@cimulate/copilot-widget 1.54.2 → 1.55.0
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 +4 -0
- package/README.md +31 -0
- package/dist/messaging.d.ts +15 -0
- package/dist/messaging.es.js +8980 -8914
- package/dist/messaging.umd.js +30 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
`@cimulate/copilot-widget` follows [Semantic Versioning](https://semver.org/). Each entry is a released `package.json` version (deployed on merge to `master`), newest first.
|
|
4
4
|
|
|
5
|
+
## 1.55.0 — 2026-11-06
|
|
6
|
+
|
|
7
|
+
- Messaging mode: `eventHandlers.cart.update` updates the latest cart message in the chat and does not emit `cimulate:cart-update`. The next agent cart result is compared with that basket. Cart messages restored while the conversation is resuming do not emit `cimulate:cart-update`.
|
|
8
|
+
|
|
5
9
|
## 1.54.2 — 2026-11-05
|
|
6
10
|
|
|
7
11
|
- Carousel tiles no longer strike through a compare price that displays the same amount as the current price.
|
package/README.md
CHANGED
|
@@ -203,6 +203,37 @@ With `messagingConfig.enablePageContext`, the widget snapshots the page context
|
|
|
203
203
|
|
|
204
204
|
The optional PDP `display` fields set the product chip and divider's name and image. SRP context shows a removable chip with a search icon and `Search: "query"`; its divider uses the same label. Only one context chip is shown at a time. Removing either chip clears page context, so the next message has no context or divider. The chip remains visible for later messages on the same product or search query. Setting SRP context replaces the PDP chip, and setting PDP context replaces the SRP chip.
|
|
205
205
|
|
|
206
|
+
### Messaging Cart
|
|
207
|
+
|
|
208
|
+
Messaging integrations push the shopper's current basket with `eventHandlers.cart.update`. Call it from the messaging entry only: `window.CimulateMessaging.eventHandlers.cart.update(cart)` on the CDN, or the NPM import below. The Copilot entry does not expose it.
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
import { eventHandlers } from "@cimulate/copilot-widget/messaging";
|
|
212
|
+
|
|
213
|
+
eventHandlers.cart.update({
|
|
214
|
+
id: "cart-1",
|
|
215
|
+
currencyCode: "USD",
|
|
216
|
+
subtotal: 90,
|
|
217
|
+
total: 90,
|
|
218
|
+
items: [
|
|
219
|
+
{
|
|
220
|
+
itemId: "line-1",
|
|
221
|
+
productId: "SKU-1",
|
|
222
|
+
name: "Men's Rovereto Running Shoes",
|
|
223
|
+
imageUrl: "https://store.example.com/products/shoes.jpg",
|
|
224
|
+
quantity: 1,
|
|
225
|
+
itemSubtotal: 90,
|
|
226
|
+
originalSubtotal: 90,
|
|
227
|
+
variants: [{ lbl: "Color", type: "color", value: "Black / White" }],
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The object is the full basket (`CartDetails`), not a quantity stub. An empty `items` array means an empty cart. A payload without an `items` array is ignored. A call before the widget is mounted is ignored.
|
|
234
|
+
|
|
235
|
+
Call it after the widget is mounted, on page load, after the shopper changes the basket outside the widget, and again after a restored conversation. The latest cart message in the chat updates to that basket. Older cart messages stay as they were. The call does not emit `cimulate:cart-update`. The next agent cart result is compared with that basket.
|
|
236
|
+
|
|
206
237
|
## Linting and pre-commit hooks
|
|
207
238
|
|
|
208
239
|
Lint and format locally with the npm scripts:
|
package/dist/messaging.d.ts
CHANGED
|
@@ -532,6 +532,9 @@ export declare const eventHandlers: {
|
|
|
532
532
|
get: typeof getPageContext;
|
|
533
533
|
clear: typeof clearPageContext;
|
|
534
534
|
};
|
|
535
|
+
cart: {
|
|
536
|
+
update: typeof updateCart;
|
|
537
|
+
};
|
|
535
538
|
};
|
|
536
539
|
|
|
537
540
|
declare type FacetFilters = Record<string, string[]>;
|
|
@@ -1510,6 +1513,18 @@ declare type ToolResultsResponse = {
|
|
|
1510
1513
|
data: unknown;
|
|
1511
1514
|
};
|
|
1512
1515
|
|
|
1516
|
+
/**
|
|
1517
|
+
* Show the storefront's current basket on the latest cart message.
|
|
1518
|
+
* Pass the full basket. `items` is required; an empty array means an empty cart.
|
|
1519
|
+
* A payload without an `items` array is ignored.
|
|
1520
|
+
*
|
|
1521
|
+
* Call from the messaging entry after the widget is mounted, on page load and
|
|
1522
|
+
* after the shopper changes the basket outside the widget, and again after a
|
|
1523
|
+
* restored conversation. Older cart messages stay as they were. A call before
|
|
1524
|
+
* the widget is mounted is ignored. Does not emit `cimulate:cart-update`.
|
|
1525
|
+
*/
|
|
1526
|
+
declare function updateCart(cart: CartDetails): void;
|
|
1527
|
+
|
|
1513
1528
|
export declare function useMessaging(): MessagingContextType;
|
|
1514
1529
|
|
|
1515
1530
|
declare interface WidgetComponentConfig {
|