@cimplify/sdk 0.51.0 → 0.52.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-QCS6D4XW.mjs → chunk-24FK7VFL.mjs} +1 -1
- package/dist/{chunk-FJQC4VSN.js → chunk-CYGLTD7D.js} +43 -54
- package/dist/{chunk-CAG3TEXO.js → chunk-D22UVSFN.js} +2 -2
- package/dist/{chunk-VOWMB2KR.js → chunk-DR4UPU6P.js} +53 -56
- package/dist/{chunk-GUZXQSGI.mjs → chunk-MBR2DBEN.mjs} +9 -20
- package/dist/{chunk-FXACV333.mjs → chunk-OFNVLUH4.mjs} +53 -56
- package/dist/{client-CF2pmEE9.d.mts → client-C6J_RGlr.d.mts} +27 -45
- package/dist/{client-B6x53-Al.d.ts → client-CX7IFIkL.d.ts} +27 -45
- package/dist/{client-BbrCopIS.d.mts → client-DdefKjcs.d.mts} +1 -1
- package/dist/{client-BvEjhvwq.d.ts → client-Lt7uGLmT.d.ts} +1 -1
- 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 +10 -18
- package/dist/server.d.ts +10 -18
- package/dist/server.js +9 -103
- package/dist/server.mjs +4 -98
- 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, k as CartOperations, b as CatalogueQueries, m as CheckoutOperations, m as CheckoutService, a7 as CimplifyElement, a6 as CimplifyElements, ab as ELEMENT_TYPES, aa as EVENT_TYPES, af as ElementEventType, ad as ElementOptions, ae as ElementType, ac as ElementsOptions, F as FetchQuoteInput, s as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, r as LiteService, a9 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, g as QuoteDynamicBuckets, f as QuoteStatus, h as QuoteUiMessage, e as RefreshQuoteInput, j as RefreshQuoteResult, q as SchedulingService, a8 as createElements } from './client-C6J_RGlr.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, k as CartOperations, b as CatalogueQueries, m as CheckoutOperations, m as CheckoutService, a7 as CimplifyElement, a6 as CimplifyElements, ab as ELEMENT_TYPES, aa as EVENT_TYPES, af as ElementEventType, ad as ElementOptions, ae as ElementType, ac as ElementsOptions, F as FetchQuoteInput, s as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, r as LiteService, a9 as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, g as QuoteDynamicBuckets, f as QuoteStatus, h as QuoteUiMessage, e as RefreshQuoteInput, j as RefreshQuoteResult, q as SchedulingService, a8 as createElements } from './client-CX7IFIkL.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 chunkDR4UPU6P_js = require('./chunk-DR4UPU6P.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 chunkDR4UPU6P_js.AuthService; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "BusinessService", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkDR4UPU6P_js.BusinessService; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "CartOperations", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkDR4UPU6P_js.CartOperations; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "CatalogueQueries", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkDR4UPU6P_js.CatalogueQueries; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "CheckoutOperations", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkDR4UPU6P_js.CheckoutService; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "CheckoutService", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkDR4UPU6P_js.CheckoutService; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "CimplifyElement", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkDR4UPU6P_js.CimplifyElement; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "CimplifyElements", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkDR4UPU6P_js.CimplifyElements; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ELEMENT_TYPES", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkDR4UPU6P_js.ELEMENT_TYPES; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "EVENT_TYPES", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkDR4UPU6P_js.EVENT_TYPES; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "FxService", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkDR4UPU6P_js.FxService; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "InventoryService", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkDR4UPU6P_js.InventoryService; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "LinkService", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkDR4UPU6P_js.LinkService; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "LiteService", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkDR4UPU6P_js.LiteService; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "MESSAGE_TYPES", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkDR4UPU6P_js.MESSAGE_TYPES; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "OrderQueries", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkDR4UPU6P_js.OrderQueries; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "SchedulingService", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkDR4UPU6P_js.SchedulingService; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "createElements", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkDR4UPU6P_js.createElements; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "generateIdempotencyKey", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkDR4UPU6P_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-OFNVLUH4.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 chunkDR4UPU6P_js = require('./chunk-DR4UPU6P.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 chunkDR4UPU6P_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 chunkDR4UPU6P_js.safe(this.client.get(path));
|
|
41
41
|
}
|
|
42
42
|
async dismissMessage(code) {
|
|
43
|
-
return
|
|
43
|
+
return chunkDR4UPU6P_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 chunkDR4UPU6P_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 chunkDR4UPU6P_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 ?? chunkDR4UPU6P_js.generateIdempotencyKey();
|
|
74
|
+
return chunkDR4UPU6P_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 chunkDR4UPU6P_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 chunkDR4UPU6P_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 ?? chunkDR4UPU6P_js.generateIdempotencyKey();
|
|
97
|
+
return chunkDR4UPU6P_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 ?? chunkDR4UPU6P_js.generateIdempotencyKey();
|
|
114
|
+
return chunkDR4UPU6P_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 chunkDR4UPU6P_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 chunkDR4UPU6P_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 chunkDR4UPU6P_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 chunkDR4UPU6P_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 ?? chunkDR4UPU6P_js.generateIdempotencyKey();
|
|
214
|
+
return chunkDR4UPU6P_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 ?? chunkDR4UPU6P_js.generateIdempotencyKey();
|
|
223
|
+
return chunkDR4UPU6P_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 chunkDR4UPU6P_js.safe(this.client.get(path));
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
241
|
|
|
@@ -284,14 +284,6 @@ 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
|
-
}
|
|
295
287
|
function mergeOptionHeaders(base, opts) {
|
|
296
288
|
if (!opts) return base;
|
|
297
289
|
const merged = { ...base };
|
|
@@ -708,9 +700,8 @@ var CimplifyClient = class {
|
|
|
708
700
|
});
|
|
709
701
|
throw finalError;
|
|
710
702
|
}
|
|
711
|
-
getDedupeKey(type, payload
|
|
712
|
-
|
|
713
|
-
return `${type}:${JSON.stringify(payload)}${cacheKey}`;
|
|
703
|
+
getDedupeKey(type, payload) {
|
|
704
|
+
return `${type}:${JSON.stringify(payload)}`;
|
|
714
705
|
}
|
|
715
706
|
async deduplicatedRequest(key, requestFn) {
|
|
716
707
|
const existing = this.inflightRequests.get(key);
|
|
@@ -723,14 +714,13 @@ var CimplifyClient = class {
|
|
|
723
714
|
this.inflightRequests.set(key, request);
|
|
724
715
|
return request;
|
|
725
716
|
}
|
|
726
|
-
async get(path
|
|
727
|
-
const key = this.getDedupeKey("get", path
|
|
717
|
+
async get(path) {
|
|
718
|
+
const key = this.getDedupeKey("get", path);
|
|
728
719
|
return this.deduplicatedRequest(key, async () => {
|
|
729
720
|
const response = await this.resilientFetch(this.buildUrl(this.baseUrl, path), {
|
|
730
721
|
method: "GET",
|
|
731
722
|
credentials: this.credentials,
|
|
732
|
-
headers: this.getHeaders()
|
|
733
|
-
...nextInit(opts?.cacheOptions)
|
|
723
|
+
headers: this.getHeaders()
|
|
734
724
|
});
|
|
735
725
|
return this.handleRestResponse(response);
|
|
736
726
|
});
|
|
@@ -761,14 +751,13 @@ var CimplifyClient = class {
|
|
|
761
751
|
});
|
|
762
752
|
return this.handleRestResponse(response);
|
|
763
753
|
}
|
|
764
|
-
async linkGet(path
|
|
765
|
-
const key = this.getDedupeKey("linkGet", path
|
|
754
|
+
async linkGet(path) {
|
|
755
|
+
const key = this.getDedupeKey("linkGet", path);
|
|
766
756
|
return this.deduplicatedRequest(key, async () => {
|
|
767
757
|
const response = await this.resilientFetch(`${this.linkApiUrl}${path}`, {
|
|
768
758
|
method: "GET",
|
|
769
759
|
credentials: this.credentials,
|
|
770
|
-
headers: this.getHeaders()
|
|
771
|
-
...nextInit(opts?.cacheOptions)
|
|
760
|
+
headers: this.getHeaders()
|
|
772
761
|
});
|
|
773
762
|
return this.handleRestResponse(response);
|
|
774
763
|
});
|
|
@@ -833,25 +822,25 @@ var CimplifyClient = class {
|
|
|
833
822
|
}
|
|
834
823
|
get catalogue() {
|
|
835
824
|
if (!this._catalogue) {
|
|
836
|
-
this._catalogue = new
|
|
825
|
+
this._catalogue = new chunkDR4UPU6P_js.CatalogueQueries(this);
|
|
837
826
|
}
|
|
838
827
|
return this._catalogue;
|
|
839
828
|
}
|
|
840
829
|
get cart() {
|
|
841
830
|
if (!this._cart) {
|
|
842
|
-
this._cart = new
|
|
831
|
+
this._cart = new chunkDR4UPU6P_js.CartOperations(this);
|
|
843
832
|
}
|
|
844
833
|
return this._cart;
|
|
845
834
|
}
|
|
846
835
|
get checkout() {
|
|
847
836
|
if (!this._checkout) {
|
|
848
|
-
this._checkout = new
|
|
837
|
+
this._checkout = new chunkDR4UPU6P_js.CheckoutService(this);
|
|
849
838
|
}
|
|
850
839
|
return this._checkout;
|
|
851
840
|
}
|
|
852
841
|
get orders() {
|
|
853
842
|
if (!this._orders) {
|
|
854
|
-
this._orders = new
|
|
843
|
+
this._orders = new chunkDR4UPU6P_js.OrderQueries(this);
|
|
855
844
|
}
|
|
856
845
|
return this._orders;
|
|
857
846
|
}
|
|
@@ -875,43 +864,43 @@ var CimplifyClient = class {
|
|
|
875
864
|
}
|
|
876
865
|
get link() {
|
|
877
866
|
if (!this._link) {
|
|
878
|
-
this._link = new
|
|
867
|
+
this._link = new chunkDR4UPU6P_js.LinkService(this);
|
|
879
868
|
}
|
|
880
869
|
return this._link;
|
|
881
870
|
}
|
|
882
871
|
get auth() {
|
|
883
872
|
if (!this._auth) {
|
|
884
|
-
this._auth = new
|
|
873
|
+
this._auth = new chunkDR4UPU6P_js.AuthService(this);
|
|
885
874
|
}
|
|
886
875
|
return this._auth;
|
|
887
876
|
}
|
|
888
877
|
get business() {
|
|
889
878
|
if (!this._business) {
|
|
890
|
-
this._business = new
|
|
879
|
+
this._business = new chunkDR4UPU6P_js.BusinessService(this);
|
|
891
880
|
}
|
|
892
881
|
return this._business;
|
|
893
882
|
}
|
|
894
883
|
get inventory() {
|
|
895
884
|
if (!this._inventory) {
|
|
896
|
-
this._inventory = new
|
|
885
|
+
this._inventory = new chunkDR4UPU6P_js.InventoryService(this);
|
|
897
886
|
}
|
|
898
887
|
return this._inventory;
|
|
899
888
|
}
|
|
900
889
|
get scheduling() {
|
|
901
890
|
if (!this._scheduling) {
|
|
902
|
-
this._scheduling = new
|
|
891
|
+
this._scheduling = new chunkDR4UPU6P_js.SchedulingService(this);
|
|
903
892
|
}
|
|
904
893
|
return this._scheduling;
|
|
905
894
|
}
|
|
906
895
|
get lite() {
|
|
907
896
|
if (!this._lite) {
|
|
908
|
-
this._lite = new
|
|
897
|
+
this._lite = new chunkDR4UPU6P_js.LiteService(this);
|
|
909
898
|
}
|
|
910
899
|
return this._lite;
|
|
911
900
|
}
|
|
912
901
|
get fx() {
|
|
913
902
|
if (!this._fx) {
|
|
914
|
-
this._fx = new
|
|
903
|
+
this._fx = new chunkDR4UPU6P_js.FxService(this);
|
|
915
904
|
}
|
|
916
905
|
return this._fx;
|
|
917
906
|
}
|
|
@@ -946,7 +935,7 @@ var CimplifyClient = class {
|
|
|
946
935
|
if (businessId) {
|
|
947
936
|
this.setBusinessId(businessId);
|
|
948
937
|
}
|
|
949
|
-
return
|
|
938
|
+
return chunkDR4UPU6P_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
950
939
|
}
|
|
951
940
|
};
|
|
952
941
|
function createCimplifyClient(config = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCYGLTD7D_js = require('./chunk-CYGLTD7D.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 = chunkCYGLTD7D_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.
|
|
@@ -254,12 +254,12 @@ var CatalogueQueries = class {
|
|
|
254
254
|
constructor(client) {
|
|
255
255
|
this.client = client;
|
|
256
256
|
}
|
|
257
|
-
async getCatalogue(
|
|
258
|
-
const result = await safe(this.client.get("/api/v1/catalogue"
|
|
257
|
+
async getCatalogue() {
|
|
258
|
+
const result = await safe(this.client.get("/api/v1/catalogue"));
|
|
259
259
|
if (!result.ok) return result;
|
|
260
260
|
return ok(normalizeCatalogueSnapshot(result.value));
|
|
261
261
|
}
|
|
262
|
-
async getProducts(options
|
|
262
|
+
async getProducts(options) {
|
|
263
263
|
const path = withQuery("/api/v1/catalogue/products", {
|
|
264
264
|
category_id: options?.category,
|
|
265
265
|
taxonomy_id: options?.taxonomy,
|
|
@@ -277,13 +277,13 @@ var CatalogueQueries = class {
|
|
|
277
277
|
cursor: options?.cursor,
|
|
278
278
|
properties: options?.properties ? JSON.stringify(options.properties) : void 0
|
|
279
279
|
});
|
|
280
|
-
const result = await safe(this.client.get(path
|
|
280
|
+
const result = await safe(this.client.get(path));
|
|
281
281
|
if (!result.ok) return result;
|
|
282
282
|
return ok(normalizeCatalogueResult(result.value));
|
|
283
283
|
}
|
|
284
|
-
async getProduct(id
|
|
284
|
+
async getProduct(id) {
|
|
285
285
|
const encodedId = encodeURIComponent(id);
|
|
286
|
-
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}
|
|
286
|
+
const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}`));
|
|
287
287
|
if (!result.ok) return result;
|
|
288
288
|
const payload = result.value;
|
|
289
289
|
const rawProduct = isRecord(payload.item) ? payload.item : payload;
|
|
@@ -293,15 +293,15 @@ var CatalogueQueries = class {
|
|
|
293
293
|
}
|
|
294
294
|
const addOnIds = rawProduct.add_on_ids;
|
|
295
295
|
if (Array.isArray(addOnIds) && addOnIds.length > 0) {
|
|
296
|
-
const addOnsResult = await this.getAddOns(product.id
|
|
296
|
+
const addOnsResult = await this.getAddOns(product.id);
|
|
297
297
|
if (addOnsResult.ok) {
|
|
298
298
|
product.add_ons = addOnsResult.value;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
return ok(product);
|
|
302
302
|
}
|
|
303
|
-
async getProductBySlug(slug
|
|
304
|
-
return this.getProduct(slug
|
|
303
|
+
async getProductBySlug(slug) {
|
|
304
|
+
return this.getProduct(slug);
|
|
305
305
|
}
|
|
306
306
|
async getVariants(productId) {
|
|
307
307
|
const encodedId = encodeURIComponent(productId);
|
|
@@ -329,45 +329,45 @@ var CatalogueQueries = class {
|
|
|
329
329
|
)
|
|
330
330
|
);
|
|
331
331
|
}
|
|
332
|
-
async getAddOns(productId
|
|
332
|
+
async getAddOns(productId) {
|
|
333
333
|
const encodedId = encodeURIComponent(productId);
|
|
334
|
-
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons
|
|
334
|
+
return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons`));
|
|
335
335
|
}
|
|
336
|
-
async getCategories(
|
|
337
|
-
return safe(this.client.get("/api/v1/catalogue/categories"
|
|
336
|
+
async getCategories() {
|
|
337
|
+
return safe(this.client.get("/api/v1/catalogue/categories"));
|
|
338
338
|
}
|
|
339
|
-
async getCategory(id
|
|
339
|
+
async getCategory(id) {
|
|
340
340
|
const encodedId = encodeURIComponent(id);
|
|
341
|
-
return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}
|
|
341
|
+
return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}`));
|
|
342
342
|
}
|
|
343
|
-
async getCategoryBySlug(slug
|
|
344
|
-
return this.getCategory(slug
|
|
343
|
+
async getCategoryBySlug(slug) {
|
|
344
|
+
return this.getCategory(slug);
|
|
345
345
|
}
|
|
346
|
-
async getCategoryProducts(categoryId, options
|
|
346
|
+
async getCategoryProducts(categoryId, options) {
|
|
347
347
|
const encodedId = encodeURIComponent(categoryId);
|
|
348
348
|
const path = withQuery(`/api/v1/catalogue/categories/${encodedId}/products`, {
|
|
349
349
|
limit: options?.limit,
|
|
350
350
|
offset: options?.offset
|
|
351
351
|
});
|
|
352
|
-
return safe(this.client.get(path
|
|
352
|
+
return safe(this.client.get(path));
|
|
353
353
|
}
|
|
354
|
-
async getCollections(
|
|
355
|
-
return safe(this.client.get("/api/v1/catalogue/collections"
|
|
354
|
+
async getCollections() {
|
|
355
|
+
return safe(this.client.get("/api/v1/catalogue/collections"));
|
|
356
356
|
}
|
|
357
|
-
async getCollection(id
|
|
357
|
+
async getCollection(id) {
|
|
358
358
|
const encodedId = encodeURIComponent(id);
|
|
359
|
-
return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}
|
|
359
|
+
return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}`));
|
|
360
360
|
}
|
|
361
|
-
async getCollectionBySlug(slug
|
|
362
|
-
return this.getCollection(slug
|
|
361
|
+
async getCollectionBySlug(slug) {
|
|
362
|
+
return this.getCollection(slug);
|
|
363
363
|
}
|
|
364
|
-
async getCollectionProducts(collectionId, options
|
|
364
|
+
async getCollectionProducts(collectionId, options) {
|
|
365
365
|
const encodedId = encodeURIComponent(collectionId);
|
|
366
366
|
const path = withQuery(`/api/v1/catalogue/collections/${encodedId}/products`, {
|
|
367
367
|
limit: options?.limit,
|
|
368
368
|
offset: options?.offset
|
|
369
369
|
});
|
|
370
|
-
return safe(this.client.get(path
|
|
370
|
+
return safe(this.client.get(path));
|
|
371
371
|
}
|
|
372
372
|
async searchCollections(query, limit = 20) {
|
|
373
373
|
const path = withQuery("/api/v1/catalogue/collections", { search: query, limit });
|
|
@@ -492,20 +492,17 @@ var CatalogueQueries = class {
|
|
|
492
492
|
})
|
|
493
493
|
);
|
|
494
494
|
}
|
|
495
|
-
async search(query, options
|
|
496
|
-
const result = await this.getProducts(
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
},
|
|
502
|
-
opts
|
|
503
|
-
);
|
|
495
|
+
async search(query, options) {
|
|
496
|
+
const result = await this.getProducts({
|
|
497
|
+
...options,
|
|
498
|
+
search: query,
|
|
499
|
+
limit: options?.limit ?? 20
|
|
500
|
+
});
|
|
504
501
|
if (!result.ok) return result;
|
|
505
502
|
return ok(result.value.items);
|
|
506
503
|
}
|
|
507
|
-
async searchProducts(query, options
|
|
508
|
-
return this.search(query, options
|
|
504
|
+
async searchProducts(query, options) {
|
|
505
|
+
return this.search(query, options);
|
|
509
506
|
}
|
|
510
507
|
async getMenu(options) {
|
|
511
508
|
const path = withQuery("/api/v1/catalogue/menu", {
|
|
@@ -1960,25 +1957,25 @@ var BusinessService = class {
|
|
|
1960
1957
|
constructor(client) {
|
|
1961
1958
|
this.client = client;
|
|
1962
1959
|
}
|
|
1963
|
-
async getInfo(
|
|
1964
|
-
return safe(this.client.get("/api/v1/business"
|
|
1960
|
+
async getInfo() {
|
|
1961
|
+
return safe(this.client.get("/api/v1/business"));
|
|
1965
1962
|
}
|
|
1966
|
-
async getByHandle(handle
|
|
1963
|
+
async getByHandle(handle) {
|
|
1967
1964
|
const encodedHandle = encodeURIComponent(handle);
|
|
1968
|
-
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}
|
|
1965
|
+
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}`));
|
|
1969
1966
|
}
|
|
1970
|
-
async getByDomain(domain
|
|
1967
|
+
async getByDomain(domain) {
|
|
1971
1968
|
const encodedDomain = encodeURIComponent(domain);
|
|
1972
|
-
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}
|
|
1969
|
+
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}`));
|
|
1973
1970
|
}
|
|
1974
|
-
async getSettings(
|
|
1975
|
-
return safe(this.client.get("/api/v1/business/settings"
|
|
1971
|
+
async getSettings() {
|
|
1972
|
+
return safe(this.client.get("/api/v1/business/settings"));
|
|
1976
1973
|
}
|
|
1977
|
-
async getLocations(
|
|
1978
|
-
return safe(this.client.get("/api/v1/business/locations"
|
|
1974
|
+
async getLocations() {
|
|
1975
|
+
return safe(this.client.get("/api/v1/business/locations"));
|
|
1979
1976
|
}
|
|
1980
|
-
async getLocation(locationId
|
|
1981
|
-
const result = await this.getLocations(
|
|
1977
|
+
async getLocation(locationId) {
|
|
1978
|
+
const result = await this.getLocations();
|
|
1982
1979
|
if (!result.ok) return err(result.error);
|
|
1983
1980
|
const location = result.value.find((item) => item.id === locationId);
|
|
1984
1981
|
if (!location) {
|
|
@@ -1986,16 +1983,16 @@ var BusinessService = class {
|
|
|
1986
1983
|
}
|
|
1987
1984
|
return ok(location);
|
|
1988
1985
|
}
|
|
1989
|
-
async getHours(
|
|
1990
|
-
return safe(this.client.get("/api/v1/business/hours"
|
|
1986
|
+
async getHours() {
|
|
1987
|
+
return safe(this.client.get("/api/v1/business/hours"));
|
|
1991
1988
|
}
|
|
1992
|
-
async getLocationHours(locationId
|
|
1993
|
-
const result = await this.getHours(
|
|
1989
|
+
async getLocationHours(locationId) {
|
|
1990
|
+
const result = await this.getHours();
|
|
1994
1991
|
if (!result.ok) return result;
|
|
1995
1992
|
return ok(result.value.filter((hour) => hour.location_id === locationId));
|
|
1996
1993
|
}
|
|
1997
|
-
async getBootstrap(
|
|
1998
|
-
return safe(this.client.get("/api/v1/bootstrap"
|
|
1994
|
+
async getBootstrap() {
|
|
1995
|
+
return safe(this.client.get("/api/v1/bootstrap"));
|
|
1999
1996
|
}
|
|
2000
1997
|
};
|
|
2001
1998
|
|