@cimplify/sdk 0.31.0 → 0.36.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.
Files changed (44) hide show
  1. package/dist/advanced.d.mts +6 -2
  2. package/dist/advanced.d.ts +6 -2
  3. package/dist/advanced.js +21 -21
  4. package/dist/advanced.mjs +2 -2
  5. package/dist/{chunk-46BDUSJX.mjs → chunk-2X6P5WJZ.mjs} +108 -32
  6. package/dist/{chunk-E3HC2YAE.mjs → chunk-6TVQQYQ5.mjs} +14 -1
  7. package/dist/{chunk-2CGA3MUW.js → chunk-HKVRUGM6.js} +142 -91
  8. package/dist/{chunk-3J4PPSMI.mjs → chunk-TFHKVQLL.mjs} +123 -72
  9. package/dist/{chunk-PEDLCL72.js → chunk-V2O5AO7I.js} +15 -0
  10. package/dist/{chunk-6HCBOIZ4.js → chunk-ZYACIPKO.js} +160 -84
  11. package/dist/{index-BpyFcJVv.d.ts → client-CkGlXZRd.d.mts} +121 -72
  12. package/dist/{index-m8zGQUda.d.mts → client-lvLvB1_K.d.ts} +121 -72
  13. package/dist/{index-D4oNCc37.d.mts → index-CC1JPhB2.d.mts} +2 -2
  14. package/dist/{index-BHVJgyqM.d.ts → index-CPcFayQg.d.ts} +2 -2
  15. package/dist/index.d.mts +6 -5
  16. package/dist/index.d.ts +6 -5
  17. package/dist/index.js +117 -109
  18. package/dist/index.mjs +3 -3
  19. package/dist/mock/cli.mjs +8086 -0
  20. package/dist/mock/library.d.mts +15 -0
  21. package/dist/mock/library.d.ts +15 -0
  22. package/dist/mock/library.js +7285 -0
  23. package/dist/mock/library.mjs +7278 -0
  24. package/dist/mock/msw.d.mts +14 -0
  25. package/dist/mock/msw.d.ts +14 -0
  26. package/dist/mock/msw.js +7280 -0
  27. package/dist/mock/msw.mjs +7278 -0
  28. package/dist/{payment-DnU_eLuT.d.ts → payment-DA1i5hhk.d.mts} +13 -12
  29. package/dist/{payment-DnU_eLuT.d.mts → payment-DA1i5hhk.d.ts} +13 -12
  30. package/dist/{price-DUVmRTaz.d.ts → price-Bv4G8aOO.d.ts} +1 -1
  31. package/dist/{price-D-hso3np.d.mts → price-s1XN0edJ.d.mts} +1 -1
  32. package/dist/react.d.mts +21 -4
  33. package/dist/react.d.ts +21 -4
  34. package/dist/react.js +835 -715
  35. package/dist/react.mjs +725 -605
  36. package/dist/server-B8TeE2OD.d.mts +915 -0
  37. package/dist/server-B8TeE2OD.d.ts +915 -0
  38. package/dist/styles.css +1 -1
  39. package/dist/utils.d.mts +3 -3
  40. package/dist/utils.d.ts +3 -3
  41. package/dist/utils.js +28 -28
  42. package/dist/utils.mjs +1 -1
  43. package/package.json +32 -12
  44. package/registry/cart-summary.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk2CGA3MUW_js = require('./chunk-2CGA3MUW.js');
4
- var chunkPEDLCL72_js = require('./chunk-PEDLCL72.js');
3
+ var chunkHKVRUGM6_js = require('./chunk-HKVRUGM6.js');
4
+ var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.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 chunk2CGA3MUW_js.safe(this.client.get("/api/v1/activity/state"));
32
+ return chunkHKVRUGM6_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 chunk2CGA3MUW_js.safe(this.client.get(path));
40
+ return chunkHKVRUGM6_js.safe(this.client.get(path));
41
41
  }
42
42
  async dismissMessage(code) {
43
- return chunk2CGA3MUW_js.safe(
43
+ return chunkHKVRUGM6_js.safe(
44
44
  this.client.post("/api/v1/activity/messages/dismiss", { code })
45
45
  );
46
46
  }
@@ -62,36 +62,44 @@ var SubscriptionService = class {
62
62
  this.client = client;
63
63
  }
64
64
  async list() {
65
- return chunk2CGA3MUW_js.safe(this.client.get("/api/v1/subscriptions"));
65
+ return chunkHKVRUGM6_js.safe(this.client.get("/api/v1/subscriptions"));
66
66
  }
67
67
  async get(id) {
68
68
  const encodedId = encodeURIComponent(id);
69
- return chunk2CGA3MUW_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
69
+ return chunkHKVRUGM6_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
70
70
  }
71
- async cancel(id, reason) {
71
+ async cancel(id, reason, opts) {
72
72
  const encodedId = encodeURIComponent(id);
73
- return chunk2CGA3MUW_js.safe(
74
- this.client.post(`/api/v1/subscriptions/${encodedId}/cancel`, {
75
- reason
76
- })
73
+ const idempotencyKey = opts?.idempotencyKey ?? chunkHKVRUGM6_js.generateIdempotencyKey();
74
+ return chunkHKVRUGM6_js.safe(
75
+ this.client.post(
76
+ `/api/v1/subscriptions/${encodedId}/cancel`,
77
+ { reason },
78
+ { idempotencyKey }
79
+ )
77
80
  );
78
81
  }
79
82
  async pause(id) {
80
83
  const encodedId = encodeURIComponent(id);
81
- return chunk2CGA3MUW_js.safe(
84
+ return chunkHKVRUGM6_js.safe(
82
85
  this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
83
86
  );
84
87
  }
85
88
  async resume(id) {
86
89
  const encodedId = encodeURIComponent(id);
87
- return chunk2CGA3MUW_js.safe(
90
+ return chunkHKVRUGM6_js.safe(
88
91
  this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
89
92
  );
90
93
  }
91
- async skipNextRenewal(id) {
94
+ async skipNextRenewal(id, opts) {
92
95
  const encodedId = encodeURIComponent(id);
93
- return chunk2CGA3MUW_js.safe(
94
- this.client.post(`/api/v1/subscriptions/${encodedId}/skip`)
96
+ const idempotencyKey = opts?.idempotencyKey ?? chunkHKVRUGM6_js.generateIdempotencyKey();
97
+ return chunkHKVRUGM6_js.safe(
98
+ this.client.post(
99
+ `/api/v1/subscriptions/${encodedId}/skip`,
100
+ void 0,
101
+ { idempotencyKey }
102
+ )
95
103
  );
96
104
  }
97
105
  };
@@ -101,17 +109,22 @@ var UploadService = class {
101
109
  constructor(client) {
102
110
  this.client = client;
103
111
  }
104
- async init(filename, contentType, sizeBytes) {
105
- return chunk2CGA3MUW_js.safe(
106
- this.client.post("/api/v1/uploads/init", {
107
- filename,
108
- content_type: contentType,
109
- size_bytes: sizeBytes
110
- })
112
+ async init(filename, contentType, sizeBytes, opts) {
113
+ const idempotencyKey = opts?.idempotencyKey ?? chunkHKVRUGM6_js.generateIdempotencyKey();
114
+ return chunkHKVRUGM6_js.safe(
115
+ this.client.post(
116
+ "/api/v1/uploads/init",
117
+ {
118
+ filename,
119
+ content_type: contentType,
120
+ size_bytes: sizeBytes
121
+ },
122
+ { idempotencyKey }
123
+ )
111
124
  );
112
125
  }
113
126
  async confirm(uploadId) {
114
- return chunk2CGA3MUW_js.safe(
127
+ return chunkHKVRUGM6_js.safe(
115
128
  this.client.post("/api/v1/uploads/confirm", {
116
129
  upload_id: uploadId
117
130
  })
@@ -130,7 +143,7 @@ var UploadService = class {
130
143
  if (!uploadResponse.ok) {
131
144
  return {
132
145
  ok: false,
133
- error: new chunkPEDLCL72_js.CimplifyError(
146
+ error: new chunkV2O5AO7I_js.CimplifyError(
134
147
  "UPLOAD_FAILED",
135
148
  `Upload failed with status ${uploadResponse.status}`,
136
149
  true
@@ -140,7 +153,7 @@ var UploadService = class {
140
153
  } catch (error) {
141
154
  return {
142
155
  ok: false,
143
- error: new chunkPEDLCL72_js.CimplifyError(
156
+ error: new chunkV2O5AO7I_js.CimplifyError(
144
157
  "UPLOAD_FAILED",
145
158
  error instanceof Error ? error.message : "Upload failed",
146
159
  true
@@ -157,7 +170,7 @@ var PlacesService = class {
157
170
  this.client = client;
158
171
  }
159
172
  async autocomplete(input, sessionToken) {
160
- return chunk2CGA3MUW_js.safe(
173
+ return chunkHKVRUGM6_js.safe(
161
174
  this.client.post("/api/v1/places/autocomplete", {
162
175
  input,
163
176
  sessionToken
@@ -165,7 +178,7 @@ var PlacesService = class {
165
178
  );
166
179
  }
167
180
  async details(placeId, sessionToken) {
168
- return chunk2CGA3MUW_js.safe(
181
+ return chunkHKVRUGM6_js.safe(
169
182
  this.client.post("/api/v1/places/details", {
170
183
  place_id: placeId,
171
184
  sessionToken
@@ -184,7 +197,7 @@ var DeliveryService = class {
184
197
  params.set("dropoff_lat", String(dropoffLat));
185
198
  params.set("dropoff_lng", String(dropoffLng));
186
199
  if (country) params.set("country", country);
187
- return chunk2CGA3MUW_js.safe(
200
+ return chunkHKVRUGM6_js.safe(
188
201
  this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
189
202
  );
190
203
  }
@@ -196,17 +209,23 @@ var SupportService = class {
196
209
  this.client = client;
197
210
  }
198
211
  /** Open (or resume) the customer's widget conversation. */
199
- async openConversation() {
200
- return chunk2CGA3MUW_js.safe(
201
- this.client.post("/api/v1/support/conversation")
212
+ async openConversation(opts) {
213
+ const idempotencyKey = opts?.idempotencyKey ?? chunkHKVRUGM6_js.generateIdempotencyKey();
214
+ return chunkHKVRUGM6_js.safe(
215
+ this.client.post("/api/v1/support/conversation", void 0, {
216
+ idempotencyKey
217
+ })
202
218
  );
203
219
  }
204
220
  /** Send a message in the active conversation. */
205
- async sendMessage(content) {
206
- return chunk2CGA3MUW_js.safe(
207
- this.client.post("/api/v1/support/conversation/messages", {
208
- content
209
- })
221
+ async sendMessage(content, opts) {
222
+ const idempotencyKey = opts?.idempotencyKey ?? chunkHKVRUGM6_js.generateIdempotencyKey();
223
+ return chunkHKVRUGM6_js.safe(
224
+ this.client.post(
225
+ "/api/v1/support/conversation/messages",
226
+ { content },
227
+ { idempotencyKey }
228
+ )
210
229
  );
211
230
  }
212
231
  /** Poll for new messages since the given cursor. */
@@ -216,10 +235,43 @@ var SupportService = class {
216
235
  if (options.limit) params.set("limit", String(options.limit));
217
236
  const query = params.toString();
218
237
  const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
219
- return chunk2CGA3MUW_js.safe(this.client.get(path));
238
+ return chunkHKVRUGM6_js.safe(this.client.get(path));
220
239
  }
221
240
  };
222
241
 
242
+ // src/internal/events.ts
243
+ function createClientEvents() {
244
+ const listeners = /* @__PURE__ */ new Map();
245
+ return {
246
+ on(name, listener) {
247
+ let set = listeners.get(name);
248
+ if (!set) {
249
+ set = /* @__PURE__ */ new Set();
250
+ listeners.set(name, set);
251
+ }
252
+ set.add(listener);
253
+ return () => {
254
+ set?.delete(listener);
255
+ };
256
+ },
257
+ off(name, listener) {
258
+ listeners.get(name)?.delete(listener);
259
+ },
260
+ emit(name, payload) {
261
+ const set = listeners.get(name);
262
+ if (!set) return;
263
+ const snapshot = Array.from(set);
264
+ for (const listener of snapshot) {
265
+ try {
266
+ listener(payload);
267
+ } catch (err) {
268
+ console.error(`[Cimplify] event listener for "${name}" threw:`, err);
269
+ }
270
+ }
271
+ }
272
+ };
273
+ }
274
+
223
275
  // src/client.ts
224
276
  var ACCESS_TOKEN_STORAGE_KEY = "cimplify_access_token";
225
277
  var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token";
@@ -232,6 +284,19 @@ var DEFAULT_RETRY_DELAY_MS = 1e3;
232
284
  function sleep(ms) {
233
285
  return new Promise((resolve) => setTimeout(resolve, ms));
234
286
  }
287
+ function mergeOptionHeaders(base, opts) {
288
+ if (!opts) return base;
289
+ const merged = { ...base };
290
+ if (opts.headers) {
291
+ for (const [k, v] of Object.entries(opts.headers)) {
292
+ merged[k] = v;
293
+ }
294
+ }
295
+ if (opts.idempotencyKey) {
296
+ merged["Idempotency-Key"] = opts.idempotencyKey;
297
+ }
298
+ return merged;
299
+ }
235
300
  function isRetryable(error) {
236
301
  if (error instanceof TypeError && error.message.includes("fetch")) {
237
302
  return true;
@@ -239,16 +304,16 @@ function isRetryable(error) {
239
304
  if (error instanceof DOMException && error.name === "AbortError") {
240
305
  return true;
241
306
  }
242
- if (error instanceof chunkPEDLCL72_js.CimplifyError) {
307
+ if (error instanceof chunkV2O5AO7I_js.CimplifyError) {
243
308
  return error.retryable;
244
309
  }
245
310
  return false;
246
311
  }
247
312
  function toNetworkError(error, isTestMode) {
248
313
  if (error instanceof DOMException && error.name === "AbortError") {
249
- return chunkPEDLCL72_js.enrichError(
250
- new chunkPEDLCL72_js.CimplifyError(
251
- chunkPEDLCL72_js.ErrorCode.TIMEOUT,
314
+ return chunkV2O5AO7I_js.enrichError(
315
+ new chunkV2O5AO7I_js.CimplifyError(
316
+ chunkV2O5AO7I_js.ErrorCode.TIMEOUT,
252
317
  "Request timed out. Please check your connection and try again.",
253
318
  true
254
319
  ),
@@ -256,21 +321,21 @@ function toNetworkError(error, isTestMode) {
256
321
  );
257
322
  }
258
323
  if (error instanceof TypeError && error.message.includes("fetch")) {
259
- return chunkPEDLCL72_js.enrichError(
260
- new chunkPEDLCL72_js.CimplifyError(
261
- chunkPEDLCL72_js.ErrorCode.NETWORK_ERROR,
324
+ return chunkV2O5AO7I_js.enrichError(
325
+ new chunkV2O5AO7I_js.CimplifyError(
326
+ chunkV2O5AO7I_js.ErrorCode.NETWORK_ERROR,
262
327
  "Network error. Please check your internet connection.",
263
328
  true
264
329
  ),
265
330
  { isTestMode }
266
331
  );
267
332
  }
268
- if (error instanceof chunkPEDLCL72_js.CimplifyError) {
269
- return chunkPEDLCL72_js.enrichError(error, { isTestMode });
333
+ if (error instanceof chunkV2O5AO7I_js.CimplifyError) {
334
+ return chunkV2O5AO7I_js.enrichError(error, { isTestMode });
270
335
  }
271
- return chunkPEDLCL72_js.enrichError(
272
- new chunkPEDLCL72_js.CimplifyError(
273
- chunkPEDLCL72_js.ErrorCode.UNKNOWN_ERROR,
336
+ return chunkV2O5AO7I_js.enrichError(
337
+ new chunkV2O5AO7I_js.CimplifyError(
338
+ chunkV2O5AO7I_js.ErrorCode.UNKNOWN_ERROR,
274
339
  error instanceof Error ? error.message : "An unknown error occurred",
275
340
  false
276
341
  ),
@@ -312,6 +377,13 @@ var CimplifyClient = class {
312
377
  this.businessId = null;
313
378
  this.businessIdResolvePromise = null;
314
379
  this.inflightRequests = /* @__PURE__ */ new Map();
380
+ /**
381
+ * App-level event channel. Subscribe to surface mutation rollbacks, outbox
382
+ * activity, and dead-letter notifications to consumer code (toasts,
383
+ * Sentry, analytics, etc.). The SDK emits but never auto-consumes — the
384
+ * consumer decides how to react.
385
+ */
386
+ this.events = createClientEvents();
315
387
  this.publicKey = config.publicKey || getEnvPublicKey() || "";
316
388
  const urls = deriveUrls();
317
389
  this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl;
@@ -437,8 +509,8 @@ var CimplifyClient = class {
437
509
  this.businessIdResolvePromise = (async () => {
438
510
  const result = await this.business.getInfo();
439
511
  if (!result.ok || !result.value?.id) {
440
- throw new chunkPEDLCL72_js.CimplifyError(
441
- chunkPEDLCL72_js.ErrorCode.NOT_FOUND,
512
+ throw new chunkV2O5AO7I_js.CimplifyError(
513
+ chunkV2O5AO7I_js.ErrorCode.NOT_FOUND,
442
514
  "Unable to resolve business ID from the current public key.",
443
515
  true
444
516
  );
@@ -539,7 +611,7 @@ var CimplifyClient = class {
539
611
  });
540
612
  return response;
541
613
  }
542
- if (response.status === 429 && attempt < this.maxRetries) {
614
+ if ((response.status === 429 || response.status === 503) && attempt < this.maxRetries) {
543
615
  retryCount++;
544
616
  const retryAfter = response.headers.get("Retry-After");
545
617
  const delay = retryAfter ? Math.min(parseInt(retryAfter, 10) * 1e3, 3e4) || this.retryDelay * Math.pow(2, attempt) : this.retryDelay * Math.pow(2, attempt);
@@ -547,7 +619,7 @@ var CimplifyClient = class {
547
619
  ...context,
548
620
  attempt: retryCount,
549
621
  delayMs: delay,
550
- error: new Error(`Rate limited: ${response.status}`)
622
+ error: new Error(`Retryable: ${response.status}`)
551
623
  });
552
624
  await sleep(delay);
553
625
  continue;
@@ -555,7 +627,7 @@ var CimplifyClient = class {
555
627
  if (response.status >= 400 && response.status < 500) {
556
628
  this.hooks.onRequestError?.({
557
629
  ...context,
558
- error: new chunkPEDLCL72_js.CimplifyError(
630
+ error: new chunkV2O5AO7I_js.CimplifyError(
559
631
  `HTTP_${response.status}`,
560
632
  `Request failed with status ${response.status}`,
561
633
  false
@@ -581,7 +653,7 @@ var CimplifyClient = class {
581
653
  }
582
654
  this.hooks.onRequestError?.({
583
655
  ...context,
584
- error: new chunkPEDLCL72_js.CimplifyError(
656
+ error: new chunkV2O5AO7I_js.CimplifyError(
585
657
  "SERVER_ERROR",
586
658
  `Server error ${response.status} after ${retryCount} retries`,
587
659
  false
@@ -652,29 +724,29 @@ var CimplifyClient = class {
652
724
  return this.handleRestResponse(response);
653
725
  });
654
726
  }
655
- async post(path, body) {
727
+ async post(path, body, opts) {
656
728
  const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
657
729
  method: "POST",
658
730
  credentials: this.credentials,
659
- headers: this.getHeaders(),
731
+ headers: mergeOptionHeaders(this.getHeaders(), opts),
660
732
  body: body ? JSON.stringify(body) : void 0
661
733
  });
662
734
  return this.handleRestResponse(response);
663
735
  }
664
- async patch(path, body) {
736
+ async patch(path, body, opts) {
665
737
  const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
666
738
  method: "PATCH",
667
739
  credentials: this.credentials,
668
- headers: this.getHeaders(),
740
+ headers: mergeOptionHeaders(this.getHeaders(), opts),
669
741
  body: body ? JSON.stringify(body) : void 0
670
742
  });
671
743
  return this.handleRestResponse(response);
672
744
  }
673
- async delete(path) {
745
+ async delete(path, opts) {
674
746
  const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
675
747
  method: "DELETE",
676
748
  credentials: this.credentials,
677
- headers: this.getHeaders()
749
+ headers: mergeOptionHeaders(this.getHeaders(), opts)
678
750
  });
679
751
  return this.handleRestResponse(response);
680
752
  }
@@ -689,20 +761,20 @@ var CimplifyClient = class {
689
761
  return this.handleRestResponse(response);
690
762
  });
691
763
  }
692
- async linkPost(path, body) {
764
+ async linkPost(path, body, opts) {
693
765
  const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
694
766
  method: "POST",
695
767
  credentials: this.credentials,
696
- headers: this.getHeaders(),
768
+ headers: mergeOptionHeaders(this.getHeaders(), opts),
697
769
  body: body ? JSON.stringify(body) : void 0
698
770
  });
699
771
  return this.handleRestResponse(response);
700
772
  }
701
- async linkDelete(path) {
773
+ async linkDelete(path, opts) {
702
774
  const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
703
775
  method: "DELETE",
704
776
  credentials: this.credentials,
705
- headers: this.getHeaders()
777
+ headers: mergeOptionHeaders(this.getHeaders(), opts)
706
778
  });
707
779
  return this.handleRestResponse(response);
708
780
  }
@@ -712,15 +784,19 @@ var CimplifyClient = class {
712
784
  const errorCode = typeof json.error === "object" && json.error?.error_code || typeof json.error === "object" && json.error?.code || "API_ERROR";
713
785
  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";
714
786
  const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
715
- const error = chunkPEDLCL72_js.enrichError(
716
- new chunkPEDLCL72_js.CimplifyError(
787
+ if (errorCode === "IDEMPOTENCY_MISMATCH") {
788
+ const originalCreatedAt = typeof json.error === "object" && json.error?.original_created_at || "";
789
+ throw new chunkV2O5AO7I_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
790
+ }
791
+ const error = chunkV2O5AO7I_js.enrichError(
792
+ new chunkV2O5AO7I_js.CimplifyError(
717
793
  errorCode,
718
794
  errorMessage,
719
795
  retryable
720
796
  ),
721
797
  { isTestMode: this.isTestMode() }
722
798
  );
723
- if (response.status === 401 || error.code === chunkPEDLCL72_js.ErrorCode.UNAUTHORIZED) {
799
+ if (response.status === 401 || error.code === chunkV2O5AO7I_js.ErrorCode.UNAUTHORIZED) {
724
800
  console.warn(
725
801
  "[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
726
802
  );
@@ -728,8 +804,8 @@ var CimplifyClient = class {
728
804
  throw error;
729
805
  }
730
806
  if (json?.success === false || json?.error?.code || json?.error?.message) {
731
- const error = chunkPEDLCL72_js.enrichError(
732
- new chunkPEDLCL72_js.CimplifyError(
807
+ const error = chunkV2O5AO7I_js.enrichError(
808
+ new chunkV2O5AO7I_js.CimplifyError(
733
809
  json.error?.code || "API_ERROR",
734
810
  json.error?.message || "An error occurred",
735
811
  json.error?.retryable || false
@@ -745,25 +821,25 @@ var CimplifyClient = class {
745
821
  }
746
822
  get catalogue() {
747
823
  if (!this._catalogue) {
748
- this._catalogue = new chunk2CGA3MUW_js.CatalogueQueries(this);
824
+ this._catalogue = new chunkHKVRUGM6_js.CatalogueQueries(this);
749
825
  }
750
826
  return this._catalogue;
751
827
  }
752
828
  get cart() {
753
829
  if (!this._cart) {
754
- this._cart = new chunk2CGA3MUW_js.CartOperations(this);
830
+ this._cart = new chunkHKVRUGM6_js.CartOperations(this);
755
831
  }
756
832
  return this._cart;
757
833
  }
758
834
  get checkout() {
759
835
  if (!this._checkout) {
760
- this._checkout = new chunk2CGA3MUW_js.CheckoutService(this);
836
+ this._checkout = new chunkHKVRUGM6_js.CheckoutService(this);
761
837
  }
762
838
  return this._checkout;
763
839
  }
764
840
  get orders() {
765
841
  if (!this._orders) {
766
- this._orders = new chunk2CGA3MUW_js.OrderQueries(this);
842
+ this._orders = new chunkHKVRUGM6_js.OrderQueries(this);
767
843
  }
768
844
  return this._orders;
769
845
  }
@@ -787,43 +863,43 @@ var CimplifyClient = class {
787
863
  }
788
864
  get link() {
789
865
  if (!this._link) {
790
- this._link = new chunk2CGA3MUW_js.LinkService(this);
866
+ this._link = new chunkHKVRUGM6_js.LinkService(this);
791
867
  }
792
868
  return this._link;
793
869
  }
794
870
  get auth() {
795
871
  if (!this._auth) {
796
- this._auth = new chunk2CGA3MUW_js.AuthService(this);
872
+ this._auth = new chunkHKVRUGM6_js.AuthService(this);
797
873
  }
798
874
  return this._auth;
799
875
  }
800
876
  get business() {
801
877
  if (!this._business) {
802
- this._business = new chunk2CGA3MUW_js.BusinessService(this);
878
+ this._business = new chunkHKVRUGM6_js.BusinessService(this);
803
879
  }
804
880
  return this._business;
805
881
  }
806
882
  get inventory() {
807
883
  if (!this._inventory) {
808
- this._inventory = new chunk2CGA3MUW_js.InventoryService(this);
884
+ this._inventory = new chunkHKVRUGM6_js.InventoryService(this);
809
885
  }
810
886
  return this._inventory;
811
887
  }
812
888
  get scheduling() {
813
889
  if (!this._scheduling) {
814
- this._scheduling = new chunk2CGA3MUW_js.SchedulingService(this);
890
+ this._scheduling = new chunkHKVRUGM6_js.SchedulingService(this);
815
891
  }
816
892
  return this._scheduling;
817
893
  }
818
894
  get lite() {
819
895
  if (!this._lite) {
820
- this._lite = new chunk2CGA3MUW_js.LiteService(this);
896
+ this._lite = new chunkHKVRUGM6_js.LiteService(this);
821
897
  }
822
898
  return this._lite;
823
899
  }
824
900
  get fx() {
825
901
  if (!this._fx) {
826
- this._fx = new chunk2CGA3MUW_js.FxService(this);
902
+ this._fx = new chunkHKVRUGM6_js.FxService(this);
827
903
  }
828
904
  return this._fx;
829
905
  }
@@ -858,7 +934,7 @@ var CimplifyClient = class {
858
934
  if (businessId) {
859
935
  this.setBusinessId(businessId);
860
936
  }
861
- return chunk2CGA3MUW_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
937
+ return chunkHKVRUGM6_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
862
938
  }
863
939
  };
864
940
  function createCimplifyClient(config = {}) {