@askdialog/dialog-sdk 2.12.0 → 2.14.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
 
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, GenericQuestionPayload, LegacyCheckoutParams, OpenAssistantPayload, ProductQuestionPayload, SubmitCheckoutParams } from "./types/events";
5
+ import { AddToCartInput, ChangeCartQuantityInput, GenericQuestionPayload, LegacyCheckoutParams, OpenAssistantPayload, 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;
@@ -54,6 +55,9 @@ export declare class Dialog {
54
55
  dispatchAssistantEvent(event: AssistantEvent): void;
55
56
  getProduct(productId: string, variantId?: string): Promise<SimplifiedProduct>;
56
57
  addToCart(input: AddToCartInput): Promise<void>;
58
+ canChangeCartQuantity(): boolean;
59
+ changeCartQuantity(input: ChangeCartQuantityInput): Promise<void>;
60
+ private _isCartWriteDisabled;
57
61
  private _getCallbacksOrThrow;
58
62
  registerAddToCartEvent(input: AddToCartInput): void;
59
63
  registerSubmitCheckoutEvent(params: SubmitCheckoutParams | LegacyCheckoutParams): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../src/Dialog.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,iBAAiB,EAClB,MAAM,qBAA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AInD,UAAU,CACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,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
@@ -157,20 +159,34 @@ export class Dialog {
157
159
  // Forward all product fields to the commerce callback and analytics.
158
160
  async addToCart(input) {
159
161
  // Disabled instances must neither modify the cart nor emit analytics.
160
- if (this._disableAddToCart) {
161
- console.warn("Dialog: addToCart is disabled on this instance (disableAddToCart); ignoring the call.");
162
+ if (this._isCartWriteDisabled("addToCart"))
162
163
  return;
163
- }
164
164
  await this._getCallbacksOrThrow("addToCart").addToCart(input);
165
165
  this.registerAddToCartEvent(input);
166
166
  return;
167
167
  }
168
+ canChangeCartQuantity() {
169
+ return (!this._disableAddToCart &&
170
+ this._callbacks?.changeCartQuantity !== undefined);
171
+ }
172
+ async changeCartQuantity(input) {
173
+ if (this._isCartWriteDisabled("changeCartQuantity"))
174
+ return;
175
+ await this._getCallbacksOrThrow("changeCartQuantity").changeCartQuantity(input);
176
+ }
177
+ _isCartWriteDisabled(operation) {
178
+ if (!this._disableAddToCart)
179
+ return false;
180
+ console.warn(`Dialog: ${operation} is disabled on this instance (disableAddToCart); ignoring the call.`);
181
+ return true;
182
+ }
168
183
  // Validate optional commerce callbacks when invoked.
169
184
  _getCallbacksOrThrow(name) {
170
- if (this._callbacks?.[name] === undefined) {
185
+ const callbacks = this._callbacks;
186
+ if (callbacks?.[name] === undefined) {
171
187
  throw new Error(`Dialog: \`callbacks.${name}\` was not provided to the constructor; ${name}() is unavailable on this instance.`);
172
188
  }
173
- return this._callbacks;
189
+ return callbacks;
174
190
  }
175
191
  registerAddToCartEvent(input) {
176
192
  this._eventsHandler.emitExternalEvent(DialogEvents.TRACK_ADD_TO_CART, {
@@ -234,6 +250,9 @@ export class Dialog {
234
250
  // Hide the add-to-cart button in the assistant.
235
251
  div.dataset.disableAddToCart = "true";
236
252
  }
253
+ if (this._analyticsConsent === "granted") {
254
+ div.dataset.analyticsConsent = this._analyticsConsent;
255
+ }
237
256
  document.body.appendChild(div);
238
257
  if (this._currentProduct !== undefined) {
239
258
  this._applyCurrentProductDataset();
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dialogChangeCartQuantity.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialogChangeCartQuantity.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/dialogChangeCartQuantity.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { afterEach, describe, expect, it, vi } from "vitest";
2
+ import { Dialog } from "../Dialog";
3
+ const buildDialog = (changeCartQuantity, disableAddToCart = false) => {
4
+ const dialog = Object.create(Dialog.prototype);
5
+ Object.assign(dialog, {
6
+ _callbacks: {
7
+ addToCart: vi.fn(),
8
+ getProduct: vi.fn(),
9
+ ...(changeCartQuantity === undefined ? {} : { changeCartQuantity }),
10
+ },
11
+ _disableAddToCart: disableAddToCart,
12
+ });
13
+ return dialog;
14
+ };
15
+ const input = {
16
+ productId: "gid://shopify/Product/42",
17
+ variantId: "gid://shopify/ProductVariant/4242",
18
+ quantity: 2,
19
+ };
20
+ afterEach(() => {
21
+ vi.clearAllMocks();
22
+ });
23
+ describe("Dialog.changeCartQuantity", () => {
24
+ it("forwards the input to the merchant callback", async () => {
25
+ const changeCartQuantity = vi.fn().mockResolvedValue(undefined);
26
+ const dialog = buildDialog(changeCartQuantity);
27
+ await dialog.changeCartQuantity(input);
28
+ expect(changeCartQuantity).toHaveBeenCalledWith(input);
29
+ expect(dialog.canChangeCartQuantity()).toBe(true);
30
+ });
31
+ it("throws an explicit configuration error without the callback", async () => {
32
+ const dialog = buildDialog(undefined);
33
+ await expect(dialog.changeCartQuantity(input)).rejects.toThrowError(/callbacks\.changeCartQuantity/);
34
+ expect(dialog.canChangeCartQuantity()).toBe(false);
35
+ });
36
+ it("is a no-op and reports no capability when disableAddToCart is set", async () => {
37
+ const changeCartQuantity = vi.fn().mockResolvedValue(undefined);
38
+ const dialog = buildDialog(changeCartQuantity, true);
39
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
40
+ await expect(dialog.changeCartQuantity(input)).resolves.toBeUndefined();
41
+ expect(changeCartQuantity).not.toHaveBeenCalled();
42
+ expect(dialog.canChangeCartQuantity()).toBe(false);
43
+ expect(warn).toHaveBeenCalledOnce();
44
+ warn.mockRestore();
45
+ });
46
+ });
@@ -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
+ });
@@ -8,6 +8,8 @@ describe("public API types", () => {
8
8
  expectTypeOf().toMatchTypeOf();
9
9
  // Invalid callback values must be rejected.
10
10
  expectTypeOf().not.toMatchTypeOf();
11
+ expectTypeOf().toMatchTypeOf();
12
+ expectTypeOf().parameters.toMatchTypeOf();
11
13
  expectTypeOf().toEqualTypeOf();
12
14
  expectTypeOf().parameters.toMatchTypeOf();
13
15
  expectTypeOf().toMatchTypeOf();
@@ -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 +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,KAChB,OAAO,CAAC,UAAU,CAepB,CAAC"}
@@ -1,10 +1,12 @@
1
- import { getBaseApiUrl } from "./base";
1
+ import { config } from "../config";
2
+ const PRODUCT_QUESTIONS_PATH = "/public/product-page-questions";
3
+ const API_KEY_HEADER = "x-dialog-api-key";
2
4
  export const loadSuggestions = async (apiKey, locale, productId) => {
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
+ const response = await fetch(`${config.monolithApiUrl}${PRODUCT_QUESTIONS_PATH}?${query.toString()}`, {
6
8
  headers: {
7
- Authorization: apiKey,
9
+ [API_KEY_HEADER]: apiKey,
8
10
  },
9
11
  });
10
12
  const data = await response.json();
@@ -1,15 +1,17 @@
1
- import { AddToCartInput } from "./events";
1
+ import { AddToCartInput, ChangeCartQuantityInput } from "./events";
2
2
  import { SimplifiedProduct } from "./product";
3
3
  import { Theme } from "./theme";
4
4
  export interface DialogCallbacks {
5
5
  addToCart: (input: AddToCartInput) => Promise<void>;
6
6
  getProduct: (productId: string, variantId?: string) => Promise<SimplifiedProduct>;
7
+ changeCartQuantity?: (input: ChangeCartQuantityInput) => Promise<void>;
7
8
  }
8
9
  export interface CurrentProduct {
9
10
  /** The catalog product id — must match the id in the Dialog product feed. */
10
11
  id: string;
11
12
  variantId?: string;
12
13
  }
14
+ export type AnalyticsConsent = "granted";
13
15
  export interface DialogConstructor {
14
16
  apiKey: string;
15
17
  /** BCP-47 locale, e.g. `fr-FR`. */
@@ -24,8 +26,10 @@ export interface DialogConstructor {
24
26
  countryCode?: string;
25
27
  /**
26
28
  * Commerce callbacks. Optional: a search-only integration can omit them —
27
- * the assistant runtime still loads, and only `getProduct()` / `addToCart()`
28
- * throw a configuration error when their callback is absent.
29
+ * the assistant runtime still loads, and `getProduct()`, `addToCart()` and
30
+ * `changeCartQuantity()` throw a configuration error when their callback is
31
+ * absent. `changeCartQuantity` is optional within the set: check
32
+ * `canChangeCartQuantity()` before calling it.
29
33
  */
30
34
  callbacks?: DialogCallbacks;
31
35
  theme?: Partial<Theme>;
@@ -48,6 +52,7 @@ export interface DialogConstructor {
48
52
  * Product links and recommendation browsing are unaffected.
49
53
  */
50
54
  disableAddToCart?: boolean;
55
+ analyticsConsent?: AnalyticsConsent;
51
56
  /**
52
57
  * The product of the page the SDK is instantiated on, when it is a product
53
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,MAAM,UAAU,CAAC;AAC1C,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;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,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;;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AAS,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"}
@@ -51,6 +51,11 @@ export interface AddToCartInput extends AddToCartProductDetails {
51
51
  currency?: string;
52
52
  variantId?: string;
53
53
  }
54
+ export interface ChangeCartQuantityInput {
55
+ productId: string;
56
+ variantId?: string;
57
+ quantity: number;
58
+ }
54
59
  export interface TrackEventPayload extends AddToCartProductDetails {
55
60
  userId?: string;
56
61
  productId: string;
@@ -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;IACjC,iBAAiB,CAAC,EAAE,MAAM,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AM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,kBAAkB,GAC1B,sBAAsB,GACtB,sBAAsB,GACtB,iBAAiB,GACjB,oBAAoB,GACpB,iBAAiB,GACjB,0BAA0B,GAC1B,6BAA6B,GAC7B,8BAA8B,CAAC;AAEnC,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,kBAAkB;IACjD,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,CAAC,CAAC;CACZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-sdk",
3
- "version": "2.12.0",
3
+ "version": "2.14.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
- };