@cimplify/sdk 0.104.1 → 0.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{catalogue-BlQ85Uma.d.mts → catalogue-CB44dO-g.d.mts} +4 -1
- package/dist/{catalogue-C8TqOj9K.d.ts → catalogue-lUdp-1hu.d.ts} +4 -1
- package/dist/{checkout-BqK9XUz5.d.mts → checkout-XoV4HNg2.d.mts} +311 -31
- package/dist/{checkout-BqK9XUz5.d.ts → checkout-XoV4HNg2.d.ts} +311 -31
- package/dist/{chunk-L5SNEU2O.mjs → chunk-3BTMAWL7.mjs} +47 -15
- package/dist/{chunk-BWEIMKLF.js → chunk-7SEOB5UW.js} +108 -76
- package/dist/{chunk-SFUJMS5E.js → chunk-AVXA4F6G.js} +33 -1
- package/dist/{chunk-UFOWPN3D.mjs → chunk-DPVDLMLI.mjs} +8 -13
- package/dist/{chunk-DQEXY542.js → chunk-H2WXUTMT.js} +211 -189
- package/dist/{chunk-6G3ANKQA.mjs → chunk-L4XKIMUO.mjs} +8 -1
- package/dist/{chunk-HYFA67A7.js → chunk-NJK3THWT.js} +67 -60
- package/dist/{chunk-RBNBSQI7.mjs → chunk-NJYR6GGM.mjs} +29 -2
- package/dist/{chunk-U54CWUUT.mjs → chunk-NYDVVNZI.mjs} +1 -1
- package/dist/{chunk-V4457OKB.mjs → chunk-RQT5BZ2Y.mjs} +36 -14
- package/dist/{chunk-XAUSDMMZ.js → chunk-UYFTOIFW.js} +6 -6
- package/dist/{chunk-WXREIBFW.js → chunk-YARZTZTB.js} +141 -146
- package/dist/{client-DhXeiUrf.d.ts → client-BQ_8FtA4.d.ts} +12 -2
- package/dist/{client-mXiUrV4X.d.mts → client-BWe1KWMf.d.mts} +12 -2
- package/dist/{index-DPWI5XcU.d.ts → index-C0k9om1S.d.ts} +2 -2
- package/dist/{index-B0AdZvrM.d.mts → index-DRMBo26v.d.mts} +2 -2
- package/dist/{index-CK8Nk5uQ.d.ts → index-DweR60Cv.d.ts} +2 -2
- package/dist/{index-DVfUh-ci.d.mts → index-aIQzSiP_.d.mts} +2 -2
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +166 -146
- package/dist/index.mjs +5 -5
- package/dist/mock/cli.mjs +9 -0
- package/dist/mock/library.js +9 -0
- package/dist/mock/library.mjs +9 -0
- package/dist/mock/msw.js +9 -0
- package/dist/mock/msw.mjs +9 -0
- package/dist/{price-BUDv1rI7.d.mts → price-CUGIYRtD.d.mts} +1 -1
- package/dist/{price-6hQIIac9.d.ts → price-De-sxcuj.d.ts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +151 -151
- package/dist/react.mjs +4 -4
- package/dist/{server-DJ0mSs9i.d.mts → server-7soMMUgP.d.ts} +3 -2
- package/dist/{server-DSTX76Ki.d.ts → server-DDEJ7e9s.d.mts} +3 -2
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +5 -5
- package/dist/testing/suite.d.ts +5 -5
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.d.mts +315 -8
- package/dist/testing.d.ts +315 -8
- package/dist/testing.js +118 -118
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +32 -32
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkH2WXUTMT_js = require('./chunk-H2WXUTMT.js');
|
|
5
|
+
var chunkAVXA4F6G_js = require('./chunk-AVXA4F6G.js');
|
|
6
6
|
|
|
7
7
|
// src/types/observability.ts
|
|
8
8
|
var SESSION_CHANGE_SOURCE = {
|
|
@@ -63,50 +63,49 @@ var PurchaseIntentResolver = class {
|
|
|
63
63
|
let pollAttempts = 0;
|
|
64
64
|
let actionSteps = 0;
|
|
65
65
|
let termsReviewSteps = 0;
|
|
66
|
+
const requestOptions = { signal: options.signal, timeoutMs: options.requestTimeoutMs };
|
|
66
67
|
this.ensureActive(options.signal);
|
|
67
|
-
this.notify(options,
|
|
68
|
-
let responseResult = options.initialResponse ?
|
|
68
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.CONFIRMING);
|
|
69
|
+
let responseResult = options.initialResponse ? chunkH2WXUTMT_js.ok(options.initialResponse) : await this.confirmation.confirm(intentId, request, requestOptions);
|
|
69
70
|
while (responseResult.ok) {
|
|
70
71
|
this.ensureActive(options.signal);
|
|
71
72
|
const response = responseResult.value;
|
|
72
73
|
switch (response.status) {
|
|
73
|
-
case
|
|
74
|
-
this.notify(options,
|
|
75
|
-
return
|
|
76
|
-
case
|
|
77
|
-
this.notify(options,
|
|
78
|
-
return
|
|
79
|
-
case
|
|
80
|
-
this.notify(options,
|
|
81
|
-
return
|
|
82
|
-
case
|
|
74
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED:
|
|
75
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.COMPLETED, response);
|
|
76
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.COMPLETED, response });
|
|
77
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.PAYMENT_FAILED:
|
|
78
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.FAILED, response);
|
|
79
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.FAILED, response });
|
|
80
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.PAYMENT_OUTCOME_UNKNOWN:
|
|
81
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.OUTCOME_UNKNOWN, response);
|
|
82
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.OUTCOME_UNKNOWN, response });
|
|
83
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.COLLECTION_PROCESSING:
|
|
83
84
|
if (pollAttempts >= maxPollAttempts) {
|
|
84
|
-
return
|
|
85
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.TIMED_OUT, response });
|
|
85
86
|
}
|
|
86
87
|
pollAttempts += 1;
|
|
87
|
-
this.notify(options,
|
|
88
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.POLLING, response);
|
|
88
89
|
await this.wait(pollIntervalMs, options.signal);
|
|
89
|
-
responseResult = await this.confirmation.confirm(intentId, request,
|
|
90
|
-
signal: options.signal
|
|
91
|
-
});
|
|
90
|
+
responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
92
91
|
continue;
|
|
93
|
-
case
|
|
94
|
-
case
|
|
95
|
-
case
|
|
96
|
-
this.notify(options,
|
|
92
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.REDIRECT_REQUIRED:
|
|
93
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED:
|
|
94
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED: {
|
|
95
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.AWAITING_ACTION, response);
|
|
97
96
|
if (!options.onActionRequired || actionSteps >= maxActionSteps) {
|
|
98
|
-
return
|
|
97
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.ACTION_REQUIRED, response });
|
|
99
98
|
}
|
|
100
99
|
actionSteps += 1;
|
|
101
100
|
const decision = await options.onActionRequired(response);
|
|
102
|
-
if (decision ===
|
|
103
|
-
return
|
|
101
|
+
if (decision === chunkAVXA4F6G_js.PURCHASE_INTENT_ACTION_DECISION.STOP) {
|
|
102
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.ACTION_REQUIRED, response });
|
|
104
103
|
}
|
|
105
|
-
if (typeof decision === "object" && decision.kind ===
|
|
104
|
+
if (typeof decision === "object" && decision.kind === chunkAVXA4F6G_js.PURCHASE_INTENT_ACTION_DECISION.SUBMIT) {
|
|
106
105
|
if (!this.confirmation.submitAction) {
|
|
107
|
-
return
|
|
108
|
-
new
|
|
109
|
-
|
|
106
|
+
return chunkH2WXUTMT_js.err(
|
|
107
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
108
|
+
chunkAVXA4F6G_js.PURCHASE_INTENT_ERROR_CODE.ACTION_UNSUPPORTED,
|
|
110
109
|
"This confirmation transport cannot submit purchase-intent actions.",
|
|
111
110
|
false
|
|
112
111
|
)
|
|
@@ -116,45 +115,41 @@ var PurchaseIntentResolver = class {
|
|
|
116
115
|
intentId,
|
|
117
116
|
response.attempt_id,
|
|
118
117
|
decision.request,
|
|
119
|
-
|
|
118
|
+
requestOptions
|
|
120
119
|
);
|
|
121
120
|
continue;
|
|
122
121
|
}
|
|
123
|
-
if (decision !==
|
|
124
|
-
return
|
|
125
|
-
new
|
|
126
|
-
|
|
122
|
+
if (decision !== chunkAVXA4F6G_js.PURCHASE_INTENT_ACTION_DECISION.CONTINUE) {
|
|
123
|
+
return chunkH2WXUTMT_js.err(
|
|
124
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
125
|
+
chunkAVXA4F6G_js.PURCHASE_INTENT_ERROR_CODE.ACTION_UNSUPPORTED,
|
|
127
126
|
"The action callback returned an unsupported decision.",
|
|
128
127
|
false
|
|
129
128
|
)
|
|
130
129
|
);
|
|
131
130
|
}
|
|
132
131
|
await this.wait(pollIntervalMs, options.signal);
|
|
133
|
-
responseResult = await this.confirmation.confirm(intentId, request,
|
|
134
|
-
signal: options.signal
|
|
135
|
-
});
|
|
132
|
+
responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
136
133
|
continue;
|
|
137
134
|
}
|
|
138
|
-
case
|
|
139
|
-
this.notify(options,
|
|
135
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED: {
|
|
136
|
+
this.notify(options, chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLVE_STATUS.REVIEWING_TERMS, response);
|
|
140
137
|
if (!options.onTermsChanged || termsReviewSteps >= maxTermsReviewSteps) {
|
|
141
|
-
return
|
|
138
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
142
139
|
}
|
|
143
140
|
termsReviewSteps += 1;
|
|
144
141
|
const replacementRequest = await options.onTermsChanged(response);
|
|
145
142
|
if (!replacementRequest) {
|
|
146
|
-
return
|
|
143
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
147
144
|
}
|
|
148
145
|
request = replacementRequest;
|
|
149
|
-
responseResult = await this.confirmation.confirm(intentId, request,
|
|
150
|
-
signal: options.signal
|
|
151
|
-
});
|
|
146
|
+
responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
152
147
|
continue;
|
|
153
148
|
}
|
|
154
|
-
case
|
|
155
|
-
case
|
|
156
|
-
case
|
|
157
|
-
return
|
|
149
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.SELECTION_UNAVAILABLE:
|
|
150
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.OFFER_ENDED:
|
|
151
|
+
case chunkAVXA4F6G_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE:
|
|
152
|
+
return chunkH2WXUTMT_js.ok({ kind: chunkAVXA4F6G_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
158
153
|
}
|
|
159
154
|
}
|
|
160
155
|
return responseResult;
|
|
@@ -197,7 +192,7 @@ var PurchaseIntentService = class {
|
|
|
197
192
|
this.resolver = new PurchaseIntentResolver({ confirmation: this });
|
|
198
193
|
}
|
|
199
194
|
mint(request, options) {
|
|
200
|
-
return
|
|
195
|
+
return chunkH2WXUTMT_js.safe(
|
|
201
196
|
this.transport.post(PURCHASE_INTENT_ROUTE.DIRECT_COLLECTION, request, {
|
|
202
197
|
idempotencyKey: request.client_intent_key,
|
|
203
198
|
signal: options?.signal,
|
|
@@ -206,7 +201,7 @@ var PurchaseIntentService = class {
|
|
|
206
201
|
);
|
|
207
202
|
}
|
|
208
203
|
get(intentId, options) {
|
|
209
|
-
return
|
|
204
|
+
return chunkH2WXUTMT_js.safe(
|
|
210
205
|
this.transport.get(this.intentPath(intentId), {
|
|
211
206
|
signal: options?.signal,
|
|
212
207
|
timeoutMs: options?.timeoutMs
|
|
@@ -217,7 +212,7 @@ var PurchaseIntentService = class {
|
|
|
217
212
|
const request = {
|
|
218
213
|
expected_intent_revision: expectedRevision
|
|
219
214
|
};
|
|
220
|
-
return
|
|
215
|
+
return chunkH2WXUTMT_js.safe(
|
|
221
216
|
this.transport.post(
|
|
222
217
|
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.REFRESH}`,
|
|
223
218
|
request,
|
|
@@ -229,7 +224,7 @@ var PurchaseIntentService = class {
|
|
|
229
224
|
);
|
|
230
225
|
}
|
|
231
226
|
confirm(intentId, request, options) {
|
|
232
|
-
return
|
|
227
|
+
return chunkH2WXUTMT_js.safe(
|
|
233
228
|
this.transport.post(
|
|
234
229
|
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.CONFIRM}`,
|
|
235
230
|
request,
|
|
@@ -244,7 +239,7 @@ var PurchaseIntentService = class {
|
|
|
244
239
|
submitAction(intentId, attemptId, request, options) {
|
|
245
240
|
const normalizedAttemptId = attemptId.trim();
|
|
246
241
|
if (!normalizedAttemptId) throw new TypeError("attemptId must not be empty");
|
|
247
|
-
return
|
|
242
|
+
return chunkH2WXUTMT_js.safe(
|
|
248
243
|
this.transport.post(
|
|
249
244
|
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.ATTEMPTS}/${encodeURIComponent(normalizedAttemptId)}/${PURCHASE_INTENT_ROUTE.ACTIONS}`,
|
|
250
245
|
request,
|
|
@@ -276,7 +271,7 @@ var HostedPurchaseIntentService = class {
|
|
|
276
271
|
this.resolver = new PurchaseIntentResolver({ confirmation: this });
|
|
277
272
|
}
|
|
278
273
|
prepare(request, options) {
|
|
279
|
-
return
|
|
274
|
+
return chunkH2WXUTMT_js.safe(
|
|
280
275
|
this.transport.post(
|
|
281
276
|
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.PREPARE}`,
|
|
282
277
|
request,
|
|
@@ -289,7 +284,7 @@ var HostedPurchaseIntentService = class {
|
|
|
289
284
|
);
|
|
290
285
|
}
|
|
291
286
|
confirm(_intentId, request, options) {
|
|
292
|
-
return
|
|
287
|
+
return chunkH2WXUTMT_js.safe(
|
|
293
288
|
this.transport.post(
|
|
294
289
|
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.CONFIRM}`,
|
|
295
290
|
request,
|
|
@@ -302,7 +297,7 @@ var HostedPurchaseIntentService = class {
|
|
|
302
297
|
);
|
|
303
298
|
}
|
|
304
299
|
replay(options) {
|
|
305
|
-
return
|
|
300
|
+
return chunkH2WXUTMT_js.safe(
|
|
306
301
|
this.transport.get(
|
|
307
302
|
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.REPLAY}`,
|
|
308
303
|
{
|
|
@@ -315,7 +310,7 @@ var HostedPurchaseIntentService = class {
|
|
|
315
310
|
submitAction(_intentId, attemptId, request, options) {
|
|
316
311
|
const normalized = attemptId.trim();
|
|
317
312
|
if (!normalized) throw new TypeError("attemptId must not be empty");
|
|
318
|
-
return
|
|
313
|
+
return chunkH2WXUTMT_js.safe(
|
|
319
314
|
this.transport.post(
|
|
320
315
|
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.ATTEMPTS}/${encodeURIComponent(normalized)}/${PURCHASE_INTENT_ROUTE.ACTIONS}`,
|
|
321
316
|
request,
|
|
@@ -341,7 +336,7 @@ var StoreCreditQueries = class {
|
|
|
341
336
|
* currency. Requires a signed-in customer; returns an error otherwise.
|
|
342
337
|
*/
|
|
343
338
|
async balance() {
|
|
344
|
-
return
|
|
339
|
+
return chunkH2WXUTMT_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
345
340
|
}
|
|
346
341
|
};
|
|
347
342
|
|
|
@@ -717,7 +712,7 @@ var ActivityService = class {
|
|
|
717
712
|
this.sendEvents([event]);
|
|
718
713
|
}
|
|
719
714
|
async getState() {
|
|
720
|
-
return
|
|
715
|
+
return chunkH2WXUTMT_js.safe(this.client.get("/api/v1/activity/state"));
|
|
721
716
|
}
|
|
722
717
|
async getRecommendations(options) {
|
|
723
718
|
const params = new URLSearchParams();
|
|
@@ -725,10 +720,10 @@ var ActivityService = class {
|
|
|
725
720
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
726
721
|
const query = params.toString();
|
|
727
722
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
728
|
-
return
|
|
723
|
+
return chunkH2WXUTMT_js.safe(this.client.get(path));
|
|
729
724
|
}
|
|
730
725
|
async dismissMessage(code) {
|
|
731
|
-
return
|
|
726
|
+
return chunkH2WXUTMT_js.safe(
|
|
732
727
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
733
728
|
);
|
|
734
729
|
}
|
|
@@ -834,16 +829,16 @@ var SubscriptionService = class {
|
|
|
834
829
|
this.client = client;
|
|
835
830
|
}
|
|
836
831
|
async list() {
|
|
837
|
-
return
|
|
832
|
+
return chunkH2WXUTMT_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
838
833
|
}
|
|
839
834
|
async get(id) {
|
|
840
835
|
const encodedId = encodeURIComponent(id);
|
|
841
|
-
return
|
|
836
|
+
return chunkH2WXUTMT_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
842
837
|
}
|
|
843
838
|
async cancel(id, reason, opts) {
|
|
844
839
|
const encodedId = encodeURIComponent(id);
|
|
845
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
846
|
-
return
|
|
840
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
841
|
+
return chunkH2WXUTMT_js.safe(
|
|
847
842
|
this.client.post(
|
|
848
843
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
849
844
|
{ reason },
|
|
@@ -853,20 +848,20 @@ var SubscriptionService = class {
|
|
|
853
848
|
}
|
|
854
849
|
async pause(id) {
|
|
855
850
|
const encodedId = encodeURIComponent(id);
|
|
856
|
-
return
|
|
851
|
+
return chunkH2WXUTMT_js.safe(
|
|
857
852
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
858
853
|
);
|
|
859
854
|
}
|
|
860
855
|
async resume(id) {
|
|
861
856
|
const encodedId = encodeURIComponent(id);
|
|
862
|
-
return
|
|
857
|
+
return chunkH2WXUTMT_js.safe(
|
|
863
858
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
864
859
|
);
|
|
865
860
|
}
|
|
866
861
|
async skipNextRenewal(id, opts) {
|
|
867
862
|
const encodedId = encodeURIComponent(id);
|
|
868
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
869
|
-
return
|
|
863
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
864
|
+
return chunkH2WXUTMT_js.safe(
|
|
870
865
|
this.client.post(
|
|
871
866
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
872
867
|
void 0,
|
|
@@ -882,8 +877,8 @@ var UploadService = class {
|
|
|
882
877
|
this.client = client;
|
|
883
878
|
}
|
|
884
879
|
async init(filename, contentType2, sizeBytes, opts) {
|
|
885
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
886
|
-
return
|
|
880
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
881
|
+
return chunkH2WXUTMT_js.safe(
|
|
887
882
|
this.client.post(
|
|
888
883
|
"/api/v1/uploads/init",
|
|
889
884
|
{
|
|
@@ -896,7 +891,7 @@ var UploadService = class {
|
|
|
896
891
|
);
|
|
897
892
|
}
|
|
898
893
|
async confirm(uploadId) {
|
|
899
|
-
return
|
|
894
|
+
return chunkH2WXUTMT_js.safe(
|
|
900
895
|
this.client.post("/api/v1/uploads/confirm", {
|
|
901
896
|
upload_id: uploadId
|
|
902
897
|
})
|
|
@@ -915,7 +910,7 @@ var UploadService = class {
|
|
|
915
910
|
if (!uploadResponse.ok) {
|
|
916
911
|
return {
|
|
917
912
|
ok: false,
|
|
918
|
-
error: new
|
|
913
|
+
error: new chunkAVXA4F6G_js.CimplifyError(
|
|
919
914
|
"UPLOAD_FAILED",
|
|
920
915
|
`Upload failed with status ${uploadResponse.status}`,
|
|
921
916
|
true
|
|
@@ -925,7 +920,7 @@ var UploadService = class {
|
|
|
925
920
|
} catch (error) {
|
|
926
921
|
return {
|
|
927
922
|
ok: false,
|
|
928
|
-
error: new
|
|
923
|
+
error: new chunkAVXA4F6G_js.CimplifyError(
|
|
929
924
|
"UPLOAD_FAILED",
|
|
930
925
|
error instanceof Error ? error.message : "Upload failed",
|
|
931
926
|
true
|
|
@@ -942,7 +937,7 @@ var PlacesService = class {
|
|
|
942
937
|
this.client = client;
|
|
943
938
|
}
|
|
944
939
|
async autocomplete(input, sessionToken) {
|
|
945
|
-
return
|
|
940
|
+
return chunkH2WXUTMT_js.safe(
|
|
946
941
|
this.client.post("/api/v1/places/autocomplete", {
|
|
947
942
|
input,
|
|
948
943
|
sessionToken
|
|
@@ -950,7 +945,7 @@ var PlacesService = class {
|
|
|
950
945
|
);
|
|
951
946
|
}
|
|
952
947
|
async details(placeId, sessionToken) {
|
|
953
|
-
return
|
|
948
|
+
return chunkH2WXUTMT_js.safe(
|
|
954
949
|
this.client.post("/api/v1/places/details", {
|
|
955
950
|
place_id: placeId,
|
|
956
951
|
sessionToken
|
|
@@ -969,7 +964,7 @@ var DeliveryService = class {
|
|
|
969
964
|
params.set("dropoff_lat", String(dropoffLat));
|
|
970
965
|
params.set("dropoff_lng", String(dropoffLng));
|
|
971
966
|
if (country) params.set("country", country);
|
|
972
|
-
return
|
|
967
|
+
return chunkH2WXUTMT_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
973
968
|
}
|
|
974
969
|
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
975
970
|
const query = typeof queryOrLatitude === "number" ? {
|
|
@@ -983,7 +978,7 @@ var DeliveryService = class {
|
|
|
983
978
|
if (query.country) params.set("country", query.country);
|
|
984
979
|
if (query.currency) params.set("currency", query.currency);
|
|
985
980
|
if (query.orderValue != null) params.set("order_value", String(query.orderValue));
|
|
986
|
-
return
|
|
981
|
+
return chunkH2WXUTMT_js.safe(
|
|
987
982
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
988
983
|
);
|
|
989
984
|
}
|
|
@@ -1155,7 +1150,7 @@ var SupportService = class {
|
|
|
1155
1150
|
async claimConversation() {
|
|
1156
1151
|
const accessToken = this.client.getAccessToken();
|
|
1157
1152
|
if (!accessToken) {
|
|
1158
|
-
return
|
|
1153
|
+
return chunkH2WXUTMT_js.err(new chunkAVXA4F6G_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
1159
1154
|
}
|
|
1160
1155
|
if (this.claimInFlight) {
|
|
1161
1156
|
if (this.claimInFlightToken === accessToken) return this.claimInFlight;
|
|
@@ -1163,12 +1158,12 @@ var SupportService = class {
|
|
|
1163
1158
|
return this.claimConversation();
|
|
1164
1159
|
}
|
|
1165
1160
|
if (this.lastClaimedAccessToken === accessToken) {
|
|
1166
|
-
return
|
|
1161
|
+
return chunkH2WXUTMT_js.err(new chunkAVXA4F6G_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
1167
1162
|
}
|
|
1168
1163
|
const epoch = this.client.getSessionEpoch();
|
|
1169
1164
|
this.claimInFlightToken = accessToken;
|
|
1170
1165
|
this.claimInFlight = (async () => {
|
|
1171
|
-
const result = await
|
|
1166
|
+
const result = await chunkH2WXUTMT_js.safe(
|
|
1172
1167
|
this.client.post(
|
|
1173
1168
|
"/api/v1/support/conversation/claim",
|
|
1174
1169
|
{ access_token: accessToken },
|
|
@@ -1177,8 +1172,8 @@ var SupportService = class {
|
|
|
1177
1172
|
);
|
|
1178
1173
|
if (result.ok) {
|
|
1179
1174
|
if (this.client.getSessionEpoch() !== epoch) {
|
|
1180
|
-
return
|
|
1181
|
-
new
|
|
1175
|
+
return chunkH2WXUTMT_js.err(
|
|
1176
|
+
new chunkAVXA4F6G_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
1182
1177
|
);
|
|
1183
1178
|
}
|
|
1184
1179
|
this.lastClaimedAccessToken = accessToken;
|
|
@@ -1208,9 +1203,9 @@ var SupportService = class {
|
|
|
1208
1203
|
*/
|
|
1209
1204
|
async claimExternalChats() {
|
|
1210
1205
|
if (!this.client.getAccessToken()) {
|
|
1211
|
-
return
|
|
1206
|
+
return chunkH2WXUTMT_js.err(new chunkAVXA4F6G_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
1212
1207
|
}
|
|
1213
|
-
return
|
|
1208
|
+
return chunkH2WXUTMT_js.safe(
|
|
1214
1209
|
(async () => {
|
|
1215
1210
|
const businessId = await this.client.resolveBusinessId();
|
|
1216
1211
|
return this.client.post("/v1/me/chats/external-claims", {
|
|
@@ -1225,26 +1220,26 @@ var SupportService = class {
|
|
|
1225
1220
|
* the inbox with empty threads.
|
|
1226
1221
|
*/
|
|
1227
1222
|
async peekConversation() {
|
|
1228
|
-
const result = await
|
|
1223
|
+
const result = await chunkH2WXUTMT_js.safe(
|
|
1229
1224
|
this.client.get("/api/v1/support/conversation")
|
|
1230
1225
|
);
|
|
1231
1226
|
if (!result.ok) return result;
|
|
1232
|
-
if (!result.value.conversation) return
|
|
1233
|
-
return
|
|
1227
|
+
if (!result.value.conversation) return chunkH2WXUTMT_js.ok(null);
|
|
1228
|
+
return chunkH2WXUTMT_js.ok({
|
|
1234
1229
|
conversation: result.value.conversation,
|
|
1235
1230
|
messages: chatMessagesFromWire(result.value.messages)
|
|
1236
1231
|
});
|
|
1237
1232
|
}
|
|
1238
1233
|
/** Open (or resume) the customer's widget conversation. */
|
|
1239
1234
|
async openConversation(opts) {
|
|
1240
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
1241
|
-
const result = await
|
|
1235
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
1236
|
+
const result = await chunkH2WXUTMT_js.safe(
|
|
1242
1237
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
1243
1238
|
idempotencyKey
|
|
1244
1239
|
})
|
|
1245
1240
|
);
|
|
1246
1241
|
if (!result.ok) return result;
|
|
1247
|
-
return
|
|
1242
|
+
return chunkH2WXUTMT_js.ok({
|
|
1248
1243
|
conversation: result.value.conversation,
|
|
1249
1244
|
messages: chatMessagesFromWire(result.value.messages)
|
|
1250
1245
|
});
|
|
@@ -1258,8 +1253,8 @@ var SupportService = class {
|
|
|
1258
1253
|
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
1259
1254
|
*/
|
|
1260
1255
|
async sendMessage(content, opts) {
|
|
1261
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
1262
|
-
const result = await
|
|
1256
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
1257
|
+
const result = await chunkH2WXUTMT_js.safe(
|
|
1263
1258
|
this.client.post(
|
|
1264
1259
|
"/api/v1/support/conversation/messages",
|
|
1265
1260
|
{
|
|
@@ -1271,7 +1266,7 @@ var SupportService = class {
|
|
|
1271
1266
|
{ idempotencyKey }
|
|
1272
1267
|
)
|
|
1273
1268
|
);
|
|
1274
|
-
return result.ok ?
|
|
1269
|
+
return result.ok ? chunkH2WXUTMT_js.ok(chatMessageFromWire(result.value.message)) : result;
|
|
1275
1270
|
}
|
|
1276
1271
|
/**
|
|
1277
1272
|
* Poll for messages. `after` pages forward (live updates); `before` pages
|
|
@@ -1286,25 +1281,25 @@ var SupportService = class {
|
|
|
1286
1281
|
if (options.limit) params.set("limit", String(options.limit));
|
|
1287
1282
|
const query = params.toString();
|
|
1288
1283
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
1289
|
-
const result = await
|
|
1290
|
-
return result.ok ?
|
|
1284
|
+
const result = await chunkH2WXUTMT_js.safe(this.client.get(path));
|
|
1285
|
+
return result.ok ? chunkH2WXUTMT_js.ok(chatMessagesFromWire(result.value)) : result;
|
|
1291
1286
|
}
|
|
1292
1287
|
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
1293
1288
|
async reactToMessage(messageId, emoji) {
|
|
1294
|
-
const clientId =
|
|
1295
|
-
const result = await
|
|
1289
|
+
const clientId = chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
1290
|
+
const result = await chunkH2WXUTMT_js.safe(
|
|
1296
1291
|
this.client.post(
|
|
1297
1292
|
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
1298
1293
|
{ emoji, client_id: clientId },
|
|
1299
1294
|
{ idempotencyKey: clientId }
|
|
1300
1295
|
)
|
|
1301
1296
|
);
|
|
1302
|
-
return result.ok ?
|
|
1297
|
+
return result.ok ? chunkH2WXUTMT_js.ok(chatMessageFromWire(result.value.message)) : result;
|
|
1303
1298
|
}
|
|
1304
1299
|
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
1305
1300
|
async requestHuman(opts) {
|
|
1306
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
1307
|
-
return
|
|
1301
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkH2WXUTMT_js.generateIdempotencyKey();
|
|
1302
|
+
return chunkH2WXUTMT_js.safe(
|
|
1308
1303
|
this.client.post(
|
|
1309
1304
|
"/api/v1/support/conversation/handoff",
|
|
1310
1305
|
void 0,
|
|
@@ -1426,7 +1421,7 @@ var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
|
1426
1421
|
var MAX_RETRY_AFTER_MS = 3e4;
|
|
1427
1422
|
function sleep(ms, signal) {
|
|
1428
1423
|
if (signal?.aborted) {
|
|
1429
|
-
return Promise.reject(new
|
|
1424
|
+
return Promise.reject(new chunkAVXA4F6G_js.CimplifyError(chunkAVXA4F6G_js.ErrorCode.CANCELLED, "Request was cancelled.", true));
|
|
1430
1425
|
}
|
|
1431
1426
|
return new Promise((resolve, reject) => {
|
|
1432
1427
|
const timer = setTimeout(() => {
|
|
@@ -1435,7 +1430,7 @@ function sleep(ms, signal) {
|
|
|
1435
1430
|
}, ms);
|
|
1436
1431
|
const onAbort = () => {
|
|
1437
1432
|
clearTimeout(timer);
|
|
1438
|
-
reject(new
|
|
1433
|
+
reject(new chunkAVXA4F6G_js.CimplifyError(chunkAVXA4F6G_js.ErrorCode.CANCELLED, "Request was cancelled.", true));
|
|
1439
1434
|
};
|
|
1440
1435
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1441
1436
|
});
|
|
@@ -1493,16 +1488,16 @@ function isRetryable(error) {
|
|
|
1493
1488
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
1494
1489
|
return true;
|
|
1495
1490
|
}
|
|
1496
|
-
if (error instanceof
|
|
1491
|
+
if (error instanceof chunkAVXA4F6G_js.CimplifyError) {
|
|
1497
1492
|
return error.retryable;
|
|
1498
1493
|
}
|
|
1499
1494
|
return false;
|
|
1500
1495
|
}
|
|
1501
1496
|
function toNetworkError(error, isTestMode) {
|
|
1502
1497
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
1503
|
-
return
|
|
1504
|
-
new
|
|
1505
|
-
|
|
1498
|
+
return chunkAVXA4F6G_js.enrichError(
|
|
1499
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
1500
|
+
chunkAVXA4F6G_js.ErrorCode.TIMEOUT,
|
|
1506
1501
|
"Request timed out. Please check your connection and try again.",
|
|
1507
1502
|
true
|
|
1508
1503
|
),
|
|
@@ -1510,21 +1505,21 @@ function toNetworkError(error, isTestMode) {
|
|
|
1510
1505
|
);
|
|
1511
1506
|
}
|
|
1512
1507
|
if (error instanceof TypeError && error.message.includes("fetch")) {
|
|
1513
|
-
return
|
|
1514
|
-
new
|
|
1515
|
-
|
|
1508
|
+
return chunkAVXA4F6G_js.enrichError(
|
|
1509
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
1510
|
+
chunkAVXA4F6G_js.ErrorCode.NETWORK_ERROR,
|
|
1516
1511
|
"Network error. Please check your internet connection.",
|
|
1517
1512
|
true
|
|
1518
1513
|
),
|
|
1519
1514
|
{ isTestMode }
|
|
1520
1515
|
);
|
|
1521
1516
|
}
|
|
1522
|
-
if (error instanceof
|
|
1523
|
-
return
|
|
1517
|
+
if (error instanceof chunkAVXA4F6G_js.CimplifyError) {
|
|
1518
|
+
return chunkAVXA4F6G_js.enrichError(error, { isTestMode });
|
|
1524
1519
|
}
|
|
1525
|
-
return
|
|
1526
|
-
new
|
|
1527
|
-
|
|
1520
|
+
return chunkAVXA4F6G_js.enrichError(
|
|
1521
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
1522
|
+
chunkAVXA4F6G_js.ErrorCode.UNKNOWN_ERROR,
|
|
1528
1523
|
error instanceof Error ? error.message : "An unknown error occurred",
|
|
1529
1524
|
false
|
|
1530
1525
|
),
|
|
@@ -1588,7 +1583,7 @@ var CimplifyClient = class {
|
|
|
1588
1583
|
this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
1589
1584
|
this.retryDelay = config.retryDelay ?? DEFAULT_RETRY_DELAY_MS;
|
|
1590
1585
|
this.hooks = config.hooks ?? {};
|
|
1591
|
-
this.authorizationAdapters = config.authorizationAdapterRegistry ??
|
|
1586
|
+
this.authorizationAdapters = config.authorizationAdapterRegistry ?? chunkH2WXUTMT_js.createDefaultPaymentAuthorizationAdapterRegistry();
|
|
1592
1587
|
this.fetchImpl = (config.fetch ?? globalThis.fetch).bind(globalThis);
|
|
1593
1588
|
this.sessionToken = this.loadSessionToken() ?? this.mintSessionToken();
|
|
1594
1589
|
const persistedSessionSync = this.loadSessionSyncPayload();
|
|
@@ -1878,15 +1873,15 @@ var CimplifyClient = class {
|
|
|
1878
1873
|
const resolution = (async () => {
|
|
1879
1874
|
const result = await this.business.getInfo();
|
|
1880
1875
|
if (!result.ok || !result.value?.id) {
|
|
1881
|
-
throw new
|
|
1882
|
-
|
|
1876
|
+
throw new chunkAVXA4F6G_js.CimplifyError(
|
|
1877
|
+
chunkAVXA4F6G_js.ErrorCode.NOT_FOUND,
|
|
1883
1878
|
"Unable to resolve business ID from the current public key.",
|
|
1884
1879
|
true
|
|
1885
1880
|
);
|
|
1886
1881
|
}
|
|
1887
1882
|
if (this.publicKeyEpoch !== publicKeyEpoch) {
|
|
1888
|
-
throw new
|
|
1889
|
-
|
|
1883
|
+
throw new chunkAVXA4F6G_js.CimplifyError(
|
|
1884
|
+
chunkAVXA4F6G_js.ErrorCode.TENANT_CONTEXT_CHANGED,
|
|
1890
1885
|
"The storefront tenant changed while resolving its business identity.",
|
|
1891
1886
|
true
|
|
1892
1887
|
);
|
|
@@ -2011,7 +2006,7 @@ var CimplifyClient = class {
|
|
|
2011
2006
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
2012
2007
|
try {
|
|
2013
2008
|
if (signal?.aborted) {
|
|
2014
|
-
throw new
|
|
2009
|
+
throw new chunkAVXA4F6G_js.CimplifyError(chunkAVXA4F6G_js.ErrorCode.CANCELLED, "Request was cancelled.", true);
|
|
2015
2010
|
}
|
|
2016
2011
|
const controller = new AbortController();
|
|
2017
2012
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs ?? this.timeout);
|
|
@@ -2054,7 +2049,7 @@ var CimplifyClient = class {
|
|
|
2054
2049
|
if (response.status >= 400 && response.status < 500) {
|
|
2055
2050
|
this.hooks.onRequestError?.({
|
|
2056
2051
|
...context,
|
|
2057
|
-
error: new
|
|
2052
|
+
error: new chunkAVXA4F6G_js.CimplifyError(
|
|
2058
2053
|
`HTTP_${response.status}`,
|
|
2059
2054
|
`Request failed with status ${response.status}`,
|
|
2060
2055
|
false
|
|
@@ -2080,8 +2075,8 @@ var CimplifyClient = class {
|
|
|
2080
2075
|
}
|
|
2081
2076
|
this.hooks.onRequestError?.({
|
|
2082
2077
|
...context,
|
|
2083
|
-
error: new
|
|
2084
|
-
|
|
2078
|
+
error: new chunkAVXA4F6G_js.CimplifyError(
|
|
2079
|
+
chunkAVXA4F6G_js.ErrorCode.SERVER_ERROR,
|
|
2085
2080
|
`Server error ${response.status} after ${retryCount} retries`,
|
|
2086
2081
|
false
|
|
2087
2082
|
),
|
|
@@ -2094,7 +2089,7 @@ var CimplifyClient = class {
|
|
|
2094
2089
|
} catch (error) {
|
|
2095
2090
|
lastError = error;
|
|
2096
2091
|
if (signal?.aborted) {
|
|
2097
|
-
throw new
|
|
2092
|
+
throw new chunkAVXA4F6G_js.CimplifyError(chunkAVXA4F6G_js.ErrorCode.CANCELLED, "Request was cancelled.", true);
|
|
2098
2093
|
}
|
|
2099
2094
|
const networkError = toNetworkError(error, this.isTestMode());
|
|
2100
2095
|
const errorRetryable = isRetryable(error);
|
|
@@ -2268,17 +2263,17 @@ var CimplifyClient = class {
|
|
|
2268
2263
|
async handleRestResponse(response) {
|
|
2269
2264
|
const json = await response.json();
|
|
2270
2265
|
if (!response.ok) {
|
|
2271
|
-
const errorCode = typeof json.error === "object" && json.error?.error_code || typeof json.error === "object" && json.error?.code ||
|
|
2266
|
+
const errorCode = typeof json.error === "object" && json.error?.error_code || typeof json.error === "object" && json.error?.code || chunkAVXA4F6G_js.ErrorCode.API_ERROR;
|
|
2272
2267
|
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";
|
|
2273
2268
|
const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
|
|
2274
|
-
if (errorCode ===
|
|
2269
|
+
if (errorCode === chunkAVXA4F6G_js.ErrorCode.IDEMPOTENCY_MISMATCH) {
|
|
2275
2270
|
const originalCreatedAt = typeof json.error === "object" && json.error?.original_created_at || "";
|
|
2276
|
-
throw new
|
|
2271
|
+
throw new chunkAVXA4F6G_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
|
|
2277
2272
|
}
|
|
2278
|
-
const error =
|
|
2273
|
+
const error = chunkAVXA4F6G_js.enrichError(new chunkAVXA4F6G_js.CimplifyError(errorCode, errorMessage, retryable), {
|
|
2279
2274
|
isTestMode: this.isTestMode()
|
|
2280
2275
|
});
|
|
2281
|
-
if ((response.status === 401 || error.code ===
|
|
2276
|
+
if ((response.status === 401 || error.code === chunkAVXA4F6G_js.ErrorCode.UNAUTHORIZED) && this.accessToken) {
|
|
2282
2277
|
console.warn(
|
|
2283
2278
|
"[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
|
|
2284
2279
|
);
|
|
@@ -2286,9 +2281,9 @@ var CimplifyClient = class {
|
|
|
2286
2281
|
throw error;
|
|
2287
2282
|
}
|
|
2288
2283
|
if (json?.success === false || json?.error?.code || json?.error?.message) {
|
|
2289
|
-
const error =
|
|
2290
|
-
new
|
|
2291
|
-
json.error?.code ||
|
|
2284
|
+
const error = chunkAVXA4F6G_js.enrichError(
|
|
2285
|
+
new chunkAVXA4F6G_js.CimplifyError(
|
|
2286
|
+
json.error?.code || chunkAVXA4F6G_js.ErrorCode.API_ERROR,
|
|
2292
2287
|
json.error?.message || "An error occurred",
|
|
2293
2288
|
json.error?.retryable || false
|
|
2294
2289
|
),
|
|
@@ -2303,19 +2298,19 @@ var CimplifyClient = class {
|
|
|
2303
2298
|
}
|
|
2304
2299
|
get catalogue() {
|
|
2305
2300
|
if (!this._catalogue) {
|
|
2306
|
-
this._catalogue = new
|
|
2301
|
+
this._catalogue = new chunkH2WXUTMT_js.CatalogueQueries(this);
|
|
2307
2302
|
}
|
|
2308
2303
|
return this._catalogue;
|
|
2309
2304
|
}
|
|
2310
2305
|
get cart() {
|
|
2311
2306
|
if (!this._cart) {
|
|
2312
|
-
this._cart = new
|
|
2307
|
+
this._cart = new chunkH2WXUTMT_js.CartOperations(this);
|
|
2313
2308
|
}
|
|
2314
2309
|
return this._cart;
|
|
2315
2310
|
}
|
|
2316
2311
|
get checkout() {
|
|
2317
2312
|
if (!this._checkout) {
|
|
2318
|
-
this._checkout = new
|
|
2313
|
+
this._checkout = new chunkH2WXUTMT_js.CheckoutService(this);
|
|
2319
2314
|
}
|
|
2320
2315
|
return this._checkout;
|
|
2321
2316
|
}
|
|
@@ -2327,7 +2322,7 @@ var CimplifyClient = class {
|
|
|
2327
2322
|
}
|
|
2328
2323
|
get orders() {
|
|
2329
2324
|
if (!this._orders) {
|
|
2330
|
-
this._orders = new
|
|
2325
|
+
this._orders = new chunkH2WXUTMT_js.OrderQueries(this);
|
|
2331
2326
|
}
|
|
2332
2327
|
return this._orders;
|
|
2333
2328
|
}
|
|
@@ -2357,43 +2352,43 @@ var CimplifyClient = class {
|
|
|
2357
2352
|
}
|
|
2358
2353
|
get link() {
|
|
2359
2354
|
if (!this._link) {
|
|
2360
|
-
this._link = new
|
|
2355
|
+
this._link = new chunkH2WXUTMT_js.LinkService(this);
|
|
2361
2356
|
}
|
|
2362
2357
|
return this._link;
|
|
2363
2358
|
}
|
|
2364
2359
|
get auth() {
|
|
2365
2360
|
if (!this._auth) {
|
|
2366
|
-
this._auth = new
|
|
2361
|
+
this._auth = new chunkH2WXUTMT_js.AuthService(this);
|
|
2367
2362
|
}
|
|
2368
2363
|
return this._auth;
|
|
2369
2364
|
}
|
|
2370
2365
|
get business() {
|
|
2371
2366
|
if (!this._business) {
|
|
2372
|
-
this._business = new
|
|
2367
|
+
this._business = new chunkH2WXUTMT_js.BusinessService(this);
|
|
2373
2368
|
}
|
|
2374
2369
|
return this._business;
|
|
2375
2370
|
}
|
|
2376
2371
|
get inventory() {
|
|
2377
2372
|
if (!this._inventory) {
|
|
2378
|
-
this._inventory = new
|
|
2373
|
+
this._inventory = new chunkH2WXUTMT_js.InventoryService(this);
|
|
2379
2374
|
}
|
|
2380
2375
|
return this._inventory;
|
|
2381
2376
|
}
|
|
2382
2377
|
get scheduling() {
|
|
2383
2378
|
if (!this._scheduling) {
|
|
2384
|
-
this._scheduling = new
|
|
2379
|
+
this._scheduling = new chunkH2WXUTMT_js.SchedulingService(this);
|
|
2385
2380
|
}
|
|
2386
2381
|
return this._scheduling;
|
|
2387
2382
|
}
|
|
2388
2383
|
get lite() {
|
|
2389
2384
|
if (!this._lite) {
|
|
2390
|
-
this._lite = new
|
|
2385
|
+
this._lite = new chunkH2WXUTMT_js.LiteService(this);
|
|
2391
2386
|
}
|
|
2392
2387
|
return this._lite;
|
|
2393
2388
|
}
|
|
2394
2389
|
get fx() {
|
|
2395
2390
|
if (!this._fx) {
|
|
2396
|
-
this._fx = new
|
|
2391
|
+
this._fx = new chunkH2WXUTMT_js.FxService(this);
|
|
2397
2392
|
}
|
|
2398
2393
|
return this._fx;
|
|
2399
2394
|
}
|
|
@@ -2428,7 +2423,7 @@ var CimplifyClient = class {
|
|
|
2428
2423
|
if (businessId) {
|
|
2429
2424
|
this.setBusinessId(businessId);
|
|
2430
2425
|
}
|
|
2431
|
-
return
|
|
2426
|
+
return chunkH2WXUTMT_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
2432
2427
|
}
|
|
2433
2428
|
};
|
|
2434
2429
|
function createCimplifyClient(config = {}) {
|