@cimulate/copilot-widget 1.55.8 → 1.57.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 CHANGED
@@ -2,6 +2,23 @@
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.57.0 — 2026-11-16
6
+
7
+ - Return a dedicated transcript class without a generic theme activation class; preserve Legacy compatibility and scope enhanced styling to Commerce.
8
+
9
+ - Preserve pre-recipe Legacy defaults and flat theme objects through an isolated compatibility path.
10
+
11
+ - Default Commerce to neutral surfaces and charcoal controls; use independent orange tokens for selected product variants.
12
+
13
+ - Export injection-ready default theme recipes; keep display copy outside theme presets and move product fixtures to Storybook.
14
+ - Add object-only Legacy and Commerce theme recipes with density, shape, elevation, and token overrides on the existing theme API.
15
+ - Remove the obsolete layout preset option; select Commerce through the theme object.
16
+ - Resolve structural variants in the shared configuration provider; retain legacy theme fields.
17
+
18
+ ## 1.56.0 — 2026-11-16
19
+
20
+ - Messaging dialog and modal can show a custom row under the title bar. Register a `SubHeader` override with the tag name of a custom element. The row is omitted when the key is unset. The element receives an empty payload and the shared override api, including `sendMessage`.
21
+
5
22
  ## 1.55.8 — 2026-11-12
6
23
 
7
24
  - Keyboard focus on every widget control now shows a 3px outline in the widget primary color, including controls that previously cleared the browser outline.
@@ -122,7 +139,6 @@
122
139
 
123
140
  ## 1.51.0 — 2026-10-16
124
141
 
125
- - Add an optional `layoutPreset` configuration property (`"standard" | "commerce"`) to support toggling between the classic widget layout and the premium commerce visual layout (featuring unified result cards, custom rounded composer groups, and padded boundaries).
126
142
  - Integrate the sparkles loader as the default connecting indicator for the commerce layout preset.
127
143
  - Wire CSS custom variables dynamically with layout-preset fallback default values (such as `#db665e` and `0.75rem` for `"commerce"`), while prioritizing custom client JSON theme overrides.
128
144
 
package/README.md CHANGED
@@ -63,6 +63,9 @@ npm start
63
63
 
64
64
  Simulates a React environment. Faster for local development because Vite serves source via hot-module replacement — no full build is required, and changes reflect instantly in the browser. This is the most appropriate testing playground for customers who will integrate the widget in a React-based storefront.
65
65
 
66
+ Configure the live Agentforce deployment in the `messagingConfig` fields of
67
+ `src/App.tsx`. The connection fields are intentionally empty by default.
68
+
66
69
  Settings are in `src/App.tsx`. Example configurations you can modify:
67
70
 
68
71
  ```tsx
@@ -214,6 +217,415 @@ With `messagingConfig.enablePageContext`, the widget snapshots the page context
214
217
 
215
218
  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.
216
219
 
220
+ ### Preset themes and recipes
221
+
222
+ The SDK's `theme` property accepts a recipe object or the existing flat theme object.
223
+ The default Legacy object includes `density: "compact"`, `shape: "sharp"`, and
224
+ `elevation: "flat"`. Legacy remains the default. Presets and custom recipes use the same stylesheet; they do
225
+ not require a theme-specific CSS file or a runtime theme download.
226
+
227
+ ```ts
228
+ const theme = {
229
+ preset: "commerce" as const,
230
+ density: "comfortable" as const,
231
+ shape: "round" as const,
232
+ elevation: "raised" as const,
233
+ };
234
+ ```
235
+
236
+ Pass that value to `theme` on React widgets/providers or `injectMessagingWidget`.
237
+ For SFCC, pass the same object as `cc_config.cc_theme`.
238
+
239
+ Both the Messaging and Copilot SDK entry points export `themes.legacy` and
240
+ `themes.commerce` as frozen, injection-ready default recipes. Spread a recipe to
241
+ customize it; the internal preset documents are not public injection configs.
242
+
243
+ ```tsx
244
+ import { AgentForceWidget, themes } from "@cimulate/copilot-widget/messaging";
245
+
246
+ const customTheme = {
247
+ ...themes.commerce,
248
+ tokens: { ...themes.commerce.tokens, primary: "#6d28d9", secondary: "#5b21b6" },
249
+ };
250
+
251
+ export function ShoppingAssistant() {
252
+ return (
253
+ <AgentForceWidget
254
+ mode="messaging"
255
+ theme={customTheme}
256
+ messagingConfig={{
257
+ scrt2Url: "https://your-deployment.salesforce-scrt.com",
258
+ orgId: "your-org-id",
259
+ esDeveloperName: "your-deployment-name",
260
+ }}
261
+ />
262
+ );
263
+ }
264
+ ```
265
+
266
+ The same `customTheme` can be passed to `injectMessagingWidget({ ...config,
267
+ theme: customTheme })`. The React playground passes its selected recipe directly
268
+ to `AgentForceWidget.theme`. Component examples live in Storybook under
269
+ **Theming/Product components**, with Legacy, Commerce, and Custom stories and
270
+ controls for preset, density, shape, elevation, and tokens.
271
+
272
+ Themes control appearance and structure, not wording. Continue to supply
273
+ connection copy through `messagingConfig.connectingMessages` and header content
274
+ through `headerConfig`. This change does not introduce a localization API.
275
+
276
+ The new Commerce default follows a neutral white/gray/charcoal appearance. Orange
277
+ is reserved for selected product variants. The Custom playground option is a
278
+ purple recipe based on Commerce, not a third built-in preset.
279
+
280
+ #### Supported recipe properties
281
+
282
+ | Property | Accepted values | If omitted |
283
+ | ----------- | ----------------------------------------- | ----------------------------------- |
284
+ | `preset` | `"legacy"`, `"commerce"` | Legacy |
285
+ | `density` | `"compact"`, `"comfortable"` | The preset's density |
286
+ | `shape` | `"sharp"`, `"soft"`, `"round"` | The preset's shape |
287
+ | `elevation` | `"flat"`, `"raised"` | The preset's elevation |
288
+ | `tokens` | Object containing supported visual tokens | Inherit the preset and trait values |
289
+
290
+ `custom` is a playground label, not a preset name. A custom theme is a recipe based
291
+ on either `legacy` or `commerce`. Any density, shape, and elevation can be combined
292
+ with either preset: 24 explicit combinations, plus individual token overrides.
293
+
294
+ | Preset | Default density | Default shape | Default elevation | Main appearance |
295
+ | ---------- | --------------- | ------------- | ----------------- | ----------------------------------------------------------------------------- |
296
+ | `legacy` | `compact` | `sharp` | `flat` | Existing standard widget appearance |
297
+ | `commerce` | `comfortable` | `round` | `raised` | White/gray surfaces, charcoal controls and messages, orange selected variants |
298
+
299
+ The Legacy row describes its recipe defaults. Bare Legacy and old flat objects
300
+ retain their original CSS and rendering; these scales are not forcibly applied to
301
+ existing customers. Explicit Legacy traits that match these defaults preserve
302
+ compatibility rendering. A different trait value or any `tokens` object opts into
303
+ recipe resolution. Full component-specific radius, shadow, spacing, and control
304
+ styling is scoped to the Commerce transcript. A custom Legacy recipe keeps grouped
305
+ structure and applies variables only where existing Legacy CSS consumes them; it
306
+ does not gain every Commerce visual effect. Use Commerce for full visual recipe
307
+ customization.
308
+
309
+ #### Density: spacing and control sizes
310
+
311
+ Density changes spacing and sizing tokens, not colors, icons, or message structure.
312
+ Choose `compact` for tighter layouts and `comfortable` for more breathing room.
313
+
314
+ | Token / surface | `compact` | `comfortable` |
315
+ | ---------------------------------------------- | ---------------------- | ------------- |
316
+ | `transcriptPadding` — conversation padding | `1rem` | `1.25rem` |
317
+ | `cardPadding` — transcript card padding | `0.75rem` | `1.25rem` |
318
+ | `transcriptGap` — gap between transcript items | `0.5rem` | `1rem` |
319
+ | `carouselGap` — gap between carousel items | `0.5rem` | `12px` |
320
+ | `headerHeight` — header sizing | `auto` (content-based) | `3.875rem` |
321
+ | `controlSize` — supported input/button sizing | `2.25rem` | `2.75rem` |
322
+
323
+ `mobileTranscriptPadding` defaults to `1rem` for both densities. Setting an explicit
324
+ `transcriptPadding` token also sets the mobile value unless
325
+ `mobileTranscriptPadding` is supplied separately. Sizes in `rem` scale with the
326
+ host page's root font size. These tokens affect the surfaces that consume them;
327
+ density does not resize every icon or every product control uniformly.
328
+
329
+ #### Shape: corners by surface
330
+
331
+ Shape is a radius scale, not a single global radius. It does not change the widget's
332
+ structure. The selected-variant color is independent of shape.
333
+
334
+ | Token / surface | `sharp` | `soft` | `round` |
335
+ | -------------------------------------------- | --------- | ---------- | -------------- |
336
+ | `cardRadius` — cards | `0.25rem` | `0.5rem` | `0.75rem` |
337
+ | `controlRadius` — supported controls | `0.25rem` | `0.375rem` | `0.75rem` |
338
+ | `composerRadius` — composer | `0.25rem` | `0.5rem` | `999px` (pill) |
339
+ | `chipRadius` — suggestions and variant chips | `0.25rem` | `0.5rem` | `999px` (pill) |
340
+ | `mediaRadius` — media surfaces | `0.25rem` | `0.375rem` | `0.75rem` |
341
+
342
+ Override individual radius tokens to mix shapes, for example round cards with a
343
+ rectangular composer. In a recipe, the older top-level `borderRadius` field takes
344
+ priority and sets all five radius tokens; use individual tokens for independent
345
+ control.
346
+
347
+ #### Elevation: shadows
348
+
349
+ | Token / surface | `flat` | `raised` |
350
+ | ---------------- | ------ | ------------------------------------------------------- |
351
+ | `cardShadow` | `none` | `0 1px 2px #0000000d` |
352
+ | `headerShadow` | `none` | `0 1px 1px -1px #17171b08, 0 14px 30px -20px #17171b1a` |
353
+ | `launcherShadow` | `none` | `0 4px 6px #00000040, 0 1px 3px #00000050` |
354
+
355
+ `flat` also sets `launcherAnimation` to `none`. `raised` supplies shadows; it does
356
+ not independently enable animation. Commerce supplies its launcher pulse, while
357
+ Legacy does not. Recipe launcher animations respect reduced-motion preferences.
358
+ Providing a custom `launcherShadow` disables the preset animation unless an
359
+ explicit `launcherAnimation` is also supplied.
360
+
361
+ #### What the preset changes structurally
362
+
363
+ These behaviors are selected by the preset; density, shape, and elevation do not
364
+ switch them. There is no public `variants` property on the recipe.
365
+
366
+ | Behavior | Legacy | Commerce |
367
+ | ----------------------------------- | ---------------- | -------------------- |
368
+ | Transcript | Grouped messages | Unified result cards |
369
+ | Connecting indicator | Pulse | Sparkles |
370
+ | Cart quantity control | Input | Stepper |
371
+ | Messaging carousel navigation | Chevron | Circle-arrow |
372
+ | Header logo when no URL is provided | None | Sparkle |
373
+ | User-message icon | Visible | Hidden |
374
+
375
+ Compatibility targets published SDK `1.53.0`, the cartridge's existing SDK baseline.
376
+
377
+ #### Colors, selection, and hover behavior
378
+
379
+ Primary is the main interaction color, used by message bubbles, logo backgrounds,
380
+ the launcher, links, and many action buttons. Secondary supplies hover or alternate
381
+ interaction colors on the surfaces that consume it. Some controls have dedicated
382
+ tokens, so primary and secondary are not universal overrides for every button.
383
+
384
+ | Surface / state | Default Commerce value | Override token |
385
+ | ------------------------------------------- | ---------------------- | ----------------------------- |
386
+ | User-message background and primary actions | `#3a3a3a` | `primary` |
387
+ | Action/suggestion hover color | `#2d2d2d` | `secondary` |
388
+ | Body text | `#3e3e3c` | `text` |
389
+ | Card/panel surface | `#ffffff` | `surface` |
390
+ | Conversation canvas | `#fcfcfc` | `canvas` |
391
+ | Borders | `#e8e8e8` | `border` |
392
+ | Unselected variant background | `#f5f5f5` | `subtle` |
393
+ | Unselected variant hover border | `#3a3a3a` | `primary` |
394
+ | Selected variant background | `#e87524` | `variantSelection` |
395
+ | Selected variant hover background | `#d96616` | `variantSelectionHover` |
396
+ | Selected variant text | `#181818` | `variantSelectionText` |
397
+ | Selected variant border / swatch outline | `#e87524` | `variantSelectionBorder` |
398
+ | Selected variant-chip hover border | `#d96616` | `variantSelectionHoverBorder` |
399
+ | Send button | `#111111` | `sendBackground` |
400
+ | Send button hover | `#333333` | `sendHoverBackground` |
401
+ | Empty composer send background | `#e8e8e8` | `sendIdleBackground` |
402
+ | Empty composer send foreground | `#767676` | `sendIdleForeground` |
403
+
404
+ Changing primary and secondary to purple does not change selected variants: they
405
+ remain orange unless the selection tokens are overridden. Variant chips represent
406
+ a persistent selection; ordinary action buttons do not gain a selected state from
407
+ the theme. The empty-composer colors apply when there is no text or attachment;
408
+ these visual tokens do not enable or disable sending.
409
+
410
+ #### Recipes to copy
411
+
412
+ The following objects are theme values. In SFCC, put the selected value under
413
+ `cc_config.cc_theme`. In React or script-tag injection, put it under `theme`.
414
+ Omitted tokens inherit their values; a full token object is not required.
415
+
416
+ Default Legacy, preserving compatibility:
417
+
418
+ ```json
419
+ {
420
+ "preset": "legacy",
421
+ "density": "compact",
422
+ "shape": "sharp",
423
+ "elevation": "flat"
424
+ }
425
+ ```
426
+
427
+ Default neutral Commerce, including orange selected variants:
428
+
429
+ ```json
430
+ {
431
+ "preset": "commerce",
432
+ "density": "comfortable",
433
+ "shape": "round",
434
+ "elevation": "raised"
435
+ }
436
+ ```
437
+
438
+ Compact, angular Commerce without shadows:
439
+
440
+ ```json
441
+ {
442
+ "preset": "commerce",
443
+ "density": "compact",
444
+ "shape": "sharp",
445
+ "elevation": "flat"
446
+ }
447
+ ```
448
+
449
+ The playground's purple custom recipe, keeping Commerce's orange selection:
450
+
451
+ ```json
452
+ {
453
+ "preset": "commerce",
454
+ "density": "compact",
455
+ "shape": "soft",
456
+ "elevation": "flat",
457
+ "tokens": {
458
+ "primary": "#6d28d9",
459
+ "secondary": "#5b21b6",
460
+ "fontFamily": "Arial, sans-serif"
461
+ }
462
+ }
463
+ ```
464
+
465
+ Legacy structure with custom colors and fonts:
466
+
467
+ ```json
468
+ {
469
+ "preset": "legacy",
470
+ "tokens": {
471
+ "primary": "#123456",
472
+ "secondary": "#654321",
473
+ "fontFamily": "Arial, sans-serif"
474
+ }
475
+ }
476
+ ```
477
+
478
+ Independent card/composer corners and selection colors:
479
+
480
+ ```json
481
+ {
482
+ "preset": "commerce",
483
+ "tokens": {
484
+ "cardRadius": "1rem",
485
+ "composerRadius": "0.25rem",
486
+ "variantSelection": "#e87524",
487
+ "variantSelectionHover": "#d96616",
488
+ "variantSelectionText": "#181818",
489
+ "variantSelectionBorder": "#e87524",
490
+ "variantSelectionHoverBorder": "#d96616"
491
+ }
492
+ }
493
+ ```
494
+
495
+ #### Complete token reference
496
+
497
+ Token values are CSS value strings, such as `"#123456"`, `"0.5rem"`, `"Arial,
498
+ sans-serif"`, or `"none"`. Numeric `0` is also accepted for zero-compatible values.
499
+ Use strings for nonzero lengths and font weights, for example `"400"`. Names are
500
+ case-sensitive. Unknown token names, blank values, and unsupported value types are
501
+ ignored. Nonempty strings still need to be valid CSS for their target property;
502
+ the resolver does not validate CSS syntax or guarantee contrast for custom colors.
503
+
504
+ Colors and typography:
505
+
506
+ | Token | Controls |
507
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
508
+ | `primary` | Main interaction color |
509
+ | `secondary` | Alternate/hover interaction color |
510
+ | `text` | Main text color, not text content |
511
+ | `fontFamily` | Widget font stack |
512
+ | `productFontFamily` | Product typography independently of the widget font |
513
+ | `surface` | Main card/panel background |
514
+ | `canvas` | Conversation background |
515
+ | `border` | Surface and control borders |
516
+ | `muted` | Supporting text and placeholder color |
517
+ | `subtle` | Subtle backgrounds, including unselected variants |
518
+ | `inputBorder` | Input/composer borders; defaults to `#767676`. An explicit `inputBorderColor` takes precedence, then `tokens.inputBorder`, then explicit border colors. |
519
+ | `outline` | Neutral control outlines |
520
+ | `foreground` | Foreground color on surfaces that consume it |
521
+ | `onPrimary` | Contrasting foreground on supported primary-colored controls/icons |
522
+ | `focus` | Recipe focus-indicator color on supported controls |
523
+
524
+ Selection, composer, and connecting indicator:
525
+
526
+ | Token | Controls |
527
+ | ----------------------------- | ---------------------------------------------- |
528
+ | `variantSelection` | Selected variant background |
529
+ | `variantSelectionHover` | Selected variant hover background |
530
+ | `variantSelectionText` | Selected variant text |
531
+ | `variantSelectionBorder` | Selected variant border and swatch outline |
532
+ | `variantSelectionHoverBorder` | Selected variant-chip hover border |
533
+ | `sendBackground` | Send-button background |
534
+ | `sendHoverBackground` | Send-button hover background |
535
+ | `sendIdleBackground` | Empty-composer send-button background |
536
+ | `sendIdleForeground` | Empty-composer send-button foreground |
537
+ | `loaderStart` | Start color of the connecting sparkle gradient |
538
+ | `loaderEnd` | End color of the connecting sparkle gradient |
539
+
540
+ Radii, spacing, sizing, and elevation:
541
+
542
+ | Token | Controls |
543
+ | ------------------------- | ------------------------------- |
544
+ | `cardRadius` | Card corners |
545
+ | `controlRadius` | Supported control corners |
546
+ | `composerRadius` | Composer corners |
547
+ | `chipRadius` | Suggestion/variant-chip corners |
548
+ | `mediaRadius` | Media corners |
549
+ | `transcriptPadding` | Conversation padding |
550
+ | `mobileTranscriptPadding` | Mobile conversation padding |
551
+ | `cardPadding` | Transcript card padding |
552
+ | `transcriptGap` | Transcript item spacing |
553
+ | `carouselGap` | Carousel item spacing |
554
+ | `headerHeight` | Header sizing |
555
+ | `controlSize` | Supported input/button sizing |
556
+ | `cardShadow` | Card shadow |
557
+ | `headerShadow` | Header shadow |
558
+ | `launcherShadow` | Launcher shadow |
559
+ | `launcherAnimation` | Launcher CSS animation value |
560
+
561
+ Header appearance:
562
+
563
+ | Token | Controls |
564
+ | ------------------ | ------------------------------------------- |
565
+ | `headerBackground` | Header background color |
566
+ | `headerText` | Header text **color**, not the title string |
567
+ | `headerFontSize` | Header title font size |
568
+ | `headerFontWeight` | Header title weight as a string |
569
+ | `headerFontFamily` | Header title font stack |
570
+
571
+ Commerce inherits `fontFamily: "inherit"`; its product font defaults to Source Sans
572
+ Pro with the widget font as fallback. In recipes, explicitly setting `fontFamily`
573
+ also applies that choice to product text unless `productFontFamily` is supplied.
574
+ Existing top-level legacy visual fields have higher priority than tokens.
575
+
576
+ #### Resolution, ownership, and compatibility
577
+
578
+ Recipe values are applied in this order; later values win:
579
+
580
+ 1. Preset defaults, including default traits and structural variants.
581
+ 2. The selected density, shape, and elevation scales.
582
+ 3. Supported `tokens` overrides.
583
+ 4. Existing top-level visual fields, such as `primaryColor` and `borderRadius`.
584
+ 5. Explicit header visual fields, on the header only.
585
+
586
+ Keep title text and logo URL in `headerConfig`, composer content and button type in
587
+ `searchConfig`, and disclaimer content in its existing configuration field. In
588
+ SFCC these are `cc_headerConfig`/`cc_headerText`, `cc_searchConfig`, and
589
+ `cc_disclaimerMarkdown`. The theme does not translate content, change cart
590
+ permissions, or enable functionality such as image upload.
591
+
592
+ | Input | Behavior |
593
+ | ------------------------------------------------ | ------------------------------------------- |
594
+ | Omitted theme | Original Legacy rendering |
595
+ | `{ "preset": "legacy" }` | Original Legacy rendering |
596
+ | Existing flat theme object | Original rendering with the same overrides |
597
+ | `{ "preset": "commerce" }` | New neutral Commerce preset |
598
+ | Legacy object with nondefault traits or `tokens` | Recipe variables; Legacy CSS consumers only |
599
+
600
+ The full Legacy default object preserves the same rendering as a bare Legacy
601
+ configuration. Existing customers can keep their current flat object unchanged. Numeric-zero radius and old empty-field fallbacks
602
+ remain supported. Compatibility and recipe styles remain isolated in the same
603
+ mode stylesheet.
604
+
605
+ The supported flat-object fields and their original Legacy defaults are:
606
+
607
+ ```json
608
+ {
609
+ "primaryColor": "#3182ce",
610
+ "secondaryColor": "#2c5282",
611
+ "fontColor": "#1a202c",
612
+ "fontFamily": "inherit",
613
+ "backgroundColor": "#ffffff",
614
+ "borderColor": "#dddddd",
615
+ "inputBorderColor": "#767676",
616
+ "borderRadius": "0.25rem"
617
+ }
618
+ ```
619
+
620
+ At the SDK boundary, an unknown preset name falls back to Legacy, invalid trait
621
+ values retain the preset's defaults, and unknown token names are ignored. The
622
+ cartridge accepts only objects for `cc_theme`; string values are invalid and
623
+ invalid field values use its normal defaults. Do not rely on invalid values to
624
+ select a look.
625
+
626
+ TypeScript contracts are in `src/themes/types.ts`; preset values are in
627
+ `src/themes/presets.ts`; exact trait scales are in `src/themes/traits.ts`.
628
+
217
629
  ### Messaging Cart
218
630
 
219
631
  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.