@gengage/assistant-fe 0.4.5 → 0.4.6

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/api-paths-C4GDpeTf.js +1214 -0
  3. package/dist/chat/index.d.ts +1 -374
  4. package/dist/chat/runtime.d.ts +374 -0
  5. package/dist/chat-BRKK63lt.js +303 -0
  6. package/dist/chat-runtime.js +13 -0
  7. package/dist/chat.iife.js +6 -6
  8. package/dist/chat.js +11 -10
  9. package/dist/common/config-constants.d.ts +1 -0
  10. package/dist/common/config-schema.d.ts +0 -1
  11. package/dist/common/overlay.d.ts +4 -4
  12. package/dist/common-CEN5OW7E.js +491 -0
  13. package/dist/common.js +78 -76
  14. package/dist/{connection-warning-n88bjkqL.js → connection-warning-B6oIU-9s.js} +1 -1
  15. package/dist/context-VIG4SVcS.js +529 -0
  16. package/dist/index.js +70 -67
  17. package/dist/locale-CfqNifrU.js +7 -0
  18. package/dist/native-webview-DudQ7nHe.js +273 -0
  19. package/dist/native.iife.js +28 -91
  20. package/dist/native.js +1 -1
  21. package/dist/overlay-1EO41ZC7.js +212 -0
  22. package/dist/overlay.d.ts +4 -0
  23. package/dist/overlay.js +10 -0
  24. package/dist/pill-launcher-57nrdLRr.js +364 -0
  25. package/dist/qna/index.d.ts +1 -61
  26. package/dist/qna/runtime.d.ts +61 -0
  27. package/dist/qna-BNvttR6s.js +40 -0
  28. package/dist/qna-runtime.js +8 -0
  29. package/dist/qna.iife.js +4 -4
  30. package/dist/qna.js +6 -5
  31. package/dist/{simrel-K2TGFi1r.js → runtime-BdwZZIrO.js} +244 -293
  32. package/dist/{chat-B1lLKIxj.js → runtime-C0qZk0y7.js} +1643 -2297
  33. package/dist/{qna-C5Ok3wd0.js → runtime-DDu8Wk0z.js} +87 -121
  34. package/dist/schemas-CLo8wCjs.js +3207 -0
  35. package/dist/{simbut-Cb5RfaAp.js → simbut-BMWC6x_t.js} +24 -22
  36. package/dist/simbut.js +1 -1
  37. package/dist/simrel/index.d.ts +1 -59
  38. package/dist/simrel/runtime.d.ts +59 -0
  39. package/dist/simrel-ohfkluhp.js +55 -0
  40. package/dist/simrel-runtime.js +8 -0
  41. package/dist/simrel.iife.js +4 -4
  42. package/dist/simrel.js +7 -6
  43. package/dist/widget-base-TgwiA8cD.js +578 -0
  44. package/package.json +17 -1
  45. package/dist/common-C5e2gLuG.js +0 -387
  46. package/dist/locale-MM0U5eeR.js +0 -1109
  47. package/dist/native-webview-niMtkiHX.js +0 -586
  48. package/dist/schemas-JpRGzRQT.js +0 -4419
  49. /package/dist/{price-formatter-CR6VT5z4.js → price-formatter-xI3g9Cd4.js} +0 -0
@@ -0,0 +1,61 @@
1
+ import { ActionPayload, PageContext } from '../common/types.js';
2
+ import { BaseWidget } from '../common/widget-base.js';
3
+ import { QNAWidgetConfig } from './types.js';
4
+ /**
5
+ * Contextual Q&A action buttons for product pages.
6
+ * Renders quick-action buttons that open the chat widget with a pre-built query.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { GengageQNA, wireQNAToChat, bootstrapSession } from '@gengage/assistant-fe';
11
+ *
12
+ * const qna = new GengageQNA();
13
+ * await qna.init({
14
+ * accountId: 'mystore',
15
+ * middlewareUrl: '<backend service location provided for your Gengage account>',
16
+ * mountTarget: '#qna-section',
17
+ * pageContext: { pageType: 'pdp', sku: '12345' },
18
+ * session: { sessionId: bootstrapSession() },
19
+ * });
20
+ * wireQNAToChat(); // Wire button clicks to chat.openWithAction()
21
+ * ```
22
+ */
23
+ export declare class GengageQNA extends BaseWidget<QNAWidgetConfig> {
24
+ private _abortController;
25
+ private _debounceTimer;
26
+ private _contentEl;
27
+ private _lastSku;
28
+ private _i18n;
29
+ protected onInit(config: QNAWidgetConfig): Promise<void>;
30
+ protected onUpdate(context: Partial<PageContext>): void;
31
+ protected onShow(): void;
32
+ protected onHide(): void;
33
+ protected onDestroy(): void;
34
+ private _abort;
35
+ /** `headerTitle` wins over deprecated `headingTitle`. */
36
+ private _resolvedQnaHeaderTitle;
37
+ /** Clean up TextInput placeholder rotation timers to prevent interval leaks. */
38
+ private _cleanupTextInputTimers;
39
+ private _fetchAndRender;
40
+ private _createLoadingIndicator;
41
+ private _resolveI18n;
42
+ private _resolveUISpecRegistry;
43
+ private _renderUISpec;
44
+ private _specIncludesType;
45
+ private _buildFallbackActionsSpec;
46
+ /**
47
+ * Free-text field when the launcher stream has no TextInput. Must sit **above** the
48
+ * quick-question pills (heading → search → chips), not below — see `render` order above.
49
+ */
50
+ private _insertStandaloneInputBeforePills;
51
+ private _appendStandaloneInput;
52
+ private _handleAction;
53
+ private _handleOpenChat;
54
+ private _showTransitionIndicator;
55
+ _actionHandler: (action: ActionPayload) => void;
56
+ _openChatHandler: () => void;
57
+ }
58
+ export declare function createQNAWidget(): GengageQNA;
59
+ export type { QNAWidgetConfig, QNAUIComponents, QNAI18n, QNAUISpecRenderContext, QNARendererConfig } from './types.js';
60
+ export { renderQnaUISpec, createDefaultQnaUISpecRegistry, defaultQnaUnknownUISpecRenderer, } from './components/renderUISpec.js';
61
+ export type { QNAUISpecRegistry } from './components/renderUISpec.js';
@@ -0,0 +1,40 @@
1
+ import { c as t, l as n, n as e, o as a, r as i, t as o, u as r } from "./schemas-CLo8wCjs.js";
2
+ var c = a({
3
+ title: t(),
4
+ type: t(),
5
+ payload: r().optional()
6
+ }), l = a({
7
+ label: t(),
8
+ action: c,
9
+ variant: o([
10
+ "primary",
11
+ "outline",
12
+ "ghost"
13
+ ]).optional()
14
+ }), p = a({
15
+ orientation: o(["horizontal", "vertical"]).optional(),
16
+ wrap: i().optional()
17
+ }), s = a({
18
+ placeholder: n([t(), e(t())]).optional(),
19
+ ctaLabel: t().optional()
20
+ }), u = a({ text: t() }), d = { components: {
21
+ ActionButton: {
22
+ schema: l,
23
+ description: "A single clickable QNA action button."
24
+ },
25
+ ButtonRow: {
26
+ schema: p,
27
+ description: "Container for a group of QNA action buttons."
28
+ },
29
+ TextInput: {
30
+ schema: s,
31
+ description: "Free-text input with rotating placeholder and CTA button."
32
+ },
33
+ QuestionHeading: {
34
+ schema: u,
35
+ description: "A heading displayed above the QNA button group."
36
+ }
37
+ } };
38
+ export {
39
+ d as t
40
+ };
@@ -0,0 +1,8 @@
1
+ import { a, i as r, n, r as t, t as s } from "./runtime-DDu8Wk0z.js";
2
+ export {
3
+ s as GengageQNA,
4
+ t as createDefaultQnaUISpecRegistry,
5
+ n as createQNAWidget,
6
+ r as defaultQnaUnknownUISpecRenderer,
7
+ a as renderQnaUISpec
8
+ };