@usethrottle/auth 0.12.0 → 0.13.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 (39) hide show
  1. package/README.md +10 -0
  2. package/dist/{AccountModal-B5Y6DXYQ.js → AccountModal-4GF7X5X4.js} +2 -2
  3. package/dist/{chunk-MC7TAQYZ.js → chunk-37RG635A.js} +4 -17
  4. package/dist/{chunk-MC7TAQYZ.js.map → chunk-37RG635A.js.map} +1 -1
  5. package/dist/chunk-PTREZIKS.js +31 -0
  6. package/dist/chunk-PTREZIKS.js.map +1 -0
  7. package/dist/{chunk-4HUBLJQC.js → chunk-X4IZ7RC6.js} +2 -2
  8. package/dist/{chunk-IQXKFRVX.js → chunk-YRJFGH6J.js} +9 -6
  9. package/dist/{chunk-IQXKFRVX.js.map → chunk-YRJFGH6J.js.map} +1 -1
  10. package/dist/{client-7LVKfuXO.d.ts → client-BripyQad.d.ts} +5 -3
  11. package/dist/{hooks-DkpLrEiC.d.ts → hooks-q2sYQa7f.d.ts} +1 -1
  12. package/dist/index.cjs +38 -2
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +8 -3
  15. package/dist/index.d.ts +8 -3
  16. package/dist/index.js +27 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/react/components/account/index.d.ts +3 -2
  19. package/dist/react/components/account/index.js +1 -1
  20. package/dist/react/components/auth/index.js +2 -2
  21. package/dist/react/components/index.cjs +71 -39
  22. package/dist/react/components/index.cjs.map +1 -1
  23. package/dist/react/components/index.d.cts +13 -5
  24. package/dist/react/components/index.d.ts +15 -7
  25. package/dist/react/components/index.js +25 -4
  26. package/dist/react/components/index.js.map +1 -1
  27. package/dist/react/components/provider.d.ts +2 -1
  28. package/dist/react/components/provider.js +1 -1
  29. package/dist/react/index.cjs +36 -0
  30. package/dist/react/index.cjs.map +1 -1
  31. package/dist/react/index.d.cts +7 -3
  32. package/dist/react/index.d.ts +7 -4
  33. package/dist/react/index.js +24 -1
  34. package/dist/styles.css +7 -4
  35. package/package.json +4 -1
  36. package/dist/chunk-ETYOOYYV.js +0 -2
  37. package/dist/chunk-ETYOOYYV.js.map +0 -1
  38. /package/dist/{AccountModal-B5Y6DXYQ.js.map → AccountModal-4GF7X5X4.js.map} +0 -0
  39. /package/dist/{chunk-4HUBLJQC.js.map → chunk-X4IZ7RC6.js.map} +0 -0
package/README.md CHANGED
@@ -597,6 +597,16 @@ vague by design.
597
597
  | `cart_already_claimed` | `claimCart` targeted a cart already bound to a different customer. |
598
598
  | `not_found` | The address/card/session/order/invoice/subscription id doesn't belong to this buyer. |
599
599
 
600
+ ## Money
601
+
602
+ Amounts are integers in the record's minor unit. Show them with
603
+ `formatMoney(amount, record.currency)`. The root and `/react` entries
604
+ re-export `@usethrottle/money` as `money`, `formatMoney` by name (two
605
+ arguments) and the `CurrencyCode` and `MoneyValue` types. The
606
+ `@usethrottle/auth/components` entry keeps its own three-argument
607
+ `formatMoney(minor, currency, locale?)`, which is deprecated: it ignores the
608
+ locale and prints what `@usethrottle/money` prints.
609
+
600
610
  ## Security notes
601
611
 
602
612
  - The **access token lives in memory only** — this package never writes it to
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  AccountModal
4
- } from "./chunk-MC7TAQYZ.js";
4
+ } from "./chunk-37RG635A.js";
5
5
  import "./chunk-UFGW76AZ.js";
6
6
  import "./chunk-QPVS6JXP.js";
7
7
  import "./chunk-CUNMJ2PH.js";
@@ -10,4 +10,4 @@ import "./chunk-TDQC3LMQ.js";
10
10
  export {
11
11
  AccountModal
12
12
  };
13
- //# sourceMappingURL=AccountModal-B5Y6DXYQ.js.map
13
+ //# sourceMappingURL=AccountModal-4GF7X5X4.js.map
@@ -788,23 +788,10 @@ function PaymentMethodsPanel(props) {
788
788
  import { useEffect as useEffect3, useState as useState7 } from "react";
789
789
 
790
790
  // src/react/components/format.ts
791
+ import { formatMoney as formatMinor } from "@usethrottle/money";
791
792
  function formatMoney(minorUnits, currency, locale) {
792
- const code = (currency || "USD").toUpperCase();
793
- let digits = 2;
794
- try {
795
- digits = new Intl.NumberFormat("en-US", { style: "currency", currency: code }).resolvedOptions().maximumFractionDigits ?? 2;
796
- } catch {
797
- }
798
- const major = minorUnits / 10 ** digits;
799
- try {
800
- return new Intl.NumberFormat(locale, { style: "currency", currency: code }).format(major);
801
- } catch {
802
- try {
803
- return new Intl.NumberFormat("en-US", { style: "currency", currency: code }).format(major);
804
- } catch {
805
- return `${code} ${major.toFixed(digits)}`;
806
- }
807
- }
793
+ void locale;
794
+ return formatMinor(minorUnits, currency);
808
795
  }
809
796
  function formatDate(value, locale) {
810
797
  const date = value instanceof Date ? value : new Date(value);
@@ -2072,4 +2059,4 @@ export {
2072
2059
  AccountDashboard,
2073
2060
  AccountModal
2074
2061
  };
2075
- //# sourceMappingURL=chunk-MC7TAQYZ.js.map
2062
+ //# sourceMappingURL=chunk-37RG635A.js.map