@replohq/sdk 2.2.1 → 2.2.2

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.
@@ -3,9 +3,18 @@ export declare class InvalidAmountError extends ReploError {
3
3
  }
4
4
  export declare class UnsupportedCurrencyError extends ReploError {
5
5
  }
6
+ /**
7
+ * True for currencies where Stripe deliberately differs from ISO — e.g. ISO
8
+ * calls IQD/LYD 3-decimal and ISK/UGX 0-decimal, but Stripe treats all four as
9
+ * 2-decimal (and MGA/MRU are ÷5, not decimal at all). Check it before sending
10
+ * minor units to Stripe, so a wrong-exponent amount can never be charged. When
11
+ * we launch one of these for Replo checkout, add a Stripe-verified override.
12
+ */
13
+ export declare function stripeExponentDiffersFromIso(currencyCode: string): boolean;
14
+ export declare function assertStripeExponentMatchesIso(currencyCode: string): void;
6
15
  /**
7
16
  * Converts a decimal major-unit amount (e.g. "19.99", 19.99) into integer
8
- * minor units (1999) using the currency's Stripe exponent. Half-away-from-zero
17
+ * minor units (1999) using the currency's ISO-4217 exponent. Half-away-from-zero
9
18
  * rounding for the non-negative amounts this domain uses (prices, totals),
10
19
  * matching Stripe. Throws on non-numeric input.
11
20
  */
@@ -1856,7 +1856,7 @@ var InvalidAmountError = class extends ReploError {
1856
1856
  };
1857
1857
  var UnsupportedCurrencyError = class extends ReploError {
1858
1858
  };
1859
- var STRIPE_UNSUPPORTED_CURRENCIES = /* @__PURE__ */ new Set([
1859
+ var STRIPE_EXPONENT_MISMATCH_CURRENCIES = /* @__PURE__ */ new Set([
1860
1860
  "ISK",
1861
1861
  "UGX",
1862
1862
  "IQD",
@@ -1864,15 +1864,19 @@ var STRIPE_UNSUPPORTED_CURRENCIES = /* @__PURE__ */ new Set([
1864
1864
  "MGA",
1865
1865
  "MRU"
1866
1866
  ]);
1867
- function currencyMinorUnitExponent(currencyCode) {
1868
- const normalizedCode = currencyCode.toUpperCase();
1869
- if (STRIPE_UNSUPPORTED_CURRENCIES.has(normalizedCode)) {
1867
+ function stripeExponentDiffersFromIso(currencyCode) {
1868
+ return STRIPE_EXPONENT_MISMATCH_CURRENCIES.has(currencyCode.toUpperCase());
1869
+ }
1870
+ function assertStripeExponentMatchesIso(currencyCode) {
1871
+ if (stripeExponentDiffersFromIso(currencyCode)) {
1870
1872
  throw new UnsupportedCurrencyError({
1871
1873
  message: "Currency's ISO minor-unit exponent differs from Stripe's; not supported",
1872
- additionalData: { currencyCode: normalizedCode }
1874
+ additionalData: { currencyCode: currencyCode.toUpperCase() }
1873
1875
  });
1874
1876
  }
1875
- return (0, import_currency_codes.code)(normalizedCode)?.digits ?? 2;
1877
+ }
1878
+ function currencyMinorUnitExponent(currencyCode) {
1879
+ return (0, import_currency_codes.code)(currencyCode.toUpperCase())?.digits ?? 2;
1876
1880
  }
1877
1881
  function fromMajorUnitsToMinorUnits({
1878
1882
  amount,
@@ -1923,4 +1927,4 @@ function formatAmount({
1923
1927
  }).format(fromMinorUnitsToMajorUnits({ amount, currencyCode }));
1924
1928
  }
1925
1929
 
1926
- export { InvalidAmountError, UnsupportedCurrencyError, formatAmount, fromMajorUnitsToMinorUnits, fromMinorUnitsToMajorUnits, fromMinorUnitsToMajorUnitsString, parseDecimalToMinorUnits };
1930
+ export { InvalidAmountError, UnsupportedCurrencyError, assertStripeExponentMatchesIso, formatAmount, fromMajorUnitsToMinorUnits, fromMinorUnitsToMajorUnits, fromMinorUnitsToMajorUnitsString, parseDecimalToMinorUnits, stripeExponentDiffersFromIso };
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "branch": "HEAD",
5
- "commit": "cb0991cc863d256c3df479ed294f1a2dc48dba29",
6
- "builtAt": "2026-10-20T23:18:54.483Z"
5
+ "commit": "10eafe148d1a068d735ebb31d3b9ad7cc63f7056",
6
+ "builtAt": "2026-10-21T00:01:06.096Z"
7
7
  };
package/money.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Money helpers for storefronts. All commerce amounts in the SDK (variant
3
- * prices, cart costs) are integer minor units, Stripe convention: 1999 =
3
+ * prices, cart costs) are integer ISO 4217 minor units: 1999 =
4
4
  * $19.99 USD, 1999 = ¥1999 JPY. Use formatAmount/useFormattedPrice for
5
5
  * display and fromMinorUnitsToMajorUnits when handing amounts to analytics or third-party
6
6
  * APIs that speak decimal money.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sdk",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sdk",
6
- "version": "2.2.1",
6
+ "version": "2.2.2",
7
7
  "branch": "HEAD",
8
- "commit": "cb0991cc863d256c3df479ed294f1a2dc48dba29",
9
- "builtAt": "2026-10-20T23:18:54.483Z"
8
+ "commit": "10eafe148d1a068d735ebb31d3b9ad7cc63f7056",
9
+ "builtAt": "2026-10-21T00:01:06.096Z"
10
10
  },
11
11
  "description": "Replo SDK — cart, analytics, and data loaders for agent-built Next.js sites.",
12
12
  "license": "SEE LICENSE IN LICENSE",
@@ -0,0 +1 @@
1
+ export declare function BuyBox(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function FixtureProductPage(): import("react/jsx-runtime").JSX.Element;