@cimplify/sdk 0.44.14 → 0.44.16
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.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +21 -21
- package/dist/advanced.mjs +2 -2
- package/dist/{chunk-6TVQQYQ5.mjs → chunk-6AZZ6AOF.mjs} +21 -1
- package/dist/{chunk-EZK2FXTM.mjs → chunk-7NML226B.mjs} +1 -1
- package/dist/{chunk-BAWKQRIB.js → chunk-CFD4J32N.js} +21 -21
- package/dist/{chunk-OMAP327U.js → chunk-MBGQP6FZ.js} +62 -61
- package/dist/{chunk-V2O5AO7I.js → chunk-MNIKXG7W.js} +26 -0
- package/dist/{chunk-3WD6U5RD.mjs → chunk-UXLQ7WXI.mjs} +4 -3
- package/dist/chunk-XL4CX75J.js +9370 -0
- package/dist/chunk-ZLEFMQC6.mjs +9318 -0
- package/dist/cli/commands/deploy.mjs +9 -1
- package/dist/{client-lvLvB1_K.d.ts → client-D6ZisKco.d.ts} +7 -0
- package/dist/{client-CkGlXZRd.d.mts → client-Dh-bHyhU.d.mts} +7 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +106 -106
- package/dist/index.mjs +3 -3
- package/dist/mock/cli.mjs +2 -1
- package/dist/mock/library.js +2 -1
- package/dist/mock/library.mjs +2 -1
- package/dist/mock/msw.js +2 -1
- package/dist/mock/msw.mjs +2 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +80 -80
- package/dist/react.mjs +3 -3
- package/dist/server-CWpUlLOQ.d.mts +1003 -0
- package/dist/server-CWpUlLOQ.d.ts +1003 -0
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/dist/testing/suite.d.mts +60 -0
- package/dist/testing/suite.d.ts +60 -0
- package/dist/testing/suite.js +169 -0
- package/dist/testing/suite.mjs +165 -0
- package/dist/testing.d.mts +1359 -0
- package/dist/testing.d.ts +1359 -0
- package/dist/testing.js +213 -0
- package/dist/testing.mjs +4 -0
- package/dist/utils.js +28 -28
- package/dist/utils.mjs +1 -1
- package/package.json +18 -3
- package/templates/storefront-bakery/__tests__/brand.test.ts +4 -0
- package/templates/storefront-bakery/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-bakery/__tests__/contract.test.ts +4 -0
- package/templates/storefront-bakery/package.json +11 -3
- package/templates/storefront-bakery/vitest.config.ts +9 -0
- package/templates/storefront-fashion/__tests__/brand.test.ts +4 -0
- package/templates/storefront-fashion/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-fashion/__tests__/contract.test.ts +4 -0
- package/templates/storefront-fashion/package.json +11 -3
- package/templates/storefront-fashion/vitest.config.ts +9 -0
- package/templates/storefront-grocery/__tests__/brand.test.ts +4 -0
- package/templates/storefront-grocery/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-grocery/__tests__/contract.test.ts +4 -0
- package/templates/storefront-grocery/package.json +11 -3
- package/templates/storefront-grocery/vitest.config.ts +9 -0
- package/templates/storefront-restaurant/__tests__/brand.test.ts +4 -0
- package/templates/storefront-restaurant/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-restaurant/__tests__/contract.test.ts +4 -0
- package/templates/storefront-restaurant/package.json +11 -3
- package/templates/storefront-restaurant/vitest.config.ts +9 -0
- package/templates/storefront-retail/__tests__/brand.test.ts +4 -0
- package/templates/storefront-retail/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-retail/__tests__/contract.test.ts +4 -0
- package/templates/storefront-retail/package.json +11 -3
- package/templates/storefront-retail/vitest.config.ts +9 -0
- package/templates/storefront-services/__tests__/brand.test.ts +4 -0
- package/templates/storefront-services/__tests__/cart-flow.test.ts +4 -0
- package/templates/storefront-services/__tests__/contract.test.ts +4 -0
- package/templates/storefront-services/package.json +11 -3
- package/templates/storefront-services/vitest.config.ts +9 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkCFD4J32N_js = require('./chunk-CFD4J32N.js');
|
|
4
|
+
var chunkMNIKXG7W_js = require('./chunk-MNIKXG7W.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
|
|
32
|
+
return chunkCFD4J32N_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
|
|
40
|
+
return chunkCFD4J32N_js.safe(this.client.get(path));
|
|
41
41
|
}
|
|
42
42
|
async dismissMessage(code) {
|
|
43
|
-
return
|
|
43
|
+
return chunkCFD4J32N_js.safe(
|
|
44
44
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -62,16 +62,16 @@ var SubscriptionService = class {
|
|
|
62
62
|
this.client = client;
|
|
63
63
|
}
|
|
64
64
|
async list() {
|
|
65
|
-
return
|
|
65
|
+
return chunkCFD4J32N_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
66
66
|
}
|
|
67
67
|
async get(id) {
|
|
68
68
|
const encodedId = encodeURIComponent(id);
|
|
69
|
-
return
|
|
69
|
+
return chunkCFD4J32N_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
70
70
|
}
|
|
71
71
|
async cancel(id, reason, opts) {
|
|
72
72
|
const encodedId = encodeURIComponent(id);
|
|
73
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
74
|
-
return
|
|
73
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkCFD4J32N_js.generateIdempotencyKey();
|
|
74
|
+
return chunkCFD4J32N_js.safe(
|
|
75
75
|
this.client.post(
|
|
76
76
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
77
77
|
{ reason },
|
|
@@ -81,20 +81,20 @@ var SubscriptionService = class {
|
|
|
81
81
|
}
|
|
82
82
|
async pause(id) {
|
|
83
83
|
const encodedId = encodeURIComponent(id);
|
|
84
|
-
return
|
|
84
|
+
return chunkCFD4J32N_js.safe(
|
|
85
85
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
async resume(id) {
|
|
89
89
|
const encodedId = encodeURIComponent(id);
|
|
90
|
-
return
|
|
90
|
+
return chunkCFD4J32N_js.safe(
|
|
91
91
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
async skipNextRenewal(id, opts) {
|
|
95
95
|
const encodedId = encodeURIComponent(id);
|
|
96
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
97
|
-
return
|
|
96
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkCFD4J32N_js.generateIdempotencyKey();
|
|
97
|
+
return chunkCFD4J32N_js.safe(
|
|
98
98
|
this.client.post(
|
|
99
99
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
100
100
|
void 0,
|
|
@@ -110,8 +110,8 @@ var UploadService = class {
|
|
|
110
110
|
this.client = client;
|
|
111
111
|
}
|
|
112
112
|
async init(filename, contentType, sizeBytes, opts) {
|
|
113
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
114
|
-
return
|
|
113
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkCFD4J32N_js.generateIdempotencyKey();
|
|
114
|
+
return chunkCFD4J32N_js.safe(
|
|
115
115
|
this.client.post(
|
|
116
116
|
"/api/v1/uploads/init",
|
|
117
117
|
{
|
|
@@ -124,7 +124,7 @@ var UploadService = class {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
async confirm(uploadId) {
|
|
127
|
-
return
|
|
127
|
+
return chunkCFD4J32N_js.safe(
|
|
128
128
|
this.client.post("/api/v1/uploads/confirm", {
|
|
129
129
|
upload_id: uploadId
|
|
130
130
|
})
|
|
@@ -143,7 +143,7 @@ var UploadService = class {
|
|
|
143
143
|
if (!uploadResponse.ok) {
|
|
144
144
|
return {
|
|
145
145
|
ok: false,
|
|
146
|
-
error: new
|
|
146
|
+
error: new chunkMNIKXG7W_js.CimplifyError(
|
|
147
147
|
"UPLOAD_FAILED",
|
|
148
148
|
`Upload failed with status ${uploadResponse.status}`,
|
|
149
149
|
true
|
|
@@ -153,7 +153,7 @@ var UploadService = class {
|
|
|
153
153
|
} catch (error) {
|
|
154
154
|
return {
|
|
155
155
|
ok: false,
|
|
156
|
-
error: new
|
|
156
|
+
error: new chunkMNIKXG7W_js.CimplifyError(
|
|
157
157
|
"UPLOAD_FAILED",
|
|
158
158
|
error instanceof Error ? error.message : "Upload failed",
|
|
159
159
|
true
|
|
@@ -170,7 +170,7 @@ var PlacesService = class {
|
|
|
170
170
|
this.client = client;
|
|
171
171
|
}
|
|
172
172
|
async autocomplete(input, sessionToken) {
|
|
173
|
-
return
|
|
173
|
+
return chunkCFD4J32N_js.safe(
|
|
174
174
|
this.client.post("/api/v1/places/autocomplete", {
|
|
175
175
|
input,
|
|
176
176
|
sessionToken
|
|
@@ -178,7 +178,7 @@ var PlacesService = class {
|
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
async details(placeId, sessionToken) {
|
|
181
|
-
return
|
|
181
|
+
return chunkCFD4J32N_js.safe(
|
|
182
182
|
this.client.post("/api/v1/places/details", {
|
|
183
183
|
place_id: placeId,
|
|
184
184
|
sessionToken
|
|
@@ -197,7 +197,7 @@ var DeliveryService = class {
|
|
|
197
197
|
params.set("dropoff_lat", String(dropoffLat));
|
|
198
198
|
params.set("dropoff_lng", String(dropoffLng));
|
|
199
199
|
if (country) params.set("country", country);
|
|
200
|
-
return
|
|
200
|
+
return chunkCFD4J32N_js.safe(
|
|
201
201
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
202
202
|
);
|
|
203
203
|
}
|
|
@@ -210,8 +210,8 @@ var SupportService = class {
|
|
|
210
210
|
}
|
|
211
211
|
/** Open (or resume) the customer's widget conversation. */
|
|
212
212
|
async openConversation(opts) {
|
|
213
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
214
|
-
return
|
|
213
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkCFD4J32N_js.generateIdempotencyKey();
|
|
214
|
+
return chunkCFD4J32N_js.safe(
|
|
215
215
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
216
216
|
idempotencyKey
|
|
217
217
|
})
|
|
@@ -219,8 +219,8 @@ var SupportService = class {
|
|
|
219
219
|
}
|
|
220
220
|
/** Send a message in the active conversation. */
|
|
221
221
|
async sendMessage(content, opts) {
|
|
222
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
223
|
-
return
|
|
222
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkCFD4J32N_js.generateIdempotencyKey();
|
|
223
|
+
return chunkCFD4J32N_js.safe(
|
|
224
224
|
this.client.post(
|
|
225
225
|
"/api/v1/support/conversation/messages",
|
|
226
226
|
{ content },
|
|
@@ -235,7 +235,7 @@ var SupportService = class {
|
|
|
235
235
|
if (options.limit) params.set("limit", String(options.limit));
|
|
236
236
|
const query = params.toString();
|
|
237
237
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
238
|
-
return
|
|
238
|
+
return chunkCFD4J32N_js.safe(this.client.get(path));
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
@@ -304,16 +304,16 @@ function isRetryable(error) {
|
|
|
304
304
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
305
305
|
return true;
|
|
306
306
|
}
|
|
307
|
-
if (error instanceof
|
|
307
|
+
if (error instanceof chunkMNIKXG7W_js.CimplifyError) {
|
|
308
308
|
return error.retryable;
|
|
309
309
|
}
|
|
310
310
|
return false;
|
|
311
311
|
}
|
|
312
312
|
function toNetworkError(error, isTestMode) {
|
|
313
313
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
314
|
-
return
|
|
315
|
-
new
|
|
316
|
-
|
|
314
|
+
return chunkMNIKXG7W_js.enrichError(
|
|
315
|
+
new chunkMNIKXG7W_js.CimplifyError(
|
|
316
|
+
chunkMNIKXG7W_js.ErrorCode.TIMEOUT,
|
|
317
317
|
"Request timed out. Please check your connection and try again.",
|
|
318
318
|
true
|
|
319
319
|
),
|
|
@@ -321,21 +321,21 @@ function toNetworkError(error, isTestMode) {
|
|
|
321
321
|
);
|
|
322
322
|
}
|
|
323
323
|
if (error instanceof TypeError && error.message.includes("fetch")) {
|
|
324
|
-
return
|
|
325
|
-
new
|
|
326
|
-
|
|
324
|
+
return chunkMNIKXG7W_js.enrichError(
|
|
325
|
+
new chunkMNIKXG7W_js.CimplifyError(
|
|
326
|
+
chunkMNIKXG7W_js.ErrorCode.NETWORK_ERROR,
|
|
327
327
|
"Network error. Please check your internet connection.",
|
|
328
328
|
true
|
|
329
329
|
),
|
|
330
330
|
{ isTestMode }
|
|
331
331
|
);
|
|
332
332
|
}
|
|
333
|
-
if (error instanceof
|
|
334
|
-
return
|
|
333
|
+
if (error instanceof chunkMNIKXG7W_js.CimplifyError) {
|
|
334
|
+
return chunkMNIKXG7W_js.enrichError(error, { isTestMode });
|
|
335
335
|
}
|
|
336
|
-
return
|
|
337
|
-
new
|
|
338
|
-
|
|
336
|
+
return chunkMNIKXG7W_js.enrichError(
|
|
337
|
+
new chunkMNIKXG7W_js.CimplifyError(
|
|
338
|
+
chunkMNIKXG7W_js.ErrorCode.UNKNOWN_ERROR,
|
|
339
339
|
error instanceof Error ? error.message : "An unknown error occurred",
|
|
340
340
|
false
|
|
341
341
|
),
|
|
@@ -393,6 +393,7 @@ var CimplifyClient = class {
|
|
|
393
393
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
394
394
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
395
395
|
this.hooks = config.hooks ?? {};
|
|
396
|
+
this.fetchImpl = (config.fetch ?? globalThis.fetch).bind(globalThis);
|
|
396
397
|
this.accessToken = this.loadAccessToken();
|
|
397
398
|
this.sessionToken = this.loadSessionToken();
|
|
398
399
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
@@ -509,8 +510,8 @@ var CimplifyClient = class {
|
|
|
509
510
|
this.businessIdResolvePromise = (async () => {
|
|
510
511
|
const result = await this.business.getInfo();
|
|
511
512
|
if (!result.ok || !result.value?.id) {
|
|
512
|
-
throw new
|
|
513
|
-
|
|
513
|
+
throw new chunkMNIKXG7W_js.CimplifyError(
|
|
514
|
+
chunkMNIKXG7W_js.ErrorCode.NOT_FOUND,
|
|
514
515
|
"Unable to resolve business ID from the current public key.",
|
|
515
516
|
true
|
|
516
517
|
);
|
|
@@ -597,7 +598,7 @@ var CimplifyClient = class {
|
|
|
597
598
|
try {
|
|
598
599
|
const controller = new AbortController();
|
|
599
600
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
600
|
-
const response = await
|
|
601
|
+
const response = await this.fetchImpl(url, {
|
|
601
602
|
...options,
|
|
602
603
|
signal: controller.signal
|
|
603
604
|
});
|
|
@@ -627,7 +628,7 @@ var CimplifyClient = class {
|
|
|
627
628
|
if (response.status >= 400 && response.status < 500) {
|
|
628
629
|
this.hooks.onRequestError?.({
|
|
629
630
|
...context,
|
|
630
|
-
error: new
|
|
631
|
+
error: new chunkMNIKXG7W_js.CimplifyError(
|
|
631
632
|
`HTTP_${response.status}`,
|
|
632
633
|
`Request failed with status ${response.status}`,
|
|
633
634
|
false
|
|
@@ -653,7 +654,7 @@ var CimplifyClient = class {
|
|
|
653
654
|
}
|
|
654
655
|
this.hooks.onRequestError?.({
|
|
655
656
|
...context,
|
|
656
|
-
error: new
|
|
657
|
+
error: new chunkMNIKXG7W_js.CimplifyError(
|
|
657
658
|
"SERVER_ERROR",
|
|
658
659
|
`Server error ${response.status} after ${retryCount} retries`,
|
|
659
660
|
false
|
|
@@ -786,17 +787,17 @@ var CimplifyClient = class {
|
|
|
786
787
|
const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
|
|
787
788
|
if (errorCode === "IDEMPOTENCY_MISMATCH") {
|
|
788
789
|
const originalCreatedAt = typeof json.error === "object" && json.error?.original_created_at || "";
|
|
789
|
-
throw new
|
|
790
|
+
throw new chunkMNIKXG7W_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
|
|
790
791
|
}
|
|
791
|
-
const error =
|
|
792
|
-
new
|
|
792
|
+
const error = chunkMNIKXG7W_js.enrichError(
|
|
793
|
+
new chunkMNIKXG7W_js.CimplifyError(
|
|
793
794
|
errorCode,
|
|
794
795
|
errorMessage,
|
|
795
796
|
retryable
|
|
796
797
|
),
|
|
797
798
|
{ isTestMode: this.isTestMode() }
|
|
798
799
|
);
|
|
799
|
-
if (response.status === 401 || error.code ===
|
|
800
|
+
if (response.status === 401 || error.code === chunkMNIKXG7W_js.ErrorCode.UNAUTHORIZED) {
|
|
800
801
|
console.warn(
|
|
801
802
|
"[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
|
|
802
803
|
);
|
|
@@ -804,8 +805,8 @@ var CimplifyClient = class {
|
|
|
804
805
|
throw error;
|
|
805
806
|
}
|
|
806
807
|
if (json?.success === false || json?.error?.code || json?.error?.message) {
|
|
807
|
-
const error =
|
|
808
|
-
new
|
|
808
|
+
const error = chunkMNIKXG7W_js.enrichError(
|
|
809
|
+
new chunkMNIKXG7W_js.CimplifyError(
|
|
809
810
|
json.error?.code || "API_ERROR",
|
|
810
811
|
json.error?.message || "An error occurred",
|
|
811
812
|
json.error?.retryable || false
|
|
@@ -821,25 +822,25 @@ var CimplifyClient = class {
|
|
|
821
822
|
}
|
|
822
823
|
get catalogue() {
|
|
823
824
|
if (!this._catalogue) {
|
|
824
|
-
this._catalogue = new
|
|
825
|
+
this._catalogue = new chunkCFD4J32N_js.CatalogueQueries(this);
|
|
825
826
|
}
|
|
826
827
|
return this._catalogue;
|
|
827
828
|
}
|
|
828
829
|
get cart() {
|
|
829
830
|
if (!this._cart) {
|
|
830
|
-
this._cart = new
|
|
831
|
+
this._cart = new chunkCFD4J32N_js.CartOperations(this);
|
|
831
832
|
}
|
|
832
833
|
return this._cart;
|
|
833
834
|
}
|
|
834
835
|
get checkout() {
|
|
835
836
|
if (!this._checkout) {
|
|
836
|
-
this._checkout = new
|
|
837
|
+
this._checkout = new chunkCFD4J32N_js.CheckoutService(this);
|
|
837
838
|
}
|
|
838
839
|
return this._checkout;
|
|
839
840
|
}
|
|
840
841
|
get orders() {
|
|
841
842
|
if (!this._orders) {
|
|
842
|
-
this._orders = new
|
|
843
|
+
this._orders = new chunkCFD4J32N_js.OrderQueries(this);
|
|
843
844
|
}
|
|
844
845
|
return this._orders;
|
|
845
846
|
}
|
|
@@ -863,43 +864,43 @@ var CimplifyClient = class {
|
|
|
863
864
|
}
|
|
864
865
|
get link() {
|
|
865
866
|
if (!this._link) {
|
|
866
|
-
this._link = new
|
|
867
|
+
this._link = new chunkCFD4J32N_js.LinkService(this);
|
|
867
868
|
}
|
|
868
869
|
return this._link;
|
|
869
870
|
}
|
|
870
871
|
get auth() {
|
|
871
872
|
if (!this._auth) {
|
|
872
|
-
this._auth = new
|
|
873
|
+
this._auth = new chunkCFD4J32N_js.AuthService(this);
|
|
873
874
|
}
|
|
874
875
|
return this._auth;
|
|
875
876
|
}
|
|
876
877
|
get business() {
|
|
877
878
|
if (!this._business) {
|
|
878
|
-
this._business = new
|
|
879
|
+
this._business = new chunkCFD4J32N_js.BusinessService(this);
|
|
879
880
|
}
|
|
880
881
|
return this._business;
|
|
881
882
|
}
|
|
882
883
|
get inventory() {
|
|
883
884
|
if (!this._inventory) {
|
|
884
|
-
this._inventory = new
|
|
885
|
+
this._inventory = new chunkCFD4J32N_js.InventoryService(this);
|
|
885
886
|
}
|
|
886
887
|
return this._inventory;
|
|
887
888
|
}
|
|
888
889
|
get scheduling() {
|
|
889
890
|
if (!this._scheduling) {
|
|
890
|
-
this._scheduling = new
|
|
891
|
+
this._scheduling = new chunkCFD4J32N_js.SchedulingService(this);
|
|
891
892
|
}
|
|
892
893
|
return this._scheduling;
|
|
893
894
|
}
|
|
894
895
|
get lite() {
|
|
895
896
|
if (!this._lite) {
|
|
896
|
-
this._lite = new
|
|
897
|
+
this._lite = new chunkCFD4J32N_js.LiteService(this);
|
|
897
898
|
}
|
|
898
899
|
return this._lite;
|
|
899
900
|
}
|
|
900
901
|
get fx() {
|
|
901
902
|
if (!this._fx) {
|
|
902
|
-
this._fx = new
|
|
903
|
+
this._fx = new chunkCFD4J32N_js.FxService(this);
|
|
903
904
|
}
|
|
904
905
|
return this._fx;
|
|
905
906
|
}
|
|
@@ -934,7 +935,7 @@ var CimplifyClient = class {
|
|
|
934
935
|
if (businessId) {
|
|
935
936
|
this.setBusinessId(businessId);
|
|
936
937
|
}
|
|
937
|
-
return
|
|
938
|
+
return chunkCFD4J32N_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
938
939
|
}
|
|
939
940
|
};
|
|
940
941
|
function createCimplifyClient(config = {}) {
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __typeError = (msg) => {
|
|
5
|
+
throw TypeError(msg);
|
|
6
|
+
};
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
10
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
11
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
12
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
13
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
14
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
15
|
+
set _(value) {
|
|
16
|
+
__privateSet(obj, member, value, setter);
|
|
17
|
+
},
|
|
18
|
+
get _() {
|
|
19
|
+
return __privateGet(obj, member, getter);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
3
23
|
// src/types/common.ts
|
|
4
24
|
function money(value) {
|
|
5
25
|
return typeof value === "string" ? parseFloat(value) || 0 : value;
|
|
@@ -717,6 +737,12 @@ exports.ErrorCode = ErrorCode;
|
|
|
717
737
|
exports.IdempotencyMismatchError = IdempotencyMismatchError;
|
|
718
738
|
exports.MOBILE_MONEY_PROVIDERS = MOBILE_MONEY_PROVIDERS;
|
|
719
739
|
exports.ZERO = ZERO;
|
|
740
|
+
exports.__privateAdd = __privateAdd;
|
|
741
|
+
exports.__privateGet = __privateGet;
|
|
742
|
+
exports.__privateMethod = __privateMethod;
|
|
743
|
+
exports.__privateSet = __privateSet;
|
|
744
|
+
exports.__privateWrapper = __privateWrapper;
|
|
745
|
+
exports.__publicField = __publicField;
|
|
720
746
|
exports.categorizePaymentError = categorizePaymentError;
|
|
721
747
|
exports.currencyCode = currencyCode;
|
|
722
748
|
exports.detectMobileMoneyProvider = detectMobileMoneyProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
2
|
-
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-
|
|
1
|
+
import { safe, generateIdempotencyKey, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-7NML226B.mjs';
|
|
2
|
+
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-6AZZ6AOF.mjs';
|
|
3
3
|
|
|
4
4
|
// src/activity.ts
|
|
5
5
|
var ActivityService = class {
|
|
@@ -391,6 +391,7 @@ var CimplifyClient = class {
|
|
|
391
391
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
392
392
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
393
393
|
this.hooks = config.hooks ?? {};
|
|
394
|
+
this.fetchImpl = (config.fetch ?? globalThis.fetch).bind(globalThis);
|
|
394
395
|
this.accessToken = this.loadAccessToken();
|
|
395
396
|
this.sessionToken = this.loadSessionToken();
|
|
396
397
|
if (!this.publicKey && !config.suppressPublicKeyWarning) {
|
|
@@ -595,7 +596,7 @@ var CimplifyClient = class {
|
|
|
595
596
|
try {
|
|
596
597
|
const controller = new AbortController();
|
|
597
598
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
598
|
-
const response = await
|
|
599
|
+
const response = await this.fetchImpl(url, {
|
|
599
600
|
...options,
|
|
600
601
|
signal: controller.signal
|
|
601
602
|
});
|