@openfort/react 0.0.25 → 0.0.27
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/build/components/Pages/Connectors/index.d.ts +1 -1
- package/build/hooks/openfort/useConnectWithSiwe.d.ts +3 -1
- package/build/hooks/useWalletConnectModal.d.ts +5 -1
- package/build/index.es.js +709 -876
- package/build/index.es.js.map +1 -1
- package/build/utils/oauthErrorHandler.d.ts +5 -0
- package/build/version.d.ts +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Openfort as Openfort$1, EmbeddedState, AccountTypeEnum, RecoveryMethod, MissingRecoveryPasswordError, ChainTypeEnum, OAuthProvider } from '@openfort/openfort-js';
|
|
2
2
|
export { AccountTypeEnum, OAuthProvider, OpenfortEvents, RecoveryMethod, ThirdPartyOAuthProvider, openfortEvents } from '@openfort/openfort-js';
|
|
3
|
-
import { http, useConfig, useConnectors as useConnectors$1, useConnect as useConnect$1, useAccount, useDisconnect, useChainId, useSwitchChain, createConfig, useEnsAddress, useEnsName, useEnsAvatar, useBalance, WagmiContext, useBlockNumber } from 'wagmi';
|
|
3
|
+
import { http, useConfig, useConnectors as useConnectors$1, useConnect as useConnect$1, useAccount, useDisconnect, useChainId, useSwitchChain, createConfig, useEnsAddress, useEnsName, useEnsAvatar, useBalance, usePublicClient, WagmiContext, useBlockNumber } from 'wagmi';
|
|
4
4
|
import { mainnet, polygon, optimism, arbitrum, sepolia } from 'wagmi/chains';
|
|
5
5
|
import { safe, injected, coinbaseWallet, walletConnect } from '@wagmi/connectors';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -13,18 +13,18 @@ import { createPortal } from 'react-dom';
|
|
|
13
13
|
import { detect } from 'detect-browser';
|
|
14
14
|
import { useTransition } from 'react-transition-state';
|
|
15
15
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
16
|
+
import { walletConnect as walletConnect$1 } from 'wagmi/connectors';
|
|
16
17
|
import useMeasure from 'react-use-measure';
|
|
17
18
|
import QRCodeUtil from 'qrcode';
|
|
18
|
-
import { walletConnect as walletConnect$1 } from 'wagmi/connectors';
|
|
19
19
|
import { normalize } from 'viem/ens';
|
|
20
20
|
import { AxiosError } from 'axios';
|
|
21
21
|
import { createSiweMessage } from 'viem/siwe';
|
|
22
|
-
import { signMessage } from '@wagmi/core';
|
|
22
|
+
import { switchChain, signMessage } from '@wagmi/core';
|
|
23
23
|
import calculateEntropy from 'fast-password-entropy';
|
|
24
24
|
import { parseSignature } from 'viem';
|
|
25
25
|
import { hashAuthorization } from 'viem/utils';
|
|
26
26
|
|
|
27
|
-
const OPENFORT_VERSION = '0.0.
|
|
27
|
+
const OPENFORT_VERSION = '0.0.27';
|
|
28
28
|
|
|
29
29
|
var OpenfortErrorType;
|
|
30
30
|
(function (OpenfortErrorType) {
|
|
@@ -416,7 +416,7 @@ const walletConfigs = {
|
|
|
416
416
|
shortName: 'Browser',
|
|
417
417
|
icon: jsx(Logos.Injected, {}),
|
|
418
418
|
},
|
|
419
|
-
'metaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK': {
|
|
419
|
+
'metaMask, MetaMask, metaMask-io, io.metamask, io.metamask.mobile, metaMaskSDK': {
|
|
420
420
|
name: 'MetaMask',
|
|
421
421
|
icon: jsx(Logos.MetaMask, {}),
|
|
422
422
|
iconConnector: jsx(Logos.MetaMask, {}),
|
|
@@ -991,6 +991,39 @@ const logger = {
|
|
|
991
991
|
debug: (...args) => console.debug(PREFIX, ...args),
|
|
992
992
|
};
|
|
993
993
|
|
|
994
|
+
/**
|
|
995
|
+
* Utility to handle and provide better error messages for OAuth configuration errors
|
|
996
|
+
*/
|
|
997
|
+
function handleOAuthConfigError(error) {
|
|
998
|
+
var _a, _b;
|
|
999
|
+
if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('OAuth Config with provider')) && ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('not found'))) {
|
|
1000
|
+
const providerMatch = error.message.match(/provider\s+(\w+)\s+not found/i);
|
|
1001
|
+
const provider = providerMatch ? providerMatch[1] : 'unknown';
|
|
1002
|
+
const providerLower = provider.toLowerCase();
|
|
1003
|
+
// Provider-specific configuration hints
|
|
1004
|
+
const configHints = {
|
|
1005
|
+
playfab: '- PlayFab title ID: Your PlayFab title ID',
|
|
1006
|
+
firebase: '- Firebase project ID: Your Firebase project ID (e.g., test-d3dd3)',
|
|
1007
|
+
supabase: '- Supabase url: Your Supabase project URL (e.g., https://xxxxx.supabase.co)\n - Supabase key: Your Supabase anon/public key',
|
|
1008
|
+
lootlocker: '- Enable LootLocker authentication in your Openfort dashboard',
|
|
1009
|
+
oidc: '- JWKS URL: URL to JSON Web Key Set for OIDC provider\n - Verifiable Public Key: PEM encoded public key to verify JWT tokens (if JWKS URL not provided)\n - Audience: Expected audience value in the ID token',
|
|
1010
|
+
custom: '- Authentication URL: Your custom authentication endpoint (e.g., https://your-domain.com/api/openfort/verify)\n' +
|
|
1011
|
+
' - Headers: Comma-separated list of headers to include (e.g., X-Openfort-Secret: your-shared-secret)',
|
|
1012
|
+
};
|
|
1013
|
+
const hint = configHints[providerLower] || configHints.custom;
|
|
1014
|
+
console.error(`❌ Openfort OAuth Configuration Error:\n\n` +
|
|
1015
|
+
`The OAuth provider "${provider}" is not configured in your Openfort account.\n\n` +
|
|
1016
|
+
`To fix this:\n` +
|
|
1017
|
+
`1. Go to https://dashboard.openfort.io\n` +
|
|
1018
|
+
`2. Navigate to Configuration → Providers\n` +
|
|
1019
|
+
`3. Enable "${provider}" in the Third Party Authentication section\n` +
|
|
1020
|
+
`4. Configure the required fields:\n` +
|
|
1021
|
+
` ${hint}\n` +
|
|
1022
|
+
`5. Click "Save"\n\n` +
|
|
1023
|
+
`See: https://www.openfort.io/docs/configuration/external-auth`);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
994
1027
|
const ConnectCallback = ({ onConnect, onDisconnect }) => {
|
|
995
1028
|
useConnectCallback({
|
|
996
1029
|
onConnect,
|
|
@@ -1117,14 +1150,23 @@ const CoreOpenfortProvider = ({ children, debugMode, onConnect, onDisconnect, ..
|
|
|
1117
1150
|
// will reset on logout
|
|
1118
1151
|
const { data: embeddedAccounts, refetch: fetchEmbeddedAccounts, isPending: isLoadingAccounts } = useQuery({
|
|
1119
1152
|
queryKey: ['openfortEmbeddedAccountsList'],
|
|
1120
|
-
queryFn: () =>
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1153
|
+
queryFn: async () => {
|
|
1154
|
+
try {
|
|
1155
|
+
return await openfort.embeddedWallet.list({
|
|
1156
|
+
limit: 100,
|
|
1157
|
+
// If its EOA we want all accounts, otherwise we want only smart accounts
|
|
1158
|
+
accountType: (walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.accountType) === AccountTypeEnum.EOA ?
|
|
1159
|
+
undefined : AccountTypeEnum.SMART_ACCOUNT
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
catch (error) {
|
|
1163
|
+
handleOAuthConfigError(error);
|
|
1164
|
+
throw error;
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1126
1167
|
refetchOnMount: false,
|
|
1127
1168
|
refetchOnWindowFocus: false,
|
|
1169
|
+
retry: false,
|
|
1128
1170
|
});
|
|
1129
1171
|
useEffect(() => {
|
|
1130
1172
|
if (!openfort)
|
|
@@ -5946,269 +5988,6 @@ const About = () => {
|
|
|
5946
5988
|
} }, i))) }) }), jsx(Button, { href: ctaUrl, arrow: true, children: locales.aboutScreen_ctaText })] }));
|
|
5947
5989
|
};
|
|
5948
5990
|
|
|
5949
|
-
const Shimmer$1 = keyframes `
|
|
5950
|
-
0%{ transform: translate(-100%) rotate(-45deg); }
|
|
5951
|
-
100%{ transform: translate(100%) rotate(-80deg); }
|
|
5952
|
-
`;
|
|
5953
|
-
styled(motion.div) `
|
|
5954
|
-
display: flex;
|
|
5955
|
-
flex-direction: column;
|
|
5956
|
-
gap: 12px;
|
|
5957
|
-
`;
|
|
5958
|
-
const InfoBox = styled.div `
|
|
5959
|
-
padding: 24px 24px 28px;
|
|
5960
|
-
border-radius: var(--ck-tertiary-border-radius, 24px);
|
|
5961
|
-
box-shadow: var(--ck-tertiary-box-shadow, none);
|
|
5962
|
-
background: var(--ck-body-background-tertiary);
|
|
5963
|
-
${ModalBody} {
|
|
5964
|
-
max-width: none;
|
|
5965
|
-
}
|
|
5966
|
-
`;
|
|
5967
|
-
const InfoBoxButtons = styled.div `
|
|
5968
|
-
display: grid;
|
|
5969
|
-
grid-template-columns: 1fr 1fr;
|
|
5970
|
-
gap: 16px;
|
|
5971
|
-
margin: 5px -8px -12px;
|
|
5972
|
-
button {
|
|
5973
|
-
}
|
|
5974
|
-
`;
|
|
5975
|
-
styled(motion.div) `
|
|
5976
|
-
text-align: center;
|
|
5977
|
-
margin-top: 16px;
|
|
5978
|
-
margin-bottom: -6px;
|
|
5979
|
-
`;
|
|
5980
|
-
styled(motion.button) `
|
|
5981
|
-
appearance: none;
|
|
5982
|
-
user-select: none;
|
|
5983
|
-
cursor: pointer;
|
|
5984
|
-
display: inline-flex;
|
|
5985
|
-
align-items: center;
|
|
5986
|
-
justify-content: center;
|
|
5987
|
-
gap: 10px;
|
|
5988
|
-
height: 42px;
|
|
5989
|
-
padding: 0 16px;
|
|
5990
|
-
border-radius: 6px;
|
|
5991
|
-
background: none;
|
|
5992
|
-
color: var(--ck-body-color-muted);
|
|
5993
|
-
font-size: 15px;
|
|
5994
|
-
line-height: 18px;
|
|
5995
|
-
font-weight: 500;
|
|
5996
|
-
/* will-change: transform; */
|
|
5997
|
-
transition: color 200ms ease, transform 100ms ease;
|
|
5998
|
-
svg {
|
|
5999
|
-
transition: all 100ms ease-out;
|
|
6000
|
-
display: block;
|
|
6001
|
-
position: relative;
|
|
6002
|
-
top: 2px;
|
|
6003
|
-
left: 2px;
|
|
6004
|
-
transform: translateZ(0px);
|
|
6005
|
-
path,
|
|
6006
|
-
circle {
|
|
6007
|
-
transition: all 100ms ease-out;
|
|
6008
|
-
}
|
|
6009
|
-
path:last-of-type {
|
|
6010
|
-
transform-origin: 0 0;
|
|
6011
|
-
transform: scaleX(1.3) skewY(-12deg);
|
|
6012
|
-
opacity: 0;
|
|
6013
|
-
}
|
|
6014
|
-
circle {
|
|
6015
|
-
transform: translate(20%, -15%);
|
|
6016
|
-
}
|
|
6017
|
-
}
|
|
6018
|
-
&:hover {
|
|
6019
|
-
color: var(--ck-body-color-muted-hover);
|
|
6020
|
-
svg {
|
|
6021
|
-
path,
|
|
6022
|
-
circle {
|
|
6023
|
-
opacity: 1;
|
|
6024
|
-
transform: none;
|
|
6025
|
-
}
|
|
6026
|
-
}
|
|
6027
|
-
}
|
|
6028
|
-
&:active {
|
|
6029
|
-
transform: scale(0.96);
|
|
6030
|
-
}
|
|
6031
|
-
`;
|
|
6032
|
-
styled(motion.div) `
|
|
6033
|
-
display: flex;
|
|
6034
|
-
flex-direction: column;
|
|
6035
|
-
gap: 12px;
|
|
6036
|
-
padding: 0 0 16px;
|
|
6037
|
-
overflow-y: scroll;
|
|
6038
|
-
max-height: 20rem;
|
|
6039
|
-
|
|
6040
|
-
&::-webkit-scrollbar {
|
|
6041
|
-
display: none;
|
|
6042
|
-
}
|
|
6043
|
-
`;
|
|
6044
|
-
styled(motion.button) `
|
|
6045
|
-
cursor: pointer;
|
|
6046
|
-
user-select: none;
|
|
6047
|
-
position: relative;
|
|
6048
|
-
display: flex;
|
|
6049
|
-
align-items: center;
|
|
6050
|
-
padding: 0 20px;
|
|
6051
|
-
width: 100%;
|
|
6052
|
-
height: 64px;
|
|
6053
|
-
font-size: 17px;
|
|
6054
|
-
font-weight: var(--ck-primary-button-font-weight, 500);
|
|
6055
|
-
line-height: 20px;
|
|
6056
|
-
text-align: var(--ck-body-button-text-align, left);
|
|
6057
|
-
transition: 180ms ease;
|
|
6058
|
-
transition-property: background, color, box-shadow, transform, opacity;
|
|
6059
|
-
will-change: transform, box-shadow, background-color, color, opacity;
|
|
6060
|
-
|
|
6061
|
-
--fallback-color: var(--ck-primary-button-color);
|
|
6062
|
-
--fallback-background: var(--ck-primary-button-background);
|
|
6063
|
-
--fallback-box-shadow: var(--ck-primary-button-box-shadow);
|
|
6064
|
-
--fallback-border-radius: var(--ck-primary-button-border-radius);
|
|
6065
|
-
|
|
6066
|
-
--color: var(--ck-primary-button-color, var(--fallback-color));
|
|
6067
|
-
--background: var(--ck-primary-button-background, var(--fallback-background));
|
|
6068
|
-
--box-shadow: var(--ck-primary-button-box-shadow, var(--fallback-box-shadow));
|
|
6069
|
-
--border-radius: var(
|
|
6070
|
-
--ck-primary-button-border-radius,
|
|
6071
|
-
var(--fallback-border-radius)
|
|
6072
|
-
);
|
|
6073
|
-
|
|
6074
|
-
--hover-color: var(--ck-primary-button-hover-color, var(--color));
|
|
6075
|
-
--hover-background: var(
|
|
6076
|
-
--ck-primary-button-hover-background,
|
|
6077
|
-
var(--background)
|
|
6078
|
-
);
|
|
6079
|
-
--hover-box-shadow: var(
|
|
6080
|
-
--ck-primary-button-hover-box-shadow,
|
|
6081
|
-
var(--box-shadow)
|
|
6082
|
-
);
|
|
6083
|
-
--hover-border-radius: var(
|
|
6084
|
-
--ck-primary-button-hover-border-radius,
|
|
6085
|
-
var(--border-radius)
|
|
6086
|
-
);
|
|
6087
|
-
|
|
6088
|
-
--active-color: var(--ck-primary-button-active-color, var(--hover-color));
|
|
6089
|
-
--active-background: var(
|
|
6090
|
-
--ck-primary-button-active-background,
|
|
6091
|
-
var(--hover-background)
|
|
6092
|
-
);
|
|
6093
|
-
--active-box-shadow: var(
|
|
6094
|
-
--ck-primary-button-active-box-shadow,
|
|
6095
|
-
var(--hover-box-shadow)
|
|
6096
|
-
);
|
|
6097
|
-
--active-border-radius: var(
|
|
6098
|
-
--ck-primary-button-active-border-radius,
|
|
6099
|
-
var(--hover-border-radius)
|
|
6100
|
-
);
|
|
6101
|
-
|
|
6102
|
-
color: var(--color);
|
|
6103
|
-
background: var(--background);
|
|
6104
|
-
box-shadow: var(--box-shadow);
|
|
6105
|
-
border-radius: var(--border-radius);
|
|
6106
|
-
|
|
6107
|
-
&:disabled {
|
|
6108
|
-
transition: 180ms ease;
|
|
6109
|
-
opacity: 0.4;
|
|
6110
|
-
}
|
|
6111
|
-
|
|
6112
|
-
--bg: var(--background);
|
|
6113
|
-
&:not(:disabled) {
|
|
6114
|
-
&:hover {
|
|
6115
|
-
color: var(--hover-color);
|
|
6116
|
-
background: var(--hover-background);
|
|
6117
|
-
box-shadow: var(--hover-box-shadow);
|
|
6118
|
-
border-radius: var(--hover-border-radius);
|
|
6119
|
-
--bg: var(--hover-background, var(--background));
|
|
6120
|
-
}
|
|
6121
|
-
&:focus-visible {
|
|
6122
|
-
transition-duration: 100ms;
|
|
6123
|
-
color: var(--hover-color);
|
|
6124
|
-
background: var(--hover-background);
|
|
6125
|
-
box-shadow: var(--hover-box-shadow);
|
|
6126
|
-
border-radius: var(--hover-border-radius);
|
|
6127
|
-
--bg: var(--hover-background, var(--background));
|
|
6128
|
-
}
|
|
6129
|
-
&:active {
|
|
6130
|
-
color: var(--active-color);
|
|
6131
|
-
background: var(--active-background);
|
|
6132
|
-
box-shadow: var(--active-box-shadow);
|
|
6133
|
-
border-radius: var(--active-border-radius);
|
|
6134
|
-
--bg: var(--active-background, var(--background));
|
|
6135
|
-
}
|
|
6136
|
-
}
|
|
6137
|
-
`;
|
|
6138
|
-
styled(motion.span) `
|
|
6139
|
-
position: relative;
|
|
6140
|
-
top: var(--ck-recent-badge-top-offset, 0.5px);
|
|
6141
|
-
display: inline-block;
|
|
6142
|
-
padding: 10px 7px;
|
|
6143
|
-
line-height: 0;
|
|
6144
|
-
font-size: 13px;
|
|
6145
|
-
font-weight: 400;
|
|
6146
|
-
border-radius: var(--ck-recent-badge-border-radius, var(--border-radius));
|
|
6147
|
-
color: var(
|
|
6148
|
-
--ck-recent-badge-color,
|
|
6149
|
-
var(--ck-accent-color, var(--ck-body-color-muted, currentColor))
|
|
6150
|
-
);
|
|
6151
|
-
background: var(--ck-recent-badge-background, transparent);
|
|
6152
|
-
overflow: hidden;
|
|
6153
|
-
span {
|
|
6154
|
-
display: inline-block;
|
|
6155
|
-
position: relative;
|
|
6156
|
-
}
|
|
6157
|
-
&:before {
|
|
6158
|
-
z-index: 1;
|
|
6159
|
-
content: '';
|
|
6160
|
-
position: absolute;
|
|
6161
|
-
inset: 0;
|
|
6162
|
-
opacity: 0.4;
|
|
6163
|
-
box-shadow: var(--ck-recent-badge-box-shadow, inset 0 0 0 1px currentColor);
|
|
6164
|
-
border-radius: inherit;
|
|
6165
|
-
}
|
|
6166
|
-
&:after {
|
|
6167
|
-
z-index: 2;
|
|
6168
|
-
content: '';
|
|
6169
|
-
position: absolute;
|
|
6170
|
-
inset: -10%;
|
|
6171
|
-
top: -110%;
|
|
6172
|
-
aspect-ratio: 1/1;
|
|
6173
|
-
opacity: 0.7;
|
|
6174
|
-
background: linear-gradient(
|
|
6175
|
-
170deg,
|
|
6176
|
-
transparent 10%,
|
|
6177
|
-
var(--ck-recent-badge-background, var(--bg)) 50%,
|
|
6178
|
-
transparent 90%
|
|
6179
|
-
);
|
|
6180
|
-
animation: ${Shimmer$1} 2s linear infinite;
|
|
6181
|
-
}
|
|
6182
|
-
`;
|
|
6183
|
-
styled(motion.span) `
|
|
6184
|
-
display: flex;
|
|
6185
|
-
align-items: center;
|
|
6186
|
-
gap: 9px;
|
|
6187
|
-
width: 100%;
|
|
6188
|
-
overflow: hidden;
|
|
6189
|
-
white-space: nowrap;
|
|
6190
|
-
text-overflow: ellipsis;
|
|
6191
|
-
padding: 2px 0;
|
|
6192
|
-
padding-right: 38px;
|
|
6193
|
-
`;
|
|
6194
|
-
styled(motion.div) `
|
|
6195
|
-
position: absolute;
|
|
6196
|
-
right: 20px;
|
|
6197
|
-
width: 32px;
|
|
6198
|
-
height: 32px;
|
|
6199
|
-
overflow: hidden;
|
|
6200
|
-
svg,
|
|
6201
|
-
img {
|
|
6202
|
-
display: block;
|
|
6203
|
-
position: relative;
|
|
6204
|
-
pointer-events: none;
|
|
6205
|
-
overflow: hidden;
|
|
6206
|
-
border-radius: 27.5%;
|
|
6207
|
-
width: 100%;
|
|
6208
|
-
height: 100%;
|
|
6209
|
-
}
|
|
6210
|
-
`;
|
|
6211
|
-
|
|
6212
5991
|
function useIsMobile() {
|
|
6213
5992
|
const [mobile, setMobile] = useState(isMobile());
|
|
6214
5993
|
useEffect(() => {
|
|
@@ -6221,6 +6000,58 @@ function useIsMobile() {
|
|
|
6221
6000
|
return mobile;
|
|
6222
6001
|
}
|
|
6223
6002
|
|
|
6003
|
+
function useWalletConnectModal() {
|
|
6004
|
+
const { log } = useOpenfort();
|
|
6005
|
+
const { connectAsync, connectors } = useConnect();
|
|
6006
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6007
|
+
return {
|
|
6008
|
+
isOpen,
|
|
6009
|
+
open: async () => {
|
|
6010
|
+
// add modal styling because wagmi does not let you add styling to the modal
|
|
6011
|
+
const w3mcss = document.createElement('style');
|
|
6012
|
+
w3mcss.innerHTML = `w3m-modal, wcm-modal{ --wcm-z-index: 2147483647; --w3m-z-index:2147483647; }`;
|
|
6013
|
+
document.head.appendChild(w3mcss);
|
|
6014
|
+
const clientConnector = connectors.find((c) => isWalletConnectConnector(c.id));
|
|
6015
|
+
if (clientConnector) {
|
|
6016
|
+
try {
|
|
6017
|
+
const provider = await clientConnector.getProvider();
|
|
6018
|
+
const projectId = provider.rpc.projectId;
|
|
6019
|
+
const connector = walletConnect$1({
|
|
6020
|
+
projectId,
|
|
6021
|
+
showQrModal: true,
|
|
6022
|
+
});
|
|
6023
|
+
setIsOpen(true);
|
|
6024
|
+
try {
|
|
6025
|
+
await connectAsync({ connector: connector });
|
|
6026
|
+
}
|
|
6027
|
+
catch (err) {
|
|
6028
|
+
log('WalletConnect', err);
|
|
6029
|
+
return {
|
|
6030
|
+
error: 'Connection failed',
|
|
6031
|
+
};
|
|
6032
|
+
}
|
|
6033
|
+
setIsOpen(false);
|
|
6034
|
+
// remove modal styling
|
|
6035
|
+
document.head.removeChild(w3mcss);
|
|
6036
|
+
return {};
|
|
6037
|
+
}
|
|
6038
|
+
catch (err) {
|
|
6039
|
+
log('Could not get WalletConnect provider', err);
|
|
6040
|
+
return {
|
|
6041
|
+
error: 'Could not get WalletConnect provider',
|
|
6042
|
+
};
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
6045
|
+
else {
|
|
6046
|
+
log('Configuration error: Please provide a WalletConnect Project ID in your wagmi config.');
|
|
6047
|
+
return {
|
|
6048
|
+
error: 'Configuration error: Please provide a WalletConnect Project ID in your wagmi config.',
|
|
6049
|
+
};
|
|
6050
|
+
}
|
|
6051
|
+
},
|
|
6052
|
+
};
|
|
6053
|
+
}
|
|
6054
|
+
|
|
6224
6055
|
const Shimmer = keyframes `
|
|
6225
6056
|
0%{ transform: translate(-100%) rotate(-45deg); }
|
|
6226
6057
|
100%{ transform: translate(100%) rotate(-80deg); }
|
|
@@ -7034,162 +6865,201 @@ const ConnectorItem = ({ wallet, isRecent, }) => {
|
|
|
7034
6865
|
}, children: content() }));
|
|
7035
6866
|
};
|
|
7036
6867
|
|
|
7037
|
-
const
|
|
7038
|
-
|
|
7039
|
-
const context = useOpenfort();
|
|
7040
|
-
const locales = useLocales({});
|
|
7041
|
-
const isMobile = useIsMobile();
|
|
7042
|
-
return (jsxs(PageContent, { style: { width: 312 }, children: [jsx(ConnectorList, {}), isMobile ? (jsx(Fragment, { children: jsxs(InfoBox, { children: [jsxs(ModalContent, { style: { padding: 0, textAlign: 'left' }, children: [jsx(ModalH1, { "$small": true, children: locales.connectorsScreen_h1 }), jsx(ModalBody, { children: locales.connectorsScreen_p })] }), jsxs(InfoBoxButtons, { children: [!((_a = context.uiConfig) === null || _a === void 0 ? void 0 : _a.hideQuestionMarkCTA) && (jsx(Button, { variant: 'tertiary', onClick: () => context.setRoute(routes.ABOUT), children: locales.learnMore })), !((_b = context.uiConfig) === null || _b === void 0 ? void 0 : _b.hideNoWalletCTA) && (jsx(Button, { variant: 'tertiary', onClick: () => context.setRoute(routes.ONBOARDING), children: locales.getWallet }))] })] }) })) : (jsx(Fragment, {}))] }));
|
|
7043
|
-
};
|
|
7044
|
-
|
|
7045
|
-
const QRCodeContainer = styled(motion.div) `
|
|
7046
|
-
z-index: 3;
|
|
6868
|
+
const LogoContainer$3 = styled(motion.div) `
|
|
6869
|
+
z-index: 4;
|
|
7047
6870
|
position: relative;
|
|
7048
6871
|
overflow: hidden;
|
|
7049
|
-
height: 0;
|
|
7050
|
-
padding-bottom: 100% !important;
|
|
7051
|
-
display: flex;
|
|
7052
|
-
align-items: center;
|
|
7053
|
-
justify-content: center;
|
|
7054
|
-
margin: 1px 0 2px;
|
|
7055
|
-
border-radius: var(--ck-qr-border-radius, 24px);
|
|
7056
|
-
background: var(--ck-qr-background, transparent);
|
|
7057
|
-
box-shadow: 0 0 0 1px var(--ck-qr-border-color);
|
|
7058
|
-
backface-visibility: hidden;
|
|
7059
6872
|
svg {
|
|
6873
|
+
z-index: 3;
|
|
6874
|
+
position: relative;
|
|
7060
6875
|
display: block;
|
|
7061
|
-
max-width: 100%;
|
|
7062
|
-
width: 100%;
|
|
7063
|
-
height: auto;
|
|
7064
6876
|
}
|
|
7065
6877
|
`;
|
|
7066
|
-
const
|
|
6878
|
+
const Logo$2 = styled(motion.div) `
|
|
6879
|
+
z-index: 2;
|
|
7067
6880
|
position: absolute;
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
6881
|
+
overflow: hidden;
|
|
6882
|
+
inset: 6px;
|
|
6883
|
+
border-radius: 24px;
|
|
6884
|
+
background: var(--ck-body-background);
|
|
6885
|
+
svg,
|
|
6886
|
+
img {
|
|
6887
|
+
pointer-events: none;
|
|
6888
|
+
display: block;
|
|
6889
|
+
width: 100%;
|
|
6890
|
+
height: 100%;
|
|
7072
6891
|
}
|
|
7073
6892
|
`;
|
|
7074
|
-
const
|
|
7075
|
-
|
|
7076
|
-
|
|
6893
|
+
const SpinnerContainer$1 = styled(motion.div) `
|
|
6894
|
+
position: absolute;
|
|
6895
|
+
inset: 1px;
|
|
6896
|
+
overflow: hidden;
|
|
7077
6897
|
`;
|
|
7078
|
-
const
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
6898
|
+
const Spinner$3 = styled(motion.div) `
|
|
6899
|
+
pointer-events: none;
|
|
6900
|
+
user-select: none;
|
|
6901
|
+
z-index: 1;
|
|
7082
6902
|
position: absolute;
|
|
7083
|
-
inset:
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
justify-content: center;
|
|
7087
|
-
> div {
|
|
7088
|
-
z-index: 4;
|
|
7089
|
-
position: relative;
|
|
7090
|
-
width: 28%;
|
|
7091
|
-
height: 28%;
|
|
7092
|
-
border-radius: 20px;
|
|
7093
|
-
background: var(--bg);
|
|
7094
|
-
box-shadow: 0 0 0 7px var(--bg);
|
|
7095
|
-
}
|
|
7096
|
-
> span {
|
|
7097
|
-
z-index: 4;
|
|
6903
|
+
inset: -25%;
|
|
6904
|
+
&:before {
|
|
6905
|
+
content: '';
|
|
7098
6906
|
position: absolute;
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
}
|
|
7115
|
-
&:nth-child(2) {
|
|
7116
|
-
top: 0;
|
|
7117
|
-
right: 0;
|
|
6907
|
+
inset: 0;
|
|
6908
|
+
background: conic-gradient(
|
|
6909
|
+
from -90deg,
|
|
6910
|
+
transparent,
|
|
6911
|
+
transparent,
|
|
6912
|
+
transparent,
|
|
6913
|
+
transparent,
|
|
6914
|
+
transparent,
|
|
6915
|
+
var(--ck-spinner-color)
|
|
6916
|
+
);
|
|
6917
|
+
animation: rotateSpinner 1200ms linear infinite;
|
|
6918
|
+
}
|
|
6919
|
+
@keyframes rotateSpinner {
|
|
6920
|
+
0% {
|
|
6921
|
+
transform: rotate(0deg);
|
|
7118
6922
|
}
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
left: 0;
|
|
6923
|
+
100% {
|
|
6924
|
+
transform: rotate(360deg);
|
|
7122
6925
|
}
|
|
7123
6926
|
}
|
|
6927
|
+
`;
|
|
6928
|
+
|
|
6929
|
+
const SquircleSpinner = ({ logo, connecting = true, }) => {
|
|
6930
|
+
return (jsxs(LogoContainer$3, { transition: { duration: 0.5, ease: [0.175, 0.885, 0.32, 0.98] }, children: [jsx(Logo$2, { children: logo }), jsx(SpinnerContainer$1, { children: jsx(AnimatePresence, { children: connecting && (jsx(Spinner$3, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: {
|
|
6931
|
+
opacity: 0,
|
|
6932
|
+
transition: {
|
|
6933
|
+
duration: 0,
|
|
6934
|
+
},
|
|
6935
|
+
} }, "Spinner")) }) }), jsxs("svg", { "aria-hidden": "true", width: "102", height: "102", viewBox: "0 0 102 102", fill: "none", children: [jsx("rect", { x: "7.57895", y: "7.57895", width: "86.8421", height: "86.8421", rx: "19.2211", stroke: "black", strokeOpacity: "0.02", strokeWidth: "1.15789" }), jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0 0H102V102H0V0ZM7 38.284C7 27.5684 7 22.2106 9.01905 18.0892C10.9522 14.1431 14.1431 10.9522 18.0892 9.01905C22.2106 7 27.5684 7 38.284 7H63.716C74.4316 7 79.7894 7 83.9108 9.01905C87.8569 10.9522 91.0478 14.1431 92.9809 18.0892C95 22.2106 95 27.5684 95 38.284V63.716C95 74.4316 95 79.7894 92.9809 83.9108C91.0478 87.8569 87.8569 91.0478 83.9108 92.9809C79.7894 95 74.4316 95 63.716 95H38.284C27.5684 95 22.2106 95 18.0892 92.9809C14.1431 91.0478 10.9522 87.8569 9.01905 83.9108C7 79.7894 7 74.4316 7 63.716V38.284ZM41.5 0.5H41.4325C34.7246 0.499996 29.6023 0.499994 25.5104 0.823325C21.388 1.14906 18.1839 1.80986 15.3416 3.20227C10.0602 5.78959 5.78959 10.0602 3.20227 15.3416C1.80986 18.1839 1.14906 21.388 0.823325 25.5104C0.499994 29.6023 0.499996 34.7246 0.5 41.4325V41.5V55.5938C0.5 55.6808 0.507407 55.766 0.521624 55.849C0.507407 55.9319 0.5 56.0172 0.5 56.1042V60.5V60.5675C0.499996 67.2754 0.499994 72.3977 0.823325 76.4896C1.14906 80.612 1.80986 83.8161 3.20227 86.6584C5.78959 91.9398 10.0602 96.2104 15.3416 98.7977C18.1839 100.19 21.388 100.851 25.5104 101.177C29.6022 101.5 34.7244 101.5 41.432 101.5H41.4324H41.5H43.4227H60.5H60.5675H60.568C67.2756 101.5 72.3977 101.5 76.4896 101.177C80.612 100.851 83.8161 100.19 86.6584 98.7977C91.9398 96.2104 96.2104 91.9398 98.7977 86.6584C100.19 83.8161 100.851 80.612 101.177 76.4896C101.5 72.3978 101.5 67.2756 101.5 60.568V60.5676V60.5V41.5V41.4324V41.432C101.5 34.7244 101.5 29.6022 101.177 25.5104C100.851 21.388 100.19 18.1839 98.7977 15.3416C96.2104 10.0602 91.9398 5.78959 86.6584 3.20227C83.8161 1.80986 80.612 1.14906 76.4896 0.823325C72.3977 0.499994 67.2754 0.499996 60.5675 0.5H60.5H41.5ZM3.5 56.1042C3.5 56.0172 3.49259 55.9319 3.47838 55.849C3.49259 55.766 3.5 55.6808 3.5 55.5938V41.5C3.5 34.7112 3.50109 29.7068 3.814 25.7467C4.1256 21.8032 4.73946 19.0229 5.89635 16.6614C8.19077 11.9779 11.9779 8.19077 16.6614 5.89635C19.0229 4.73946 21.8032 4.1256 25.7467 3.814C29.7068 3.50109 34.7112 3.5 41.5 3.5H60.5C67.2888 3.5 72.2932 3.50109 76.2533 3.814C80.1968 4.1256 82.977 4.73946 85.3386 5.89635C90.022 8.19077 93.8092 11.9779 96.1036 16.6614C97.2605 19.0229 97.8744 21.8032 98.186 25.7467C98.4989 29.7068 98.5 34.7112 98.5 41.5V60.5C98.5 67.2888 98.4989 72.2932 98.186 76.2533C97.8744 80.1968 97.2605 82.9771 96.1036 85.3386C93.8092 90.022 90.022 93.8092 85.3386 96.1036C82.977 97.2605 80.1968 97.8744 76.2533 98.186C72.2932 98.4989 67.2888 98.5 60.5 98.5H43.4227H41.5C34.7112 98.5 29.7068 98.4989 25.7467 98.186C21.8032 97.8744 19.0229 97.2605 16.6614 96.1036C11.9779 93.8092 8.19077 90.022 5.89635 85.3386C4.73946 82.9771 4.1256 80.1968 3.814 76.2533C3.50109 72.2932 3.5 67.2888 3.5 60.5V56.1042Z", fill: "var(--ck-body-background)" })] })] }));
|
|
6936
|
+
};
|
|
6937
|
+
|
|
6938
|
+
const Content = styled(motion.div) `
|
|
6939
|
+
display: flex;
|
|
6940
|
+
flex-direction: column;
|
|
6941
|
+
gap: 6px;
|
|
6942
|
+
position: relative;
|
|
6943
|
+
left: 0;
|
|
6944
|
+
right: 0;
|
|
6945
|
+
${ModalContent} {
|
|
6946
|
+
padding: 0 8px 32px;
|
|
6947
|
+
gap: 12px;
|
|
6948
|
+
}
|
|
6949
|
+
`;
|
|
6950
|
+
const dist$1 = 2;
|
|
6951
|
+
const shakeKeyframes$1 = keyframes `
|
|
6952
|
+
0%{ transform:none; }
|
|
6953
|
+
25%{ transform:translateX(${dist$1}px); }
|
|
6954
|
+
50%{ transform:translateX(-${dist$1}px); }
|
|
6955
|
+
75%{ transform:translateX(${dist$1}px); }
|
|
6956
|
+
100%{ transform:none; }
|
|
6957
|
+
`;
|
|
6958
|
+
const outlineKeyframes$1 = keyframes `
|
|
6959
|
+
0%{ opacity:1; }
|
|
6960
|
+
100%{ opacity:0; }
|
|
6961
|
+
`;
|
|
6962
|
+
const Container$7 = styled(motion.div) `
|
|
6963
|
+
/*
|
|
6964
|
+
background: var(
|
|
6965
|
+
--ck-body-background
|
|
6966
|
+
); // To stop the overlay issue during transition for the squircle spinner
|
|
6967
|
+
*/
|
|
6968
|
+
`;
|
|
6969
|
+
const ConnectingContainer$1 = styled(motion.div) `
|
|
6970
|
+
display: flex;
|
|
6971
|
+
align-items: center;
|
|
6972
|
+
justify-content: center;
|
|
6973
|
+
margin: 10px auto 16px;
|
|
6974
|
+
height: 120px;
|
|
6975
|
+
//transform: scale(1.001); // fixes shifting issue between states
|
|
6976
|
+
`;
|
|
6977
|
+
const ConnectingAnimation$1 = styled(motion.div) `
|
|
6978
|
+
user-select: none;
|
|
6979
|
+
position: relative;
|
|
6980
|
+
--spinner-error-opacity: 0;
|
|
7124
6981
|
&:before {
|
|
7125
|
-
z-index: 3;
|
|
7126
6982
|
content: '';
|
|
7127
6983
|
position: absolute;
|
|
7128
|
-
inset:
|
|
7129
|
-
|
|
7130
|
-
background
|
|
7131
|
-
|
|
6984
|
+
inset: 1px;
|
|
6985
|
+
opacity: 0;
|
|
6986
|
+
background: var(--ck-body-color-danger);
|
|
6987
|
+
${(props) => props.$circle &&
|
|
6988
|
+
css `
|
|
6989
|
+
inset: -5px;
|
|
6990
|
+
border-radius: 50%;
|
|
6991
|
+
background: none;
|
|
6992
|
+
box-shadow: inset 0 0 0 3.5px var(--ck-body-color-danger);
|
|
6993
|
+
`}
|
|
7132
6994
|
}
|
|
7133
|
-
|
|
7134
|
-
|
|
6995
|
+
${(props) => props.$shake &&
|
|
6996
|
+
css `
|
|
6997
|
+
animation: ${shakeKeyframes$1} 220ms ease-out both;
|
|
6998
|
+
&:before {
|
|
6999
|
+
animation: ${outlineKeyframes$1} 220ms ease-out 750ms both;
|
|
7000
|
+
}
|
|
7001
|
+
`}
|
|
7002
|
+
`;
|
|
7003
|
+
const RetryButton = styled(motion.button) `
|
|
7004
|
+
z-index: 5;
|
|
7005
|
+
appearance: none;
|
|
7006
|
+
position: absolute;
|
|
7007
|
+
right: 10px;
|
|
7008
|
+
bottom: 10px;
|
|
7009
|
+
padding: 0;
|
|
7010
|
+
display: flex;
|
|
7011
|
+
align-items: center;
|
|
7012
|
+
justify-content: center;
|
|
7013
|
+
width: 32px;
|
|
7014
|
+
height: 32px;
|
|
7015
|
+
border-radius: 16px;
|
|
7016
|
+
cursor: pointer;
|
|
7017
|
+
overflow: hidden;
|
|
7018
|
+
background: none;
|
|
7019
|
+
|
|
7020
|
+
color: var(--ck-body-background-secondary);
|
|
7021
|
+
transition: color 200ms ease;
|
|
7022
|
+
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
|
|
7023
|
+
|
|
7024
|
+
&:before {
|
|
7025
|
+
z-index: 3;
|
|
7135
7026
|
content: '';
|
|
7136
7027
|
position: absolute;
|
|
7137
7028
|
inset: 0;
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
background-size: 200% 100%;
|
|
7146
|
-
animation: ${PlaceholderKeyframes$2} 1000ms linear infinite both;
|
|
7029
|
+
opacity: 0;
|
|
7030
|
+
transition: opacity 200ms ease;
|
|
7031
|
+
background: var(--ck-body-color);
|
|
7032
|
+
}
|
|
7033
|
+
|
|
7034
|
+
&:hover:before {
|
|
7035
|
+
opacity: 0.1;
|
|
7147
7036
|
}
|
|
7148
7037
|
`;
|
|
7149
|
-
const
|
|
7150
|
-
z-index: 6;
|
|
7151
|
-
position: absolute;
|
|
7152
|
-
top: 0;
|
|
7153
|
-
left: 0;
|
|
7154
|
-
width: 100%;
|
|
7155
|
-
height: 100%;
|
|
7156
|
-
transform: translateY(50%) scale(0.9999); // Shifting fix
|
|
7157
|
-
`;
|
|
7158
|
-
const LogoIcon = styled(motion.div) `
|
|
7159
|
-
z-index: 6;
|
|
7038
|
+
const RetryIconContainer = styled(motion.div) `
|
|
7160
7039
|
position: absolute;
|
|
7161
|
-
|
|
7162
|
-
overflow: hidden;
|
|
7040
|
+
inset: 0;
|
|
7163
7041
|
|
|
7164
|
-
|
|
7042
|
+
&:before {
|
|
7043
|
+
z-index: 1;
|
|
7044
|
+
content: '';
|
|
7045
|
+
position: absolute;
|
|
7046
|
+
inset: 3px;
|
|
7047
|
+
border-radius: 16px;
|
|
7048
|
+
background: conic-gradient(
|
|
7049
|
+
from 90deg,
|
|
7050
|
+
currentColor 10%,
|
|
7051
|
+
var(--ck-body-color) 80%
|
|
7052
|
+
);
|
|
7053
|
+
}
|
|
7165
7054
|
|
|
7166
7055
|
svg {
|
|
7056
|
+
z-index: 2;
|
|
7167
7057
|
display: block;
|
|
7168
7058
|
position: relative;
|
|
7169
7059
|
width: 100%;
|
|
7170
7060
|
height: 100%;
|
|
7171
7061
|
}
|
|
7172
|
-
|
|
7173
|
-
${(props) => props.$wcLogo
|
|
7174
|
-
? css `
|
|
7175
|
-
width: 29%;
|
|
7176
|
-
height: 20.5%;
|
|
7177
|
-
`
|
|
7178
|
-
: css `
|
|
7179
|
-
width: 28%;
|
|
7180
|
-
height: 28%;
|
|
7181
|
-
border-radius: 17px;
|
|
7182
|
-
&:before {
|
|
7183
|
-
pointer-events: none;
|
|
7184
|
-
z-index: 2;
|
|
7185
|
-
content: '';
|
|
7186
|
-
position: absolute;
|
|
7187
|
-
inset: 0;
|
|
7188
|
-
border-radius: inherit;
|
|
7189
|
-
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
|
|
7190
|
-
}
|
|
7191
|
-
`}
|
|
7192
|
-
`;
|
|
7062
|
+
`;
|
|
7193
7063
|
|
|
7194
7064
|
const TooltipWindow = styled(motion.div) `
|
|
7195
7065
|
z-index: 2147483647;
|
|
@@ -7353,6 +7223,271 @@ const Tooltip = ({ children, message, open, xOffset = 0, yOffset = 0, delay, })
|
|
|
7353
7223
|
}, children: [message, jsx(TooltipTail, { "$size": size })] }) }) })) }) })] }));
|
|
7354
7224
|
};
|
|
7355
7225
|
|
|
7226
|
+
const LoadingTextWrapper = styled.div `
|
|
7227
|
+
display: flex;
|
|
7228
|
+
justify-content: center;
|
|
7229
|
+
align-items: center;
|
|
7230
|
+
flex-direction: column;
|
|
7231
|
+
gap: 12px;
|
|
7232
|
+
padding: 0 8px 16px;
|
|
7233
|
+
text-align: center;
|
|
7234
|
+
`;
|
|
7235
|
+
const ConnectingContainer = styled(motion.div) `
|
|
7236
|
+
display: flex;
|
|
7237
|
+
align-items: center;
|
|
7238
|
+
justify-content: center;
|
|
7239
|
+
margin: 10px auto 16px;
|
|
7240
|
+
height: 120px;
|
|
7241
|
+
`;
|
|
7242
|
+
const dist = 2;
|
|
7243
|
+
const shakeKeyframes = keyframes `
|
|
7244
|
+
0%{ transform:none; }
|
|
7245
|
+
25%{ transform:translateX(${dist}px); }
|
|
7246
|
+
50%{ transform:translateX(-${dist}px); }
|
|
7247
|
+
75%{ transform:translateX(${dist}px); }
|
|
7248
|
+
100%{ transform:none; }
|
|
7249
|
+
`;
|
|
7250
|
+
const outlineKeyframes = keyframes `
|
|
7251
|
+
0%{ opacity:0; }
|
|
7252
|
+
100%{ opacity:1; }
|
|
7253
|
+
`;
|
|
7254
|
+
const ConnectingAnimation = styled(motion.div) `
|
|
7255
|
+
position: relative;
|
|
7256
|
+
user-select: none;
|
|
7257
|
+
position: relative;
|
|
7258
|
+
--spinner-error-opacity: 0;
|
|
7259
|
+
&:before {
|
|
7260
|
+
content: '';
|
|
7261
|
+
position: absolute;
|
|
7262
|
+
inset: 1px;
|
|
7263
|
+
opacity: 0;
|
|
7264
|
+
background: ${(props) => props.$color};
|
|
7265
|
+
}
|
|
7266
|
+
${(props) => !!props.$color &&
|
|
7267
|
+
css `
|
|
7268
|
+
&:before {
|
|
7269
|
+
opacity: 1;
|
|
7270
|
+
}
|
|
7271
|
+
`}
|
|
7272
|
+
${(props) => props.$shake &&
|
|
7273
|
+
css `
|
|
7274
|
+
animation: ${shakeKeyframes} 220ms ease-out both;
|
|
7275
|
+
&:before {
|
|
7276
|
+
animation: ${outlineKeyframes} 220ms ease-out both;
|
|
7277
|
+
}
|
|
7278
|
+
`}
|
|
7279
|
+
`;
|
|
7280
|
+
const Loader = ({ header, description, icon, isError = false, isSuccess = false, isLoading = !isError && !isSuccess, onRetry, }) => {
|
|
7281
|
+
const { uiConfig: options } = useOpenfort();
|
|
7282
|
+
const { triggerResize } = useOpenfort();
|
|
7283
|
+
const locales = useLocales();
|
|
7284
|
+
useEffect(() => {
|
|
7285
|
+
return () => triggerResize();
|
|
7286
|
+
}, []);
|
|
7287
|
+
const renderLogo = () => {
|
|
7288
|
+
if (icon) {
|
|
7289
|
+
return icon;
|
|
7290
|
+
}
|
|
7291
|
+
if (options === null || options === void 0 ? void 0 : options.logo) {
|
|
7292
|
+
if (typeof options.logo === 'string') {
|
|
7293
|
+
return jsx("img", { src: options.logo, alt: "Logo", style: { width: '100%' } });
|
|
7294
|
+
}
|
|
7295
|
+
return options.logo;
|
|
7296
|
+
}
|
|
7297
|
+
return jsx(Logos.Openfort, {});
|
|
7298
|
+
};
|
|
7299
|
+
return (jsxs(Fragment, { children: [jsx(ConnectingContainer, { children: jsxs(ConnectingAnimation, { "$color": isSuccess ? 'var(--ck-body-color-valid)' : isError ? 'var(--ck-body-color-danger)' : undefined, "$shake": isError, children: [jsx(AnimatePresence, { children: (isError && onRetry) && (jsx(RetryButton, { "aria-label": "Retry", initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, whileTap: { scale: 0.9 }, transition: { duration: 0.1 }, onClick: onRetry, children: jsx(RetryIconContainer, { children: jsx(Tooltip, { open: isError, message: locales.tryAgainQuestion, xOffset: -6, children: jsx(RetryIconCircle, {}) }) }) })) }), jsx(SquircleSpinner, { logo: jsx("div", { style: {
|
|
7300
|
+
padding: '12px',
|
|
7301
|
+
position: 'relative',
|
|
7302
|
+
width: '100%',
|
|
7303
|
+
}, children: renderLogo() }), connecting: isLoading })] }) }), jsxs(LoadingTextWrapper, { children: [isLoading && (jsxs(Fragment, { children: [jsx(ModalH1, { children: "Loading, please wait" }), jsx(ModalBody, { children: description !== null && description !== void 0 ? description : header })] })), isSuccess && (jsxs(Fragment, { children: [jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", header] }), jsx(ModalBody, { children: description })] })), isError && (jsxs(Fragment, { children: [jsx(ModalH1, { "$error": true, children: header }), jsx(ModalBody, { children: description })] }))] })] }));
|
|
7304
|
+
};
|
|
7305
|
+
|
|
7306
|
+
const ConnectWithMobile$1 = () => {
|
|
7307
|
+
const { open: openWalletConnectModal } = useWalletConnectModal();
|
|
7308
|
+
const [error, setError] = useState(undefined);
|
|
7309
|
+
const { connect, connectors } = useConnect$1();
|
|
7310
|
+
const { connector, address } = useAccount();
|
|
7311
|
+
const { setRoute, setConnector } = useOpenfort();
|
|
7312
|
+
const openWCModal = async () => {
|
|
7313
|
+
setError(undefined);
|
|
7314
|
+
const { error } = await openWalletConnectModal();
|
|
7315
|
+
if (error) {
|
|
7316
|
+
setError(error);
|
|
7317
|
+
}
|
|
7318
|
+
};
|
|
7319
|
+
useEffect(() => {
|
|
7320
|
+
openWCModal();
|
|
7321
|
+
}, [connect, connectors]);
|
|
7322
|
+
useEffect(() => {
|
|
7323
|
+
if (connector && address) {
|
|
7324
|
+
const walletConnectDeeplinkChoice = localStorage.getItem("WALLETCONNECT_DEEPLINK_CHOICE");
|
|
7325
|
+
if (walletConnectDeeplinkChoice) {
|
|
7326
|
+
const parsedChoice = JSON.parse(walletConnectDeeplinkChoice);
|
|
7327
|
+
setConnector({ id: parsedChoice.name });
|
|
7328
|
+
}
|
|
7329
|
+
else {
|
|
7330
|
+
setConnector({ id: connector.id });
|
|
7331
|
+
}
|
|
7332
|
+
setRoute(routes.CONNECT_WITH_MOBILE);
|
|
7333
|
+
}
|
|
7334
|
+
}, [address, connector]);
|
|
7335
|
+
return (jsx(Loader, { header: error ? "Error connecting wallet." : `Connecting...`, isError: !!error, description: error, onRetry: () => openWCModal() }));
|
|
7336
|
+
};
|
|
7337
|
+
const Wallets = () => {
|
|
7338
|
+
const isMobile = useIsMobile();
|
|
7339
|
+
return (jsx(PageContent, { style: { width: 312 }, children: isMobile ? (jsx(ConnectWithMobile$1, {})) : (jsx(ConnectorList, {})) }));
|
|
7340
|
+
};
|
|
7341
|
+
|
|
7342
|
+
const QRCodeContainer = styled(motion.div) `
|
|
7343
|
+
z-index: 3;
|
|
7344
|
+
position: relative;
|
|
7345
|
+
overflow: hidden;
|
|
7346
|
+
height: 0;
|
|
7347
|
+
padding-bottom: 100% !important;
|
|
7348
|
+
display: flex;
|
|
7349
|
+
align-items: center;
|
|
7350
|
+
justify-content: center;
|
|
7351
|
+
margin: 1px 0 2px;
|
|
7352
|
+
border-radius: var(--ck-qr-border-radius, 24px);
|
|
7353
|
+
background: var(--ck-qr-background, transparent);
|
|
7354
|
+
box-shadow: 0 0 0 1px var(--ck-qr-border-color);
|
|
7355
|
+
backface-visibility: hidden;
|
|
7356
|
+
svg {
|
|
7357
|
+
display: block;
|
|
7358
|
+
max-width: 100%;
|
|
7359
|
+
width: 100%;
|
|
7360
|
+
height: auto;
|
|
7361
|
+
}
|
|
7362
|
+
`;
|
|
7363
|
+
const QRCodeContent = styled(motion.div) `
|
|
7364
|
+
position: absolute;
|
|
7365
|
+
inset: 13px;
|
|
7366
|
+
svg {
|
|
7367
|
+
width: 100% !important;
|
|
7368
|
+
height: auto !important;
|
|
7369
|
+
}
|
|
7370
|
+
`;
|
|
7371
|
+
const PlaceholderKeyframes$2 = keyframes `
|
|
7372
|
+
0%{ background-position: 100% 0; }
|
|
7373
|
+
100%{ background-position: -100% 0; }
|
|
7374
|
+
`;
|
|
7375
|
+
const QRPlaceholder = styled(motion.div) `
|
|
7376
|
+
--color: var(--ck-qr-dot-color);
|
|
7377
|
+
--bg: var(--ck-qr-background, var(--ck-body-background));
|
|
7378
|
+
|
|
7379
|
+
position: absolute;
|
|
7380
|
+
inset: 0;
|
|
7381
|
+
display: flex;
|
|
7382
|
+
align-items: center;
|
|
7383
|
+
justify-content: center;
|
|
7384
|
+
> div {
|
|
7385
|
+
z-index: 4;
|
|
7386
|
+
position: relative;
|
|
7387
|
+
width: 28%;
|
|
7388
|
+
height: 28%;
|
|
7389
|
+
border-radius: 20px;
|
|
7390
|
+
background: var(--bg);
|
|
7391
|
+
box-shadow: 0 0 0 7px var(--bg);
|
|
7392
|
+
}
|
|
7393
|
+
> span {
|
|
7394
|
+
z-index: 4;
|
|
7395
|
+
position: absolute;
|
|
7396
|
+
background: var(--color);
|
|
7397
|
+
border-radius: 12px;
|
|
7398
|
+
width: 13.25%;
|
|
7399
|
+
height: 13.25%;
|
|
7400
|
+
box-shadow: 0 0 0 4px var(--bg);
|
|
7401
|
+
&:before {
|
|
7402
|
+
content: '';
|
|
7403
|
+
position: absolute;
|
|
7404
|
+
inset: 9px;
|
|
7405
|
+
border-radius: 3px;
|
|
7406
|
+
box-shadow: 0 0 0 4px var(--bg);
|
|
7407
|
+
}
|
|
7408
|
+
&:nth-child(1) {
|
|
7409
|
+
top: 0;
|
|
7410
|
+
left: 0;
|
|
7411
|
+
}
|
|
7412
|
+
&:nth-child(2) {
|
|
7413
|
+
top: 0;
|
|
7414
|
+
right: 0;
|
|
7415
|
+
}
|
|
7416
|
+
&:nth-child(3) {
|
|
7417
|
+
bottom: 0;
|
|
7418
|
+
left: 0;
|
|
7419
|
+
}
|
|
7420
|
+
}
|
|
7421
|
+
&:before {
|
|
7422
|
+
z-index: 3;
|
|
7423
|
+
content: '';
|
|
7424
|
+
position: absolute;
|
|
7425
|
+
inset: 0;
|
|
7426
|
+
background: repeat;
|
|
7427
|
+
background-size: 1.888% 1.888%;
|
|
7428
|
+
background-image: radial-gradient(var(--color) 41%, transparent 41%);
|
|
7429
|
+
}
|
|
7430
|
+
&:after {
|
|
7431
|
+
z-index: 5;
|
|
7432
|
+
content: '';
|
|
7433
|
+
position: absolute;
|
|
7434
|
+
inset: 0;
|
|
7435
|
+
transform: scale(1.5) rotate(45deg);
|
|
7436
|
+
background-image: linear-gradient(
|
|
7437
|
+
90deg,
|
|
7438
|
+
rgba(255, 255, 255, 0) 50%,
|
|
7439
|
+
rgba(255, 255, 255, 1),
|
|
7440
|
+
rgba(255, 255, 255, 0)
|
|
7441
|
+
);
|
|
7442
|
+
background-size: 200% 100%;
|
|
7443
|
+
animation: ${PlaceholderKeyframes$2} 1000ms linear infinite both;
|
|
7444
|
+
}
|
|
7445
|
+
`;
|
|
7446
|
+
const LogoContainer$2 = styled(motion.div) `
|
|
7447
|
+
z-index: 6;
|
|
7448
|
+
position: absolute;
|
|
7449
|
+
top: 0;
|
|
7450
|
+
left: 0;
|
|
7451
|
+
width: 100%;
|
|
7452
|
+
height: 100%;
|
|
7453
|
+
transform: translateY(50%) scale(0.9999); // Shifting fix
|
|
7454
|
+
`;
|
|
7455
|
+
const LogoIcon = styled(motion.div) `
|
|
7456
|
+
z-index: 6;
|
|
7457
|
+
position: absolute;
|
|
7458
|
+
left: 50%;
|
|
7459
|
+
overflow: hidden;
|
|
7460
|
+
|
|
7461
|
+
transform: translate(-50%, -50%) scale(0.9999); // Shifting fix
|
|
7462
|
+
|
|
7463
|
+
svg {
|
|
7464
|
+
display: block;
|
|
7465
|
+
position: relative;
|
|
7466
|
+
width: 100%;
|
|
7467
|
+
height: 100%;
|
|
7468
|
+
}
|
|
7469
|
+
|
|
7470
|
+
${(props) => props.$wcLogo
|
|
7471
|
+
? css `
|
|
7472
|
+
width: 29%;
|
|
7473
|
+
height: 20.5%;
|
|
7474
|
+
`
|
|
7475
|
+
: css `
|
|
7476
|
+
width: 28%;
|
|
7477
|
+
height: 28%;
|
|
7478
|
+
border-radius: 17px;
|
|
7479
|
+
&:before {
|
|
7480
|
+
pointer-events: none;
|
|
7481
|
+
z-index: 2;
|
|
7482
|
+
content: '';
|
|
7483
|
+
position: absolute;
|
|
7484
|
+
inset: 0;
|
|
7485
|
+
border-radius: inherit;
|
|
7486
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
|
|
7487
|
+
}
|
|
7488
|
+
`}
|
|
7489
|
+
`;
|
|
7490
|
+
|
|
7356
7491
|
const generateMatrix = (value, errorCorrectionLevel) => {
|
|
7357
7492
|
const arr = Array.prototype.slice.call(QRCodeUtil.create(value, { errorCorrectionLevel }).modules.data, 0);
|
|
7358
7493
|
const sqrt = Math.sqrt(arr.length);
|
|
@@ -7438,7 +7573,7 @@ function useWindowSize() {
|
|
|
7438
7573
|
function CustomQRCode({ value, image, imageBackground, imagePosition = 'center', tooltipMessage, }) {
|
|
7439
7574
|
const windowSize = useWindowSize();
|
|
7440
7575
|
const Logo = windowSize.width > 920 && tooltipMessage ? (jsx(Tooltip, { xOffset: 139, yOffset: 5, delay: 0.1, message: tooltipMessage, children: image })) : (image);
|
|
7441
|
-
return (jsx(QRCodeContainer, { children: jsxs(QRCodeContent, { children: [image && (jsx(LogoContainer$
|
|
7576
|
+
return (jsx(QRCodeContainer, { children: jsxs(QRCodeContent, { children: [image && (jsx(LogoContainer$2, { children: jsx(LogoIcon, { "$wcLogo": imagePosition !== 'center', style: {
|
|
7442
7577
|
background: imagePosition === 'center' ? imageBackground : undefined,
|
|
7443
7578
|
}, children: Logo }) })), jsx(AnimatePresence, { initial: false, children: value ? (jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0, position: 'absolute', inset: [0, 0] }, transition: {
|
|
7444
7579
|
duration: 0.2,
|
|
@@ -7528,49 +7663,7 @@ const WalletList = styled.div `
|
|
|
7528
7663
|
}
|
|
7529
7664
|
`}
|
|
7530
7665
|
`;
|
|
7531
|
-
const Container$
|
|
7532
|
-
|
|
7533
|
-
function useWalletConnectModal() {
|
|
7534
|
-
const { log } = useOpenfort();
|
|
7535
|
-
const { connectAsync, connectors } = useConnect();
|
|
7536
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
7537
|
-
return {
|
|
7538
|
-
isOpen,
|
|
7539
|
-
open: async () => {
|
|
7540
|
-
// add modal styling because wagmi does not let you add styling to the modal
|
|
7541
|
-
const w3mcss = document.createElement('style');
|
|
7542
|
-
w3mcss.innerHTML = `w3m-modal, wcm-modal{ --wcm-z-index: 2147483647; --w3m-z-index:2147483647; }`;
|
|
7543
|
-
document.head.appendChild(w3mcss);
|
|
7544
|
-
const clientConnector = connectors.find((c) => isWalletConnectConnector(c.id));
|
|
7545
|
-
if (clientConnector) {
|
|
7546
|
-
try {
|
|
7547
|
-
const provider = await clientConnector.getProvider();
|
|
7548
|
-
const projectId = provider.rpc.projectId;
|
|
7549
|
-
const connector = walletConnect$1({
|
|
7550
|
-
projectId,
|
|
7551
|
-
showQrModal: true,
|
|
7552
|
-
});
|
|
7553
|
-
setIsOpen(true);
|
|
7554
|
-
try {
|
|
7555
|
-
await connectAsync({ connector: connector });
|
|
7556
|
-
}
|
|
7557
|
-
catch (err) {
|
|
7558
|
-
log('WalletConnect', err);
|
|
7559
|
-
}
|
|
7560
|
-
setIsOpen(false);
|
|
7561
|
-
// remove modal styling
|
|
7562
|
-
document.head.removeChild(w3mcss);
|
|
7563
|
-
}
|
|
7564
|
-
catch (err) {
|
|
7565
|
-
log('Could not get WalletConnect provider', err);
|
|
7566
|
-
}
|
|
7567
|
-
}
|
|
7568
|
-
else {
|
|
7569
|
-
log('No WalletConnect connector available');
|
|
7570
|
-
}
|
|
7571
|
-
},
|
|
7572
|
-
};
|
|
7573
|
-
}
|
|
7666
|
+
const Container$6 = styled.div ``;
|
|
7574
7667
|
|
|
7575
7668
|
const IconContainer$3 = styled(motion.div) `
|
|
7576
7669
|
transition: all 220ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
|
|
@@ -7635,7 +7728,7 @@ const CopyToClipboardIcon = ({ copied, small, }) => (jsx(IconContainer$3, { "$cl
|
|
|
7635
7728
|
opacity: small || copied ? 1 : 0.3,
|
|
7636
7729
|
} }) }));
|
|
7637
7730
|
|
|
7638
|
-
const Container$
|
|
7731
|
+
const Container$5 = styled.div `
|
|
7639
7732
|
--color: var(--ck-copytoclipboard-stroke);
|
|
7640
7733
|
--bg: var(--ck-body-background);
|
|
7641
7734
|
transition: all 220ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
|
|
@@ -7685,7 +7778,7 @@ const CopyToClipboard = ({ string, children, variant }) => {
|
|
|
7685
7778
|
};
|
|
7686
7779
|
if (variant === 'button')
|
|
7687
7780
|
return (jsx(Button, { disabled: !string, onClick: onCopy, icon: jsx(CopyToClipboardIcon, { copied: clipboard }), children: children }));
|
|
7688
|
-
return (jsx(Container$
|
|
7781
|
+
return (jsx(Container$5, { onClick: onCopy, "$disabled": !string, children: jsxs(OffsetContainer, { children: [children, jsx(CopyToClipboardIcon, { copied: clipboard, small: true })] }) }));
|
|
7689
7782
|
};
|
|
7690
7783
|
|
|
7691
7784
|
const MoreIcon = (jsx("svg", { width: "60", height: "60", viewBox: "0 0 60 60", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M30 42V19M19 30.5H42", stroke: "var(--ck-body-color-muted)", strokeWidth: "3", strokeLinecap: "round" }) }));
|
|
@@ -7710,7 +7803,7 @@ const MobileConnectors = () => {
|
|
|
7710
7803
|
context.setRoute(routes.CONNECT_WITH_MOBILE);
|
|
7711
7804
|
context.setConnector({ id: walletId });
|
|
7712
7805
|
};
|
|
7713
|
-
return (jsx(PageContent, { style: { width: 312 }, children: jsxs(Container$
|
|
7806
|
+
return (jsx(PageContent, { style: { width: 312 }, children: jsxs(Container$6, { children: [jsx(ModalContent, { style: { paddingBottom: 0 }, children: jsx(ScrollArea, { height: 340, children: jsxs(WalletList, { "$disabled": !wcUri, children: [walletsIdsToDisplay
|
|
7714
7807
|
.sort(
|
|
7715
7808
|
// sort by name
|
|
7716
7809
|
(a, b) => {
|
|
@@ -7855,7 +7948,7 @@ const RotateWrapper = styled(motion.div) `
|
|
|
7855
7948
|
animation-name: ${rotate};
|
|
7856
7949
|
animation-duration: 3200ms;
|
|
7857
7950
|
`;
|
|
7858
|
-
const Logo$
|
|
7951
|
+
const Logo$1 = styled(motion.div) `
|
|
7859
7952
|
position: absolute;
|
|
7860
7953
|
inset: 0;
|
|
7861
7954
|
|
|
@@ -7918,7 +8011,7 @@ const Introduction = () => {
|
|
|
7918
8011
|
const context = useOpenfort();
|
|
7919
8012
|
const locales = useLocales({});
|
|
7920
8013
|
const ctaUrl = (_b = (_a = context.uiConfig) === null || _a === void 0 ? void 0 : _a.walletOnboardingUrl) !== null && _b !== void 0 ? _b : locales.onboardingScreen_ctaUrl;
|
|
7921
|
-
return (jsxs(PageContent, { children: [jsxs(Graphic, { children: [jsxs(LogoGroup, { children: [jsx(Logo$
|
|
8014
|
+
return (jsxs(PageContent, { children: [jsxs(Graphic, { children: [jsxs(LogoGroup, { children: [jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Coinbase, { background: true }) }) }) }) }) }) }), jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.MetaMask, { background: true }) }) }) }) }) }) }), jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Trust, {}) }) }) }) }) }) }), jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.Argent, {}) }) }) }) }) }) }), jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { children: jsx(Logos.ImToken, {}) }) }) }) }) }) })] }), jsx(GraphicBackground, { children: wave })] }), jsxs(ModalContent, { style: { paddingBottom: 18 }, children: [jsx(ModalH1, { "$small": true, children: locales.onboardingScreen_h1 }), jsx(ModalBody, { children: locales.onboardingScreen_p })] }), jsx(Button, { href: ctaUrl, arrow: true, children: locales.onboardingScreen_ctaText })] }));
|
|
7922
8015
|
};
|
|
7923
8016
|
|
|
7924
8017
|
const AvatarContainer = styled(motion.div) `
|
|
@@ -8158,7 +8251,7 @@ const ChainContainer = styled.div `
|
|
|
8158
8251
|
justify-content: center;
|
|
8159
8252
|
}
|
|
8160
8253
|
`;
|
|
8161
|
-
const LogoContainer$
|
|
8254
|
+
const LogoContainer$1 = styled(motion.div) `
|
|
8162
8255
|
display: block;
|
|
8163
8256
|
position: absolute;
|
|
8164
8257
|
inset: 0;
|
|
@@ -8658,7 +8751,7 @@ const chainConfigs = [
|
|
|
8658
8751
|
},
|
|
8659
8752
|
];
|
|
8660
8753
|
|
|
8661
|
-
const Spinner$
|
|
8754
|
+
const Spinner$2 = (jsxs("svg", { "aria-hidden": "true", width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.3592 30.1654C10.0472 29.4491 8.85718 28.524 7.83713 27.424C6.81708 26.324 5.98425 25.0677 5.36889 23.7054C5.20157 23.335 5.05033 22.9567 4.91578 22.5717C4.51465 21.4237 4.26735 20.2308 4.17794 19.0239C4.16599 18.8626 4.13894 18.7041 4.09809 18.5507C3.85023 17.6197 3.09399 16.8738 2.11531 16.7999C0.975331 16.7138 -0.0310983 17.5702 0.0141657 18.7125C0.0223289 18.9185 0.0340286 19.1243 0.049253 19.3298C0.165374 20.8971 0.486545 22.4464 1.00749 23.9373C1.10424 24.2142 1.20764 24.4884 1.31755 24.7596C2.13617 26.7799 3.31595 28.6371 4.80146 30.239C6.28696 31.841 8.04998 33.1573 10.0029 34.1258C10.2651 34.2558 10.5307 34.3796 10.7995 34.4969C12.247 35.1287 13.7676 35.5656 15.3217 35.7995C15.5255 35.8301 15.7298 35.8573 15.9346 35.881C17.0703 36.0122 18.0001 35.0731 18.0001 33.9299C18.0001 32.9484 17.3133 32.1381 16.4036 31.8208C16.2537 31.7685 16.0977 31.7296 15.9377 31.7056C14.7411 31.5255 13.5702 31.1891 12.4556 30.7026C12.0818 30.5394 11.716 30.3601 11.3592 30.1654Z", fill: "url(#paint0_linear_1288_1870)" }), jsx("defs", { children: jsxs("linearGradient", { id: "paint0_linear_1288_1870", x1: "2", y1: "19.4884", x2: "16.8752", y2: "33.7485", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopColor: "var(--ck-connectbutton-balance-color,currentColor)", stopOpacity: "0.7" }), jsx("stop", { offset: "1", stopColor: "var(--ck-connectbutton-balance-color,currentColor)", stopOpacity: "0" })] }) })] }));
|
|
8662
8755
|
const Chain = ({ id, unsupported: controlledUnsupported, radius = '50%', size = 24, }) => {
|
|
8663
8756
|
var _a;
|
|
8664
8757
|
const isChainSupported = useChainIsSupported(id);
|
|
@@ -8670,7 +8763,7 @@ const Chain = ({ id, unsupported: controlledUnsupported, radius = '50%', size =
|
|
|
8670
8763
|
width: size,
|
|
8671
8764
|
height: size,
|
|
8672
8765
|
} }));
|
|
8673
|
-
return (jsx(ChainContainer, { size: size, radius: radius, children: jsxs(AnimatePresence, { initial: false, children: [unsupported && (jsx(Unsupported, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "13", height: "12", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) })), id ? (jsx(LogoContainer$
|
|
8766
|
+
return (jsx(ChainContainer, { size: size, radius: radius, children: jsxs(AnimatePresence, { initial: false, children: [unsupported && (jsx(Unsupported, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "13", height: "12", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) })), id ? (jsx(LogoContainer$1, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 }, children: (_a = chain === null || chain === void 0 ? void 0 : chain.logo) !== null && _a !== void 0 ? _a : jsx(ChainIcons.UnknownChain, {}) }, `${chain === null || chain === void 0 ? void 0 : chain.id}-${chain === null || chain === void 0 ? void 0 : chain.name}-${id}`)) : (jsx(LoadingContainer, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 }, children: Spinner$2 }, "loading"))] }) }));
|
|
8674
8767
|
};
|
|
8675
8768
|
|
|
8676
8769
|
const SwitchNetworksContainer = styled.div `
|
|
@@ -8891,7 +8984,7 @@ const ChainButtonBg = styled(motion.div) `
|
|
|
8891
8984
|
}
|
|
8892
8985
|
`;
|
|
8893
8986
|
|
|
8894
|
-
const Spinner$
|
|
8987
|
+
const Spinner$1 = (jsxs("svg", { "aria-hidden": "true", width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2 16.75C2.69036 16.75 3.25 17.3096 3.25 18V19C3.25 26.5939 9.40609 32.75 17 32.75V35.25C8.02537 35.25 0.75 27.9746 0.75 19V18C0.75 17.3096 1.30964 16.75 2 16.75Z", fill: "url(#paint0_linear_1288_18701)" }), jsx("defs", { children: jsxs("linearGradient", { id: "paint0_linear_1288_18701", x1: "2", y1: "19.4884", x2: "16.8752", y2: "33.7485", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopColor: "var(--ck-spinner-color)" }), jsx("stop", { offset: "1", stopColor: "var(--ck-spinner-color)", stopOpacity: "0" })] }) })] }));
|
|
8895
8988
|
const ChainSelectList = ({ variant, }) => {
|
|
8896
8989
|
const { connector, chain } = useAccount();
|
|
8897
8990
|
const { chains, isPending, switchChain, error } = useSwitchChain();
|
|
@@ -8939,7 +9032,7 @@ const ChainSelectList = ({ variant, }) => {
|
|
|
8939
9032
|
opacity: [1, 0],
|
|
8940
9033
|
transition: { delay: 4, duration: 3 },
|
|
8941
9034
|
}
|
|
8942
|
-
: { opacity: 1 }, children: Spinner$
|
|
9035
|
+
: { opacity: 1 }, children: Spinner$1 }, `${ch === null || ch === void 0 ? void 0 : ch.id}-${ch === null || ch === void 0 ? void 0 : ch.name}`) }), jsx(ChainIcon, { children: (_a = ch.logo) !== null && _a !== void 0 ? _a : jsx(ChainIcons.UnknownChain, {}) })] }), ch.name] }), variant !== 'secondary' && (jsx(ChainButtonStatus, { children: jsxs(AnimatePresence, { initial: false, exitBeforeEnter: true, children: [ch.id === (chain === null || chain === void 0 ? void 0 : chain.id) && (jsx(motion.span, { style: {
|
|
8943
9036
|
color: 'var(--ck-dropdown-active-color, var(--ck-focus-color))',
|
|
8944
9037
|
display: 'block',
|
|
8945
9038
|
position: 'relative',
|
|
@@ -9179,7 +9272,7 @@ const ChainSelectDropdown = ({ children, open, onClose, offsetX = 0, offsetY = 8
|
|
|
9179
9272
|
}, children: [jsx(DropdownHeading, { children: locales.switchNetworks }), jsx(ChainSelectList, {})] })] }) }) }) })) })] }));
|
|
9180
9273
|
};
|
|
9181
9274
|
|
|
9182
|
-
const Container$
|
|
9275
|
+
const Container$4 = styled(motion.div) ``;
|
|
9183
9276
|
const SwitchChainButton = styled(motion.button) `
|
|
9184
9277
|
--color: var(
|
|
9185
9278
|
--ck-dropdown-button-color,
|
|
@@ -9288,7 +9381,7 @@ const ChainSelector = () => {
|
|
|
9288
9381
|
setIsOpen(false);
|
|
9289
9382
|
}, [context.open]);
|
|
9290
9383
|
const disabled = chains.length <= 1;
|
|
9291
|
-
return (jsx(Fragment, { children: jsx(Container$
|
|
9384
|
+
return (jsx(Fragment, { children: jsx(Container$4, { children: jsx(ChainSelectDropdown, { offsetX: -12, open: !mobile && isOpen, onClose: () => setIsOpen(false), children: chain && (jsxs(SwitchChainButton, { "aria-label": flattenChildren(locales.switchNetworks).toString(), disabled: disabled, onClick: () => {
|
|
9292
9385
|
if (mobile) {
|
|
9293
9386
|
context.setRoute(routes.SWITCHNETWORKS);
|
|
9294
9387
|
}
|
|
@@ -9301,8 +9394,8 @@ const ChainSelector = () => {
|
|
|
9301
9394
|
const PoweredByFooter = ({ showDisclaimer }) => {
|
|
9302
9395
|
var _a, _b;
|
|
9303
9396
|
const { uiConfig: options } = useOpenfort();
|
|
9304
|
-
return (jsxs(Container$
|
|
9305
|
-
window.open("https://www.openfort.
|
|
9397
|
+
return (jsxs(Container$3, { children: [showDisclaimer && (jsx(Disclaimer, { children: (options === null || options === void 0 ? void 0 : options.disclaimer) ? (jsx(Fragment, { children: options.disclaimer })) : (jsxs("div", { children: ["By logging in, you agree to our ", jsx("a", { href: (_a = options === null || options === void 0 ? void 0 : options.termsOfServiceUrl) !== null && _a !== void 0 ? _a : "https://www.openfort.io/terms", target: "_blank", rel: "noopener noreferrer", children: "Terms of Service" }), " & ", jsx("a", { href: (_b = options === null || options === void 0 ? void 0 : options.privacyPolicyUrl) !== null && _b !== void 0 ? _b : "https://www.openfort.io/privacy", target: "_blank", rel: "noopener noreferrer", children: "Privacy Policy" }), "."] })) })), jsxs(TextButton, { onClick: () => {
|
|
9398
|
+
window.open("https://www.openfort.io/", "_blank");
|
|
9306
9399
|
}, children: [jsx("span", { children: "Powered by" }), jsx(IconContainer$2, { children: jsx(Logos.Openfort, {}) }), jsx("span", { children: "Openfort" })] })] }));
|
|
9307
9400
|
};
|
|
9308
9401
|
const Disclaimer = styled(motion.div) `
|
|
@@ -9350,7 +9443,7 @@ const IconContainer$2 = styled.div `
|
|
|
9350
9443
|
border-radius: 0;
|
|
9351
9444
|
}
|
|
9352
9445
|
`;
|
|
9353
|
-
const Container$
|
|
9446
|
+
const Container$3 = styled(motion.div) `
|
|
9354
9447
|
text-align: center;
|
|
9355
9448
|
margin-top: 4px;
|
|
9356
9449
|
margin-bottom: -16px;
|
|
@@ -9542,323 +9635,127 @@ const ProviderLabel = styled.span `
|
|
|
9542
9635
|
display: flex;
|
|
9543
9636
|
align-items: center;
|
|
9544
9637
|
gap: 9px;
|
|
9545
|
-
width: 100%;
|
|
9546
|
-
overflow: hidden;
|
|
9547
|
-
white-space: nowrap;
|
|
9548
|
-
text-overflow: ellipsis;
|
|
9549
|
-
padding: 2px 0;
|
|
9550
|
-
`;
|
|
9551
|
-
const ProviderIcon$1 = styled.div `
|
|
9552
|
-
width: 32px;
|
|
9553
|
-
height: 32px;
|
|
9554
|
-
svg,
|
|
9555
|
-
img {
|
|
9556
|
-
display: block;
|
|
9557
|
-
position: relative;
|
|
9558
|
-
pointer-events: none;
|
|
9559
|
-
overflow: hidden;
|
|
9560
|
-
width: 100%;
|
|
9561
|
-
height: 100%;
|
|
9562
|
-
}
|
|
9563
|
-
|
|
9564
|
-
&[data-shape='squircle'] {
|
|
9565
|
-
border-radius: 22.5%;
|
|
9566
|
-
}
|
|
9567
|
-
&[data-shape='circle'] {
|
|
9568
|
-
border-radius: 100%;
|
|
9569
|
-
}
|
|
9570
|
-
&[data-shape='square'] {
|
|
9571
|
-
border-radius: 0;
|
|
9572
|
-
}
|
|
9573
|
-
`;
|
|
9574
|
-
|
|
9575
|
-
const WalletIcon = ({ provider }) => {
|
|
9576
|
-
var _a;
|
|
9577
|
-
if (provider.walletClientType === "walletconnect")
|
|
9578
|
-
return jsx(Logos.WalletConnect, {});
|
|
9579
|
-
const wallets = useWallets$1();
|
|
9580
|
-
const wallet = useMemo(() => {
|
|
9581
|
-
return wallets.find(w => { var _a; return ((_a = w.id) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === provider.walletClientType; });
|
|
9582
|
-
}, [provider]);
|
|
9583
|
-
if (wallet)
|
|
9584
|
-
return jsx(Fragment, { children: (_a = wallet.iconConnector) !== null && _a !== void 0 ? _a : wallet.icon });
|
|
9585
|
-
return jsx(Wallet, {});
|
|
9586
|
-
};
|
|
9587
|
-
const ProviderIcon = ({ provider }) => {
|
|
9588
|
-
switch (provider.provider) {
|
|
9589
|
-
case "email":
|
|
9590
|
-
return jsx(EmailIcon, {});
|
|
9591
|
-
case "wallet":
|
|
9592
|
-
return jsx(WalletIcon, { provider: provider });
|
|
9593
|
-
case "google":
|
|
9594
|
-
case "twitter":
|
|
9595
|
-
case "facebook":
|
|
9596
|
-
return providersLogos[provider.provider];
|
|
9597
|
-
default:
|
|
9598
|
-
return jsx(FitText, { children: provider.provider.substring(0, 4).toUpperCase() });
|
|
9599
|
-
}
|
|
9600
|
-
};
|
|
9601
|
-
const LinkedProvider = ({ provider }) => {
|
|
9602
|
-
return (jsx(LinkedProviderButton, { disabled: true, children: jsx(ProviderIcon$1, { children: jsx(ProviderIcon, { provider: provider }) }) }));
|
|
9603
|
-
};
|
|
9604
|
-
const AddLinkedProviderButton = () => {
|
|
9605
|
-
const { setRoute } = useOpenfort();
|
|
9606
|
-
const { availableProviders: unlinkedProviders } = useProviders();
|
|
9607
|
-
return (jsx(LinkedProviderButton, { disabled: unlinkedProviders.length === 0, onClick: () => setRoute(routes.PROVIDERS), children: "+" }));
|
|
9608
|
-
};
|
|
9609
|
-
const LinkedProviders = () => {
|
|
9610
|
-
const { user } = useOpenfortCore();
|
|
9611
|
-
if (!user || !user.linkedAccounts) {
|
|
9612
|
-
return (jsx("div", { children: jsx("p", { children: "No linked providers" }) }));
|
|
9613
|
-
}
|
|
9614
|
-
return (jsxs(Fragment, { children: [jsx(ProvidersHeader, { children: "Linked providers" }), jsxs(LinkedProviderContainer, { children: [user.linkedAccounts.map((provider, i) => (jsx(LinkedProvider, { provider: provider }, provider.provider + i))), jsx(AddLinkedProviderButton, {})] })] }));
|
|
9615
|
-
};
|
|
9616
|
-
|
|
9617
|
-
const Profile = ({ closeModal }) => {
|
|
9618
|
-
var _a, _b, _c, _d;
|
|
9619
|
-
const context = useOpenfort();
|
|
9620
|
-
const themeContext = useThemeContext();
|
|
9621
|
-
const locales = useLocales();
|
|
9622
|
-
const { address, isConnected, connector, chain } = useAccount();
|
|
9623
|
-
const ensFallbackConfig = useEnsFallbackConfig();
|
|
9624
|
-
const { data: ensName } = useEnsName({
|
|
9625
|
-
chainId: 1,
|
|
9626
|
-
address: address,
|
|
9627
|
-
config: ensFallbackConfig,
|
|
9628
|
-
});
|
|
9629
|
-
const { data: balance } = useBalance({
|
|
9630
|
-
address,
|
|
9631
|
-
//watch: true,
|
|
9632
|
-
});
|
|
9633
|
-
const [shouldDisconnect, setShouldDisconnect] = useState(false);
|
|
9634
|
-
const { logout } = useOpenfortCore();
|
|
9635
|
-
useEffect(() => {
|
|
9636
|
-
if (!shouldDisconnect)
|
|
9637
|
-
return;
|
|
9638
|
-
// Close before disconnecting to avoid layout shifting while modal is still open
|
|
9639
|
-
if (closeModal) {
|
|
9640
|
-
closeModal();
|
|
9641
|
-
}
|
|
9642
|
-
else {
|
|
9643
|
-
context.setOpen(false);
|
|
9644
|
-
}
|
|
9645
|
-
return () => {
|
|
9646
|
-
logout();
|
|
9647
|
-
};
|
|
9648
|
-
}, [shouldDisconnect, logout]);
|
|
9649
|
-
const separator = ['web95', 'rounded', 'minimal'].includes((_c = (_a = themeContext.theme) !== null && _a !== void 0 ? _a : (_b = context.uiConfig) === null || _b === void 0 ? void 0 : _b.theme) !== null && _c !== void 0 ? _c : '')
|
|
9650
|
-
? '....'
|
|
9651
|
-
: undefined;
|
|
9652
|
-
return (jsxs(PageContent, { children: [jsxs(ModalContent, { style: { paddingBottom: 22, gap: 6 }, children: [address ? (jsxs(Fragment, { children: [jsx(AvatarContainer, { children: jsxs(AvatarInner, { children: [jsx(ChainSelectorContainer, { children: jsx(ChainSelector, {}) }), jsx(Avatar, { address: address })] }) }), jsx(ModalH1, { children: jsx(CopyToClipboard, { string: address, children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(address, separator) }) }), ((_d = context === null || context === void 0 ? void 0 : context.uiConfig) === null || _d === void 0 ? void 0 : _d.hideBalance) ? null : (jsx(ModalBody, { children: jsx(BalanceContainer, { children: jsxs(AnimatePresence, { exitBeforeEnter: true, initial: false, children: [balance && (jsxs(Balance$1, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [nFormatter(Number(balance === null || balance === void 0 ? void 0 : balance.formatted)), ` `, balance === null || balance === void 0 ? void 0 : balance.symbol] }, `chain-${chain === null || chain === void 0 ? void 0 : chain.id}`)), !balance && (jsx(LoadingBalance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: "\u00A0" }))] }) }) }))] })) : (jsx(Button, { onClick: () => context.setRoute(routes.CONNECTORS), icon: jsx(Unsupported$1, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "130", height: "120", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) }), children: "Connect wallet" })), jsx(LinkedProviders, {})] }), !isSafeConnector(connector === null || connector === void 0 ? void 0 : connector.id) && (jsx(Button, { onClick: () => setShouldDisconnect(true), icon: jsx(DisconnectIcon, {}), children: locales.disconnect })), jsx(PoweredByFooter, {})] }));
|
|
9653
|
-
};
|
|
9654
|
-
|
|
9655
|
-
const SwitchNetworks = () => {
|
|
9656
|
-
const { reset } = useConnect$1();
|
|
9657
|
-
const { disconnect } = useDisconnect();
|
|
9658
|
-
const { connector, chain } = useAccount();
|
|
9659
|
-
const isChainSupported = useChainIsSupported(chain === null || chain === void 0 ? void 0 : chain.id);
|
|
9660
|
-
const locales = useLocales({});
|
|
9661
|
-
const onDisconnect = () => {
|
|
9662
|
-
disconnect();
|
|
9663
|
-
reset();
|
|
9664
|
-
};
|
|
9665
|
-
return (jsx(PageContent, { style: { width: 278 }, children: jsxs(ModalContent, { style: { padding: 0, marginTop: -10 }, children: [!isChainSupported && (jsxs(ModalBody, { children: [locales.warnings_chainUnsupported, ' ', locales.warnings_chainUnsupportedResolve] })), jsx("div", { style: { padding: '6px 8px' }, children: jsx(ChainSelectList, { variant: "secondary" }) }), !isChainSupported && !isSafeConnector(connector === null || connector === void 0 ? void 0 : connector.id) && (jsxs("div", { style: { paddingTop: 12 }, children: [jsx(OrDivider, {}), jsx(Button, { icon: jsx(DisconnectIcon, {}), variant: "secondary", onClick: onDisconnect, children: locales.disconnect })] }))] }) }));
|
|
9666
|
-
};
|
|
9667
|
-
|
|
9668
|
-
const Content = styled(motion.div) `
|
|
9669
|
-
display: flex;
|
|
9670
|
-
flex-direction: column;
|
|
9671
|
-
gap: 6px;
|
|
9672
|
-
position: relative;
|
|
9673
|
-
left: 0;
|
|
9674
|
-
right: 0;
|
|
9675
|
-
${ModalContent} {
|
|
9676
|
-
padding: 0 8px 32px;
|
|
9677
|
-
gap: 12px;
|
|
9678
|
-
}
|
|
9679
|
-
`;
|
|
9680
|
-
const dist$1 = 2;
|
|
9681
|
-
const shakeKeyframes$1 = keyframes `
|
|
9682
|
-
0%{ transform:none; }
|
|
9683
|
-
25%{ transform:translateX(${dist$1}px); }
|
|
9684
|
-
50%{ transform:translateX(-${dist$1}px); }
|
|
9685
|
-
75%{ transform:translateX(${dist$1}px); }
|
|
9686
|
-
100%{ transform:none; }
|
|
9687
|
-
`;
|
|
9688
|
-
const outlineKeyframes$1 = keyframes `
|
|
9689
|
-
0%{ opacity:1; }
|
|
9690
|
-
100%{ opacity:0; }
|
|
9691
|
-
`;
|
|
9692
|
-
const Container$3 = styled(motion.div) `
|
|
9693
|
-
/*
|
|
9694
|
-
background: var(
|
|
9695
|
-
--ck-body-background
|
|
9696
|
-
); // To stop the overlay issue during transition for the squircle spinner
|
|
9697
|
-
*/
|
|
9698
|
-
`;
|
|
9699
|
-
const ConnectingContainer$1 = styled(motion.div) `
|
|
9700
|
-
display: flex;
|
|
9701
|
-
align-items: center;
|
|
9702
|
-
justify-content: center;
|
|
9703
|
-
margin: 10px auto 16px;
|
|
9704
|
-
height: 120px;
|
|
9705
|
-
//transform: scale(1.001); // fixes shifting issue between states
|
|
9706
|
-
`;
|
|
9707
|
-
const ConnectingAnimation$1 = styled(motion.div) `
|
|
9708
|
-
user-select: none;
|
|
9709
|
-
position: relative;
|
|
9710
|
-
--spinner-error-opacity: 0;
|
|
9711
|
-
&:before {
|
|
9712
|
-
content: '';
|
|
9713
|
-
position: absolute;
|
|
9714
|
-
inset: 1px;
|
|
9715
|
-
opacity: 0;
|
|
9716
|
-
background: var(--ck-body-color-danger);
|
|
9717
|
-
${(props) => props.$circle &&
|
|
9718
|
-
css `
|
|
9719
|
-
inset: -5px;
|
|
9720
|
-
border-radius: 50%;
|
|
9721
|
-
background: none;
|
|
9722
|
-
box-shadow: inset 0 0 0 3.5px var(--ck-body-color-danger);
|
|
9723
|
-
`}
|
|
9724
|
-
}
|
|
9725
|
-
${(props) => props.$shake &&
|
|
9726
|
-
css `
|
|
9727
|
-
animation: ${shakeKeyframes$1} 220ms ease-out both;
|
|
9728
|
-
&:before {
|
|
9729
|
-
animation: ${outlineKeyframes$1} 220ms ease-out 750ms both;
|
|
9730
|
-
}
|
|
9731
|
-
`}
|
|
9732
|
-
`;
|
|
9733
|
-
const RetryButton = styled(motion.button) `
|
|
9734
|
-
z-index: 5;
|
|
9735
|
-
appearance: none;
|
|
9736
|
-
position: absolute;
|
|
9737
|
-
right: 10px;
|
|
9738
|
-
bottom: 10px;
|
|
9739
|
-
padding: 0;
|
|
9740
|
-
display: flex;
|
|
9741
|
-
align-items: center;
|
|
9742
|
-
justify-content: center;
|
|
9743
|
-
width: 32px;
|
|
9744
|
-
height: 32px;
|
|
9745
|
-
border-radius: 16px;
|
|
9746
|
-
cursor: pointer;
|
|
9747
|
-
overflow: hidden;
|
|
9748
|
-
background: none;
|
|
9749
|
-
|
|
9750
|
-
color: var(--ck-body-background-secondary);
|
|
9751
|
-
transition: color 200ms ease;
|
|
9752
|
-
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
|
|
9753
|
-
|
|
9754
|
-
&:before {
|
|
9755
|
-
z-index: 3;
|
|
9756
|
-
content: '';
|
|
9757
|
-
position: absolute;
|
|
9758
|
-
inset: 0;
|
|
9759
|
-
opacity: 0;
|
|
9760
|
-
transition: opacity 200ms ease;
|
|
9761
|
-
background: var(--ck-body-color);
|
|
9762
|
-
}
|
|
9763
|
-
|
|
9764
|
-
&:hover:before {
|
|
9765
|
-
opacity: 0.1;
|
|
9766
|
-
}
|
|
9767
|
-
`;
|
|
9768
|
-
const RetryIconContainer = styled(motion.div) `
|
|
9769
|
-
position: absolute;
|
|
9770
|
-
inset: 0;
|
|
9771
|
-
|
|
9772
|
-
&:before {
|
|
9773
|
-
z-index: 1;
|
|
9774
|
-
content: '';
|
|
9775
|
-
position: absolute;
|
|
9776
|
-
inset: 3px;
|
|
9777
|
-
border-radius: 16px;
|
|
9778
|
-
background: conic-gradient(
|
|
9779
|
-
from 90deg,
|
|
9780
|
-
currentColor 10%,
|
|
9781
|
-
var(--ck-body-color) 80%
|
|
9782
|
-
);
|
|
9783
|
-
}
|
|
9784
|
-
|
|
9785
|
-
svg {
|
|
9786
|
-
z-index: 2;
|
|
9787
|
-
display: block;
|
|
9788
|
-
position: relative;
|
|
9789
|
-
width: 100%;
|
|
9790
|
-
height: 100%;
|
|
9791
|
-
}
|
|
9792
|
-
`;
|
|
9793
|
-
|
|
9794
|
-
const LogoContainer$1 = styled(motion.div) `
|
|
9795
|
-
z-index: 4;
|
|
9796
|
-
position: relative;
|
|
9797
|
-
overflow: hidden;
|
|
9798
|
-
svg {
|
|
9799
|
-
z-index: 3;
|
|
9800
|
-
position: relative;
|
|
9801
|
-
display: block;
|
|
9802
|
-
}
|
|
9803
|
-
`;
|
|
9804
|
-
const Logo$1 = styled(motion.div) `
|
|
9805
|
-
z-index: 2;
|
|
9806
|
-
position: absolute;
|
|
9638
|
+
width: 100%;
|
|
9807
9639
|
overflow: hidden;
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9640
|
+
white-space: nowrap;
|
|
9641
|
+
text-overflow: ellipsis;
|
|
9642
|
+
padding: 2px 0;
|
|
9643
|
+
`;
|
|
9644
|
+
const ProviderIcon$1 = styled.div `
|
|
9645
|
+
width: 32px;
|
|
9646
|
+
height: 32px;
|
|
9811
9647
|
svg,
|
|
9812
9648
|
img {
|
|
9813
|
-
pointer-events: none;
|
|
9814
9649
|
display: block;
|
|
9650
|
+
position: relative;
|
|
9651
|
+
pointer-events: none;
|
|
9652
|
+
overflow: hidden;
|
|
9815
9653
|
width: 100%;
|
|
9816
9654
|
height: 100%;
|
|
9817
9655
|
}
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
inset: 1px;
|
|
9822
|
-
overflow: hidden;
|
|
9823
|
-
`;
|
|
9824
|
-
const Spinner$1 = styled(motion.div) `
|
|
9825
|
-
pointer-events: none;
|
|
9826
|
-
user-select: none;
|
|
9827
|
-
z-index: 1;
|
|
9828
|
-
position: absolute;
|
|
9829
|
-
inset: -25%;
|
|
9830
|
-
&:before {
|
|
9831
|
-
content: '';
|
|
9832
|
-
position: absolute;
|
|
9833
|
-
inset: 0;
|
|
9834
|
-
background: conic-gradient(
|
|
9835
|
-
from -90deg,
|
|
9836
|
-
transparent,
|
|
9837
|
-
transparent,
|
|
9838
|
-
transparent,
|
|
9839
|
-
transparent,
|
|
9840
|
-
transparent,
|
|
9841
|
-
var(--ck-spinner-color)
|
|
9842
|
-
);
|
|
9843
|
-
animation: rotateSpinner 1200ms linear infinite;
|
|
9656
|
+
|
|
9657
|
+
&[data-shape='squircle'] {
|
|
9658
|
+
border-radius: 22.5%;
|
|
9844
9659
|
}
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
transform: rotate(360deg);
|
|
9851
|
-
}
|
|
9660
|
+
&[data-shape='circle'] {
|
|
9661
|
+
border-radius: 100%;
|
|
9662
|
+
}
|
|
9663
|
+
&[data-shape='square'] {
|
|
9664
|
+
border-radius: 0;
|
|
9852
9665
|
}
|
|
9853
9666
|
`;
|
|
9854
9667
|
|
|
9855
|
-
const
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9668
|
+
const WalletIcon = ({ provider }) => {
|
|
9669
|
+
var _a;
|
|
9670
|
+
if (provider.walletClientType === "walletconnect")
|
|
9671
|
+
return jsx(Logos.WalletConnect, {});
|
|
9672
|
+
const wallets = useWallets$1();
|
|
9673
|
+
const wallet = useMemo(() => {
|
|
9674
|
+
return wallets.find(w => { var _a; return ((_a = w.id) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === provider.walletClientType; });
|
|
9675
|
+
}, [provider]);
|
|
9676
|
+
if (wallet)
|
|
9677
|
+
return jsx(Fragment, { children: (_a = wallet.iconConnector) !== null && _a !== void 0 ? _a : wallet.icon });
|
|
9678
|
+
return jsx(Wallet, {});
|
|
9679
|
+
};
|
|
9680
|
+
const ProviderIcon = ({ provider }) => {
|
|
9681
|
+
switch (provider.provider) {
|
|
9682
|
+
case "email":
|
|
9683
|
+
return jsx(EmailIcon, {});
|
|
9684
|
+
case "wallet":
|
|
9685
|
+
return jsx(WalletIcon, { provider: provider });
|
|
9686
|
+
case "google":
|
|
9687
|
+
case "twitter":
|
|
9688
|
+
case "facebook":
|
|
9689
|
+
return providersLogos[provider.provider];
|
|
9690
|
+
default:
|
|
9691
|
+
return jsx(FitText, { children: provider.provider.substring(0, 4).toUpperCase() });
|
|
9692
|
+
}
|
|
9693
|
+
};
|
|
9694
|
+
const LinkedProvider = ({ provider }) => {
|
|
9695
|
+
return (jsx(LinkedProviderButton, { disabled: true, children: jsx(ProviderIcon$1, { children: jsx(ProviderIcon, { provider: provider }) }) }));
|
|
9696
|
+
};
|
|
9697
|
+
const AddLinkedProviderButton = () => {
|
|
9698
|
+
const { setRoute } = useOpenfort();
|
|
9699
|
+
const { availableProviders: unlinkedProviders } = useProviders();
|
|
9700
|
+
return (jsx(LinkedProviderButton, { disabled: unlinkedProviders.length === 0, onClick: () => setRoute(routes.PROVIDERS), children: "+" }));
|
|
9701
|
+
};
|
|
9702
|
+
const LinkedProviders = () => {
|
|
9703
|
+
const { user } = useOpenfortCore();
|
|
9704
|
+
if (!user || !user.linkedAccounts) {
|
|
9705
|
+
return (jsx("div", { children: jsx("p", { children: "No linked providers" }) }));
|
|
9706
|
+
}
|
|
9707
|
+
return (jsxs(Fragment, { children: [jsx(ProvidersHeader, { children: "Linked providers" }), jsxs(LinkedProviderContainer, { children: [user.linkedAccounts.map((provider, i) => (jsx(LinkedProvider, { provider: provider }, provider.provider + i))), jsx(AddLinkedProviderButton, {})] })] }));
|
|
9708
|
+
};
|
|
9709
|
+
|
|
9710
|
+
const Profile = ({ closeModal }) => {
|
|
9711
|
+
var _a, _b, _c, _d;
|
|
9712
|
+
const context = useOpenfort();
|
|
9713
|
+
const themeContext = useThemeContext();
|
|
9714
|
+
const locales = useLocales();
|
|
9715
|
+
const { address, isConnected, connector, chain } = useAccount();
|
|
9716
|
+
const ensFallbackConfig = useEnsFallbackConfig();
|
|
9717
|
+
const { data: ensName } = useEnsName({
|
|
9718
|
+
chainId: 1,
|
|
9719
|
+
address: address,
|
|
9720
|
+
config: ensFallbackConfig,
|
|
9721
|
+
});
|
|
9722
|
+
const { data: balance } = useBalance({
|
|
9723
|
+
address,
|
|
9724
|
+
//watch: true,
|
|
9725
|
+
});
|
|
9726
|
+
const [shouldDisconnect, setShouldDisconnect] = useState(false);
|
|
9727
|
+
const { logout } = useOpenfortCore();
|
|
9728
|
+
useEffect(() => {
|
|
9729
|
+
if (!shouldDisconnect)
|
|
9730
|
+
return;
|
|
9731
|
+
// Close before disconnecting to avoid layout shifting while modal is still open
|
|
9732
|
+
if (closeModal) {
|
|
9733
|
+
closeModal();
|
|
9734
|
+
}
|
|
9735
|
+
else {
|
|
9736
|
+
context.setOpen(false);
|
|
9737
|
+
}
|
|
9738
|
+
return () => {
|
|
9739
|
+
logout();
|
|
9740
|
+
};
|
|
9741
|
+
}, [shouldDisconnect, logout]);
|
|
9742
|
+
const separator = ['web95', 'rounded', 'minimal'].includes((_c = (_a = themeContext.theme) !== null && _a !== void 0 ? _a : (_b = context.uiConfig) === null || _b === void 0 ? void 0 : _b.theme) !== null && _c !== void 0 ? _c : '')
|
|
9743
|
+
? '....'
|
|
9744
|
+
: undefined;
|
|
9745
|
+
return (jsxs(PageContent, { children: [jsxs(ModalContent, { style: { paddingBottom: 22, gap: 6 }, children: [address ? (jsxs(Fragment, { children: [jsx(AvatarContainer, { children: jsxs(AvatarInner, { children: [jsx(ChainSelectorContainer, { children: jsx(ChainSelector, {}) }), jsx(Avatar, { address: address })] }) }), jsx(ModalH1, { children: jsx(CopyToClipboard, { string: address, children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(address, separator) }) }), ((_d = context === null || context === void 0 ? void 0 : context.uiConfig) === null || _d === void 0 ? void 0 : _d.hideBalance) ? null : (jsx(ModalBody, { children: jsx(BalanceContainer, { children: jsxs(AnimatePresence, { exitBeforeEnter: true, initial: false, children: [balance && (jsxs(Balance$1, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [nFormatter(Number(balance === null || balance === void 0 ? void 0 : balance.formatted)), ` `, balance === null || balance === void 0 ? void 0 : balance.symbol] }, `chain-${chain === null || chain === void 0 ? void 0 : chain.id}`)), !balance && (jsx(LoadingBalance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: "\u00A0" }))] }) }) }))] })) : (jsx(Button, { onClick: () => context.setRoute(routes.CONNECTORS), icon: jsx(Unsupported$1, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "130", height: "120", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) }), children: "Connect wallet" })), jsx(LinkedProviders, {})] }), !isSafeConnector(connector === null || connector === void 0 ? void 0 : connector.id) && (jsx(Button, { onClick: () => setShouldDisconnect(true), icon: jsx(DisconnectIcon, {}), children: locales.disconnect })), jsx(PoweredByFooter, {})] }));
|
|
9746
|
+
};
|
|
9747
|
+
|
|
9748
|
+
const SwitchNetworks = () => {
|
|
9749
|
+
const { reset } = useConnect$1();
|
|
9750
|
+
const { disconnect } = useDisconnect();
|
|
9751
|
+
const { connector, chain } = useAccount();
|
|
9752
|
+
const isChainSupported = useChainIsSupported(chain === null || chain === void 0 ? void 0 : chain.id);
|
|
9753
|
+
const locales = useLocales({});
|
|
9754
|
+
const onDisconnect = () => {
|
|
9755
|
+
disconnect();
|
|
9756
|
+
reset();
|
|
9757
|
+
};
|
|
9758
|
+
return (jsx(PageContent, { style: { width: 278 }, children: jsxs(ModalContent, { style: { padding: 0, marginTop: -10 }, children: [!isChainSupported && (jsxs(ModalBody, { children: [locales.warnings_chainUnsupported, ' ', locales.warnings_chainUnsupportedResolve] })), jsx("div", { style: { padding: '6px 8px' }, children: jsx(ChainSelectList, { variant: "secondary" }) }), !isChainSupported && !isSafeConnector(connector === null || connector === void 0 ? void 0 : connector.id) && (jsxs("div", { style: { paddingTop: 12 }, children: [jsx(OrDivider, {}), jsx(Button, { icon: jsx(DisconnectIcon, {}), variant: "secondary", onClick: onDisconnect, children: locales.disconnect })] }))] }) }));
|
|
9862
9759
|
};
|
|
9863
9760
|
|
|
9864
9761
|
const BrowserIconContainer = styled(motion.div) `
|
|
@@ -10042,19 +9939,25 @@ const createSIWEMessage = (address, nonce, chainId) => createSiweMessage({
|
|
|
10042
9939
|
function useConnectWithSiwe() {
|
|
10043
9940
|
const { client, user, updateUser } = useOpenfortCore();
|
|
10044
9941
|
const { log } = useOpenfort();
|
|
10045
|
-
const { address, connector } = useAccount();
|
|
9942
|
+
const { address, connector, chainId: accountChainId } = useAccount();
|
|
10046
9943
|
const chainId = useChainId();
|
|
10047
9944
|
const config = useConfig();
|
|
10048
|
-
|
|
10049
|
-
const connectWithSiwe = useCallback(async ({ onError, onConnect, } = {}) => {
|
|
10050
|
-
|
|
10051
|
-
const
|
|
9945
|
+
const publicClient = usePublicClient();
|
|
9946
|
+
const connectWithSiwe = useCallback(async ({ onError, onConnect, connectorType: propsConnectorType, walletClientType: propsWalletClientType, } = {}) => {
|
|
9947
|
+
var _a, _b;
|
|
9948
|
+
const connectorType = propsConnectorType !== null && propsConnectorType !== void 0 ? propsConnectorType : connector === null || connector === void 0 ? void 0 : connector.type;
|
|
9949
|
+
const walletClientType = propsWalletClientType !== null && propsWalletClientType !== void 0 ? propsWalletClientType : connector === null || connector === void 0 ? void 0 : connector.id;
|
|
10052
9950
|
if (!address || !connectorType || !walletClientType) {
|
|
10053
9951
|
log("No address found", { address, connectorType, walletClientType });
|
|
10054
9952
|
onError && onError("No address found");
|
|
10055
9953
|
return;
|
|
10056
9954
|
}
|
|
10057
9955
|
try {
|
|
9956
|
+
if (accountChainId !== chainId) {
|
|
9957
|
+
switchChain(config, {
|
|
9958
|
+
chainId,
|
|
9959
|
+
});
|
|
9960
|
+
}
|
|
10058
9961
|
const { nonce } = await client.auth.initSIWE({ address });
|
|
10059
9962
|
const SIWEMessage = createSIWEMessage(address, nonce, chainId);
|
|
10060
9963
|
const signature = await signMessage(config, { message: SIWEMessage });
|
|
@@ -10093,7 +9996,7 @@ function useConnectWithSiwe() {
|
|
|
10093
9996
|
message = "Invalid signature. Please try again.";
|
|
10094
9997
|
}
|
|
10095
9998
|
else if (message.includes("An error occurred when attempting to switch chain")) {
|
|
10096
|
-
message =
|
|
9999
|
+
message = `Failed to switch chain. Please switch your wallet to ${(_b = (_a = publicClient === null || publicClient === void 0 ? void 0 : publicClient.chain) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "the correct network"} and try again.`;
|
|
10097
10000
|
}
|
|
10098
10001
|
else {
|
|
10099
10002
|
message = "Failed to connect with SIWE.";
|
|
@@ -10305,14 +10208,14 @@ const ConnectWithInjector = ({ switchConnectMethod, forceState }) => {
|
|
|
10305
10208
|
}, [status, expiryTimer]);
|
|
10306
10209
|
*/
|
|
10307
10210
|
if (!wallet) {
|
|
10308
|
-
return (jsx(PageContent, { children: jsxs(Container$
|
|
10211
|
+
return (jsx(PageContent, { children: jsxs(Container$7, { children: [jsx(ModalHeading, { children: "Invalid State" }), jsx(ModalContent, { children: jsx(Alert, { children: "No connectors match the id given. This state should never happen." }) })] }) }));
|
|
10309
10212
|
}
|
|
10310
10213
|
// OLD_TODO: Make this more generic
|
|
10311
10214
|
if (isWalletConnectConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector.id)) {
|
|
10312
|
-
return (jsx(PageContent, { children: jsxs(Container$
|
|
10215
|
+
return (jsx(PageContent, { children: jsxs(Container$7, { children: [jsx(ModalHeading, { children: "Invalid State" }), jsx(ModalContent, { children: jsx(Alert, { children: "WalletConnect does not have an injection flow. This state should never happen." }) })] }) }));
|
|
10313
10216
|
}
|
|
10314
10217
|
const hasError = status === states$3.FAILED || status === states$3.REJECTED || status === states$3.DUPLICATED;
|
|
10315
|
-
return (jsx(PageContent, { children: jsxs(Container$
|
|
10218
|
+
return (jsx(PageContent, { children: jsxs(Container$7, { children: [jsx(ConnectingContainer$1, { children: jsxs(ConnectingAnimation$1, { "$shake": hasError, "$circle": walletInfo.iconShape === 'circle', children: [jsx(AnimatePresence, { children: (hasError) && (jsx(RetryButton, { "aria-label": "Retry", initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, whileTap: { scale: 0.9 }, transition: { duration: 0.1 }, onClick: runConnect, children: jsx(RetryIconContainer, { children: jsx(Tooltip, { open: showTryAgainTooltip &&
|
|
10316
10219
|
(hasError), message: locales.tryAgainQuestion, xOffset: -6, children: jsx(RetryIconCircle, {}) }) }) })) }), walletInfo.iconShape === 'circle' ? (jsx(CircleSpinner, { logo: status === states$3.UNAVAILABLE ? (jsx("div", { style: {
|
|
10317
10220
|
transform: 'scale(1.14)',
|
|
10318
10221
|
position: 'relative',
|
|
@@ -10448,86 +10351,6 @@ const ConnectWithQRCode = ({ switchConnectMethod }) => {
|
|
|
10448
10351
|
download: true, children: locales.getWalletName }) }))] }));
|
|
10449
10352
|
};
|
|
10450
10353
|
|
|
10451
|
-
const LoadingTextWrapper = styled.div `
|
|
10452
|
-
display: flex;
|
|
10453
|
-
justify-content: center;
|
|
10454
|
-
align-items: center;
|
|
10455
|
-
flex-direction: column;
|
|
10456
|
-
gap: 12px;
|
|
10457
|
-
padding: 0 8px 16px;
|
|
10458
|
-
text-align: center;
|
|
10459
|
-
`;
|
|
10460
|
-
const ConnectingContainer = styled(motion.div) `
|
|
10461
|
-
display: flex;
|
|
10462
|
-
align-items: center;
|
|
10463
|
-
justify-content: center;
|
|
10464
|
-
margin: 10px auto 16px;
|
|
10465
|
-
height: 120px;
|
|
10466
|
-
`;
|
|
10467
|
-
const dist = 2;
|
|
10468
|
-
const shakeKeyframes = keyframes `
|
|
10469
|
-
0%{ transform:none; }
|
|
10470
|
-
25%{ transform:translateX(${dist}px); }
|
|
10471
|
-
50%{ transform:translateX(-${dist}px); }
|
|
10472
|
-
75%{ transform:translateX(${dist}px); }
|
|
10473
|
-
100%{ transform:none; }
|
|
10474
|
-
`;
|
|
10475
|
-
const outlineKeyframes = keyframes `
|
|
10476
|
-
0%{ opacity:0; }
|
|
10477
|
-
100%{ opacity:1; }
|
|
10478
|
-
`;
|
|
10479
|
-
const ConnectingAnimation = styled(motion.div) `
|
|
10480
|
-
position: relative;
|
|
10481
|
-
user-select: none;
|
|
10482
|
-
position: relative;
|
|
10483
|
-
--spinner-error-opacity: 0;
|
|
10484
|
-
&:before {
|
|
10485
|
-
content: '';
|
|
10486
|
-
position: absolute;
|
|
10487
|
-
inset: 1px;
|
|
10488
|
-
opacity: 0;
|
|
10489
|
-
background: ${(props) => props.$color};
|
|
10490
|
-
}
|
|
10491
|
-
${(props) => !!props.$color &&
|
|
10492
|
-
css `
|
|
10493
|
-
&:before {
|
|
10494
|
-
opacity: 1;
|
|
10495
|
-
}
|
|
10496
|
-
`}
|
|
10497
|
-
${(props) => props.$shake &&
|
|
10498
|
-
css `
|
|
10499
|
-
animation: ${shakeKeyframes} 220ms ease-out both;
|
|
10500
|
-
&:before {
|
|
10501
|
-
animation: ${outlineKeyframes} 220ms ease-out both;
|
|
10502
|
-
}
|
|
10503
|
-
`}
|
|
10504
|
-
`;
|
|
10505
|
-
const Loader = ({ header, description, icon, isError = false, isSuccess = false, isLoading = !isError && !isSuccess, onRetry, }) => {
|
|
10506
|
-
const { uiConfig: options } = useOpenfort();
|
|
10507
|
-
const { triggerResize } = useOpenfort();
|
|
10508
|
-
const locales = useLocales();
|
|
10509
|
-
useEffect(() => {
|
|
10510
|
-
return () => triggerResize();
|
|
10511
|
-
}, []);
|
|
10512
|
-
const renderLogo = () => {
|
|
10513
|
-
if (icon) {
|
|
10514
|
-
return icon;
|
|
10515
|
-
}
|
|
10516
|
-
if (options === null || options === void 0 ? void 0 : options.logo) {
|
|
10517
|
-
if (typeof options.logo === 'string') {
|
|
10518
|
-
return jsx("img", { src: options.logo, alt: "Logo", style: { width: '100%' } });
|
|
10519
|
-
}
|
|
10520
|
-
return options.logo;
|
|
10521
|
-
}
|
|
10522
|
-
return jsx(Logos.Openfort, {});
|
|
10523
|
-
};
|
|
10524
|
-
return (jsxs(Fragment, { children: [jsx(ConnectingContainer, { children: jsxs(ConnectingAnimation, { "$color": isSuccess ? 'var(--ck-body-color-valid)' : isError ? 'var(--ck-body-color-danger)' : undefined, "$shake": isError, children: [jsx(AnimatePresence, { children: (isError && onRetry) && (jsx(RetryButton, { "aria-label": "Retry", initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, whileTap: { scale: 0.9 }, transition: { duration: 0.1 }, onClick: onRetry, children: jsx(RetryIconContainer, { children: jsx(Tooltip, { open: isError, message: locales.tryAgainQuestion, xOffset: -6, children: jsx(RetryIconCircle, {}) }) }) })) }), jsx(SquircleSpinner, { logo: jsx("div", { style: {
|
|
10525
|
-
padding: '12px',
|
|
10526
|
-
position: 'relative',
|
|
10527
|
-
width: '100%',
|
|
10528
|
-
}, children: renderLogo() }), connecting: isLoading })] }) }), jsxs(LoadingTextWrapper, { children: [isLoading && (jsxs(Fragment, { children: [jsx(ModalH1, { children: "Loading, please wait" }), jsx(ModalBody, { children: description !== null && description !== void 0 ? description : header })] })), isSuccess && (jsxs(Fragment, { children: [jsxs(ModalH1, { "$valid": true, children: [jsx(TickIcon, {}), " ", header] }), jsx(ModalBody, { children: description })] })), isError && (jsxs(Fragment, { children: [jsx(ModalH1, { "$error": true, children: header }), jsx(ModalBody, { children: description })] }))] })] }));
|
|
10529
|
-
};
|
|
10530
|
-
|
|
10531
10354
|
const states$2 = {
|
|
10532
10355
|
INIT: "init",
|
|
10533
10356
|
REDIRECT: "redirect",
|
|
@@ -10896,15 +10719,30 @@ const onError = ({ hookOptions, options, error, }) => {
|
|
|
10896
10719
|
function useUser() {
|
|
10897
10720
|
const { user, client, embeddedState } = useOpenfortCore();
|
|
10898
10721
|
const getAccessTokenAndUpdate = useCallback(async () => {
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10722
|
+
try {
|
|
10723
|
+
await client.validateAndRefreshToken();
|
|
10724
|
+
const token = await client.getAccessToken();
|
|
10725
|
+
return token;
|
|
10726
|
+
}
|
|
10727
|
+
catch (error) {
|
|
10728
|
+
handleOAuthConfigError(error);
|
|
10729
|
+
throw error;
|
|
10730
|
+
}
|
|
10731
|
+
}, [client]);
|
|
10732
|
+
const validateAndRefresh = useCallback(async () => {
|
|
10733
|
+
try {
|
|
10734
|
+
await client.validateAndRefreshToken();
|
|
10735
|
+
}
|
|
10736
|
+
catch (error) {
|
|
10737
|
+
handleOAuthConfigError(error);
|
|
10738
|
+
throw error;
|
|
10739
|
+
}
|
|
10902
10740
|
}, [client]);
|
|
10903
10741
|
return {
|
|
10904
10742
|
user,
|
|
10905
10743
|
isAuthenticated: embeddedState !== EmbeddedState.NONE && embeddedState !== EmbeddedState.UNAUTHENTICATED,
|
|
10906
10744
|
getAccessToken: getAccessTokenAndUpdate,
|
|
10907
|
-
validateAndRefreshToken:
|
|
10745
|
+
validateAndRefreshToken: validateAndRefresh,
|
|
10908
10746
|
};
|
|
10909
10747
|
}
|
|
10910
10748
|
|
|
@@ -11262,7 +11100,7 @@ function useWallets(hookOptions = {}) {
|
|
|
11262
11100
|
}
|
|
11263
11101
|
}
|
|
11264
11102
|
else {
|
|
11265
|
-
|
|
11103
|
+
accountToRecover = embeddedAccounts.find((w) => w.chainId === chainId);
|
|
11266
11104
|
if (!accountToRecover) {
|
|
11267
11105
|
// Here it should check if there is a wallet that can recover in another chain and recover it in the current chain (its a different account so its not supported yet)
|
|
11268
11106
|
// TODO: Connect to wallet in the other chain and then switch chain
|
|
@@ -12099,7 +11937,7 @@ const EmailLogin = () => {
|
|
|
12099
11937
|
};
|
|
12100
11938
|
|
|
12101
11939
|
const LogoGraphic = ({ size = "100%", logo }) => {
|
|
12102
|
-
return (jsx(Logo$
|
|
11940
|
+
return (jsx(Logo$1, { children: jsx(LogoPosition, { children: jsx(LogoInner, { children: jsx(FloatWrapper, { children: jsx(RotateWrapper, { children: jsx(LogoGraphic$1, { style: { transform: `scale(${size})` }, children: logo }) }) }) }) }) }));
|
|
12103
11941
|
};
|
|
12104
11942
|
const FloatingGraphic = ({ height = "130px", logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft }) => {
|
|
12105
11943
|
return (jsxs(Graphic, { "$height": height, children: [jsxs(LogoGroup, { children: [jsx(LogoGraphic, { ...logoCenter }), logoTopLeft ? jsx(LogoGraphic, { ...logoTopLeft }) : jsx("div", {}), logoTopRight ? jsx(LogoGraphic, { ...logoTopRight }) : jsx("div", {}), logoBottomLeft ? jsx(LogoGraphic, { ...logoBottomLeft }) : jsx("div", {}), logoBottomRight ? jsx(LogoGraphic, { ...logoBottomRight }) : jsx("div", {})] }), jsx(GraphicBackground, { children: wave })] }));
|
|
@@ -13160,19 +12998,25 @@ const DownloadFooter = styled.div `
|
|
|
13160
12998
|
`;
|
|
13161
12999
|
const ConnectWithMobile = ({}) => {
|
|
13162
13000
|
var _a, _b, _c;
|
|
13163
|
-
const { connector, setRoute } = useOpenfort();
|
|
13164
|
-
const
|
|
13165
|
-
|
|
13001
|
+
const { connector, setRoute, log } = useOpenfort();
|
|
13002
|
+
const walletId = Object.keys(walletConfigs).find(
|
|
13003
|
+
// where id is comma seperated list
|
|
13004
|
+
(id) => id
|
|
13005
|
+
.split(',')
|
|
13006
|
+
.map((i) => i.trim())
|
|
13007
|
+
.indexOf(connector.id) !== -1);
|
|
13008
|
+
const wallet = useWallet(connector.id) || (walletId && walletConfigs[walletId]) || {};
|
|
13009
|
+
const { isConnected } = useAccount();
|
|
13010
|
+
const [status, setStatus] = useState(isConnected ? states.INIT : states.CONNECTING);
|
|
13166
13011
|
const [description, setDescription] = useState(undefined);
|
|
13167
13012
|
const { connect: { getUri }, } = useWeb3();
|
|
13168
13013
|
const wcUri = getUri();
|
|
13169
13014
|
const [hasReturned, setHasReturned] = useState(false);
|
|
13170
|
-
const { isConnected } = useAccount();
|
|
13171
|
-
const [shouldRedirectToWalletApp, setShouldRedirectToWalletApp] = useState(false);
|
|
13172
13015
|
const siwe = useConnectWithSiwe();
|
|
13173
13016
|
const openApp = (url) => {
|
|
13174
13017
|
var _a;
|
|
13175
13018
|
const uri = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.getWalletConnectDeeplink) === null || _a === void 0 ? void 0 : _a.call(wallet, url !== null && url !== void 0 ? url : "");
|
|
13019
|
+
log("Opening wallet app with uri", { uri, url, wallet, walletId, walletConfigs, connectorId: connector.id });
|
|
13176
13020
|
if (uri) {
|
|
13177
13021
|
if (url) {
|
|
13178
13022
|
window.location.href = uri;
|
|
@@ -13209,8 +13053,9 @@ const ConnectWithMobile = ({}) => {
|
|
|
13209
13053
|
openApp(wcUri);
|
|
13210
13054
|
break;
|
|
13211
13055
|
case states.CONNECTING:
|
|
13212
|
-
setDescription("Requesting signature...");
|
|
13056
|
+
setDescription("Requesting signature to verify wallet...");
|
|
13213
13057
|
siwe({
|
|
13058
|
+
walletClientType: walletId,
|
|
13214
13059
|
onConnect: () => {
|
|
13215
13060
|
setRoute(routes.PROFILE);
|
|
13216
13061
|
},
|
|
@@ -13219,23 +13064,11 @@ const ConnectWithMobile = ({}) => {
|
|
|
13219
13064
|
setDescription(error || "Connection failed");
|
|
13220
13065
|
}
|
|
13221
13066
|
});
|
|
13222
|
-
setTimeout(() => {
|
|
13223
|
-
setShouldRedirectToWalletApp(true);
|
|
13224
|
-
}, 1500);
|
|
13225
13067
|
break;
|
|
13226
13068
|
}
|
|
13227
13069
|
}, [status]);
|
|
13228
|
-
useEffect(() => {
|
|
13229
|
-
if (shouldRedirectToWalletApp && status === states.CONNECTING) {
|
|
13230
|
-
openApp();
|
|
13231
|
-
}
|
|
13232
|
-
}, [shouldRedirectToWalletApp, status]);
|
|
13233
13070
|
return (jsxs(PageContent, { children: [jsx(Loader, { header: `Connecting with ${connector.id.split(",")[0]}`, icon: wallet === null || wallet === void 0 ? void 0 : wallet.icon, isError: status === states.ERROR, description: description, onRetry: () => {
|
|
13234
|
-
|
|
13235
|
-
setStatus(states.CONNECTING);
|
|
13236
|
-
return;
|
|
13237
|
-
}
|
|
13238
|
-
setStatus(states.INIT);
|
|
13071
|
+
setStatus(isConnected ? states.CONNECTING : states.INIT);
|
|
13239
13072
|
setDescription("");
|
|
13240
13073
|
} }), isConnected ? (jsx(Button, { onClick: () => {
|
|
13241
13074
|
openApp();
|