Events
The widget talks to its host page. Subscribe once and route the four events wherever they belong — analytics, a cart, your own console.
const cfg = DuorEmbed.createConfigurator('kitchen-terra', el, { publicKey: 'pk_live_…',});
cfg.on('configuration.saved', ({ shortId, url, priceCents, currency }) => { analytics.track('design_saved', { shortId, priceCents });});
cfg.on('lead.created', ({ name, phone, shortId }) => { crm.createLead({ name, phone, source: 'duor', ref: shortId });});The four
Section titled “The four”| Event | When | Carries |
|---|---|---|
configuration.saved |
a design becomes a link | shortId, url, priceCents, currency |
lead.created |
somebody asks to be called | name, phone, shortId, priceCents |
ar.opened |
AR starts, on either platform | shortId, platform |
product.requested |
the cart button is pressed | bom, priceCents, currency |
product.requested is the one that puts a configuration into your own basket.
It hands you a bill of materials and a price; what you do with them is your
shop’s business.
Driving it from outside
Section titled “Driving it from outside”cfg.setLocale('ru');cfg.setCurrency('EUR');const url = await cfg.getShortUrl(); // saves, and gives you the linkcfg.destroy();Your own prices
Section titled “Your own prices”If your shop already knows what things cost, tell the widget instead of letting it work it out:
DuorEmbed.createConfigurator('kitchen-terra', el, { publicKey: 'pk_live_…', priceRequest: async (bom) => { const res = await fetch('/api/price', { method: 'POST', body: JSON.stringify(bom) }); return res.json(); // { cents, currency } },});The widget then shows your number and stops showing ours. The bill of materials underneath stays the catalogue’s arithmetic — only the total changes hands, and we do not claim a figure of yours was confirmed by our server.