@askdialog/dialog-sdk 2.13.0 → 2.15.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/README.md CHANGED
@@ -122,7 +122,29 @@ If your site uses OneTrust auto-blocking, it may neutralize the assistant script
122
122
  - categorize the assistant CDN domain as strictly necessary in your OneTrust console, or
123
123
  - pass the optional `ignoreOneTrustAutoBlock: true` constructor flag so the SDK adds `data-ot-ignore` on the script it injects.
124
124
 
125
- Either is compliance-safe with regard to analytics: the assistant gates all analytics on consent internally and sends nothing without an explicit opt-in (inspect `window.dialog.audit.consent`).
125
+ Either is compliance-safe with regard to analytics: the assistant gates all analytics on consent internally and sends nothing without an explicit opt-in, unless you declared the consent yourself with `analyticsConsent` (inspect `window.dialog.audit.consent`).
126
+
127
+ ### Declaring the analytics consent
128
+
129
+ By default the assistant sends analytics events (add-to-cart, checkout, assistant usage) only once it detects a consent signal on the page: Google Consent Mode, TCF v2 or OneTrust. A site with no cookie banner emits no such signal, so nothing is sent for any of its visitors.
130
+
131
+ On those sites, pass the optional `analyticsConsent: 'granted'` constructor option:
132
+
133
+ ```ts
134
+ new Dialog({
135
+ apiKey: 'YOUR_API_KEY',
136
+ locale: 'en-US', currency: 'USD',
137
+ analyticsConsent: 'granted', // no cookie banner on this site
138
+ });
139
+ ```
140
+
141
+ It works like a Google Consent Mode `default` state:
142
+
143
+ - analytics is on from the first page view, for every visitor;
144
+ - a refusal coming from a consent platform present on the page still wins: a Google Consent Mode `update` set to `denied`, or OneTrust loaded without the performance group (`C0002`), turns analytics off for that visitor;
145
+ - `window.dialog.audit.consent` reports `detectedCmp: 'declared'` when the option is what enabled analytics.
146
+
147
+ Whether consent can be assumed for your visitors is your compliance decision. Omit the option to keep the default detection.
126
148
 
127
149
  ### Disabling add-to-cart
128
150
 
@@ -173,6 +195,22 @@ client.sendGenericMessage({
173
195
  });
174
196
  ```
175
197
 
198
+ - Open the assistant with suggested questions
199
+
200
+ The assistant opens on a list of questions the shopper can click. With a `product`, a clicked question is asked about that product.
201
+
202
+ ```typescript
203
+ client.openAssistantWithSuggestions({
204
+ questions: [{ question: 'YOUR_QUESTION' }], // required, e.g. suggestions.questions
205
+ product: { // Optional
206
+ id: 'PRODUCT_ID',
207
+ title: 'PRODUCT_TITLE',
208
+ handle: 'PRODUCT_HANDLE',
209
+ selectedVariantId: 'CURRENT_VARIANT_ID', // Optional
210
+ },
211
+ });
212
+ ```
213
+
176
214
  - Get locale information
177
215
 
178
216
  ```typescript
@@ -195,6 +233,8 @@ You can use this query to make your own integration and trigger `sendProductMess
195
233
 
196
234
  ```typescript
197
235
  const suggestions = await client.getSuggestions(productId);
236
+ // Up to 5 questions (default 2):
237
+ const moreSuggestions = await client.getSuggestions(productId, { limit: 5 });
198
238
 
199
239
  /*
200
240
  Example of expected result:
package/dist/Dialog.d.ts CHANGED
@@ -2,7 +2,7 @@ import { DialogConstructor } from "./types/constructor";
2
2
  import { Theme } from "./types/theme";
3
3
  import { DetailedLocaleInfo } from "./utils/localization";
4
4
  import { Suggestion } from "./types/suggestion";
5
- import { AddToCartInput, ChangeCartQuantityInput, GenericQuestionPayload, LegacyCheckoutParams, OpenAssistantPayload, ProductQuestionPayload, SubmitCheckoutParams } from "./types/events";
5
+ import { AddToCartInput, ChangeCartQuantityInput, GenericQuestionPayload, LegacyCheckoutParams, OpenAssistantPayload, OpenWithSuggestionsParams, ProductQuestionPayload, SubmitCheckoutParams } from "./types/events";
6
6
  import { SimplifiedProduct } from "./types/product";
7
7
  import { SelectSearchResultParams, ViewSearchResultsParams } from "./types/searchAnalytics";
8
8
  import { EventsHandler } from "./EventsHandler";
@@ -20,8 +20,9 @@ export declare class Dialog {
20
20
  private _eventsHandler;
21
21
  private _ignoreOneTrustAutoBlock;
22
22
  private _disableAddToCart;
23
+ private _analyticsConsent?;
23
24
  private _currentProduct?;
24
- constructor({ apiKey, locale, currency, countryCode, callbacks, theme, userId, ignoreOneTrustAutoBlock, disableAddToCart, product, }: DialogConstructor);
25
+ constructor({ apiKey, locale, currency, countryCode, callbacks, theme, userId, ignoreOneTrustAutoBlock, disableAddToCart, analyticsConsent, product, }: DialogConstructor);
25
26
  get apiKey(): string;
26
27
  get theme(): Theme;
27
28
  get userId(): string;
@@ -30,7 +31,10 @@ export declare class Dialog {
30
31
  get eventsHandler(): EventsHandler;
31
32
  getLocalizationInformations(): DetailedLocaleInfo | null;
32
33
  private _createOrRetrieveUserId;
33
- getSuggestions(productId: string): Promise<Suggestion>;
34
+ /** `limit` (1 to 5) defaults to 2 server-side. */
35
+ getSuggestions(productId: string, options?: {
36
+ limit?: number;
37
+ }): Promise<Suggestion>;
34
38
  /**
35
39
  * Send one search request with names built by `searchIndexName`.
36
40
  * Cancel through `options.signal`. HTTP errors reject with `DialogSearchError`;
@@ -38,6 +42,7 @@ export declare class Dialog {
38
42
  */
39
43
  search(request: SearchRequest, options?: SearchOptions): Promise<SearchResponse>;
40
44
  openAssistant(params: OpenAssistantPayload): void;
45
+ openAssistantWithSuggestions({ questions, product, }: OpenWithSuggestionsParams): void;
41
46
  closeAssistant(): void;
42
47
  /**
43
48
  * Set the default product context for assistant questions.
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,uBAAuB,EAEvB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,wBAAwB,EACxB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,OAAO,CAAC,iBAAiB,CAAC;IAQhB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrD,qBAAqB,IAAI,OAAO;IAO1B,kBAAkB,CAC7B,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,IAAI,CAAC;IAQhB,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,oBAAoB;IAarB,sBAAsB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IASnD,2BAA2B,CAChC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,GAClD,IAAI;IA0BP;;;OAGG;IACI,sBAAsB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IAUpE,0FAA0F;IACnF,uBAAuB,CAAC,MAAM,EAAE,wBAAwB,GAAG,IAAI;IAUtE,OAAO,CAAC,cAAc;CAyCvB"}
package/dist/Dialog.js CHANGED
@@ -22,8 +22,9 @@ export class Dialog {
22
22
  _eventsHandler;
23
23
  _ignoreOneTrustAutoBlock;
24
24
  _disableAddToCart;
25
+ _analyticsConsent;
25
26
  _currentProduct;
26
- constructor({ apiKey, locale, currency, countryCode, callbacks, theme, userId, ignoreOneTrustAutoBlock, disableAddToCart, product, }) {
27
+ constructor({ apiKey, locale, currency, countryCode, callbacks, theme, userId, ignoreOneTrustAutoBlock, disableAddToCart, analyticsConsent, product, }) {
27
28
  this._apiKey = apiKey;
28
29
  this._locale = locale;
29
30
  this._currency = currency;
@@ -31,6 +32,7 @@ export class Dialog {
31
32
  this._callbacks = callbacks;
32
33
  this._ignoreOneTrustAutoBlock = ignoreOneTrustAutoBlock ?? false;
33
34
  this._disableAddToCart = disableAddToCart ?? false;
35
+ this._analyticsConsent = analyticsConsent;
34
36
  this._currentProduct =
35
37
  product !== undefined && Dialog._isValidProductId(product.id)
36
38
  ? product
@@ -78,8 +80,9 @@ export class Dialog {
78
80
  localStorage.setItem(ANONYMOUS_CUSTOMER_ID, newUserId);
79
81
  return newUserId;
80
82
  }
81
- async getSuggestions(productId) {
82
- return loadSuggestions(this._apiKey, this._locale, productId);
83
+ /** `limit` (1 to 5) defaults to 2 server-side. */
84
+ async getSuggestions(productId, options) {
85
+ return loadSuggestions(this._apiKey, this._locale, productId, options?.limit);
83
86
  }
84
87
  /**
85
88
  * Send one search request with names built by `searchIndexName`.
@@ -93,6 +96,17 @@ export class Dialog {
93
96
  openAssistant(params) {
94
97
  this._eventsHandler.emitExternalEvent(DialogEvents.OPEN_ASSISTANT, params);
95
98
  }
99
+ openAssistantWithSuggestions({ questions, product, }) {
100
+ this._eventsHandler.emitExternalEvent(DialogEvents.OPEN_WITH_SUGGESTIONS, {
101
+ suggestions: questions.map(({ question }) => ({ question })),
102
+ ...(product !== undefined && {
103
+ productId: product.id,
104
+ productTitle: product.title,
105
+ handle: product.handle,
106
+ selectedVariantId: product.selectedVariantId,
107
+ }),
108
+ });
109
+ }
96
110
  // TODO: Not yet implemented on assistant
97
111
  closeAssistant() {
98
112
  this._eventsHandler.emitExternalEvent(DialogEvents.CLOSE_ASSISTANT);
@@ -248,6 +262,9 @@ export class Dialog {
248
262
  // Hide the add-to-cart button in the assistant.
249
263
  div.dataset.disableAddToCart = "true";
250
264
  }
265
+ if (this._analyticsConsent === "granted") {
266
+ div.dataset.analyticsConsent = this._analyticsConsent;
267
+ }
251
268
  document.body.appendChild(div);
252
269
  if (this._currentProduct !== undefined) {
253
270
  this._applyCurrentProductDataset();
@@ -77,3 +77,23 @@ describe("Dialog._loadAssistant add-to-cart toggle", () => {
77
77
  expect(div.dataset.disableAddToCart).toBeUndefined();
78
78
  });
79
79
  });
80
+ describe("Dialog._loadAssistant analytics consent", () => {
81
+ it("declares the granted consent on the injected div", () => {
82
+ vi.useFakeTimers();
83
+ const { div } = stubDocument();
84
+ loadAssistant(buildDialog({ _analyticsConsent: "granted" }));
85
+ expect(div.dataset.analyticsConsent).toBe("granted");
86
+ });
87
+ it("declares nothing by default", () => {
88
+ vi.useFakeTimers();
89
+ const { div } = stubDocument();
90
+ loadAssistant(buildDialog());
91
+ expect(div.dataset.analyticsConsent).toBeUndefined();
92
+ });
93
+ it("ignores a value other than granted", () => {
94
+ vi.useFakeTimers();
95
+ const { div } = stubDocument();
96
+ loadAssistant(buildDialog({ _analyticsConsent: "true" }));
97
+ expect(div.dataset.analyticsConsent).toBeUndefined();
98
+ });
99
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=suggestions.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestions.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/suggestions.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ // @vitest-environment jsdom
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
+ import { config } from "../config";
4
+ import { loadSuggestions } from "../services/suggestions";
5
+ const fetchMock = vi.fn();
6
+ const apiKey = "a5c3c7e0-5f2b-4d3a-9b1e-2f6c8d7a1b23";
7
+ const productId = "9053100277937";
8
+ describe("loadSuggestions", () => {
9
+ beforeEach(() => {
10
+ vi.stubGlobal("fetch", fetchMock);
11
+ window.history.pushState({}, "", "/products/serum-eclat");
12
+ fetchMock.mockResolvedValue({
13
+ json: () => Promise.resolve({ questions: [] }),
14
+ });
15
+ });
16
+ afterEach(() => {
17
+ vi.unstubAllGlobals();
18
+ fetchMock.mockReset();
19
+ });
20
+ it("calls the monolith route with the api key header", async () => {
21
+ await loadSuggestions(apiKey, "fr", productId);
22
+ const [url, init] = fetchMock.mock.calls[0];
23
+ const parsed = new URL(url);
24
+ expect(parsed.origin).toBe(new URL(config.monolithApiUrl).origin);
25
+ expect(parsed.pathname).toBe("/public/product-page-questions");
26
+ expect(Object.fromEntries(parsed.searchParams)).toEqual({
27
+ pagePath: "/products/serum-eclat",
28
+ locale: "fr",
29
+ productId,
30
+ });
31
+ expect(init.headers).toEqual({ "x-dialog-api-key": apiKey });
32
+ });
33
+ it("returns the parsed body", async () => {
34
+ const body = { questions: [{ question: "Is it vegan?" }] };
35
+ fetchMock.mockResolvedValue({ json: () => Promise.resolve(body) });
36
+ await expect(loadSuggestions(apiKey, "en", productId)).resolves.toEqual(body);
37
+ });
38
+ });
@@ -1,5 +1,4 @@
1
1
  export declare const config: {
2
- baseApiUrl: string;
3
2
  monolithApiUrl: string;
4
3
  assistantUrl: string;
5
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.development.d.ts","sourceRoot":"","sources":["../../src/config/config.development.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;CAKlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"config.development.d.ts","sourceRoot":"","sources":["../../src/config/config.development.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;CAKlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export const config = {
2
- baseApiUrl: "https://hr5buzenb1.execute-api.eu-west-1.amazonaws.com",
3
- // Nest monolith (staging) — serves POST /public/search/lexical.
4
- monolithApiUrl: "https://fvcphlqyle.execute-api.eu-west-1.amazonaws.com",
2
+ // Nest monolith (staging) — serves POST /public/search/lexical and
3
+ // GET /public/product-page-questions.
4
+ monolithApiUrl: "https://api-staging.askdialog.ai",
5
5
  assistantUrl: "https://d2bycosa71tnxv.cloudfront.net/assets/index.js",
6
6
  };
@@ -1,5 +1,4 @@
1
1
  export declare const config: {
2
- baseApiUrl: string;
3
2
  monolithApiUrl: string;
4
3
  assistantUrl: string;
5
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.production.d.ts","sourceRoot":"","sources":["../../src/config/config.production.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;CAOlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"config.production.d.ts","sourceRoot":"","sources":["../../src/config/config.production.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;CAOlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
@@ -1,8 +1,8 @@
1
1
  export const config = {
2
- baseApiUrl: "https://rtbzcxkmwj.execute-api.eu-west-1.amazonaws.com",
3
- // Nest monolith (production) — serves POST /public/search/lexical. Custom domain,
4
- // same as the dashboard's VITE_MONOLITH_API_URL: the raw execute-api
5
- // gateway URL answers 500 on every route and must not be used.
2
+ // Nest monolith (production) — serves POST /public/search/lexical and
3
+ // GET /public/product-page-questions. Custom domain, same as the dashboard's
4
+ // VITE_MONOLITH_API_URL: the raw execute-api gateway URL answers 500 on
5
+ // every route and must not be used.
6
6
  monolithApiUrl: "https://api.askdialog.ai",
7
7
  assistantUrl: "https://d2zm7i5bmzo6ze.cloudfront.net/assets/index.js",
8
8
  };
@@ -1,5 +1,4 @@
1
1
  export declare const config: {
2
- baseApiUrl: string;
3
2
  monolithApiUrl: string;
4
3
  assistantUrl: string;
5
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;CAOlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;CAOlB,CAAC;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
@@ -1,8 +1,8 @@
1
1
  export const config = {
2
- baseApiUrl: "https://rtbzcxkmwj.execute-api.eu-west-1.amazonaws.com",
3
- // Nest monolith (production) — serves POST /public/search/lexical. Custom domain,
4
- // same as the dashboard's VITE_MONOLITH_API_URL: the raw execute-api
5
- // gateway URL answers 500 on every route and must not be used.
2
+ // Nest monolith (production) — serves POST /public/search/lexical and
3
+ // GET /public/product-page-questions. Custom domain, same as the dashboard's
4
+ // VITE_MONOLITH_API_URL: the raw execute-api gateway URL answers 500 on
5
+ // every route and must not be used.
6
6
  monolithApiUrl: "https://api.askdialog.ai",
7
7
  assistantUrl: "https://d2zm7i5bmzo6ze.cloudfront.net/assets/index.js",
8
8
  };
@@ -1,3 +1,3 @@
1
1
  import { Suggestion } from "../types/suggestion";
2
- export declare const loadSuggestions: (apiKey: string, locale: string, productId: string) => Promise<Suggestion>;
2
+ export declare const loadSuggestions: (apiKey: string, locale: string, productId: string, limit?: number) => Promise<Suggestion>;
3
3
  //# sourceMappingURL=suggestions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../src/services/suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,WAAW,MAAM,KAChB,OAAO,CAAC,UAAU,CAiBpB,CAAC"}
1
+ {"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../src/services/suggestions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKjD,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,QAAQ,MAAM,KACb,OAAO,CAAC,UAAU,CAkBpB,CAAC"}
@@ -1,10 +1,15 @@
1
- import { getBaseApiUrl } from "./base";
2
- export const loadSuggestions = async (apiKey, locale, productId) => {
1
+ import { config } from "../config";
2
+ const PRODUCT_QUESTIONS_PATH = "/public/product-page-questions";
3
+ const API_KEY_HEADER = "x-dialog-api-key";
4
+ export const loadSuggestions = async (apiKey, locale, productId, limit) => {
3
5
  const pagePath = window.location.pathname.split("?")[0];
4
- const baseApiUrl = getBaseApiUrl();
5
- const response = await fetch(`${baseApiUrl}/ai/product-questions?pagePath=${pagePath}&locale=${locale}&productId=${productId}`, {
6
+ const query = new URLSearchParams({ pagePath, locale, productId });
7
+ if (limit !== undefined) {
8
+ query.set("limit", String(limit));
9
+ }
10
+ const response = await fetch(`${config.monolithApiUrl}${PRODUCT_QUESTIONS_PATH}?${query.toString()}`, {
6
11
  headers: {
7
- Authorization: apiKey,
12
+ [API_KEY_HEADER]: apiKey,
8
13
  },
9
14
  });
10
15
  const data = await response.json();
@@ -11,6 +11,7 @@ export interface CurrentProduct {
11
11
  id: string;
12
12
  variantId?: string;
13
13
  }
14
+ export type AnalyticsConsent = "granted";
14
15
  export interface DialogConstructor {
15
16
  apiKey: string;
16
17
  /** BCP-47 locale, e.g. `fr-FR`. */
@@ -51,6 +52,7 @@ export interface DialogConstructor {
51
52
  * Product links and recommendation browsing are unaffected.
52
53
  */
53
54
  disableAddToCart?: boolean;
55
+ analyticsConsent?: AnalyticsConsent;
54
56
  /**
55
57
  * The product of the page the SDK is instantiated on, when it is a product
56
58
  * page. The assistant uses it as the conversation's product context for
@@ -1 +1 @@
1
- {"version":3,"file":"constructor.d.ts","sourceRoot":"","sources":["../../src/types/constructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,UAAU,EAAE,CACV,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,EAAE,EAAE,MA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,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B"}
@@ -2,6 +2,7 @@ import { SelectSearchResultEventPayload, ViewSearchResultsEventPayload } from ".
2
2
  export declare const DIALOG_CUSTOM_EVENT = "enableDialogAssistantEvent";
3
3
  export declare enum DialogEvents {
4
4
  OPEN_ASSISTANT = "open_assistant",
5
+ OPEN_WITH_SUGGESTIONS = "OPEN_WITH_SUGGESTIONS",
5
6
  CLOSE_ASSISTANT = "close_assistant",
6
7
  SEND_MESSAGE = "PRODUCT_QUESTION",
7
8
  SEND_GENERIC_QUESTION = "GENERIC_QUESTION",
@@ -28,6 +29,27 @@ export interface OpenAssistantPayload {
28
29
  fromQuestionSuggestion?: boolean;
29
30
  selectedVariantId?: string;
30
31
  }
32
+ export interface SuggestionsProduct {
33
+ id: string;
34
+ title: string;
35
+ handle: string;
36
+ selectedVariantId?: string;
37
+ }
38
+ export interface OpenWithSuggestionsParams {
39
+ questions: {
40
+ question: string;
41
+ }[];
42
+ product?: SuggestionsProduct;
43
+ }
44
+ export interface OpenWithSuggestionsPayload {
45
+ suggestions: {
46
+ question: string;
47
+ }[];
48
+ productId?: string;
49
+ productTitle?: string;
50
+ handle?: string;
51
+ selectedVariantId?: string;
52
+ }
31
53
  export type DiagnosticButtonType = "productPageButton" | "simpleButton";
32
54
  export interface DiagnosticPayload {
33
55
  productTitle: string;
@@ -95,7 +117,7 @@ export interface LegacyCheckoutParams {
95
117
  currency?: string;
96
118
  variantId?: string;
97
119
  }
98
- export type DialogEventPayload = ProductQuestionPayload | GenericQuestionPayload | DiagnosticPayload | OpenAssistantPayload | TrackEventPayload | SubmitCheckoutEventPayload | ViewSearchResultsEventPayload | SelectSearchResultEventPayload;
120
+ export type DialogEventPayload = ProductQuestionPayload | GenericQuestionPayload | DiagnosticPayload | OpenAssistantPayload | OpenWithSuggestionsPayload | TrackEventPayload | SubmitCheckoutEventPayload | ViewSearchResultsEventPayload | SelectSearchResultEventPayload;
99
121
  export interface DialogEvent<T = DialogEventPayload> {
100
122
  type: DialogEvents;
101
123
  payload: T;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAEhE,oBAAY,YAAY;IACtB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,YAAY,qBAAqB;IACjC,qBAAqB,qBAAqB;IAC1C,iBAAiB,sBAAsB;IACvC,qBAAqB,0BAA0B;IAC/C,yBAAyB,8BAA8B;IACvD,0BAA0B,+BAA+B;CAC1D;AACD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACj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  export var DialogEvents;
3
3
  (function (DialogEvents) {
4
4
  DialogEvents["OPEN_ASSISTANT"] = "open_assistant";
5
+ DialogEvents["OPEN_WITH_SUGGESTIONS"] = "OPEN_WITH_SUGGESTIONS";
5
6
  DialogEvents["CLOSE_ASSISTANT"] = "close_assistant";
6
7
  DialogEvents["SEND_MESSAGE"] = "PRODUCT_QUESTION";
7
8
  DialogEvents["SEND_GENERIC_QUESTION"] = "GENERIC_QUESTION";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-sdk",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "private": false,
5
5
  "description": "Dialog SDK",
6
6
  "main": "dist/index.js",
@@ -1,2 +0,0 @@
1
- export declare const getBaseApiUrl: () => string;
2
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/services/base.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,QAAO,MAEhC,CAAC"}
@@ -1,4 +0,0 @@
1
- import { config } from "../config";
2
- export const getBaseApiUrl = () => {
3
- return config.baseApiUrl;
4
- };