@cimplify/sdk 0.17.0 → 0.19.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.
@@ -1,5 +1,5 @@
1
- export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, x as CimplifyElement, w as CimplifyElements, z as ELEMENT_TYPES, E as EVENT_TYPES, K as ElementEventType, H as ElementOptions, J as ElementType, D as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, y as createElements, l as generateIdempotencyKey } from './client-BaolRdB4.mjs';
2
- import './payment-C6ULw3K-.mjs';
1
+ export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, w as CimplifyElement, v as CimplifyElements, y as ELEMENT_TYPES, E as EVENT_TYPES, J as ElementEventType, D as ElementOptions, H as ElementType, z as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, S as SchedulingService, x as createElements, l as generateIdempotencyKey } from './client-B3payjUV.mjs';
2
+ import './payment-CO2tRThu.mjs';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
5
  type SortOrder = "asc" | "desc";
@@ -1,5 +1,5 @@
1
- export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, x as CimplifyElement, w as CimplifyElements, z as ELEMENT_TYPES, E as EVENT_TYPES, K as ElementEventType, H as ElementOptions, J as ElementType, D as ElementsOptions, F as FetchQuoteInput, r as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, q as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, p as SchedulingService, S as SearchOptions, y as createElements, l as generateIdempotencyKey } from './client-C59R79gx.js';
2
- import './payment-C6ULw3K-.js';
1
+ export { A as AuthService, B as BusinessService, j as CartOperations, b as CatalogueQueries, k as CheckoutOperations, k as CheckoutService, w as CimplifyElement, v as CimplifyElements, y as ELEMENT_TYPES, E as EVENT_TYPES, J as ElementEventType, D as ElementOptions, H as ElementType, z as ElementsOptions, F as FetchQuoteInput, q as FxService, G as GetProductsOptions, I as InventoryService, L as LinkService, p as LiteService, M as MESSAGE_TYPES, O as OrderQueries, P as PriceQuote, d as QuoteBundleSelectionInput, Q as QuoteCompositeSelectionInput, f as QuoteDynamicBuckets, e as QuoteStatus, g as QuoteUiMessage, R as RefreshQuoteInput, i as RefreshQuoteResult, S as SchedulingService, x as createElements, l as generateIdempotencyKey } from './client-FNZzXO_v.js';
2
+ import './payment-CO2tRThu.js';
3
3
 
4
4
  type Operator = "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains" | "startsWith";
5
5
  type SortOrder = "asc" | "desc";
package/dist/advanced.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkFLPI2VVJ_js = require('./chunk-FLPI2VVJ.js');
4
- var chunkREPTMTQ4_js = require('./chunk-REPTMTQ4.js');
5
- require('./chunk-J65U5SED.js');
4
+ var chunk6SRY4DPY_js = require('./chunk-6SRY4DPY.js');
5
+ require('./chunk-RYQ5IPWX.js');
6
6
 
7
7
 
8
8
 
@@ -16,77 +16,77 @@ Object.defineProperty(exports, "query", {
16
16
  });
17
17
  Object.defineProperty(exports, "AuthService", {
18
18
  enumerable: true,
19
- get: function () { return chunkREPTMTQ4_js.AuthService; }
19
+ get: function () { return chunk6SRY4DPY_js.AuthService; }
20
20
  });
21
21
  Object.defineProperty(exports, "BusinessService", {
22
22
  enumerable: true,
23
- get: function () { return chunkREPTMTQ4_js.BusinessService; }
23
+ get: function () { return chunk6SRY4DPY_js.BusinessService; }
24
24
  });
25
25
  Object.defineProperty(exports, "CartOperations", {
26
26
  enumerable: true,
27
- get: function () { return chunkREPTMTQ4_js.CartOperations; }
27
+ get: function () { return chunk6SRY4DPY_js.CartOperations; }
28
28
  });
29
29
  Object.defineProperty(exports, "CatalogueQueries", {
30
30
  enumerable: true,
31
- get: function () { return chunkREPTMTQ4_js.CatalogueQueries; }
31
+ get: function () { return chunk6SRY4DPY_js.CatalogueQueries; }
32
32
  });
33
33
  Object.defineProperty(exports, "CheckoutOperations", {
34
34
  enumerable: true,
35
- get: function () { return chunkREPTMTQ4_js.CheckoutService; }
35
+ get: function () { return chunk6SRY4DPY_js.CheckoutService; }
36
36
  });
37
37
  Object.defineProperty(exports, "CheckoutService", {
38
38
  enumerable: true,
39
- get: function () { return chunkREPTMTQ4_js.CheckoutService; }
39
+ get: function () { return chunk6SRY4DPY_js.CheckoutService; }
40
40
  });
41
41
  Object.defineProperty(exports, "CimplifyElement", {
42
42
  enumerable: true,
43
- get: function () { return chunkREPTMTQ4_js.CimplifyElement; }
43
+ get: function () { return chunk6SRY4DPY_js.CimplifyElement; }
44
44
  });
45
45
  Object.defineProperty(exports, "CimplifyElements", {
46
46
  enumerable: true,
47
- get: function () { return chunkREPTMTQ4_js.CimplifyElements; }
47
+ get: function () { return chunk6SRY4DPY_js.CimplifyElements; }
48
48
  });
49
49
  Object.defineProperty(exports, "ELEMENT_TYPES", {
50
50
  enumerable: true,
51
- get: function () { return chunkREPTMTQ4_js.ELEMENT_TYPES; }
51
+ get: function () { return chunk6SRY4DPY_js.ELEMENT_TYPES; }
52
52
  });
53
53
  Object.defineProperty(exports, "EVENT_TYPES", {
54
54
  enumerable: true,
55
- get: function () { return chunkREPTMTQ4_js.EVENT_TYPES; }
55
+ get: function () { return chunk6SRY4DPY_js.EVENT_TYPES; }
56
56
  });
57
57
  Object.defineProperty(exports, "FxService", {
58
58
  enumerable: true,
59
- get: function () { return chunkREPTMTQ4_js.FxService; }
59
+ get: function () { return chunk6SRY4DPY_js.FxService; }
60
60
  });
61
61
  Object.defineProperty(exports, "InventoryService", {
62
62
  enumerable: true,
63
- get: function () { return chunkREPTMTQ4_js.InventoryService; }
63
+ get: function () { return chunk6SRY4DPY_js.InventoryService; }
64
64
  });
65
65
  Object.defineProperty(exports, "LinkService", {
66
66
  enumerable: true,
67
- get: function () { return chunkREPTMTQ4_js.LinkService; }
67
+ get: function () { return chunk6SRY4DPY_js.LinkService; }
68
68
  });
69
69
  Object.defineProperty(exports, "LiteService", {
70
70
  enumerable: true,
71
- get: function () { return chunkREPTMTQ4_js.LiteService; }
71
+ get: function () { return chunk6SRY4DPY_js.LiteService; }
72
72
  });
73
73
  Object.defineProperty(exports, "MESSAGE_TYPES", {
74
74
  enumerable: true,
75
- get: function () { return chunkREPTMTQ4_js.MESSAGE_TYPES; }
75
+ get: function () { return chunk6SRY4DPY_js.MESSAGE_TYPES; }
76
76
  });
77
77
  Object.defineProperty(exports, "OrderQueries", {
78
78
  enumerable: true,
79
- get: function () { return chunkREPTMTQ4_js.OrderQueries; }
79
+ get: function () { return chunk6SRY4DPY_js.OrderQueries; }
80
80
  });
81
81
  Object.defineProperty(exports, "SchedulingService", {
82
82
  enumerable: true,
83
- get: function () { return chunkREPTMTQ4_js.SchedulingService; }
83
+ get: function () { return chunk6SRY4DPY_js.SchedulingService; }
84
84
  });
85
85
  Object.defineProperty(exports, "createElements", {
86
86
  enumerable: true,
87
- get: function () { return chunkREPTMTQ4_js.createElements; }
87
+ get: function () { return chunk6SRY4DPY_js.createElements; }
88
88
  });
89
89
  Object.defineProperty(exports, "generateIdempotencyKey", {
90
90
  enumerable: true,
91
- get: function () { return chunkREPTMTQ4_js.generateIdempotencyKey; }
91
+ get: function () { return chunk6SRY4DPY_js.generateIdempotencyKey; }
92
92
  });
package/dist/advanced.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  export { QueryBuilder, query } from './chunk-LM3CJ4L7.mjs';
2
- 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-GFKBH7R2.mjs';
3
- import './chunk-OVM5YWM5.mjs';
2
+ 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-7ACYNCNM.mjs';
3
+ import './chunk-FTL2SXCG.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJ65U5SED_js = require('./chunk-J65U5SED.js');
3
+ var chunkRYQ5IPWX_js = require('./chunk-RYQ5IPWX.js');
4
4
 
5
5
  // src/types/result.ts
6
6
  function ok(value) {
@@ -74,11 +74,11 @@ function combineObject(results) {
74
74
 
75
75
  // src/internal/safe.ts
76
76
  function toCimplifyError(error) {
77
- if (error instanceof chunkJ65U5SED_js.CimplifyError) return chunkJ65U5SED_js.enrichError(error);
77
+ if (error instanceof chunkRYQ5IPWX_js.CimplifyError) return chunkRYQ5IPWX_js.enrichError(error);
78
78
  if (error instanceof Error) {
79
- return chunkJ65U5SED_js.enrichError(new chunkJ65U5SED_js.CimplifyError(chunkJ65U5SED_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
79
+ return chunkRYQ5IPWX_js.enrichError(new chunkRYQ5IPWX_js.CimplifyError(chunkRYQ5IPWX_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
80
80
  }
81
- return chunkJ65U5SED_js.enrichError(new chunkJ65U5SED_js.CimplifyError(chunkJ65U5SED_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
81
+ return chunkRYQ5IPWX_js.enrichError(new chunkRYQ5IPWX_js.CimplifyError(chunkRYQ5IPWX_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
82
82
  }
83
83
  async function safe(promise) {
84
84
  try {
@@ -263,7 +263,8 @@ var CatalogueQueries = class {
263
263
  sort_order: options?.sort_order,
264
264
  limit: options?.limit,
265
265
  offset: options?.offset,
266
- cursor: options?.cursor
266
+ cursor: options?.cursor,
267
+ properties: options?.properties ? JSON.stringify(options.properties) : void 0
267
268
  });
268
269
  const result = await safe(this.client.get(path));
269
270
  if (!result.ok) return result;
@@ -322,9 +323,13 @@ var CatalogueQueries = class {
322
323
  const encodedSlug = encodeURIComponent(slug);
323
324
  return safe(this.client.get(`/api/v1/catalogue/categories/slug/${encodedSlug}`));
324
325
  }
325
- async getCategoryProducts(categoryId) {
326
+ async getCategoryProducts(categoryId, options) {
326
327
  const encodedId = encodeURIComponent(categoryId);
327
- return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}/products`));
328
+ const path = withQuery(`/api/v1/catalogue/categories/${encodedId}/products`, {
329
+ limit: options?.limit,
330
+ offset: options?.offset
331
+ });
332
+ return safe(this.client.get(path));
328
333
  }
329
334
  async getCollections() {
330
335
  return safe(this.client.get("/api/v1/catalogue/collections"));
@@ -337,9 +342,13 @@ var CatalogueQueries = class {
337
342
  const encodedSlug = encodeURIComponent(slug);
338
343
  return safe(this.client.get(`/api/v1/catalogue/collections/slug/${encodedSlug}`));
339
344
  }
340
- async getCollectionProducts(collectionId) {
345
+ async getCollectionProducts(collectionId, options) {
341
346
  const encodedId = encodeURIComponent(collectionId);
342
- return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}/products`));
347
+ const path = withQuery(`/api/v1/catalogue/collections/${encodedId}/products`, {
348
+ limit: options?.limit,
349
+ offset: options?.offset
350
+ });
351
+ return safe(this.client.get(path));
343
352
  }
344
353
  async searchCollections(query, limit = 20) {
345
354
  const path = withQuery("/api/v1/catalogue/collections", { search: query, limit });
@@ -439,8 +448,8 @@ var CatalogueQueries = class {
439
448
  }
440
449
  async search(query, options) {
441
450
  const result = await this.getProducts({
451
+ ...options,
442
452
  search: query,
443
- category: options?.category,
444
453
  limit: options?.limit ?? 20
445
454
  });
446
455
  if (!result.ok) return result;
@@ -474,6 +483,36 @@ var CatalogueQueries = class {
474
483
  });
475
484
  return safe(this.client.get(path));
476
485
  }
486
+ async getAttributeDefinitions() {
487
+ return safe(this.client.get("/api/v1/catalogue/attributes"));
488
+ }
489
+ async getPropertyFacets(options) {
490
+ const path = withQuery("/api/v1/catalogue/properties/facets", {
491
+ category_id: options?.category_id,
492
+ product_type: options?.product_type
493
+ });
494
+ return safe(this.client.get(path));
495
+ }
496
+ async getTaxonomyAttributes(taxonomyId) {
497
+ const encodedId = encodeURIComponent(taxonomyId);
498
+ return safe(
499
+ this.client.get(
500
+ `/api/v1/catalogue/taxonomies/${encodedId}/attributes`
501
+ )
502
+ );
503
+ }
504
+ async searchKnowledge(query, limit) {
505
+ const path = withQuery("/api/v1/catalogue/knowledge-base/search", {
506
+ q: query,
507
+ limit: limit ?? 5
508
+ });
509
+ return safe(this.client.get(path));
510
+ }
511
+ async getKnowledgeArticles() {
512
+ return safe(
513
+ this.client.get("/api/v1/catalogue/knowledge-base/articles")
514
+ );
515
+ }
477
516
  };
478
517
 
479
518
  // src/cart.ts
@@ -934,7 +973,7 @@ var CheckoutResolver = class {
934
973
  }
935
974
  }
936
975
  }
937
- if (checkoutResult.requires_authorization || chunkJ65U5SED_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
976
+ if (checkoutResult.requires_authorization || chunkRYQ5IPWX_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
938
977
  const authorization = await this.handleAuthorization({
939
978
  authorizationType,
940
979
  paymentReference,
@@ -1108,18 +1147,18 @@ var CheckoutResolver = class {
1108
1147
  if (statusResult.value.reference) {
1109
1148
  paymentReference = statusResult.value.reference;
1110
1149
  }
1111
- const normalized = chunkJ65U5SED_js.normalizeStatusResponse(statusResult.value);
1112
- if (normalized.paid || chunkJ65U5SED_js.isPaymentStatusSuccess(normalized.status)) {
1150
+ const normalized = chunkRYQ5IPWX_js.normalizeStatusResponse(statusResult.value);
1151
+ if (normalized.paid || chunkRYQ5IPWX_js.isPaymentStatusSuccess(normalized.status)) {
1113
1152
  return this.finalizeSuccess(latestCheckoutResult);
1114
1153
  }
1115
- if (chunkJ65U5SED_js.isPaymentStatusFailure(normalized.status)) {
1154
+ if (chunkRYQ5IPWX_js.isPaymentStatusFailure(normalized.status)) {
1116
1155
  return this.fail(
1117
1156
  normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
1118
1157
  normalized.message || "Payment failed during confirmation.",
1119
1158
  false
1120
1159
  );
1121
1160
  }
1122
- if (chunkJ65U5SED_js.isPaymentStatusRequiresAction(normalized.status)) {
1161
+ if (chunkRYQ5IPWX_js.isPaymentStatusRequiresAction(normalized.status)) {
1123
1162
  const authorization = await this.handleAuthorization({
1124
1163
  authorizationType,
1125
1164
  paymentReference,
@@ -1150,8 +1189,8 @@ var CheckoutResolver = class {
1150
1189
  try {
1151
1190
  const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
1152
1191
  if (finalResult.ok) {
1153
- const normalized = chunkJ65U5SED_js.normalizeStatusResponse(finalResult.value);
1154
- if (normalized.paid || chunkJ65U5SED_js.isPaymentStatusSuccess(normalized.status)) {
1192
+ const normalized = chunkRYQ5IPWX_js.normalizeStatusResponse(finalResult.value);
1193
+ if (normalized.paid || chunkRYQ5IPWX_js.isPaymentStatusSuccess(normalized.status)) {
1155
1194
  return this.finalizeSuccess(latestCheckoutResult);
1156
1195
  }
1157
1196
  }
@@ -1347,12 +1386,12 @@ var CheckoutResolver = class {
1347
1386
  };
1348
1387
  }
1349
1388
  isSuccessfulStatus(status) {
1350
- const normalized = chunkJ65U5SED_js.normalizeStatusResponse({ status, paid: false });
1351
- return normalized.paid || chunkJ65U5SED_js.isPaymentStatusSuccess(normalized.status);
1389
+ const normalized = chunkRYQ5IPWX_js.normalizeStatusResponse({ status, paid: false });
1390
+ return normalized.paid || chunkRYQ5IPWX_js.isPaymentStatusSuccess(normalized.status);
1352
1391
  }
1353
1392
  isFailureStatus(status) {
1354
- const normalized = chunkJ65U5SED_js.normalizeStatusResponse({ status, paid: false });
1355
- return chunkJ65U5SED_js.isPaymentStatusFailure(normalized.status);
1393
+ const normalized = chunkRYQ5IPWX_js.normalizeStatusResponse({ status, paid: false });
1394
+ return chunkRYQ5IPWX_js.isPaymentStatusFailure(normalized.status);
1356
1395
  }
1357
1396
  ensureNotAborted() {
1358
1397
  if (this.signal?.aborted) {
@@ -1423,7 +1462,7 @@ var CheckoutService = class {
1423
1462
  }
1424
1463
  async initializePayment(_orderId, _method) {
1425
1464
  return err(
1426
- new chunkJ65U5SED_js.CimplifyError(
1465
+ new chunkRYQ5IPWX_js.CimplifyError(
1427
1466
  "NOT_IMPLEMENTED",
1428
1467
  "initializePayment is not available in REST mode.",
1429
1468
  false
@@ -1495,11 +1534,11 @@ var CheckoutService = class {
1495
1534
  pay_currency: data.pay_currency,
1496
1535
  fx_quote_id: data.fx_quote_id
1497
1536
  };
1498
- const baseCurrency = chunkJ65U5SED_js.currencyCode(
1537
+ const baseCurrency = chunkRYQ5IPWX_js.currencyCode(
1499
1538
  (cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
1500
1539
  );
1501
1540
  const payCurrency = data.pay_currency?.trim().toUpperCase();
1502
- const payCurrencyCode = payCurrency ? chunkJ65U5SED_js.currencyCode(payCurrency) : void 0;
1541
+ const payCurrencyCode = payCurrency ? chunkRYQ5IPWX_js.currencyCode(payCurrency) : void 0;
1503
1542
  const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
1504
1543
  if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
1505
1544
  const fxQuoteResult = await this.client.fx.lockQuote({
@@ -1822,7 +1861,7 @@ var BusinessService = class {
1822
1861
  if (!result.ok) return err(result.error);
1823
1862
  const location = result.value.find((item) => item.id === locationId);
1824
1863
  if (!location) {
1825
- return err(new chunkJ65U5SED_js.CimplifyError(chunkJ65U5SED_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
1864
+ return err(new chunkRYQ5IPWX_js.CimplifyError(chunkRYQ5IPWX_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
1826
1865
  }
1827
1866
  return ok(location);
1828
1867
  }
@@ -2096,7 +2135,7 @@ var EVENT_TYPES = {
2096
2135
 
2097
2136
  // src/elements.ts
2098
2137
  function toCheckoutError(code, message, recoverable) {
2099
- const hint = chunkJ65U5SED_js.getErrorHint(code);
2138
+ const hint = chunkRYQ5IPWX_js.getErrorHint(code);
2100
2139
  return {
2101
2140
  success: false,
2102
2141
  error: {
@@ -1,4 +1,4 @@
1
- import { CimplifyError, currencyCode, ErrorCode, isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure, getErrorHint, enrichError } from './chunk-OVM5YWM5.mjs';
1
+ import { CimplifyError, currencyCode, ErrorCode, isPaymentStatusRequiresAction, normalizeStatusResponse, isPaymentStatusSuccess, isPaymentStatusFailure, getErrorHint, enrichError } from './chunk-FTL2SXCG.mjs';
2
2
 
3
3
  // src/types/result.ts
4
4
  function ok(value) {
@@ -261,7 +261,8 @@ var CatalogueQueries = class {
261
261
  sort_order: options?.sort_order,
262
262
  limit: options?.limit,
263
263
  offset: options?.offset,
264
- cursor: options?.cursor
264
+ cursor: options?.cursor,
265
+ properties: options?.properties ? JSON.stringify(options.properties) : void 0
265
266
  });
266
267
  const result = await safe(this.client.get(path));
267
268
  if (!result.ok) return result;
@@ -320,9 +321,13 @@ var CatalogueQueries = class {
320
321
  const encodedSlug = encodeURIComponent(slug);
321
322
  return safe(this.client.get(`/api/v1/catalogue/categories/slug/${encodedSlug}`));
322
323
  }
323
- async getCategoryProducts(categoryId) {
324
+ async getCategoryProducts(categoryId, options) {
324
325
  const encodedId = encodeURIComponent(categoryId);
325
- return safe(this.client.get(`/api/v1/catalogue/categories/${encodedId}/products`));
326
+ const path = withQuery(`/api/v1/catalogue/categories/${encodedId}/products`, {
327
+ limit: options?.limit,
328
+ offset: options?.offset
329
+ });
330
+ return safe(this.client.get(path));
326
331
  }
327
332
  async getCollections() {
328
333
  return safe(this.client.get("/api/v1/catalogue/collections"));
@@ -335,9 +340,13 @@ var CatalogueQueries = class {
335
340
  const encodedSlug = encodeURIComponent(slug);
336
341
  return safe(this.client.get(`/api/v1/catalogue/collections/slug/${encodedSlug}`));
337
342
  }
338
- async getCollectionProducts(collectionId) {
343
+ async getCollectionProducts(collectionId, options) {
339
344
  const encodedId = encodeURIComponent(collectionId);
340
- return safe(this.client.get(`/api/v1/catalogue/collections/${encodedId}/products`));
345
+ const path = withQuery(`/api/v1/catalogue/collections/${encodedId}/products`, {
346
+ limit: options?.limit,
347
+ offset: options?.offset
348
+ });
349
+ return safe(this.client.get(path));
341
350
  }
342
351
  async searchCollections(query, limit = 20) {
343
352
  const path = withQuery("/api/v1/catalogue/collections", { search: query, limit });
@@ -437,8 +446,8 @@ var CatalogueQueries = class {
437
446
  }
438
447
  async search(query, options) {
439
448
  const result = await this.getProducts({
449
+ ...options,
440
450
  search: query,
441
- category: options?.category,
442
451
  limit: options?.limit ?? 20
443
452
  });
444
453
  if (!result.ok) return result;
@@ -472,6 +481,36 @@ var CatalogueQueries = class {
472
481
  });
473
482
  return safe(this.client.get(path));
474
483
  }
484
+ async getAttributeDefinitions() {
485
+ return safe(this.client.get("/api/v1/catalogue/attributes"));
486
+ }
487
+ async getPropertyFacets(options) {
488
+ const path = withQuery("/api/v1/catalogue/properties/facets", {
489
+ category_id: options?.category_id,
490
+ product_type: options?.product_type
491
+ });
492
+ return safe(this.client.get(path));
493
+ }
494
+ async getTaxonomyAttributes(taxonomyId) {
495
+ const encodedId = encodeURIComponent(taxonomyId);
496
+ return safe(
497
+ this.client.get(
498
+ `/api/v1/catalogue/taxonomies/${encodedId}/attributes`
499
+ )
500
+ );
501
+ }
502
+ async searchKnowledge(query, limit) {
503
+ const path = withQuery("/api/v1/catalogue/knowledge-base/search", {
504
+ q: query,
505
+ limit: limit ?? 5
506
+ });
507
+ return safe(this.client.get(path));
508
+ }
509
+ async getKnowledgeArticles() {
510
+ return safe(
511
+ this.client.get("/api/v1/catalogue/knowledge-base/articles")
512
+ );
513
+ }
475
514
  };
476
515
 
477
516
  // src/cart.ts
@@ -1,5 +1,5 @@
1
- import { CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-GFKBH7R2.mjs';
2
- import { CimplifyError, ErrorCode, enrichError } from './chunk-OVM5YWM5.mjs';
1
+ import { CatalogueQueries, CartOperations, CheckoutService, OrderQueries, LinkService, AuthService, BusinessService, InventoryService, SchedulingService, LiteService, FxService, createElements } from './chunk-7ACYNCNM.mjs';
2
+ import { CimplifyError, ErrorCode, enrichError } from './chunk-FTL2SXCG.mjs';
3
3
 
4
4
  // src/activity.ts
5
5
  var ActivityService = class {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkREPTMTQ4_js = require('./chunk-REPTMTQ4.js');
4
- var chunkJ65U5SED_js = require('./chunk-J65U5SED.js');
3
+ var chunk6SRY4DPY_js = require('./chunk-6SRY4DPY.js');
4
+ var chunkRYQ5IPWX_js = require('./chunk-RYQ5IPWX.js');
5
5
 
6
6
  // src/activity.ts
7
7
  var ActivityService = class {
@@ -62,16 +62,16 @@ function isRetryable(error) {
62
62
  if (error instanceof DOMException && error.name === "AbortError") {
63
63
  return true;
64
64
  }
65
- if (error instanceof chunkJ65U5SED_js.CimplifyError) {
65
+ if (error instanceof chunkRYQ5IPWX_js.CimplifyError) {
66
66
  return error.retryable;
67
67
  }
68
68
  return false;
69
69
  }
70
70
  function toNetworkError(error, isTestMode) {
71
71
  if (error instanceof DOMException && error.name === "AbortError") {
72
- return chunkJ65U5SED_js.enrichError(
73
- new chunkJ65U5SED_js.CimplifyError(
74
- chunkJ65U5SED_js.ErrorCode.TIMEOUT,
72
+ return chunkRYQ5IPWX_js.enrichError(
73
+ new chunkRYQ5IPWX_js.CimplifyError(
74
+ chunkRYQ5IPWX_js.ErrorCode.TIMEOUT,
75
75
  "Request timed out. Please check your connection and try again.",
76
76
  true
77
77
  ),
@@ -79,21 +79,21 @@ function toNetworkError(error, isTestMode) {
79
79
  );
80
80
  }
81
81
  if (error instanceof TypeError && error.message.includes("fetch")) {
82
- return chunkJ65U5SED_js.enrichError(
83
- new chunkJ65U5SED_js.CimplifyError(
84
- chunkJ65U5SED_js.ErrorCode.NETWORK_ERROR,
82
+ return chunkRYQ5IPWX_js.enrichError(
83
+ new chunkRYQ5IPWX_js.CimplifyError(
84
+ chunkRYQ5IPWX_js.ErrorCode.NETWORK_ERROR,
85
85
  "Network error. Please check your internet connection.",
86
86
  true
87
87
  ),
88
88
  { isTestMode }
89
89
  );
90
90
  }
91
- if (error instanceof chunkJ65U5SED_js.CimplifyError) {
92
- return chunkJ65U5SED_js.enrichError(error, { isTestMode });
91
+ if (error instanceof chunkRYQ5IPWX_js.CimplifyError) {
92
+ return chunkRYQ5IPWX_js.enrichError(error, { isTestMode });
93
93
  }
94
- return chunkJ65U5SED_js.enrichError(
95
- new chunkJ65U5SED_js.CimplifyError(
96
- chunkJ65U5SED_js.ErrorCode.UNKNOWN_ERROR,
94
+ return chunkRYQ5IPWX_js.enrichError(
95
+ new chunkRYQ5IPWX_js.CimplifyError(
96
+ chunkRYQ5IPWX_js.ErrorCode.UNKNOWN_ERROR,
97
97
  error instanceof Error ? error.message : "An unknown error occurred",
98
98
  false
99
99
  ),
@@ -260,8 +260,8 @@ var CimplifyClient = class {
260
260
  this.businessIdResolvePromise = (async () => {
261
261
  const result = await this.business.getInfo();
262
262
  if (!result.ok || !result.value?.id) {
263
- throw new chunkJ65U5SED_js.CimplifyError(
264
- chunkJ65U5SED_js.ErrorCode.NOT_FOUND,
263
+ throw new chunkRYQ5IPWX_js.CimplifyError(
264
+ chunkRYQ5IPWX_js.ErrorCode.NOT_FOUND,
265
265
  "Unable to resolve business ID from the current public key.",
266
266
  true
267
267
  );
@@ -378,7 +378,7 @@ var CimplifyClient = class {
378
378
  if (response.status >= 400 && response.status < 500) {
379
379
  this.hooks.onRequestError?.({
380
380
  ...context,
381
- error: new chunkJ65U5SED_js.CimplifyError(
381
+ error: new chunkRYQ5IPWX_js.CimplifyError(
382
382
  `HTTP_${response.status}`,
383
383
  `Request failed with status ${response.status}`,
384
384
  false
@@ -404,7 +404,7 @@ var CimplifyClient = class {
404
404
  }
405
405
  this.hooks.onRequestError?.({
406
406
  ...context,
407
- error: new chunkJ65U5SED_js.CimplifyError(
407
+ error: new chunkRYQ5IPWX_js.CimplifyError(
408
408
  "SERVER_ERROR",
409
409
  `Server error ${response.status} after ${retryCount} retries`,
410
410
  false
@@ -535,15 +535,15 @@ var CimplifyClient = class {
535
535
  const errorCode = typeof json.error === "object" && json.error?.error_code || typeof json.error === "object" && json.error?.code || "API_ERROR";
536
536
  const errorMessage = typeof json.error === "object" && json.error?.error_message || typeof json.error === "object" && json.error?.message || typeof json.error === "string" && json.error || typeof json.message === "string" && json.message || "An error occurred";
537
537
  const retryable = typeof json.error === "object" && typeof json.error?.retryable === "boolean" ? json.error.retryable : false;
538
- const error = chunkJ65U5SED_js.enrichError(
539
- new chunkJ65U5SED_js.CimplifyError(
538
+ const error = chunkRYQ5IPWX_js.enrichError(
539
+ new chunkRYQ5IPWX_js.CimplifyError(
540
540
  errorCode,
541
541
  errorMessage,
542
542
  retryable
543
543
  ),
544
544
  { isTestMode: this.isTestMode() }
545
545
  );
546
- if (response.status === 401 || error.code === chunkJ65U5SED_js.ErrorCode.UNAUTHORIZED) {
546
+ if (response.status === 401 || error.code === chunkRYQ5IPWX_js.ErrorCode.UNAUTHORIZED) {
547
547
  console.warn(
548
548
  "[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
549
549
  );
@@ -551,8 +551,8 @@ var CimplifyClient = class {
551
551
  throw error;
552
552
  }
553
553
  if (json?.success === false || json?.error?.code || json?.error?.message) {
554
- const error = chunkJ65U5SED_js.enrichError(
555
- new chunkJ65U5SED_js.CimplifyError(
554
+ const error = chunkRYQ5IPWX_js.enrichError(
555
+ new chunkRYQ5IPWX_js.CimplifyError(
556
556
  json.error?.code || "API_ERROR",
557
557
  json.error?.message || "An error occurred",
558
558
  json.error?.retryable || false
@@ -568,67 +568,67 @@ var CimplifyClient = class {
568
568
  }
569
569
  get catalogue() {
570
570
  if (!this._catalogue) {
571
- this._catalogue = new chunkREPTMTQ4_js.CatalogueQueries(this);
571
+ this._catalogue = new chunk6SRY4DPY_js.CatalogueQueries(this);
572
572
  }
573
573
  return this._catalogue;
574
574
  }
575
575
  get cart() {
576
576
  if (!this._cart) {
577
- this._cart = new chunkREPTMTQ4_js.CartOperations(this);
577
+ this._cart = new chunk6SRY4DPY_js.CartOperations(this);
578
578
  }
579
579
  return this._cart;
580
580
  }
581
581
  get checkout() {
582
582
  if (!this._checkout) {
583
- this._checkout = new chunkREPTMTQ4_js.CheckoutService(this);
583
+ this._checkout = new chunk6SRY4DPY_js.CheckoutService(this);
584
584
  }
585
585
  return this._checkout;
586
586
  }
587
587
  get orders() {
588
588
  if (!this._orders) {
589
- this._orders = new chunkREPTMTQ4_js.OrderQueries(this);
589
+ this._orders = new chunk6SRY4DPY_js.OrderQueries(this);
590
590
  }
591
591
  return this._orders;
592
592
  }
593
593
  get link() {
594
594
  if (!this._link) {
595
- this._link = new chunkREPTMTQ4_js.LinkService(this);
595
+ this._link = new chunk6SRY4DPY_js.LinkService(this);
596
596
  }
597
597
  return this._link;
598
598
  }
599
599
  get auth() {
600
600
  if (!this._auth) {
601
- this._auth = new chunkREPTMTQ4_js.AuthService(this);
601
+ this._auth = new chunk6SRY4DPY_js.AuthService(this);
602
602
  }
603
603
  return this._auth;
604
604
  }
605
605
  get business() {
606
606
  if (!this._business) {
607
- this._business = new chunkREPTMTQ4_js.BusinessService(this);
607
+ this._business = new chunk6SRY4DPY_js.BusinessService(this);
608
608
  }
609
609
  return this._business;
610
610
  }
611
611
  get inventory() {
612
612
  if (!this._inventory) {
613
- this._inventory = new chunkREPTMTQ4_js.InventoryService(this);
613
+ this._inventory = new chunk6SRY4DPY_js.InventoryService(this);
614
614
  }
615
615
  return this._inventory;
616
616
  }
617
617
  get scheduling() {
618
618
  if (!this._scheduling) {
619
- this._scheduling = new chunkREPTMTQ4_js.SchedulingService(this);
619
+ this._scheduling = new chunk6SRY4DPY_js.SchedulingService(this);
620
620
  }
621
621
  return this._scheduling;
622
622
  }
623
623
  get lite() {
624
624
  if (!this._lite) {
625
- this._lite = new chunkREPTMTQ4_js.LiteService(this);
625
+ this._lite = new chunk6SRY4DPY_js.LiteService(this);
626
626
  }
627
627
  return this._lite;
628
628
  }
629
629
  get fx() {
630
630
  if (!this._fx) {
631
- this._fx = new chunkREPTMTQ4_js.FxService(this);
631
+ this._fx = new chunk6SRY4DPY_js.FxService(this);
632
632
  }
633
633
  return this._fx;
634
634
  }
@@ -642,7 +642,7 @@ var CimplifyClient = class {
642
642
  if (businessId) {
643
643
  this.setBusinessId(businessId);
644
644
  }
645
- return chunkREPTMTQ4_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
645
+ return chunk6SRY4DPY_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
646
646
  }
647
647
  };
648
648
  function createCimplifyClient(config = {}) {