HatchedDocs
ReferenceWidgets

Marketplace widget

Browse items, preview on the buddy, purchase and equip with one tap.

Mount

<div
  data-hatched-widget="marketplace"
  data-hatched-token="SESSION_OR_EMBED_TOKEN"
  data-hatched-marketplace-id="mp_default"
></div>

Attributes

AttributeValuesDefault
data-hatched-tokensession token (embed token NOT supported)required
data-hatched-marketplace-ididrequired
data-hatched-layoutgrid carouselgrid
data-hatched-categorycategory keyall
data-hatched-show-balancetrue falsetrue

Required scopes

  • marketplace:read
  • marketplace:purchase — to enable the Buy button
  • buddy:read — to show affordability and preview

Events

el.addEventListener('hatched:item-purchased', (e) => {
  toast(`Bought ${e.detail.itemName}`);
});

el.addEventListener('hatched:item-equipped', (e) => {
  // buddy widget picks this up automatically — no action needed
});

Preview-on-buddy

When the marketplace widget is mounted on the same page as a buddy widget, hovering over an item previews it on the buddy live. This uses a cross-widget messaging bus; no extra wiring needed.