@cimplify/sdk 0.100.1 → 0.100.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-QGFKIAEM.js → chunk-6JEKKL3M.js} +5 -0
- package/dist/{chunk-NKZIXLKW.mjs → chunk-B2YOCOLH.mjs} +1 -1
- package/dist/{chunk-NH3HYUC3.js → chunk-IFAQLFAJ.js} +1 -1
- package/dist/{chunk-BHQCSHIG.js → chunk-IJI7KMTG.js} +58 -57
- package/dist/{chunk-T2B656RS.mjs → chunk-PJUXAUM2.mjs} +13 -12
- package/dist/{chunk-NR4Z2SFY.js → chunk-QRBBSIAY.js} +4 -4
- package/dist/{chunk-PTKAN4SI.mjs → chunk-TIQLOH2B.mjs} +5 -0
- package/dist/{chunk-KEC2CX4R.mjs → chunk-YWNJJO2U.mjs} +2 -2
- package/dist/{client-T5c-Nxq-.d.mts → client-C6wb92AD.d.mts} +2 -2
- package/dist/{client-DRgEa78P.d.ts → client-CgXkRu2o.d.ts} +2 -2
- package/dist/{client-B0Lku_lc.d.mts → client-D8XcrONA.d.mts} +23 -12
- package/dist/{client-DxgC_lXU.d.ts → client-LPg_AUUr.d.ts} +23 -12
- package/dist/{index-CzKN1hjf.d.ts → index-B_RYmvlF.d.ts} +3 -3
- package/dist/{index-DzuLT5wi.d.mts → index-D-LUYk1Y.d.mts} +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +69 -69
- package/dist/index.mjs +3 -3
- package/dist/mock/cli.mjs +1 -1
- package/dist/mock/library.js +1 -1
- package/dist/mock/library.mjs +1 -1
- package/dist/mock/msw.js +1 -1
- package/dist/mock/msw.mjs +1 -1
- package/dist/{payment-D8NEwCna.d.mts → payment-BSzy7sly.d.mts} +1 -1
- package/dist/{payment-lZBP7h5M.d.ts → payment-jK8ztICx.d.ts} +1 -1
- package/dist/{price-ncQb-TC8.d.ts → price-CJLfcYKd.d.ts} +1 -1
- package/dist/{price-DepWAmcL.d.mts → price-D96h6c6L.d.mts} +1 -1
- package/dist/{product-B384_Qm2.d.mts → product-CeV8euw4.d.mts} +11 -10
- package/dist/{product-B384_Qm2.d.ts → product-CeV8euw4.d.ts} +11 -10
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +51 -29
- package/dist/react.mjs +28 -6
- package/dist/{server-oCGNIO_K.d.mts → server--RyVAfPN.d.mts} +1 -1
- package/dist/{server-B7O4ttpv.d.ts → server-CNyy47HL.d.ts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +23 -23
- package/dist/testing/suite.mjs +4 -4
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +79 -79
- package/dist/testing.mjs +5 -5
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.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,
|
|
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, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-D8XcrONA.mjs';
|
|
2
|
+
import './product-CeV8euw4.mjs';
|
|
3
|
+
import './payment-BSzy7sly.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,
|
|
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, aL as ELEMENT_TYPES, aM as EVENT_TYPES, aP as ElementEventType, aQ as ElementOptions, aR as ElementType, aZ as ElementsOptions, b5 as FetchQuoteInput, be as FxService, bi as GetProductsOptions, bl as InventoryService, bt as LinkService, bz as LiteService, bG as MESSAGE_TYPES, c6 as OrderQueries, cs as PriceQuote, cy as QuoteBundleSelectionInput, cz as QuoteCompositeSelectionInput, cA as QuoteDynamicBuckets, cB as QuoteStatus, cC as QuoteUiMessage, cE as RefreshQuoteInput, cF as RefreshQuoteResult, d5 as SchedulingService, dL as createElements } from './client-LPg_AUUr.js';
|
|
2
|
+
import './product-CeV8euw4.js';
|
|
3
|
+
import './payment-jK8ztICx.js';
|
|
4
4
|
|
|
5
5
|
declare function generateIdempotencyKey(prefix?: string): string;
|
|
6
6
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6JEKKL3M_js = require('./chunk-6JEKKL3M.js');
|
|
4
4
|
require('./chunk-WMEC5JWN.js');
|
|
5
5
|
require('./chunk-NIOUSKQQ.js');
|
|
6
6
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -9,77 +9,77 @@ require('./chunk-OWW5GUSB.js');
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "AuthService", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk6JEKKL3M_js.AuthService; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "BusinessService", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk6JEKKL3M_js.BusinessService; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "CartOperations", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunk6JEKKL3M_js.CartOperations; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunk6JEKKL3M_js.CatalogueQueries; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunk6JEKKL3M_js.CheckoutService; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "CheckoutService", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunk6JEKKL3M_js.CheckoutService; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunk6JEKKL3M_js.CimplifyElement; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunk6JEKKL3M_js.CimplifyElements; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunk6JEKKL3M_js.ELEMENT_TYPES; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunk6JEKKL3M_js.EVENT_TYPES; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "FxService", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunk6JEKKL3M_js.FxService; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "InventoryService", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunk6JEKKL3M_js.InventoryService; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "LinkService", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunk6JEKKL3M_js.LinkService; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "LiteService", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunk6JEKKL3M_js.LiteService; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunk6JEKKL3M_js.MESSAGE_TYPES; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "OrderQueries", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunk6JEKKL3M_js.OrderQueries; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "SchedulingService", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunk6JEKKL3M_js.SchedulingService; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "createElements", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunk6JEKKL3M_js.createElements; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunk6JEKKL3M_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-
|
|
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-TIQLOH2B.mjs';
|
|
2
2
|
import './chunk-DLW3RWRK.mjs';
|
|
3
3
|
import './chunk-O3YUHLZL.mjs';
|
|
4
4
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -2779,6 +2779,7 @@ var KNOWN_IFRAME_TYPES = /* @__PURE__ */ new Set([
|
|
|
2779
2779
|
MESSAGE_TYPES.READY,
|
|
2780
2780
|
MESSAGE_TYPES.HEIGHT_CHANGE,
|
|
2781
2781
|
MESSAGE_TYPES.AUTH_REQUESTED,
|
|
2782
|
+
MESSAGE_TYPES.SESSION_ESTABLISHED,
|
|
2782
2783
|
MESSAGE_TYPES.ERROR,
|
|
2783
2784
|
MESSAGE_TYPES.ADDRESS_CHANGED,
|
|
2784
2785
|
MESSAGE_TYPES.ADDRESS_SELECTED,
|
|
@@ -2811,6 +2812,10 @@ function parseIframeMessage(data) {
|
|
|
2811
2812
|
return null;
|
|
2812
2813
|
}
|
|
2813
2814
|
break;
|
|
2815
|
+
case MESSAGE_TYPES.SESSION_ESTABLISHED:
|
|
2816
|
+
if (typeof record.accessToken !== "string" || !record.accessToken.trim()) return null;
|
|
2817
|
+
if (record.refreshToken !== void 0 && typeof record.refreshToken !== "string") return null;
|
|
2818
|
+
break;
|
|
2814
2819
|
case MESSAGE_TYPES.ADDRESS_CHANGED:
|
|
2815
2820
|
case MESSAGE_TYPES.ADDRESS_SELECTED:
|
|
2816
2821
|
if (!record.address || typeof record.address !== "object") return null;
|
|
@@ -4609,7 +4609,7 @@ function toUICart(registry, cart) {
|
|
|
4609
4609
|
is_available: product?.is_available ?? true,
|
|
4610
4610
|
base_price: i.price,
|
|
4611
4611
|
add_ons_price: i.add_ons_price,
|
|
4612
|
-
total_price:
|
|
4612
|
+
total_price: add(i.price, i.add_ons_price),
|
|
4613
4613
|
item_discount_amount: i.item_discount_amount,
|
|
4614
4614
|
price_info: defaultChosenPrice(i.price),
|
|
4615
4615
|
add_on_option_ids: cfg.add_ons?.selected_options.map((o) => o.option_id) ?? [],
|
|
@@ -4611,7 +4611,7 @@ function toUICart(registry, cart) {
|
|
|
4611
4611
|
is_available: product?.is_available ?? true,
|
|
4612
4612
|
base_price: i.price,
|
|
4613
4613
|
add_ons_price: i.add_ons_price,
|
|
4614
|
-
total_price:
|
|
4614
|
+
total_price: add(i.price, i.add_ons_price),
|
|
4615
4615
|
item_discount_amount: i.item_discount_amount,
|
|
4616
4616
|
price_info: defaultChosenPrice(i.price),
|
|
4617
4617
|
add_on_option_ids: cfg.add_ons?.selected_options.map((o) => o.option_id) ?? [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6JEKKL3M_js = require('./chunk-6JEKKL3M.js');
|
|
4
4
|
var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
|
|
5
5
|
|
|
6
6
|
// src/store-credit.ts
|
|
@@ -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 chunk6JEKKL3M_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 chunk6JEKKL3M_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 chunk6JEKKL3M_js.safe(this.client.get(path));
|
|
117
117
|
}
|
|
118
118
|
async dismissMessage(code) {
|
|
119
|
-
return
|
|
119
|
+
return chunk6JEKKL3M_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 chunk6JEKKL3M_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 chunk6JEKKL3M_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 ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
201
|
+
return chunk6JEKKL3M_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 chunk6JEKKL3M_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 chunk6JEKKL3M_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 ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
224
|
+
return chunk6JEKKL3M_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 ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
241
|
+
return chunk6JEKKL3M_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 chunk6JEKKL3M_js.safe(
|
|
255
255
|
this.client.post("/api/v1/uploads/confirm", {
|
|
256
256
|
upload_id: uploadId
|
|
257
257
|
})
|
|
@@ -297,7 +297,7 @@ var PlacesService = class {
|
|
|
297
297
|
this.client = client;
|
|
298
298
|
}
|
|
299
299
|
async autocomplete(input, sessionToken) {
|
|
300
|
-
return
|
|
300
|
+
return chunk6JEKKL3M_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 chunk6JEKKL3M_js.safe(
|
|
309
309
|
this.client.post("/api/v1/places/details", {
|
|
310
310
|
place_id: placeId,
|
|
311
311
|
sessionToken
|
|
@@ -324,19 +324,20 @@ 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
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
327
|
+
return chunk6JEKKL3M_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
328
|
+
}
|
|
329
|
+
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
330
|
+
const query = typeof queryOrLatitude === "number" ? {
|
|
331
|
+
...legacyOptions,
|
|
332
|
+
dropoffLat: queryOrLatitude,
|
|
333
|
+
dropoffLng: longitude
|
|
334
|
+
} : queryOrLatitude ?? {};
|
|
334
335
|
const params = new URLSearchParams();
|
|
335
|
-
params.set("dropoff_lat", String(dropoffLat));
|
|
336
|
-
params.set("dropoff_lng", String(dropoffLng));
|
|
337
|
-
if (
|
|
338
|
-
if (
|
|
339
|
-
return
|
|
336
|
+
if (query.dropoffLat != null) params.set("dropoff_lat", String(query.dropoffLat));
|
|
337
|
+
if (query.dropoffLng != null) params.set("dropoff_lng", String(query.dropoffLng));
|
|
338
|
+
if (query.country) params.set("country", query.country);
|
|
339
|
+
if (query.orderValue != null) params.set("order_value", String(query.orderValue));
|
|
340
|
+
return chunk6JEKKL3M_js.safe(
|
|
340
341
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
341
342
|
);
|
|
342
343
|
}
|
|
@@ -413,7 +414,7 @@ var SupportService = class {
|
|
|
413
414
|
async claimConversation() {
|
|
414
415
|
const accessToken = this.client.getAccessToken();
|
|
415
416
|
if (!accessToken) {
|
|
416
|
-
return
|
|
417
|
+
return chunk6JEKKL3M_js.err(new chunkNIOUSKQQ_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
417
418
|
}
|
|
418
419
|
if (this.claimInFlight) {
|
|
419
420
|
if (this.claimInFlightToken === accessToken) return this.claimInFlight;
|
|
@@ -421,12 +422,12 @@ var SupportService = class {
|
|
|
421
422
|
return this.claimConversation();
|
|
422
423
|
}
|
|
423
424
|
if (this.lastClaimedAccessToken === accessToken) {
|
|
424
|
-
return
|
|
425
|
+
return chunk6JEKKL3M_js.err(new chunkNIOUSKQQ_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
425
426
|
}
|
|
426
427
|
const epoch = this.client.getSessionEpoch();
|
|
427
428
|
this.claimInFlightToken = accessToken;
|
|
428
429
|
this.claimInFlight = (async () => {
|
|
429
|
-
const result = await
|
|
430
|
+
const result = await chunk6JEKKL3M_js.safe(
|
|
430
431
|
this.client.post(
|
|
431
432
|
"/api/v1/support/conversation/claim",
|
|
432
433
|
{ access_token: accessToken },
|
|
@@ -435,7 +436,7 @@ var SupportService = class {
|
|
|
435
436
|
);
|
|
436
437
|
if (result.ok) {
|
|
437
438
|
if (this.client.getSessionEpoch() !== epoch) {
|
|
438
|
-
return
|
|
439
|
+
return chunk6JEKKL3M_js.err(
|
|
439
440
|
new chunkNIOUSKQQ_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
440
441
|
);
|
|
441
442
|
}
|
|
@@ -464,20 +465,20 @@ var SupportService = class {
|
|
|
464
465
|
* the inbox with empty threads.
|
|
465
466
|
*/
|
|
466
467
|
async peekConversation() {
|
|
467
|
-
const result = await
|
|
468
|
+
const result = await chunk6JEKKL3M_js.safe(
|
|
468
469
|
this.client.get("/api/v1/support/conversation")
|
|
469
470
|
);
|
|
470
471
|
if (!result.ok) return result;
|
|
471
|
-
if (!result.value.conversation) return
|
|
472
|
-
return
|
|
472
|
+
if (!result.value.conversation) return chunk6JEKKL3M_js.ok(null);
|
|
473
|
+
return chunk6JEKKL3M_js.ok({
|
|
473
474
|
conversation: result.value.conversation,
|
|
474
475
|
messages: result.value.messages
|
|
475
476
|
});
|
|
476
477
|
}
|
|
477
478
|
/** Open (or resume) the customer's widget conversation. */
|
|
478
479
|
async openConversation(opts) {
|
|
479
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
480
|
-
return
|
|
480
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
481
|
+
return chunk6JEKKL3M_js.safe(
|
|
481
482
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
482
483
|
idempotencyKey
|
|
483
484
|
})
|
|
@@ -492,8 +493,8 @@ var SupportService = class {
|
|
|
492
493
|
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
493
494
|
*/
|
|
494
495
|
async sendMessage(content, opts) {
|
|
495
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
496
|
-
return
|
|
496
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
497
|
+
return chunk6JEKKL3M_js.safe(
|
|
497
498
|
this.client.post(
|
|
498
499
|
"/api/v1/support/conversation/messages",
|
|
499
500
|
{
|
|
@@ -517,11 +518,11 @@ var SupportService = class {
|
|
|
517
518
|
if (options.limit) params.set("limit", String(options.limit));
|
|
518
519
|
const query = params.toString();
|
|
519
520
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
520
|
-
return
|
|
521
|
+
return chunk6JEKKL3M_js.safe(this.client.get(path));
|
|
521
522
|
}
|
|
522
523
|
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
523
524
|
async reactToMessage(messageId, emoji) {
|
|
524
|
-
return
|
|
525
|
+
return chunk6JEKKL3M_js.safe(
|
|
525
526
|
this.client.post(
|
|
526
527
|
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
527
528
|
{ emoji }
|
|
@@ -530,8 +531,8 @@ var SupportService = class {
|
|
|
530
531
|
}
|
|
531
532
|
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
532
533
|
async requestHuman(opts) {
|
|
533
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
534
|
-
return
|
|
534
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunk6JEKKL3M_js.generateIdempotencyKey();
|
|
535
|
+
return chunk6JEKKL3M_js.safe(
|
|
535
536
|
this.client.post(
|
|
536
537
|
"/api/v1/support/conversation/handoff",
|
|
537
538
|
void 0,
|
|
@@ -1255,25 +1256,25 @@ var CimplifyClient = class {
|
|
|
1255
1256
|
}
|
|
1256
1257
|
get catalogue() {
|
|
1257
1258
|
if (!this._catalogue) {
|
|
1258
|
-
this._catalogue = new
|
|
1259
|
+
this._catalogue = new chunk6JEKKL3M_js.CatalogueQueries(this);
|
|
1259
1260
|
}
|
|
1260
1261
|
return this._catalogue;
|
|
1261
1262
|
}
|
|
1262
1263
|
get cart() {
|
|
1263
1264
|
if (!this._cart) {
|
|
1264
|
-
this._cart = new
|
|
1265
|
+
this._cart = new chunk6JEKKL3M_js.CartOperations(this);
|
|
1265
1266
|
}
|
|
1266
1267
|
return this._cart;
|
|
1267
1268
|
}
|
|
1268
1269
|
get checkout() {
|
|
1269
1270
|
if (!this._checkout) {
|
|
1270
|
-
this._checkout = new
|
|
1271
|
+
this._checkout = new chunk6JEKKL3M_js.CheckoutService(this);
|
|
1271
1272
|
}
|
|
1272
1273
|
return this._checkout;
|
|
1273
1274
|
}
|
|
1274
1275
|
get orders() {
|
|
1275
1276
|
if (!this._orders) {
|
|
1276
|
-
this._orders = new
|
|
1277
|
+
this._orders = new chunk6JEKKL3M_js.OrderQueries(this);
|
|
1277
1278
|
}
|
|
1278
1279
|
return this._orders;
|
|
1279
1280
|
}
|
|
@@ -1303,43 +1304,43 @@ var CimplifyClient = class {
|
|
|
1303
1304
|
}
|
|
1304
1305
|
get link() {
|
|
1305
1306
|
if (!this._link) {
|
|
1306
|
-
this._link = new
|
|
1307
|
+
this._link = new chunk6JEKKL3M_js.LinkService(this);
|
|
1307
1308
|
}
|
|
1308
1309
|
return this._link;
|
|
1309
1310
|
}
|
|
1310
1311
|
get auth() {
|
|
1311
1312
|
if (!this._auth) {
|
|
1312
|
-
this._auth = new
|
|
1313
|
+
this._auth = new chunk6JEKKL3M_js.AuthService(this);
|
|
1313
1314
|
}
|
|
1314
1315
|
return this._auth;
|
|
1315
1316
|
}
|
|
1316
1317
|
get business() {
|
|
1317
1318
|
if (!this._business) {
|
|
1318
|
-
this._business = new
|
|
1319
|
+
this._business = new chunk6JEKKL3M_js.BusinessService(this);
|
|
1319
1320
|
}
|
|
1320
1321
|
return this._business;
|
|
1321
1322
|
}
|
|
1322
1323
|
get inventory() {
|
|
1323
1324
|
if (!this._inventory) {
|
|
1324
|
-
this._inventory = new
|
|
1325
|
+
this._inventory = new chunk6JEKKL3M_js.InventoryService(this);
|
|
1325
1326
|
}
|
|
1326
1327
|
return this._inventory;
|
|
1327
1328
|
}
|
|
1328
1329
|
get scheduling() {
|
|
1329
1330
|
if (!this._scheduling) {
|
|
1330
|
-
this._scheduling = new
|
|
1331
|
+
this._scheduling = new chunk6JEKKL3M_js.SchedulingService(this);
|
|
1331
1332
|
}
|
|
1332
1333
|
return this._scheduling;
|
|
1333
1334
|
}
|
|
1334
1335
|
get lite() {
|
|
1335
1336
|
if (!this._lite) {
|
|
1336
|
-
this._lite = new
|
|
1337
|
+
this._lite = new chunk6JEKKL3M_js.LiteService(this);
|
|
1337
1338
|
}
|
|
1338
1339
|
return this._lite;
|
|
1339
1340
|
}
|
|
1340
1341
|
get fx() {
|
|
1341
1342
|
if (!this._fx) {
|
|
1342
|
-
this._fx = new
|
|
1343
|
+
this._fx = new chunk6JEKKL3M_js.FxService(this);
|
|
1343
1344
|
}
|
|
1344
1345
|
return this._fx;
|
|
1345
1346
|
}
|
|
@@ -1374,7 +1375,7 @@ var CimplifyClient = class {
|
|
|
1374
1375
|
if (businessId) {
|
|
1375
1376
|
this.setBusinessId(businessId);
|
|
1376
1377
|
}
|
|
1377
|
-
return
|
|
1378
|
+
return chunk6JEKKL3M_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1378
1379
|
}
|
|
1379
1380
|
};
|
|
1380
1381
|
function createCimplifyClient(config = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { safe, generateIdempotencyKey, err, ok, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-
|
|
1
|
+
import { safe, generateIdempotencyKey, err, ok, CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-TIQLOH2B.mjs';
|
|
2
2
|
import { CimplifyError, ErrorCode, IdempotencyMismatchError, enrichError } from './chunk-O3YUHLZL.mjs';
|
|
3
3
|
|
|
4
4
|
// src/store-credit.ts
|
|
@@ -322,18 +322,19 @@ var DeliveryService = class {
|
|
|
322
322
|
params.set("dropoff_lat", String(dropoffLat));
|
|
323
323
|
params.set("dropoff_lng", String(dropoffLng));
|
|
324
324
|
if (country) params.set("country", country);
|
|
325
|
-
return safe(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
325
|
+
return safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
326
|
+
}
|
|
327
|
+
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
328
|
+
const query = typeof queryOrLatitude === "number" ? {
|
|
329
|
+
...legacyOptions,
|
|
330
|
+
dropoffLat: queryOrLatitude,
|
|
331
|
+
dropoffLng: longitude
|
|
332
|
+
} : queryOrLatitude ?? {};
|
|
332
333
|
const params = new URLSearchParams();
|
|
333
|
-
params.set("dropoff_lat", String(dropoffLat));
|
|
334
|
-
params.set("dropoff_lng", String(dropoffLng));
|
|
335
|
-
if (
|
|
336
|
-
if (
|
|
334
|
+
if (query.dropoffLat != null) params.set("dropoff_lat", String(query.dropoffLat));
|
|
335
|
+
if (query.dropoffLng != null) params.set("dropoff_lng", String(query.dropoffLng));
|
|
336
|
+
if (query.country) params.set("country", query.country);
|
|
337
|
+
if (query.orderValue != null) params.set("order_value", String(query.orderValue));
|
|
337
338
|
return safe(
|
|
338
339
|
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
339
340
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkIFAQLFAJ_js = require('./chunk-IFAQLFAJ.js');
|
|
4
|
+
var chunkIJI7KMTG_js = require('./chunk-IJI7KMTG.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var cimplifyRegistry = zod.z.registry();
|
|
@@ -600,7 +600,7 @@ async function toForwardedRequest(input, init) {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
function createTestClient(options = {}) {
|
|
603
|
-
const mock =
|
|
603
|
+
const mock = chunkIFAQLFAJ_js.createMockApp(options);
|
|
604
604
|
let sessionToken;
|
|
605
605
|
const fetchImpl = async (input, init) => {
|
|
606
606
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -619,7 +619,7 @@ function createTestClient(options = {}) {
|
|
|
619
619
|
if (echoed) sessionToken = echoed;
|
|
620
620
|
return res;
|
|
621
621
|
};
|
|
622
|
-
const client =
|
|
622
|
+
const client = chunkIJI7KMTG_js.createCimplifyClient({
|
|
623
623
|
baseUrl: TEST_BASE_URL,
|
|
624
624
|
// Link mock lives at /v1/link on the same Hono app, so point the SDK's
|
|
625
625
|
// separate Link transport at the same TEST_BASE_URL.
|
|
@@ -2777,6 +2777,7 @@ var KNOWN_IFRAME_TYPES = /* @__PURE__ */ new Set([
|
|
|
2777
2777
|
MESSAGE_TYPES.READY,
|
|
2778
2778
|
MESSAGE_TYPES.HEIGHT_CHANGE,
|
|
2779
2779
|
MESSAGE_TYPES.AUTH_REQUESTED,
|
|
2780
|
+
MESSAGE_TYPES.SESSION_ESTABLISHED,
|
|
2780
2781
|
MESSAGE_TYPES.ERROR,
|
|
2781
2782
|
MESSAGE_TYPES.ADDRESS_CHANGED,
|
|
2782
2783
|
MESSAGE_TYPES.ADDRESS_SELECTED,
|
|
@@ -2809,6 +2810,10 @@ function parseIframeMessage(data) {
|
|
|
2809
2810
|
return null;
|
|
2810
2811
|
}
|
|
2811
2812
|
break;
|
|
2813
|
+
case MESSAGE_TYPES.SESSION_ESTABLISHED:
|
|
2814
|
+
if (typeof record.accessToken !== "string" || !record.accessToken.trim()) return null;
|
|
2815
|
+
if (record.refreshToken !== void 0 && typeof record.refreshToken !== "string") return null;
|
|
2816
|
+
break;
|
|
2812
2817
|
case MESSAGE_TYPES.ADDRESS_CHANGED:
|
|
2813
2818
|
case MESSAGE_TYPES.ADDRESS_SELECTED:
|
|
2814
2819
|
if (!record.address || typeof record.address !== "object") return null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createMockApp } from './chunk-
|
|
2
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createMockApp } from './chunk-B2YOCOLH.mjs';
|
|
2
|
+
import { createCimplifyClient } from './chunk-PJUXAUM2.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server
|
|
1
|
+
import { af as CimplifyClient } from './client-D8XcrONA.mjs';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server--RyVAfPN.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { af as CimplifyClient } from './client-
|
|
2
|
-
import { A as AppHandle, C as CreateAppOptions } from './server-
|
|
1
|
+
import { af as CimplifyClient } from './client-LPg_AUUr.js';
|
|
2
|
+
import { A as AppHandle, C as CreateAppOptions } from './server-CNyy47HL.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test client + fixtures.
|