Renders Thankly widgets into the DOM. Built on Preact; chart.js and the Google
Maps loader are imported dynamically, so only consumers that actually render a
nutrition or map view pay for them.
npm install @thankly/sdk-renderer
import { createThanklyRenderer } from '@thankly/sdk-renderer';
const renderer = createThanklyRenderer();
Widget components are also available directly via the ./widgets entry point
(thanklyWidgetFactory), along with ThanklyWidgetRenderer and the default
style builders.
The API never emits a map widget. renderMap draws a map across the
recommendation widgets you already have, so it is called explicitly rather than
dispatched from a widget type. Looking for map in the widget union is a dead
end — it was removed deliberately.
Catalog recommendations and virtual try-on views use nativeOffer when the
property is present. Decimal strings keep their exact precision, including
original prices. Purchase links use the offer's selected market URL. Null,
unavailable, malformed, or expired terms show “Check retailer for price” and
never fall back to legacy amounts or URLs. An expired offer can retain its own
valid HTTPS market link.
Try-on totals require available prices in a single currency and use exact decimal
addition. Products without nativeOffer continue to use legacy product terms.
Offer expiry is checked whenever a view renders; hosts should refresh catalog
terms before checkout.
Full API reference: https://docs.thankly.ai/js
Apache-2.0
Native offers own their amounts, currency and purchase links. Cards hide amounts
when their validity expires. Pass RenderOptions.signal and abort it when removing
a rendered widget to release its expiry timers.
Try-on widgets accept purchaseContext for read-only product hydration. They
refresh native terms at expiry, ignore aborted responses and preserve selected
product IDs when an offer disappears. Remount with the new purchase context and
saved selection state when the host changes markets. Cached native terms are
withheld until hydrated; refreshes do not generate new recommendations.