@gengage/assistant-fe 0.3.21 → 0.3.23

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.
Files changed (52) hide show
  1. package/README.md +18 -6
  2. package/dist/chat/catalog.d.ts +11 -1
  3. package/dist/chat/components/ChatDrawer.d.ts +5 -0
  4. package/dist/chat/components/PhotoAnalysisCard.d.ts +14 -7
  5. package/dist/chat/types.d.ts +14 -1
  6. package/dist/chat-BOkLnT1i.cjs +93 -0
  7. package/dist/{chat-yAf9OADM.js → chat-DBJ8ZWch.js} +1807 -1737
  8. package/dist/chat.cjs +1 -1
  9. package/dist/chat.iife.js +26 -26
  10. package/dist/chat.js +1 -1
  11. package/dist/common/client.d.ts +4 -0
  12. package/dist/common/config-schema.d.ts +4 -0
  13. package/dist/common/overlay.d.ts +4 -0
  14. package/dist/common/widget-base.d.ts +6 -0
  15. package/dist/common-0GWnpStO.cjs +1 -0
  16. package/dist/{common-C8NRcP7O.js → common-BJZB1LIH.js} +35 -26
  17. package/dist/common.cjs +1 -1
  18. package/dist/common.js +6 -6
  19. package/dist/{connection-warning-CVZzlGJt.js → connection-warning-CHHi3BAf.js} +1 -1
  20. package/dist/{connection-warning-CL1CReZo.cjs → connection-warning-YQiIRXrz.cjs} +1 -1
  21. package/dist/{ga-datalayer-DkfsAHf9.cjs → ga-datalayer-BVppFxqk.cjs} +1 -1
  22. package/dist/{ga-datalayer-CgI6Kb_i.js → ga-datalayer-BwxWX-cr.js} +35 -32
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.js +9 -9
  25. package/dist/{native-webview-B8vOoxns.js → native-webview-111Or6o1.js} +72 -69
  26. package/dist/native-webview-BePZBK3U.cjs +1 -0
  27. package/dist/native.cjs +1 -1
  28. package/dist/native.iife.js +11 -11
  29. package/dist/native.js +1 -1
  30. package/dist/{qna-YSaIDxjs.js → qna-DXCQtwLq.js} +3 -3
  31. package/dist/{qna-KizG_W1J.cjs → qna-DwG8AJJf.cjs} +1 -1
  32. package/dist/qna.cjs +1 -1
  33. package/dist/qna.iife.js +1 -1
  34. package/dist/qna.js +1 -1
  35. package/dist/{schemas-B6RjqKrg.cjs → schemas-B7jnyzQI.cjs} +1 -1
  36. package/dist/{schemas-PkedCk_-.js → schemas-CTbgsvNJ.js} +1 -1
  37. package/dist/simbut/index.d.ts +3 -0
  38. package/dist/{simbut-BI054QK0.js → simbut-BBXTlzOg.js} +28 -20
  39. package/dist/simbut-D_ycY_MQ.cjs +1 -0
  40. package/dist/simbut.cjs +1 -1
  41. package/dist/simbut.iife.js +8 -8
  42. package/dist/simbut.js +1 -1
  43. package/dist/{simrel-C-DKpfVB.js → simrel-DP2EMyua.js} +3 -3
  44. package/dist/{simrel-vL0woDkE.cjs → simrel-DdP4lur9.cjs} +1 -1
  45. package/dist/simrel.cjs +1 -1
  46. package/dist/simrel.iife.js +1 -1
  47. package/dist/simrel.js +1 -1
  48. package/package.json +1 -1
  49. package/dist/chat-CuPO9t-Z.cjs +0 -93
  50. package/dist/common-BzegEdJs.cjs +0 -1
  51. package/dist/native-webview-D2lDXTh3.cjs +0 -1
  52. package/dist/simbut-B2jXtckF.cjs +0 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![tests](https://img.shields.io/badge/tests-passing-brightgreen)]()
5
5
  [![license](https://img.shields.io/badge/license-source--available-blue)](LICENSE)
6
6
 
7
- Embeddable AI shopping assistant widgets for e-commerce — **chat**, **contextual Q&A**, and **similar products** — built with vanilla TypeScript, zero framework dependencies.
7
+ Embeddable AI shopping assistant widgets for e-commerce — **chat**, **contextual Q&A**, **similar products**, and an optional **find-similar PDP image overlay** — built with vanilla TypeScript, zero framework dependencies.
8
8
 
9
9
  > Backend services require a [gengage.ai](https://gengage.ai) subscription.
10
10
  > See [LEGAL.md](./LEGAL.md) and [TRADEMARKS.md](./TRADEMARKS.md).
@@ -16,10 +16,10 @@ Embeddable AI shopping assistant widgets for e-commerce — **chat**, **contextu
16
16
  ### CDN Script Tag (fastest)
17
17
 
18
18
  ```html
19
- <script src="https://unpkg.com/@gengage/assistant-fe/dist/gengage-assistant.iife.js"></script>
19
+ <script src="https://unpkg.com/@gengage/assistant-fe/dist/chat.iife.js"></script>
20
20
  <script>
21
- GengageAssistant.initFromConfig({
22
- version: '1',
21
+ const chat = new window.Gengage.GengageChat();
22
+ chat.init({
23
23
  accountId: 'YOUR_ACCOUNT_ID',
24
24
  middlewareUrl: 'https://YOUR_BACKEND_URL',
25
25
  });
@@ -57,6 +57,7 @@ await chat.init({
57
57
  chat: { variant: 'floating' },
58
58
  qna: { mountTarget: '#qna-section' },
59
59
  simrel: { mountTarget: '#similar-products' },
60
+ simbut: { mountTarget: '#product-gallery' },
60
61
  });
61
62
  </script>
62
63
  ```
@@ -87,6 +88,7 @@ See [docs/native-mobile-sdk.md](docs/native-mobile-sdk.md) for iOS WKWebView, An
87
88
  | **Chat** | `@gengage/assistant-fe/chat` | Floating AI drawer with streaming responses, product cards, comparison tables |
88
89
  | **QNA** | `@gengage/assistant-fe/qna` | Contextual action buttons for product pages |
89
90
  | **SimRel** | `@gengage/assistant-fe/simrel` | AI-powered similar/related product grid |
91
+ | **SimBut** | `@gengage/assistant-fe/simbut` | PDP image-overlay pill that opens a `findSimilar` flow for the current product |
90
92
  | **Native** | `@gengage/assistant-fe/native` | Android/iOS WebView bridge + overlay bootstrap |
91
93
 
92
94
  ---
@@ -102,9 +104,11 @@ chat.init({
102
104
 
103
105
  **Component overrides** — swap any UI component via the json-render registry.
104
106
 
107
+ **SimBut customization** — use theme tokens, `i18n.findSimilarLabel`, and `onFindSimilar` for the PDP image-overlay pill.
108
+
105
109
  **Full fork** — replace `src/chat/components/` entirely; keep `catalog.ts` + `index.ts`.
106
110
 
107
- See [CUSTOMIZATION-GUIDE.md](CUSTOMIZATION-GUIDE.md) for the full playbook.
111
+ See [docs/customization.md](docs/customization.md) for the fork and merchant-customization playbook.
108
112
 
109
113
  ---
110
114
 
@@ -117,6 +121,7 @@ npm run typecheck # TypeScript strict check
117
121
  npm run test # Unit tests
118
122
  npm run build # Build to dist/
119
123
  npm run catalog # Visual component catalog at :3002
124
+ npm run docs:build # Build contributor docs with VitePress
120
125
  ```
121
126
 
122
127
  **Using a local backend:**
@@ -137,14 +142,20 @@ MIDDLEWARE_URL=http://localhost:7860 npm run dev -- koctascomtr --sku=1000465056
137
142
 
138
143
  | Doc | Description |
139
144
  |-----|-------------|
145
+ | [Docs Index](docs/index.md) | Full documentation map |
146
+ | [API Reference](docs/api-reference.md) | Public entry points and config surfaces |
140
147
  | [Architecture](docs/architecture.md) | System design, widget lifecycle, data flows |
141
148
  | [Wire Protocol](docs/wire-protocol.md) | Backend NDJSON streaming contract |
142
149
  | [Customization](docs/customization.md) | CSS tokens, component overrides, XSS rules |
150
+ | [i18n](docs/i18n.md) | Locale resolution and string overrides |
151
+ | [Error Handling](docs/error-handling.md) | Offline, retry, and recovery behavior |
143
152
  | [GTM Quickstart](docs/gtm-quickstart.md) | Copy-paste GTM embedding patterns |
144
153
  | [Security](docs/security-production.md) | Production CSP, postMessage origins, sanitization |
145
154
  | [Analytics](docs/analytics-contract.md) | Event taxonomy and attribution |
146
155
  | [Mobile SDK](docs/native-mobile-sdk.md) | Android/iOS/React Native integration |
147
156
  | [New Account](docs/new-account-guide.md) | Adding a new merchant demo |
157
+ | [AGENTS](AGENTS.md) | Coding-agent architecture and code-path index |
158
+ | [Contributing](CONTRIBUTING.md) | Shared SDK contribution workflow |
148
159
 
149
160
  ---
150
161
 
@@ -156,8 +167,9 @@ src/
156
167
  chat/ # Chat widget (GengageChat class + components)
157
168
  qna/ # QNA widget (GengageQNA class + components)
158
169
  simrel/ # Similar products widget (GengageSimRel class + components)
170
+ simbut/ # PDP image overlay pill widget (GengageSimBut class)
159
171
  native/ # Native WebView bridge exports
160
- demos/ # 12 merchant-branded demo pages
172
+ demos/ # Merchant-branded demo pages and framework integration examples
161
173
  catalog/ # Visual component catalog (mock data, no backend)
162
174
  docs/ # Architecture, wire protocol, customization, analytics
163
175
  tests/ # Vitest unit tests + Playwright E2E
@@ -362,6 +362,11 @@ export declare const HandoffNoticeSchema: z.ZodObject<{
362
362
  export declare const PhotoAnalysisCardSchema: z.ZodObject<{
363
363
  summary: z.ZodString;
364
364
  clues: z.ZodArray<z.ZodString>;
365
+ strengths: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
+ focus_points: z.ZodOptional<z.ZodArray<z.ZodString>>;
367
+ celeb_style: z.ZodOptional<z.ZodString>;
368
+ celeb_style_reason: z.ZodOptional<z.ZodString>;
369
+ details: z.ZodOptional<z.ZodArray<z.ZodString>>;
365
370
  next_question: z.ZodOptional<z.ZodString>;
366
371
  style_images: z.ZodOptional<z.ZodArray<z.ZodString>>;
367
372
  }, z.core.$strip>;
@@ -758,10 +763,15 @@ export declare const chatCatalog: {
758
763
  readonly schema: z.ZodObject<{
759
764
  summary: z.ZodString;
760
765
  clues: z.ZodArray<z.ZodString>;
766
+ strengths: z.ZodOptional<z.ZodArray<z.ZodString>>;
767
+ focus_points: z.ZodOptional<z.ZodArray<z.ZodString>>;
768
+ celeb_style: z.ZodOptional<z.ZodString>;
769
+ celeb_style_reason: z.ZodOptional<z.ZodString>;
770
+ details: z.ZodOptional<z.ZodArray<z.ZodString>>;
761
771
  next_question: z.ZodOptional<z.ZodString>;
762
772
  style_images: z.ZodOptional<z.ZodArray<z.ZodString>>;
763
773
  }, z.core.$strip>;
764
- readonly description: "Structured photo analysis card with summary, clues, and follow-up question.";
774
+ readonly description: "Structured photo analysis card with strengths, focus points, celeb vibe, details, and follow-up question.";
765
775
  };
766
776
  readonly BeautyPhotoStep: {
767
777
  readonly schema: z.ZodObject<{
@@ -303,6 +303,11 @@ export declare class ChatDrawer {
303
303
  updateBotMessage(messageId: string, html: string, renderHint?: string, photoAnalysis?: {
304
304
  summary: string;
305
305
  clues: string[];
306
+ strengths?: string[];
307
+ focusPoints?: string[];
308
+ celebStyle?: string;
309
+ celebStyleReason?: string;
310
+ details?: string[];
306
311
  nextQuestion?: string;
307
312
  }): void;
308
313
  /** Mark a message as the first bot message in its thread (for special styling). */
@@ -3,6 +3,11 @@ import { ChatUISpecRenderContext } from '../types.js';
3
3
  export interface PhotoAnalysisData {
4
4
  summary: string;
5
5
  clues: string[];
6
+ strengths?: string[];
7
+ focusPoints?: string[];
8
+ celebStyle?: string;
9
+ celebStyleReason?: string;
10
+ details?: string[];
6
11
  nextQuestion?: string;
7
12
  }
8
13
  /** Extract structured photo-analysis data from a UISpec element's props. */
@@ -12,11 +17,13 @@ export declare function renderPhotoAnalysisCard(element: UIElement, ctx: ChatUIS
12
17
  * Renders a photo analysis card into a chat message bubble.
13
18
  *
14
19
  * When structured data is available (from a PhotoAnalysisCard UISpec), it renders
15
- * the summary, clues, and next question directly. Otherwise, falls back to a
16
- * sentence-splitting heuristic for old backends that don't send the UISpec.
20
+ * the summary, sections, and follow-up question directly. Otherwise, falls back
21
+ * to a sentence-splitting heuristic for old backends that don't send the UISpec.
17
22
  */
18
- export declare function renderPhotoAnalysisBubble(container: HTMLElement, content: string, badgeText: string, structured?: {
19
- summary: string;
20
- clues: string[];
21
- nextQuestion?: string;
22
- }): void;
23
+ export declare function renderPhotoAnalysisBubble(container: HTMLElement, content: string, labels: {
24
+ badge: string;
25
+ strengths: string;
26
+ focus: string;
27
+ celebStyle: string;
28
+ seeMore: string;
29
+ }, structured?: PhotoAnalysisData): void;
@@ -258,6 +258,14 @@ export interface ChatI18n {
258
258
  aiBrowseCategoriesTitle: string;
259
259
  /** Badge text on photo analysis message cards. */
260
260
  photoAnalysisBadge: string;
261
+ /** Photo analysis section label: strengths. */
262
+ photoAnalysisStrengthsLabel: string;
263
+ /** Photo analysis section label: focus points. */
264
+ photoAnalysisFocusLabel: string;
265
+ /** Photo analysis section label: celeb style match. */
266
+ photoAnalysisCelebStyleLabel: string;
267
+ /** Photo analysis expander summary text. */
268
+ photoAnalysisSeeMoreLabel: string;
261
269
  /** Beauty photo step card: title. */
262
270
  beautyPhotoStepTitle: string;
263
271
  /** Beauty photo step card: description. */
@@ -323,7 +331,7 @@ export interface ChatUISpecRenderContext {
323
331
  onProductSelect?: (product: Record<string, unknown>) => void;
324
332
  pricing?: import('../common/price-formatter.js').PriceFormatConfig | undefined;
325
333
  productPriceUi?: ProductPriceUiConfig | undefined;
326
- i18n?: Pick<ChatI18n, 'productCtaLabel' | 'viewOnSiteLabel' | 'aiTopPicksTitle' | 'roleWinner' | 'roleBestValue' | 'roleBestAlternative' | 'viewDetails' | 'groundingReviewCta' | 'groundingReviewSubtitle' | 'variantsLabel' | 'sortRelated' | 'sortPriceAsc' | 'sortPriceDesc' | 'sortToolbarAriaLabel' | 'compareSelected' | 'compareMinHint' | 'comparisonSelectLabel' | 'comparisonSelectedLabel' | 'comparisonSelectCardHint' | 'panelTitleProductDetails' | 'panelTitleSimilarProducts' | 'panelTitleComparisonResults' | 'panelTitleCategories' | 'panelTitleSearchResults' | 'inStockLabel' | 'outOfStockLabel' | 'findSimilarLabel' | 'galleryPrevAriaLabel' | 'galleryNextAriaLabel' | 'beautyStylesPreparedTitle' | 'watchStylesPreparedTitle' | 'viewMoreLabel' | 'similarProductsLabel' | 'addToCartButton' | 'shareButton' | 'productInfoTab' | 'specificationsTab' | 'recommendedChoiceLabel' | 'highlightsLabel' | 'keyDifferencesLabel' | 'specialCasesLabel' | 'emptyReviewsMessage' | 'closeAriaLabel' | 'dismissAriaLabel' | 'startChatLabel' | 'handoffHeading' | 'customerReviewsTitle' | 'addToFavoritesLabel' | 'reviewFilterPositive' | 'reviewFilterNegative' | 'decreaseLabel' | 'increaseLabel' | 'reviewCustomersMentionSingular' | 'reviewCustomersMentionPlural' | 'reviewSubjectsHeading' | 'aiBrowseCategoriesTitle' | 'photoAnalysisBadge' | 'beautyPhotoStepTitle' | 'beautyPhotoStepDescription' | 'beautyPhotoStepUpload' | 'beautyPhotoStepProcessing' | 'beautyPhotoStepSkip'>;
334
+ i18n?: Pick<ChatI18n, 'productCtaLabel' | 'viewOnSiteLabel' | 'aiTopPicksTitle' | 'roleWinner' | 'roleBestValue' | 'roleBestAlternative' | 'viewDetails' | 'groundingReviewCta' | 'groundingReviewSubtitle' | 'variantsLabel' | 'sortRelated' | 'sortPriceAsc' | 'sortPriceDesc' | 'sortToolbarAriaLabel' | 'compareSelected' | 'compareMinHint' | 'comparisonSelectLabel' | 'comparisonSelectedLabel' | 'comparisonSelectCardHint' | 'panelTitleProductDetails' | 'panelTitleSimilarProducts' | 'panelTitleComparisonResults' | 'panelTitleCategories' | 'panelTitleSearchResults' | 'inStockLabel' | 'outOfStockLabel' | 'findSimilarLabel' | 'galleryPrevAriaLabel' | 'galleryNextAriaLabel' | 'beautyStylesPreparedTitle' | 'watchStylesPreparedTitle' | 'viewMoreLabel' | 'similarProductsLabel' | 'addToCartButton' | 'shareButton' | 'productInfoTab' | 'specificationsTab' | 'recommendedChoiceLabel' | 'highlightsLabel' | 'keyDifferencesLabel' | 'specialCasesLabel' | 'emptyReviewsMessage' | 'closeAriaLabel' | 'dismissAriaLabel' | 'startChatLabel' | 'handoffHeading' | 'customerReviewsTitle' | 'addToFavoritesLabel' | 'reviewFilterPositive' | 'reviewFilterNegative' | 'decreaseLabel' | 'increaseLabel' | 'reviewCustomersMentionSingular' | 'reviewCustomersMentionPlural' | 'reviewSubjectsHeading' | 'aiBrowseCategoriesTitle' | 'photoAnalysisBadge' | 'photoAnalysisStrengthsLabel' | 'photoAnalysisFocusLabel' | 'photoAnalysisCelebStyleLabel' | 'photoAnalysisSeeMoreLabel' | 'beautyPhotoStepTitle' | 'beautyPhotoStepDescription' | 'beautyPhotoStepUpload' | 'beautyPhotoStepProcessing' | 'beautyPhotoStepSkip'>;
327
335
  productSort?: ProductSortState | undefined;
328
336
  onSortChange?: ((sort: ProductSortState) => void) | undefined;
329
337
  comparisonSelectMode?: boolean | undefined;
@@ -367,6 +375,11 @@ export interface ChatMessage {
367
375
  photoAnalysis?: {
368
376
  summary: string;
369
377
  clues: string[];
378
+ strengths?: string[];
379
+ focusPoints?: string[];
380
+ celebStyle?: string;
381
+ celebStyleReason?: string;
382
+ details?: string[];
370
383
  nextQuestion?: string;
371
384
  };
372
385
  timestamp: number;