@cimulate/copilot-widget 1.51.1 → 1.51.2

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 CHANGED
@@ -2,6 +2,11 @@
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.51.2 — 2026-10-19
6
+
7
+ - Successful last-item removals emit `cimulate:cart-update` with `action: "remove"`, using the agent's `cartOperation: "REMOVE"` when no previous cart is available. Both cart execution-status field names are accepted; explicit failures do not emit a cart-update event.
8
+ - Empty cart blocks no longer render a built-in cart card; the agent's accompanying message remains visible. Cart overrides still receive the empty snapshot.
9
+
5
10
  ## 1.51.1 — 2026-10-19
6
11
 
7
12
  - Scope all shipped widget CSS to the `cim-widget-` namespace so it can no longer override host-page styles. Removes three unused unprefixed rules (`.message`, `.widget-message`, `.user-message`) that leaked onto storefronts whose own markup reused those class names, and renames the `cursor-blink` keyframes to `cim-widget-cursor-blink`. A test now fails the build on any unscoped selector or unprefixed `@keyframes` in shipped CSS.
@@ -234,6 +234,7 @@ declare type CartResponseData = {
234
234
  products_to_highlight?: string[];
235
235
  cart: {
236
236
  __action_execution_status__?: "success" | "failure";
237
+ action_execution_status?: "success" | "failure";
237
238
  cartSummary: {
238
239
  cartDetails: CartDetails;
239
240
  cartOperation?: string | null;
@@ -246,29 +247,22 @@ declare type CartResponseData = {
246
247
  * cart diff, or from the agent's `cartSummary.cartOperation` (matched
247
248
  * case-insensitively) when there is no previous snapshot to diff against:
248
249
  * - `add` / `remove` / `quantity` — a single line-level change of that kind
249
- * - `add` with empty `changes` — the first cart the widget has seen (nothing to
250
- * diff against), but the agent reported `cartOperation: "add"`
250
+ * - `add` / `remove` with empty `changes` - no previous snapshot, but the agent
251
+ * reported the matching `cartOperation` (including a successful empty cart)
251
252
  * - `coupon` — only the applied-coupon set changed
252
253
  * - `mixed` — several distinct kinds of change in one turn
253
254
  * - `unknown` — a settled turn with nothing reliably diffable: no previous
254
- * snapshot (and no agent-reported add), identical carts, or a cart-mutation
255
- * reply that carried no cart block (an emptied cart and a failed edit are
256
- * indistinguishable, so the host re-fetches rather than trust a fabricated
257
- * delta)
258
- *
259
- * TODO(cart-events): reintroduce a `clear` action (and a distinct `error`
260
- * signal) once the agent returns a disambiguated response for an emptied cart
261
- * vs a failed edit — today both reply with plain markdown and no cart block, so
262
- * the widget cannot tell them apart and reports `unknown` for that turn.
255
+ * snapshot (and no agent-reported add/remove), identical carts, or an ambiguous
256
+ * cart-mutation reply with no cart block. The host must re-fetch its own cart.
263
257
  */
264
258
  export declare type CartUpdateAction = "add" | "remove" | "quantity" | "coupon" | "mixed" | "unknown";
265
259
 
266
260
  /**
267
261
  * `detail` of the `cimulate:cart-update` `CustomEvent`. `action` is the primary
268
262
  * action for the turn; `changes` is every line/coupon delta detected by diffing
269
- * the previous cart against the new one (empty when there was no cart block to
270
- * diff). `status` stays `"success"` — the event only fires for a successful
271
- * mutation — so existing listeners that read `detail.status` keep working.
263
+ * the previous cart against the new one (empty when either snapshot is missing).
264
+ * `status` stays `"success"`; ambiguous control-driven replies also use this
265
+ * status as a re-fetch nudge, but explicit failures do not emit an event.
272
266
  */
273
267
  export declare type CartUpdateDetail = {
274
268
  status: "success";
@@ -1335,11 +1329,9 @@ export declare interface SendMessageOptions {
1335
1329
  reconcileMessageId?: string;
1336
1330
  displayContent?: string;
1337
1331
  /**
1338
- * Marks a send that mutates the shared server basket (the cart card's remove /
1339
- * quantity / coupon controls). The provider fires `cimulate:cart-update` when
1340
- * such a turn settles even if the reply carries no cart block — removing the
1341
- * last item returns a plain "your cart is now empty" message with nothing to
1342
- * detect in the content.
1332
+ * Emit an `unknown` cart-update nudge when this basket-edit turn settles without
1333
+ * a cart snapshot or explicit failure. Successful cart blocks emit updates
1334
+ * independently of this flag.
1343
1335
  */
1344
1336
  cartMutation?: boolean;
1345
1337
  }