The main entry point for the TECSAFE Widget SDK. This class should only be instantiated after the user has consented to the terms, conditions, and privacy policy. The SDK will not ensure GDPR compliance itself - this task is left for the implementor to integrate into existing tools and flows.
A function that returns the customer token as a string inside a promise. It is expected that you implement a route in your backend, using your own auth method to secure API communication, and request a token from the TECSAFE API /jwt/saleschannel-customer. This function handles initial as well as consecutive token creation. If a previous token exists it must be handed in for proper session upgrading.
A function that adds product(s) to the cart. It is left tpo the implementor to chose a single or bulk processing given their frameworks prerequisites. The function will return a success status.
The SDK configuration containing tracking and regional settings for customer specific app optimization.
Internal method to trigger listeners from a widget
Creates a custom page widget.
The element to attach the widget to
OptionalcontextId: stringA custom contextID which needs to be references in TECSAFE's cockpit to provide the necessary layout context.
The custom page widget
Creates a product detail widget.
The element to attach the widget to
The articleNumber of the respectively promoted article on the PDP. Make sure to configure that article in TECSAFE's cockkpit to provide the necessary layout context.
The product detail widget
Emits a message to all widgets
The message definition
The payload to send
this
Gets the config
The config
Gets the widgets
The widgets
Stops listening to a message from any widget
The message definition
The handler to remove
this
Listens to a message from any widget
The message definition
The handler to call when the message is received
this
Listens to a message from any widget once
The message definition
The handler to call when the message is received
this
Refreshes the token and propagates it to all widget instances. If a customer's login status changes you have to notify TECSAFE about that change. The customer token API will ensure that guest assets will be transferred to registered accounts on login and that restigered customer sessions will be cleaned appropriately for a new guest session.
Optionaltoken: stringIf provided, the token to use instead of fetching a new one with the tokenFN
Sends a message to all widgets
The message to send
ProtectedtriggerTriggers all listeners for a given message type
The message type
The message envelope containing the payload
The SDK instance
The widget instance
The main entry point for the TECSAFE Widget SDK