@cimplify/sdk 0.51.1 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +23 -22
- package/dist/advanced.mjs +4 -3
- package/dist/chunk-3G6RQLXK.mjs +21 -0
- package/dist/{chunk-GUZXQSGI.mjs → chunk-4QDCMYYB.mjs} +10 -21
- package/dist/{chunk-CAG3TEXO.js → chunk-7A3D3LFI.js} +4 -4
- package/dist/{chunk-6RP6OPYO.js → chunk-7Y2O3E4D.js} +3 -3
- package/dist/{chunk-Z2AYLZDF.mjs → chunk-AMZXALF6.mjs} +1 -21
- package/dist/{chunk-VOWMB2KR.js → chunk-EQLT46ZR.js} +75 -78
- package/dist/{chunk-FXACV333.mjs → chunk-GLAVTDDE.mjs} +55 -58
- package/dist/chunk-OWW5GUSB.js +28 -0
- package/dist/{chunk-GEWFWQYK.js → chunk-Q5VGDCQF.js} +235 -234
- package/dist/{chunk-632JEJUS.mjs → chunk-R3F55BRN.mjs} +2 -1
- package/dist/{chunk-QCS6D4XW.mjs → chunk-RDORJT7Y.mjs} +2 -2
- package/dist/{chunk-XY2DFX5K.mjs → chunk-TD3AY34U.mjs} +1 -1
- package/dist/{chunk-FJQC4VSN.js → chunk-W6CCBNGL.js} +68 -79
- package/dist/{chunk-TKOTACKZ.js → chunk-XA3ZNR75.js} +0 -26
- 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 +110 -109
- package/dist/index.mjs +5 -4
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +86 -85
- package/dist/react.mjs +5 -4
- package/dist/server/evict.d.mts +31 -0
- package/dist/server/evict.d.ts +31 -0
- package/dist/server/evict.js +75 -0
- package/dist/server/evict.mjs +73 -0
- package/dist/server.d.mts +11 -48
- package/dist/server.d.ts +11 -48
- package/dist/server.js +7 -76
- package/dist/server.mjs +6 -74
- package/dist/testing/msw.js +4 -3
- package/dist/testing/msw.mjs +3 -2
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +82 -81
- package/dist/testing.mjs +8 -7
- package/dist/utils.js +30 -29
- package/dist/utils.mjs +3 -2
- package/package.json +7 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-
|
|
2
|
-
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-
|
|
1
|
+
import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-TD3AY34U.mjs';
|
|
2
|
+
import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-AMZXALF6.mjs';
|
|
3
3
|
|
|
4
4
|
// src/types/result.ts
|
|
5
5
|
function ok(value) {
|
|
@@ -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() {
|
|
256
|
+
const result = await safe(this.client.get("/api/v1/catalogue"));
|
|
257
257
|
if (!result.ok) return result;
|
|
258
258
|
return ok(normalizeCatalogueSnapshot(result.value));
|
|
259
259
|
}
|
|
260
|
-
async getProducts(options
|
|
260
|
+
async getProducts(options) {
|
|
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));
|
|
279
279
|
if (!result.ok) return result;
|
|
280
280
|
return ok(normalizeCatalogueResult(result.value));
|
|
281
281
|
}
|
|
282
|
-
async getProduct(id
|
|
282
|
+
async getProduct(id) {
|
|
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}`));
|
|
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);
|
|
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) {
|
|
302
|
+
return this.getProduct(slug);
|
|
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) {
|
|
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`));
|
|
333
333
|
}
|
|
334
|
-
async getCategories(
|
|
335
|
-
return safe(this.client.get("/api/v1/catalogue/categories"
|
|
334
|
+
async getCategories() {
|
|
335
|
+
return safe(this.client.get("/api/v1/catalogue/categories"));
|
|
336
336
|
}
|
|
337
|
-
async getCategory(id
|
|
337
|
+
async getCategory(id) {
|
|
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}`));
|
|
340
340
|
}
|
|
341
|
-
async getCategoryBySlug(slug
|
|
342
|
-
return this.getCategory(slug
|
|
341
|
+
async getCategoryBySlug(slug) {
|
|
342
|
+
return this.getCategory(slug);
|
|
343
343
|
}
|
|
344
|
-
async getCategoryProducts(categoryId, options
|
|
344
|
+
async getCategoryProducts(categoryId, options) {
|
|
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));
|
|
351
351
|
}
|
|
352
|
-
async getCollections(
|
|
353
|
-
return safe(this.client.get("/api/v1/catalogue/collections"
|
|
352
|
+
async getCollections() {
|
|
353
|
+
return safe(this.client.get("/api/v1/catalogue/collections"));
|
|
354
354
|
}
|
|
355
|
-
async getCollection(id
|
|
355
|
+
async getCollection(id) {
|
|
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}`));
|
|
358
358
|
}
|
|
359
|
-
async getCollectionBySlug(slug
|
|
360
|
-
return this.getCollection(slug
|
|
359
|
+
async getCollectionBySlug(slug) {
|
|
360
|
+
return this.getCollection(slug);
|
|
361
361
|
}
|
|
362
|
-
async getCollectionProducts(collectionId, options
|
|
362
|
+
async getCollectionProducts(collectionId, options) {
|
|
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));
|
|
369
369
|
}
|
|
370
370
|
async searchCollections(query, limit = 20) {
|
|
371
371
|
const path = withQuery("/api/v1/catalogue/collections", { search: query, limit });
|
|
@@ -490,20 +490,17 @@ var CatalogueQueries = class {
|
|
|
490
490
|
})
|
|
491
491
|
);
|
|
492
492
|
}
|
|
493
|
-
async search(query, options
|
|
494
|
-
const result = await this.getProducts(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
},
|
|
500
|
-
opts
|
|
501
|
-
);
|
|
493
|
+
async search(query, options) {
|
|
494
|
+
const result = await this.getProducts({
|
|
495
|
+
...options,
|
|
496
|
+
search: query,
|
|
497
|
+
limit: options?.limit ?? 20
|
|
498
|
+
});
|
|
502
499
|
if (!result.ok) return result;
|
|
503
500
|
return ok(result.value.items);
|
|
504
501
|
}
|
|
505
|
-
async searchProducts(query, options
|
|
506
|
-
return this.search(query, options
|
|
502
|
+
async searchProducts(query, options) {
|
|
503
|
+
return this.search(query, options);
|
|
507
504
|
}
|
|
508
505
|
async getMenu(options) {
|
|
509
506
|
const path = withQuery("/api/v1/catalogue/menu", {
|
|
@@ -1958,25 +1955,25 @@ var BusinessService = class {
|
|
|
1958
1955
|
constructor(client) {
|
|
1959
1956
|
this.client = client;
|
|
1960
1957
|
}
|
|
1961
|
-
async getInfo(
|
|
1962
|
-
return safe(this.client.get("/api/v1/business"
|
|
1958
|
+
async getInfo() {
|
|
1959
|
+
return safe(this.client.get("/api/v1/business"));
|
|
1963
1960
|
}
|
|
1964
|
-
async getByHandle(handle
|
|
1961
|
+
async getByHandle(handle) {
|
|
1965
1962
|
const encodedHandle = encodeURIComponent(handle);
|
|
1966
|
-
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}
|
|
1963
|
+
return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}`));
|
|
1967
1964
|
}
|
|
1968
|
-
async getByDomain(domain
|
|
1965
|
+
async getByDomain(domain) {
|
|
1969
1966
|
const encodedDomain = encodeURIComponent(domain);
|
|
1970
|
-
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}
|
|
1967
|
+
return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}`));
|
|
1971
1968
|
}
|
|
1972
|
-
async getSettings(
|
|
1973
|
-
return safe(this.client.get("/api/v1/business/settings"
|
|
1969
|
+
async getSettings() {
|
|
1970
|
+
return safe(this.client.get("/api/v1/business/settings"));
|
|
1974
1971
|
}
|
|
1975
|
-
async getLocations(
|
|
1976
|
-
return safe(this.client.get("/api/v1/business/locations"
|
|
1972
|
+
async getLocations() {
|
|
1973
|
+
return safe(this.client.get("/api/v1/business/locations"));
|
|
1977
1974
|
}
|
|
1978
|
-
async getLocation(locationId
|
|
1979
|
-
const result = await this.getLocations(
|
|
1975
|
+
async getLocation(locationId) {
|
|
1976
|
+
const result = await this.getLocations();
|
|
1980
1977
|
if (!result.ok) return err(result.error);
|
|
1981
1978
|
const location = result.value.find((item) => item.id === locationId);
|
|
1982
1979
|
if (!location) {
|
|
@@ -1984,16 +1981,16 @@ var BusinessService = class {
|
|
|
1984
1981
|
}
|
|
1985
1982
|
return ok(location);
|
|
1986
1983
|
}
|
|
1987
|
-
async getHours(
|
|
1988
|
-
return safe(this.client.get("/api/v1/business/hours"
|
|
1984
|
+
async getHours() {
|
|
1985
|
+
return safe(this.client.get("/api/v1/business/hours"));
|
|
1989
1986
|
}
|
|
1990
|
-
async getLocationHours(locationId
|
|
1991
|
-
const result = await this.getHours(
|
|
1987
|
+
async getLocationHours(locationId) {
|
|
1988
|
+
const result = await this.getHours();
|
|
1992
1989
|
if (!result.ok) return result;
|
|
1993
1990
|
return ok(result.value.filter((hour) => hour.location_id === locationId));
|
|
1994
1991
|
}
|
|
1995
|
-
async getBootstrap(
|
|
1996
|
-
return safe(this.client.get("/api/v1/bootstrap"
|
|
1992
|
+
async getBootstrap() {
|
|
1993
|
+
return safe(this.client.get("/api/v1/bootstrap"));
|
|
1997
1994
|
}
|
|
1998
1995
|
};
|
|
1999
1996
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __typeError = (msg) => {
|
|
5
|
+
throw TypeError(msg);
|
|
6
|
+
};
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
10
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
11
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
12
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
13
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
14
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
15
|
+
set _(value) {
|
|
16
|
+
__privateSet(obj, member, value, setter);
|
|
17
|
+
},
|
|
18
|
+
get _() {
|
|
19
|
+
return __privateGet(obj, member, getter);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
exports.__privateAdd = __privateAdd;
|
|
24
|
+
exports.__privateGet = __privateGet;
|
|
25
|
+
exports.__privateMethod = __privateMethod;
|
|
26
|
+
exports.__privateSet = __privateSet;
|
|
27
|
+
exports.__privateWrapper = __privateWrapper;
|
|
28
|
+
exports.__publicField = __publicField;
|