@mintmoney/react 0.1.0-alpha.9 → 0.2.0-alpha.1
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 +13 -88
- package/dist/css/styles.css +178 -7
- package/dist/docs/customisation.md +67 -0
- package/dist/docs/overview.md +19 -0
- package/dist/docs/quickstart.md +171 -0
- package/dist/esm/api/checkouts.js +13 -12
- package/dist/esm/api/checkouts.js.map +1 -1
- package/dist/esm/api/generated.js +961 -51
- package/dist/esm/api/generated.js.map +1 -1
- package/dist/esm/api/index.js +2 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/payments.js +74 -11
- package/dist/esm/api/payments.js.map +1 -1
- package/dist/esm/api/types.js +10 -1
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/checkout/claimable-funds.js +26 -0
- package/dist/esm/checkout/claimable-funds.js.map +1 -0
- package/dist/esm/checkout/container.js +1 -1
- package/dist/esm/checkout/creation-error-modal.js +6 -0
- package/dist/esm/checkout/creation-error-modal.js.map +1 -0
- package/dist/esm/checkout/index.js +100 -8
- package/dist/esm/checkout/index.js.map +1 -1
- package/dist/esm/checkout/launcher.js +6 -0
- package/dist/esm/checkout/launcher.js.map +1 -0
- package/dist/esm/checkout/modal.js +75 -35
- package/dist/esm/checkout/modal.js.map +1 -1
- package/dist/esm/checkout/payment-status.js +55 -0
- package/dist/esm/checkout/payment-status.js.map +1 -0
- package/dist/esm/checkout/providers/wagmi-config.js +108 -0
- package/dist/esm/checkout/providers/wagmi-config.js.map +1 -0
- package/dist/esm/checkout/providers/wallet-connect-resume.js +129 -0
- package/dist/esm/checkout/providers/wallet-connect-resume.js.map +1 -0
- package/dist/esm/checkout/refund-availability.js +16 -0
- package/dist/esm/checkout/refund-availability.js.map +1 -0
- package/dist/esm/checkout/resume-state.js +82 -0
- package/dist/esm/checkout/resume-state.js.map +1 -0
- package/dist/esm/checkout/surplus-refund.js +38 -0
- package/dist/esm/checkout/surplus-refund.js.map +1 -0
- package/dist/esm/checkout/views/amount-header.js +82 -0
- package/dist/esm/checkout/views/amount-header.js.map +1 -0
- package/dist/esm/checkout/views/back.js +2 -2
- package/dist/esm/checkout/views/back.js.map +1 -1
- package/dist/esm/checkout/views/claimable-funds.js +29 -0
- package/dist/esm/checkout/views/claimable-funds.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/direct-details.js +1037 -12
- package/dist/esm/checkout/views/crypto-intent/direct-details.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js +112 -0
- package/dist/esm/checkout/views/crypto-intent/manual-payment-summary.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js +69 -0
- package/dist/esm/checkout/views/crypto-intent/manual-refund-preference.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/methods.js +166 -18
- package/dist/esm/checkout/views/crypto-intent/methods.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/processing.js +89 -31
- package/dist/esm/checkout/views/crypto-intent/processing.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/success.js +70 -9
- package/dist/esm/checkout/views/crypto-intent/success.js.map +1 -1
- package/dist/esm/checkout/views/crypto-intent/test-payment.js +35 -0
- package/dist/esm/checkout/views/crypto-intent/test-payment.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js +30 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-confirmation-amount.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js +1207 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-payment-options.js.map +1 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js +166 -0
- package/dist/esm/checkout/views/crypto-intent/wallet-select.js.map +1 -0
- package/dist/esm/checkout/views/failed.js +91 -0
- package/dist/esm/checkout/views/failed.js.map +1 -0
- package/dist/esm/checkout/views/initial.js +63 -12
- package/dist/esm/checkout/views/initial.js.map +1 -1
- package/dist/esm/checkout/views/method-select.js +28 -5
- package/dist/esm/checkout/views/method-select.js.map +1 -1
- package/dist/esm/checkout/views/restart.js +12 -0
- package/dist/esm/checkout/views/restart.js.map +1 -0
- package/dist/esm/components/buttons/async-button.js +16 -0
- package/dist/esm/components/buttons/async-button.js.map +1 -0
- package/dist/esm/components/buttons/index.js +102 -16
- package/dist/esm/components/buttons/index.js.map +1 -1
- package/dist/esm/components/buttons/use-async-button.js +44 -0
- package/dist/esm/components/buttons/use-async-button.js.map +1 -0
- package/dist/esm/components/crypto/currency-selector.js +26 -0
- package/dist/esm/components/crypto/currency-selector.js.map +1 -0
- package/dist/esm/components/icons/alert.js +20 -0
- package/dist/esm/components/icons/alert.js.map +1 -0
- package/dist/esm/components/icons/checkMark.js.map +1 -1
- package/dist/esm/components/icons/clipboard-add.js +20 -0
- package/dist/esm/components/icons/clipboard-add.js.map +1 -0
- package/dist/esm/components/icons/clipboard-check.js +20 -0
- package/dist/esm/components/icons/clipboard-check.js.map +1 -0
- package/dist/esm/components/icons/clock.js +4 -0
- package/dist/esm/components/icons/clock.js.map +1 -0
- package/dist/esm/components/icons/close.js.map +1 -1
- package/dist/esm/components/icons/edit.js +6 -0
- package/dist/esm/components/icons/edit.js.map +1 -0
- package/dist/esm/components/icons/index.js +9 -0
- package/dist/esm/components/icons/index.js.map +1 -1
- package/dist/esm/components/icons/link.js +20 -0
- package/dist/esm/components/icons/link.js.map +1 -0
- package/dist/esm/components/icons/loading.js +26 -0
- package/dist/esm/components/icons/loading.js.map +1 -0
- package/dist/esm/components/icons/log-out.js +6 -0
- package/dist/esm/components/icons/log-out.js.map +1 -0
- package/dist/esm/components/icons/send.js +6 -0
- package/dist/esm/components/icons/send.js.map +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/inputs/index.js +47 -0
- package/dist/esm/components/inputs/index.js.map +1 -0
- package/dist/esm/components/lists/index.js.map +1 -1
- package/dist/esm/components/loading/index.js.map +1 -1
- package/dist/esm/components/modals/modal-with-views.js +7 -4
- package/dist/esm/components/modals/modal-with-views.js.map +1 -1
- package/dist/esm/components/modals/modal.js +3 -3
- package/dist/esm/components/modals/modal.js.map +1 -1
- package/dist/esm/components/modals/use-modal-with-views.js +11 -3
- package/dist/esm/components/modals/use-modal-with-views.js.map +1 -1
- package/dist/esm/components/quote-expiry/index.js +2 -0
- package/dist/esm/components/quote-expiry/index.js.map +1 -0
- package/dist/esm/components/quote-expiry/quote-expiry-countdown.js +35 -0
- package/dist/esm/components/quote-expiry/quote-expiry-countdown.js.map +1 -0
- package/dist/esm/components/quote-expiry/styles.js +109 -0
- package/dist/esm/components/quote-expiry/styles.js.map +1 -0
- package/dist/esm/components/quote-expiry/tiers.js +31 -0
- package/dist/esm/components/quote-expiry/tiers.js.map +1 -0
- package/dist/esm/components/text/index.js +2 -0
- package/dist/esm/components/text/index.js.map +1 -1
- package/dist/esm/components/wallet-selector/component.js +59 -0
- package/dist/esm/components/wallet-selector/component.js.map +1 -0
- package/dist/esm/components/wallet-selector/domain.js +2 -0
- package/dist/esm/components/wallet-selector/domain.js.map +1 -0
- package/dist/esm/components/wallet-selector/helper.js +12 -0
- package/dist/esm/components/wallet-selector/helper.js.map +1 -0
- package/dist/esm/components/wallet-selector/index.js +5 -0
- package/dist/esm/components/wallet-selector/index.js.map +1 -0
- package/dist/esm/components/wallet-selector/provider.js +15 -0
- package/dist/esm/components/wallet-selector/provider.js.map +1 -0
- package/dist/esm/components/wallet-selector/schemas.js +6 -0
- package/dist/esm/components/wallet-selector/schemas.js.map +1 -0
- package/dist/esm/components/wallet-selector/store.js +134 -0
- package/dist/esm/components/wallet-selector/store.js.map +1 -0
- package/dist/esm/components/wallet-selector/util/exceptions.js +16 -0
- package/dist/esm/components/wallet-selector/util/exceptions.js.map +1 -0
- package/dist/esm/components/wallet-selector/wallets/index.js +3 -0
- package/dist/esm/components/wallet-selector/wallets/index.js.map +1 -0
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js +218 -0
- package/dist/esm/components/wallet-selector/wallets/wagmi/index.js.map +1 -0
- package/dist/esm/components/wallet-selector/wallets/wagmi/usdt-abi.json +671 -0
- package/dist/esm/config.js +10 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/context.js +2 -1
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/integrations/evm-chain.js +22 -0
- package/dist/esm/integrations/evm-chain.js.map +1 -0
- package/dist/esm/integrations/index.js +3 -0
- package/dist/esm/integrations/index.js.map +1 -0
- package/dist/esm/integrations/lifi.js +218 -0
- package/dist/esm/integrations/lifi.js.map +1 -0
- package/dist/esm/integrations/types.js +2 -0
- package/dist/esm/integrations/types.js.map +1 -0
- package/dist/esm/refund/confirmation.js +30 -0
- package/dist/esm/refund/confirmation.js.map +1 -0
- package/dist/esm/refund/index.js +599 -0
- package/dist/esm/refund/index.js.map +1 -0
- package/dist/esm/refund/prepare-guard.js +13 -0
- package/dist/esm/refund/prepare-guard.js.map +1 -0
- package/dist/esm/state/checkout/payment-attempt.js +46 -0
- package/dist/esm/state/checkout/payment-attempt.js.map +1 -0
- package/dist/esm/state/checkout/payment-lifecycle.js +78 -0
- package/dist/esm/state/checkout/payment-lifecycle.js.map +1 -0
- package/dist/esm/state/checkout/store.js +841 -55
- package/dist/esm/state/checkout/store.js.map +1 -1
- package/dist/esm/state/checkout/wallet-payment-options.js +44 -0
- package/dist/esm/state/checkout/wallet-payment-options.js.map +1 -0
- package/dist/esm/themes/default.js +48 -0
- package/dist/esm/themes/default.js.map +1 -1
- package/dist/esm/themes/types.js +1 -1
- package/dist/esm/themes/types.js.map +1 -1
- package/dist/esm/utils/string.js +35 -0
- package/dist/esm/utils/string.js.map +1 -0
- package/dist/esm/utils/wallet-errors.js +15 -0
- package/dist/esm/utils/wallet-errors.js.map +1 -0
- package/dist/types/api/checkouts.d.ts +2 -8
- package/dist/types/api/checkouts.d.ts.map +1 -1
- package/dist/types/api/generated.d.ts +4653 -269
- package/dist/types/api/generated.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/payments.d.ts +53 -5
- package/dist/types/api/payments.d.ts.map +1 -1
- package/dist/types/api/types.d.ts +27 -7
- package/dist/types/api/types.d.ts.map +1 -1
- package/dist/types/checkout/claimable-funds.d.ts +9 -0
- package/dist/types/checkout/claimable-funds.d.ts.map +1 -0
- package/dist/types/checkout/creation-error-modal.d.ts +9 -0
- package/dist/types/checkout/creation-error-modal.d.ts.map +1 -0
- package/dist/types/checkout/index.d.ts +10 -2
- package/dist/types/checkout/index.d.ts.map +1 -1
- package/dist/types/checkout/launcher.d.ts +6 -0
- package/dist/types/checkout/launcher.d.ts.map +1 -0
- package/dist/types/checkout/modal.d.ts +4 -2
- package/dist/types/checkout/modal.d.ts.map +1 -1
- package/dist/types/checkout/payment-status.d.ts +23 -0
- package/dist/types/checkout/payment-status.d.ts.map +1 -0
- package/dist/types/checkout/providers/wagmi-config.d.ts +18 -0
- package/dist/types/checkout/providers/wagmi-config.d.ts.map +1 -0
- package/dist/types/checkout/providers/wallet-connect-resume.d.ts +9 -0
- package/dist/types/checkout/providers/wallet-connect-resume.d.ts.map +1 -0
- package/dist/types/checkout/refund-availability.d.ts +2 -0
- package/dist/types/checkout/refund-availability.d.ts.map +1 -0
- package/dist/types/checkout/resume-state.d.ts +13 -0
- package/dist/types/checkout/resume-state.d.ts.map +1 -0
- package/dist/types/checkout/surplus-refund.d.ts +10 -0
- package/dist/types/checkout/surplus-refund.d.ts.map +1 -0
- package/dist/types/checkout/views/amount-header.d.ts +10 -0
- package/dist/types/checkout/views/amount-header.d.ts.map +1 -0
- package/dist/types/checkout/views/back.d.ts +3 -1
- package/dist/types/checkout/views/back.d.ts.map +1 -1
- package/dist/types/checkout/views/claimable-funds.d.ts +2 -0
- package/dist/types/checkout/views/claimable-funds.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts +12 -1
- package/dist/types/checkout/views/crypto-intent/direct-details.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts +20 -0
- package/dist/types/checkout/views/crypto-intent/manual-payment-summary.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts +16 -0
- package/dist/types/checkout/views/crypto-intent/manual-refund-preference.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/methods.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/processing.d.ts +3 -2
- package/dist/types/checkout/views/crypto-intent/processing.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/success.d.ts.map +1 -1
- package/dist/types/checkout/views/crypto-intent/test-payment.d.ts +3 -0
- package/dist/types/checkout/views/crypto-intent/test-payment.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts +13 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-confirmation-amount.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts +3 -0
- package/dist/types/checkout/views/crypto-intent/wallet-payment-options.d.ts.map +1 -0
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts +3 -0
- package/dist/types/checkout/views/crypto-intent/wallet-select.d.ts.map +1 -0
- package/dist/types/checkout/views/failed.d.ts +2 -0
- package/dist/types/checkout/views/failed.d.ts.map +1 -0
- package/dist/types/checkout/views/initial.d.ts +6 -2
- package/dist/types/checkout/views/initial.d.ts.map +1 -1
- package/dist/types/checkout/views/method-select.d.ts +3 -0
- package/dist/types/checkout/views/method-select.d.ts.map +1 -1
- package/dist/types/checkout/views/restart.d.ts +4 -0
- package/dist/types/checkout/views/restart.d.ts.map +1 -0
- package/dist/types/components/buttons/async-button.d.ts +14 -0
- package/dist/types/components/buttons/async-button.d.ts.map +1 -0
- package/dist/types/components/buttons/index.d.ts +21 -3
- package/dist/types/components/buttons/index.d.ts.map +1 -1
- package/dist/types/components/buttons/use-async-button.d.ts +16 -0
- package/dist/types/components/buttons/use-async-button.d.ts.map +1 -0
- package/dist/types/components/crypto/currency-selector.d.ts +11 -0
- package/dist/types/components/crypto/currency-selector.d.ts.map +1 -0
- package/dist/types/components/icons/alert.d.ts +7 -0
- package/dist/types/components/icons/alert.d.ts.map +1 -0
- package/dist/types/components/icons/checkMark.d.ts.map +1 -1
- package/dist/types/components/icons/clipboard-add.d.ts +6 -0
- package/dist/types/components/icons/clipboard-add.d.ts.map +1 -0
- package/dist/types/components/icons/clipboard-check.d.ts +6 -0
- package/dist/types/components/icons/clipboard-check.d.ts.map +1 -0
- package/dist/types/components/icons/clock.d.ts +6 -0
- package/dist/types/components/icons/clock.d.ts.map +1 -0
- package/dist/types/components/icons/close.d.ts.map +1 -1
- package/dist/types/components/icons/edit.d.ts +6 -0
- package/dist/types/components/icons/edit.d.ts.map +1 -0
- package/dist/types/components/icons/index.d.ts +9 -0
- package/dist/types/components/icons/index.d.ts.map +1 -1
- package/dist/types/components/icons/link.d.ts +6 -0
- package/dist/types/components/icons/link.d.ts.map +1 -0
- package/dist/types/components/icons/loading.d.ts +6 -0
- package/dist/types/components/icons/loading.d.ts.map +1 -0
- package/dist/types/components/icons/log-out.d.ts +6 -0
- package/dist/types/components/icons/log-out.d.ts.map +1 -0
- package/dist/types/components/icons/send.d.ts +6 -0
- package/dist/types/components/icons/send.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/inputs/index.d.ts +7 -0
- package/dist/types/components/inputs/index.d.ts.map +1 -0
- package/dist/types/components/lists/index.d.ts.map +1 -1
- package/dist/types/components/loading/index.d.ts.map +1 -1
- package/dist/types/components/modals/modal-with-views.d.ts +1 -0
- package/dist/types/components/modals/modal-with-views.d.ts.map +1 -1
- package/dist/types/components/modals/modal.d.ts.map +1 -1
- package/dist/types/components/modals/use-modal-with-views.d.ts.map +1 -1
- package/dist/types/components/quote-expiry/index.d.ts +2 -0
- package/dist/types/components/quote-expiry/index.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/quote-expiry-countdown.d.ts +15 -0
- package/dist/types/components/quote-expiry/quote-expiry-countdown.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/styles.d.ts +22 -0
- package/dist/types/components/quote-expiry/styles.d.ts.map +1 -0
- package/dist/types/components/quote-expiry/tiers.d.ts +10 -0
- package/dist/types/components/quote-expiry/tiers.d.ts.map +1 -0
- package/dist/types/components/text/index.d.ts.map +1 -1
- package/dist/types/components/wallet-selector/component.d.ts +12 -0
- package/dist/types/components/wallet-selector/component.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/domain.d.ts +96 -0
- package/dist/types/components/wallet-selector/domain.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/helper.d.ts +4 -0
- package/dist/types/components/wallet-selector/helper.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/index.d.ts +7 -0
- package/dist/types/components/wallet-selector/index.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/provider.d.ts +10 -0
- package/dist/types/components/wallet-selector/provider.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/schemas.d.ts +4 -0
- package/dist/types/components/wallet-selector/schemas.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/store.d.ts +33 -0
- package/dist/types/components/wallet-selector/store.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/util/exceptions.d.ts +7 -0
- package/dist/types/components/wallet-selector/util/exceptions.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/wallets/index.d.ts +3 -0
- package/dist/types/components/wallet-selector/wallets/index.d.ts.map +1 -0
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts +519 -0
- package/dist/types/components/wallet-selector/wallets/wagmi/index.d.ts.map +1 -0
- package/dist/types/config.d.ts +74 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrations/evm-chain.d.ts +3 -0
- package/dist/types/integrations/evm-chain.d.ts.map +1 -0
- package/dist/types/integrations/index.d.ts +3 -0
- package/dist/types/integrations/index.d.ts.map +1 -0
- package/dist/types/integrations/lifi.d.ts +14 -0
- package/dist/types/integrations/lifi.d.ts.map +1 -0
- package/dist/types/integrations/types.d.ts +5 -0
- package/dist/types/integrations/types.d.ts.map +1 -0
- package/dist/types/refund/confirmation.d.ts +14 -0
- package/dist/types/refund/confirmation.d.ts.map +1 -0
- package/dist/types/refund/index.d.ts +26 -0
- package/dist/types/refund/index.d.ts.map +1 -0
- package/dist/types/refund/prepare-guard.d.ts +11 -0
- package/dist/types/refund/prepare-guard.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-attempt.d.ts +9 -0
- package/dist/types/state/checkout/payment-attempt.d.ts.map +1 -0
- package/dist/types/state/checkout/payment-lifecycle.d.ts +39 -0
- package/dist/types/state/checkout/payment-lifecycle.d.ts.map +1 -0
- package/dist/types/state/checkout/store.d.ts +88 -40
- package/dist/types/state/checkout/store.d.ts.map +1 -1
- package/dist/types/state/checkout/wallet-payment-options.d.ts +24 -0
- package/dist/types/state/checkout/wallet-payment-options.d.ts.map +1 -0
- package/dist/types/themes/default.d.ts +2 -2
- package/dist/types/themes/default.d.ts.map +1 -1
- package/dist/types/themes/types.d.ts +20 -0
- package/dist/types/themes/types.d.ts.map +1 -1
- package/dist/types/utils/string.d.ts +24 -0
- package/dist/types/utils/string.d.ts.map +1 -0
- package/dist/types/utils/wallet-errors.d.ts +2 -0
- package/dist/types/utils/wallet-errors.d.ts.map +1 -0
- package/package.json +50 -7
- package/LICENSE +0 -21
- package/dist/esm/checkout/views/card-intent/details.js +0 -12
- package/dist/esm/checkout/views/card-intent/details.js.map +0 -1
- package/dist/esm/checkout/views/crypto-intent/curreny.js +0 -28
- package/dist/esm/checkout/views/crypto-intent/curreny.js.map +0 -1
- package/dist/types/checkout/views/card-intent/details.d.ts +0 -3
- package/dist/types/checkout/views/card-intent/details.d.ts.map +0 -1
- package/dist/types/checkout/views/crypto-intent/curreny.d.ts +0 -3
- package/dist/types/checkout/views/crypto-intent/curreny.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,94 +1,19 @@
|
|
|
1
|
-
# mintmoney
|
|
1
|
+
# @mintmoney/react
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
to integrate the mint money payments checkout into your web application.
|
|
3
|
+
A React SDK for integrating MintMoney payments into your web application. This package provides a simple and customizable way to accept cryptocurrency payments in your React application.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Installation
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
|
|
15
|
-
|
|
16
|
-
import { routes } from './routes.tsx';
|
|
17
|
-
import { ViewportProvider } from '@/contexts/viewport-context.tsx';
|
|
18
|
-
import { createConfig } from "@mintmoney/react/config"
|
|
19
|
-
import { MintMoneyProvider } from "@mintmoney/react/context"
|
|
20
|
-
|
|
21
|
-
export const router = createBrowserRouter([routes], {
|
|
22
|
-
basename: import.meta.env.VITE_BASENAME || '/',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const config = createConfig("pk_8tcytWcpd8vfUuclzqWgRGzW", {
|
|
26
|
-
checkoutId: 'your-checkout-id',
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const App = () => {
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<ViewportProvider>
|
|
33
|
-
<MintMoneyProvider config={config}>
|
|
34
|
-
<RouterProvider router={router} />;
|
|
35
|
-
</MintMoneyProvider>
|
|
36
|
-
</ViewportProvider>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
```jsx
|
|
44
|
-
import { cn } from "@/util/class-name-merge";
|
|
45
|
-
import { Checkout } from "@mintmoney/react/checkout";
|
|
46
|
-
import { useState } from "react";
|
|
47
|
-
import "@mintmoney/react/css/styles.css";
|
|
48
|
-
|
|
49
|
-
export default () => {
|
|
50
|
-
const [amount, setAmount] = (useState < number) | (null > null);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div className="flex flex-col gap-4 items-center">
|
|
54
|
-
<h1 className="text-center">Mint Money Connect Demo</h1>
|
|
55
|
-
<div className="flex gap-4">
|
|
56
|
-
<button onClick={() => setAmount(10.0)}>$10</button>
|
|
57
|
-
<button onClick={() => setAmount(50.0)}>$50</button>
|
|
58
|
-
<button onClick={() => setAmount(150.0)}>$150</button>
|
|
59
|
-
</div>
|
|
60
|
-
<div>
|
|
61
|
-
<Checkout amount={amount} />
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mintmoney/react
|
|
9
|
+
# or
|
|
10
|
+
yarn add @mintmoney/react
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @mintmoney/react
|
|
66
13
|
```
|
|
67
14
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
🟢 Ensure you're running node version 22
|
|
71
|
-
|
|
72
|
-
`nvm install 22 && nvm use 22`
|
|
73
|
-
|
|
74
|
-
🟢 Install dependencies and set up package workspace.
|
|
75
|
-
|
|
76
|
-
`npm install`
|
|
77
|
-
|
|
78
|
-
🟢 build the packages
|
|
79
|
-
|
|
80
|
-
`npm run build`
|
|
81
|
-
|
|
82
|
-
🟢 create a linkable package for dev
|
|
83
|
-
|
|
84
|
-
`npm run link`
|
|
85
|
-
|
|
86
|
-
🟢 Install the @mintmoney/react package
|
|
87
|
-
|
|
88
|
-
`cd platgrounds/vite-react-app`
|
|
89
|
-
|
|
90
|
-
`npm link @mintmoney/react`
|
|
91
|
-
|
|
92
|
-
🟢 Run example app
|
|
15
|
+
## Documentation
|
|
93
16
|
|
|
94
|
-
|
|
17
|
+
- [Quickstart Guide](../docs/guides/quickstart.md) - Get started with @mintmoney/react
|
|
18
|
+
- [Overview](../docs/guides/overview.md) - Learn about the SDK's features and architecture
|
|
19
|
+
- [Customization](../docs/guides/customisation.md) - Customize the checkout experience
|
package/dist/css/styles.css
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Nunito
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700&display=swap");
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--mm-font-family: "Nunito", sans-serif;
|
|
5
|
+
}
|
|
2
6
|
|
|
3
7
|
.mm-root {
|
|
4
|
-
font-family: var(--mm-font-family
|
|
8
|
+
font-family: var(--mm-font-family);
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
.mm-qr-container {
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
.mm-modal-overlay {
|
|
29
33
|
position: fixed;
|
|
30
34
|
inset: 0;
|
|
31
|
-
z-index:
|
|
35
|
+
z-index: 149;
|
|
32
36
|
background-color: rgba(0, 0, 0, 0.2);
|
|
33
37
|
backdrop-filter: blur(4px);
|
|
34
38
|
}
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
.mm-modal-container {
|
|
37
41
|
display: flex;
|
|
38
42
|
flex-direction: column;
|
|
39
|
-
z-index:
|
|
43
|
+
z-index: 150;
|
|
40
44
|
position: fixed;
|
|
41
45
|
width: 100%;
|
|
42
46
|
pointer-events: auto;
|
|
@@ -50,17 +54,57 @@
|
|
|
50
54
|
min-height: 300px;
|
|
51
55
|
min-width: 400px;
|
|
52
56
|
max-width: 400px;
|
|
53
|
-
max-height:
|
|
54
|
-
overflow-y:
|
|
57
|
+
max-height: calc(100dvh - 32px);
|
|
58
|
+
overflow-y: hidden;
|
|
59
|
+
overflow-x: visible;
|
|
55
60
|
border-radius: 20px;
|
|
56
61
|
margin: auto;
|
|
62
|
+
font-family: var(--mm-font-family);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Mobile full-screen modal */
|
|
66
|
+
@media (max-width: 768px) {
|
|
67
|
+
.mm-modal-container {
|
|
68
|
+
width: 100vw !important;
|
|
69
|
+
height: 100dvh !important;
|
|
70
|
+
max-width: 100vw !important;
|
|
71
|
+
max-height: 100dvh !important;
|
|
72
|
+
min-width: 100vw !important;
|
|
73
|
+
min-height: 100dvh !important;
|
|
74
|
+
left: 0 !important;
|
|
75
|
+
top: 0 !important;
|
|
76
|
+
transform: none !important;
|
|
77
|
+
border-radius: 0 !important;
|
|
78
|
+
margin: 0 !important;
|
|
79
|
+
padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
|
|
80
|
+
}
|
|
57
81
|
}
|
|
58
82
|
|
|
59
83
|
.mm-modal-content {
|
|
60
84
|
display: flex;
|
|
61
85
|
flex-direction: column;
|
|
62
86
|
height: 100%;
|
|
63
|
-
min-height:
|
|
87
|
+
min-height: 0;
|
|
88
|
+
/* view-transition-name: wrapper;
|
|
89
|
+
view-transition-containment: layout; */
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.mm-checkout-creation-error .mm-modal-content {
|
|
93
|
+
flex: 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.mm-checkout-creation-error .mm-modal-footer {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Mobile full-height content */
|
|
103
|
+
@media (max-width: 768px) {
|
|
104
|
+
.mm-modal-content {
|
|
105
|
+
height: 100%;
|
|
106
|
+
min-height: 0;
|
|
107
|
+
}
|
|
64
108
|
}
|
|
65
109
|
|
|
66
110
|
.mm-modal-nav {
|
|
@@ -70,6 +114,30 @@
|
|
|
70
114
|
align-items: center;
|
|
71
115
|
}
|
|
72
116
|
|
|
117
|
+
.mm-modal-nav button {
|
|
118
|
+
background: transparent;
|
|
119
|
+
border: none;
|
|
120
|
+
padding: 6px;
|
|
121
|
+
border-radius: 10px;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mm-modal-nav button:hover {
|
|
126
|
+
background: rgba(148, 163, 184, 0.12);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.mm-modal-nav button svg {
|
|
130
|
+
display: block;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Mobile navigation adjustments */
|
|
134
|
+
@media (max-width: 768px) {
|
|
135
|
+
.mm-modal-nav {
|
|
136
|
+
margin-bottom: 12px;
|
|
137
|
+
padding: 0 4px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
73
141
|
.mm-modal-nav-left {
|
|
74
142
|
justify-content: flex-start;
|
|
75
143
|
}
|
|
@@ -88,17 +156,86 @@
|
|
|
88
156
|
font-weight: bold;
|
|
89
157
|
}
|
|
90
158
|
|
|
159
|
+
/* Mobile header adjustments */
|
|
160
|
+
@media (max-width: 768px) {
|
|
161
|
+
.mm-modal-header {
|
|
162
|
+
padding-bottom: 8px;
|
|
163
|
+
font-size: 16px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
91
167
|
.mm-modal-body {
|
|
92
168
|
display: flex;
|
|
93
169
|
flex-grow: 1;
|
|
170
|
+
min-height: 0;
|
|
94
171
|
overflow-y: auto;
|
|
95
172
|
overflow-x: hidden;
|
|
173
|
+
position: relative;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.mm-modal-container {
|
|
177
|
+
scrollbar-width: none;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.mm-modal-container::-webkit-scrollbar,
|
|
181
|
+
.mm-modal-body::-webkit-scrollbar {
|
|
182
|
+
width: 0;
|
|
183
|
+
height: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Mobile full-height body */
|
|
187
|
+
@media (max-width: 768px) {
|
|
188
|
+
.mm-modal-body {
|
|
189
|
+
flex: 1;
|
|
190
|
+
min-height: 0;
|
|
191
|
+
overflow-y: auto;
|
|
192
|
+
overflow-x: hidden;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.mm-checkout-modal.mm-modal-view-methods .mm-modal-content,
|
|
196
|
+
.mm-checkout-modal.mm-modal-view-cryptoIntent .mm-modal-content,
|
|
197
|
+
.mm-checkout-modal.mm-modal-view-paymentStatus .mm-modal-content,
|
|
198
|
+
.mm-checkout-modal.mm-modal-view-paymentSuccess .mm-modal-content,
|
|
199
|
+
.mm-checkout-modal.mm-modal-view-failed .mm-modal-content {
|
|
200
|
+
justify-content: center;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.mm-checkout-modal.mm-modal-view-methods .mm-modal-body,
|
|
204
|
+
.mm-checkout-modal.mm-modal-view-cryptoIntent .mm-modal-body,
|
|
205
|
+
.mm-checkout-modal.mm-modal-view-paymentStatus .mm-modal-body,
|
|
206
|
+
.mm-checkout-modal.mm-modal-view-paymentSuccess .mm-modal-body,
|
|
207
|
+
.mm-checkout-modal.mm-modal-view-failed .mm-modal-body {
|
|
208
|
+
flex: 0 0 auto;
|
|
209
|
+
min-height: auto;
|
|
210
|
+
overflow: visible;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.mm-checkout-modal.mm-modal-view-methods .mm-modal-footer,
|
|
214
|
+
.mm-checkout-modal.mm-modal-view-cryptoIntent .mm-modal-footer,
|
|
215
|
+
.mm-checkout-modal.mm-modal-view-paymentStatus .mm-modal-footer,
|
|
216
|
+
.mm-checkout-modal.mm-modal-view-paymentSuccess .mm-modal-footer,
|
|
217
|
+
.mm-checkout-modal.mm-modal-view-failed .mm-modal-footer {
|
|
218
|
+
flex: 0 0 auto;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
::view-transition-old(wrapper),
|
|
223
|
+
::view-transition-new(wrapper) {
|
|
224
|
+
animation-duration: 200ms;
|
|
225
|
+
animation-timing-function: ease-out;
|
|
96
226
|
}
|
|
97
227
|
|
|
98
228
|
.mm-modal-footer {
|
|
99
229
|
padding-top: 24px;
|
|
100
230
|
}
|
|
101
231
|
|
|
232
|
+
/* Mobile footer adjustments */
|
|
233
|
+
@media (max-width: 768px) {
|
|
234
|
+
.mm-modal-footer {
|
|
235
|
+
padding-top: 16px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
102
239
|
@keyframes spin {
|
|
103
240
|
0% {
|
|
104
241
|
transform: rotate(0deg);
|
|
@@ -140,6 +277,40 @@
|
|
|
140
277
|
box-shadow: 0 0 0 3px rgba(26, 83, 255, 0.4);
|
|
141
278
|
}
|
|
142
279
|
|
|
280
|
+
.loading-animation {
|
|
281
|
+
animation: fadeIn 0.3s ease-in-out;
|
|
282
|
+
}
|
|
283
|
+
.success-animation {
|
|
284
|
+
animation: fadeIn 0.5s ease-in-out;
|
|
285
|
+
}
|
|
286
|
+
.error-animation {
|
|
287
|
+
animation: shake 0.5s ease-in-out;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@keyframes fadeIn {
|
|
291
|
+
from {
|
|
292
|
+
opacity: 0;
|
|
293
|
+
}
|
|
294
|
+
to {
|
|
295
|
+
opacity: 1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@keyframes shake {
|
|
300
|
+
0%,
|
|
301
|
+
100% {
|
|
302
|
+
transform: translateX(0);
|
|
303
|
+
}
|
|
304
|
+
20%,
|
|
305
|
+
60% {
|
|
306
|
+
transform: translateX(-4px);
|
|
307
|
+
}
|
|
308
|
+
40%,
|
|
309
|
+
80% {
|
|
310
|
+
transform: translateX(4px);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
143
314
|
/* ***********************************************
|
|
144
315
|
* Lists
|
|
145
316
|
* **********************************************/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Customisation
|
|
2
|
+
|
|
3
|
+
## MintMoney UI Namespace (`mm-`)
|
|
4
|
+
|
|
5
|
+
### 🎯 What is the `mm-` Namespace?
|
|
6
|
+
|
|
7
|
+
The **`mm-` namespace** is a **CSS class prefix** used in MintMoney UI to:
|
|
8
|
+
|
|
9
|
+
- **Scope styles** to MintMoney components.
|
|
10
|
+
- **Prevent style conflicts** with other CSS in consuming applications.
|
|
11
|
+
- **Provide customization flexibility** through CSS variables.
|
|
12
|
+
|
|
13
|
+
### **Example of Namespace Usage**
|
|
14
|
+
|
|
15
|
+
```css
|
|
16
|
+
.mm-button {
|
|
17
|
+
background-color: var(--mm-color-primary);
|
|
18
|
+
font-family: var(--mm-font-family);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Customizing Fonts
|
|
23
|
+
|
|
24
|
+
MintMoney UI allows you to customize fonts using CSS variables. This ensures flexibility while maintaining a consistent
|
|
25
|
+
look across all components.
|
|
26
|
+
|
|
27
|
+
### 🎨 Default Font
|
|
28
|
+
|
|
29
|
+
By default, MintMoney UI uses **Nunito Sans** as the primary font:
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
.mm-root {
|
|
33
|
+
font-family: var(--mm-font-family, "Nunito Sans"), sans-serif;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Overriding the default font
|
|
38
|
+
|
|
39
|
+
If you want to override the font for only a specific section, apply the CSS variable to a class.
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
:root {
|
|
43
|
+
--mm-font-family: "Inter", sans-serif;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Surplus refund thresholds
|
|
48
|
+
|
|
49
|
+
The checkout success view only surfaces a surplus claim CTA when the refundable surplus is large enough to be useful. By default, MintMoney uses a raw token threshold of `1000000` base units for USDC/USDT-style stablecoins, which is `1.00` for 6-decimal assets. Unknown assets default to `0` so their refunds are not hidden accidentally.
|
|
50
|
+
|
|
51
|
+
You can override thresholds through `cryptoCheckoutConfig.surplusRefundMinimums`:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
createConfig("pk_test_...", {
|
|
55
|
+
checkoutId: "checkout_...",
|
|
56
|
+
cryptoCheckoutConfig: {
|
|
57
|
+
numBlockConfirmations: 1,
|
|
58
|
+
paymentConfirmationStatus: PaymentStatus.CONFIRMING_PAYMENT,
|
|
59
|
+
surplusRefundMinimums: [
|
|
60
|
+
{
|
|
61
|
+
symbol: "USDC",
|
|
62
|
+
minimumBaseUnits: "5000000",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Guides
|
|
2
|
+
|
|
3
|
+
This page demonstrates some of the built-in markdown extensions provided by VitePress.
|
|
4
|
+
|
|
5
|
+
## Syntax Highlighting
|
|
6
|
+
|
|
7
|
+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
|
|
8
|
+
|
|
9
|
+
**Input**
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
export default {
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
msg: "Highlighted!",
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
```
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Quickstart
|
|
2
|
+
|
|
3
|
+
This guide walks you through integrating @mintmoney/react into your React application, including both frontend setup and backend integration.
|
|
4
|
+
|
|
5
|
+
## 🚀 Prerequisites
|
|
6
|
+
|
|
7
|
+
Before starting, ensure you have the following:
|
|
8
|
+
|
|
9
|
+
- ✅ A React application (React 18+)
|
|
10
|
+
- ✅ API Keys from your MintMoney dashboard
|
|
11
|
+
- ✅ A backend server (Node.js/Express recommended)
|
|
12
|
+
|
|
13
|
+
## 📥 Installation
|
|
14
|
+
|
|
15
|
+
Install @mintmoney/react in your project:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @mintmoney/react
|
|
19
|
+
# or
|
|
20
|
+
yarn add @mintmoney/react
|
|
21
|
+
# or
|
|
22
|
+
pnpm add @mintmoney/react
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🛠️ SDK Setup
|
|
26
|
+
|
|
27
|
+
Add the MintMoneyProvider to your application's root component:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { createConfig } from "@mintmoney/react/config";
|
|
31
|
+
import { MintMoneyProvider } from "@mintmoney/react/context";
|
|
32
|
+
import "@mintmoney/react/css/styles.css"; // Import default styles
|
|
33
|
+
|
|
34
|
+
const config = createConfig("your-public-key", {
|
|
35
|
+
apiUrl: "https://api.mintmoney.com", // Your API URL
|
|
36
|
+
checkoutId: "your-checkout-id", // Your checkout ID
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const App = () => {
|
|
40
|
+
return (
|
|
41
|
+
<MintMoneyProvider config={config}>
|
|
42
|
+
<YourApp />
|
|
43
|
+
</MintMoneyProvider>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 🔒 Backend Integration
|
|
49
|
+
|
|
50
|
+
For security, always create payments through a server-side endpoint. Here's an example using Express:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// Example using Express
|
|
54
|
+
app.post("/api/create-payment", async (req, res) => {
|
|
55
|
+
const { amount, currency } = req.body;
|
|
56
|
+
|
|
57
|
+
// Validate required fields
|
|
58
|
+
if (!amount || !currency) {
|
|
59
|
+
res.status(400).json({ error: "Missing required fields" });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
// Make request to MintMoney API
|
|
65
|
+
const response = await fetch(`${process.env.API_URL}/v1/payments`, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: {
|
|
68
|
+
"Content-Type": "application/json",
|
|
69
|
+
"x-api-key": process.env.API_SECRET_KEY,
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
amount: Number(amount), // Ensure amount is a number
|
|
73
|
+
currency: currency.toUpperCase(), // Ensure currency is uppercase
|
|
74
|
+
checkout_id: process.env.CHECKOUT_ID,
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const data = await response.json();
|
|
79
|
+
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
throw new Error(data.error || "Failed to create payment");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
res.json(data);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error("Payment creation error:", error);
|
|
87
|
+
res.status(500).json({
|
|
88
|
+
error:
|
|
89
|
+
error instanceof Error ? error.message : "Failed to create payment",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 💳 Using the Checkout Component
|
|
96
|
+
|
|
97
|
+
Add the Checkout component to your application:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { Checkout } from "@mintmoney/react";
|
|
101
|
+
|
|
102
|
+
function ProductPage() {
|
|
103
|
+
const orderId = "your-stable-order-id";
|
|
104
|
+
|
|
105
|
+
const handleCreatePayment = async () => {
|
|
106
|
+
// Call your server endpoint to create the payment
|
|
107
|
+
const response = await fetch("/api/create-payment", {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: {
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
},
|
|
112
|
+
body: JSON.stringify({
|
|
113
|
+
amount: 10.99, // Amount in the currency's standard unit (e.g., dollars)
|
|
114
|
+
currency: "USD", // Currency code (e.g., USD, EUR)
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (!response.ok) {
|
|
119
|
+
const error = await response.json();
|
|
120
|
+
throw new Error(error.error || "Failed to create payment");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return response.json();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const handleSuccess = (paymentId: string) => {
|
|
127
|
+
// Handle successful payment
|
|
128
|
+
console.log("Payment successful:", paymentId);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleError = (error: Error) => {
|
|
132
|
+
// Handle payment error
|
|
133
|
+
console.error("Payment failed:", error);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Checkout
|
|
138
|
+
createPayment={handleCreatePayment}
|
|
139
|
+
onSuccess={handleSuccess}
|
|
140
|
+
onError={handleError}
|
|
141
|
+
>
|
|
142
|
+
{/* Optional: Custom trigger button */}
|
|
143
|
+
<button>Pay with Crypto</button>
|
|
144
|
+
</Checkout>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Checkout Component Props
|
|
150
|
+
|
|
151
|
+
| Prop | Type | Required | Description |
|
|
152
|
+
| --------------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------- |
|
|
153
|
+
| `createPayment` | `() => Promise<Payment>` | Yes | Function that calls your server endpoint to create a payment. Must be implemented server-side. |
|
|
154
|
+
| `onSuccess` | `(paymentId: string) => Promise<void>` | No | Callback when payment is successful |
|
|
155
|
+
| `onError` | `(error: Error) => Promise<void>` | No | Callback when payment fails |
|
|
156
|
+
| `asChild` | `boolean` | No | Whether to use the child element as the trigger button |
|
|
157
|
+
| `children` | `ReactNode` | No | Custom trigger element when asChild is true |
|
|
158
|
+
|
|
159
|
+
## ⚠️ Security Considerations
|
|
160
|
+
|
|
161
|
+
- Never expose your API secret key in the frontend code
|
|
162
|
+
- Always create payments through a server-side endpoint
|
|
163
|
+
- Use environment variables to store sensitive credentials
|
|
164
|
+
- Implement proper error handling and validation on the server
|
|
165
|
+
- Use HTTPS for all API communications
|
|
166
|
+
|
|
167
|
+
## 📚 Next Steps
|
|
168
|
+
|
|
169
|
+
- Learn about [customizing the checkout experience](./customisation.md)
|
|
170
|
+
- Read the [overview guide](./overview.md) for more details about the SDK
|
|
171
|
+
- Check out our [example implementations](https://github.com/mintmoney/mintmoney-js/tree/main/examples) for more use cases
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export const getCheckoutCryptoCurrencies = (checkout) => {
|
|
2
|
+
if (!checkout.checkout_config.crypto?.enabled ||
|
|
3
|
+
!checkout.checkout_config.crypto.settlementConfig) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const settlementConfig = checkout.checkout_config.crypto.settlementConfig;
|
|
3
7
|
return {
|
|
4
|
-
|
|
8
|
+
chain: settlementConfig.chain,
|
|
9
|
+
asset: settlementConfig.asset,
|
|
10
|
+
chain_name: settlementConfig.chain_name,
|
|
11
|
+
asset_name: settlementConfig.asset_name,
|
|
12
|
+
asset_id: settlementConfig.asset_id,
|
|
13
|
+
logo_url: settlementConfig.logo_url,
|
|
14
|
+
chain_logo_url: settlementConfig.chain_logo_url,
|
|
5
15
|
};
|
|
6
16
|
};
|
|
7
|
-
export const getCheckoutCryptoCurrencies = (checkout) => {
|
|
8
|
-
return checkout.checkout_config.crypto?.enabled
|
|
9
|
-
? checkout.checkout_config.crypto.assets || []
|
|
10
|
-
: [];
|
|
11
|
-
};
|
|
12
|
-
export async function getCheckoutById(checkoutId) {
|
|
13
|
-
const resp = await api.v1.checkoutsDetail(checkoutId);
|
|
14
|
-
return checkoutDTO(resp.data);
|
|
15
|
-
}
|
|
16
17
|
//# sourceMappingURL=checkouts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkouts.js","sourceRoot":"","sources":["../../../src/api/checkouts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkouts.js","sourceRoot":"","sources":["../../../src/api/checkouts.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,QAAkB,EACK,EAAE;IACzB,IACE,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO;QACzC,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,gBAAgB,EACjD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAC1E,OAAO;QACL,KAAK,EAAE,gBAAgB,CAAC,KAAK;QAC7B,KAAK,EAAE,gBAAgB,CAAC,KAAK;QAC7B,UAAU,EAAE,gBAAgB,CAAC,UAAU;QACvC,UAAU,EAAE,gBAAgB,CAAC,UAAU;QACvC,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;QACnC,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;QACnC,cAAc,EAAE,gBAAgB,CAAC,cAAc;KAChD,CAAC;AACJ,CAAC,CAAC"}
|