@cimplify/sdk 0.100.5 → 0.101.1

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 (68) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/advanced.js +20 -20
  4. package/dist/advanced.mjs +1 -1
  5. package/dist/{chunk-HSDQWJLA.mjs → chunk-7H6IL7CX.mjs} +2 -2
  6. package/dist/{chunk-RWR7JF7F.mjs → chunk-DKLHCZ5M.mjs} +13 -3
  7. package/dist/{chunk-PNTINRAU.js → chunk-H5SSGN7W.js} +28 -0
  8. package/dist/{chunk-LMD7B33E.js → chunk-ICCCSVN3.js} +4 -4
  9. package/dist/{chunk-JEVCHTKZ.js → chunk-YDA46OZ6.js} +59 -49
  10. package/dist/{chunk-3HU5I5VG.js → chunk-YER7DIOM.js} +15 -0
  11. package/dist/{chunk-RQPXLXB2.mjs → chunk-YHPMFTMN.mjs} +28 -0
  12. package/dist/{chunk-Z7M6GAHS.mjs → chunk-Z3K2D3TE.mjs} +15 -0
  13. package/dist/{client-CrPglBBz.d.ts → client-CdTx7X_X.d.mts} +12 -2
  14. package/dist/{client-CPcZIrjC.d.ts → client-D40kI8z2.d.ts} +2 -2
  15. package/dist/{client-BwRAAk4y.d.mts → client-Db554902.d.ts} +12 -2
  16. package/dist/{client-DGrvLiJv.d.mts → client-WkUcvRvO.d.mts} +2 -2
  17. package/dist/{index-D-LUYk1Y.d.mts → index-BjWUkYgY.d.mts} +3 -3
  18. package/dist/{index-B_RYmvlF.d.ts → index-D3UXgAYl.d.ts} +3 -3
  19. package/dist/index.d.mts +7 -7
  20. package/dist/index.d.ts +7 -7
  21. package/dist/index.js +69 -69
  22. package/dist/index.mjs +3 -3
  23. package/dist/mock/cli.mjs +28 -0
  24. package/dist/mock/library.js +28 -0
  25. package/dist/mock/library.mjs +28 -0
  26. package/dist/mock/msw.js +28 -0
  27. package/dist/mock/msw.mjs +28 -0
  28. package/dist/{payment-BSzy7sly.d.mts → payment-CRqjGrx6.d.mts} +1 -1
  29. package/dist/{payment-jK8ztICx.d.ts → payment-DO1Z1Ip6.d.ts} +1 -1
  30. package/dist/{price-D96h6c6L.d.mts → price-CiQUd_XX.d.mts} +1 -1
  31. package/dist/{price-CJLfcYKd.d.ts → price-D9EOj8y8.d.ts} +1 -1
  32. package/dist/{product-CeV8euw4.d.mts → product-DwKdC_to.d.mts} +727 -625
  33. package/dist/{product-CeV8euw4.d.ts → product-DwKdC_to.d.ts} +727 -625
  34. package/dist/react.d.mts +7 -4
  35. package/dist/react.d.ts +7 -4
  36. package/dist/react.js +75 -34
  37. package/dist/react.mjs +52 -11
  38. package/dist/server/evict.d.mts +12 -8
  39. package/dist/server/evict.d.ts +12 -8
  40. package/dist/server/evict.js +53 -7
  41. package/dist/server/evict.mjs +53 -7
  42. package/dist/server/tanstack.d.mts +4 -2
  43. package/dist/server/tanstack.d.ts +4 -2
  44. package/dist/server/tanstack.js +53 -14
  45. package/dist/server/tanstack.mjs +53 -14
  46. package/dist/{server-zyrpzJVn.d.ts → server-CeDb93WA.d.ts} +13 -1
  47. package/dist/{server-DRAW2OOX.d.mts → server-D-nSkrUr.d.mts} +13 -1
  48. package/dist/server.d.mts +4 -4
  49. package/dist/server.d.ts +4 -4
  50. package/dist/server.js +7 -7
  51. package/dist/server.mjs +2 -2
  52. package/dist/testing/msw.d.mts +2 -2
  53. package/dist/testing/msw.d.ts +2 -2
  54. package/dist/testing/msw.js +2 -2
  55. package/dist/testing/msw.mjs +1 -1
  56. package/dist/testing/suite.d.mts +6 -6
  57. package/dist/testing/suite.d.ts +6 -6
  58. package/dist/testing/suite.js +23 -23
  59. package/dist/testing/suite.mjs +4 -4
  60. package/dist/testing.d.mts +20 -20
  61. package/dist/testing.d.ts +20 -20
  62. package/dist/testing.js +79 -79
  63. package/dist/testing.mjs +5 -5
  64. package/dist/utils.d.mts +4 -4
  65. package/dist/utils.d.ts +4 -4
  66. package/package.json +1 -1
  67. package/registry/cart-summary.json +1 -1
  68. package/registry/chat-widget.json +1 -1
@@ -1,6 +1,6 @@
1
- export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-BwRAAk4y.mjs';
2
- import './product-CeV8euw4.mjs';
3
- import './payment-BSzy7sly.mjs';
1
+ export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-CdTx7X_X.mjs';
2
+ import './product-DwKdC_to.mjs';
3
+ import './payment-CRqjGrx6.mjs';
4
4
 
5
5
  declare function generateIdempotencyKey(prefix?: string): string;
6
6
 
@@ -1,6 +1,6 @@
1
- export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-CrPglBBz.js';
2
- import './product-CeV8euw4.js';
3
- import './payment-jK8ztICx.js';
1
+ export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-Db554902.js';
2
+ import './product-DwKdC_to.js';
3
+ import './payment-DO1Z1Ip6.js';
4
4
 
5
5
  declare function generateIdempotencyKey(prefix?: string): string;
6
6
 
package/dist/advanced.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3HU5I5VG_js = require('./chunk-3HU5I5VG.js');
3
+ var chunkYER7DIOM_js = require('./chunk-YER7DIOM.js');
4
4
  require('./chunk-WMEC5JWN.js');
5
5
  require('./chunk-NIOUSKQQ.js');
6
6
  require('./chunk-OWW5GUSB.js');
@@ -9,77 +9,77 @@ require('./chunk-OWW5GUSB.js');
9
9
 
10
10
  Object.defineProperty(exports, "AuthService", {
11
11
  enumerable: true,
12
- get: function () { return chunk3HU5I5VG_js.AuthService; }
12
+ get: function () { return chunkYER7DIOM_js.AuthService; }
13
13
  });
14
14
  Object.defineProperty(exports, "BusinessService", {
15
15
  enumerable: true,
16
- get: function () { return chunk3HU5I5VG_js.BusinessService; }
16
+ get: function () { return chunkYER7DIOM_js.BusinessService; }
17
17
  });
18
18
  Object.defineProperty(exports, "CartOperations", {
19
19
  enumerable: true,
20
- get: function () { return chunk3HU5I5VG_js.CartOperations; }
20
+ get: function () { return chunkYER7DIOM_js.CartOperations; }
21
21
  });
22
22
  Object.defineProperty(exports, "CatalogueQueries", {
23
23
  enumerable: true,
24
- get: function () { return chunk3HU5I5VG_js.CatalogueQueries; }
24
+ get: function () { return chunkYER7DIOM_js.CatalogueQueries; }
25
25
  });
26
26
  Object.defineProperty(exports, "CheckoutOperations", {
27
27
  enumerable: true,
28
- get: function () { return chunk3HU5I5VG_js.CheckoutService; }
28
+ get: function () { return chunkYER7DIOM_js.CheckoutService; }
29
29
  });
30
30
  Object.defineProperty(exports, "CheckoutService", {
31
31
  enumerable: true,
32
- get: function () { return chunk3HU5I5VG_js.CheckoutService; }
32
+ get: function () { return chunkYER7DIOM_js.CheckoutService; }
33
33
  });
34
34
  Object.defineProperty(exports, "CimplifyElement", {
35
35
  enumerable: true,
36
- get: function () { return chunk3HU5I5VG_js.CimplifyElement; }
36
+ get: function () { return chunkYER7DIOM_js.CimplifyElement; }
37
37
  });
38
38
  Object.defineProperty(exports, "CimplifyElements", {
39
39
  enumerable: true,
40
- get: function () { return chunk3HU5I5VG_js.CimplifyElements; }
40
+ get: function () { return chunkYER7DIOM_js.CimplifyElements; }
41
41
  });
42
42
  Object.defineProperty(exports, "ELEMENT_TYPES", {
43
43
  enumerable: true,
44
- get: function () { return chunk3HU5I5VG_js.ELEMENT_TYPES; }
44
+ get: function () { return chunkYER7DIOM_js.ELEMENT_TYPES; }
45
45
  });
46
46
  Object.defineProperty(exports, "EVENT_TYPES", {
47
47
  enumerable: true,
48
- get: function () { return chunk3HU5I5VG_js.EVENT_TYPES; }
48
+ get: function () { return chunkYER7DIOM_js.EVENT_TYPES; }
49
49
  });
50
50
  Object.defineProperty(exports, "FxService", {
51
51
  enumerable: true,
52
- get: function () { return chunk3HU5I5VG_js.FxService; }
52
+ get: function () { return chunkYER7DIOM_js.FxService; }
53
53
  });
54
54
  Object.defineProperty(exports, "InventoryService", {
55
55
  enumerable: true,
56
- get: function () { return chunk3HU5I5VG_js.InventoryService; }
56
+ get: function () { return chunkYER7DIOM_js.InventoryService; }
57
57
  });
58
58
  Object.defineProperty(exports, "LinkService", {
59
59
  enumerable: true,
60
- get: function () { return chunk3HU5I5VG_js.LinkService; }
60
+ get: function () { return chunkYER7DIOM_js.LinkService; }
61
61
  });
62
62
  Object.defineProperty(exports, "LiteService", {
63
63
  enumerable: true,
64
- get: function () { return chunk3HU5I5VG_js.LiteService; }
64
+ get: function () { return chunkYER7DIOM_js.LiteService; }
65
65
  });
66
66
  Object.defineProperty(exports, "MESSAGE_TYPES", {
67
67
  enumerable: true,
68
- get: function () { return chunk3HU5I5VG_js.MESSAGE_TYPES; }
68
+ get: function () { return chunkYER7DIOM_js.MESSAGE_TYPES; }
69
69
  });
70
70
  Object.defineProperty(exports, "OrderQueries", {
71
71
  enumerable: true,
72
- get: function () { return chunk3HU5I5VG_js.OrderQueries; }
72
+ get: function () { return chunkYER7DIOM_js.OrderQueries; }
73
73
  });
74
74
  Object.defineProperty(exports, "SchedulingService", {
75
75
  enumerable: true,
76
- get: function () { return chunk3HU5I5VG_js.SchedulingService; }
76
+ get: function () { return chunkYER7DIOM_js.SchedulingService; }
77
77
  });
78
78
  Object.defineProperty(exports, "createElements", {
79
79
  enumerable: true,
80
- get: function () { return chunk3HU5I5VG_js.createElements; }
80
+ get: function () { return chunkYER7DIOM_js.createElements; }
81
81
  });
82
82
  Object.defineProperty(exports, "generateIdempotencyKey", {
83
83
  enumerable: true,
84
- get: function () { return chunk3HU5I5VG_js.generateIdempotencyKey; }
84
+ get: function () { return chunkYER7DIOM_js.generateIdempotencyKey; }
85
85
  });
package/dist/advanced.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-Z7M6GAHS.mjs';
1
+ export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-Z3K2D3TE.mjs';
2
2
  import './chunk-DLW3RWRK.mjs';
3
3
  import './chunk-O3YUHLZL.mjs';
4
4
  import './chunk-3G6RQLXK.mjs';
@@ -1,5 +1,5 @@
1
- import { createMockApp } from './chunk-RQPXLXB2.mjs';
2
- import { createCimplifyClient } from './chunk-RWR7JF7F.mjs';
1
+ import { createMockApp } from './chunk-YHPMFTMN.mjs';
2
+ import { createCimplifyClient } from './chunk-DKLHCZ5M.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  var cimplifyRegistry = z.registry();
@@ -1,4 +1,4 @@
1
- import { safe, generateIdempotencyKey, err, ok, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-Z7M6GAHS.mjs';
1
+ import { safe, generateIdempotencyKey, err, ok, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-Z3K2D3TE.mjs';
2
2
  import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-O3YUHLZL.mjs';
3
3
 
4
4
  // src/store-credit.ts
@@ -726,6 +726,7 @@ var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
726
726
  var SESSION_SYNC_STORAGE_KEY = "cimplify_session_sync";
727
727
  var ORDER_TOKEN_PREFIX = "cimplify_ot_";
728
728
  var SESSION_TOKEN_HEADER = "x-session-token";
729
+ var LOCATION_ID_QUERY_PARAMETER = "location_id";
729
730
  var ORDER_TOKEN_TTL_MS = 24 * 60 * 60 * 1e3;
730
731
  var DEFAULT_TIMEOUT_MS = 5e3;
731
732
  var DEFAULT_MAX_RETRIES = 3;
@@ -878,8 +879,14 @@ var CimplifyClient = class {
878
879
  const url = `${base}${path}`;
879
880
  const locationId = this.context.location_id;
880
881
  if (!locationId) return url;
881
- const separator = url.includes("?") ? "&" : "?";
882
- return `${url}${separator}location_id=${encodeURIComponent(locationId)}`;
882
+ const fragmentIndex = url.indexOf("#");
883
+ const urlWithoutFragment = fragmentIndex === -1 ? url : url.slice(0, fragmentIndex);
884
+ const fragment = fragmentIndex === -1 ? "" : url.slice(fragmentIndex);
885
+ const queryIndex = urlWithoutFragment.indexOf("?");
886
+ const query = queryIndex === -1 ? "" : urlWithoutFragment.slice(queryIndex + 1);
887
+ if (new URLSearchParams(query).has(LOCATION_ID_QUERY_PARAMETER)) return url;
888
+ const separator = queryIndex === -1 ? "?" : "&";
889
+ return `${urlWithoutFragment}${separator}${LOCATION_ID_QUERY_PARAMETER}=${encodeURIComponent(locationId)}${fragment}`;
883
890
  }
884
891
  stopTrackingPageViews() {
885
892
  this.stopPageViewTracking?.();
@@ -963,6 +970,9 @@ var CimplifyClient = class {
963
970
  getSessionEpoch() {
964
971
  return this.sessionEpoch;
965
972
  }
973
+ getSessionToken() {
974
+ return this.sessionToken;
975
+ }
966
976
  publishSessionClaimed(customerName) {
967
977
  if (!this.sessionToken) return;
968
978
  this.broadcastSessionSync({
@@ -2308,6 +2308,10 @@ function buildV1(deps) {
2308
2308
  app.delete("/cart/items/:cart_item_id", (c) => tryRoute(c, () => deps.cart.removeItem(c.var.session, c.req.param("cart_item_id"))));
2309
2309
  app.get("/cart/count", (c) => tryRoute(c, () => deps.cart.getCount(c.var.session)));
2310
2310
  app.get("/cart/total", (c) => tryRoute(c, () => deps.cart.getTotal(c.var.session)));
2311
+ app.post("/cart/destination-quote", async (c) => {
2312
+ const body = await c.req.json();
2313
+ return tryRoute(c, () => deps.cart.quoteDestination(c.var.session, body));
2314
+ });
2311
2315
  app.post("/cart/coupons", async (c) => {
2312
2316
  const body = await c.req.json().catch(() => ({}));
2313
2317
  return tryRoute(c, () => deps.cart.applyCoupon(c.var.session, body.coupon_code ?? ""));
@@ -4796,6 +4800,30 @@ function createCartService(opts) {
4796
4800
  getTotal(session) {
4797
4801
  return findOrCreate(session).total_price;
4798
4802
  },
4803
+ quoteDestination(session, body) {
4804
+ const cart = findOrCreate(session);
4805
+ const city = body.address_info.city?.trim();
4806
+ const region = body.address_info.region?.trim();
4807
+ const label = city && region ? `${city}, ${region}` : city ?? region ?? "";
4808
+ const deliveryFee = body.order_type === "delivery" ? "5.00" : "0.00";
4809
+ const total = (Number(cart.total_price) + Number(deliveryFee)).toFixed(2);
4810
+ return {
4811
+ subtotal: cart.subtotal,
4812
+ tax_amount: cart.tax_amount,
4813
+ service_charge: cart.service_charge,
4814
+ total_discounts: cart.total_discounts,
4815
+ delivery_fee: deliveryFee,
4816
+ statutory_charge_total: "0.00",
4817
+ statutory_charges: [],
4818
+ total,
4819
+ currency: cart.currency,
4820
+ tax_jurisdiction_label: label,
4821
+ tax_inclusive: false,
4822
+ tax_rate: cart.tax_rate,
4823
+ delivery_fee_details: null,
4824
+ address_info: body.address_info
4825
+ };
4826
+ },
4799
4827
  toUICart(cart) {
4800
4828
  return toUICart(registry, cart);
4801
4829
  },
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkPNTINRAU_js = require('./chunk-PNTINRAU.js');
4
- var chunkJEVCHTKZ_js = require('./chunk-JEVCHTKZ.js');
3
+ var chunkH5SSGN7W_js = require('./chunk-H5SSGN7W.js');
4
+ var chunkYDA46OZ6_js = require('./chunk-YDA46OZ6.js');
5
5
  var zod = require('zod');
6
6
 
7
7
  var cimplifyRegistry = zod.z.registry();
@@ -600,7 +600,7 @@ async function toForwardedRequest(input, init) {
600
600
  };
601
601
  }
602
602
  function createTestClient(options = {}) {
603
- const mock = chunkPNTINRAU_js.createMockApp(options);
603
+ const mock = chunkH5SSGN7W_js.createMockApp(options);
604
604
  let sessionToken;
605
605
  const fetchImpl = async (input, init) => {
606
606
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
@@ -619,7 +619,7 @@ function createTestClient(options = {}) {
619
619
  if (echoed) sessionToken = echoed;
620
620
  return res;
621
621
  };
622
- const client = chunkJEVCHTKZ_js.createCimplifyClient({
622
+ const client = chunkYDA46OZ6_js.createCimplifyClient({
623
623
  baseUrl: TEST_BASE_URL,
624
624
  // Link mock lives at /v1/link on the same Hono app, so point the SDK's
625
625
  // separate Link transport at the same TEST_BASE_URL.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk3HU5I5VG_js = require('./chunk-3HU5I5VG.js');
3
+ var chunkYER7DIOM_js = require('./chunk-YER7DIOM.js');
4
4
  var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
5
5
 
6
6
  // src/store-credit.ts
@@ -13,7 +13,7 @@ var StoreCreditQueries = class {
13
13
  * currency. Requires a signed-in customer; returns an error otherwise.
14
14
  */
15
15
  async balance() {
16
- return chunk3HU5I5VG_js.safe(this.client.get("/api/v1/store-credit/balance"));
16
+ return chunkYER7DIOM_js.safe(this.client.get("/api/v1/store-credit/balance"));
17
17
  }
18
18
  };
19
19
 
@@ -262,7 +262,7 @@ var ActivityService = class {
262
262
  this.sendEvents([event]);
263
263
  }
264
264
  async getState() {
265
- return chunk3HU5I5VG_js.safe(this.client.get("/api/v1/activity/state"));
265
+ return chunkYER7DIOM_js.safe(this.client.get("/api/v1/activity/state"));
266
266
  }
267
267
  async getRecommendations(options) {
268
268
  const params = new URLSearchParams();
@@ -270,10 +270,10 @@ var ActivityService = class {
270
270
  if (options?.limit) params.set("limit", String(options.limit));
271
271
  const query = params.toString();
272
272
  const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
273
- return chunk3HU5I5VG_js.safe(this.client.get(path));
273
+ return chunkYER7DIOM_js.safe(this.client.get(path));
274
274
  }
275
275
  async dismissMessage(code) {
276
- return chunk3HU5I5VG_js.safe(
276
+ return chunkYER7DIOM_js.safe(
277
277
  this.client.post("/api/v1/activity/messages/dismiss", { code })
278
278
  );
279
279
  }
@@ -369,16 +369,16 @@ var SubscriptionService = class {
369
369
  this.client = client;
370
370
  }
371
371
  async list() {
372
- return chunk3HU5I5VG_js.safe(this.client.get("/api/v1/subscriptions"));
372
+ return chunkYER7DIOM_js.safe(this.client.get("/api/v1/subscriptions"));
373
373
  }
374
374
  async get(id) {
375
375
  const encodedId = encodeURIComponent(id);
376
- return chunk3HU5I5VG_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
376
+ return chunkYER7DIOM_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
377
377
  }
378
378
  async cancel(id, reason, opts) {
379
379
  const encodedId = encodeURIComponent(id);
380
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
381
- return chunk3HU5I5VG_js.safe(
380
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
381
+ return chunkYER7DIOM_js.safe(
382
382
  this.client.post(
383
383
  `/api/v1/subscriptions/${encodedId}/cancel`,
384
384
  { reason },
@@ -388,20 +388,20 @@ var SubscriptionService = class {
388
388
  }
389
389
  async pause(id) {
390
390
  const encodedId = encodeURIComponent(id);
391
- return chunk3HU5I5VG_js.safe(
391
+ return chunkYER7DIOM_js.safe(
392
392
  this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
393
393
  );
394
394
  }
395
395
  async resume(id) {
396
396
  const encodedId = encodeURIComponent(id);
397
- return chunk3HU5I5VG_js.safe(
397
+ return chunkYER7DIOM_js.safe(
398
398
  this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
399
399
  );
400
400
  }
401
401
  async skipNextRenewal(id, opts) {
402
402
  const encodedId = encodeURIComponent(id);
403
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
404
- return chunk3HU5I5VG_js.safe(
403
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
404
+ return chunkYER7DIOM_js.safe(
405
405
  this.client.post(
406
406
  `/api/v1/subscriptions/${encodedId}/skip`,
407
407
  void 0,
@@ -417,8 +417,8 @@ var UploadService = class {
417
417
  this.client = client;
418
418
  }
419
419
  async init(filename, contentType, sizeBytes, opts) {
420
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
421
- return chunk3HU5I5VG_js.safe(
420
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
421
+ return chunkYER7DIOM_js.safe(
422
422
  this.client.post(
423
423
  "/api/v1/uploads/init",
424
424
  {
@@ -431,7 +431,7 @@ var UploadService = class {
431
431
  );
432
432
  }
433
433
  async confirm(uploadId) {
434
- return chunk3HU5I5VG_js.safe(
434
+ return chunkYER7DIOM_js.safe(
435
435
  this.client.post("/api/v1/uploads/confirm", {
436
436
  upload_id: uploadId
437
437
  })
@@ -477,7 +477,7 @@ var PlacesService = class {
477
477
  this.client = client;
478
478
  }
479
479
  async autocomplete(input, sessionToken) {
480
- return chunk3HU5I5VG_js.safe(
480
+ return chunkYER7DIOM_js.safe(
481
481
  this.client.post("/api/v1/places/autocomplete", {
482
482
  input,
483
483
  sessionToken
@@ -485,7 +485,7 @@ var PlacesService = class {
485
485
  );
486
486
  }
487
487
  async details(placeId, sessionToken) {
488
- return chunk3HU5I5VG_js.safe(
488
+ return chunkYER7DIOM_js.safe(
489
489
  this.client.post("/api/v1/places/details", {
490
490
  place_id: placeId,
491
491
  sessionToken
@@ -504,7 +504,7 @@ var DeliveryService = class {
504
504
  params.set("dropoff_lat", String(dropoffLat));
505
505
  params.set("dropoff_lng", String(dropoffLng));
506
506
  if (country) params.set("country", country);
507
- return chunk3HU5I5VG_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
507
+ return chunkYER7DIOM_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
508
508
  }
509
509
  async getOptions(queryOrLatitude, longitude, legacyOptions) {
510
510
  const query = typeof queryOrLatitude === "number" ? {
@@ -518,7 +518,7 @@ var DeliveryService = class {
518
518
  if (query.country) params.set("country", query.country);
519
519
  if (query.currency) params.set("currency", query.currency);
520
520
  if (query.orderValue != null) params.set("order_value", String(query.orderValue));
521
- return chunk3HU5I5VG_js.safe(
521
+ return chunkYER7DIOM_js.safe(
522
522
  this.client.get(`/api/v1/delivery/options?${params.toString()}`)
523
523
  );
524
524
  }
@@ -595,7 +595,7 @@ var SupportService = class {
595
595
  async claimConversation() {
596
596
  const accessToken = this.client.getAccessToken();
597
597
  if (!accessToken) {
598
- return chunk3HU5I5VG_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
598
+ return chunkYER7DIOM_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
599
599
  }
600
600
  if (this.claimInFlight) {
601
601
  if (this.claimInFlightToken === accessToken) return this.claimInFlight;
@@ -603,12 +603,12 @@ var SupportService = class {
603
603
  return this.claimConversation();
604
604
  }
605
605
  if (this.lastClaimedAccessToken === accessToken) {
606
- return chunk3HU5I5VG_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
606
+ return chunkYER7DIOM_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
607
607
  }
608
608
  const epoch = this.client.getSessionEpoch();
609
609
  this.claimInFlightToken = accessToken;
610
610
  this.claimInFlight = (async () => {
611
- const result = await chunk3HU5I5VG_js.safe(
611
+ const result = await chunkYER7DIOM_js.safe(
612
612
  this.client.post(
613
613
  "/api/v1/support/conversation/claim",
614
614
  { access_token: accessToken },
@@ -617,7 +617,7 @@ var SupportService = class {
617
617
  );
618
618
  if (result.ok) {
619
619
  if (this.client.getSessionEpoch() !== epoch) {
620
- return chunk3HU5I5VG_js.err(
620
+ return chunkYER7DIOM_js.err(
621
621
  new chunkNIOUSKQQ_js.CimplifyError("session_cleared", "Session was cleared during the claim")
622
622
  );
623
623
  }
@@ -646,20 +646,20 @@ var SupportService = class {
646
646
  * the inbox with empty threads.
647
647
  */
648
648
  async peekConversation() {
649
- const result = await chunk3HU5I5VG_js.safe(
649
+ const result = await chunkYER7DIOM_js.safe(
650
650
  this.client.get("/api/v1/support/conversation")
651
651
  );
652
652
  if (!result.ok) return result;
653
- if (!result.value.conversation) return chunk3HU5I5VG_js.ok(null);
654
- return chunk3HU5I5VG_js.ok({
653
+ if (!result.value.conversation) return chunkYER7DIOM_js.ok(null);
654
+ return chunkYER7DIOM_js.ok({
655
655
  conversation: result.value.conversation,
656
656
  messages: result.value.messages
657
657
  });
658
658
  }
659
659
  /** Open (or resume) the customer's widget conversation. */
660
660
  async openConversation(opts) {
661
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
662
- return chunk3HU5I5VG_js.safe(
661
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
662
+ return chunkYER7DIOM_js.safe(
663
663
  this.client.post("/api/v1/support/conversation", void 0, {
664
664
  idempotencyKey
665
665
  })
@@ -674,8 +674,8 @@ var SupportService = class {
674
674
  * server resolves it thread-scoped and echoes the quote as `reply_to`.
675
675
  */
676
676
  async sendMessage(content, opts) {
677
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
678
- return chunk3HU5I5VG_js.safe(
677
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
678
+ return chunkYER7DIOM_js.safe(
679
679
  this.client.post(
680
680
  "/api/v1/support/conversation/messages",
681
681
  {
@@ -699,11 +699,11 @@ var SupportService = class {
699
699
  if (options.limit) params.set("limit", String(options.limit));
700
700
  const query = params.toString();
701
701
  const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
702
- return chunk3HU5I5VG_js.safe(this.client.get(path));
702
+ return chunkYER7DIOM_js.safe(this.client.get(path));
703
703
  }
704
704
  /** React to a message in the active conversation by its `ChatMessage.id`. */
705
705
  async reactToMessage(messageId, emoji) {
706
- return chunk3HU5I5VG_js.safe(
706
+ return chunkYER7DIOM_js.safe(
707
707
  this.client.post(
708
708
  `/api/v1/support/conversation/messages/${messageId}/reactions`,
709
709
  { emoji }
@@ -712,8 +712,8 @@ var SupportService = class {
712
712
  }
713
713
  /** Ask for a person: flags the thread for the merchant's inbox. */
714
714
  async requestHuman(opts) {
715
- const idempotencyKey = opts?.idempotencyKey ?? chunk3HU5I5VG_js.generateIdempotencyKey();
716
- return chunk3HU5I5VG_js.safe(
715
+ const idempotencyKey = opts?.idempotencyKey ?? chunkYER7DIOM_js.generateIdempotencyKey();
716
+ return chunkYER7DIOM_js.safe(
717
717
  this.client.post(
718
718
  "/api/v1/support/conversation/handoff",
719
719
  void 0,
@@ -728,6 +728,7 @@ var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
728
728
  var SESSION_SYNC_STORAGE_KEY = "cimplify_session_sync";
729
729
  var ORDER_TOKEN_PREFIX = "cimplify_ot_";
730
730
  var SESSION_TOKEN_HEADER = "x-session-token";
731
+ var LOCATION_ID_QUERY_PARAMETER = "location_id";
731
732
  var ORDER_TOKEN_TTL_MS = 24 * 60 * 60 * 1e3;
732
733
  var DEFAULT_TIMEOUT_MS = 5e3;
733
734
  var DEFAULT_MAX_RETRIES = 3;
@@ -880,8 +881,14 @@ var CimplifyClient = class {
880
881
  const url = `${base}${path}`;
881
882
  const locationId = this.context.location_id;
882
883
  if (!locationId) return url;
883
- const separator = url.includes("?") ? "&" : "?";
884
- return `${url}${separator}location_id=${encodeURIComponent(locationId)}`;
884
+ const fragmentIndex = url.indexOf("#");
885
+ const urlWithoutFragment = fragmentIndex === -1 ? url : url.slice(0, fragmentIndex);
886
+ const fragment = fragmentIndex === -1 ? "" : url.slice(fragmentIndex);
887
+ const queryIndex = urlWithoutFragment.indexOf("?");
888
+ const query = queryIndex === -1 ? "" : urlWithoutFragment.slice(queryIndex + 1);
889
+ if (new URLSearchParams(query).has(LOCATION_ID_QUERY_PARAMETER)) return url;
890
+ const separator = queryIndex === -1 ? "?" : "&";
891
+ return `${urlWithoutFragment}${separator}${LOCATION_ID_QUERY_PARAMETER}=${encodeURIComponent(locationId)}${fragment}`;
885
892
  }
886
893
  stopTrackingPageViews() {
887
894
  this.stopPageViewTracking?.();
@@ -965,6 +972,9 @@ var CimplifyClient = class {
965
972
  getSessionEpoch() {
966
973
  return this.sessionEpoch;
967
974
  }
975
+ getSessionToken() {
976
+ return this.sessionToken;
977
+ }
968
978
  publishSessionClaimed(customerName) {
969
979
  if (!this.sessionToken) return;
970
980
  this.broadcastSessionSync({
@@ -1438,25 +1448,25 @@ var CimplifyClient = class {
1438
1448
  }
1439
1449
  get catalogue() {
1440
1450
  if (!this._catalogue) {
1441
- this._catalogue = new chunk3HU5I5VG_js.CatalogueQueries(this);
1451
+ this._catalogue = new chunkYER7DIOM_js.CatalogueQueries(this);
1442
1452
  }
1443
1453
  return this._catalogue;
1444
1454
  }
1445
1455
  get cart() {
1446
1456
  if (!this._cart) {
1447
- this._cart = new chunk3HU5I5VG_js.CartOperations(this);
1457
+ this._cart = new chunkYER7DIOM_js.CartOperations(this);
1448
1458
  }
1449
1459
  return this._cart;
1450
1460
  }
1451
1461
  get checkout() {
1452
1462
  if (!this._checkout) {
1453
- this._checkout = new chunk3HU5I5VG_js.CheckoutService(this);
1463
+ this._checkout = new chunkYER7DIOM_js.CheckoutService(this);
1454
1464
  }
1455
1465
  return this._checkout;
1456
1466
  }
1457
1467
  get orders() {
1458
1468
  if (!this._orders) {
1459
- this._orders = new chunk3HU5I5VG_js.OrderQueries(this);
1469
+ this._orders = new chunkYER7DIOM_js.OrderQueries(this);
1460
1470
  }
1461
1471
  return this._orders;
1462
1472
  }
@@ -1486,43 +1496,43 @@ var CimplifyClient = class {
1486
1496
  }
1487
1497
  get link() {
1488
1498
  if (!this._link) {
1489
- this._link = new chunk3HU5I5VG_js.LinkService(this);
1499
+ this._link = new chunkYER7DIOM_js.LinkService(this);
1490
1500
  }
1491
1501
  return this._link;
1492
1502
  }
1493
1503
  get auth() {
1494
1504
  if (!this._auth) {
1495
- this._auth = new chunk3HU5I5VG_js.AuthService(this);
1505
+ this._auth = new chunkYER7DIOM_js.AuthService(this);
1496
1506
  }
1497
1507
  return this._auth;
1498
1508
  }
1499
1509
  get business() {
1500
1510
  if (!this._business) {
1501
- this._business = new chunk3HU5I5VG_js.BusinessService(this);
1511
+ this._business = new chunkYER7DIOM_js.BusinessService(this);
1502
1512
  }
1503
1513
  return this._business;
1504
1514
  }
1505
1515
  get inventory() {
1506
1516
  if (!this._inventory) {
1507
- this._inventory = new chunk3HU5I5VG_js.InventoryService(this);
1517
+ this._inventory = new chunkYER7DIOM_js.InventoryService(this);
1508
1518
  }
1509
1519
  return this._inventory;
1510
1520
  }
1511
1521
  get scheduling() {
1512
1522
  if (!this._scheduling) {
1513
- this._scheduling = new chunk3HU5I5VG_js.SchedulingService(this);
1523
+ this._scheduling = new chunkYER7DIOM_js.SchedulingService(this);
1514
1524
  }
1515
1525
  return this._scheduling;
1516
1526
  }
1517
1527
  get lite() {
1518
1528
  if (!this._lite) {
1519
- this._lite = new chunk3HU5I5VG_js.LiteService(this);
1529
+ this._lite = new chunkYER7DIOM_js.LiteService(this);
1520
1530
  }
1521
1531
  return this._lite;
1522
1532
  }
1523
1533
  get fx() {
1524
1534
  if (!this._fx) {
1525
- this._fx = new chunk3HU5I5VG_js.FxService(this);
1535
+ this._fx = new chunkYER7DIOM_js.FxService(this);
1526
1536
  }
1527
1537
  return this._fx;
1528
1538
  }
@@ -1557,7 +1567,7 @@ var CimplifyClient = class {
1557
1567
  if (businessId) {
1558
1568
  this.setBusinessId(businessId);
1559
1569
  }
1560
- return chunk3HU5I5VG_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
1570
+ return chunkYER7DIOM_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
1561
1571
  }
1562
1572
  };
1563
1573
  function createCimplifyClient(config = {}) {
@@ -668,6 +668,9 @@ var CartOperations = class {
668
668
  async getTotal() {
669
669
  return safe(this.client.get("/api/v1/cart/total"));
670
670
  }
671
+ async quoteDestination(input) {
672
+ return safe(this.client.post("/api/v1/cart/destination-quote", input));
673
+ }
671
674
  async getSummary() {
672
675
  const cartResult = await this.get();
673
676
  if (!cartResult.ok) return cartResult;
@@ -2370,6 +2373,7 @@ var ELEMENT_TYPES = {
2370
2373
  var MESSAGE_TYPES = {
2371
2374
  INIT: "init",
2372
2375
  SET_TOKEN: "set_token",
2376
+ SET_SESSION: "set_session",
2373
2377
  SET_CART: "set_cart",
2374
2378
  GET_DATA: "get_data",
2375
2379
  NAVIGATE: "navigate",
@@ -3132,6 +3136,9 @@ var CimplifyElements = class {
3132
3136
  getPublicKey() {
3133
3137
  return this.client.getPublicKey();
3134
3138
  }
3139
+ getSessionToken() {
3140
+ return this.client.getSessionToken();
3141
+ }
3135
3142
  getBusinessId() {
3136
3143
  return this.businessId;
3137
3144
  }
@@ -3239,8 +3246,12 @@ var CimplifyElements = class {
3239
3246
  };
3240
3247
  }
3241
3248
  broadcastAccessToken(token) {
3249
+ const sessionToken = this.client.getSessionToken();
3242
3250
  this.elements.forEach((element) => {
3243
3251
  element.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3252
+ if (sessionToken) {
3253
+ element.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
3254
+ }
3244
3255
  });
3245
3256
  }
3246
3257
  startEmbeddedAuth(sourceElement, request) {
@@ -3582,6 +3593,10 @@ var CimplifyElement = class {
3582
3593
  if (token) {
3583
3594
  this.sendMessage({ type: MESSAGE_TYPES.SET_TOKEN, token });
3584
3595
  }
3596
+ const sessionToken = this.parent.getSessionToken();
3597
+ if (sessionToken) {
3598
+ this.sendMessage({ type: MESSAGE_TYPES.SET_SESSION, sessionToken });
3599
+ }
3585
3600
  this.pendingInit = null;
3586
3601
  }
3587
3602
  this.flushPending();