@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.
Files changed (51) hide show
  1. package/dist/advanced.d.mts +1 -1
  2. package/dist/advanced.d.ts +1 -1
  3. package/dist/advanced.js +23 -22
  4. package/dist/advanced.mjs +4 -3
  5. package/dist/chunk-3G6RQLXK.mjs +21 -0
  6. package/dist/{chunk-GUZXQSGI.mjs → chunk-4QDCMYYB.mjs} +10 -21
  7. package/dist/{chunk-CAG3TEXO.js → chunk-7A3D3LFI.js} +4 -4
  8. package/dist/{chunk-6RP6OPYO.js → chunk-7Y2O3E4D.js} +3 -3
  9. package/dist/{chunk-Z2AYLZDF.mjs → chunk-AMZXALF6.mjs} +1 -21
  10. package/dist/{chunk-VOWMB2KR.js → chunk-EQLT46ZR.js} +75 -78
  11. package/dist/{chunk-FXACV333.mjs → chunk-GLAVTDDE.mjs} +55 -58
  12. package/dist/chunk-OWW5GUSB.js +28 -0
  13. package/dist/{chunk-GEWFWQYK.js → chunk-Q5VGDCQF.js} +235 -234
  14. package/dist/{chunk-632JEJUS.mjs → chunk-R3F55BRN.mjs} +2 -1
  15. package/dist/{chunk-QCS6D4XW.mjs → chunk-RDORJT7Y.mjs} +2 -2
  16. package/dist/{chunk-XY2DFX5K.mjs → chunk-TD3AY34U.mjs} +1 -1
  17. package/dist/{chunk-FJQC4VSN.js → chunk-W6CCBNGL.js} +68 -79
  18. package/dist/{chunk-TKOTACKZ.js → chunk-XA3ZNR75.js} +0 -26
  19. package/dist/{client-CF2pmEE9.d.mts → client-C6J_RGlr.d.mts} +27 -45
  20. package/dist/{client-B6x53-Al.d.ts → client-CX7IFIkL.d.ts} +27 -45
  21. package/dist/{client-BbrCopIS.d.mts → client-DdefKjcs.d.mts} +1 -1
  22. package/dist/{client-BvEjhvwq.d.ts → client-Lt7uGLmT.d.ts} +1 -1
  23. package/dist/index.d.mts +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +110 -109
  26. package/dist/index.mjs +5 -4
  27. package/dist/react.d.mts +1 -1
  28. package/dist/react.d.ts +1 -1
  29. package/dist/react.js +86 -85
  30. package/dist/react.mjs +5 -4
  31. package/dist/server/evict.d.mts +31 -0
  32. package/dist/server/evict.d.ts +31 -0
  33. package/dist/server/evict.js +75 -0
  34. package/dist/server/evict.mjs +73 -0
  35. package/dist/server.d.mts +11 -48
  36. package/dist/server.d.ts +11 -48
  37. package/dist/server.js +7 -76
  38. package/dist/server.mjs +6 -74
  39. package/dist/testing/msw.js +4 -3
  40. package/dist/testing/msw.mjs +3 -2
  41. package/dist/testing/suite.d.mts +2 -2
  42. package/dist/testing/suite.d.ts +2 -2
  43. package/dist/testing/suite.js +26 -25
  44. package/dist/testing/suite.mjs +7 -6
  45. package/dist/testing.d.mts +2 -2
  46. package/dist/testing.d.ts +2 -2
  47. package/dist/testing.js +82 -81
  48. package/dist/testing.mjs +8 -7
  49. package/dist/utils.js +30 -29
  50. package/dist/utils.mjs +3 -2
  51. package/package.json +7 -1
@@ -1,5 +1,5 @@
1
- import { isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure } from './chunk-XY2DFX5K.mjs';
2
- import { CimplifyError, currencyCode, ErrorCode, enrichError, getErrorHint } from './chunk-Z2AYLZDF.mjs';
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(opts) {
256
- const result = await safe(this.client.get("/api/v1/catalogue", opts));
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, opts) {
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, opts));
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, opts) {
282
+ async getProduct(id) {
283
283
  const encodedId = encodeURIComponent(id);
284
- const result = await safe(this.client.get(`/api/v1/catalogue/products/${encodedId}`, opts));
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, opts);
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, opts) {
302
- return this.getProduct(slug, opts);
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, opts) {
330
+ async getAddOns(productId) {
331
331
  const encodedId = encodeURIComponent(productId);
332
- return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons`, opts));
332
+ return safe(this.client.get(`/api/v1/catalogue/products/${encodedId}/add-ons`));
333
333
  }
334
- async getCategories(opts) {
335
- return safe(this.client.get("/api/v1/catalogue/categories", opts));
334
+ async getCategories() {
335
+ return safe(this.client.get("/api/v1/catalogue/categories"));
336
336
  }
337
- async getCategory(id, opts) {
337
+ async getCategory(id) {
338
338
  const encodedId = encodeURIComponent(id);
339
- return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}`, opts));
339
+ return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}`));
340
340
  }
341
- async getCategoryBySlug(slug, opts) {
342
- return this.getCategory(slug, opts);
341
+ async getCategoryBySlug(slug) {
342
+ return this.getCategory(slug);
343
343
  }
344
- async getCategoryProducts(categoryId, options, opts) {
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, opts));
350
+ return safe(this.client.get(path));
351
351
  }
352
- async getCollections(opts) {
353
- return safe(this.client.get("/api/v1/catalogue/collections", opts));
352
+ async getCollections() {
353
+ return safe(this.client.get("/api/v1/catalogue/collections"));
354
354
  }
355
- async getCollection(id, opts) {
355
+ async getCollection(id) {
356
356
  const encodedId = encodeURIComponent(id);
357
- return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}`, opts));
357
+ return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}`));
358
358
  }
359
- async getCollectionBySlug(slug, opts) {
360
- return this.getCollection(slug, opts);
359
+ async getCollectionBySlug(slug) {
360
+ return this.getCollection(slug);
361
361
  }
362
- async getCollectionProducts(collectionId, options, opts) {
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, opts));
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, opts) {
494
- const result = await this.getProducts(
495
- {
496
- ...options,
497
- search: query,
498
- limit: options?.limit ?? 20
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, opts) {
506
- return this.search(query, options, opts);
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(opts) {
1962
- return safe(this.client.get("/api/v1/business", opts));
1958
+ async getInfo() {
1959
+ return safe(this.client.get("/api/v1/business"));
1963
1960
  }
1964
- async getByHandle(handle, opts) {
1961
+ async getByHandle(handle) {
1965
1962
  const encodedHandle = encodeURIComponent(handle);
1966
- return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}`, opts));
1963
+ return safe(this.client.get(`/api/v1/business/by-handle/${encodedHandle}`));
1967
1964
  }
1968
- async getByDomain(domain, opts) {
1965
+ async getByDomain(domain) {
1969
1966
  const encodedDomain = encodeURIComponent(domain);
1970
- return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}`, opts));
1967
+ return safe(this.client.get(`/api/v1/business/by-domain?domain=${encodedDomain}`));
1971
1968
  }
1972
- async getSettings(opts) {
1973
- return safe(this.client.get("/api/v1/business/settings", opts));
1969
+ async getSettings() {
1970
+ return safe(this.client.get("/api/v1/business/settings"));
1974
1971
  }
1975
- async getLocations(opts) {
1976
- return safe(this.client.get("/api/v1/business/locations", opts));
1972
+ async getLocations() {
1973
+ return safe(this.client.get("/api/v1/business/locations"));
1977
1974
  }
1978
- async getLocation(locationId, opts) {
1979
- const result = await this.getLocations(opts);
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(opts) {
1988
- return safe(this.client.get("/api/v1/business/hours", opts));
1984
+ async getHours() {
1985
+ return safe(this.client.get("/api/v1/business/hours"));
1989
1986
  }
1990
- async getLocationHours(locationId, opts) {
1991
- const result = await this.getHours(opts);
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(opts) {
1996
- return safe(this.client.get("/api/v1/bootstrap", opts));
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;