@cimplify/sdk 0.20.0 → 0.20.2

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/dist/advanced.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkFLPI2VVJ_js = require('./chunk-FLPI2VVJ.js');
4
- var chunkKSN3RJFL_js = require('./chunk-KSN3RJFL.js');
5
- require('./chunk-2BSYTQAY.js');
4
+ var chunkUVBJDWIV_js = require('./chunk-UVBJDWIV.js');
5
+ require('./chunk-64OCG2TJ.js');
6
6
 
7
7
 
8
8
 
@@ -16,77 +16,77 @@ Object.defineProperty(exports, "query", {
16
16
  });
17
17
  Object.defineProperty(exports, "AuthService", {
18
18
  enumerable: true,
19
- get: function () { return chunkKSN3RJFL_js.AuthService; }
19
+ get: function () { return chunkUVBJDWIV_js.AuthService; }
20
20
  });
21
21
  Object.defineProperty(exports, "BusinessService", {
22
22
  enumerable: true,
23
- get: function () { return chunkKSN3RJFL_js.BusinessService; }
23
+ get: function () { return chunkUVBJDWIV_js.BusinessService; }
24
24
  });
25
25
  Object.defineProperty(exports, "CartOperations", {
26
26
  enumerable: true,
27
- get: function () { return chunkKSN3RJFL_js.CartOperations; }
27
+ get: function () { return chunkUVBJDWIV_js.CartOperations; }
28
28
  });
29
29
  Object.defineProperty(exports, "CatalogueQueries", {
30
30
  enumerable: true,
31
- get: function () { return chunkKSN3RJFL_js.CatalogueQueries; }
31
+ get: function () { return chunkUVBJDWIV_js.CatalogueQueries; }
32
32
  });
33
33
  Object.defineProperty(exports, "CheckoutOperations", {
34
34
  enumerable: true,
35
- get: function () { return chunkKSN3RJFL_js.CheckoutService; }
35
+ get: function () { return chunkUVBJDWIV_js.CheckoutService; }
36
36
  });
37
37
  Object.defineProperty(exports, "CheckoutService", {
38
38
  enumerable: true,
39
- get: function () { return chunkKSN3RJFL_js.CheckoutService; }
39
+ get: function () { return chunkUVBJDWIV_js.CheckoutService; }
40
40
  });
41
41
  Object.defineProperty(exports, "CimplifyElement", {
42
42
  enumerable: true,
43
- get: function () { return chunkKSN3RJFL_js.CimplifyElement; }
43
+ get: function () { return chunkUVBJDWIV_js.CimplifyElement; }
44
44
  });
45
45
  Object.defineProperty(exports, "CimplifyElements", {
46
46
  enumerable: true,
47
- get: function () { return chunkKSN3RJFL_js.CimplifyElements; }
47
+ get: function () { return chunkUVBJDWIV_js.CimplifyElements; }
48
48
  });
49
49
  Object.defineProperty(exports, "ELEMENT_TYPES", {
50
50
  enumerable: true,
51
- get: function () { return chunkKSN3RJFL_js.ELEMENT_TYPES; }
51
+ get: function () { return chunkUVBJDWIV_js.ELEMENT_TYPES; }
52
52
  });
53
53
  Object.defineProperty(exports, "EVENT_TYPES", {
54
54
  enumerable: true,
55
- get: function () { return chunkKSN3RJFL_js.EVENT_TYPES; }
55
+ get: function () { return chunkUVBJDWIV_js.EVENT_TYPES; }
56
56
  });
57
57
  Object.defineProperty(exports, "FxService", {
58
58
  enumerable: true,
59
- get: function () { return chunkKSN3RJFL_js.FxService; }
59
+ get: function () { return chunkUVBJDWIV_js.FxService; }
60
60
  });
61
61
  Object.defineProperty(exports, "InventoryService", {
62
62
  enumerable: true,
63
- get: function () { return chunkKSN3RJFL_js.InventoryService; }
63
+ get: function () { return chunkUVBJDWIV_js.InventoryService; }
64
64
  });
65
65
  Object.defineProperty(exports, "LinkService", {
66
66
  enumerable: true,
67
- get: function () { return chunkKSN3RJFL_js.LinkService; }
67
+ get: function () { return chunkUVBJDWIV_js.LinkService; }
68
68
  });
69
69
  Object.defineProperty(exports, "LiteService", {
70
70
  enumerable: true,
71
- get: function () { return chunkKSN3RJFL_js.LiteService; }
71
+ get: function () { return chunkUVBJDWIV_js.LiteService; }
72
72
  });
73
73
  Object.defineProperty(exports, "MESSAGE_TYPES", {
74
74
  enumerable: true,
75
- get: function () { return chunkKSN3RJFL_js.MESSAGE_TYPES; }
75
+ get: function () { return chunkUVBJDWIV_js.MESSAGE_TYPES; }
76
76
  });
77
77
  Object.defineProperty(exports, "OrderQueries", {
78
78
  enumerable: true,
79
- get: function () { return chunkKSN3RJFL_js.OrderQueries; }
79
+ get: function () { return chunkUVBJDWIV_js.OrderQueries; }
80
80
  });
81
81
  Object.defineProperty(exports, "SchedulingService", {
82
82
  enumerable: true,
83
- get: function () { return chunkKSN3RJFL_js.SchedulingService; }
83
+ get: function () { return chunkUVBJDWIV_js.SchedulingService; }
84
84
  });
85
85
  Object.defineProperty(exports, "createElements", {
86
86
  enumerable: true,
87
- get: function () { return chunkKSN3RJFL_js.createElements; }
87
+ get: function () { return chunkUVBJDWIV_js.createElements; }
88
88
  });
89
89
  Object.defineProperty(exports, "generateIdempotencyKey", {
90
90
  enumerable: true,
91
- get: function () { return chunkKSN3RJFL_js.generateIdempotencyKey; }
91
+ get: function () { return chunkUVBJDWIV_js.generateIdempotencyKey; }
92
92
  });
package/dist/advanced.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  export { QueryBuilder, query } from './chunk-LM3CJ4L7.mjs';
2
- 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-7KH2XJIW.mjs';
3
- import './chunk-HG7GG3TT.mjs';
2
+ 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-VTMRPTQ7.mjs';
3
+ import './chunk-JFT63H34.mjs';
@@ -61,8 +61,16 @@ var SUPPORTED_CURRENCY_CODES = /* @__PURE__ */ new Set([
61
61
  function isSupportedCurrency(code) {
62
62
  return SUPPORTED_CURRENCY_CODES.has(code);
63
63
  }
64
+ var warnedCurrencies = /* @__PURE__ */ new Set();
64
65
  function currencyCode(value) {
65
- return value;
66
+ const normalized = value.trim().toUpperCase();
67
+ if (!isSupportedCurrency(normalized) && !warnedCurrencies.has(normalized)) {
68
+ warnedCurrencies.add(normalized);
69
+ console.warn(
70
+ `[Cimplify] Unrecognized currency code "${normalized}". It may not format correctly.`
71
+ );
72
+ }
73
+ return normalized;
66
74
  }
67
75
  var ErrorCode = {
68
76
  UNKNOWN_ERROR: "UNKNOWN_ERROR",
@@ -185,22 +193,17 @@ function getErrorHint(code) {
185
193
  }
186
194
  function enrichError(error, options = {}) {
187
195
  const hint = getErrorHint(error.code);
188
- if (hint) {
189
- if (!error.docs_url) {
190
- error.docs_url = hint.docs_url;
191
- }
192
- if (!error.suggestion) {
193
- error.suggestion = hint.suggestion;
194
- }
195
- } else if (!error.docs_url) {
196
- error.docs_url = docsUrlForCode(error.code || ErrorCode.UNKNOWN_ERROR);
197
- }
198
- if (options.isTestMode && !error.message.includes("pk_test_")) {
199
- error.message = `${error.message}
196
+ const docsUrl = error.docs_url || hint?.docs_url || docsUrlForCode(error.code || ErrorCode.UNKNOWN_ERROR);
197
+ const suggestion = error.suggestion || hint?.suggestion;
198
+ let message = error.message;
199
+ if (options.isTestMode && !message.includes("pk_test_")) {
200
+ message = `${message}
200
201
 
201
202
  \u2139 Your API key is a test-mode key (pk_test_...). Verify test data/session before retrying.`;
202
203
  }
203
- return error;
204
+ const enriched = new CimplifyError(error.code, message, error.retryable, docsUrl, suggestion);
205
+ enriched.stack = error.stack;
206
+ return enriched;
204
207
  }
205
208
  function isRetryableError(error) {
206
209
  if (isCimplifyError(error)) {
@@ -59,8 +59,16 @@ var SUPPORTED_CURRENCY_CODES = /* @__PURE__ */ new Set([
59
59
  function isSupportedCurrency(code) {
60
60
  return SUPPORTED_CURRENCY_CODES.has(code);
61
61
  }
62
+ var warnedCurrencies = /* @__PURE__ */ new Set();
62
63
  function currencyCode(value) {
63
- return value;
64
+ const normalized = value.trim().toUpperCase();
65
+ if (!isSupportedCurrency(normalized) && !warnedCurrencies.has(normalized)) {
66
+ warnedCurrencies.add(normalized);
67
+ console.warn(
68
+ `[Cimplify] Unrecognized currency code "${normalized}". It may not format correctly.`
69
+ );
70
+ }
71
+ return normalized;
64
72
  }
65
73
  var ErrorCode = {
66
74
  UNKNOWN_ERROR: "UNKNOWN_ERROR",
@@ -183,22 +191,17 @@ function getErrorHint(code) {
183
191
  }
184
192
  function enrichError(error, options = {}) {
185
193
  const hint = getErrorHint(error.code);
186
- if (hint) {
187
- if (!error.docs_url) {
188
- error.docs_url = hint.docs_url;
189
- }
190
- if (!error.suggestion) {
191
- error.suggestion = hint.suggestion;
192
- }
193
- } else if (!error.docs_url) {
194
- error.docs_url = docsUrlForCode(error.code || ErrorCode.UNKNOWN_ERROR);
195
- }
196
- if (options.isTestMode && !error.message.includes("pk_test_")) {
197
- error.message = `${error.message}
194
+ const docsUrl = error.docs_url || hint?.docs_url || docsUrlForCode(error.code || ErrorCode.UNKNOWN_ERROR);
195
+ const suggestion = error.suggestion || hint?.suggestion;
196
+ let message = error.message;
197
+ if (options.isTestMode && !message.includes("pk_test_")) {
198
+ message = `${message}
198
199
 
199
200
  \u2139 Your API key is a test-mode key (pk_test_...). Verify test data/session before retrying.`;
200
201
  }
201
- return error;
202
+ const enriched = new CimplifyError(error.code, message, error.retryable, docsUrl, suggestion);
203
+ enriched.stack = error.stack;
204
+ return enriched;
202
205
  }
203
206
  function isRetryableError(error) {
204
207
  if (isCimplifyError(error)) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk2BSYTQAY_js = require('./chunk-2BSYTQAY.js');
3
+ var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
4
4
 
5
5
  // src/types/result.ts
6
6
  function ok(value) {
@@ -74,11 +74,11 @@ function combineObject(results) {
74
74
 
75
75
  // src/internal/safe.ts
76
76
  function toCimplifyError(error) {
77
- if (error instanceof chunk2BSYTQAY_js.CimplifyError) return chunk2BSYTQAY_js.enrichError(error);
77
+ if (error instanceof chunk64OCG2TJ_js.CimplifyError) return chunk64OCG2TJ_js.enrichError(error);
78
78
  if (error instanceof Error) {
79
- return chunk2BSYTQAY_js.enrichError(new chunk2BSYTQAY_js.CimplifyError(chunk2BSYTQAY_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
79
+ return chunk64OCG2TJ_js.enrichError(new chunk64OCG2TJ_js.CimplifyError(chunk64OCG2TJ_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
80
80
  }
81
- return chunk2BSYTQAY_js.enrichError(new chunk2BSYTQAY_js.CimplifyError(chunk2BSYTQAY_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
81
+ return chunk64OCG2TJ_js.enrichError(new chunk64OCG2TJ_js.CimplifyError(chunk64OCG2TJ_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
82
82
  }
83
83
  async function safe(promise) {
84
84
  try {
@@ -509,23 +509,26 @@ var CatalogueQueries = class {
509
509
  );
510
510
  }
511
511
  async getProductAttributes(productId) {
512
+ const encodedId = encodeURIComponent(productId);
512
513
  return safe(
513
514
  this.client.get(
514
- `/api/v1/catalogue/products/${productId}/attributes`
515
+ `/api/v1/catalogue/products/${encodedId}/attributes`
515
516
  )
516
517
  );
517
518
  }
518
519
  async getCategoryAttributes(categoryId) {
520
+ const encodedId = encodeURIComponent(categoryId);
519
521
  return safe(
520
522
  this.client.get(
521
- `/api/v1/catalogue/categories/${categoryId}/attributes`
523
+ `/api/v1/catalogue/categories/${encodedId}/attributes`
522
524
  )
523
525
  );
524
526
  }
525
527
  async getCollectionAttributes(collectionId) {
528
+ const encodedId = encodeURIComponent(collectionId);
526
529
  return safe(
527
530
  this.client.get(
528
- `/api/v1/catalogue/collections/${collectionId}/attributes`
531
+ `/api/v1/catalogue/collections/${encodedId}/attributes`
529
532
  )
530
533
  );
531
534
  }
@@ -1016,7 +1019,7 @@ var CheckoutResolver = class {
1016
1019
  }
1017
1020
  }
1018
1021
  }
1019
- if (checkoutResult.requires_authorization || chunk2BSYTQAY_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1022
+ if (checkoutResult.requires_authorization || chunk64OCG2TJ_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1020
1023
  const authorization = await this.handleAuthorization({
1021
1024
  authorizationType,
1022
1025
  paymentReference,
@@ -1190,18 +1193,18 @@ var CheckoutResolver = class {
1190
1193
  if (statusResult.value.reference) {
1191
1194
  paymentReference = statusResult.value.reference;
1192
1195
  }
1193
- const normalized = chunk2BSYTQAY_js.normalizeStatusResponse(statusResult.value);
1194
- if (normalized.paid || chunk2BSYTQAY_js.isPaymentStatusSuccess(normalized.status)) {
1196
+ const normalized = chunk64OCG2TJ_js.normalizeStatusResponse(statusResult.value);
1197
+ if (normalized.paid || chunk64OCG2TJ_js.isPaymentStatusSuccess(normalized.status)) {
1195
1198
  return this.finalizeSuccess(latestCheckoutResult);
1196
1199
  }
1197
- if (chunk2BSYTQAY_js.isPaymentStatusFailure(normalized.status)) {
1200
+ if (chunk64OCG2TJ_js.isPaymentStatusFailure(normalized.status)) {
1198
1201
  return this.fail(
1199
1202
  normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
1200
1203
  normalized.message || "Payment failed during confirmation.",
1201
1204
  false
1202
1205
  );
1203
1206
  }
1204
- if (chunk2BSYTQAY_js.isPaymentStatusRequiresAction(normalized.status)) {
1207
+ if (chunk64OCG2TJ_js.isPaymentStatusRequiresAction(normalized.status)) {
1205
1208
  const authorization = await this.handleAuthorization({
1206
1209
  authorizationType,
1207
1210
  paymentReference,
@@ -1232,8 +1235,8 @@ var CheckoutResolver = class {
1232
1235
  try {
1233
1236
  const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
1234
1237
  if (finalResult.ok) {
1235
- const normalized = chunk2BSYTQAY_js.normalizeStatusResponse(finalResult.value);
1236
- if (normalized.paid || chunk2BSYTQAY_js.isPaymentStatusSuccess(normalized.status)) {
1238
+ const normalized = chunk64OCG2TJ_js.normalizeStatusResponse(finalResult.value);
1239
+ if (normalized.paid || chunk64OCG2TJ_js.isPaymentStatusSuccess(normalized.status)) {
1237
1240
  return this.finalizeSuccess(latestCheckoutResult);
1238
1241
  }
1239
1242
  }
@@ -1429,12 +1432,12 @@ var CheckoutResolver = class {
1429
1432
  };
1430
1433
  }
1431
1434
  isSuccessfulStatus(status) {
1432
- const normalized = chunk2BSYTQAY_js.normalizeStatusResponse({ status, paid: false });
1433
- return normalized.paid || chunk2BSYTQAY_js.isPaymentStatusSuccess(normalized.status);
1435
+ const normalized = chunk64OCG2TJ_js.normalizeStatusResponse({ status, paid: false });
1436
+ return normalized.paid || chunk64OCG2TJ_js.isPaymentStatusSuccess(normalized.status);
1434
1437
  }
1435
1438
  isFailureStatus(status) {
1436
- const normalized = chunk2BSYTQAY_js.normalizeStatusResponse({ status, paid: false });
1437
- return chunk2BSYTQAY_js.isPaymentStatusFailure(normalized.status);
1439
+ const normalized = chunk64OCG2TJ_js.normalizeStatusResponse({ status, paid: false });
1440
+ return chunk64OCG2TJ_js.isPaymentStatusFailure(normalized.status);
1438
1441
  }
1439
1442
  ensureNotAborted() {
1440
1443
  if (this.signal?.aborted) {
@@ -1505,7 +1508,7 @@ var CheckoutService = class {
1505
1508
  }
1506
1509
  async initializePayment(_orderId, _method) {
1507
1510
  return err(
1508
- new chunk2BSYTQAY_js.CimplifyError(
1511
+ new chunk64OCG2TJ_js.CimplifyError(
1509
1512
  "NOT_IMPLEMENTED",
1510
1513
  "initializePayment is not available in REST mode.",
1511
1514
  false
@@ -1577,11 +1580,11 @@ var CheckoutService = class {
1577
1580
  pay_currency: data.pay_currency,
1578
1581
  fx_quote_id: data.fx_quote_id
1579
1582
  };
1580
- const baseCurrency = chunk2BSYTQAY_js.currencyCode(
1583
+ const baseCurrency = chunk64OCG2TJ_js.currencyCode(
1581
1584
  (cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
1582
1585
  );
1583
1586
  const payCurrency = data.pay_currency?.trim().toUpperCase();
1584
- const payCurrencyCode = payCurrency ? chunk2BSYTQAY_js.currencyCode(payCurrency) : void 0;
1587
+ const payCurrencyCode = payCurrency ? chunk64OCG2TJ_js.currencyCode(payCurrency) : void 0;
1585
1588
  const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
1586
1589
  if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
1587
1590
  const fxQuoteResult = await this.client.fx.lockQuote({
@@ -1904,7 +1907,7 @@ var BusinessService = class {
1904
1907
  if (!result.ok) return err(result.error);
1905
1908
  const location = result.value.find((item) => item.id === locationId);
1906
1909
  if (!location) {
1907
- return err(new chunk2BSYTQAY_js.CimplifyError(chunk2BSYTQAY_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
1910
+ return err(new chunk64OCG2TJ_js.CimplifyError(chunk64OCG2TJ_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
1908
1911
  }
1909
1912
  return ok(location);
1910
1913
  }
@@ -2178,7 +2181,7 @@ var EVENT_TYPES = {
2178
2181
 
2179
2182
  // src/elements.ts
2180
2183
  function toCheckoutError(code, message, recoverable) {
2181
- const hint = chunk2BSYTQAY_js.getErrorHint(code);
2184
+ const hint = chunk64OCG2TJ_js.getErrorHint(code);
2182
2185
  return {
2183
2186
  success: false,
2184
2187
  error: {
@@ -1,4 +1,4 @@
1
- import { CimplifyError, currencyCode, ErrorCode, enrichError, isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure, getErrorHint } from './chunk-HG7GG3TT.mjs';
1
+ import { CimplifyError, currencyCode, ErrorCode, enrichError, isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure, getErrorHint } from './chunk-JFT63H34.mjs';
2
2
 
3
3
  // src/types/result.ts
4
4
  function ok(value) {
@@ -507,23 +507,26 @@ var CatalogueQueries = class {
507
507
  );
508
508
  }
509
509
  async getProductAttributes(productId) {
510
+ const encodedId = encodeURIComponent(productId);
510
511
  return safe(
511
512
  this.client.get(
512
- `/api/v1/catalogue/products/${productId}/attributes`
513
+ `/api/v1/catalogue/products/${encodedId}/attributes`
513
514
  )
514
515
  );
515
516
  }
516
517
  async getCategoryAttributes(categoryId) {
518
+ const encodedId = encodeURIComponent(categoryId);
517
519
  return safe(
518
520
  this.client.get(
519
- `/api/v1/catalogue/categories/${categoryId}/attributes`
521
+ `/api/v1/catalogue/categories/${encodedId}/attributes`
520
522
  )
521
523
  );
522
524
  }
523
525
  async getCollectionAttributes(collectionId) {
526
+ const encodedId = encodeURIComponent(collectionId);
524
527
  return safe(
525
528
  this.client.get(
526
- `/api/v1/catalogue/collections/${collectionId}/attributes`
529
+ `/api/v1/catalogue/collections/${encodedId}/attributes`
527
530
  )
528
531
  );
529
532
  }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkKSN3RJFL_js = require('./chunk-KSN3RJFL.js');
4
- var chunk2BSYTQAY_js = require('./chunk-2BSYTQAY.js');
3
+ var chunkUVBJDWIV_js = require('./chunk-UVBJDWIV.js');
4
+ var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
5
5
 
6
6
  // src/activity.ts
7
7
  var ActivityService = class {
@@ -29,7 +29,7 @@ var ActivityService = class {
29
29
  this.sendEvents([event]);
30
30
  }
31
31
  async getState() {
32
- return chunkKSN3RJFL_js.safe(this.client.get("/api/v1/activity/state"));
32
+ return chunkUVBJDWIV_js.safe(this.client.get("/api/v1/activity/state"));
33
33
  }
34
34
  async getRecommendations(options) {
35
35
  const params = new URLSearchParams();
@@ -37,10 +37,10 @@ var ActivityService = class {
37
37
  if (options?.limit) params.set("limit", String(options.limit));
38
38
  const query = params.toString();
39
39
  const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
40
- return chunkKSN3RJFL_js.safe(this.client.get(path));
40
+ return chunkUVBJDWIV_js.safe(this.client.get(path));
41
41
  }
42
42
  async dismissMessage(code) {
43
- return chunkKSN3RJFL_js.safe(
43
+ return chunkUVBJDWIV_js.safe(
44
44
  this.client.post("/api/v1/activity/messages/dismiss", { code })
45
45
  );
46
46
  }
@@ -66,7 +66,7 @@ var DeliveryService = class {
66
66
  params.set("dropoff_lat", String(dropoffLat));
67
67
  params.set("dropoff_lng", String(dropoffLng));
68
68
  if (country) params.set("country", country);
69
- return chunkKSN3RJFL_js.safe(
69
+ return chunkUVBJDWIV_js.safe(
70
70
  this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
71
71
  );
72
72
  }
@@ -91,16 +91,16 @@ function isRetryable(error) {
91
91
  if (error instanceof DOMException && error.name === "AbortError") {
92
92
  return true;
93
93
  }
94
- if (error instanceof chunk2BSYTQAY_js.CimplifyError) {
94
+ if (error instanceof chunk64OCG2TJ_js.CimplifyError) {
95
95
  return error.retryable;
96
96
  }
97
97
  return false;
98
98
  }
99
99
  function toNetworkError(error, isTestMode) {
100
100
  if (error instanceof DOMException && error.name === "AbortError") {
101
- return chunk2BSYTQAY_js.enrichError(
102
- new chunk2BSYTQAY_js.CimplifyError(
103
- chunk2BSYTQAY_js.ErrorCode.TIMEOUT,
101
+ return chunk64OCG2TJ_js.enrichError(
102
+ new chunk64OCG2TJ_js.CimplifyError(
103
+ chunk64OCG2TJ_js.ErrorCode.TIMEOUT,
104
104
  "Request timed out. Please check your connection and try again.",
105
105
  true
106
106
  ),
@@ -108,21 +108,21 @@ function toNetworkError(error, isTestMode) {
108
108
  );
109
109
  }
110
110
  if (error instanceof TypeError && error.message.includes("fetch")) {
111
- return chunk2BSYTQAY_js.enrichError(
112
- new chunk2BSYTQAY_js.CimplifyError(
113
- chunk2BSYTQAY_js.ErrorCode.NETWORK_ERROR,
111
+ return chunk64OCG2TJ_js.enrichError(
112
+ new chunk64OCG2TJ_js.CimplifyError(
113
+ chunk64OCG2TJ_js.ErrorCode.NETWORK_ERROR,
114
114
  "Network error. Please check your internet connection.",
115
115
  true
116
116
  ),
117
117
  { isTestMode }
118
118
  );
119
119
  }
120
- if (error instanceof chunk2BSYTQAY_js.CimplifyError) {
121
- return chunk2BSYTQAY_js.enrichError(error, { isTestMode });
120
+ if (error instanceof chunk64OCG2TJ_js.CimplifyError) {
121
+ return chunk64OCG2TJ_js.enrichError(error, { isTestMode });
122
122
  }
123
- return chunk2BSYTQAY_js.enrichError(
124
- new chunk2BSYTQAY_js.CimplifyError(
125
- chunk2BSYTQAY_js.ErrorCode.UNKNOWN_ERROR,
123
+ return chunk64OCG2TJ_js.enrichError(
124
+ new chunk64OCG2TJ_js.CimplifyError(
125
+ chunk64OCG2TJ_js.ErrorCode.UNKNOWN_ERROR,
126
126
  error instanceof Error ? error.message : "An unknown error occurred",
127
127
  false
128
128
  ),
@@ -289,8 +289,8 @@ var CimplifyClient = class {
289
289
  this.businessIdResolvePromise = (async () => {
290
290
  const result = await this.business.getInfo();
291
291
  if (!result.ok || !result.value?.id) {
292
- throw new chunk2BSYTQAY_js.CimplifyError(
293
- chunk2BSYTQAY_js.ErrorCode.NOT_FOUND,
292
+ throw new chunk64OCG2TJ_js.CimplifyError(
293
+ chunk64OCG2TJ_js.ErrorCode.NOT_FOUND,
294
294
  "Unable to resolve business ID from the current public key.",
295
295
  true
296
296
  );
@@ -407,7 +407,7 @@ var CimplifyClient = class {
407
407
  if (response.status >= 400 && response.status < 500) {
408
408
  this.hooks.onRequestError?.({
409
409
  ...context,
410
- error: new chunk2BSYTQAY_js.CimplifyError(
410
+ error: new chunk64OCG2TJ_js.CimplifyError(
411
411
  `HTTP_${response.status}`,
412
412
  `Request failed with status ${response.status}`,
413
413
  false
@@ -433,7 +433,7 @@ var CimplifyClient = class {
433
433
  }
434
434
  this.hooks.onRequestError?.({
435
435
  ...context,
436
- error: new chunk2BSYTQAY_js.CimplifyError(
436
+ error: new chunk64OCG2TJ_js.CimplifyError(
437
437
  "SERVER_ERROR",
438
438
  `Server error ${response.status} after ${retryCount} retries`,
439
439
  false
@@ -564,15 +564,15 @@ var CimplifyClient = class {
564
564
  const errorCode = typeof json.error === "object" && json.error?.error_code || typeof json.error === "object" && json.error?.code || "API_ERROR";
565
565
  const errorMessage = typeof json.error === "object" && json.error?.error_message || typeof json.error === "object" && json.error?.message || typeof json.error === "string" && json.error || typeof json.message === "string" && json.message || "An error occurred";
566
566
  const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
567
- const error = chunk2BSYTQAY_js.enrichError(
568
- new chunk2BSYTQAY_js.CimplifyError(
567
+ const error = chunk64OCG2TJ_js.enrichError(
568
+ new chunk64OCG2TJ_js.CimplifyError(
569
569
  errorCode,
570
570
  errorMessage,
571
571
  retryable
572
572
  ),
573
573
  { isTestMode: this.isTestMode() }
574
574
  );
575
- if (response.status === 401 || error.code === chunk2BSYTQAY_js.ErrorCode.UNAUTHORIZED) {
575
+ if (response.status === 401 || error.code === chunk64OCG2TJ_js.ErrorCode.UNAUTHORIZED) {
576
576
  console.warn(
577
577
  "[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
578
578
  );
@@ -580,8 +580,8 @@ var CimplifyClient = class {
580
580
  throw error;
581
581
  }
582
582
  if (json?.success === false || json?.error?.code || json?.error?.message) {
583
- const error = chunk2BSYTQAY_js.enrichError(
584
- new chunk2BSYTQAY_js.CimplifyError(
583
+ const error = chunk64OCG2TJ_js.enrichError(
584
+ new chunk64OCG2TJ_js.CimplifyError(
585
585
  json.error?.code || "API_ERROR",
586
586
  json.error?.message || "An error occurred",
587
587
  json.error?.retryable || false
@@ -597,67 +597,67 @@ var CimplifyClient = class {
597
597
  }
598
598
  get catalogue() {
599
599
  if (!this._catalogue) {
600
- this._catalogue = new chunkKSN3RJFL_js.CatalogueQueries(this);
600
+ this._catalogue = new chunkUVBJDWIV_js.CatalogueQueries(this);
601
601
  }
602
602
  return this._catalogue;
603
603
  }
604
604
  get cart() {
605
605
  if (!this._cart) {
606
- this._cart = new chunkKSN3RJFL_js.CartOperations(this);
606
+ this._cart = new chunkUVBJDWIV_js.CartOperations(this);
607
607
  }
608
608
  return this._cart;
609
609
  }
610
610
  get checkout() {
611
611
  if (!this._checkout) {
612
- this._checkout = new chunkKSN3RJFL_js.CheckoutService(this);
612
+ this._checkout = new chunkUVBJDWIV_js.CheckoutService(this);
613
613
  }
614
614
  return this._checkout;
615
615
  }
616
616
  get orders() {
617
617
  if (!this._orders) {
618
- this._orders = new chunkKSN3RJFL_js.OrderQueries(this);
618
+ this._orders = new chunkUVBJDWIV_js.OrderQueries(this);
619
619
  }
620
620
  return this._orders;
621
621
  }
622
622
  get link() {
623
623
  if (!this._link) {
624
- this._link = new chunkKSN3RJFL_js.LinkService(this);
624
+ this._link = new chunkUVBJDWIV_js.LinkService(this);
625
625
  }
626
626
  return this._link;
627
627
  }
628
628
  get auth() {
629
629
  if (!this._auth) {
630
- this._auth = new chunkKSN3RJFL_js.AuthService(this);
630
+ this._auth = new chunkUVBJDWIV_js.AuthService(this);
631
631
  }
632
632
  return this._auth;
633
633
  }
634
634
  get business() {
635
635
  if (!this._business) {
636
- this._business = new chunkKSN3RJFL_js.BusinessService(this);
636
+ this._business = new chunkUVBJDWIV_js.BusinessService(this);
637
637
  }
638
638
  return this._business;
639
639
  }
640
640
  get inventory() {
641
641
  if (!this._inventory) {
642
- this._inventory = new chunkKSN3RJFL_js.InventoryService(this);
642
+ this._inventory = new chunkUVBJDWIV_js.InventoryService(this);
643
643
  }
644
644
  return this._inventory;
645
645
  }
646
646
  get scheduling() {
647
647
  if (!this._scheduling) {
648
- this._scheduling = new chunkKSN3RJFL_js.SchedulingService(this);
648
+ this._scheduling = new chunkUVBJDWIV_js.SchedulingService(this);
649
649
  }
650
650
  return this._scheduling;
651
651
  }
652
652
  get lite() {
653
653
  if (!this._lite) {
654
- this._lite = new chunkKSN3RJFL_js.LiteService(this);
654
+ this._lite = new chunkUVBJDWIV_js.LiteService(this);
655
655
  }
656
656
  return this._lite;
657
657
  }
658
658
  get fx() {
659
659
  if (!this._fx) {
660
- this._fx = new chunkKSN3RJFL_js.FxService(this);
660
+ this._fx = new chunkUVBJDWIV_js.FxService(this);
661
661
  }
662
662
  return this._fx;
663
663
  }
@@ -677,7 +677,7 @@ var CimplifyClient = class {
677
677
  if (businessId) {
678
678
  this.setBusinessId(businessId);
679
679
  }
680
- return chunkKSN3RJFL_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
680
+ return chunkUVBJDWIV_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
681
681
  }
682
682
  };
683
683
  function createCimplifyClient(config = {}) {
@@ -1,5 +1,5 @@
1
- import { safe, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-7KH2XJIW.mjs';
2
- import { CimplifyError, ErrorCode, enrichError } from './chunk-HG7GG3TT.mjs';
1
+ import { safe, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-VTMRPTQ7.mjs';
2
+ import { CimplifyError, ErrorCode, enrichError } from './chunk-JFT63H34.mjs';
3
3
 
4
4
  // src/activity.ts
5
5
  var ActivityService = class {