@usethrottle/checkout-react 2.1.1 → 2.2.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.
package/README.md CHANGED
@@ -206,6 +206,13 @@ The callback shape changed in v0.2: `onCompleted(orderId, paymentId)`
206
206
  is now `onSucceeded({orderId, paymentId})` and `onError(code, message)`
207
207
  is now `onFailed({code, message})`. Update call sites accordingly.
208
208
 
209
+ ## Money
210
+
211
+ Amounts are integers in the record's minor unit. Show them with
212
+ `formatMoney(amount, currency)`: this package re-exports `@usethrottle/money`
213
+ as `money` and `formatMoney` by name, plus the `CurrencyCode` and `MoneyValue`
214
+ types. For analytics, use `toDecimalString(amount, currency)`, never `/ 100`.
215
+
209
216
  ## See also
210
217
 
211
218
  - [CLI: `throttle embed-config`](https://www.npmjs.com/package/@usethrottle/cli)
package/dist/index.cjs CHANGED
@@ -1004,6 +1004,7 @@ var require_lib = __commonJS({
1004
1004
  // src/index.tsx
1005
1005
  var index_exports = {};
1006
1006
  __export(index_exports, {
1007
+ CURRENCIES: () => import_money.CURRENCIES,
1007
1008
  CardNumberField: () => CardNumberField,
1008
1009
  CheckoutEmbed: () => CheckoutEmbed,
1009
1010
  ExpiryField: () => ExpiryField,
@@ -1012,6 +1013,16 @@ __export(index_exports, {
1012
1013
  SecureCardProvider: () => SecureCardProvider,
1013
1014
  SecurityCodeField: () => SecurityCodeField,
1014
1015
  ThrottleCheckout: () => CheckoutEmbed,
1016
+ UnknownCurrencyError: () => import_money.UnknownCurrencyError,
1017
+ currencySymbol: () => import_money.currencySymbol,
1018
+ formatMoney: () => import_money.formatMoney,
1019
+ isKnownCurrency: () => import_money.isKnownCurrency,
1020
+ minorUnitsOf: () => import_money.minorUnitsOf,
1021
+ money: () => money,
1022
+ moneyValue: () => import_money.moneyValue,
1023
+ parseMoney: () => import_money.parseMoney,
1024
+ toDecimalString: () => import_money.toDecimalString,
1025
+ toMinor: () => import_money.toMinor,
1015
1026
  useCartSession: () => useCartSession,
1016
1027
  useSecureCard: () => useSecureCard,
1017
1028
  useThrottleCheckout: () => useThrottleCheckout,
@@ -1967,8 +1978,13 @@ function SecurityCodeField({ className, style, options }) {
1967
1978
  function PostalCodeField({ className, style, options }) {
1968
1979
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref: useField("postalCode", options), className, style });
1969
1980
  }
1981
+
1982
+ // src/index.tsx
1983
+ var money = __toESM(require("@usethrottle/money"), 1);
1984
+ var import_money = require("@usethrottle/money");
1970
1985
  // Annotate the CommonJS export names for ESM import in node:
1971
1986
  0 && (module.exports = {
1987
+ CURRENCIES,
1972
1988
  CardNumberField,
1973
1989
  CheckoutEmbed,
1974
1990
  ExpiryField,
@@ -1977,6 +1993,16 @@ function PostalCodeField({ className, style, options }) {
1977
1993
  SecureCardProvider,
1978
1994
  SecurityCodeField,
1979
1995
  ThrottleCheckout,
1996
+ UnknownCurrencyError,
1997
+ currencySymbol,
1998
+ formatMoney,
1999
+ isKnownCurrency,
2000
+ minorUnitsOf,
2001
+ money,
2002
+ moneyValue,
2003
+ parseMoney,
2004
+ toDecimalString,
2005
+ toMinor,
1980
2006
  useCartSession,
1981
2007
  useSecureCard,
1982
2008
  useThrottleCheckout,