@cimplify/sdk 0.50.1 → 0.51.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 +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-D22UVSFN.js → chunk-CAG3TEXO.js} +2 -2
- package/dist/{chunk-CYGLTD7D.js → chunk-FJQC4VSN.js} +54 -43
- package/dist/{chunk-OFNVLUH4.mjs → chunk-FXACV333.mjs} +56 -53
- package/dist/{chunk-MBR2DBEN.mjs → chunk-GUZXQSGI.mjs} +20 -9
- package/dist/{chunk-24FK7VFL.mjs → chunk-QCS6D4XW.mjs} +1 -1
- package/dist/{chunk-DR4UPU6P.js → chunk-VOWMB2KR.js} +56 -53
- package/dist/{client-B8tJnOde.d.ts → client-B6x53-Al.d.ts} +45 -27
- package/dist/{client-BqCAm5vI.d.mts → client-BbrCopIS.d.mts} +1 -1
- package/dist/{client-BdbvMtOU.d.ts → client-BvEjhvwq.d.ts} +1 -1
- package/dist/{client-BZZK1txR.d.mts → client-CF2pmEE9.d.mts} +45 -27
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -61
- package/dist/index.mjs +2 -2
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +16 -16
- package/dist/react.mjs +2 -2
- package/dist/server.d.mts +18 -10
- package/dist/server.d.ts +18 -10
- package/dist/server.js +4 -4
- package/dist/server.mjs +3 -3
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +22 -22
- package/dist/testing/suite.mjs +3 -3
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +78 -78
- package/dist/testing.mjs +4 -4
- package/package.json +1 -1
package/dist/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService,
|
|
1
|
+
export { A as AuthService, B as BusinessService, m as CartOperations, e as CatalogueQueries, o as CheckoutOperations, o as CheckoutService, a9 as CimplifyElement, a8 as CimplifyElements, ad as ELEMENT_TYPES, ac as EVENT_TYPES, ah as ElementEventType, af as ElementOptions, ag as ElementType, ae as ElementsOptions, F as FetchQuoteInput, u as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, t as LiteService, ab as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, i as QuoteDynamicBuckets, h as QuoteStatus, j as QuoteUiMessage, g as RefreshQuoteInput, l as RefreshQuoteResult, s as SchedulingService, aa as createElements } from './client-CF2pmEE9.mjs';
|
|
2
2
|
import './product-C-xLzh7Q.mjs';
|
|
3
3
|
import './payment-9L_-GWqQ.mjs';
|
|
4
4
|
|
package/dist/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthService, B as BusinessService,
|
|
1
|
+
export { A as AuthService, B as BusinessService, m as CartOperations, e as CatalogueQueries, o as CheckoutOperations, o as CheckoutService, a9 as CimplifyElement, a8 as CimplifyElements, ad as ELEMENT_TYPES, ac as EVENT_TYPES, ah as ElementEventType, af as ElementOptions, ag as ElementType, ae as ElementsOptions, F as FetchQuoteInput, u as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, t as LiteService, ab as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, f as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, i as QuoteDynamicBuckets, h as QuoteStatus, j as QuoteUiMessage, g as RefreshQuoteInput, l as RefreshQuoteResult, s as SchedulingService, aa as createElements } from './client-B6x53-Al.js';
|
|
2
2
|
import './product-C-xLzh7Q.js';
|
|
3
3
|
import './payment-_e99nSRj.js';
|
|
4
4
|
|
package/dist/advanced.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVOWMB2KR_js = require('./chunk-VOWMB2KR.js');
|
|
4
4
|
require('./chunk-6RP6OPYO.js');
|
|
5
5
|
require('./chunk-TKOTACKZ.js');
|
|
6
6
|
|
|
@@ -8,77 +8,77 @@ require('./chunk-TKOTACKZ.js');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "AuthService", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkVOWMB2KR_js.AuthService; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "BusinessService", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkVOWMB2KR_js.BusinessService; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "CartOperations", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkVOWMB2KR_js.CartOperations; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkVOWMB2KR_js.CatalogueQueries; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkVOWMB2KR_js.CheckoutService; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "CheckoutService", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkVOWMB2KR_js.CheckoutService; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkVOWMB2KR_js.CimplifyElement; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkVOWMB2KR_js.CimplifyElements; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkVOWMB2KR_js.ELEMENT_TYPES; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkVOWMB2KR_js.EVENT_TYPES; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "FxService", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkVOWMB2KR_js.FxService; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "InventoryService", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkVOWMB2KR_js.InventoryService; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "LinkService", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkVOWMB2KR_js.LinkService; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "LiteService", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkVOWMB2KR_js.LiteService; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkVOWMB2KR_js.MESSAGE_TYPES; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "OrderQueries", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkVOWMB2KR_js.OrderQueries; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "SchedulingService", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkVOWMB2KR_js.SchedulingService; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "createElements", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkVOWMB2KR_js.createElements; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkVOWMB2KR_js.generateIdempotencyKey; }
|
|
84
84
|
});
|
package/dist/advanced.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-FXACV333.mjs';
|
|
2
2
|
import './chunk-XY2DFX5K.mjs';
|
|
3
3
|
import './chunk-Z2AYLZDF.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFJQC4VSN_js = require('./chunk-FJQC4VSN.js');
|
|
4
4
|
var chunkGEWFWQYK_js = require('./chunk-GEWFWQYK.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
@@ -614,7 +614,7 @@ function createTestClient(options = {}) {
|
|
|
614
614
|
if (echoed) sessionToken = echoed;
|
|
615
615
|
return res;
|
|
616
616
|
};
|
|
617
|
-
const client =
|
|
617
|
+
const client = chunkFJQC4VSN_js.createCimplifyClient({
|
|
618
618
|
baseUrl: TEST_BASE_URL,
|
|
619
619
|
// Link mock lives at /v1/link on the same Hono app, so point the SDK's
|
|
620
620
|
// separate Link transport at the same TEST_BASE_URL.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkVOWMB2KR_js = require('./chunk-VOWMB2KR.js');
|
|
4
4
|
var chunkTKOTACKZ_js = require('./chunk-TKOTACKZ.js');
|
|
5
5
|
|
|
6
6
|
// src/activity.ts
|
|
@@ -29,7 +29,7 @@ var ActivityService = class {
|
|
|
29
29
|
this.sendEvents([event]);
|
|
30
30
|
}
|
|
31
31
|
async getState() {
|
|
32
|
-
return
|
|
32
|
+
return chunkVOWMB2KR_js.safe(this.client.get("/api/v1/activity/state"));
|
|
33
33
|
}
|
|
34
34
|
async getRecommendations(options) {
|
|
35
35
|
const params = new URLSearchParams();
|
|
@@ -37,10 +37,10 @@ var ActivityService = class {
|
|
|
37
37
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
38
38
|
const query = params.toString();
|
|
39
39
|
const path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
40
|
-
return
|
|
40
|
+
return chunkVOWMB2KR_js.safe(this.client.get(path));
|
|
41
41
|
}
|
|
42
42
|
async dismissMessage(code) {
|
|
43
|
-
return
|
|
43
|
+
return chunkVOWMB2KR_js.safe(
|
|
44
44
|
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -62,16 +62,16 @@ var SubscriptionService = class {
|
|
|
62
62
|
this.client = client;
|
|
63
63
|
}
|
|
64
64
|
async list() {
|
|
65
|
-
return
|
|
65
|
+
return chunkVOWMB2KR_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
66
66
|
}
|
|
67
67
|
async get(id) {
|
|
68
68
|
const encodedId = encodeURIComponent(id);
|
|
69
|
-
return
|
|
69
|
+
return chunkVOWMB2KR_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
70
70
|
}
|
|
71
71
|
async cancel(id, reason, opts) {
|
|
72
72
|
const encodedId = encodeURIComponent(id);
|
|
73
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
74
|
-
return
|
|
73
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVOWMB2KR_js.generateIdempotencyKey();
|
|
74
|
+
return chunkVOWMB2KR_js.safe(
|
|
75
75
|
this.client.post(
|
|
76
76
|
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
77
77
|
{ reason },
|
|
@@ -81,20 +81,20 @@ var SubscriptionService = class {
|
|
|
81
81
|
}
|
|
82
82
|
async pause(id) {
|
|
83
83
|
const encodedId = encodeURIComponent(id);
|
|
84
|
-
return
|
|
84
|
+
return chunkVOWMB2KR_js.safe(
|
|
85
85
|
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
async resume(id) {
|
|
89
89
|
const encodedId = encodeURIComponent(id);
|
|
90
|
-
return
|
|
90
|
+
return chunkVOWMB2KR_js.safe(
|
|
91
91
|
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
async skipNextRenewal(id, opts) {
|
|
95
95
|
const encodedId = encodeURIComponent(id);
|
|
96
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
97
|
-
return
|
|
96
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVOWMB2KR_js.generateIdempotencyKey();
|
|
97
|
+
return chunkVOWMB2KR_js.safe(
|
|
98
98
|
this.client.post(
|
|
99
99
|
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
100
100
|
void 0,
|
|
@@ -110,8 +110,8 @@ var UploadService = class {
|
|
|
110
110
|
this.client = client;
|
|
111
111
|
}
|
|
112
112
|
async init(filename, contentType, sizeBytes, opts) {
|
|
113
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
114
|
-
return
|
|
113
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVOWMB2KR_js.generateIdempotencyKey();
|
|
114
|
+
return chunkVOWMB2KR_js.safe(
|
|
115
115
|
this.client.post(
|
|
116
116
|
"/api/v1/uploads/init",
|
|
117
117
|
{
|
|
@@ -124,7 +124,7 @@ var UploadService = class {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
async confirm(uploadId) {
|
|
127
|
-
return
|
|
127
|
+
return chunkVOWMB2KR_js.safe(
|
|
128
128
|
this.client.post("/api/v1/uploads/confirm", {
|
|
129
129
|
upload_id: uploadId
|
|
130
130
|
})
|
|
@@ -170,7 +170,7 @@ var PlacesService = class {
|
|
|
170
170
|
this.client = client;
|
|
171
171
|
}
|
|
172
172
|
async autocomplete(input, sessionToken) {
|
|
173
|
-
return
|
|
173
|
+
return chunkVOWMB2KR_js.safe(
|
|
174
174
|
this.client.post("/api/v1/places/autocomplete", {
|
|
175
175
|
input,
|
|
176
176
|
sessionToken
|
|
@@ -178,7 +178,7 @@ var PlacesService = class {
|
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
async details(placeId, sessionToken) {
|
|
181
|
-
return
|
|
181
|
+
return chunkVOWMB2KR_js.safe(
|
|
182
182
|
this.client.post("/api/v1/places/details", {
|
|
183
183
|
place_id: placeId,
|
|
184
184
|
sessionToken
|
|
@@ -197,7 +197,7 @@ var DeliveryService = class {
|
|
|
197
197
|
params.set("dropoff_lat", String(dropoffLat));
|
|
198
198
|
params.set("dropoff_lng", String(dropoffLng));
|
|
199
199
|
if (country) params.set("country", country);
|
|
200
|
-
return
|
|
200
|
+
return chunkVOWMB2KR_js.safe(
|
|
201
201
|
this.client.get(`/api/v1/delivery/fee?${params.toString()}`)
|
|
202
202
|
);
|
|
203
203
|
}
|
|
@@ -210,8 +210,8 @@ var SupportService = class {
|
|
|
210
210
|
}
|
|
211
211
|
/** Open (or resume) the customer's widget conversation. */
|
|
212
212
|
async openConversation(opts) {
|
|
213
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
214
|
-
return
|
|
213
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVOWMB2KR_js.generateIdempotencyKey();
|
|
214
|
+
return chunkVOWMB2KR_js.safe(
|
|
215
215
|
this.client.post("/api/v1/support/conversation", void 0, {
|
|
216
216
|
idempotencyKey
|
|
217
217
|
})
|
|
@@ -219,8 +219,8 @@ var SupportService = class {
|
|
|
219
219
|
}
|
|
220
220
|
/** Send a message in the active conversation. */
|
|
221
221
|
async sendMessage(content, opts) {
|
|
222
|
-
const idempotencyKey = opts?.idempotencyKey ??
|
|
223
|
-
return
|
|
222
|
+
const idempotencyKey = opts?.idempotencyKey ?? chunkVOWMB2KR_js.generateIdempotencyKey();
|
|
223
|
+
return chunkVOWMB2KR_js.safe(
|
|
224
224
|
this.client.post(
|
|
225
225
|
"/api/v1/support/conversation/messages",
|
|
226
226
|
{ content },
|
|
@@ -235,7 +235,7 @@ var SupportService = class {
|
|
|
235
235
|
if (options.limit) params.set("limit", String(options.limit));
|
|
236
236
|
const query = params.toString();
|
|
237
237
|
const path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages";
|
|
238
|
-
return
|
|
238
|
+
return chunkVOWMB2KR_js.safe(this.client.get(path));
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
@@ -284,6 +284,14 @@ var DEFAULT_RETRY_DELAY_MS = 1e3;
|
|
|
284
284
|
function sleep(ms) {
|
|
285
285
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
286
286
|
}
|
|
287
|
+
function nextInit(cacheOptions) {
|
|
288
|
+
if (!cacheOptions) return {};
|
|
289
|
+
const next = {};
|
|
290
|
+
if (cacheOptions.revalidate !== void 0) next.revalidate = cacheOptions.revalidate;
|
|
291
|
+
if (cacheOptions.tags && cacheOptions.tags.length > 0) next.tags = [...cacheOptions.tags];
|
|
292
|
+
if (next.revalidate === void 0 && !next.tags) return {};
|
|
293
|
+
return { next };
|
|
294
|
+
}
|
|
287
295
|
function mergeOptionHeaders(base, opts) {
|
|
288
296
|
if (!opts) return base;
|
|
289
297
|
const merged = { ...base };
|
|
@@ -700,8 +708,9 @@ var CimplifyClient = class {
|
|
|
700
708
|
});
|
|
701
709
|
throw finalError;
|
|
702
710
|
}
|
|
703
|
-
getDedupeKey(type, payload) {
|
|
704
|
-
|
|
711
|
+
getDedupeKey(type, payload, cacheOptions) {
|
|
712
|
+
const cacheKey = cacheOptions ? `|${JSON.stringify(cacheOptions)}` : "";
|
|
713
|
+
return `${type}:${JSON.stringify(payload)}${cacheKey}`;
|
|
705
714
|
}
|
|
706
715
|
async deduplicatedRequest(key, requestFn) {
|
|
707
716
|
const existing = this.inflightRequests.get(key);
|
|
@@ -714,13 +723,14 @@ var CimplifyClient = class {
|
|
|
714
723
|
this.inflightRequests.set(key, request);
|
|
715
724
|
return request;
|
|
716
725
|
}
|
|
717
|
-
async get(path) {
|
|
718
|
-
const key = this.getDedupeKey("get", path);
|
|
726
|
+
async get(path, opts) {
|
|
727
|
+
const key = this.getDedupeKey("get", path, opts?.cacheOptions);
|
|
719
728
|
return this.deduplicatedRequest(key, async () => {
|
|
720
729
|
const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
|
|
721
730
|
method: "GET",
|
|
722
731
|
credentials: this.credentials,
|
|
723
|
-
headers: this.getHeaders()
|
|
732
|
+
headers: this.getHeaders(),
|
|
733
|
+
...nextInit(opts?.cacheOptions)
|
|
724
734
|
});
|
|
725
735
|
return this.handleRestResponse(response);
|
|
726
736
|
});
|
|
@@ -751,13 +761,14 @@ var CimplifyClient = class {
|
|
|
751
761
|
});
|
|
752
762
|
return this.handleRestResponse(response);
|
|
753
763
|
}
|
|
754
|
-
async linkGet(path) {
|
|
755
|
-
const key = this.getDedupeKey("linkGet", path);
|
|
764
|
+
async linkGet(path, opts) {
|
|
765
|
+
const key = this.getDedupeKey("linkGet", path, opts?.cacheOptions);
|
|
756
766
|
return this.deduplicatedRequest(key, async () => {
|
|
757
767
|
const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
|
|
758
768
|
method: "GET",
|
|
759
769
|
credentials: this.credentials,
|
|
760
|
-
headers: this.getHeaders()
|
|
770
|
+
headers: this.getHeaders(),
|
|
771
|
+
...nextInit(opts?.cacheOptions)
|
|
761
772
|
});
|
|
762
773
|
return this.handleRestResponse(response);
|
|
763
774
|
});
|
|
@@ -822,25 +833,25 @@ var CimplifyClient = class {
|
|
|
822
833
|
}
|
|
823
834
|
get catalogue() {
|
|
824
835
|
if (!this._catalogue) {
|
|
825
|
-
this._catalogue = new
|
|
836
|
+
this._catalogue = new chunkVOWMB2KR_js.CatalogueQueries(this);
|
|
826
837
|
}
|
|
827
838
|
return this._catalogue;
|
|
828
839
|
}
|
|
829
840
|
get cart() {
|
|
830
841
|
if (!this._cart) {
|
|
831
|
-
this._cart = new
|
|
842
|
+
this._cart = new chunkVOWMB2KR_js.CartOperations(this);
|
|
832
843
|
}
|
|
833
844
|
return this._cart;
|
|
834
845
|
}
|
|
835
846
|
get checkout() {
|
|
836
847
|
if (!this._checkout) {
|
|
837
|
-
this._checkout = new
|
|
848
|
+
this._checkout = new chunkVOWMB2KR_js.CheckoutService(this);
|
|
838
849
|
}
|
|
839
850
|
return this._checkout;
|
|
840
851
|
}
|
|
841
852
|
get orders() {
|
|
842
853
|
if (!this._orders) {
|
|
843
|
-
this._orders = new
|
|
854
|
+
this._orders = new chunkVOWMB2KR_js.OrderQueries(this);
|
|
844
855
|
}
|
|
845
856
|
return this._orders;
|
|
846
857
|
}
|
|
@@ -864,43 +875,43 @@ var CimplifyClient = class {
|
|
|
864
875
|
}
|
|
865
876
|
get link() {
|
|
866
877
|
if (!this._link) {
|
|
867
|
-
this._link = new
|
|
878
|
+
this._link = new chunkVOWMB2KR_js.LinkService(this);
|
|
868
879
|
}
|
|
869
880
|
return this._link;
|
|
870
881
|
}
|
|
871
882
|
get auth() {
|
|
872
883
|
if (!this._auth) {
|
|
873
|
-
this._auth = new
|
|
884
|
+
this._auth = new chunkVOWMB2KR_js.AuthService(this);
|
|
874
885
|
}
|
|
875
886
|
return this._auth;
|
|
876
887
|
}
|
|
877
888
|
get business() {
|
|
878
889
|
if (!this._business) {
|
|
879
|
-
this._business = new
|
|
890
|
+
this._business = new chunkVOWMB2KR_js.BusinessService(this);
|
|
880
891
|
}
|
|
881
892
|
return this._business;
|
|
882
893
|
}
|
|
883
894
|
get inventory() {
|
|
884
895
|
if (!this._inventory) {
|
|
885
|
-
this._inventory = new
|
|
896
|
+
this._inventory = new chunkVOWMB2KR_js.InventoryService(this);
|
|
886
897
|
}
|
|
887
898
|
return this._inventory;
|
|
888
899
|
}
|
|
889
900
|
get scheduling() {
|
|
890
901
|
if (!this._scheduling) {
|
|
891
|
-
this._scheduling = new
|
|
902
|
+
this._scheduling = new chunkVOWMB2KR_js.SchedulingService(this);
|
|
892
903
|
}
|
|
893
904
|
return this._scheduling;
|
|
894
905
|
}
|
|
895
906
|
get lite() {
|
|
896
907
|
if (!this._lite) {
|
|
897
|
-
this._lite = new
|
|
908
|
+
this._lite = new chunkVOWMB2KR_js.LiteService(this);
|
|
898
909
|
}
|
|
899
910
|
return this._lite;
|
|
900
911
|
}
|
|
901
912
|
get fx() {
|
|
902
913
|
if (!this._fx) {
|
|
903
|
-
this._fx = new
|
|
914
|
+
this._fx = new chunkVOWMB2KR_js.FxService(this);
|
|
904
915
|
}
|
|
905
916
|
return this._fx;
|
|
906
917
|
}
|
|
@@ -935,7 +946,7 @@ var CimplifyClient = class {
|
|
|
935
946
|
if (businessId) {
|
|
936
947
|
this.setBusinessId(businessId);
|
|
937
948
|
}
|
|
938
|
-
return
|
|
949
|
+
return chunkVOWMB2KR_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
939
950
|
}
|
|
940
951
|
};
|
|
941
952
|
function createCimplifyClient(config = {}) {
|
|
@@ -252,12 +252,12 @@ var CatalogueQueries = class {
|
|
|
252
252
|
constructor(client) {
|
|
253
253
|
this.client = client;
|
|
254
254
|
}
|
|
255
|
-
async getCatalogue() {
|
|
256
|
-
const result = await safe(this.client.get("/api/v1/catalogue"));
|
|
255
|
+
async getCatalogue(opts) {
|
|
256
|
+
const result = await safe(this.client.get("/api/v1/catalogue", opts));
|
|
257
257
|
if (!result.ok) return result;
|
|
258
258
|
return ok(normalizeCatalogueSnapshot(result.value));
|
|
259
259
|
}
|
|
260
|
-
async getProducts(options) {
|
|
260
|
+
async getProducts(options, opts) {
|
|
261
261
|
const path = withQuery("/api/v1/catalogue/products", {
|
|
262
262
|
category_id: options?.category,
|
|
263
263
|
taxonomy_id: options?.taxonomy,
|
|
@@ -275,13 +275,13 @@ var CatalogueQueries = class {
|
|
|
275
275
|
cursor: options?.cursor,
|
|
276
276
|
properties: options?.properties ? JSON.stringify(options.properties) : void 0
|
|
277
277
|
});
|
|
278
|
-
const result = await safe(this.client.get(path));
|
|
278
|
+
const result = await safe(this.client.get(path, opts));
|
|
279
279
|
if (!result.ok) return result;
|
|
280
280
|
return ok(normalizeCatalogueResult(result.value));
|
|
281
281
|
}
|
|
282
|
-
async getProduct(id) {
|
|
282
|
+
async getProduct(id, opts) {
|
|
283
283
|
const encodedId = encodeURIComponent(id);
|
|
284
|
-
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}
|
|
284
|
+
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}`, opts));
|
|
285
285
|
if (!result.ok) return result;
|
|
286
286
|
const payload = result.value;
|
|
287
287
|
const rawProduct = isRecord(payload.item) ? payload.item : payload;
|
|
@@ -291,15 +291,15 @@ var CatalogueQueries = class {
|
|
|
291
291
|
}
|
|
292
292
|
const addOnIds = rawProduct.add_on_ids;
|
|
293
293
|
if (Array.isArray(addOnIds) && addOnIds.length > 0) {
|
|
294
|
-
const addOnsResult = await this.getAddOns(product.id);
|
|
294
|
+
const addOnsResult = await this.getAddOns(product.id, opts);
|
|
295
295
|
if (addOnsResult.ok) {
|
|
296
296
|
product.add_ons = addOnsResult.value;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
return ok(product);
|
|
300
300
|
}
|
|
301
|
-
async getProductBySlug(slug) {
|
|
302
|
-
return this.getProduct(slug);
|
|
301
|
+
async getProductBySlug(slug, opts) {
|
|
302
|
+
return this.getProduct(slug, opts);
|
|
303
303
|
}
|
|
304
304
|
async getVariants(productId) {
|
|
305
305
|
const encodedId = encodeURIComponent(productId);
|
|
@@ -327,45 +327,45 @@ var CatalogueQueries = class {
|
|
|
327
327
|
)
|
|
328
328
|
);
|
|
329
329
|
}
|
|
330
|
-
async getAddOns(productId) {
|
|
330
|
+
async getAddOns(productId, opts) {
|
|
331
331
|
const encodedId = encodeURIComponent(productId);
|
|
332
|
-
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons
|
|
332
|
+
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons`, opts));
|
|
333
333
|
}
|
|
334
|
-
async getCategories() {
|
|
335
|
-
return safe(this.client.get("/api/v1/catalogue/categories"));
|
|
334
|
+
async getCategories(opts) {
|
|
335
|
+
return safe(this.client.get("/api/v1/catalogue/categories", opts));
|
|
336
336
|
}
|
|
337
|
-
async getCategory(id) {
|
|
337
|
+
async getCategory(id, opts) {
|
|
338
338
|
const encodedId = encodeURIComponent(id);
|
|
339
|
-
return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}
|
|
339
|
+
return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}`, opts));
|
|
340
340
|
}
|
|
341
|
-
async getCategoryBySlug(slug) {
|
|
342
|
-
return this.getCategory(slug);
|
|
341
|
+
async getCategoryBySlug(slug, opts) {
|
|
342
|
+
return this.getCategory(slug, opts);
|
|
343
343
|
}
|
|
344
|
-
async getCategoryProducts(categoryId, options) {
|
|
344
|
+
async getCategoryProducts(categoryId, options, opts) {
|
|
345
345
|
const encodedId = encodeURIComponent(categoryId);
|
|
346
346
|
const path = withQuery(`/api/v1/catalogue/categories/${encodedId}/products`, {
|
|
347
347
|
limit: options?.limit,
|
|
348
348
|
offset: options?.offset
|
|
349
349
|
});
|
|
350
|
-
return safe(this.client.get(path));
|
|
350
|
+
return safe(this.client.get(path, opts));
|
|
351
351
|
}
|
|
352
|
-
async getCollections() {
|
|
353
|
-
return safe(this.client.get("/api/v1/catalogue/collections"));
|
|
352
|
+
async getCollections(opts) {
|
|
353
|
+
return safe(this.client.get("/api/v1/catalogue/collections", opts));
|
|
354
354
|
}
|
|
355
|
-
async getCollection(id) {
|
|
355
|
+
async getCollection(id, opts) {
|
|
356
356
|
const encodedId = encodeURIComponent(id);
|
|
357
|
-
return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}
|
|
357
|
+
return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}`, opts));
|
|
358
358
|
}
|
|
359
|
-
async getCollectionBySlug(slug) {
|
|
360
|
-
return this.getCollection(slug);
|
|
359
|
+
async getCollectionBySlug(slug, opts) {
|
|
360
|
+
return this.getCollection(slug, opts);
|
|
361
361
|
}
|
|
362
|
-
async getCollectionProducts(collectionId, options) {
|
|
362
|
+
async getCollectionProducts(collectionId, options, opts) {
|
|
363
363
|
const encodedId = encodeURIComponent(collectionId);
|
|
364
364
|
const path = withQuery(`/api/v1/catalogue/collections/${encodedId}/products`, {
|
|
365
365
|
limit: options?.limit,
|
|
366
366
|
offset: options?.offset
|
|
367
367
|
});
|
|
368
|
-
return safe(this.client.get(path));
|
|
368
|
+
return safe(this.client.get(path, opts));
|
|
369
369
|
}
|
|
370
370
|
async searchCollections(query, limit = 20) {
|
|
371
371
|
const path = withQuery("/api/v1/catalogue/collections", { search: query, limit });
|
|
@@ -490,17 +490,20 @@ var CatalogueQueries = class {
|
|
|
490
490
|
})
|
|
491
491
|
);
|
|
492
492
|
}
|
|
493
|
-
async search(query, options) {
|
|
494
|
-
const result = await this.getProducts(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
493
|
+
async search(query, options, opts) {
|
|
494
|
+
const result = await this.getProducts(
|
|
495
|
+
{
|
|
496
|
+
...options,
|
|
497
|
+
search: query,
|
|
498
|
+
limit: options?.limit ?? 20
|
|
499
|
+
},
|
|
500
|
+
opts
|
|
501
|
+
);
|
|
499
502
|
if (!result.ok) return result;
|
|
500
503
|
return ok(result.value.items);
|
|
501
504
|
}
|
|
502
|
-
async searchProducts(query, options) {
|
|
503
|
-
return this.search(query, options);
|
|
505
|
+
async searchProducts(query, options, opts) {
|
|
506
|
+
return this.search(query, options, opts);
|
|
504
507
|
}
|
|
505
508
|
async getMenu(options) {
|
|
506
509
|
const path = withQuery("/api/v1/catalogue/menu", {
|
|
@@ -1955,25 +1958,25 @@ var BusinessService = class {
|
|
|
1955
1958
|
constructor(client) {
|
|
1956
1959
|
this.client = client;
|
|
1957
1960
|
}
|
|
1958
|
-
async getInfo() {
|
|
1959
|
-
return safe(this.client.get("/api/v1/business"));
|
|
1961
|
+
async getInfo(opts) {
|
|
1962
|
+
return safe(this.client.get("/api/v1/business", opts));
|
|
1960
1963
|
}
|
|
1961
|
-
async getByHandle(handle) {
|
|
1964
|
+
async getByHandle(handle, opts) {
|
|
1962
1965
|
const encodedHandle = encodeURIComponent(handle);
|
|
1963
|
-
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}
|
|
1966
|
+
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}`, opts));
|
|
1964
1967
|
}
|
|
1965
|
-
async getByDomain(domain) {
|
|
1968
|
+
async getByDomain(domain, opts) {
|
|
1966
1969
|
const encodedDomain = encodeURIComponent(domain);
|
|
1967
|
-
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}
|
|
1970
|
+
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}`, opts));
|
|
1968
1971
|
}
|
|
1969
|
-
async getSettings() {
|
|
1970
|
-
return safe(this.client.get("/api/v1/business/settings"));
|
|
1972
|
+
async getSettings(opts) {
|
|
1973
|
+
return safe(this.client.get("/api/v1/business/settings", opts));
|
|
1971
1974
|
}
|
|
1972
|
-
async getLocations() {
|
|
1973
|
-
return safe(this.client.get("/api/v1/business/locations"));
|
|
1975
|
+
async getLocations(opts) {
|
|
1976
|
+
return safe(this.client.get("/api/v1/business/locations", opts));
|
|
1974
1977
|
}
|
|
1975
|
-
async getLocation(locationId) {
|
|
1976
|
-
const result = await this.getLocations();
|
|
1978
|
+
async getLocation(locationId, opts) {
|
|
1979
|
+
const result = await this.getLocations(opts);
|
|
1977
1980
|
if (!result.ok) return err(result.error);
|
|
1978
1981
|
const location = result.value.find((item) => item.id === locationId);
|
|
1979
1982
|
if (!location) {
|
|
@@ -1981,16 +1984,16 @@ var BusinessService = class {
|
|
|
1981
1984
|
}
|
|
1982
1985
|
return ok(location);
|
|
1983
1986
|
}
|
|
1984
|
-
async getHours() {
|
|
1985
|
-
return safe(this.client.get("/api/v1/business/hours"));
|
|
1987
|
+
async getHours(opts) {
|
|
1988
|
+
return safe(this.client.get("/api/v1/business/hours", opts));
|
|
1986
1989
|
}
|
|
1987
|
-
async getLocationHours(locationId) {
|
|
1988
|
-
const result = await this.getHours();
|
|
1990
|
+
async getLocationHours(locationId, opts) {
|
|
1991
|
+
const result = await this.getHours(opts);
|
|
1989
1992
|
if (!result.ok) return result;
|
|
1990
1993
|
return ok(result.value.filter((hour) => hour.location_id === locationId));
|
|
1991
1994
|
}
|
|
1992
|
-
async getBootstrap() {
|
|
1993
|
-
return safe(this.client.get("/api/v1/bootstrap"));
|
|
1995
|
+
async getBootstrap(opts) {
|
|
1996
|
+
return safe(this.client.get("/api/v1/bootstrap", opts));
|
|
1994
1997
|
}
|
|
1995
1998
|
};
|
|
1996
1999
|
|