@coinbase/cdp-react 0.0.24 → 0.0.26

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 (88) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/AmountInput.css +1 -1
  3. package/dist/assets/AuthButton.css +1 -1
  4. package/dist/assets/ExchangeAmountInput.css +1 -1
  5. package/dist/assets/Fund.css +1 -0
  6. package/dist/assets/FundAmountInput.css +1 -0
  7. package/dist/assets/FundErrorScreen.css +1 -0
  8. package/dist/assets/FundForm.css +1 -0
  9. package/dist/assets/FundModal.css +1 -0
  10. package/dist/assets/FundPaymentMethods.css +1 -0
  11. package/dist/assets/FundPresetAmountInputs.css +1 -0
  12. package/dist/assets/FundTitle.css +1 -0
  13. package/dist/assets/FundTransactionStatus.css +1 -0
  14. package/dist/assets/Input.css +1 -1
  15. package/dist/assets/Modal.css +1 -1
  16. package/dist/assets/ThemeProvider.css +1 -1
  17. package/dist/components/Fund/FundForm.d.ts +18 -0
  18. package/dist/components/Fund/FundForm.js +156 -0
  19. package/dist/components/Fund/FundProvider.d.ts +6 -0
  20. package/dist/components/Fund/FundProvider.js +128 -0
  21. package/dist/components/Fund/FundTitle.d.ts +5 -0
  22. package/dist/components/Fund/FundTitle.js +17 -0
  23. package/dist/components/Fund/components/FundAmountInput.d.ts +5 -0
  24. package/dist/components/Fund/components/FundAmountInput.js +58 -0
  25. package/dist/components/Fund/components/FundErrorScreen.d.ts +6 -0
  26. package/dist/components/Fund/components/FundErrorScreen.js +118 -0
  27. package/dist/components/Fund/components/FundPaymentMethods.d.ts +6 -0
  28. package/dist/components/Fund/components/FundPaymentMethods.js +55 -0
  29. package/dist/components/Fund/components/FundPresetAmountInputs.d.ts +6 -0
  30. package/dist/components/Fund/components/FundPresetAmountInputs.js +41 -0
  31. package/dist/components/Fund/components/FundTransactionStatus.d.ts +8 -0
  32. package/dist/components/Fund/components/FundTransactionStatus.js +106 -0
  33. package/dist/components/Fund/hooks/useBuyUrl.d.ts +14 -0
  34. package/dist/components/Fund/hooks/useBuyUrl.js +65 -0
  35. package/dist/components/Fund/hooks/useEmitLifecycleStatus.d.ts +5 -0
  36. package/dist/components/Fund/hooks/useEmitLifecycleStatus.js +14 -0
  37. package/dist/components/Fund/hooks/useExchangeRate.d.ts +11 -0
  38. package/dist/components/Fund/hooks/useExchangeRate.js +62 -0
  39. package/dist/components/Fund/hooks/usePaymentMethods.d.ts +11 -0
  40. package/dist/components/Fund/hooks/usePaymentMethods.js +112 -0
  41. package/dist/components/Fund/hooks/usePopupMonitor.d.ts +3 -0
  42. package/dist/components/Fund/hooks/usePopupMonitor.js +17 -0
  43. package/dist/components/Fund/hooks/useSetupOnrampEventListeners.d.ts +1 -0
  44. package/dist/components/Fund/hooks/useSetupOnrampEventListeners.js +56 -0
  45. package/dist/components/Fund/index.d.ts +10 -0
  46. package/dist/components/Fund/index.js +30 -0
  47. package/dist/components/Fund/types.d.ts +218 -0
  48. package/dist/components/Fund/types.js +1 -0
  49. package/dist/components/Fund/useFundReducer.d.ts +9 -0
  50. package/dist/components/Fund/useFundReducer.js +104 -0
  51. package/dist/components/Fund/utils/buildPaymentMethods.d.ts +5 -0
  52. package/dist/components/Fund/utils/buildPaymentMethods.js +57 -0
  53. package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +9 -0
  54. package/dist/components/Fund/utils/setupOnrampEventListeners.js +19 -0
  55. package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +14 -0
  56. package/dist/components/Fund/utils/subscribeToWindowMessage.js +24 -0
  57. package/dist/components/FundModal/index.d.ts +9 -0
  58. package/dist/components/FundModal/index.js +92 -0
  59. package/dist/components/forms/ExchangeAmountInput/index.js +93 -65
  60. package/dist/components/forms/ExchangeAmountInput/types.d.ts +2 -1
  61. package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.js +42 -38
  62. package/dist/components/forms/Input/index.d.ts +6 -2
  63. package/dist/components/forms/Input/index.js +27 -12
  64. package/dist/components/forms/PhoneNumberInput/index.d.ts +2 -2
  65. package/dist/components/ui/Button/index.js +7 -7
  66. package/dist/components/ui/ButtonBase/index.js +19 -19
  67. package/dist/components/ui/LoadingSpinner/index.d.ts +9 -2
  68. package/dist/components/ui/LoadingSpinner/index.js +39 -17
  69. package/dist/icons/IconAppleLogo.d.ts +2 -0
  70. package/dist/icons/IconAppleLogo.js +10 -0
  71. package/dist/icons/IconCoinbaseMark.d.ts +2 -0
  72. package/dist/icons/IconCoinbaseMark.js +13 -0
  73. package/dist/icons/IconCreditCard.d.ts +2 -0
  74. package/dist/icons/IconCreditCard.js +10 -0
  75. package/dist/icons/IconExclamationTriangle.d.ts +2 -0
  76. package/dist/icons/IconExclamationTriangle.js +14 -0
  77. package/dist/icons/index.d.ts +1 -0
  78. package/dist/icons/index.js +18 -16
  79. package/dist/index.d.ts +2 -0
  80. package/dist/index.js +86 -73
  81. package/dist/theme/theme.d.ts +23 -0
  82. package/dist/theme/tokens.d.ts +67 -0
  83. package/dist/theme/tokens.js +19 -2
  84. package/dist/utils/formatFiat.d.ts +1 -0
  85. package/dist/utils/formatFiat.js +13 -0
  86. package/dist/utils/openPopup.d.ts +7 -0
  87. package/dist/utils/openPopup.js +15 -0
  88. package/package.json +6 -6
package/README.md CHANGED
@@ -48,7 +48,7 @@ Next, you need to wrap your application with the `CDPReactProvider`.
48
48
 
49
49
  Update your main application file (e.g., `main.tsx` or `App.tsx`) to include the provider:
50
50
 
51
- ```tsx
51
+ ```tsx lines
52
52
  import React from 'react';
53
53
  import ReactDOM from 'react-dom/client';
54
54
  import { App } from './App'; // Your main App component
@@ -87,7 +87,7 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
87
87
 
88
88
  Now you can use the components from the library. Let's add the `AuthButton` component to your application. This component handles both sign-in and sign-out functionality.
89
89
 
90
- ```tsx
90
+ ```tsx lines
91
91
  // In your App.tsx or any other component
92
92
  import { AuthButton } from '@coinbase/cdp-react/components/AuthButton';
93
93
 
@@ -1 +1 @@
1
- .AmountInput-module__amount-input___24NlC{--cdp-web-amount-input-text-size: 3.75em;--cdp-web-amount-input-scale: 1;--cdp-web-amount-input-width: 1em;box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.2;display:flex;align-items:center;justify-content:flex-start;gap:.25rem;overflow:hidden;position:relative;width:100%}.AmountInput-module__input___Af-R1{appearance:textfield;background-color:transparent;color:var(--cdp-web-colors-page-text-default);border:0;font-weight:600;margin:0;outline:0;padding:0;width:var(--cdp-web-amount-input-width)}.AmountInput-module__input___Af-R1::placeholder{color:var(--cdp-web-colors-page-text-muted)}.AmountInput-module__amount-unit___48d60{font-size:var(--cdp-web-amount-input-text-size);font-weight:600;display:flex;align-items:center;justify-content:flex-start}.AmountInput-module__amount-unit___48d60.AmountInput-module__visible___qmvT0{cursor:text;transform:scale(var(--cdp-web-amount-input-scale));transform-origin:left center}.AmountInput-module__hidden___cO0sQ{visibility:hidden;position:absolute;pointer-events:none}.AmountInput-module__unit___-zmGz{color:var(--cdp-web-colors-page-text-muted)}
1
+ .AmountInput-module__amount-input___24NlC{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.2;display:flex;align-items:center;justify-content:flex-start;gap:.25rem;overflow:hidden;position:relative;width:100%}.AmountInput-module__input___Af-R1{appearance:textfield;background-color:transparent;color:var(--cdp-web-colors-page-text-default);border:0;font-size:1em;font-family:var(--cdp-web-font-family-sans);font-weight:600;margin:0;outline:0;padding:0;width:1em}.AmountInput-module__input___Af-R1::placeholder{color:var(--cdp-web-colors-page-text-muted)}.AmountInput-module__amount-unit___48d60{font-size:3.75em;font-weight:600;display:flex;align-items:center;justify-content:flex-start}.AmountInput-module__amount-unit___48d60.AmountInput-module__visible___qmvT0{cursor:text;transform-origin:left center}.AmountInput-module__hidden___cO0sQ{visibility:hidden;position:absolute;pointer-events:none}.AmountInput-module__unit___-zmGz{color:var(--cdp-web-colors-page-text-muted);text-transform:uppercase}
@@ -1 +1 @@
1
- .AuthButton-module__loading___JpDqi{border-radius:9999em;height:3.5em;width:7.5em}
1
+ .AuthButton-module__loading___JpDqi{border-radius:9999em;height:3em;width:7.5em}
@@ -1 +1 @@
1
- .ExchangeAmountInput-module__flex-row___ZKB-Q{display:flex;flex-direction:row;font-size:var(--cdp-web-font-size-base);align-items:center;justify-content:flex-start}.ExchangeAmountInput-module__gap-1___vuNQW{gap:.5em}.ExchangeAmountInput-module__gap-2___4-s-b{gap:.25em}.ExchangeAmountInput-module__swap-button___i9lSz{background-color:transparent;border:none;display:flex;align-items:center;justify-content:center;padding:0;margin:0;cursor:pointer}.ExchangeAmountInput-module__icon___b5JpF{width:auto;height:1.25em}
1
+ .ExchangeAmountInput-module__flex-row___ZKB-Q{display:flex;flex-direction:row;font-size:var(--cdp-web-font-size-base);align-items:center;justify-content:flex-start}.ExchangeAmountInput-module__gap-1___vuNQW{gap:.5em}.ExchangeAmountInput-module__gap-2___4-s-b{gap:.25em}.ExchangeAmountInput-module__swap-button___i9lSz{border:none;display:flex;align-items:center;justify-content:center;padding-left:.25em;padding-right:.25em;margin:0;cursor:pointer}.ExchangeAmountInput-module__icon___b5JpF{width:auto;height:1.25em}.ExchangeAmountInput-module__output-loading-skeleton___gKMEZ{padding-left:2.25em;border-radius:9999em;height:1.75em;width:max-content}.ExchangeAmountInput-module__output-loading-skeleton-placeholder___1-jT-{visibility:hidden}.ExchangeAmountInput-module__output-currency___vlpC1{text-transform:uppercase}
@@ -0,0 +1 @@
1
+ .Fund-module__fund___6j-Og{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);gap:1em;width:100%;max-width:28.125em;padding:.75em 2em 1em}.Fund-module__fund___6j-Og *{box-sizing:border-box}
@@ -0,0 +1 @@
1
+ .FundAmountInput-module__input-wrapper___6r-sX{padding-bottom:1.5em}.FundAmountInput-module__error___lMqzh{margin-top:-1.25em}
@@ -0,0 +1 @@
1
+ .FundErrorScreen-module__icon___Mf6ck{width:4em;height:4em;color:var(--cdp-web-colors-fg-warning)}.FundErrorScreen-module__title___8Qv6o{font-size:1.25em;font-weight:600;line-height:1.4;margin:.5em 0 .25em}.FundErrorScreen-module__body___-p-r9{color:var(--cdp-web-colors-fg-muted);line-height:1.5;margin:0 0 .25em}.FundErrorScreen-module__body___-p-r9:last-child{margin-bottom:0}.FundErrorScreen-module__docs-link___mzeH8{white-space:nowrap}.FundErrorScreen-module__keywords___u85Do span[data-part=keyword]{background-color:var(--cdp-web-colors-code-bg-default);border:1px solid var(--cdp-web-colors-code-border-default);border-radius:.25em;color:var(--cdp-web-colors-code-text-default);font-size:.875em;line-height:1;padding:.2em .25em;font-family:var(--cdp-web-font-family-mono)}
@@ -0,0 +1 @@
1
+ .FundForm-module__view___5V1qO,.FundForm-module__form___TIzVJ{display:flex;flex-direction:column;gap:1em}
@@ -0,0 +1 @@
1
+ .FundModal-module__trigger___2IuXj{padding-left:2em;padding-right:2em}.FundModal-module__fund___1AmQa{height:100%;overflow:hidden}.FundModal-module__fund___1AmQa.FundModal-module__no-footer___WKV78{padding-bottom:2em}.FundModal-module__title-buttons___Lctf7{display:flex;justify-content:space-between;align-items:center}.FundModal-module__close-button___jzdFM{transform:translate(.75em);margin-left:auto;margin-right:0}.FundModal-module__close-icon___WoA4a{height:auto;width:1.5em}.FundModal-module__fund-inner___UuOq3{text-align:left}.FundModal-module__fund-inner___UuOq3.FundModal-module__tx-status___fc-3f{text-align:center}.FundModal-module__title___lNsoT{flex-grow:1}.FundModal-module__tx-status___fc-3f .FundModal-module__title___lNsoT{padding-left:3em}.FundModal-module__content___9f3ze{margin-top:1.5em}.FundModal-module__tx-status___fc-3f .FundModal-module__content___9f3ze{margin-top:4em}.FundModal-module__tx-status___fc-3f .FundModal-module__content___9f3ze p:last-child{margin-bottom:4em}.FundModal-module__tx-status___fc-3f .FundModal-module__content___9f3ze button:last-child{margin-top:4em}
@@ -0,0 +1 @@
1
+ .FundPaymentMethods-module__select-loading-skeleton___ZuD3n{width:100%;border-radius:.5em;height:3em}.FundPaymentMethods-module__select-item___9VyxH{display:flex;align-items:center;line-height:1.25em;gap:.5em}.FundPaymentMethods-module__select-item-icon___28unQ{display:flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;width:2.25em}.FundPaymentMethods-module__select-item-name___5vLc0{display:block;font-weight:600;font-size:.875em}.FundPaymentMethods-module__select-item-description___C5mTB{color:var(--cdp-web-colors-select-list-item-text-muted);display:block;font-size:.875em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item___9VyxH{line-height:1.5em;gap:.75em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-icon___28unQ{width:auto}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-name___5vLc0{font-size:1em}.FundPaymentMethods-module__select-trigger___ypebl .FundPaymentMethods-module__select-item-description___C5mTB{display:none}
@@ -0,0 +1 @@
1
+ .FundPresetAmountInputs-module__preset-amount-inputs___Skjnm{align-items:center;display:flex;gap:.5em;justify-content:center}.FundPresetAmountInputs-module__preset-amount-input___eyNqU{flex-grow:1}
@@ -0,0 +1 @@
1
+ .FundTitle-module__title___K6czk{font-size:var(--cdp-web-font-size-base);font-weight:600;line-height:1.5;margin:0}
@@ -0,0 +1 @@
1
+ .FundTransactionStatus-module__graphic___cam38{display:flex;align-items:center;justify-content:center;position:relative}.FundTransactionStatus-module__status___2zKJu{text-align:center}.FundTransactionStatus-module__pad___-9rGO{padding:.5em}.FundTransactionStatus-module__spinner___94rMk{width:5em;height:5em;color:var(--cdp-web-colors-line-primary)}.FundTransactionStatus-module__icon___0hBQO{color:var(--cdp-web-colors-page-text-default);position:absolute;display:flex;align-items:center;justify-content:center;width:2em;height:2em;top:50%;left:50%;transform:translate(-50%,-50%)}.FundTransactionStatus-module__icon___0hBQO svg{width:100%;height:auto}.FundTransactionStatus-module__icon-success___893VG svg{color:var(--cdp-web-colors-fg-positive)}.FundTransactionStatus-module__icon-error___-aQvD svg{color:var(--cdp-web-colors-fg-negative)}.FundTransactionStatus-module__subhead___0sHIM{font-size:1.25em;line-height:1.2;font-weight:600;margin:1em 0 .25em}.FundTransactionStatus-module__description___W7kK2{font-size:1.125em;color:var(--cdp-web-colors-page-text-muted);line-height:1.5;font-weight:400;margin:0 0 1em}.FundTransactionStatus-module__description___W7kK2:last-child{margin-bottom:0}.FundTransactionStatus-module__ring___1vnCu{border-radius:9999em;border:3px solid transparent;display:block;width:4em;height:4em}.FundTransactionStatus-module__ring-success___Bxudq{border-color:var(--cdp-web-colors-line-positive)}.FundTransactionStatus-module__ring-error___WmTaE{border-color:var(--cdp-web-colors-line-negative)}
@@ -1 +1 @@
1
- .Input-module__input___-mK8z{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding:1em;border-radius:.5em;border:0;background-color:var(--cdp-web-colors-input-bg-default);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color) inset;color:var(--cdp-web-colors-input-text-default);transition:box-shadow .15s ease-in-out;width:100%}.Input-module__input___-mK8z::placeholder{color:var(--cdp-web-colors-input-placeholder-default)}.Input-module__input___-mK8z:focus-visible{outline:none;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-focus);--cdp-web-input-ring-width: 2px}.Input-module__input___-mK8z[aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-error)}.Input-module__input___-mK8z[data-success=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-success)}
1
+ .Input-module__input___-mK8z{--cdp-web-input-ring-width: 1px;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-default);box-sizing:border-box;font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding:1em;border-radius:.5em;border:0;background-color:var(--cdp-web-colors-input-bg-default);box-shadow:0 0 0 var(--cdp-web-input-ring-width) var(--cdp-web-input-ring-color) inset;color:var(--cdp-web-colors-input-text-default);transition:box-shadow .15s ease-in-out;width:100%}.Input-module__size-lg___IYoRG{padding:1em}.Input-module__size-md___8hkn5{padding:.75em}.Input-module__size-sm___cnynF{padding:.5em .75em}.Input-module__size-xs___aK-NH{padding:.25em .75em}.Input-module__input___-mK8z::placeholder{color:var(--cdp-web-colors-input-placeholder-default)}.Input-module__input___-mK8z:focus-visible{outline:none;--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-focus);--cdp-web-input-ring-width: 2px}.Input-module__input___-mK8z[aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-error)}.Input-module__input___-mK8z[data-success=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-success)}
@@ -1 +1 @@
1
- .Modal-module__modal___MUsZA{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);box-sizing:border-box;box-shadow:var(--shadow-md);width:100%;max-width:28.125em;min-width:0;background:var(--cdp-web-colors-page-bg-default);border-radius:.5em;outline:1px solid var(--cdp-web-colors-page-border-default);position:relative}.Modal-module__modal___MUsZA[data-state=open]{animation:Modal-module__slide-in___p-A8u .2s ease-out,Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__modal___MUsZA[data-state=closed]{animation:Modal-module__slide-out___hrRK1 .2s ease-in,Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__overlay___-RqGQ{background:var(--cdp-web-colors-bg-overlay);box-sizing:border-box;-webkit-backdrop-filter:blur(.5em);backdrop-filter:blur(.5em);display:grid;grid-template-rows:auto 1fr;inset:0;overflow-y:auto;place-items:end center;position:fixed;z-index:1000}.Modal-module__overlay___-RqGQ[data-state=open]{animation:Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__overlay___-RqGQ[data-state=closed]{animation:Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__spacer___dIfOA{height:1em}@keyframes Modal-module__fade-in___NfUjS{0%{opacity:0}to{opacity:1}}@keyframes Modal-module__fade-out___LpBNV{0%{opacity:1}to{opacity:0}}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media (min-width: 400px){.Modal-module__overlay___-RqGQ{padding:.5rem}}@media (min-width: 450px){.Modal-module__overlay___-RqGQ{place-items:center;padding:1rem;grid-template-rows:1fr}.Modal-module__modal___MUsZA{height:auto}.Modal-module__spacer___dIfOA{display:none}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(10%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(10%)}}}
1
+ .Modal-module__modal___MUsZA{--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);box-sizing:border-box;box-shadow:var(--shadow-md);width:100%;max-width:28.125em;min-width:0;background:var(--cdp-web-colors-page-bg-default);border-radius:.5em;outline:1px solid var(--cdp-web-colors-page-border-default);position:relative}.Modal-module__modal___MUsZA[data-state=open]{animation:Modal-module__slide-in___p-A8u .2s ease-out,Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__modal___MUsZA[data-state=closed]{animation:Modal-module__slide-out___hrRK1 .2s ease-in,Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__overlay___-RqGQ{background:var(--cdp-web-colors-bg-overlay);box-sizing:border-box;-webkit-backdrop-filter:blur(.5em);backdrop-filter:blur(.5em);display:grid;grid-template-rows:auto 1fr;inset:0;overflow-y:auto;place-items:end center;position:fixed;z-index:auto}.Modal-module__overlay___-RqGQ[data-state=open]{animation:Modal-module__fade-in___NfUjS .2s ease-out}.Modal-module__overlay___-RqGQ[data-state=closed]{animation:Modal-module__fade-out___LpBNV .2s ease-in}.Modal-module__spacer___dIfOA{height:1em}@keyframes Modal-module__fade-in___NfUjS{0%{opacity:0}to{opacity:1}}@keyframes Modal-module__fade-out___LpBNV{0%{opacity:1}to{opacity:0}}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media (min-width: 400px){.Modal-module__overlay___-RqGQ{padding:.5rem}}@media (min-width: 450px){.Modal-module__overlay___-RqGQ{place-items:center;padding:1rem;grid-template-rows:1fr}.Modal-module__modal___MUsZA{height:auto}.Modal-module__spacer___dIfOA{display:none}@keyframes Modal-module__slide-in___p-A8u{0%{transform:translateY(10%)}to{transform:translateY(0)}}@keyframes Modal-module__slide-out___hrRK1{0%{transform:translateY(0)}to{transform:translateY(10%)}}}
@@ -1 +1 @@
1
- @import"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap";.ThemeProvider-module__wrapper___aXwhZ{width:100%}
1
+ @import"https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap";.ThemeProvider-module__wrapper___aXwhZ{width:100%}
@@ -0,0 +1,18 @@
1
+ import { FormHTMLAttributes, ReactNode } from 'react';
2
+ import { FundProps } from './types';
3
+ export declare const VIEWS: readonly ["form", "error", "transaction-status"];
4
+ export type View = (typeof VIEWS)[number];
5
+ export interface FundFormProps extends Omit<FormHTMLAttributes<HTMLFormElement>, "children"> {
6
+ children?: (params: {
7
+ view: View;
8
+ Content: ReactNode;
9
+ }) => ReactNode;
10
+ openIn?: FundProps["openIn"];
11
+ submitLabel?: FundProps["submitLabel"];
12
+ onPopupOpen?: (popup: Window) => void;
13
+ onPopupClose?: () => void;
14
+ unmountOnTransactionError?: boolean;
15
+ unmountOnTransactionSuccess?: boolean;
16
+ unmount?: () => void;
17
+ }
18
+ export declare const FundForm: ({ className, children, onPopupClose, onPopupOpen, onSubmit, openIn, submitLabel, unmountOnTransactionError, unmountOnTransactionSuccess, unmount, ...props }: FundFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,156 @@
1
+ import { jsx as r, jsxs as H } from "react/jsx-runtime";
2
+ import { useRef as f, useState as p, useCallback as a, useEffect as h, useMemo as J } from "react";
3
+ import { Button as Y } from "../ui/Button/index.js";
4
+ import { SwitchFadeTransition as Q } from "../ui/SwitchFadeTransition/index.js";
5
+ import { useTimer as X } from "../../hooks/useTimer.js";
6
+ import { formatFiat as w } from "../../utils/formatFiat.js";
7
+ import { openPopup as Z } from "../../utils/openPopup.js";
8
+ import { FundAmountInput as O } from "./components/FundAmountInput.js";
9
+ import { FundErrorScreen as tt } from "./components/FundErrorScreen.js";
10
+ import { FundPaymentMethods as et } from "./components/FundPaymentMethods.js";
11
+ import { FundPresetAmountInputs as rt } from "./components/FundPresetAmountInputs.js";
12
+ import { FundTransactionStatus as nt } from "./components/FundTransactionStatus.js";
13
+ import { useFundContext as ot } from "./FundProvider.js";
14
+ import { usePopupMonitor as it } from "./hooks/usePopupMonitor.js";
15
+ import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", st = "FundForm-module__form___TIzVJ", B = {
16
+ view: at,
17
+ form: st
18
+ }, mt = ["form", "error", "transaction-status"], _t = ({
19
+ className: E = "",
20
+ children: y,
21
+ onPopupClose: A,
22
+ onPopupOpen: M,
23
+ onSubmit: I,
24
+ openIn: V,
25
+ submitLabel: D,
26
+ unmountOnTransactionError: s = !1,
27
+ unmountOnTransactionSuccess: m = !1,
28
+ unmount: u,
29
+ ...T
30
+ }) => {
31
+ const { state: t, dispatch: N, fetchBuyUrl: P } = ot(), g = f(t.fiatAmount === void 0 ? NaN : t.fiatAmount), [$, S] = p(!1), [k, _] = p(!1), F = f(null), [j, K] = p(null), v = f(null), C = f(null), o = f(null), {
32
+ timeRemaining: d,
33
+ start: R,
34
+ reset: U
35
+ } = X(), n = a((e) => {
36
+ C.current !== e && (C.current = e, v.current?.transition.toggle(e));
37
+ }, []), l = a(() => {
38
+ u && (o.current === "transactionSuccess" && m || o.current === "error" && s) ? u() : n("form"), o.current = null, N({
39
+ type: "SET_TRANSACTION_STATUS",
40
+ payload: { transactionStatus: { statusName: "init", statusData: null } }
41
+ });
42
+ }, [n, N, u, m, s]), L = a(() => {
43
+ u && (o.current === "transactionSuccess" && m || o.current === "error" && s) ? R(3) : o.current === null && l(), A?.();
44
+ }, [
45
+ R,
46
+ A,
47
+ l,
48
+ u,
49
+ m,
50
+ s
51
+ ]);
52
+ h(() => {
53
+ d !== null && d <= 0 && (l(), U());
54
+ }, [d, l, U]), h(() => {
55
+ (t.transactionStatus.statusName === "transactionSuccess" || t.transactionStatus.statusName === "error") && (o.current = t.transactionStatus.statusName);
56
+ }, [t.transactionStatus.statusName]), h(() => {
57
+ t.paymentMethodsError?.message && n("error");
58
+ }, [t.paymentMethodsError?.message, n]);
59
+ const { startPopupMonitor: b } = it(L), W = a(
60
+ (e) => {
61
+ e && (n("transaction-status"), b(e), M?.(e));
62
+ },
63
+ [M, b, n]
64
+ ), q = a(() => {
65
+ (t.fiatAmount === void 0 || isNaN(t.fiatAmount)) && isNaN(g.current) || t.fiatAmount === g.current || S(!0);
66
+ }, [t.fiatAmount]), x = J(() => {
67
+ if (t.fiatAmount === void 0 || isNaN(t.fiatAmount))
68
+ return "Enter an amount";
69
+ if (t.fiatAmount < (t.selectedPaymentMethod?.minAmount ?? 0))
70
+ return `Minimum amount is ${w(t.selectedPaymentMethod?.minAmount ?? 0, t.fiatCurrency, t.fiatDecimalPlaces, t.locale)}`;
71
+ if (t.selectedPaymentMethod?.maxAmount !== void 0 && t.fiatAmount > t.selectedPaymentMethod.maxAmount)
72
+ return `Maximum amount is ${w(t.selectedPaymentMethod?.maxAmount, t.fiatCurrency, t.fiatDecimalPlaces, t.locale)}`;
73
+ }, [
74
+ t.fiatAmount,
75
+ t.fiatCurrency,
76
+ t.fiatDecimalPlaces,
77
+ t.locale,
78
+ t.selectedPaymentMethod?.minAmount,
79
+ t.selectedPaymentMethod?.maxAmount
80
+ ]), z = a(async () => {
81
+ if (!(t.fiatAmount === void 0 || isNaN(t.fiatAmount) || !t.selectedPaymentMethod?.id))
82
+ return P(
83
+ {
84
+ paymentMethod: t.selectedPaymentMethod?.id,
85
+ paymentAmount: t.fiatAmount
86
+ },
87
+ (e) => {
88
+ K({
89
+ code: e?.code || "UNKNOWN_BUY_URL_ERROR",
90
+ message: e?.debugMessage || "Something went wrong fetching the buy url"
91
+ }), n("error");
92
+ }
93
+ );
94
+ }, [t.fiatAmount, t.selectedPaymentMethod?.id, P, n]), G = async (e) => {
95
+ if (e.preventDefault(), x) {
96
+ S(!0), F.current?.focus();
97
+ return;
98
+ }
99
+ I?.(e), _(!0);
100
+ const c = await z();
101
+ if (_(!1), c)
102
+ if (V === "tab")
103
+ window.open(c, "_blank");
104
+ else {
105
+ const i = Z({ url: c, width: 460, height: 720 });
106
+ W(i);
107
+ }
108
+ };
109
+ return /* @__PURE__ */ r(
110
+ Q,
111
+ {
112
+ animateHeight: !0,
113
+ timeout: 250,
114
+ items: mt,
115
+ initialEntered: !0,
116
+ transitionRef: v,
117
+ children: ({ itemKey: e, ...c }) => {
118
+ let i = null;
119
+ return e === "form" && (i = /* @__PURE__ */ H("form", { className: `${B.form} ${E}`, onSubmit: G, ...T, children: [
120
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
121
+ O,
122
+ {
123
+ ref: F,
124
+ error: $ ? x : void 0,
125
+ onBlur: q
126
+ }
127
+ ) }),
128
+ /* @__PURE__ */ r(rt, {}),
129
+ /* @__PURE__ */ r(et, {}),
130
+ /* @__PURE__ */ r(
131
+ Y,
132
+ {
133
+ variant: "primary",
134
+ type: "submit",
135
+ isPending: k,
136
+ pendingLabel: "Getting purchase link",
137
+ children: D || "Deposit"
138
+ }
139
+ )
140
+ ] })), e === "error" && (i = /* @__PURE__ */ r(tt, { error: t.paymentMethodsError || j })), e === "transaction-status" && (i = /* @__PURE__ */ r(
141
+ nt,
142
+ {
143
+ unmountOnSuccess: m,
144
+ unmountOnError: s,
145
+ reset: l,
146
+ timeRemaining: d
147
+ }
148
+ )), /* @__PURE__ */ r("div", { ...c, className: B.view, children: y ? y({ view: e, Content: i }) : i });
149
+ }
150
+ }
151
+ );
152
+ };
153
+ export {
154
+ _t as FundForm,
155
+ mt as VIEWS
156
+ };
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { FundContextType, FundProps } from './types';
3
+ export declare const FundProvider: ({ children, fetchBuyOptions, fetchBuyQuote, inputType, onError, onStatus, onSuccess, ...props }: Omit<FundProps, "children"> & {
4
+ children: ReactNode;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const useFundContext: () => FundContextType;
@@ -0,0 +1,128 @@
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import { useEvmAddress as T } from "@coinbase/cdp-hooks";
3
+ import { createContext as R, useContext as U, useEffect as l, useMemo as b } from "react";
4
+ import { useBuyUrl as M } from "./hooks/useBuyUrl.js";
5
+ import { useEmitLifecycleStatus as g } from "./hooks/useEmitLifecycleStatus.js";
6
+ import { useExchangeRate as k } from "./hooks/useExchangeRate.js";
7
+ import { usePaymentMethods as H } from "./hooks/usePaymentMethods.js";
8
+ import { useFundReducer as N } from "./useFundReducer.js";
9
+ const x = {
10
+ country: "US",
11
+ cryptoCurrency: "ETH",
12
+ cryptoDecimalPlaces: 8,
13
+ fiatCurrency: "USD",
14
+ fiatDecimalPlaces: 2,
15
+ network: "base",
16
+ presetAmountInputs: void 0,
17
+ selectedInputType: "fiat",
18
+ transactionStatus: {
19
+ statusName: "init",
20
+ statusData: null
21
+ }
22
+ }, C = R(void 0), z = ({
23
+ children: c,
24
+ fetchBuyOptions: h,
25
+ fetchBuyQuote: f,
26
+ inputType: S,
27
+ onError: u,
28
+ onStatus: D,
29
+ onSuccess: F,
30
+ ...I
31
+ }) => {
32
+ const {
33
+ country: t,
34
+ cryptoCurrency: e,
35
+ cryptoDecimalPlaces: a,
36
+ fiatCurrency: s,
37
+ fiatDecimalPlaces: i,
38
+ locale: d,
39
+ network: o,
40
+ presetAmountInputs: m,
41
+ subdivision: n
42
+ } = I, { evmAddress: w } = T(), [p, r] = N({
43
+ ...x,
44
+ country: t,
45
+ cryptoCurrency: e,
46
+ cryptoDecimalPlaces: a,
47
+ fiatCurrency: s,
48
+ fiatDecimalPlaces: i,
49
+ locale: d,
50
+ network: o,
51
+ presetAmountInputs: m,
52
+ subdivision: n,
53
+ selectedInputType: S || x.selectedInputType
54
+ });
55
+ l(() => {
56
+ r({
57
+ type: "SYNC_WITH_PROPS",
58
+ payload: {
59
+ country: t,
60
+ cryptoCurrency: e,
61
+ cryptoDecimalPlaces: a,
62
+ fiatCurrency: s,
63
+ fiatDecimalPlaces: i,
64
+ locale: d,
65
+ network: o,
66
+ presetAmountInputs: m,
67
+ subdivision: n
68
+ }
69
+ });
70
+ }, [
71
+ t,
72
+ e,
73
+ a,
74
+ s,
75
+ i,
76
+ d,
77
+ o,
78
+ m,
79
+ n,
80
+ r
81
+ ]), g({
82
+ lifecycleStatus: p.transactionStatus,
83
+ onError: u,
84
+ onStatus: D,
85
+ onSuccess: F
86
+ });
87
+ const { fetchExchangeRate: y } = k({
88
+ cryptoCurrency: e,
89
+ country: t,
90
+ dispatch: r,
91
+ fetchBuyQuote: f,
92
+ fiatCurrency: s,
93
+ network: o,
94
+ onError: u,
95
+ subdivision: n
96
+ }), { fetchPaymentMethods: P } = H({
97
+ country: t,
98
+ cryptoCurrency: e,
99
+ dispatch: r,
100
+ fetchBuyOptions: h,
101
+ fiatCurrency: s,
102
+ network: o,
103
+ onError: u,
104
+ subdivision: n
105
+ }), { fetchBuyUrl: v } = M({
106
+ cryptoCurrency: e,
107
+ destinationAddress: w || void 0,
108
+ fiatCurrency: s,
109
+ fetchBuyQuote: f,
110
+ country: t,
111
+ network: o,
112
+ subdivision: n
113
+ }), A = b(() => ({ state: p, dispatch: r, fetchBuyUrl: v }), [p, r, v]);
114
+ return l(() => {
115
+ y();
116
+ }, [y]), l(() => {
117
+ P();
118
+ }, [P]), /* @__PURE__ */ E(C.Provider, { value: A, children: c });
119
+ }, G = () => {
120
+ const c = U(C);
121
+ if (!c)
122
+ throw new Error("useFundContext must be used within a FundProvider");
123
+ return c;
124
+ };
125
+ export {
126
+ z as FundProvider,
127
+ G as useFundContext
128
+ };
@@ -0,0 +1,5 @@
1
+ import { ElementType, HTMLAttributes } from 'react';
2
+ export interface FundTitleProps extends HTMLAttributes<HTMLDivElement> {
3
+ as?: ElementType;
4
+ }
5
+ export declare const FundTitle: ({ children, as: Component, className, ...props }: FundTitleProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import "react";
3
+ import { useFundContext as n } from "./FundProvider.js";
4
+ import '../../assets/FundTitle.css';const l = "FundTitle-module__title___K6czk", c = {
5
+ title: l
6
+ }, a = ({
7
+ children: t,
8
+ as: e = "h2",
9
+ className: o = "",
10
+ ...s
11
+ }) => {
12
+ const { state: r } = n();
13
+ return /* @__PURE__ */ i(e, { ...s, className: `${c.title} ${o}`, children: t || `Deposit ${r.cryptoCurrency.toUpperCase()}` });
14
+ };
15
+ export {
16
+ a as FundTitle
17
+ };
@@ -0,0 +1,5 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ export interface FundAmountInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "min" | "max" | "value"> {
3
+ error?: string;
4
+ }
5
+ export declare const FundAmountInput: import('react').ForwardRefExoticComponent<FundAmountInputProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,58 @@
1
+ import { jsxs as I, Fragment as _, jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as x, useId as g, useCallback as i } from "react";
3
+ import { ExchangeAmountInput as F } from "../../forms/ExchangeAmountInput/index.js";
4
+ import { Error as b } from "../../ui/Error/index.js";
5
+ import { useFundContext as v } from "../FundProvider.js";
6
+ import { createSetFieldAction as a } from "../useFundReducer.js";
7
+ import '../../../assets/FundAmountInput.css';const C = "FundAmountInput-module__error___lMqzh", s = {
8
+ "input-wrapper": "FundAmountInput-module__input-wrapper___6r-sX",
9
+ error: C
10
+ }, P = x(
11
+ ({ "aria-describedby": u, "aria-invalid": p, error: r, ...m }, d) => {
12
+ const { state: t, dispatch: e } = v(), c = g(), l = i(
13
+ (n) => {
14
+ e(a("cryptoAmount", n));
15
+ },
16
+ [e]
17
+ ), y = i(
18
+ (n) => {
19
+ e(a("fiatAmount", n));
20
+ },
21
+ [e]
22
+ ), f = i(
23
+ (n) => {
24
+ e(a("selectedInputType", n));
25
+ },
26
+ [e]
27
+ ), A = [r ? c : void 0, u].filter(Boolean).join(" "), h = !!(r || p);
28
+ return /* @__PURE__ */ I(_, { children: [
29
+ /* @__PURE__ */ o("div", { className: s["input-wrapper"], children: /* @__PURE__ */ o(
30
+ F,
31
+ {
32
+ ...m,
33
+ ref: d,
34
+ "aria-describedby": A || void 0,
35
+ "aria-invalid": h || void 0,
36
+ cryptoAmount: t.cryptoAmount,
37
+ cryptoCurrency: t.cryptoCurrency,
38
+ cryptoDecimalPlaces: t.cryptoDecimalPlaces,
39
+ exchangeRate: t.exchangeRate,
40
+ fiatAmount: t.fiatAmount,
41
+ fiatCurrency: t.fiatCurrency,
42
+ fiatDecimalPlaces: t.fiatDecimalPlaces,
43
+ inputType: t.selectedInputType,
44
+ isExchangeRatePending: t.isExchangeRatePending,
45
+ min: 0,
46
+ setCryptoAmount: l,
47
+ setFiatAmount: y,
48
+ setInputType: f
49
+ }
50
+ ) }),
51
+ r && /* @__PURE__ */ o(b, { id: c, className: s.error, children: r })
52
+ ] });
53
+ }
54
+ );
55
+ P.displayName = "FundAmountInput";
56
+ export {
57
+ P as FundAmountInput
58
+ };
@@ -0,0 +1,6 @@
1
+ import { FundStateError } from '../types';
2
+ interface FundErrorScreenProps {
3
+ error: FundStateError | null;
4
+ }
5
+ export declare const FundErrorScreen: ({ error }: FundErrorScreenProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,118 @@
1
+ import { jsxs as d, jsx as o, Fragment as y } from "react/jsx-runtime";
2
+ import { useMemo as i, Fragment as E } from "react";
3
+ import { IconExclamationTriangle as m } from "../../../icons/IconExclamationTriangle.js";
4
+ import { useFundContext as h } from "../FundProvider.js";
5
+ import '../../../assets/FundErrorScreen.css';const f = "FundErrorScreen-module__icon___Mf6ck", O = "FundErrorScreen-module__title___8Qv6o", g = "FundErrorScreen-module__body___-p-r9", U = "FundErrorScreen-module__keywords___u85Do", c = {
6
+ icon: f,
7
+ title: O,
8
+ body: g,
9
+ "docs-link": "FundErrorScreen-module__docs-link___mzeH8",
10
+ keywords: U
11
+ }, C = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), b = ({
12
+ message: s,
13
+ keywords: e,
14
+ className: t = ""
15
+ }) => {
16
+ if (!s || !e?.length)
17
+ return /* @__PURE__ */ o(y, { children: s });
18
+ const a = new RegExp(`(${e.map(C).join("|")})\\b`, "g"), r = s.split(a);
19
+ return /* @__PURE__ */ o(y, { children: r.map((n, u) => n ? e.includes(n) ? /* @__PURE__ */ o("span", { className: t, "data-part": "keyword", children: n }, u) : /* @__PURE__ */ o(E, { children: n }, u) : null) });
20
+ }, T = ({ error: s }) => {
21
+ const { state: e } = h(), { code: t, message: a } = s || {}, r = process.env.NODE_ENV === "development", n = e.network.charAt(0).toUpperCase() + e.network.slice(1), u = i(() => {
22
+ switch (t) {
23
+ case "NO_ONRAMP_URL":
24
+ case "BUY_URL_ERROR":
25
+ case "UNKNOWN_BUY_URL_ERROR":
26
+ return "https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/generating-quotes#example-request%2Fresponse-with-one-click-buy-url";
27
+ case "EXCHANGE_RATE_ERROR":
28
+ case "UNKNOWN_EXCHANGE_RATE_ERROR":
29
+ return "https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/generating-quotes#onramp-quote";
30
+ default:
31
+ return "https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/countries-&-currencies#fiat-currencies-and-crypto-assets-supported";
32
+ }
33
+ }, [t]), l = i(() => {
34
+ if (!r || !t)
35
+ return "";
36
+ switch (t) {
37
+ case "NO_ONRAMP_URL":
38
+ case "BUY_URL_ERROR":
39
+ case "UNKNOWN_BUY_URL_ERROR":
40
+ return "Use the Onramp Quote API with a destination address to get a one-click-buy URL.";
41
+ case "EXCHANGE_RATE_ERROR":
42
+ case "UNKNOWN_EXCHANGE_RATE_ERROR":
43
+ return "Use the Onramp Quote API to calculate the exchange rate.";
44
+ default:
45
+ return "Use the Buy Options API to see the full list of crypto assets that can be bought for each region your app supports.";
46
+ }
47
+ }, [t, r]), R = i(() => {
48
+ switch (t) {
49
+ case "INVALID_PURCHASE_CURRENCY":
50
+ return r ? "Invalid parameters" : `${e.cryptoCurrency} is not available`;
51
+ case "INVALID_NETWORK":
52
+ return r ? "Invalid parameters" : `${n} network is not available`;
53
+ case "NO_ONRAMP_URL":
54
+ case "BUY_URL_ERROR":
55
+ case "UNKNOWN_BUY_URL_ERROR":
56
+ return r ? "Onramp URL error" : "Something went wrong";
57
+ case "EXCHANGE_RATE_ERROR":
58
+ case "UNKNOWN_EXCHANGE_RATE_ERROR":
59
+ return "No exchange rate";
60
+ default:
61
+ return "No payment methods";
62
+ }
63
+ }, [t, e.cryptoCurrency, n, r]), _ = i(() => {
64
+ switch (t) {
65
+ case "PAYMENT_METHODS_ERROR":
66
+ case "UNKNOWN_PAYMENT_METHODS_ERROR":
67
+ return r ? a || "There was an error fetching the payment methods." : `Unfortunately there's no available payment method to purchase ${e.cryptoCurrency} with ${e.fiatCurrency} on ${n} in your region. Please select a different asset to buy.`;
68
+ case "INVALID_PURCHASE_CURRENCY":
69
+ return r ? `${e.cryptoCurrency} crypto asset is not available.` : "Please select a different asset to buy.";
70
+ case "INVALID_NETWORK":
71
+ return r ? `${e.network} is not available for buying ${e.cryptoCurrency} in your region.` : `Coinbase doesn’t support buying ${e.cryptoCurrency} on ${n} in your region. Please select a different network to buy ${e.cryptoCurrency} on.`;
72
+ case "NO_ONRAMP_URL":
73
+ return r ? "An onramp url was unable to be created" : "We’re running into some issues. Please try again later.";
74
+ case "BUY_URL_ERROR":
75
+ case "UNKNOWN_BUY_URL_ERROR":
76
+ return r ? a || "There was an error creating the onramp url." : "We’re running into some issues. Please try again later.";
77
+ case "EXCHANGE_RATE_ERROR":
78
+ case "UNKNOWN_EXCHANGE_RATE_ERROR":
79
+ return r ? a || "There was an error fetching the exchange rate." : `No exchange rate found for ${e.fiatCurrency}<>${e.cryptoCurrency} on ${n} in your region.`;
80
+ default:
81
+ return r ? `There's no available payment method to purchase ${e.cryptoCurrency} with ${e.fiatCurrency} on ${e.network} in your region.` : `Unfortunately there's no available payment method to purchase ${e.cryptoCurrency} with ${e.fiatCurrency} on ${n} in your region. Please select a different asset to buy.`;
82
+ }
83
+ }, [
84
+ t,
85
+ a,
86
+ e.cryptoCurrency,
87
+ e.network,
88
+ n,
89
+ r,
90
+ e.fiatCurrency
91
+ ]), N = i(() => {
92
+ const p = [e.cryptoCurrency, e.network, e.country, e.fiatCurrency];
93
+ return e.subdivision && p.push(e.subdivision), p;
94
+ }, [e.cryptoCurrency, e.network, e.country, e.fiatCurrency, e.subdivision]);
95
+ return !R || !_ ? null : /* @__PURE__ */ d("div", { children: [
96
+ /* @__PURE__ */ o(m, { className: c.icon }),
97
+ /* @__PURE__ */ o("p", { className: `${c.title}`, children: R }),
98
+ /* @__PURE__ */ o("p", { className: `${c.body} ${r ? c.keywords : ""}`, children: /* @__PURE__ */ o(b, { message: _, keywords: N }) }),
99
+ l && /* @__PURE__ */ d("p", { className: `${c.body}`, children: [
100
+ " ",
101
+ l,
102
+ " ",
103
+ /* @__PURE__ */ o(
104
+ "a",
105
+ {
106
+ className: c["docs-link"],
107
+ href: u,
108
+ target: "_blank",
109
+ rel: "noopener noreferrer",
110
+ children: "View docs"
111
+ }
112
+ )
113
+ ] })
114
+ ] });
115
+ };
116
+ export {
117
+ T as FundErrorScreen
118
+ };
@@ -0,0 +1,6 @@
1
+ import { ElementType, HTMLAttributes } from 'react';
2
+ interface FundPaymentMethodsProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
3
+ as?: ElementType;
4
+ }
5
+ export declare const FundPaymentMethods: ({ as: Component, ...props }: FundPaymentMethodsProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};