@cimulate/copilot-widget 1.31.0 → 1.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cimulate-copilot-widget.es.js +5087 -5067
- package/dist/cimulate-copilot-widget.umd.js +29 -29
- package/dist/copilot.es.js +5085 -5065
- package/dist/copilot.umd.js +29 -29
- package/dist/messaging.d.ts +35 -0
- package/dist/messaging.es.js +9376 -9268
- package/dist/messaging.umd.js +34 -34
- package/package.json +2 -2
package/dist/messaging.d.ts
CHANGED
|
@@ -349,6 +349,33 @@ export declare const eventHandlers: {
|
|
|
349
349
|
|
|
350
350
|
declare type FacetFilters = Record<string, string[]>;
|
|
351
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Retrieve a single-use auth link key for the current conversation.
|
|
354
|
+
*
|
|
355
|
+
* The host-page/script-tag counterpart of the `getAuthLinkKey` method on the
|
|
356
|
+
* messaging context (React hosts use `useMessaging().getAuthLinkKey()`). Hand
|
|
357
|
+
* the returned key to your own backend, which bridges the shopper's session
|
|
358
|
+
* (e.g. a SLAS/commerce session) into the conversation so the agent inherits
|
|
359
|
+
* the shopper's identity — and cart.
|
|
360
|
+
*
|
|
361
|
+
* Call after `injectMessagingWidget()` has mounted the widget; rejects if the
|
|
362
|
+
* widget is not yet ready or the request fails. `async` so the registry's
|
|
363
|
+
* synchronous "not ready" throw surfaces as a rejected promise (honoring the
|
|
364
|
+
* contract for `.catch()` callers, not just `await`).
|
|
365
|
+
*
|
|
366
|
+
* The key is **single-use**: each call mints a fresh key that the server
|
|
367
|
+
* invalidates once redeemed. Do not cache it or retry a rejected call with the
|
|
368
|
+
* same key — request a new one, or you will send the backend a key it already
|
|
369
|
+
* consumed.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```js
|
|
373
|
+
* const authLinkKey = await window.CimulateMessaging.getAuthLinkKey();
|
|
374
|
+
* await fetch("/bridge-session", { method: "POST", body: JSON.stringify({ authLinkKey }) });
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
export declare function getAuthLinkKey(): Promise<string>;
|
|
378
|
+
|
|
352
379
|
declare interface HeaderConfig {
|
|
353
380
|
logoUrl?: string;
|
|
354
381
|
headerText?: string;
|
|
@@ -444,6 +471,14 @@ export declare interface MessagingContextType {
|
|
|
444
471
|
retryLastMessage: () => ReturnType<SendMessage> | undefined;
|
|
445
472
|
retryConnection: () => void;
|
|
446
473
|
downloadTranscript: () => Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* Retrieve a single-use auth link key for the current conversation. The host
|
|
476
|
+
* hands the key to its own backend, which bridges the shopper's session (e.g.
|
|
477
|
+
* a SLAS/commerce session) into this conversation so the agent inherits the
|
|
478
|
+
* shopper's identity — and cart. Resolves with the key; rejects if the widget
|
|
479
|
+
* is not connected or the request fails.
|
|
480
|
+
*/
|
|
481
|
+
getAuthLinkKey: () => Promise<string>;
|
|
447
482
|
}
|
|
448
483
|
|
|
449
484
|
/**
|