Skip to main content

MarketfrontClient / MarketfrontView

The main class for integrating the Marketfront SDK.

Constructor

import { MarketfrontClient } from '@gett/marketfront';

// Get session token from your backend
const response = await fetch('/api/gett/session');
const { sessionToken } = await response.json();

// Initialize the client
const client = new MarketfrontClient({
sessionToken,
onOrderComplete: (order) => {
console.log('Order placed:', order.id);
},
});

// Mount to the DOM
client.mount('#marketfront-container');

Methods

mount / addToView

Display the marketfront in the UI.

// Mount to a CSS selector
client.mount('#container');

// Or mount to a DOM element
client.mount(document.getElementById('container'));

unmount / removeFromView

Remove the marketfront and cleanup resources.

client.unmount();