@cimplify/sdk 0.100.0 → 0.100.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/{chunk-J3UYIBKH.js → chunk-BHQCSHIG.js} +78 -72
- package/dist/{chunk-V5TU5JKA.mjs → chunk-DLW3RWRK.mjs} +30 -6
- package/dist/{chunk-I7L4VRHI.mjs → chunk-KEC2CX4R.mjs} +2 -2
- package/dist/{chunk-FECGCIVV.js → chunk-NH3HYUC3.js} +3 -3
- package/dist/{chunk-AETVRBKI.js → chunk-NIOUSKQQ.js} +1 -0
- package/dist/{chunk-7TEMLVDT.mjs → chunk-NKZIXLKW.mjs} +1 -1
- package/dist/{chunk-ZA5VKVUB.js → chunk-NR4Z2SFY.js} +4 -4
- package/dist/{chunk-K5EN2W2Q.mjs → chunk-O3YUHLZL.mjs} +1 -0
- package/dist/{chunk-OX5L6XE7.mjs → chunk-PTKAN4SI.mjs} +25 -15
- package/dist/{chunk-X6G6QERR.js → chunk-QGFKIAEM.js} +48 -38
- package/dist/{chunk-GWKIDFN6.mjs → chunk-T2B656RS.mjs} +8 -3
- package/dist/{chunk-64EDCDBR.js → chunk-WMEC5JWN.js} +32 -7
- package/dist/{client-C1vS5pf0.d.ts → client-B0Lku_lc.d.mts} +17 -16
- package/dist/{client-DmR3Z6pQ.d.ts → client-DRgEa78P.d.ts} +2 -2
- package/dist/{client-B5MeD8da.d.mts → client-DxgC_lXU.d.ts} +17 -16
- package/dist/{client-DQpvwf-p.d.mts → client-T5c-Nxq-.d.mts} +2 -2
- package/dist/{index-Br-vFygC.d.ts → index-CzKN1hjf.d.ts} +3 -3
- package/dist/{index-DUOCn1Cs.d.mts → index-DzuLT5wi.d.mts} +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +117 -117
- package/dist/index.mjs +5 -5
- package/dist/{payment-BIpS9oPG.d.mts → payment-D8NEwCna.d.mts} +1 -1
- package/dist/{payment-CsuBKHqg.d.ts → payment-lZBP7h5M.d.ts} +1 -1
- package/dist/{price-IOOoVYS-.d.mts → price-DepWAmcL.d.mts} +1 -1
- package/dist/{price-Ml_uPoiY.d.ts → price-ncQb-TC8.d.ts} +1 -1
- package/dist/{product-BKV6TBj_.d.ts → product-B384_Qm2.d.mts} +12 -1
- package/dist/{product-BKV6TBj_.d.mts → product-B384_Qm2.d.ts} +12 -1
- package/dist/react.d.mts +10 -5
- package/dist/react.d.ts +10 -5
- package/dist/react.js +830 -446
- package/dist/react.mjs +711 -327
- package/dist/{server-CfpYhSV_.d.ts → server-B7O4ttpv.d.ts} +1 -1
- package/dist/{server-C0iEk55_.d.mts → server-oCGNIO_K.d.mts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- 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 +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +81 -81
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +29 -29
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
- package/registry/cart-summary.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/sale-badge.json +1 -1
package/dist/advanced.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aK as ELEMENT_TYPES, aL as EVENT_TYPES, aO as ElementEventType, aP as ElementOptions, aQ as ElementType, aY as ElementsOptions, b4 as FetchQuoteInput, bd as FxService, bh as GetProductsOptions, bk as InventoryService, bs as LinkService, by as LiteService, bF as MESSAGE_TYPES, c5 as OrderQueries, cr as PriceQuote, cx as QuoteBundleSelectionInput, cy as QuoteCompositeSelectionInput, cz as QuoteDynamicBuckets, cA as QuoteStatus, cB as QuoteUiMessage, cD as RefreshQuoteInput, cE as RefreshQuoteResult, d4 as SchedulingService, dK as createElements } from './client-
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aK as ELEMENT_TYPES, aL as EVENT_TYPES, aO as ElementEventType, aP as ElementOptions, aQ as ElementType, aY as ElementsOptions, b4 as FetchQuoteInput, bd as FxService, bh as GetProductsOptions, bk as InventoryService, bs as LinkService, by as LiteService, bF as MESSAGE_TYPES, c5 as OrderQueries, cr as PriceQuote, cx as QuoteBundleSelectionInput, cy as QuoteCompositeSelectionInput, cz as QuoteDynamicBuckets, cA as QuoteStatus, cB as QuoteUiMessage, cD as RefreshQuoteInput, cE as RefreshQuoteResult, d4 as SchedulingService, dK as createElements } from './client-B0Lku_lc.mjs';
|
|
2
|
+
import './product-B384_Qm2.mjs';
|
|
3
|
+
import './payment-D8NEwCna.mjs';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aK as ELEMENT_TYPES, aL as EVENT_TYPES, aO as ElementEventType, aP as ElementOptions, aQ as ElementType, aY as ElementsOptions, b4 as FetchQuoteInput, bd as FxService, bh as GetProductsOptions, bk as InventoryService, bs as LinkService, by as LiteService, bF as MESSAGE_TYPES, c5 as OrderQueries, cr as PriceQuote, cx as QuoteBundleSelectionInput, cy as QuoteCompositeSelectionInput, cz as QuoteDynamicBuckets, cA as QuoteStatus, cB as QuoteUiMessage, cD as RefreshQuoteInput, cE as RefreshQuoteResult, d4 as SchedulingService, dK as createElements } from './client-
|
|
2
|
-
import './product-
|
|
3
|
-
import './payment-
|
|
1
|
+
export { k as AuthService, C as BusinessService, O as CartOperations, P as CatalogueQueries, ab as CheckoutOperations, ab as CheckoutService, ah as CimplifyElement, ai as CimplifyElements, aK as ELEMENT_TYPES, aL as EVENT_TYPES, aO as ElementEventType, aP as ElementOptions, aQ as ElementType, aY as ElementsOptions, b4 as FetchQuoteInput, bd as FxService, bh as GetProductsOptions, bk as InventoryService, bs as LinkService, by as LiteService, bF as MESSAGE_TYPES, c5 as OrderQueries, cr as PriceQuote, cx as QuoteBundleSelectionInput, cy as QuoteCompositeSelectionInput, cz as QuoteDynamicBuckets, cA as QuoteStatus, cB as QuoteUiMessage, cD as RefreshQuoteInput, cE as RefreshQuoteResult, d4 as SchedulingService, dK as createElements } from './client-DxgC_lXU.js';
|
|
2
|
+
import './product-B384_Qm2.js';
|
|
3
|
+
import './payment-lZBP7h5M.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkQGFKIAEM_js = require('./chunk-QGFKIAEM.js');
|
|
4
|
+
require('./chunk-WMEC5JWN.js');
|
|
5
|
+
require('./chunk-NIOUSKQQ.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkQGFKIAEM_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkQGFKIAEM_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkQGFKIAEM_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkQGFKIAEM_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkQGFKIAEM_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkQGFKIAEM_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkQGFKIAEM_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkQGFKIAEM_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkQGFKIAEM_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkQGFKIAEM_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkQGFKIAEM_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkQGFKIAEM_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkQGFKIAEM_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkQGFKIAEM_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkQGFKIAEM_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkQGFKIAEM_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkQGFKIAEM_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkQGFKIAEM_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkQGFKIAEM_js.generateIdempotencyKey; }
|
|
85
85
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { AuthService, BusinessService, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LinkService, LiteService, MESSAGE_TYPES, OrderQueries, SchedulingService, createElements, generateIdempotencyKey } from './chunk-PTKAN4SI.mjs';
|
|
2
|
+
import './chunk-DLW3RWRK.mjs';
|
|
3
|
+
import './chunk-O3YUHLZL.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkQGFKIAEM_js = require('./chunk-QGFKIAEM.js');
|
|
4
|
+
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
|
|
5
5
|
|
|
6
6
|
// src/store-credit.ts
|
|
7
7
|
var StoreCreditQueries = class {
|
|
@@ -13,7 +13,7 @@ var StoreCreditQueries = class {
|
|
|
13
13
|
* currency. Requires a signed-in customer; returns an error otherwise.
|
|
14
14
|
*/
|
|
15
15
|
async balance() {
|
|
16
|
-
return
|
|
16
|
+
return chunkQGFKIAEM_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -105,7 +105,7 @@ var ActivityService = class {
|
|
|
105
105
|
this.sendEvents([event]);
|
|
106
106
|
}
|
|
107
107
|
async getState() {
|
|
108
|
-
return
|
|
108
|
+
return chunkQGFKIAEM_js.safe(this.client.get("/api/v1/activity/state"));
|
|
109
109
|
}
|
|
110
110
|
async getRecommendations(options) {
|
|
111
111
|
const params = new URLSearchParams();
|
|
@@ -113,10 +113,10 @@ var ActivityService = class {
|
|
|
113
113
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
114
114
|
const query = params.toString();
|
|
115
115
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
116
|
-
return
|
|
116
|
+
return chunkQGFKIAEM_js.safe(this.client.get(path));
|
|
117
117
|
}
|
|
118
118
|
async dismissMessage(code) {
|
|
119
|
-
return
|
|
119
|
+
return chunkQGFKIAEM_js.safe(
|
|
120
120
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
121
121
|
);
|
|
122
122
|
}
|
|
@@ -189,16 +189,16 @@ var SubscriptionService = class {
|
|
|
189
189
|
this.client = client;
|
|
190
190
|
}
|
|
191
191
|
async list() {
|
|
192
|
-
return
|
|
192
|
+
return chunkQGFKIAEM_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
193
193
|
}
|
|
194
194
|
async get(id) {
|
|
195
195
|
const encodedId = encodeURIComponent(id);
|
|
196
|
-
return
|
|
196
|
+
return chunkQGFKIAEM_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
197
197
|
}
|
|
198
198
|
async cancel(id, reason, opts) {
|
|
199
199
|
const encodedId = encodeURIComponent(id);
|
|
200
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
201
|
-
return
|
|
200
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
201
|
+
return chunkQGFKIAEM_js.safe(
|
|
202
202
|
this.client.post(
|
|
203
203
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
204
204
|
{ reason },
|
|
@@ -208,20 +208,20 @@ var SubscriptionService = class {
|
|
|
208
208
|
}
|
|
209
209
|
async pause(id) {
|
|
210
210
|
const encodedId = encodeURIComponent(id);
|
|
211
|
-
return
|
|
211
|
+
return chunkQGFKIAEM_js.safe(
|
|
212
212
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
async resume(id) {
|
|
216
216
|
const encodedId = encodeURIComponent(id);
|
|
217
|
-
return
|
|
217
|
+
return chunkQGFKIAEM_js.safe(
|
|
218
218
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
219
219
|
);
|
|
220
220
|
}
|
|
221
221
|
async skipNextRenewal(id, opts) {
|
|
222
222
|
const encodedId = encodeURIComponent(id);
|
|
223
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
224
|
-
return
|
|
223
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
224
|
+
return chunkQGFKIAEM_js.safe(
|
|
225
225
|
this.client.post(
|
|
226
226
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
227
227
|
void 0,
|
|
@@ -237,8 +237,8 @@ var UploadService = class {
|
|
|
237
237
|
this.client = client;
|
|
238
238
|
}
|
|
239
239
|
async init(filename, contentType, sizeBytes, opts) {
|
|
240
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
241
|
-
return
|
|
240
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
241
|
+
return chunkQGFKIAEM_js.safe(
|
|
242
242
|
this.client.post(
|
|
243
243
|
"/api/v1/uploads/init",
|
|
244
244
|
{
|
|
@@ -251,7 +251,7 @@ var UploadService = class {
|
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
async confirm(uploadId) {
|
|
254
|
-
return
|
|
254
|
+
return chunkQGFKIAEM_js.safe(
|
|
255
255
|
this.client.post("/api/v1/uploads/confirm", {
|
|
256
256
|
upload_id: uploadId
|
|
257
257
|
})
|
|
@@ -270,7 +270,7 @@ var UploadService = class {
|
|
|
270
270
|
if (!uploadResponse.ok) {
|
|
271
271
|
return {
|
|
272
272
|
ok: false,
|
|
273
|
-
error: new
|
|
273
|
+
error: new chunkNIOUSKQQ_js.CimplifyError(
|
|
274
274
|
"UPLOAD_FAILED",
|
|
275
275
|
`Upload failed with status ${uploadResponse.status}`,
|
|
276
276
|
true
|
|
@@ -280,7 +280,7 @@ var UploadService = class {
|
|
|
280
280
|
} catch (error) {
|
|
281
281
|
return {
|
|
282
282
|
ok: false,
|
|
283
|
-
error: new
|
|
283
|
+
error: new chunkNIOUSKQQ_js.CimplifyError(
|
|
284
284
|
"UPLOAD_FAILED",
|
|
285
285
|
error instanceof Error ? error.message : "Upload failed",
|
|
286
286
|
true
|
|
@@ -297,7 +297,7 @@ var PlacesService = class {
|
|
|
297
297
|
this.client = client;
|
|
298
298
|
}
|
|
299
299
|
async autocomplete(input, sessionToken) {
|
|
300
|
-
return
|
|
300
|
+
return chunkQGFKIAEM_js.safe(
|
|
301
301
|
this.client.post("/api/v1/places/autocomplete", {
|
|
302
302
|
input,
|
|
303
303
|
sessionToken
|
|
@@ -305,7 +305,7 @@ var PlacesService = class {
|
|
|
305
305
|
);
|
|
306
306
|
}
|
|
307
307
|
async details(placeId, sessionToken) {
|
|
308
|
-
return
|
|
308
|
+
return chunkQGFKIAEM_js.safe(
|
|
309
309
|
this.client.post("/api/v1/places/details", {
|
|
310
310
|
place_id: placeId,
|
|
311
311
|
sessionToken
|
|
@@ -324,7 +324,7 @@ var DeliveryService = class {
|
|
|
324
324
|
params.set("dropoff_lat", String(dropoffLat));
|
|
325
325
|
params.set("dropoff_lng", String(dropoffLng));
|
|
326
326
|
if (country) params.set("country", country);
|
|
327
|
-
return
|
|
327
|
+
return chunkQGFKIAEM_js.safe(
|
|
328
328
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
329
329
|
);
|
|
330
330
|
}
|
|
@@ -336,7 +336,7 @@ var DeliveryService = class {
|
|
|
336
336
|
params.set("dropoff_lng", String(dropoffLng));
|
|
337
337
|
if (opts?.country) params.set("country", opts.country);
|
|
338
338
|
if (opts?.orderValue != null) params.set("order_value", String(opts.orderValue));
|
|
339
|
-
return
|
|
339
|
+
return chunkQGFKIAEM_js.safe(
|
|
340
340
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
341
341
|
);
|
|
342
342
|
}
|
|
@@ -413,7 +413,7 @@ var SupportService = class {
|
|
|
413
413
|
async claimConversation() {
|
|
414
414
|
const accessToken = this.client.getAccessToken();
|
|
415
415
|
if (!accessToken) {
|
|
416
|
-
return
|
|
416
|
+
return chunkQGFKIAEM_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
417
417
|
}
|
|
418
418
|
if (this.claimInFlight) {
|
|
419
419
|
if (this.claimInFlightToken === accessToken) return this.claimInFlight;
|
|
@@ -421,12 +421,12 @@ var SupportService = class {
|
|
|
421
421
|
return this.claimConversation();
|
|
422
422
|
}
|
|
423
423
|
if (this.lastClaimedAccessToken === accessToken) {
|
|
424
|
-
return
|
|
424
|
+
return chunkQGFKIAEM_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
425
425
|
}
|
|
426
426
|
const epoch = this.client.getSessionEpoch();
|
|
427
427
|
this.claimInFlightToken = accessToken;
|
|
428
428
|
this.claimInFlight = (async () => {
|
|
429
|
-
const result = await
|
|
429
|
+
const result = await chunkQGFKIAEM_js.safe(
|
|
430
430
|
this.client.post(
|
|
431
431
|
"/api/v1/support/conversation/claim",
|
|
432
432
|
{ access_token: accessToken },
|
|
@@ -435,8 +435,8 @@ var SupportService = class {
|
|
|
435
435
|
);
|
|
436
436
|
if (result.ok) {
|
|
437
437
|
if (this.client.getSessionEpoch() !== epoch) {
|
|
438
|
-
return
|
|
439
|
-
new
|
|
438
|
+
return chunkQGFKIAEM_js.err(
|
|
439
|
+
new chunkNIOUSKQQ_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
440
440
|
);
|
|
441
441
|
}
|
|
442
442
|
this.lastClaimedAccessToken = accessToken;
|
|
@@ -464,20 +464,20 @@ var SupportService = class {
|
|
|
464
464
|
* the inbox with empty threads.
|
|
465
465
|
*/
|
|
466
466
|
async peekConversation() {
|
|
467
|
-
const result = await
|
|
467
|
+
const result = await chunkQGFKIAEM_js.safe(
|
|
468
468
|
this.client.get("/api/v1/support/conversation")
|
|
469
469
|
);
|
|
470
470
|
if (!result.ok) return result;
|
|
471
|
-
if (!result.value.conversation) return
|
|
472
|
-
return
|
|
471
|
+
if (!result.value.conversation) return chunkQGFKIAEM_js.ok(null);
|
|
472
|
+
return chunkQGFKIAEM_js.ok({
|
|
473
473
|
conversation: result.value.conversation,
|
|
474
474
|
messages: result.value.messages
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
/** Open (or resume) the customer's widget conversation. */
|
|
478
478
|
async openConversation(opts) {
|
|
479
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
480
|
-
return
|
|
479
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
480
|
+
return chunkQGFKIAEM_js.safe(
|
|
481
481
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
482
482
|
idempotencyKey
|
|
483
483
|
})
|
|
@@ -492,8 +492,8 @@ var SupportService = class {
|
|
|
492
492
|
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
493
493
|
*/
|
|
494
494
|
async sendMessage(content, opts) {
|
|
495
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
496
|
-
return
|
|
495
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
496
|
+
return chunkQGFKIAEM_js.safe(
|
|
497
497
|
this.client.post(
|
|
498
498
|
"/api/v1/support/conversation/messages",
|
|
499
499
|
{
|
|
@@ -517,11 +517,11 @@ var SupportService = class {
|
|
|
517
517
|
if (options.limit) params.set("limit", String(options.limit));
|
|
518
518
|
const query = params.toString();
|
|
519
519
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
520
|
-
return
|
|
520
|
+
return chunkQGFKIAEM_js.safe(this.client.get(path));
|
|
521
521
|
}
|
|
522
522
|
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
523
523
|
async reactToMessage(messageId, emoji) {
|
|
524
|
-
return
|
|
524
|
+
return chunkQGFKIAEM_js.safe(
|
|
525
525
|
this.client.post(
|
|
526
526
|
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
527
527
|
{ emoji }
|
|
@@ -530,8 +530,8 @@ var SupportService = class {
|
|
|
530
530
|
}
|
|
531
531
|
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
532
532
|
async requestHuman(opts) {
|
|
533
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
534
|
-
return
|
|
533
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkQGFKIAEM_js.generateIdempotencyKey();
|
|
534
|
+
return chunkQGFKIAEM_js.safe(
|
|
535
535
|
this.client.post(
|
|
536
536
|
"/api/v1/support/conversation/handoff",
|
|
537
537
|
void 0,
|
|
@@ -591,16 +591,16 @@ function isRetryable(error) {
|
|
|
591
591
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
592
592
|
return true;
|
|
593
593
|
}
|
|
594
|
-
if (error instanceof
|
|
594
|
+
if (error instanceof chunkNIOUSKQQ_js.CimplifyError) {
|
|
595
595
|
return error.retryable;
|
|
596
596
|
}
|
|
597
597
|
return false;
|
|
598
598
|
}
|
|
599
599
|
function toNetworkError(error, isTestMode) {
|
|
600
600
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
601
|
-
return
|
|
602
|
-
new
|
|
603
|
-
|
|
601
|
+
return chunkNIOUSKQQ_js.enrichError(
|
|
602
|
+
new chunkNIOUSKQQ_js.CimplifyError(
|
|
603
|
+
chunkNIOUSKQQ_js.ErrorCode.TIMEOUT,
|
|
604
604
|
"Request timed out. Please check your connection and try again.",
|
|
605
605
|
true
|
|
606
606
|
),
|
|
@@ -608,21 +608,21 @@ function toNetworkError(error, isTestMode) {
|
|
|
608
608
|
);
|
|
609
609
|
}
|
|
610
610
|
if (error instanceof TypeError && error.message.includes("fetch")) {
|
|
611
|
-
return
|
|
612
|
-
new
|
|
613
|
-
|
|
611
|
+
return chunkNIOUSKQQ_js.enrichError(
|
|
612
|
+
new chunkNIOUSKQQ_js.CimplifyError(
|
|
613
|
+
chunkNIOUSKQQ_js.ErrorCode.NETWORK_ERROR,
|
|
614
614
|
"Network error. Please check your internet connection.",
|
|
615
615
|
true
|
|
616
616
|
),
|
|
617
617
|
{ isTestMode }
|
|
618
618
|
);
|
|
619
619
|
}
|
|
620
|
-
if (error instanceof
|
|
621
|
-
return
|
|
620
|
+
if (error instanceof chunkNIOUSKQQ_js.CimplifyError) {
|
|
621
|
+
return chunkNIOUSKQQ_js.enrichError(error, { isTestMode });
|
|
622
622
|
}
|
|
623
|
-
return
|
|
624
|
-
new
|
|
625
|
-
|
|
623
|
+
return chunkNIOUSKQQ_js.enrichError(
|
|
624
|
+
new chunkNIOUSKQQ_js.CimplifyError(
|
|
625
|
+
chunkNIOUSKQQ_js.ErrorCode.UNKNOWN_ERROR,
|
|
626
626
|
error instanceof Error ? error.message : "An unknown error occurred",
|
|
627
627
|
false
|
|
628
628
|
),
|
|
@@ -726,6 +726,9 @@ var CimplifyClient = class {
|
|
|
726
726
|
setAccessToken(token) {
|
|
727
727
|
const previous = this.accessToken;
|
|
728
728
|
this.accessToken = token;
|
|
729
|
+
if (previous !== token) {
|
|
730
|
+
this.sessionEpoch++;
|
|
731
|
+
}
|
|
729
732
|
this.hooks.onSessionChange?.({
|
|
730
733
|
previousToken: previous,
|
|
731
734
|
newToken: token,
|
|
@@ -752,6 +755,7 @@ var CimplifyClient = class {
|
|
|
752
755
|
adoptSessionToken(token) {
|
|
753
756
|
if (!token || token === this.sessionToken) return;
|
|
754
757
|
this.sessionToken = token;
|
|
758
|
+
this.sessionEpoch++;
|
|
755
759
|
this.saveSessionToken(token);
|
|
756
760
|
}
|
|
757
761
|
clearSession() {
|
|
@@ -808,6 +812,7 @@ var CimplifyClient = class {
|
|
|
808
812
|
if (!payload?.token || payload.token === this.sessionToken) return;
|
|
809
813
|
if (payload.type === "claimed") {
|
|
810
814
|
this.sessionToken = payload.token;
|
|
815
|
+
this.sessionEpoch++;
|
|
811
816
|
this.events.emit(SESSION_CLAIMED, {
|
|
812
817
|
sessionToken: payload.token,
|
|
813
818
|
threadId: null,
|
|
@@ -901,8 +906,8 @@ var CimplifyClient = class {
|
|
|
901
906
|
this.businessIdResolvePromise = (async () => {
|
|
902
907
|
const result = await this.business.getInfo();
|
|
903
908
|
if (!result.ok || !result.value?.id) {
|
|
904
|
-
throw new
|
|
905
|
-
|
|
909
|
+
throw new chunkNIOUSKQQ_js.CimplifyError(
|
|
910
|
+
chunkNIOUSKQQ_js.ErrorCode.NOT_FOUND,
|
|
906
911
|
"Unable to resolve business ID from the current public key.",
|
|
907
912
|
true
|
|
908
913
|
);
|
|
@@ -1042,7 +1047,7 @@ var CimplifyClient = class {
|
|
|
1042
1047
|
if (response.status >= 400 && response.status < 500) {
|
|
1043
1048
|
this.hooks.onRequestError?.({
|
|
1044
1049
|
...context,
|
|
1045
|
-
error: new
|
|
1050
|
+
error: new chunkNIOUSKQQ_js.CimplifyError(
|
|
1046
1051
|
`HTTP_${response.status}`,
|
|
1047
1052
|
`Request failed with status ${response.status}`,
|
|
1048
1053
|
false
|
|
@@ -1068,7 +1073,7 @@ var CimplifyClient = class {
|
|
|
1068
1073
|
}
|
|
1069
1074
|
this.hooks.onRequestError?.({
|
|
1070
1075
|
...context,
|
|
1071
|
-
error: new
|
|
1076
|
+
error: new chunkNIOUSKQQ_js.CimplifyError(
|
|
1072
1077
|
"SERVER_ERROR",
|
|
1073
1078
|
`Server error ${response.status} after ${retryCount} retries`,
|
|
1074
1079
|
false
|
|
@@ -1220,12 +1225,12 @@ var CimplifyClient = class {
|
|
|
1220
1225
|
const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
|
|
1221
1226
|
if (errorCode === "IDEMPOTENCY_MISMATCH") {
|
|
1222
1227
|
const originalCreatedAt = typeof json.error === "object" && json.error?.original_created_at || "";
|
|
1223
|
-
throw new
|
|
1228
|
+
throw new chunkNIOUSKQQ_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
|
|
1224
1229
|
}
|
|
1225
|
-
const error =
|
|
1230
|
+
const error = chunkNIOUSKQQ_js.enrichError(new chunkNIOUSKQQ_js.CimplifyError(errorCode, errorMessage, retryable), {
|
|
1226
1231
|
isTestMode: this.isTestMode()
|
|
1227
1232
|
});
|
|
1228
|
-
if ((response.status === 401 || error.code ===
|
|
1233
|
+
if ((response.status === 401 || error.code === chunkNIOUSKQQ_js.ErrorCode.UNAUTHORIZED) && this.accessToken) {
|
|
1229
1234
|
console.warn(
|
|
1230
1235
|
"[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
|
|
1231
1236
|
);
|
|
@@ -1233,8 +1238,8 @@ var CimplifyClient = class {
|
|
|
1233
1238
|
throw error;
|
|
1234
1239
|
}
|
|
1235
1240
|
if (json?.success === false || json?.error?.code || json?.error?.message) {
|
|
1236
|
-
const error =
|
|
1237
|
-
new
|
|
1241
|
+
const error = chunkNIOUSKQQ_js.enrichError(
|
|
1242
|
+
new chunkNIOUSKQQ_js.CimplifyError(
|
|
1238
1243
|
json.error?.code || "API_ERROR",
|
|
1239
1244
|
json.error?.message || "An error occurred",
|
|
1240
1245
|
json.error?.retryable || false
|
|
@@ -1250,25 +1255,25 @@ var CimplifyClient = class {
|
|
|
1250
1255
|
}
|
|
1251
1256
|
get catalogue() {
|
|
1252
1257
|
if (!this._catalogue) {
|
|
1253
|
-
this._catalogue = new
|
|
1258
|
+
this._catalogue = new chunkQGFKIAEM_js.CatalogueQueries(this);
|
|
1254
1259
|
}
|
|
1255
1260
|
return this._catalogue;
|
|
1256
1261
|
}
|
|
1257
1262
|
get cart() {
|
|
1258
1263
|
if (!this._cart) {
|
|
1259
|
-
this._cart = new
|
|
1264
|
+
this._cart = new chunkQGFKIAEM_js.CartOperations(this);
|
|
1260
1265
|
}
|
|
1261
1266
|
return this._cart;
|
|
1262
1267
|
}
|
|
1263
1268
|
get checkout() {
|
|
1264
1269
|
if (!this._checkout) {
|
|
1265
|
-
this._checkout = new
|
|
1270
|
+
this._checkout = new chunkQGFKIAEM_js.CheckoutService(this);
|
|
1266
1271
|
}
|
|
1267
1272
|
return this._checkout;
|
|
1268
1273
|
}
|
|
1269
1274
|
get orders() {
|
|
1270
1275
|
if (!this._orders) {
|
|
1271
|
-
this._orders = new
|
|
1276
|
+
this._orders = new chunkQGFKIAEM_js.OrderQueries(this);
|
|
1272
1277
|
}
|
|
1273
1278
|
return this._orders;
|
|
1274
1279
|
}
|
|
@@ -1298,43 +1303,43 @@ var CimplifyClient = class {
|
|
|
1298
1303
|
}
|
|
1299
1304
|
get link() {
|
|
1300
1305
|
if (!this._link) {
|
|
1301
|
-
this._link = new
|
|
1306
|
+
this._link = new chunkQGFKIAEM_js.LinkService(this);
|
|
1302
1307
|
}
|
|
1303
1308
|
return this._link;
|
|
1304
1309
|
}
|
|
1305
1310
|
get auth() {
|
|
1306
1311
|
if (!this._auth) {
|
|
1307
|
-
this._auth = new
|
|
1312
|
+
this._auth = new chunkQGFKIAEM_js.AuthService(this);
|
|
1308
1313
|
}
|
|
1309
1314
|
return this._auth;
|
|
1310
1315
|
}
|
|
1311
1316
|
get business() {
|
|
1312
1317
|
if (!this._business) {
|
|
1313
|
-
this._business = new
|
|
1318
|
+
this._business = new chunkQGFKIAEM_js.BusinessService(this);
|
|
1314
1319
|
}
|
|
1315
1320
|
return this._business;
|
|
1316
1321
|
}
|
|
1317
1322
|
get inventory() {
|
|
1318
1323
|
if (!this._inventory) {
|
|
1319
|
-
this._inventory = new
|
|
1324
|
+
this._inventory = new chunkQGFKIAEM_js.InventoryService(this);
|
|
1320
1325
|
}
|
|
1321
1326
|
return this._inventory;
|
|
1322
1327
|
}
|
|
1323
1328
|
get scheduling() {
|
|
1324
1329
|
if (!this._scheduling) {
|
|
1325
|
-
this._scheduling = new
|
|
1330
|
+
this._scheduling = new chunkQGFKIAEM_js.SchedulingService(this);
|
|
1326
1331
|
}
|
|
1327
1332
|
return this._scheduling;
|
|
1328
1333
|
}
|
|
1329
1334
|
get lite() {
|
|
1330
1335
|
if (!this._lite) {
|
|
1331
|
-
this._lite = new
|
|
1336
|
+
this._lite = new chunkQGFKIAEM_js.LiteService(this);
|
|
1332
1337
|
}
|
|
1333
1338
|
return this._lite;
|
|
1334
1339
|
}
|
|
1335
1340
|
get fx() {
|
|
1336
1341
|
if (!this._fx) {
|
|
1337
|
-
this._fx = new
|
|
1342
|
+
this._fx = new chunkQGFKIAEM_js.FxService(this);
|
|
1338
1343
|
}
|
|
1339
1344
|
return this._fx;
|
|
1340
1345
|
}
|
|
@@ -1369,13 +1374,14 @@ var CimplifyClient = class {
|
|
|
1369
1374
|
if (businessId) {
|
|
1370
1375
|
this.setBusinessId(businessId);
|
|
1371
1376
|
}
|
|
1372
|
-
return
|
|
1377
|
+
return chunkQGFKIAEM_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1373
1378
|
}
|
|
1374
1379
|
};
|
|
1375
1380
|
function createCimplifyClient(config = {}) {
|
|
1376
1381
|
return new CimplifyClient(config);
|
|
1377
1382
|
}
|
|
1378
1383
|
|
|
1384
|
+
exports.AUTH_TOKEN_CHANGED = AUTH_TOKEN_CHANGED;
|
|
1379
1385
|
exports.ActivityService = ActivityService;
|
|
1380
1386
|
exports.CimplifyClient = CimplifyClient;
|
|
1381
1387
|
exports.DeliveryService = DeliveryService;
|