@cimplify/sdk 0.44.14 → 0.44.18

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 (85) hide show
  1. package/dist/advanced.d.mts +1 -1
  2. package/dist/advanced.d.ts +1 -1
  3. package/dist/advanced.js +22 -21
  4. package/dist/advanced.mjs +3 -2
  5. package/dist/{chunk-OMAP327U.js → chunk-3FS3ZDKX.js} +62 -61
  6. package/dist/chunk-53J2WE4S.js +657 -0
  7. package/dist/{chunk-3WD6U5RD.mjs → chunk-5OK3YDZC.mjs} +4 -3
  8. package/dist/{chunk-V2O5AO7I.js → chunk-BN2CXGMO.js} +5 -246
  9. package/dist/chunk-CCSONJCO.js +8824 -0
  10. package/dist/{chunk-BAWKQRIB.js → chunk-HBRCVJL4.js} +22 -21
  11. package/dist/chunk-MJBSVUHO.mjs +8822 -0
  12. package/dist/{chunk-6TVQQYQ5.mjs → chunk-NRT6PVW5.mjs} +4 -231
  13. package/dist/chunk-QBQCMQ4F.js +271 -0
  14. package/dist/chunk-VDH3O7UB.mjs +604 -0
  15. package/dist/chunk-XPXAZXF2.mjs +250 -0
  16. package/dist/{chunk-EZK2FXTM.mjs → chunk-XZPO5GEM.mjs} +2 -1
  17. package/dist/cli/commands/deploy.mjs +9 -1
  18. package/dist/client-B_Ei3ENB.d.mts +86 -0
  19. package/dist/client-Bep2FooI.d.ts +86 -0
  20. package/dist/{client-lvLvB1_K.d.ts → client-D6ZisKco.d.ts} +7 -0
  21. package/dist/{client-CkGlXZRd.d.mts → client-Dh-bHyhU.d.mts} +7 -0
  22. package/dist/index.d.mts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +145 -144
  25. package/dist/index.mjs +4 -3
  26. package/dist/mock/cli.mjs +2 -1
  27. package/dist/mock/library.js +2 -1
  28. package/dist/mock/library.mjs +2 -1
  29. package/dist/mock/msw.js +2 -1
  30. package/dist/mock/msw.mjs +2 -1
  31. package/dist/react.d.mts +1 -1
  32. package/dist/react.d.ts +1 -1
  33. package/dist/react.js +81 -80
  34. package/dist/react.mjs +4 -3
  35. package/dist/server-CWpUlLOQ.d.mts +1003 -0
  36. package/dist/server-CWpUlLOQ.d.ts +1003 -0
  37. package/dist/server.d.mts +2 -2
  38. package/dist/server.d.ts +2 -2
  39. package/dist/server.js +6 -5
  40. package/dist/server.mjs +4 -3
  41. package/dist/testing/msw.d.mts +17 -0
  42. package/dist/testing/msw.d.ts +17 -0
  43. package/dist/testing/msw.js +42 -0
  44. package/dist/testing/msw.mjs +40 -0
  45. package/dist/testing/suite.d.mts +85 -0
  46. package/dist/testing/suite.d.ts +85 -0
  47. package/dist/testing/suite.js +174 -0
  48. package/dist/testing/suite.mjs +170 -0
  49. package/dist/testing.d.mts +1885 -0
  50. package/dist/testing.d.ts +1885 -0
  51. package/dist/testing.js +261 -0
  52. package/dist/testing.mjs +51 -0
  53. package/dist/utils.js +29 -28
  54. package/dist/utils.mjs +2 -1
  55. package/package.json +28 -4
  56. package/templates/storefront-bakery/__tests__/brand.test.ts +4 -0
  57. package/templates/storefront-bakery/__tests__/cart-flow.test.ts +4 -0
  58. package/templates/storefront-bakery/__tests__/contract.test.ts +4 -0
  59. package/templates/storefront-bakery/package.json +11 -3
  60. package/templates/storefront-bakery/vitest.config.ts +9 -0
  61. package/templates/storefront-fashion/__tests__/brand.test.ts +4 -0
  62. package/templates/storefront-fashion/__tests__/cart-flow.test.ts +4 -0
  63. package/templates/storefront-fashion/__tests__/contract.test.ts +4 -0
  64. package/templates/storefront-fashion/package.json +11 -3
  65. package/templates/storefront-fashion/vitest.config.ts +9 -0
  66. package/templates/storefront-grocery/__tests__/brand.test.ts +4 -0
  67. package/templates/storefront-grocery/__tests__/cart-flow.test.ts +4 -0
  68. package/templates/storefront-grocery/__tests__/contract.test.ts +4 -0
  69. package/templates/storefront-grocery/package.json +11 -3
  70. package/templates/storefront-grocery/vitest.config.ts +9 -0
  71. package/templates/storefront-restaurant/__tests__/brand.test.ts +4 -0
  72. package/templates/storefront-restaurant/__tests__/cart-flow.test.ts +4 -0
  73. package/templates/storefront-restaurant/__tests__/contract.test.ts +4 -0
  74. package/templates/storefront-restaurant/package.json +11 -3
  75. package/templates/storefront-restaurant/vitest.config.ts +9 -0
  76. package/templates/storefront-retail/__tests__/brand.test.ts +4 -0
  77. package/templates/storefront-retail/__tests__/cart-flow.test.ts +4 -0
  78. package/templates/storefront-retail/__tests__/contract.test.ts +4 -0
  79. package/templates/storefront-retail/package.json +11 -3
  80. package/templates/storefront-retail/vitest.config.ts +9 -0
  81. package/templates/storefront-services/__tests__/brand.test.ts +4 -0
  82. package/templates/storefront-services/__tests__/cart-flow.test.ts +4 -0
  83. package/templates/storefront-services/__tests__/contract.test.ts +4 -0
  84. package/templates/storefront-services/package.json +11 -3
  85. package/templates/storefront-services/vitest.config.ts +9 -0
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.js');
3
+ var chunkBN2CXGMO_js = require('./chunk-BN2CXGMO.js');
4
+ var chunkQBQCMQ4F_js = require('./chunk-QBQCMQ4F.js');
4
5
 
5
6
  // src/types/result.ts
6
7
  function ok(value) {
@@ -84,11 +85,11 @@ function generateIdempotencyKey(prefix = "idem") {
84
85
 
85
86
  // src/internal/safe.ts
86
87
  function toCimplifyError(error) {
87
- if (error instanceof chunkV2O5AO7I_js.CimplifyError) return chunkV2O5AO7I_js.enrichError(error);
88
+ if (error instanceof chunkQBQCMQ4F_js.CimplifyError) return chunkQBQCMQ4F_js.enrichError(error);
88
89
  if (error instanceof Error) {
89
- return chunkV2O5AO7I_js.enrichError(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
90
+ return chunkQBQCMQ4F_js.enrichError(new chunkQBQCMQ4F_js.CimplifyError(chunkQBQCMQ4F_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
90
91
  }
91
- return chunkV2O5AO7I_js.enrichError(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
92
+ return chunkQBQCMQ4F_js.enrichError(new chunkQBQCMQ4F_js.CimplifyError(chunkQBQCMQ4F_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
92
93
  }
93
94
  async function safe(promise) {
94
95
  try {
@@ -647,7 +648,7 @@ var CartOperations = class {
647
648
  if (typeof updates.quantity !== "number") {
648
649
  return {
649
650
  ok: false,
650
- error: new chunkV2O5AO7I_js.CimplifyError(
651
+ error: new chunkQBQCMQ4F_js.CimplifyError(
651
652
  "VALIDATION_ERROR",
652
653
  "updateItem requires a quantity; richer mid-cart edits are not supported"
653
654
  )
@@ -1089,7 +1090,7 @@ var CheckoutResolver = class {
1089
1090
  }
1090
1091
  }
1091
1092
  }
1092
- if (checkoutResult.requires_authorization || chunkV2O5AO7I_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1093
+ if (checkoutResult.requires_authorization || chunkBN2CXGMO_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1093
1094
  const authorization = await this.handleAuthorization({
1094
1095
  authorizationType,
1095
1096
  paymentReference,
@@ -1263,18 +1264,18 @@ var CheckoutResolver = class {
1263
1264
  if (statusResult.value.reference) {
1264
1265
  paymentReference = statusResult.value.reference;
1265
1266
  }
1266
- const normalized = chunkV2O5AO7I_js.normalizeStatusResponse(statusResult.value);
1267
- if (normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status)) {
1267
+ const normalized = chunkBN2CXGMO_js.normalizeStatusResponse(statusResult.value);
1268
+ if (normalized.paid || chunkBN2CXGMO_js.isPaymentStatusSuccess(normalized.status)) {
1268
1269
  return this.finalizeSuccess(latestCheckoutResult);
1269
1270
  }
1270
- if (chunkV2O5AO7I_js.isPaymentStatusFailure(normalized.status)) {
1271
+ if (chunkBN2CXGMO_js.isPaymentStatusFailure(normalized.status)) {
1271
1272
  return this.fail(
1272
1273
  normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
1273
1274
  normalized.message || "Payment failed during confirmation.",
1274
1275
  false
1275
1276
  );
1276
1277
  }
1277
- if (chunkV2O5AO7I_js.isPaymentStatusRequiresAction(normalized.status)) {
1278
+ if (chunkBN2CXGMO_js.isPaymentStatusRequiresAction(normalized.status)) {
1278
1279
  const authorization = await this.handleAuthorization({
1279
1280
  authorizationType,
1280
1281
  paymentReference,
@@ -1305,8 +1306,8 @@ var CheckoutResolver = class {
1305
1306
  try {
1306
1307
  const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
1307
1308
  if (finalResult.ok) {
1308
- const normalized = chunkV2O5AO7I_js.normalizeStatusResponse(finalResult.value);
1309
- if (normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status)) {
1309
+ const normalized = chunkBN2CXGMO_js.normalizeStatusResponse(finalResult.value);
1310
+ if (normalized.paid || chunkBN2CXGMO_js.isPaymentStatusSuccess(normalized.status)) {
1310
1311
  return this.finalizeSuccess(latestCheckoutResult);
1311
1312
  }
1312
1313
  }
@@ -1502,12 +1503,12 @@ var CheckoutResolver = class {
1502
1503
  };
1503
1504
  }
1504
1505
  isSuccessfulStatus(status) {
1505
- const normalized = chunkV2O5AO7I_js.normalizeStatusResponse({ status, paid: false });
1506
- return normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status);
1506
+ const normalized = chunkBN2CXGMO_js.normalizeStatusResponse({ status, paid: false });
1507
+ return normalized.paid || chunkBN2CXGMO_js.isPaymentStatusSuccess(normalized.status);
1507
1508
  }
1508
1509
  isFailureStatus(status) {
1509
- const normalized = chunkV2O5AO7I_js.normalizeStatusResponse({ status, paid: false });
1510
- return chunkV2O5AO7I_js.isPaymentStatusFailure(normalized.status);
1510
+ const normalized = chunkBN2CXGMO_js.normalizeStatusResponse({ status, paid: false });
1511
+ return chunkBN2CXGMO_js.isPaymentStatusFailure(normalized.status);
1511
1512
  }
1512
1513
  ensureNotAborted() {
1513
1514
  if (this.signal?.aborted) {
@@ -1570,7 +1571,7 @@ var CheckoutService = class {
1570
1571
  }
1571
1572
  async initializePayment(_orderId, _method) {
1572
1573
  return err(
1573
- new chunkV2O5AO7I_js.CimplifyError(
1574
+ new chunkQBQCMQ4F_js.CimplifyError(
1574
1575
  "NOT_IMPLEMENTED",
1575
1576
  "initializePayment is not available in REST mode.",
1576
1577
  false
@@ -1642,11 +1643,11 @@ var CheckoutService = class {
1642
1643
  pay_currency: data.pay_currency,
1643
1644
  fx_quote_id: data.fx_quote_id
1644
1645
  };
1645
- const baseCurrency = chunkV2O5AO7I_js.currencyCode(
1646
+ const baseCurrency = chunkQBQCMQ4F_js.currencyCode(
1646
1647
  (cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
1647
1648
  );
1648
1649
  const payCurrency = data.pay_currency?.trim().toUpperCase();
1649
- const payCurrencyCode = payCurrency ? chunkV2O5AO7I_js.currencyCode(payCurrency) : void 0;
1650
+ const payCurrencyCode = payCurrency ? chunkQBQCMQ4F_js.currencyCode(payCurrency) : void 0;
1650
1651
  const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
1651
1652
  if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
1652
1653
  const fxQuoteResult = await this.client.fx.lockQuote({
@@ -2004,7 +2005,7 @@ var BusinessService = class {
2004
2005
  if (!result.ok) return err(result.error);
2005
2006
  const location = result.value.find((item) => item.id === locationId);
2006
2007
  if (!location) {
2007
- return err(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
2008
+ return err(new chunkQBQCMQ4F_js.CimplifyError(chunkQBQCMQ4F_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
2008
2009
  }
2009
2010
  return ok(location);
2010
2011
  }
@@ -2290,7 +2291,7 @@ var EVENT_TYPES = {
2290
2291
 
2291
2292
  // src/elements.ts
2292
2293
  function toCheckoutError(code, message, recoverable) {
2293
- const hint = chunkV2O5AO7I_js.getErrorHint(code);
2294
+ const hint = chunkQBQCMQ4F_js.getErrorHint(code);
2294
2295
  return {
2295
2296
  success: false,
2296
2297
  error: {