@cimplify/sdk 0.31.0 → 0.36.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.
Files changed (44) hide show
  1. package/dist/advanced.d.mts +6 -2
  2. package/dist/advanced.d.ts +6 -2
  3. package/dist/advanced.js +21 -21
  4. package/dist/advanced.mjs +2 -2
  5. package/dist/{chunk-46BDUSJX.mjs → chunk-2X6P5WJZ.mjs} +108 -32
  6. package/dist/{chunk-E3HC2YAE.mjs → chunk-6TVQQYQ5.mjs} +14 -1
  7. package/dist/{chunk-2CGA3MUW.js → chunk-HKVRUGM6.js} +142 -91
  8. package/dist/{chunk-3J4PPSMI.mjs → chunk-TFHKVQLL.mjs} +123 -72
  9. package/dist/{chunk-PEDLCL72.js → chunk-V2O5AO7I.js} +15 -0
  10. package/dist/{chunk-6HCBOIZ4.js → chunk-ZYACIPKO.js} +160 -84
  11. package/dist/{index-BpyFcJVv.d.ts → client-CkGlXZRd.d.mts} +121 -72
  12. package/dist/{index-m8zGQUda.d.mts → client-lvLvB1_K.d.ts} +121 -72
  13. package/dist/{index-D4oNCc37.d.mts → index-CC1JPhB2.d.mts} +2 -2
  14. package/dist/{index-BHVJgyqM.d.ts → index-CPcFayQg.d.ts} +2 -2
  15. package/dist/index.d.mts +6 -5
  16. package/dist/index.d.ts +6 -5
  17. package/dist/index.js +117 -109
  18. package/dist/index.mjs +3 -3
  19. package/dist/mock/cli.mjs +8086 -0
  20. package/dist/mock/library.d.mts +15 -0
  21. package/dist/mock/library.d.ts +15 -0
  22. package/dist/mock/library.js +7285 -0
  23. package/dist/mock/library.mjs +7278 -0
  24. package/dist/mock/msw.d.mts +14 -0
  25. package/dist/mock/msw.d.ts +14 -0
  26. package/dist/mock/msw.js +7280 -0
  27. package/dist/mock/msw.mjs +7278 -0
  28. package/dist/{payment-DnU_eLuT.d.ts → payment-DA1i5hhk.d.mts} +13 -12
  29. package/dist/{payment-DnU_eLuT.d.mts → payment-DA1i5hhk.d.ts} +13 -12
  30. package/dist/{price-DUVmRTaz.d.ts → price-Bv4G8aOO.d.ts} +1 -1
  31. package/dist/{price-D-hso3np.d.mts → price-s1XN0edJ.d.mts} +1 -1
  32. package/dist/react.d.mts +21 -4
  33. package/dist/react.d.ts +21 -4
  34. package/dist/react.js +835 -715
  35. package/dist/react.mjs +725 -605
  36. package/dist/server-B8TeE2OD.d.mts +915 -0
  37. package/dist/server-B8TeE2OD.d.ts +915 -0
  38. package/dist/styles.css +1 -1
  39. package/dist/utils.d.mts +3 -3
  40. package/dist/utils.d.ts +3 -3
  41. package/dist/utils.js +28 -28
  42. package/dist/utils.mjs +1 -1
  43. package/package.json +32 -12
  44. package/registry/cart-summary.json +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPEDLCL72_js = require('./chunk-PEDLCL72.js');
3
+ var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.js');
4
4
 
5
5
  // src/types/result.ts
6
6
  function ok(value) {
@@ -72,13 +72,23 @@ function combineObject(results) {
72
72
  return ok(values);
73
73
  }
74
74
 
75
+ // src/internal/idempotency.ts
76
+ function generateIdempotencyKey(prefix = "idem") {
77
+ if (typeof crypto !== "undefined" && crypto.randomUUID) {
78
+ return `${prefix}_${crypto.randomUUID()}`;
79
+ }
80
+ const timestamp = Date.now().toString(36);
81
+ const random = Math.random().toString(36).substring(2, 15);
82
+ return `${prefix}_${timestamp}_${random}`;
83
+ }
84
+
75
85
  // src/internal/safe.ts
76
86
  function toCimplifyError(error) {
77
- if (error instanceof chunkPEDLCL72_js.CimplifyError) return chunkPEDLCL72_js.enrichError(error);
87
+ if (error instanceof chunkV2O5AO7I_js.CimplifyError) return chunkV2O5AO7I_js.enrichError(error);
78
88
  if (error instanceof Error) {
79
- return chunkPEDLCL72_js.enrichError(new chunkPEDLCL72_js.CimplifyError(chunkPEDLCL72_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
89
+ return chunkV2O5AO7I_js.enrichError(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.UNKNOWN_ERROR, error.message, false));
80
90
  }
81
- return chunkPEDLCL72_js.enrichError(new chunkPEDLCL72_js.CimplifyError(chunkPEDLCL72_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
91
+ return chunkV2O5AO7I_js.enrichError(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.UNKNOWN_ERROR, String(error), false));
82
92
  }
83
93
  async function safe(promise) {
84
94
  try {
@@ -400,8 +410,11 @@ var CatalogueQueries = class {
400
410
  )
401
411
  );
402
412
  }
403
- async fetchQuote(input) {
404
- return safe(this.client.post("/api/v1/catalogue/quotes", input));
413
+ async fetchQuote(input, opts) {
414
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
415
+ return safe(
416
+ this.client.post("/api/v1/catalogue/quotes", input, { idempotencyKey })
417
+ );
405
418
  }
406
419
  async getQuote(quoteId) {
407
420
  const encodedQuoteId = encodeURIComponent(quoteId);
@@ -594,22 +607,11 @@ function lineItemToCartInput(item) {
594
607
  }
595
608
  return input;
596
609
  }
597
- function isUICartResponse(value) {
598
- return "cart" in value;
599
- }
600
- function unwrapEnrichedCart(value) {
601
- return isUICartResponse(value) ? value.cart : value;
602
- }
603
610
  var CartOperations = class {
604
611
  constructor(client) {
605
612
  this.client = client;
606
613
  }
607
614
  async get() {
608
- const result = await safe(this.client.get("/api/v1/cart"));
609
- if (!result.ok) return result;
610
- return ok(unwrapEnrichedCart(result.value));
611
- }
612
- async getRaw() {
613
615
  return safe(this.client.get("/api/v1/cart"));
614
616
  }
615
617
  async getItems() {
@@ -635,15 +637,23 @@ var CartOperations = class {
635
637
  currency: cart.pricing.currency
636
638
  });
637
639
  }
638
- async addItem(input) {
639
- return safe(this.client.post("/api/v1/cart/items", input));
640
+ async addItem(input, opts) {
641
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
642
+ return safe(
643
+ this.client.post("/api/v1/cart/items", input, { idempotencyKey })
644
+ );
640
645
  }
641
646
  async updateItem(cartItemId, updates) {
642
- if (typeof updates.quantity === "number") {
643
- return this.updateQuantity(cartItemId, updates.quantity);
647
+ if (typeof updates.quantity !== "number") {
648
+ return {
649
+ ok: false,
650
+ error: new chunkV2O5AO7I_js.CimplifyError(
651
+ "VALIDATION_ERROR",
652
+ "updateItem requires a quantity; richer mid-cart edits are not supported"
653
+ )
654
+ };
644
655
  }
645
- const encodedId = encodeURIComponent(cartItemId);
646
- return safe(this.client.patch(`/api/v1/cart/items/${encodedId}`, updates));
656
+ return this.updateQuantity(cartItemId, updates.quantity);
647
657
  }
648
658
  async updateQuantity(cartItemId, quantity) {
649
659
  const encodedId = encodeURIComponent(cartItemId);
@@ -660,11 +670,14 @@ var CartOperations = class {
660
670
  async clear() {
661
671
  return safe(this.client.delete("/api/v1/cart"));
662
672
  }
663
- async applyCoupon(code) {
673
+ async applyCoupon(code, opts) {
674
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
664
675
  return safe(
665
- this.client.post("/api/v1/cart/coupons", {
666
- coupon_code: code
667
- })
676
+ this.client.post(
677
+ "/api/v1/cart/coupons",
678
+ { coupon_code: code },
679
+ { idempotencyKey }
680
+ )
668
681
  );
669
682
  }
670
683
  async removeCoupon() {
@@ -1071,7 +1084,7 @@ var CheckoutResolver = class {
1071
1084
  }
1072
1085
  }
1073
1086
  }
1074
- if (checkoutResult.requires_authorization || chunkPEDLCL72_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1087
+ if (checkoutResult.requires_authorization || chunkV2O5AO7I_js.isPaymentStatusRequiresAction(checkoutResult.payment_status)) {
1075
1088
  const authorization = await this.handleAuthorization({
1076
1089
  authorizationType,
1077
1090
  paymentReference,
@@ -1245,18 +1258,18 @@ var CheckoutResolver = class {
1245
1258
  if (statusResult.value.reference) {
1246
1259
  paymentReference = statusResult.value.reference;
1247
1260
  }
1248
- const normalized = chunkPEDLCL72_js.normalizeStatusResponse(statusResult.value);
1249
- if (normalized.paid || chunkPEDLCL72_js.isPaymentStatusSuccess(normalized.status)) {
1261
+ const normalized = chunkV2O5AO7I_js.normalizeStatusResponse(statusResult.value);
1262
+ if (normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status)) {
1250
1263
  return this.finalizeSuccess(latestCheckoutResult);
1251
1264
  }
1252
- if (chunkPEDLCL72_js.isPaymentStatusFailure(normalized.status)) {
1265
+ if (chunkV2O5AO7I_js.isPaymentStatusFailure(normalized.status)) {
1253
1266
  return this.fail(
1254
1267
  normalized.status ? normalized.status.toUpperCase() : "PAYMENT_FAILED",
1255
1268
  normalized.message || "Payment failed during confirmation.",
1256
1269
  false
1257
1270
  );
1258
1271
  }
1259
- if (chunkPEDLCL72_js.isPaymentStatusRequiresAction(normalized.status)) {
1272
+ if (chunkV2O5AO7I_js.isPaymentStatusRequiresAction(normalized.status)) {
1260
1273
  const authorization = await this.handleAuthorization({
1261
1274
  authorizationType,
1262
1275
  paymentReference,
@@ -1287,8 +1300,8 @@ var CheckoutResolver = class {
1287
1300
  try {
1288
1301
  const finalResult = await this.client.checkout.pollPaymentStatus(input.orderId);
1289
1302
  if (finalResult.ok) {
1290
- const normalized = chunkPEDLCL72_js.normalizeStatusResponse(finalResult.value);
1291
- if (normalized.paid || chunkPEDLCL72_js.isPaymentStatusSuccess(normalized.status)) {
1303
+ const normalized = chunkV2O5AO7I_js.normalizeStatusResponse(finalResult.value);
1304
+ if (normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status)) {
1292
1305
  return this.finalizeSuccess(latestCheckoutResult);
1293
1306
  }
1294
1307
  }
@@ -1484,12 +1497,12 @@ var CheckoutResolver = class {
1484
1497
  };
1485
1498
  }
1486
1499
  isSuccessfulStatus(status) {
1487
- const normalized = chunkPEDLCL72_js.normalizeStatusResponse({ status, paid: false });
1488
- return normalized.paid || chunkPEDLCL72_js.isPaymentStatusSuccess(normalized.status);
1500
+ const normalized = chunkV2O5AO7I_js.normalizeStatusResponse({ status, paid: false });
1501
+ return normalized.paid || chunkV2O5AO7I_js.isPaymentStatusSuccess(normalized.status);
1489
1502
  }
1490
1503
  isFailureStatus(status) {
1491
- const normalized = chunkPEDLCL72_js.normalizeStatusResponse({ status, paid: false });
1492
- return chunkPEDLCL72_js.isPaymentStatusFailure(normalized.status);
1504
+ const normalized = chunkV2O5AO7I_js.normalizeStatusResponse({ status, paid: false });
1505
+ return chunkV2O5AO7I_js.isPaymentStatusFailure(normalized.status);
1493
1506
  }
1494
1507
  ensureNotAborted() {
1495
1508
  if (this.signal?.aborted) {
@@ -1527,14 +1540,6 @@ function toTerminalFailure(code, message, recoverable) {
1527
1540
  }
1528
1541
  };
1529
1542
  }
1530
- function generateIdempotencyKey() {
1531
- if (typeof crypto !== "undefined" && crypto.randomUUID) {
1532
- return `idem_${crypto.randomUUID()}`;
1533
- }
1534
- const timestamp = Date.now().toString(36);
1535
- const random = Math.random().toString(36).substring(2, 15);
1536
- return `idem_${timestamp}_${random}`;
1537
- }
1538
1543
  var CheckoutService = class {
1539
1544
  constructor(client) {
1540
1545
  this.client = client;
@@ -1560,7 +1565,7 @@ var CheckoutService = class {
1560
1565
  }
1561
1566
  async initializePayment(_orderId, _method) {
1562
1567
  return err(
1563
- new chunkPEDLCL72_js.CimplifyError(
1568
+ new chunkV2O5AO7I_js.CimplifyError(
1564
1569
  "NOT_IMPLEMENTED",
1565
1570
  "initializePayment is not available in REST mode.",
1566
1571
  false
@@ -1632,11 +1637,11 @@ var CheckoutService = class {
1632
1637
  pay_currency: data.pay_currency,
1633
1638
  fx_quote_id: data.fx_quote_id
1634
1639
  };
1635
- const baseCurrency = chunkPEDLCL72_js.currencyCode(
1640
+ const baseCurrency = chunkV2O5AO7I_js.currencyCode(
1636
1641
  (cart.pricing.currency || checkoutData.pay_currency || "GHS").toUpperCase()
1637
1642
  );
1638
1643
  const payCurrency = data.pay_currency?.trim().toUpperCase();
1639
- const payCurrencyCode = payCurrency ? chunkPEDLCL72_js.currencyCode(payCurrency) : void 0;
1644
+ const payCurrencyCode = payCurrency ? chunkV2O5AO7I_js.currencyCode(payCurrency) : void 0;
1640
1645
  const cartTotalAmount = typeof cart.pricing.total_price === "number" ? cart.pricing.total_price : Number.parseFloat(cart.pricing.total_price || "0");
1641
1646
  if (payCurrencyCode && payCurrencyCode !== baseCurrency && !checkoutData.fx_quote_id && Number.isFinite(cartTotalAmount) && cartTotalAmount > 0) {
1642
1647
  const fxQuoteResult = await this.client.fx.lockQuote({
@@ -1715,13 +1720,16 @@ var OrderQueries = class {
1715
1720
  async getByStatus(status) {
1716
1721
  return this.list({ status });
1717
1722
  }
1718
- async cancel(orderId, reason) {
1723
+ async cancel(orderId, reason, opts) {
1719
1724
  const encodedId = encodeURIComponent(orderId);
1720
1725
  const tokenParam = this.orderTokenParam(orderId);
1726
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1721
1727
  return safe(
1722
- this.client.post(`/api/v1/orders/${encodedId}/cancel${tokenParam}`, {
1723
- reason
1724
- })
1728
+ this.client.post(
1729
+ `/api/v1/orders/${encodedId}/cancel${tokenParam}`,
1730
+ { reason },
1731
+ { idempotencyKey }
1732
+ )
1725
1733
  );
1726
1734
  }
1727
1735
  };
@@ -1766,12 +1774,16 @@ var LinkService = class {
1766
1774
  async getProfile() {
1767
1775
  return safe(this.client.linkGet("/v1/link/profile"));
1768
1776
  }
1769
- async requestOtp(input) {
1770
- return safe(this.client.linkPost("/v1/link/auth/request-otp", input));
1777
+ async requestOtp(input, opts) {
1778
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1779
+ return safe(
1780
+ this.client.linkPost("/v1/link/auth/request-otp", input, { idempotencyKey })
1781
+ );
1771
1782
  }
1772
- async verifyOtp(input) {
1783
+ async verifyOtp(input, opts) {
1784
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1773
1785
  const result = await safe(
1774
- this.client.linkPost("/v1/link/auth/verify-otp", input)
1786
+ this.client.linkPost("/v1/link/auth/verify-otp", input, { idempotencyKey })
1775
1787
  );
1776
1788
  if (result.ok && result.value.session_token) {
1777
1789
  this.client.setAccessToken(result.value.session_token);
@@ -1800,20 +1812,33 @@ var LinkService = class {
1800
1812
  async getPreferences() {
1801
1813
  return safe(this.client.linkGet("/v1/link/preferences"));
1802
1814
  }
1803
- async enroll(data) {
1804
- return safe(this.client.linkPost("/v1/link/enroll", data));
1815
+ async enroll(data, opts) {
1816
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1817
+ return safe(
1818
+ this.client.linkPost("/v1/link/enroll", data, { idempotencyKey })
1819
+ );
1805
1820
  }
1806
- async enrollAndLinkOrder(data) {
1821
+ async enrollAndLinkOrder(data, opts) {
1822
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1807
1823
  return safe(
1808
- this.client.linkPost("/v1/link/enroll-and-link-order", data)
1824
+ this.client.linkPost(
1825
+ "/v1/link/enroll-and-link-order",
1826
+ data,
1827
+ { idempotencyKey }
1828
+ )
1809
1829
  );
1810
1830
  }
1811
1831
  async updatePreferences(preferences) {
1812
1832
  return safe(this.client.linkPost("/v1/link/preferences", preferences));
1813
1833
  }
1814
- async createAddress(input) {
1834
+ async createAddress(input, opts) {
1835
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1815
1836
  return safe(
1816
- this.client.linkPost("/v1/link/addresses", toCreateAddressPayload(input))
1837
+ this.client.linkPost(
1838
+ "/v1/link/addresses",
1839
+ toCreateAddressPayload(input),
1840
+ { idempotencyKey }
1841
+ )
1817
1842
  );
1818
1843
  }
1819
1844
  async updateAddress(input) {
@@ -1843,11 +1868,13 @@ var LinkService = class {
1843
1868
  )
1844
1869
  );
1845
1870
  }
1846
- async createMobileMoney(input) {
1871
+ async createMobileMoney(input, opts) {
1872
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1847
1873
  return safe(
1848
1874
  this.client.linkPost(
1849
1875
  "/v1/link/mobile-money",
1850
- toCreateMobileMoneyPayload(input)
1876
+ toCreateMobileMoneyPayload(input),
1877
+ { idempotencyKey }
1851
1878
  )
1852
1879
  );
1853
1880
  }
@@ -1872,10 +1899,13 @@ var LinkService = class {
1872
1899
  )
1873
1900
  );
1874
1901
  }
1875
- async verifyMobileMoney(mobileMoneyId) {
1902
+ async verifyMobileMoney(mobileMoneyId, opts) {
1903
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1876
1904
  return safe(
1877
1905
  this.client.linkPost(
1878
- `/v1/link/mobile-money/${encodePathSegment(mobileMoneyId)}/verify`
1906
+ `/v1/link/mobile-money/${encodePathSegment(mobileMoneyId)}/verify`,
1907
+ void 0,
1908
+ { idempotencyKey }
1879
1909
  )
1880
1910
  );
1881
1911
  }
@@ -1908,24 +1938,34 @@ var AuthService = class {
1908
1938
  if (!result.ok) return result;
1909
1939
  return ok(result.value.is_authenticated);
1910
1940
  }
1911
- async requestOtp(contact, contactType) {
1941
+ async requestOtp(contact, contactType, opts) {
1942
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1912
1943
  return safe(
1913
- this.client.post("/api/v1/auth/request-otp", {
1914
- contact,
1915
- contact_type: contactType
1916
- })
1944
+ this.client.post(
1945
+ "/api/v1/auth/request-otp",
1946
+ { contact, contact_type: contactType },
1947
+ { idempotencyKey }
1948
+ )
1917
1949
  );
1918
1950
  }
1919
- async verifyOtp(code, contact) {
1920
- return safe(
1921
- this.client.post("/api/v1/auth/verify-otp", {
1922
- otp_code: code,
1923
- contact
1924
- })
1951
+ async verifyOtp(code, contact, opts) {
1952
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
1953
+ const result = await safe(
1954
+ this.client.post(
1955
+ "/api/v1/auth/verify-otp",
1956
+ { otp_code: code, contact },
1957
+ { idempotencyKey }
1958
+ )
1925
1959
  );
1960
+ if (result.ok && result.value.session_token) {
1961
+ this.client.setAccessToken(result.value.session_token);
1962
+ }
1963
+ return result;
1926
1964
  }
1927
1965
  async logout() {
1928
- return safe(this.client.post("/api/v1/auth/logout"));
1966
+ const result = await safe(this.client.post("/api/v1/auth/logout"));
1967
+ this.client.clearSession();
1968
+ return result;
1929
1969
  }
1930
1970
  async updateProfile(input) {
1931
1971
  return safe(this.client.post("/api/v1/auth/profile", input));
@@ -1959,7 +1999,7 @@ var BusinessService = class {
1959
1999
  if (!result.ok) return err(result.error);
1960
2000
  const location = result.value.find((item) => item.id === locationId);
1961
2001
  if (!location) {
1962
- return err(new chunkPEDLCL72_js.CimplifyError(chunkPEDLCL72_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
2002
+ return err(new chunkV2O5AO7I_js.CimplifyError(chunkV2O5AO7I_js.ErrorCode.NOT_FOUND, `Location not found: ${locationId}`, false));
1963
2003
  }
1964
2004
  return ok(location);
1965
2005
  }
@@ -2120,17 +2160,25 @@ var SchedulingService = class {
2120
2160
  const past = result.value.filter((booking) => String(booking.status).toLowerCase() === "completed").sort((a, b) => firstScheduledTime(b).localeCompare(firstScheduledTime(a))).slice(0, Math.max(0, limit));
2121
2161
  return ok(past);
2122
2162
  }
2123
- async cancelBooking(input) {
2163
+ async cancelBooking(input, opts) {
2124
2164
  const encodedId = encodeURIComponent(input.booking_id);
2165
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
2125
2166
  return safe(
2126
- this.client.post(`/api/v1/scheduling/bookings/${encodedId}/cancel`, {
2127
- reason: input.reason
2128
- })
2167
+ this.client.post(
2168
+ `/api/v1/scheduling/bookings/${encodedId}/cancel`,
2169
+ { reason: input.reason },
2170
+ { idempotencyKey }
2171
+ )
2129
2172
  );
2130
2173
  }
2131
- async rescheduleBooking(input) {
2174
+ async rescheduleBooking(input, opts) {
2175
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
2132
2176
  return safe(
2133
- this.client.post("/api/v1/scheduling/bookings/reschedule", input)
2177
+ this.client.post(
2178
+ "/api/v1/scheduling/bookings/reschedule",
2179
+ input,
2180
+ { idempotencyKey }
2181
+ )
2134
2182
  );
2135
2183
  }
2136
2184
  async getNextAvailableSlot(serviceId, fromDate) {
@@ -2140,7 +2188,7 @@ var SchedulingService = class {
2140
2188
  date
2141
2189
  });
2142
2190
  if (!result.ok) return result;
2143
- return ok(result.value.find((slot) => slot.is_available) || null);
2191
+ return ok(result.value[0] ?? null);
2144
2192
  }
2145
2193
  async hasAvailabilityOn(serviceId, date) {
2146
2194
  const result = await this.getAvailableSlots({
@@ -2148,7 +2196,7 @@ var SchedulingService = class {
2148
2196
  date
2149
2197
  });
2150
2198
  if (!result.ok) return result;
2151
- return ok(result.value.some((slot) => slot.is_available));
2199
+ return ok(result.value.length > 0);
2152
2200
  }
2153
2201
  };
2154
2202
 
@@ -2182,8 +2230,11 @@ var FxService = class {
2182
2230
  const path = `/api/v1/fx/rate?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`;
2183
2231
  return safe(this.client.get(path));
2184
2232
  }
2185
- async lockQuote(request) {
2186
- return safe(this.client.post("/api/v1/fx/quotes", request));
2233
+ async lockQuote(request, opts) {
2234
+ const idempotencyKey = opts?.idempotencyKey ?? generateIdempotencyKey();
2235
+ return safe(
2236
+ this.client.post("/api/v1/fx/quotes", request, { idempotencyKey })
2237
+ );
2187
2238
  }
2188
2239
  };
2189
2240
 
@@ -2234,7 +2285,7 @@ var EVENT_TYPES = {
2234
2285
 
2235
2286
  // src/elements.ts
2236
2287
  function toCheckoutError(code, message, recoverable) {
2237
- const hint = chunkPEDLCL72_js.getErrorHint(code);
2288
+ const hint = chunkV2O5AO7I_js.getErrorHint(code);
2238
2289
  return {
2239
2290
  success: false,
2240
2291
  error: {