@coinbase/cdp-react 0.0.58 → 0.0.61
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 +10 -8
- package/dist/assets/Banner.css +1 -0
- package/dist/assets/CopyAddress.css +1 -0
- package/dist/assets/ExportWallet.css +1 -0
- package/dist/assets/ExportWalletModal.css +1 -0
- package/dist/assets/IframeButton.css +1 -0
- package/dist/assets/Input.css +1 -1
- package/dist/assets/LinkAuth.css +1 -0
- package/dist/assets/LinkAuthFlow.css +1 -0
- package/dist/assets/LinkAuthFlowBackButton.css +1 -0
- package/dist/assets/LinkAuthItem.css +1 -0
- package/dist/assets/LinkAuthItems.css +1 -0
- package/dist/assets/LinkAuthModal.css +1 -0
- package/dist/assets/LinkAuthTitle.css +1 -0
- package/dist/assets/SwitchSlideTransition.css +1 -1
- package/dist/chunks/LinkAuthFlow.CxSnHF2p.js +111 -0
- package/dist/components/CDPReactProvider/index.js +71 -55
- package/dist/components/CopyAddress/index.d.ts +8 -0
- package/dist/components/CopyAddress/index.js +61 -0
- package/dist/components/CopyEvmKeyButton/index.d.ts +13 -0
- package/dist/components/CopyEvmKeyButton/index.js +61 -0
- package/dist/components/CopySolanaKeyButton/index.d.ts +13 -0
- package/dist/components/CopySolanaKeyButton/index.js +61 -0
- package/dist/components/ExportWallet/index.d.ts +21 -0
- package/dist/components/ExportWallet/index.js +110 -0
- package/dist/components/ExportWalletModal/index.d.ts +18 -0
- package/dist/components/ExportWalletModal/index.js +96 -0
- package/dist/components/LinkAuth/LinkAuthFlow.d.ts +13 -0
- package/dist/components/LinkAuth/LinkAuthFlow.js +19 -0
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.d.ts +9 -0
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +40 -0
- package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +33 -0
- package/dist/components/LinkAuth/LinkAuthFlowProvider.js +9 -0
- package/dist/components/LinkAuth/LinkAuthItem.d.ts +13 -0
- package/dist/components/LinkAuth/LinkAuthItem.js +48 -0
- package/dist/components/LinkAuth/LinkAuthItems.d.ts +9 -0
- package/dist/components/LinkAuth/LinkAuthItems.js +47 -0
- package/dist/components/LinkAuth/LinkAuthProvider.d.ts +12 -0
- package/dist/components/LinkAuth/LinkAuthProvider.js +108 -0
- package/dist/components/LinkAuth/LinkAuthTitle.d.ts +6 -0
- package/dist/components/LinkAuth/LinkAuthTitle.js +19 -0
- package/dist/components/LinkAuth/index.d.ts +17 -0
- package/dist/components/LinkAuth/index.js +93 -0
- package/dist/components/LinkAuth/types.d.ts +32 -0
- package/dist/components/LinkAuth/types.js +5 -0
- package/dist/components/LinkAuth/utils.d.ts +4 -0
- package/dist/components/LinkAuth/utils.js +7 -0
- package/dist/components/LinkAuthModal/index.d.ts +21 -0
- package/dist/components/LinkAuthModal/index.js +69 -0
- package/dist/components/OAuthStatusModal/index.d.ts +7 -1
- package/dist/components/OAuthStatusModal/index.js +115 -93
- package/dist/components/SignIn/SignInAuthMethodButtons.js +36 -34
- package/dist/components/SignIn/SignInForm.d.ts +2 -1
- package/dist/components/SignIn/SignInForm.js +19 -18
- package/dist/components/SignIn/SignInProvider.d.ts +2 -1
- package/dist/components/SignIn/SignInProvider.js +22 -17
- package/dist/components/SignIn/flows/SignInWithEmail.d.ts +1 -1
- package/dist/components/SignIn/flows/SignInWithEmail.js +66 -61
- package/dist/components/SignIn/flows/SignInWithSms.d.ts +1 -1
- package/dist/components/SignIn/flows/SignInWithSms.js +90 -2987
- package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +0 -1
- package/dist/components/SignIn/hooks/useSignInWithOAuth.js +19 -20
- package/dist/components/SignIn/index.d.ts +3 -1
- package/dist/components/SignIn/index.js +16 -11
- package/dist/components/SignIn/types.d.ts +2 -0
- package/dist/components/SignIn/useSignInReducer.js +1 -0
- package/dist/components/SignInModal/index.d.ts +3 -1
- package/dist/components/SignInModal/index.js +72 -65
- package/dist/components/forms/Label/index.d.ts +2 -2
- package/dist/components/forms/PhoneNumberInput/index.js +24 -22
- package/dist/components/ui/Banner/index.d.ts +7 -0
- package/dist/components/ui/Banner/index.js +27 -0
- package/dist/components/ui/IframeButton/index.d.ts +11 -0
- package/dist/components/ui/IframeButton/index.js +50 -0
- package/dist/components/ui/Modal/index.js +22 -22
- package/dist/components/ui/SwitchTransition/index.d.ts +3 -1
- package/dist/components/ui/SwitchTransition/index.js +1 -1
- package/dist/hooks/useKeyExportPostMessage.d.ts +38 -0
- package/dist/hooks/useKeyExportPostMessage.js +83 -0
- package/dist/hooks/useTransitionMap.d.ts +50 -0
- package/dist/hooks/useTransitionMap.js +92 -0
- package/dist/icons/IconCopy.d.ts +2 -0
- package/dist/icons/IconCopy.js +10 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +20 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +122 -107
- package/dist/theme/theme.d.ts +33 -4
- package/dist/theme/tokens.d.ts +99 -12
- package/dist/theme/tokens.js +29 -12
- package/dist/types/secureIframe.d.ts +30 -0
- package/dist/types/secureIframe.js +13 -0
- package/dist/utils/childrenHasComponent.d.ts +1 -1
- package/dist/utils/formatPhoneNumber.d.ts +1 -0
- package/dist/utils/formatPhoneNumber.js +2910 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -6
- package/dist/utils/sendIframeMessage.d.ts +1 -0
- package/dist/utils/sendIframeMessage.js +13 -0
- package/dist/utils/transition.d.ts +30 -0
- package/dist/utils/transition.js +43 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -9
- package/dist/assets/ManageAuth.css +0 -1
- package/dist/assets/ManageAuthItem.css +0 -1
- package/dist/assets/ManageAuthModal.css +0 -1
- package/dist/components/ManageAuth/ManageAuthItem.d.ts +0 -9
- package/dist/components/ManageAuth/ManageAuthItem.js +0 -77
- package/dist/components/ManageAuth/ManageAuthProvider.d.ts +0 -8
- package/dist/components/ManageAuth/ManageAuthProvider.js +0 -64
- package/dist/components/ManageAuth/index.d.ts +0 -9
- package/dist/components/ManageAuth/index.js +0 -51
- package/dist/components/ManageAuth/types.d.ts +0 -13
- package/dist/components/ManageAuth/types.js +0 -1
- package/dist/components/ManageAuthModal/index.d.ts +0 -20
- package/dist/components/ManageAuthModal/index.js +0 -53
package/README.md
CHANGED
|
@@ -3,14 +3,16 @@ the CDP frontend SDK.
|
|
|
3
3
|
|
|
4
4
|
## Components
|
|
5
5
|
|
|
6
|
-
- {@link SignInModal |
|
|
7
|
-
- {@link SignIn |
|
|
8
|
-
- {@link SignOutButton |
|
|
9
|
-
- {@link AuthButton |
|
|
10
|
-
- {@link SendEvmTransactionButton |
|
|
11
|
-
- {@link SendSolanaTransactionButton |
|
|
12
|
-
- {@link Fund |
|
|
13
|
-
- {@link FundModal |
|
|
6
|
+
- {@link SignInModal | SignInModal} - a button that triggers a modal with the sign-in flow
|
|
7
|
+
- {@link SignIn | SignIn} - the forms for the sign in flow, a logo, heading, and description text
|
|
8
|
+
- {@link SignOutButton | SignOutButton} - a sign out button
|
|
9
|
+
- {@link AuthButton | AuthButton} - the `SignOutButton` when logged in, and the `SignInModal` when logged out
|
|
10
|
+
- {@link SendEvmTransactionButton | SendEvmTransactionButton} - a button that signs and sends an EVM transaction
|
|
11
|
+
- {@link SendSolanaTransactionButton | SendSolanaTransactionButton} - a button that signs and sends a Solana transaction
|
|
12
|
+
- {@link Fund | Fund} - the fund flow
|
|
13
|
+
- {@link FundModal | FundModal} - a button that triggers a modal with the fund flow
|
|
14
|
+
- {@link LinkAuth | LinkAuth} - a component to link or unlink auth methods
|
|
15
|
+
- {@link LinkAuthModal | LinkAuthModal} - a button that triggers a modal with the link / unlink flow
|
|
14
16
|
|
|
15
17
|
## Quickstart
|
|
16
18
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Banner-module__banner___vODjX{border-radius:var(--cdp-web-borderRadius-banner);display:flex;gap:.5em;padding:.75em;line-height:1.25em;background-color:var(--cdp-web-colors-bg-alternate);color:var(--cdp-web-colors-page-text-default)}.Banner-module__banner___vODjX[data-variant=error]{background-color:var(--cdp-web-colors-bg-negativeWash);color:var(--cdp-web-colors-fg-onNegativeWash)}.Banner-module__banner___vODjX[data-variant=success]{background-color:var(--cdp-web-colors-bg-positiveWash);color:var(--cdp-web-colors-fg-onPositiveWash)}.Banner-module__banner___vODjX[data-variant=warning]{background-color:var(--cdp-web-colors-bg-warningWash);color:var(--cdp-web-colors-fg-onWarningWash)}.Banner-module__banner___vODjX .Banner-module__icon___wzB6C{width:1.5em;height:1.25em;display:flex;align-items:center;justify-content:center}.Banner-module__banner___vODjX[data-variant=error] .Banner-module__icon___wzB6C{color:var(--cdp-web-colors-fg-negative)}.Banner-module__banner___vODjX[data-variant=success] .Banner-module__icon___wzB6C{color:var(--cdp-web-colors-fg-positive)}.Banner-module__banner___vODjX[data-variant=warning] .Banner-module__icon___wzB6C{color:var(--cdp-web-colors-fg-warning)}.Banner-module__banner___vODjX svg{width:.875em;height:.875em}.Banner-module__banner___vODjX .Banner-module__text___fTYC-{font-size:.875em;padding-right:.25em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.CopyAddress-module__address-copy___KpKeI{display:flex;flex-direction:column;gap:.25em}.CopyAddress-module__label___O2o5m{display:block}.CopyAddress-module__address-input-container___qq0TH{position:relative;background-color:var(--cdp-web-colors-input-bg-readonly);color:var(--cdp-web-colors-input-text-readonly);cursor:pointer;border-radius:var(--cdp-web-borderRadius-input);padding:.75em;display:flex;align-items:center;justify-content:space-between;gap:.5em}.CopyAddress-module__address-truncated___kr8St{font-size:.875em;color:var(--cdp-web-colors-input-text-readonly);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.CopyAddress-module__copy-button___64o2y{align-items:center;background:transparent;border:0;border-radius:var(--cdp-web-borderRadius-cta);color:var(--cdp-web-colors-input-text-readonly);cursor:pointer;display:flex;height:1.5em;line-height:1;justify-content:center;padding:0;width:1.5em}.CopyAddress-module__copy-button___64o2y:focus{outline:none}.CopyAddress-module__copy-button___64o2y:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-input-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);box-shadow:inset 0 0 0 2px var(--cdp-web-button-ring-inset-color),0 0 0 2px var(--cdp-web-button-ring-color)}.CopyAddress-module__success-icon___qXipU{display:block;width:1.25em;height:1.25em}.CopyAddress-module__copy-icon___lUbYG{display:block;width:.875em;height:.875em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ExportWallet-module__export-wallet___EyZys{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;gap:1em;padding:1.5em 1.5em 1em;overflow:hidden;width:100%}.ExportWallet-module__export-wallet___EyZys *{box-sizing:border-box}.ExportWallet-module__export-wallet-title___MuI09{font-size:1em;line-height:1.1;font-weight:600;margin:0}.ExportWallet-module__footer___NvrFY{padding-left:0;padding-right:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ExportWalletModal-module__export-wallet___--L56{height:100%;overflow:hidden;gap:0}.ExportWalletModal-module__export-wallet___--L56.ExportWalletModal-module__no-footer___J8uj2{padding-bottom:2em}.ExportWalletModal-module__trigger___zMk8N{padding-left:2em;padding-right:2em}.ExportWalletModal-module__title-bar___RTPZq{display:flex;justify-content:space-between;align-items:center;margin-bottom:1em;width:100%}.ExportWalletModal-module__content___KzNol{display:flex;flex-direction:column;gap:1em}.ExportWalletModal-module__close-button___ImsDR{padding:0}.ExportWalletModal-module__close-icon___iAfyT{height:1.5em;width:1.5em}.ExportWalletModal-module__footer___byg1T{padding:.75em 0 0}@media (min-width: 450px){.ExportWalletModal-module__modal___pX1AP{max-width:22.5em}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.IframeButton-module__iframe-button___XeAhH{position:relative;width:min-content;height:3.5em;padding-left:2.5em;padding-right:2.5em}.IframeButton-module__iframe-button___XeAhH>*{grid-area:center}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__full-width___lQWpM{width:100%}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-lg___HCOiF{height:4em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-md___p44a4{height:3.5em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-sm___U8ILi{padding-left:2em;padding-right:2em;height:3em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-xs___S2jGa{padding-left:1.5em;padding-right:1.5em;height:2.5em}.IframeButton-module__loading-skeleton___fzBol{border-radius:var(--cdp-web-borderRadius-cta);width:calc(100% - .5em);height:calc(100% - .5em);position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__label___Vvl8W{visibility:hidden;white-space:nowrap;position:relative}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__with-icon___KBiq1 .IframeButton-module__label___Vvl8W{padding-left:1em}.IframeButton-module__iframe___0RBLL{border:none;width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__iframe___0RBLL.IframeButton-module__hidden___LcF1X{display:none}
|
package/dist/assets/Input.css
CHANGED
|
@@ -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-input);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding:1em;border-radius:var(--cdp-web-borderRadius-input);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
|
+
.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-input);font-size:var(--cdp-web-font-size-base);line-height:1.5;padding:1em;border-radius:var(--cdp-web-borderRadius-input);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[readonly]{--cdp-web-input-ring-color: transparent;background-color:var(--cdp-web-colors-input-bg-readonly);color:var(--cdp-web-colors-input-text-readonly)}.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,.Input-module__input___-mK8z[readonly]: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],.Input-module__input___-mK8z[readonly][aria-invalid=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-error)}.Input-module__input___-mK8z[data-success=true],.Input-module__input___-mK8z[readonly][data-success=true]{--cdp-web-input-ring-color: var(--cdp-web-colors-input-border-success)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuth-module__link-auth___kPJao{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;gap:1em;max-width:38.25em;overflow:hidden;padding:1.5em 0;width:100%}.LinkAuth-module__link-auth___kPJao *{box-sizing:border-box}.LinkAuth-module__header___0UuxP,.LinkAuth-module__error___XUo4W{padding:0 1.5em}.LinkAuth-module__error___XUo4W:empty{display:none}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthFlow-module__sign-in___F2bj7{padding:0 1.5em}.LinkAuthFlow-module__sign-in-title-desc-wrapper___6QeTc{display:flex;flex-direction:column;gap:1.5em;margin-bottom:1.5em}.LinkAuthFlow-module__sign-in-image___XGuJI{flex-grow:1;margin:2em 0}.LinkAuthFlow-module__sign-in-form___REZlP,.LinkAuthFlow-module__sign-in-form___REZlP form{flex-grow:1}.LinkAuthFlow-module__sign-in-footer___KYZNd{margin-top:1.5em}.LinkAuthFlow-module__list___dkNmh{padding-left:1.5em;padding-right:1.5em}@media (min-width: 450px){.LinkAuthFlow-module__sign-in-image___XGuJI{flex-grow:0;margin:0 0 1.5em}.LinkAuthFlow-module__sign-in-image___XGuJI:empty{display:none}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthFlowBackButton-module__button___wPKfW{padding:0}.LinkAuthFlowBackButton-module__icon___OUmzY{width:1.5em;height:1.5em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthItem-module__item___NE3CT{display:flex;align-items:center;justify-content:flex-start;gap:.75em;padding:.5em 1em;margin:0;box-shadow:inset 0 0 0 1px var(--cdp-web-colors-page-border-default);color:var(--cdp-web-colors-page-text-default);border-radius:.75em}.LinkAuthItem-module__item-icon___ZIQny{display:flex;align-items:center;justify-content:center;width:1em;height:1em}.LinkAuthItem-module__item-icon___ZIQny svg{width:.875em;height:.875em}.LinkAuthItem-module__item-text___-5DVL{font-weight:500;font-size:.875em;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.LinkAuthItem-module__item-action___4wOIN{display:flex;align-items:center;margin-left:auto;margin-right:0}.LinkAuthItem-module__button___nM5Tc{width:1.5em;height:1.5em;padding:0}.LinkAuthItem-module__button___nM5Tc:disabled{opacity:.5;cursor:not-allowed}.LinkAuthItem-module__button___nM5Tc svg{width:.75em;height:.75em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthItems-module__list___5AimM{display:flex;flex-direction:column;gap:.75em;list-style:none;margin:0;padding:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthModal-module__header___qoco6{display:flex;align-items:center;justify-content:space-between;padding:0 1.5em}.LinkAuthModal-module__error___Srl7H{padding:0 1.5em}.LinkAuthModal-module__error___Srl7H:empty{display:none}.LinkAuthModal-module__close-icon___Fe02C{width:1.5em;height:1.5em}.LinkAuthModal-module__close-button___x6j3c{padding:0}.LinkAuthModal-module__trigger___aHDfG{padding-left:2em;padding-right:2em}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.LinkAuthTitle-module__title___HIjM6{font-size:var(--cdp-web-font-size-base);font-weight:600;line-height:1.5;margin:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status],.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-right][data-status]{width:100%;transition:opacity var(--cdp-web-transition-timeout, .2s),transform var(--cdp-web-transition-timeout, .2s)}.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left],.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right],.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left][data-animate-height=true]>div,.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right][data-animate-height=true]>div{display:flex;position:relative;width:100%}.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left][data-animate-height=true]>div,.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right][data-animate-height=true]>div{align-items:flex-start}.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status=preEnter]{opacity:0;transform:
|
|
1
|
+
.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status],.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-right][data-status]{width:100%;transition:opacity var(--cdp-web-transition-timeout, .2s),transform var(--cdp-web-transition-timeout, .2s)}.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left],.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right],.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left][data-animate-height=true]>div,.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right][data-animate-height=true]>div{display:flex;position:relative;width:100%}.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-left][data-animate-height=true]>div,.SwitchSlideTransition-module__switch-slide-transition___FykQG[data-transition=slide-right][data-animate-height=true]>div{align-items:flex-start}.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status=preEnter]{opacity:0;transform:translate3d(200%,0,0)}.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status=exiting],.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-left][data-status=exited]{position:absolute;opacity:0;transform:translate3d(-200%,0,0)}.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-right][data-status=preEnter]{opacity:0;transform:translate3d(-200%,0,0)}.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-right][data-status=exiting],.SwitchSlideTransition-module__switch-slide-transition___FykQG [data-transition=slide-right][data-status=exited]{position:absolute;opacity:0;transform:translate3d(200%,0,0)}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as i, jsxs as m, Fragment as p } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as S, useContext as I, useMemo as v, forwardRef as A, useRef as L, useImperativeHandle as x, useEffect as N } from "react";
|
|
3
|
+
import { useAppConfig as C } from "../components/CDPReactProvider/index.js";
|
|
4
|
+
import { SignIn as _ } from "../components/SignIn/index.js";
|
|
5
|
+
import "@coinbase/cdp-hooks";
|
|
6
|
+
import { SwitchSlideTransition as T } from "../components/ui/SwitchSlideTransition/index.js";
|
|
7
|
+
import { VisuallyHidden as h } from "../components/ui/VisuallyHidden/index.js";
|
|
8
|
+
import { LinkAuthItems as E } from "../components/LinkAuth/LinkAuthItems.js";
|
|
9
|
+
import { LINK_AUTH_FLOW_VIEWS as R } from "../components/LinkAuth/types.js";
|
|
10
|
+
import { useSignInContext as y } from "../components/SignIn/SignInProvider.js";
|
|
11
|
+
import { SignInImage as b } from "../components/SignIn/SignInImage.js";
|
|
12
|
+
import { SignInForm as H } from "../components/SignIn/SignInForm.js";
|
|
13
|
+
import { SignInTitle as g } from "../components/SignIn/SignInTitle.js";
|
|
14
|
+
import { SignInDescription as w } from "../components/SignIn/SignInDescription.js";
|
|
15
|
+
import { SignInFooter as P } from "../components/SignIn/SignInFooter.js";
|
|
16
|
+
import '../assets/LinkAuthFlow.css';const j = "LinkAuthFlow-module__list___dkNmh", c = {
|
|
17
|
+
"sign-in": "LinkAuthFlow-module__sign-in___F2bj7",
|
|
18
|
+
"sign-in-title-desc-wrapper": "LinkAuthFlow-module__sign-in-title-desc-wrapper___6QeTc",
|
|
19
|
+
"sign-in-image": "LinkAuthFlow-module__sign-in-image___XGuJI",
|
|
20
|
+
"sign-in-form": "LinkAuthFlow-module__sign-in-form___REZlP",
|
|
21
|
+
"sign-in-footer": "LinkAuthFlow-module__sign-in-footer___KYZNd",
|
|
22
|
+
list: j
|
|
23
|
+
}, k = S(null), f = () => {
|
|
24
|
+
const t = I(k);
|
|
25
|
+
if (!t)
|
|
26
|
+
throw new Error("useLinkAuthFlowInternal must be used within a LinkAuthFlowContext.Provider");
|
|
27
|
+
return t;
|
|
28
|
+
}, $ = () => {
|
|
29
|
+
const {
|
|
30
|
+
signInRef: t,
|
|
31
|
+
transitionRef: u,
|
|
32
|
+
...s
|
|
33
|
+
} = f();
|
|
34
|
+
return s;
|
|
35
|
+
}, K = ({
|
|
36
|
+
direction: t = "left",
|
|
37
|
+
children: u,
|
|
38
|
+
onBack: s,
|
|
39
|
+
onLink: e,
|
|
40
|
+
onLinkSuccess: r,
|
|
41
|
+
signInRef: a,
|
|
42
|
+
transitionRef: n
|
|
43
|
+
}) => {
|
|
44
|
+
const o = v(
|
|
45
|
+
() => ({
|
|
46
|
+
direction: t,
|
|
47
|
+
back: s,
|
|
48
|
+
link: e,
|
|
49
|
+
linkSuccess: r,
|
|
50
|
+
signInRef: a,
|
|
51
|
+
transitionRef: n
|
|
52
|
+
}),
|
|
53
|
+
[s, e, r, n, a, t]
|
|
54
|
+
);
|
|
55
|
+
return /* @__PURE__ */ i(k.Provider, { value: o, children: u });
|
|
56
|
+
}, d = A((t, u) => {
|
|
57
|
+
const { showCoinbaseFooter: s } = C(), { state: e, dispatch: r } = y(), { linkSuccess: a } = f(), n = L(null);
|
|
58
|
+
return x(
|
|
59
|
+
u,
|
|
60
|
+
() => ({
|
|
61
|
+
canGoBack: e.step === "verification",
|
|
62
|
+
goBack: () => {
|
|
63
|
+
r({ type: "RESET_STATE" });
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
[e.step, r]
|
|
67
|
+
), N(() => {
|
|
68
|
+
let o;
|
|
69
|
+
return e.step === "credentials" && (o = setTimeout(() => {
|
|
70
|
+
n.current?.querySelector("input[type='email'], input[type='tel']")?.focus();
|
|
71
|
+
}, 300)), e.step === "verification" && (o = setTimeout(() => {
|
|
72
|
+
n.current?.querySelector("input[type='text']")?.focus();
|
|
73
|
+
}, 300)), () => clearTimeout(o);
|
|
74
|
+
}, [e.step]), /* @__PURE__ */ m(p, { children: [
|
|
75
|
+
/* @__PURE__ */ i("div", { className: c["sign-in-image"], children: /* @__PURE__ */ i(b, {}) }),
|
|
76
|
+
/* @__PURE__ */ i(H, { autoFocus: !1, onSuccess: a, children: ({ authMethod: o, step: l, Form: F }) => /* @__PURE__ */ m(p, { children: [
|
|
77
|
+
/* @__PURE__ */ m("div", { className: c["sign-in-title-desc-wrapper"], children: [
|
|
78
|
+
l === "verification" ? /* @__PURE__ */ i(h, { as: "div", children: /* @__PURE__ */ i(g, {}) }) : /* @__PURE__ */ i(g, {}),
|
|
79
|
+
l === "credentials" ? /* @__PURE__ */ i(h, { as: "div", children: /* @__PURE__ */ i(w, { authMethod: o }) }) : /* @__PURE__ */ i(w, { authMethod: o })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ i("div", { ref: n, className: c["sign-in-form"], children: F })
|
|
82
|
+
] }) }),
|
|
83
|
+
s && /* @__PURE__ */ i(P, { className: c["sign-in-footer"] })
|
|
84
|
+
] });
|
|
85
|
+
});
|
|
86
|
+
d.displayName = "SignInContent";
|
|
87
|
+
const ii = ({ children: t }) => {
|
|
88
|
+
const { direction: u, link: s, linkSuccess: e, signInRef: r, transitionRef: a } = f();
|
|
89
|
+
return /* @__PURE__ */ i(
|
|
90
|
+
T,
|
|
91
|
+
{
|
|
92
|
+
autoFocus: !1,
|
|
93
|
+
animateHeight: !0,
|
|
94
|
+
items: R,
|
|
95
|
+
initialEntered: !0,
|
|
96
|
+
timeout: 250,
|
|
97
|
+
direction: u,
|
|
98
|
+
transitionRef: a,
|
|
99
|
+
children: ({ itemKey: n, ...o }) => {
|
|
100
|
+
let l = null;
|
|
101
|
+
return n === "list" && (l = /* @__PURE__ */ i(E, { className: c.list, onLink: s })), n === "email" && (l = /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(_, { className: c["sign-in"], authMethods: ["email"], onSuccess: e, children: /* @__PURE__ */ i(d, { ref: r }) }) })), n === "sms" && (l = /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(_, { className: c["sign-in"], authMethods: ["sms"], onSuccess: e, children: /* @__PURE__ */ i(d, { ref: r }) }) })), /* @__PURE__ */ i("div", { ...o, children: t ? t({ view: n, Content: l }) : l });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
ii as L,
|
|
108
|
+
K as a,
|
|
109
|
+
f as b,
|
|
110
|
+
$ as u
|
|
111
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { OAuth2ProviderType as
|
|
3
|
-
import { lazy as
|
|
4
|
-
import { ThemeProvider as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as p, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { OAuth2ProviderType as S, CDPContext as U, CDPHooksProvider as _ } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { lazy as E, createContext as j, useContext as m, useMemo as L } from "react";
|
|
4
|
+
import { ThemeProvider as F } from "../ThemeProvider/index.js";
|
|
5
|
+
const k = E(() => import("../OAuthStatusModal/index.js")), I = (t) => {
|
|
6
6
|
try {
|
|
7
|
-
return JSON.stringify(
|
|
7
|
+
return JSON.stringify(t);
|
|
8
8
|
} catch {
|
|
9
9
|
}
|
|
10
10
|
return "";
|
|
11
|
-
},
|
|
11
|
+
}, J = Object.keys(S).map((t) => `oauth:${t}`), V = [
|
|
12
12
|
/** Email OTP method */
|
|
13
13
|
"email",
|
|
14
14
|
/** SMS OTP method */
|
|
15
15
|
"sms"
|
|
16
|
-
],
|
|
17
|
-
children:
|
|
16
|
+
], G = [...V, ...J], K = ({
|
|
17
|
+
children: t,
|
|
18
18
|
className: r = "",
|
|
19
19
|
config: n,
|
|
20
20
|
name: s,
|
|
@@ -23,51 +23,67 @@ const E = S(() => import("../OAuthStatusModal/index.js")), j = (o) => {
|
|
|
23
23
|
}) => {
|
|
24
24
|
const {
|
|
25
25
|
appName: h,
|
|
26
|
-
appLogoUrl:
|
|
26
|
+
appLogoUrl: c,
|
|
27
27
|
showCoinbaseFooter: u,
|
|
28
|
-
authMethods:
|
|
28
|
+
authMethods: e,
|
|
29
29
|
projectId: d,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
secureIframeBasePath: C,
|
|
31
|
+
useMock: l,
|
|
32
|
+
debugging: f,
|
|
33
|
+
basePath: A,
|
|
34
|
+
ethereum: y,
|
|
35
|
+
solana: b,
|
|
36
|
+
disableAnalytics: O,
|
|
37
|
+
customAuth: P
|
|
38
|
+
} = n, { createOnLogin: M } = y ?? {}, { createOnLogin: v } = b ?? {}, w = L(
|
|
36
39
|
() => ({
|
|
37
40
|
projectId: d,
|
|
38
|
-
useMock:
|
|
39
|
-
debugging:
|
|
40
|
-
basePath:
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
useMock: l,
|
|
42
|
+
debugging: f,
|
|
43
|
+
basePath: A,
|
|
44
|
+
secureIframeBasePath: C,
|
|
45
|
+
disableAnalytics: O,
|
|
46
|
+
customAuth: P,
|
|
47
|
+
ethereum: { createOnLogin: M },
|
|
48
|
+
solana: { createOnLogin: v }
|
|
43
49
|
}),
|
|
44
|
-
[
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
[
|
|
51
|
+
d,
|
|
52
|
+
l,
|
|
53
|
+
f,
|
|
54
|
+
A,
|
|
55
|
+
C,
|
|
56
|
+
M,
|
|
57
|
+
v,
|
|
58
|
+
O,
|
|
59
|
+
P
|
|
60
|
+
]
|
|
61
|
+
), N = { appName: h, appLogoUrl: c, showCoinbaseFooter: u, authMethods: e }, T = e?.some((D) => D.startsWith("oauth:")), x = /* @__PURE__ */ p(z, { name: s, config: N, children: /* @__PURE__ */ H(F, { className: r, style: a, theme: i, children: [
|
|
62
|
+
t,
|
|
63
|
+
T && /* @__PURE__ */ p(k, {})
|
|
48
64
|
] }) });
|
|
49
|
-
return m(
|
|
50
|
-
}, g =
|
|
65
|
+
return m(U) ? x : /* @__PURE__ */ p(_, { config: w, children: x });
|
|
66
|
+
}, g = j(
|
|
51
67
|
void 0
|
|
52
|
-
),
|
|
68
|
+
), o = {
|
|
53
69
|
appName: "",
|
|
54
70
|
appLogoUrl: "",
|
|
55
71
|
showCoinbaseFooter: !0,
|
|
56
72
|
authMethods: ["email"]
|
|
57
|
-
},
|
|
58
|
-
children:
|
|
73
|
+
}, z = ({
|
|
74
|
+
children: t,
|
|
59
75
|
config: r,
|
|
60
76
|
name: n
|
|
61
77
|
}) => {
|
|
62
78
|
const {
|
|
63
|
-
appName: s =
|
|
64
|
-
appLogoUrl: a =
|
|
65
|
-
showCoinbaseFooter: i =
|
|
66
|
-
authMethods: h =
|
|
67
|
-
} = r ?? {},
|
|
68
|
-
let
|
|
79
|
+
appName: s = o.appName,
|
|
80
|
+
appLogoUrl: a = o.appLogoUrl,
|
|
81
|
+
showCoinbaseFooter: i = o.showCoinbaseFooter,
|
|
82
|
+
authMethods: h = o.authMethods
|
|
83
|
+
} = r ?? {}, c = I(h), u = L(() => {
|
|
84
|
+
let e = ["email"];
|
|
69
85
|
try {
|
|
70
|
-
|
|
86
|
+
e = JSON.parse(c);
|
|
71
87
|
} catch {
|
|
72
88
|
}
|
|
73
89
|
return {
|
|
@@ -75,28 +91,28 @@ const E = S(() => import("../OAuthStatusModal/index.js")), j = (o) => {
|
|
|
75
91
|
appName: s,
|
|
76
92
|
appLogoUrl: a,
|
|
77
93
|
showCoinbaseFooter: i,
|
|
78
|
-
authMethods: Array.isArray(
|
|
94
|
+
authMethods: Array.isArray(e) && e?.length ? e : o.authMethods
|
|
79
95
|
},
|
|
80
96
|
name: n
|
|
81
97
|
};
|
|
82
|
-
}, [s, a, i,
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
},
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
98
|
+
}, [s, a, i, c, n]);
|
|
99
|
+
return /* @__PURE__ */ p(g.Provider, { value: u, children: t });
|
|
100
|
+
}, Q = () => {
|
|
101
|
+
const t = m(g);
|
|
102
|
+
if (!t)
|
|
87
103
|
throw new Error("useAppConfig must be used within an AppConfigProvider");
|
|
88
|
-
return
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
104
|
+
return t.app;
|
|
105
|
+
}, X = () => {
|
|
106
|
+
const t = m(g);
|
|
107
|
+
if (!t)
|
|
92
108
|
throw new Error("useProviderName must be used within an AppConfigProvider");
|
|
93
|
-
return
|
|
109
|
+
return t.name ?? "";
|
|
94
110
|
};
|
|
95
111
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
G as ALL_AUTH_METHODS,
|
|
113
|
+
V as AUTH_METHODS,
|
|
114
|
+
K as CDPReactProvider,
|
|
115
|
+
J as OAUTH_METHODS,
|
|
116
|
+
Q as useAppConfig,
|
|
117
|
+
X as useProviderName
|
|
102
118
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface CopyAddressProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
address: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
onCopy?: () => void;
|
|
6
|
+
onCopySuccess?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CopyAddress: ({ className, address, label, onCopy, onCopySuccess, }: CopyAddressProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import { useRef as u, useState as m, useCallback as y } from "react";
|
|
4
|
+
import { Label as C } from "../forms/Label/index.js";
|
|
5
|
+
import { IconCheck as b } from "../../icons/IconCheck.js";
|
|
6
|
+
import { IconCopy as f } from "../../icons/IconCopy.js";
|
|
7
|
+
import '../../assets/CopyAddress.css';const h = "CopyAddress-module__label___O2o5m", e = {
|
|
8
|
+
"address-copy": "CopyAddress-module__address-copy___KpKeI",
|
|
9
|
+
label: h,
|
|
10
|
+
"address-input-container": "CopyAddress-module__address-input-container___qq0TH",
|
|
11
|
+
"address-truncated": "CopyAddress-module__address-truncated___kr8St",
|
|
12
|
+
"copy-button": "CopyAddress-module__copy-button___64o2y",
|
|
13
|
+
"success-icon": "CopyAddress-module__success-icon___qXipU",
|
|
14
|
+
"copy-icon": "CopyAddress-module__copy-icon___lUbYG"
|
|
15
|
+
}, w = ({
|
|
16
|
+
className: l = "",
|
|
17
|
+
address: s,
|
|
18
|
+
label: r,
|
|
19
|
+
onCopy: t,
|
|
20
|
+
onCopySuccess: d
|
|
21
|
+
}) => {
|
|
22
|
+
const i = u(null), [p, a] = m(!1), n = y(() => {
|
|
23
|
+
if (s) {
|
|
24
|
+
t?.();
|
|
25
|
+
try {
|
|
26
|
+
if (navigator.clipboard)
|
|
27
|
+
navigator.clipboard.writeText(s);
|
|
28
|
+
else
|
|
29
|
+
throw new Error("Clipboard API not supported");
|
|
30
|
+
} catch {
|
|
31
|
+
i.current?.select(), document.execCommand("copy");
|
|
32
|
+
}
|
|
33
|
+
a(!0), setTimeout(() => {
|
|
34
|
+
a(!1);
|
|
35
|
+
}, 2e3), d?.();
|
|
36
|
+
}
|
|
37
|
+
}, [s, t, d]);
|
|
38
|
+
return /* @__PURE__ */ c("div", { className: _(e["address-copy"], l), children: [
|
|
39
|
+
r && /* @__PURE__ */ o(C, { as: "span", className: e.label, children: r }),
|
|
40
|
+
/* @__PURE__ */ c("div", { className: e["address-input-container"], onClick: n, children: [
|
|
41
|
+
/* @__PURE__ */ c("span", { className: e["address-truncated"], children: [
|
|
42
|
+
s.slice(0, 6),
|
|
43
|
+
"...",
|
|
44
|
+
s.slice(-4)
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ o(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
type: "button",
|
|
50
|
+
"aria-label": "copy address",
|
|
51
|
+
onClick: n,
|
|
52
|
+
className: e["copy-button"],
|
|
53
|
+
children: p ? /* @__PURE__ */ o(b, { className: e["success-icon"] }) : /* @__PURE__ */ o(f, { className: e["copy-icon"] })
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] })
|
|
57
|
+
] });
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
w as CopyAddress
|
|
61
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonProps } from '../ui/Button';
|
|
2
|
+
interface CopyEvmKeyButtonProps extends Pick<ButtonProps, "variant" | "size" | "fullWidth"> {
|
|
3
|
+
address: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
copiedLabel?: string;
|
|
6
|
+
icon?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
onReady?: () => void;
|
|
9
|
+
onSuccess?: () => void;
|
|
10
|
+
onError?: (error?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const CopyEvmKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, variant, }: CopyEvmKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { CopyEvmKeyButton as unstable_CopyEvmKeyButton, type CopyEvmKeyButtonProps as unstable_CopyEvmKeyButtonProps, };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { useConfig as P } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useRef as v, useCallback as x } from "react";
|
|
4
|
+
import "../ui/Button/index.js";
|
|
5
|
+
import { IframeButton as I } from "../ui/IframeButton/index.js";
|
|
6
|
+
import { useKeyExportPostMessage as K } from "../../hooks/useKeyExportPostMessage.js";
|
|
7
|
+
import "@coinbase/cdp-core";
|
|
8
|
+
import "../../theme/cssVariables.js";
|
|
9
|
+
import "../../theme/theme.js";
|
|
10
|
+
import "../../theme/tokens.js";
|
|
11
|
+
const A = ({
|
|
12
|
+
address: s,
|
|
13
|
+
className: a = "",
|
|
14
|
+
copiedLabel: n = "Copied",
|
|
15
|
+
icon: o = !0,
|
|
16
|
+
fullWidth: c,
|
|
17
|
+
label: e = "Copy key",
|
|
18
|
+
onReady: t,
|
|
19
|
+
onSuccess: m,
|
|
20
|
+
onError: i,
|
|
21
|
+
size: p,
|
|
22
|
+
variant: u
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
config: { projectId: l, secureIframeBasePath: y }
|
|
26
|
+
} = P(), f = v(null), d = x(
|
|
27
|
+
(r, g) => {
|
|
28
|
+
r === "ready" && t?.(), r === "success" && m?.(), r === "error" && i?.(g);
|
|
29
|
+
},
|
|
30
|
+
[t, m, i]
|
|
31
|
+
), { iframeUrl: C, isPending: b } = K({
|
|
32
|
+
address: s,
|
|
33
|
+
type: "evm",
|
|
34
|
+
projectId: l,
|
|
35
|
+
variant: u,
|
|
36
|
+
size: p,
|
|
37
|
+
label: e,
|
|
38
|
+
basePath: y,
|
|
39
|
+
copiedLabel: n,
|
|
40
|
+
icon: o,
|
|
41
|
+
iframeRef: f,
|
|
42
|
+
onStatusUpdate: d
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ B(
|
|
45
|
+
I,
|
|
46
|
+
{
|
|
47
|
+
ref: f,
|
|
48
|
+
src: C,
|
|
49
|
+
allow: "clipboard-read; clipboard-write",
|
|
50
|
+
isPending: b,
|
|
51
|
+
label: e,
|
|
52
|
+
icon: o,
|
|
53
|
+
fullWidth: c,
|
|
54
|
+
size: p,
|
|
55
|
+
className: a
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
A as unstable_CopyEvmKeyButton
|
|
61
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonProps } from '../ui/Button';
|
|
2
|
+
interface CopySolanaKeyButtonProps extends Pick<ButtonProps, "variant" | "size" | "fullWidth"> {
|
|
3
|
+
address: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
copiedLabel?: string;
|
|
6
|
+
icon?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
onReady?: () => void;
|
|
9
|
+
onSuccess?: () => void;
|
|
10
|
+
onError?: (error?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const CopySolanaKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, variant, }: CopySolanaKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { CopySolanaKeyButton as unstable_CopySolanaKeyButton, type CopySolanaKeyButtonProps as unstable_CopySolanaKeyButtonProps, };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { useConfig as P } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useRef as x, useCallback as I } from "react";
|
|
4
|
+
import "../ui/Button/index.js";
|
|
5
|
+
import { IframeButton as K } from "../ui/IframeButton/index.js";
|
|
6
|
+
import { useKeyExportPostMessage as h } from "../../hooks/useKeyExportPostMessage.js";
|
|
7
|
+
import "@coinbase/cdp-core";
|
|
8
|
+
import "../../theme/cssVariables.js";
|
|
9
|
+
import "../../theme/theme.js";
|
|
10
|
+
import "../../theme/tokens.js";
|
|
11
|
+
const A = ({
|
|
12
|
+
address: s,
|
|
13
|
+
className: f = "",
|
|
14
|
+
copiedLabel: n = "Copied",
|
|
15
|
+
icon: r = !0,
|
|
16
|
+
fullWidth: c,
|
|
17
|
+
label: e = "Copy key",
|
|
18
|
+
onReady: t,
|
|
19
|
+
onSuccess: a,
|
|
20
|
+
onError: i,
|
|
21
|
+
size: p,
|
|
22
|
+
variant: l
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
config: { projectId: u, secureIframeBasePath: y }
|
|
26
|
+
} = P(), m = x(null), d = I(
|
|
27
|
+
(o, g) => {
|
|
28
|
+
o === "ready" && t?.(), o === "success" && a?.(), o === "error" && i?.(g);
|
|
29
|
+
},
|
|
30
|
+
[t, a, i]
|
|
31
|
+
), { iframeUrl: C, isPending: b } = h({
|
|
32
|
+
address: s,
|
|
33
|
+
type: "solana",
|
|
34
|
+
projectId: u,
|
|
35
|
+
variant: l,
|
|
36
|
+
size: p,
|
|
37
|
+
label: e,
|
|
38
|
+
basePath: y,
|
|
39
|
+
copiedLabel: n,
|
|
40
|
+
icon: r,
|
|
41
|
+
iframeRef: m,
|
|
42
|
+
onStatusUpdate: d
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ B(
|
|
45
|
+
K,
|
|
46
|
+
{
|
|
47
|
+
ref: m,
|
|
48
|
+
src: C,
|
|
49
|
+
allow: "clipboard-read; clipboard-write",
|
|
50
|
+
isPending: b,
|
|
51
|
+
label: e,
|
|
52
|
+
icon: r,
|
|
53
|
+
fullWidth: c,
|
|
54
|
+
size: p,
|
|
55
|
+
className: f
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
A as unstable_CopySolanaKeyButton
|
|
61
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { CopyAddressProps } from '../CopyAddress';
|
|
3
|
+
import { unstable_CopyEvmKeyButtonProps as CopyEvmKeyButtonProps } from '../CopyEvmKeyButton';
|
|
4
|
+
interface ExportWalletTitleProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
as?: ElementType;
|
|
6
|
+
}
|
|
7
|
+
interface ExportWalletProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
address: string;
|
|
9
|
+
onIframeReady?: () => void;
|
|
10
|
+
onCopySuccess?: () => void;
|
|
11
|
+
onIframeError?: (error?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
type ExportWalletCopyAddressProps = Omit<CopyAddressProps, "address">;
|
|
14
|
+
type ExportWalletCopyKeyButtonProps = Omit<CopyEvmKeyButtonProps, "address" | "onError" | "onReady" | "onSuccess">;
|
|
15
|
+
declare const ExportWalletTitle: ({ children, className, as: Component, ...props }: ExportWalletTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const ExportWalletWarning: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const ExportWalletCopyAddress: ({ label, ...props }: ExportWalletCopyAddressProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const ExportWalletCopyKeyButton: ({ fullWidth, ...props }: ExportWalletCopyKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
+
declare const ExportWalletFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const ExportWallet: ({ address, children, className, onIframeError, onIframeReady, onCopySuccess, ...props }: ExportWalletProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { ExportWallet as unstable_ExportWallet, ExportWalletCopyAddress as unstable_ExportWalletCopyAddress, ExportWalletCopyKeyButton as unstable_ExportWalletCopyKeyButton, ExportWalletFooter as unstable_ExportWalletFooter, ExportWalletTitle as unstable_ExportWalletTitle, ExportWalletWarning as unstable_ExportWalletWarning, type ExportWalletProps as unstable_ExportWalletProps, type ExportWalletCopyAddressProps as unstable_ExportWalletCopyAddressProps, type ExportWalletCopyKeyButtonProps as unstable_ExportWalletCopyKeyButtonProps, type ExportWalletTitleProps as unstable_ExportWalletTitleProps, };
|