@openfort/react 0.0.26 → 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 +655 -879
- package/build/index.es.js.map +1 -1
- 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, {}),
|
|
@@ -5988,269 +5988,6 @@ const About = () => {
|
|
|
5988
5988
|
} }, i))) }) }), jsx(Button, { href: ctaUrl, arrow: true, children: locales.aboutScreen_ctaText })] }));
|
|
5989
5989
|
};
|
|
5990
5990
|
|
|
5991
|
-
const Shimmer$1 = keyframes `
|
|
5992
|
-
0%{ transform: translate(-100%) rotate(-45deg); }
|
|
5993
|
-
100%{ transform: translate(100%) rotate(-80deg); }
|
|
5994
|
-
`;
|
|
5995
|
-
styled(motion.div) `
|
|
5996
|
-
display: flex;
|
|
5997
|
-
flex-direction: column;
|
|
5998
|
-
gap: 12px;
|
|
5999
|
-
`;
|
|
6000
|
-
const InfoBox = styled.div `
|
|
6001
|
-
padding: 24px 24px 28px;
|
|
6002
|
-
border-radius: var(--ck-tertiary-border-radius, 24px);
|
|
6003
|
-
box-shadow: var(--ck-tertiary-box-shadow, none);
|
|
6004
|
-
background: var(--ck-body-background-tertiary);
|
|
6005
|
-
${ModalBody} {
|
|
6006
|
-
max-width: none;
|
|
6007
|
-
}
|
|
6008
|
-
`;
|
|
6009
|
-
const InfoBoxButtons = styled.div `
|
|
6010
|
-
display: grid;
|
|
6011
|
-
grid-template-columns: 1fr 1fr;
|
|
6012
|
-
gap: 16px;
|
|
6013
|
-
margin: 5px -8px -12px;
|
|
6014
|
-
button {
|
|
6015
|
-
}
|
|
6016
|
-
`;
|
|
6017
|
-
styled(motion.div) `
|
|
6018
|
-
text-align: center;
|
|
6019
|
-
margin-top: 16px;
|
|
6020
|
-
margin-bottom: -6px;
|
|
6021
|
-
`;
|
|
6022
|
-
styled(motion.button) `
|
|
6023
|
-
appearance: none;
|
|
6024
|
-
user-select: none;
|
|
6025
|
-
cursor: pointer;
|
|
6026
|
-
display: inline-flex;
|
|
6027
|
-
align-items: center;
|
|
6028
|
-
justify-content: center;
|
|
6029
|
-
gap: 10px;
|
|
6030
|
-
height: 42px;
|
|
6031
|
-
padding: 0 16px;
|
|
6032
|
-
border-radius: 6px;
|
|
6033
|
-
background: none;
|
|
6034
|
-
color: var(--ck-body-color-muted);
|
|
6035
|
-
font-size: 15px;
|
|
6036
|
-
line-height: 18px;
|
|
6037
|
-
font-weight: 500;
|
|
6038
|
-
/* will-change: transform; */
|
|
6039
|
-
transition: color 200ms ease, transform 100ms ease;
|
|
6040
|
-
svg {
|
|
6041
|
-
transition: all 100ms ease-out;
|
|
6042
|
-
display: block;
|
|
6043
|
-
position: relative;
|
|
6044
|
-
top: 2px;
|
|
6045
|
-
left: 2px;
|
|
6046
|
-
transform: translateZ(0px);
|
|
6047
|
-
path,
|
|
6048
|
-
circle {
|
|
6049
|
-
transition: all 100ms ease-out;
|
|
6050
|
-
}
|
|
6051
|
-
path:last-of-type {
|
|
6052
|
-
transform-origin: 0 0;
|
|
6053
|
-
transform: scaleX(1.3) skewY(-12deg);
|
|
6054
|
-
opacity: 0;
|
|
6055
|
-
}
|
|
6056
|
-
circle {
|
|
6057
|
-
transform: translate(20%, -15%);
|
|
6058
|
-
}
|
|
6059
|
-
}
|
|
6060
|
-
&:hover {
|
|
6061
|
-
color: var(--ck-body-color-muted-hover);
|
|
6062
|
-
svg {
|
|
6063
|
-
path,
|
|
6064
|
-
circle {
|
|
6065
|
-
opacity: 1;
|
|
6066
|
-
transform: none;
|
|
6067
|
-
}
|
|
6068
|
-
}
|
|
6069
|
-
}
|
|
6070
|
-
&:active {
|
|
6071
|
-
transform: scale(0.96);
|
|
6072
|
-
}
|
|
6073
|
-
`;
|
|
6074
|
-
styled(motion.div) `
|
|
6075
|
-
display: flex;
|
|
6076
|
-
flex-direction: column;
|
|
6077
|
-
gap: 12px;
|
|
6078
|
-
padding: 0 0 16px;
|
|
6079
|
-
overflow-y: scroll;
|
|
6080
|
-
max-height: 20rem;
|
|
6081
|
-
|
|
6082
|
-
&::-webkit-scrollbar {
|
|
6083
|
-
display: none;
|
|
6084
|
-
}
|
|
6085
|
-
`;
|
|
6086
|
-
styled(motion.button) `
|
|
6087
|
-
cursor: pointer;
|
|
6088
|
-
user-select: none;
|
|
6089
|
-
position: relative;
|
|
6090
|
-
display: flex;
|
|
6091
|
-
align-items: center;
|
|
6092
|
-
padding: 0 20px;
|
|
6093
|
-
width: 100%;
|
|
6094
|
-
height: 64px;
|
|
6095
|
-
font-size: 17px;
|
|
6096
|
-
font-weight: var(--ck-primary-button-font-weight, 500);
|
|
6097
|
-
line-height: 20px;
|
|
6098
|
-
text-align: var(--ck-body-button-text-align, left);
|
|
6099
|
-
transition: 180ms ease;
|
|
6100
|
-
transition-property: background, color, box-shadow, transform, opacity;
|
|
6101
|
-
will-change: transform, box-shadow, background-color, color, opacity;
|
|
6102
|
-
|
|
6103
|
-
--fallback-color: var(--ck-primary-button-color);
|
|
6104
|
-
--fallback-background: var(--ck-primary-button-background);
|
|
6105
|
-
--fallback-box-shadow: var(--ck-primary-button-box-shadow);
|
|
6106
|
-
--fallback-border-radius: var(--ck-primary-button-border-radius);
|
|
6107
|
-
|
|
6108
|
-
--color: var(--ck-primary-button-color, var(--fallback-color));
|
|
6109
|
-
--background: var(--ck-primary-button-background, var(--fallback-background));
|
|
6110
|
-
--box-shadow: var(--ck-primary-button-box-shadow, var(--fallback-box-shadow));
|
|
6111
|
-
--border-radius: var(
|
|
6112
|
-
--ck-primary-button-border-radius,
|
|
6113
|
-
var(--fallback-border-radius)
|
|
6114
|
-
);
|
|
6115
|
-
|
|
6116
|
-
--hover-color: var(--ck-primary-button-hover-color, var(--color));
|
|
6117
|
-
--hover-background: var(
|
|
6118
|
-
--ck-primary-button-hover-background,
|
|
6119
|
-
var(--background)
|
|
6120
|
-
);
|
|
6121
|
-
--hover-box-shadow: var(
|
|
6122
|
-
--ck-primary-button-hover-box-shadow,
|
|
6123
|
-
var(--box-shadow)
|
|
6124
|
-
);
|
|
6125
|
-
--hover-border-radius: var(
|
|
6126
|
-
--ck-primary-button-hover-border-radius,
|
|
6127
|
-
var(--border-radius)
|
|
6128
|
-
);
|
|
6129
|
-
|
|
6130
|
-
--active-color: var(--ck-primary-button-active-color, var(--hover-color));
|
|
6131
|
-
--active-background: var(
|
|
6132
|
-
--ck-primary-button-active-background,
|
|
6133
|
-
var(--hover-background)
|
|
6134
|
-
);
|
|
6135
|
-
--active-box-shadow: var(
|
|
6136
|
-
--ck-primary-button-active-box-shadow,
|
|
6137
|
-
var(--hover-box-shadow)
|
|
6138
|
-
);
|
|
6139
|
-
--active-border-radius: var(
|
|
6140
|
-
--ck-primary-button-active-border-radius,
|
|
6141
|
-
var(--hover-border-radius)
|
|
6142
|
-
);
|
|
6143
|
-
|
|
6144
|
-
color: var(--color);
|
|
6145
|
-
background: var(--background);
|
|
6146
|
-
box-shadow: var(--box-shadow);
|
|
6147
|
-
border-radius: var(--border-radius);
|
|
6148
|
-
|
|
6149
|
-
&:disabled {
|
|
6150
|
-
transition: 180ms ease;
|
|
6151
|
-
opacity: 0.4;
|
|
6152
|
-
}
|
|
6153
|
-
|
|
6154
|
-
--bg: var(--background);
|
|
6155
|
-
&:not(:disabled) {
|
|
6156
|
-
&:hover {
|
|
6157
|
-
color: var(--hover-color);
|
|
6158
|
-
background: var(--hover-background);
|
|
6159
|
-
box-shadow: var(--hover-box-shadow);
|
|
6160
|
-
border-radius: var(--hover-border-radius);
|
|
6161
|
-
--bg: var(--hover-background, var(--background));
|
|
6162
|
-
}
|
|
6163
|
-
&:focus-visible {
|
|
6164
|
-
transition-duration: 100ms;
|
|
6165
|
-
color: var(--hover-color);
|
|
6166
|
-
background: var(--hover-background);
|
|
6167
|
-
box-shadow: var(--hover-box-shadow);
|
|
6168
|
-
border-radius: var(--hover-border-radius);
|
|
6169
|
-
--bg: var(--hover-background, var(--background));
|
|
6170
|
-
}
|
|
6171
|
-
&:active {
|
|
6172
|
-
color: var(--active-color);
|
|
6173
|
-
background: var(--active-background);
|
|
6174
|
-
box-shadow: var(--active-box-shadow);
|
|
6175
|
-
border-radius: var(--active-border-radius);
|
|
6176
|
-
--bg: var(--active-background, var(--background));
|
|
6177
|
-
}
|
|
6178
|
-
}
|
|
6179
|
-
`;
|
|
6180
|
-
styled(motion.span) `
|
|
6181
|
-
position: relative;
|
|
6182
|
-
top: var(--ck-recent-badge-top-offset, 0.5px);
|
|
6183
|
-
display: inline-block;
|
|
6184
|
-
padding: 10px 7px;
|
|
6185
|
-
line-height: 0;
|
|
6186
|
-
font-size: 13px;
|
|
6187
|
-
font-weight: 400;
|
|
6188
|
-
border-radius: var(--ck-recent-badge-border-radius, var(--border-radius));
|
|
6189
|
-
color: var(
|
|
6190
|
-
--ck-recent-badge-color,
|
|
6191
|
-
var(--ck-accent-color, var(--ck-body-color-muted, currentColor))
|
|
6192
|
-
);
|
|
6193
|
-
background: var(--ck-recent-badge-background, transparent);
|
|
6194
|
-
overflow: hidden;
|
|
6195
|
-
span {
|
|
6196
|
-
display: inline-block;
|
|
6197
|
-
position: relative;
|
|
6198
|
-
}
|
|
6199
|
-
&:before {
|
|
6200
|
-
z-index: 1;
|
|
6201
|
-
content: '';
|
|
6202
|
-
position: absolute;
|
|
6203
|
-
inset: 0;
|
|
6204
|
-
opacity: 0.4;
|
|
6205
|
-
box-shadow: var(--ck-recent-badge-box-shadow, inset 0 0 0 1px currentColor);
|
|
6206
|
-
border-radius: inherit;
|
|
6207
|
-
}
|
|
6208
|
-
&:after {
|
|
6209
|
-
z-index: 2;
|
|
6210
|
-
content: '';
|
|
6211
|
-
position: absolute;
|
|
6212
|
-
inset: -10%;
|
|
6213
|
-
top: -110%;
|
|
6214
|
-
aspect-ratio: 1/1;
|
|
6215
|
-
opacity: 0.7;
|
|
6216
|
-
background: linear-gradient(
|
|
6217
|
-
170deg,
|
|
6218
|
-
transparent 10%,
|
|
6219
|
-
var(--ck-recent-badge-background, var(--bg)) 50%,
|
|
6220
|
-
transparent 90%
|
|
6221
|
-
);
|
|
6222
|
-
animation: ${Shimmer$1} 2s linear infinite;
|
|
6223
|
-
}
|
|
6224
|
-
`;
|
|
6225
|
-
styled(motion.span) `
|
|
6226
|
-
display: flex;
|
|
6227
|
-
align-items: center;
|
|
6228
|
-
gap: 9px;
|
|
6229
|
-
width: 100%;
|
|
6230
|
-
overflow: hidden;
|
|
6231
|
-
white-space: nowrap;
|
|
6232
|
-
text-overflow: ellipsis;
|
|
6233
|
-
padding: 2px 0;
|
|
6234
|
-
padding-right: 38px;
|
|
6235
|
-
`;
|
|
6236
|
-
styled(motion.div) `
|
|
6237
|
-
position: absolute;
|
|
6238
|
-
right: 20px;
|
|
6239
|
-
width: 32px;
|
|
6240
|
-
height: 32px;
|
|
6241
|
-
overflow: hidden;
|
|
6242
|
-
svg,
|
|
6243
|
-
img {
|
|
6244
|
-
display: block;
|
|
6245
|
-
position: relative;
|
|
6246
|
-
pointer-events: none;
|
|
6247
|
-
overflow: hidden;
|
|
6248
|
-
border-radius: 27.5%;
|
|
6249
|
-
width: 100%;
|
|
6250
|
-
height: 100%;
|
|
6251
|
-
}
|
|
6252
|
-
`;
|
|
6253
|
-
|
|
6254
5991
|
function useIsMobile() {
|
|
6255
5992
|
const [mobile, setMobile] = useState(isMobile());
|
|
6256
5993
|
useEffect(() => {
|
|
@@ -6263,6 +6000,58 @@ function useIsMobile() {
|
|
|
6263
6000
|
return mobile;
|
|
6264
6001
|
}
|
|
6265
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
|
+
|
|
6266
6055
|
const Shimmer = keyframes `
|
|
6267
6056
|
0%{ transform: translate(-100%) rotate(-45deg); }
|
|
6268
6057
|
100%{ transform: translate(100%) rotate(-80deg); }
|
|
@@ -7076,161 +6865,200 @@ const ConnectorItem = ({ wallet, isRecent, }) => {
|
|
|
7076
6865
|
}, children: content() }));
|
|
7077
6866
|
};
|
|
7078
6867
|
|
|
7079
|
-
const
|
|
7080
|
-
|
|
7081
|
-
const context = useOpenfort();
|
|
7082
|
-
const locales = useLocales({});
|
|
7083
|
-
const isMobile = useIsMobile();
|
|
7084
|
-
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, {}))] }));
|
|
7085
|
-
};
|
|
7086
|
-
|
|
7087
|
-
const QRCodeContainer = styled(motion.div) `
|
|
7088
|
-
z-index: 3;
|
|
6868
|
+
const LogoContainer$3 = styled(motion.div) `
|
|
6869
|
+
z-index: 4;
|
|
7089
6870
|
position: relative;
|
|
7090
6871
|
overflow: hidden;
|
|
7091
|
-
height: 0;
|
|
7092
|
-
padding-bottom: 100% !important;
|
|
7093
|
-
display: flex;
|
|
7094
|
-
align-items: center;
|
|
7095
|
-
justify-content: center;
|
|
7096
|
-
margin: 1px 0 2px;
|
|
7097
|
-
border-radius: var(--ck-qr-border-radius, 24px);
|
|
7098
|
-
background: var(--ck-qr-background, transparent);
|
|
7099
|
-
box-shadow: 0 0 0 1px var(--ck-qr-border-color);
|
|
7100
|
-
backface-visibility: hidden;
|
|
7101
6872
|
svg {
|
|
6873
|
+
z-index: 3;
|
|
6874
|
+
position: relative;
|
|
7102
6875
|
display: block;
|
|
7103
|
-
max-width: 100%;
|
|
7104
|
-
width: 100%;
|
|
7105
|
-
height: auto;
|
|
7106
6876
|
}
|
|
7107
6877
|
`;
|
|
7108
|
-
const
|
|
6878
|
+
const Logo$2 = styled(motion.div) `
|
|
6879
|
+
z-index: 2;
|
|
7109
6880
|
position: absolute;
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
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%;
|
|
7114
6891
|
}
|
|
7115
6892
|
`;
|
|
7116
|
-
const
|
|
7117
|
-
|
|
7118
|
-
|
|
6893
|
+
const SpinnerContainer$1 = styled(motion.div) `
|
|
6894
|
+
position: absolute;
|
|
6895
|
+
inset: 1px;
|
|
6896
|
+
overflow: hidden;
|
|
7119
6897
|
`;
|
|
7120
|
-
const
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
6898
|
+
const Spinner$3 = styled(motion.div) `
|
|
6899
|
+
pointer-events: none;
|
|
6900
|
+
user-select: none;
|
|
6901
|
+
z-index: 1;
|
|
7124
6902
|
position: absolute;
|
|
7125
|
-
inset:
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
justify-content: center;
|
|
7129
|
-
> div {
|
|
7130
|
-
z-index: 4;
|
|
7131
|
-
position: relative;
|
|
7132
|
-
width: 28%;
|
|
7133
|
-
height: 28%;
|
|
7134
|
-
border-radius: 20px;
|
|
7135
|
-
background: var(--bg);
|
|
7136
|
-
box-shadow: 0 0 0 7px var(--bg);
|
|
7137
|
-
}
|
|
7138
|
-
> span {
|
|
7139
|
-
z-index: 4;
|
|
6903
|
+
inset: -25%;
|
|
6904
|
+
&:before {
|
|
6905
|
+
content: '';
|
|
7140
6906
|
position: absolute;
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
}
|
|
7157
|
-
&:nth-child(2) {
|
|
7158
|
-
top: 0;
|
|
7159
|
-
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);
|
|
7160
6922
|
}
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
left: 0;
|
|
6923
|
+
100% {
|
|
6924
|
+
transform: rotate(360deg);
|
|
7164
6925
|
}
|
|
7165
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;
|
|
7166
6981
|
&:before {
|
|
7167
|
-
z-index: 3;
|
|
7168
6982
|
content: '';
|
|
7169
6983
|
position: absolute;
|
|
7170
|
-
inset:
|
|
7171
|
-
|
|
7172
|
-
background
|
|
7173
|
-
|
|
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
|
+
`}
|
|
7174
6994
|
}
|
|
7175
|
-
|
|
7176
|
-
|
|
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;
|
|
7177
7026
|
content: '';
|
|
7178
7027
|
position: absolute;
|
|
7179
7028
|
inset: 0;
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
background-size: 200% 100%;
|
|
7188
|
-
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;
|
|
7189
7036
|
}
|
|
7190
7037
|
`;
|
|
7191
|
-
const
|
|
7192
|
-
z-index: 6;
|
|
7193
|
-
position: absolute;
|
|
7194
|
-
top: 0;
|
|
7195
|
-
left: 0;
|
|
7196
|
-
width: 100%;
|
|
7197
|
-
height: 100%;
|
|
7198
|
-
transform: translateY(50%) scale(0.9999); // Shifting fix
|
|
7199
|
-
`;
|
|
7200
|
-
const LogoIcon = styled(motion.div) `
|
|
7201
|
-
z-index: 6;
|
|
7038
|
+
const RetryIconContainer = styled(motion.div) `
|
|
7202
7039
|
position: absolute;
|
|
7203
|
-
|
|
7204
|
-
overflow: hidden;
|
|
7040
|
+
inset: 0;
|
|
7205
7041
|
|
|
7206
|
-
|
|
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
|
+
}
|
|
7207
7054
|
|
|
7208
7055
|
svg {
|
|
7056
|
+
z-index: 2;
|
|
7209
7057
|
display: block;
|
|
7210
7058
|
position: relative;
|
|
7211
7059
|
width: 100%;
|
|
7212
7060
|
height: 100%;
|
|
7213
7061
|
}
|
|
7214
|
-
|
|
7215
|
-
${(props) => props.$wcLogo
|
|
7216
|
-
? css `
|
|
7217
|
-
width: 29%;
|
|
7218
|
-
height: 20.5%;
|
|
7219
|
-
`
|
|
7220
|
-
: css `
|
|
7221
|
-
width: 28%;
|
|
7222
|
-
height: 28%;
|
|
7223
|
-
border-radius: 17px;
|
|
7224
|
-
&:before {
|
|
7225
|
-
pointer-events: none;
|
|
7226
|
-
z-index: 2;
|
|
7227
|
-
content: '';
|
|
7228
|
-
position: absolute;
|
|
7229
|
-
inset: 0;
|
|
7230
|
-
border-radius: inherit;
|
|
7231
|
-
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
|
|
7232
|
-
}
|
|
7233
|
-
`}
|
|
7234
7062
|
`;
|
|
7235
7063
|
|
|
7236
7064
|
const TooltipWindow = styled(motion.div) `
|
|
@@ -7395,13 +7223,278 @@ const Tooltip = ({ children, message, open, xOffset = 0, yOffset = 0, delay, })
|
|
|
7395
7223
|
}, children: [message, jsx(TooltipTail, { "$size": size })] }) }) })) }) })] }));
|
|
7396
7224
|
};
|
|
7397
7225
|
|
|
7398
|
-
const
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
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
|
+
|
|
7491
|
+
const generateMatrix = (value, errorCorrectionLevel) => {
|
|
7492
|
+
const arr = Array.prototype.slice.call(QRCodeUtil.create(value, { errorCorrectionLevel }).modules.data, 0);
|
|
7493
|
+
const sqrt = Math.sqrt(arr.length);
|
|
7494
|
+
return arr.reduce((rows, key, index) => (index % sqrt === 0
|
|
7495
|
+
? rows.push([key])
|
|
7496
|
+
: rows[rows.length - 1].push(key)) && rows, []);
|
|
7497
|
+
};
|
|
7405
7498
|
function QRCode({ ecl = 'M', size: sizeProp = 200, uri, clearArea = false, image, imageBackground = 'transparent', }) {
|
|
7406
7499
|
const logoSize = clearArea ? 76 : 0;
|
|
7407
7500
|
const size = sizeProp - 10 * 2;
|
|
@@ -7480,7 +7573,7 @@ function useWindowSize() {
|
|
|
7480
7573
|
function CustomQRCode({ value, image, imageBackground, imagePosition = 'center', tooltipMessage, }) {
|
|
7481
7574
|
const windowSize = useWindowSize();
|
|
7482
7575
|
const Logo = windowSize.width > 920 && tooltipMessage ? (jsx(Tooltip, { xOffset: 139, yOffset: 5, delay: 0.1, message: tooltipMessage, children: image })) : (image);
|
|
7483
|
-
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: {
|
|
7484
7577
|
background: imagePosition === 'center' ? imageBackground : undefined,
|
|
7485
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: {
|
|
7486
7579
|
duration: 0.2,
|
|
@@ -7570,49 +7663,7 @@ const WalletList = styled.div `
|
|
|
7570
7663
|
}
|
|
7571
7664
|
`}
|
|
7572
7665
|
`;
|
|
7573
|
-
const Container$
|
|
7574
|
-
|
|
7575
|
-
function useWalletConnectModal() {
|
|
7576
|
-
const { log } = useOpenfort();
|
|
7577
|
-
const { connectAsync, connectors } = useConnect();
|
|
7578
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
7579
|
-
return {
|
|
7580
|
-
isOpen,
|
|
7581
|
-
open: async () => {
|
|
7582
|
-
// add modal styling because wagmi does not let you add styling to the modal
|
|
7583
|
-
const w3mcss = document.createElement('style');
|
|
7584
|
-
w3mcss.innerHTML = `w3m-modal, wcm-modal{ --wcm-z-index: 2147483647; --w3m-z-index:2147483647; }`;
|
|
7585
|
-
document.head.appendChild(w3mcss);
|
|
7586
|
-
const clientConnector = connectors.find((c) => isWalletConnectConnector(c.id));
|
|
7587
|
-
if (clientConnector) {
|
|
7588
|
-
try {
|
|
7589
|
-
const provider = await clientConnector.getProvider();
|
|
7590
|
-
const projectId = provider.rpc.projectId;
|
|
7591
|
-
const connector = walletConnect$1({
|
|
7592
|
-
projectId,
|
|
7593
|
-
showQrModal: true,
|
|
7594
|
-
});
|
|
7595
|
-
setIsOpen(true);
|
|
7596
|
-
try {
|
|
7597
|
-
await connectAsync({ connector: connector });
|
|
7598
|
-
}
|
|
7599
|
-
catch (err) {
|
|
7600
|
-
log('WalletConnect', err);
|
|
7601
|
-
}
|
|
7602
|
-
setIsOpen(false);
|
|
7603
|
-
// remove modal styling
|
|
7604
|
-
document.head.removeChild(w3mcss);
|
|
7605
|
-
}
|
|
7606
|
-
catch (err) {
|
|
7607
|
-
log('Could not get WalletConnect provider', err);
|
|
7608
|
-
}
|
|
7609
|
-
}
|
|
7610
|
-
else {
|
|
7611
|
-
log('No WalletConnect connector available');
|
|
7612
|
-
}
|
|
7613
|
-
},
|
|
7614
|
-
};
|
|
7615
|
-
}
|
|
7666
|
+
const Container$6 = styled.div ``;
|
|
7616
7667
|
|
|
7617
7668
|
const IconContainer$3 = styled(motion.div) `
|
|
7618
7669
|
transition: all 220ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
|
|
@@ -7677,7 +7728,7 @@ const CopyToClipboardIcon = ({ copied, small, }) => (jsx(IconContainer$3, { "$cl
|
|
|
7677
7728
|
opacity: small || copied ? 1 : 0.3,
|
|
7678
7729
|
} }) }));
|
|
7679
7730
|
|
|
7680
|
-
const Container$
|
|
7731
|
+
const Container$5 = styled.div `
|
|
7681
7732
|
--color: var(--ck-copytoclipboard-stroke);
|
|
7682
7733
|
--bg: var(--ck-body-background);
|
|
7683
7734
|
transition: all 220ms cubic-bezier(0.175, 0.885, 0.32, 1.1);
|
|
@@ -7727,7 +7778,7 @@ const CopyToClipboard = ({ string, children, variant }) => {
|
|
|
7727
7778
|
};
|
|
7728
7779
|
if (variant === 'button')
|
|
7729
7780
|
return (jsx(Button, { disabled: !string, onClick: onCopy, icon: jsx(CopyToClipboardIcon, { copied: clipboard }), children: children }));
|
|
7730
|
-
return (jsx(Container$
|
|
7781
|
+
return (jsx(Container$5, { onClick: onCopy, "$disabled": !string, children: jsxs(OffsetContainer, { children: [children, jsx(CopyToClipboardIcon, { copied: clipboard, small: true })] }) }));
|
|
7731
7782
|
};
|
|
7732
7783
|
|
|
7733
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" }) }));
|
|
@@ -7752,7 +7803,7 @@ const MobileConnectors = () => {
|
|
|
7752
7803
|
context.setRoute(routes.CONNECT_WITH_MOBILE);
|
|
7753
7804
|
context.setConnector({ id: walletId });
|
|
7754
7805
|
};
|
|
7755
|
-
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
|
|
7756
7807
|
.sort(
|
|
7757
7808
|
// sort by name
|
|
7758
7809
|
(a, b) => {
|
|
@@ -7897,7 +7948,7 @@ const RotateWrapper = styled(motion.div) `
|
|
|
7897
7948
|
animation-name: ${rotate};
|
|
7898
7949
|
animation-duration: 3200ms;
|
|
7899
7950
|
`;
|
|
7900
|
-
const Logo$
|
|
7951
|
+
const Logo$1 = styled(motion.div) `
|
|
7901
7952
|
position: absolute;
|
|
7902
7953
|
inset: 0;
|
|
7903
7954
|
|
|
@@ -7960,7 +8011,7 @@ const Introduction = () => {
|
|
|
7960
8011
|
const context = useOpenfort();
|
|
7961
8012
|
const locales = useLocales({});
|
|
7962
8013
|
const ctaUrl = (_b = (_a = context.uiConfig) === null || _a === void 0 ? void 0 : _a.walletOnboardingUrl) !== null && _b !== void 0 ? _b : locales.onboardingScreen_ctaUrl;
|
|
7963
|
-
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 })] }));
|
|
7964
8015
|
};
|
|
7965
8016
|
|
|
7966
8017
|
const AvatarContainer = styled(motion.div) `
|
|
@@ -8200,7 +8251,7 @@ const ChainContainer = styled.div `
|
|
|
8200
8251
|
justify-content: center;
|
|
8201
8252
|
}
|
|
8202
8253
|
`;
|
|
8203
|
-
const LogoContainer$
|
|
8254
|
+
const LogoContainer$1 = styled(motion.div) `
|
|
8204
8255
|
display: block;
|
|
8205
8256
|
position: absolute;
|
|
8206
8257
|
inset: 0;
|
|
@@ -8700,7 +8751,7 @@ const chainConfigs = [
|
|
|
8700
8751
|
},
|
|
8701
8752
|
];
|
|
8702
8753
|
|
|
8703
|
-
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" })] }) })] }));
|
|
8704
8755
|
const Chain = ({ id, unsupported: controlledUnsupported, radius = '50%', size = 24, }) => {
|
|
8705
8756
|
var _a;
|
|
8706
8757
|
const isChainSupported = useChainIsSupported(id);
|
|
@@ -8712,7 +8763,7 @@ const Chain = ({ id, unsupported: controlledUnsupported, radius = '50%', size =
|
|
|
8712
8763
|
width: size,
|
|
8713
8764
|
height: size,
|
|
8714
8765
|
} }));
|
|
8715
|
-
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"))] }) }));
|
|
8716
8767
|
};
|
|
8717
8768
|
|
|
8718
8769
|
const SwitchNetworksContainer = styled.div `
|
|
@@ -8933,7 +8984,7 @@ const ChainButtonBg = styled(motion.div) `
|
|
|
8933
8984
|
}
|
|
8934
8985
|
`;
|
|
8935
8986
|
|
|
8936
|
-
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" })] }) })] }));
|
|
8937
8988
|
const ChainSelectList = ({ variant, }) => {
|
|
8938
8989
|
const { connector, chain } = useAccount();
|
|
8939
8990
|
const { chains, isPending, switchChain, error } = useSwitchChain();
|
|
@@ -8981,7 +9032,7 @@ const ChainSelectList = ({ variant, }) => {
|
|
|
8981
9032
|
opacity: [1, 0],
|
|
8982
9033
|
transition: { delay: 4, duration: 3 },
|
|
8983
9034
|
}
|
|
8984
|
-
: { 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: {
|
|
8985
9036
|
color: 'var(--ck-dropdown-active-color, var(--ck-focus-color))',
|
|
8986
9037
|
display: 'block',
|
|
8987
9038
|
position: 'relative',
|
|
@@ -9221,7 +9272,7 @@ const ChainSelectDropdown = ({ children, open, onClose, offsetX = 0, offsetY = 8
|
|
|
9221
9272
|
}, children: [jsx(DropdownHeading, { children: locales.switchNetworks }), jsx(ChainSelectList, {})] })] }) }) }) })) })] }));
|
|
9222
9273
|
};
|
|
9223
9274
|
|
|
9224
|
-
const Container$
|
|
9275
|
+
const Container$4 = styled(motion.div) ``;
|
|
9225
9276
|
const SwitchChainButton = styled(motion.button) `
|
|
9226
9277
|
--color: var(
|
|
9227
9278
|
--ck-dropdown-button-color,
|
|
@@ -9330,7 +9381,7 @@ const ChainSelector = () => {
|
|
|
9330
9381
|
setIsOpen(false);
|
|
9331
9382
|
}, [context.open]);
|
|
9332
9383
|
const disabled = chains.length <= 1;
|
|
9333
|
-
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: () => {
|
|
9334
9385
|
if (mobile) {
|
|
9335
9386
|
context.setRoute(routes.SWITCHNETWORKS);
|
|
9336
9387
|
}
|
|
@@ -9343,7 +9394,7 @@ const ChainSelector = () => {
|
|
|
9343
9394
|
const PoweredByFooter = ({ showDisclaimer }) => {
|
|
9344
9395
|
var _a, _b;
|
|
9345
9396
|
const { uiConfig: options } = useOpenfort();
|
|
9346
|
-
return (jsxs(Container$
|
|
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: () => {
|
|
9347
9398
|
window.open("https://www.openfort.io/", "_blank");
|
|
9348
9399
|
}, children: [jsx("span", { children: "Powered by" }), jsx(IconContainer$2, { children: jsx(Logos.Openfort, {}) }), jsx("span", { children: "Openfort" })] })] }));
|
|
9349
9400
|
};
|
|
@@ -9392,7 +9443,7 @@ const IconContainer$2 = styled.div `
|
|
|
9392
9443
|
border-radius: 0;
|
|
9393
9444
|
}
|
|
9394
9445
|
`;
|
|
9395
|
-
const Container$
|
|
9446
|
+
const Container$3 = styled(motion.div) `
|
|
9396
9447
|
text-align: center;
|
|
9397
9448
|
margin-top: 4px;
|
|
9398
9449
|
margin-bottom: -16px;
|
|
@@ -9573,334 +9624,138 @@ const ProvidersButton = styled.div `
|
|
|
9573
9624
|
padding: 0 20px;
|
|
9574
9625
|
justify-content: space-between;
|
|
9575
9626
|
}
|
|
9576
|
-
|
|
9577
|
-
${InnerContainer} {
|
|
9578
|
-
justify-content: space-between;
|
|
9579
|
-
width: 100%;
|
|
9580
|
-
max-width: 100%;
|
|
9581
|
-
}
|
|
9582
|
-
`;
|
|
9583
|
-
const ProviderLabel = styled.span `
|
|
9584
|
-
display: flex;
|
|
9585
|
-
align-items: center;
|
|
9586
|
-
gap: 9px;
|
|
9587
|
-
width: 100%;
|
|
9588
|
-
overflow: hidden;
|
|
9589
|
-
white-space: nowrap;
|
|
9590
|
-
text-overflow: ellipsis;
|
|
9591
|
-
padding: 2px 0;
|
|
9592
|
-
`;
|
|
9593
|
-
const ProviderIcon$1 = styled.div `
|
|
9594
|
-
width: 32px;
|
|
9595
|
-
height: 32px;
|
|
9596
|
-
svg,
|
|
9597
|
-
img {
|
|
9598
|
-
display: block;
|
|
9599
|
-
position: relative;
|
|
9600
|
-
pointer-events: none;
|
|
9601
|
-
overflow: hidden;
|
|
9602
|
-
width: 100%;
|
|
9603
|
-
height: 100%;
|
|
9604
|
-
}
|
|
9605
|
-
|
|
9606
|
-
&[data-shape='squircle'] {
|
|
9607
|
-
border-radius: 22.5%;
|
|
9608
|
-
}
|
|
9609
|
-
&[data-shape='circle'] {
|
|
9610
|
-
border-radius: 100%;
|
|
9611
|
-
}
|
|
9612
|
-
&[data-shape='square'] {
|
|
9613
|
-
border-radius: 0;
|
|
9614
|
-
}
|
|
9615
|
-
`;
|
|
9616
|
-
|
|
9617
|
-
const WalletIcon = ({ provider }) => {
|
|
9618
|
-
var _a;
|
|
9619
|
-
if (provider.walletClientType === "walletconnect")
|
|
9620
|
-
return jsx(Logos.WalletConnect, {});
|
|
9621
|
-
const wallets = useWallets$1();
|
|
9622
|
-
const wallet = useMemo(() => {
|
|
9623
|
-
return wallets.find(w => { var _a; return ((_a = w.id) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === provider.walletClientType; });
|
|
9624
|
-
}, [provider]);
|
|
9625
|
-
if (wallet)
|
|
9626
|
-
return jsx(Fragment, { children: (_a = wallet.iconConnector) !== null && _a !== void 0 ? _a : wallet.icon });
|
|
9627
|
-
return jsx(Wallet, {});
|
|
9628
|
-
};
|
|
9629
|
-
const ProviderIcon = ({ provider }) => {
|
|
9630
|
-
switch (provider.provider) {
|
|
9631
|
-
case "email":
|
|
9632
|
-
return jsx(EmailIcon, {});
|
|
9633
|
-
case "wallet":
|
|
9634
|
-
return jsx(WalletIcon, { provider: provider });
|
|
9635
|
-
case "google":
|
|
9636
|
-
case "twitter":
|
|
9637
|
-
case "facebook":
|
|
9638
|
-
return providersLogos[provider.provider];
|
|
9639
|
-
default:
|
|
9640
|
-
return jsx(FitText, { children: provider.provider.substring(0, 4).toUpperCase() });
|
|
9641
|
-
}
|
|
9642
|
-
};
|
|
9643
|
-
const LinkedProvider = ({ provider }) => {
|
|
9644
|
-
return (jsx(LinkedProviderButton, { disabled: true, children: jsx(ProviderIcon$1, { children: jsx(ProviderIcon, { provider: provider }) }) }));
|
|
9645
|
-
};
|
|
9646
|
-
const AddLinkedProviderButton = () => {
|
|
9647
|
-
const { setRoute } = useOpenfort();
|
|
9648
|
-
const { availableProviders: unlinkedProviders } = useProviders();
|
|
9649
|
-
return (jsx(LinkedProviderButton, { disabled: unlinkedProviders.length === 0, onClick: () => setRoute(routes.PROVIDERS), children: "+" }));
|
|
9650
|
-
};
|
|
9651
|
-
const LinkedProviders = () => {
|
|
9652
|
-
const { user } = useOpenfortCore();
|
|
9653
|
-
if (!user || !user.linkedAccounts) {
|
|
9654
|
-
return (jsx("div", { children: jsx("p", { children: "No linked providers" }) }));
|
|
9655
|
-
}
|
|
9656
|
-
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, {})] })] }));
|
|
9657
|
-
};
|
|
9658
|
-
|
|
9659
|
-
const Profile = ({ closeModal }) => {
|
|
9660
|
-
var _a, _b, _c, _d;
|
|
9661
|
-
const context = useOpenfort();
|
|
9662
|
-
const themeContext = useThemeContext();
|
|
9663
|
-
const locales = useLocales();
|
|
9664
|
-
const { address, isConnected, connector, chain } = useAccount();
|
|
9665
|
-
const ensFallbackConfig = useEnsFallbackConfig();
|
|
9666
|
-
const { data: ensName } = useEnsName({
|
|
9667
|
-
chainId: 1,
|
|
9668
|
-
address: address,
|
|
9669
|
-
config: ensFallbackConfig,
|
|
9670
|
-
});
|
|
9671
|
-
const { data: balance } = useBalance({
|
|
9672
|
-
address,
|
|
9673
|
-
//watch: true,
|
|
9674
|
-
});
|
|
9675
|
-
const [shouldDisconnect, setShouldDisconnect] = useState(false);
|
|
9676
|
-
const { logout } = useOpenfortCore();
|
|
9677
|
-
useEffect(() => {
|
|
9678
|
-
if (!shouldDisconnect)
|
|
9679
|
-
return;
|
|
9680
|
-
// Close before disconnecting to avoid layout shifting while modal is still open
|
|
9681
|
-
if (closeModal) {
|
|
9682
|
-
closeModal();
|
|
9683
|
-
}
|
|
9684
|
-
else {
|
|
9685
|
-
context.setOpen(false);
|
|
9686
|
-
}
|
|
9687
|
-
return () => {
|
|
9688
|
-
logout();
|
|
9689
|
-
};
|
|
9690
|
-
}, [shouldDisconnect, logout]);
|
|
9691
|
-
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 : '')
|
|
9692
|
-
? '....'
|
|
9693
|
-
: undefined;
|
|
9694
|
-
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, {})] }));
|
|
9695
|
-
};
|
|
9696
|
-
|
|
9697
|
-
const SwitchNetworks = () => {
|
|
9698
|
-
const { reset } = useConnect$1();
|
|
9699
|
-
const { disconnect } = useDisconnect();
|
|
9700
|
-
const { connector, chain } = useAccount();
|
|
9701
|
-
const isChainSupported = useChainIsSupported(chain === null || chain === void 0 ? void 0 : chain.id);
|
|
9702
|
-
const locales = useLocales({});
|
|
9703
|
-
const onDisconnect = () => {
|
|
9704
|
-
disconnect();
|
|
9705
|
-
reset();
|
|
9706
|
-
};
|
|
9707
|
-
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 })] }))] }) }));
|
|
9708
|
-
};
|
|
9709
|
-
|
|
9710
|
-
const Content = styled(motion.div) `
|
|
9711
|
-
display: flex;
|
|
9712
|
-
flex-direction: column;
|
|
9713
|
-
gap: 6px;
|
|
9714
|
-
position: relative;
|
|
9715
|
-
left: 0;
|
|
9716
|
-
right: 0;
|
|
9717
|
-
${ModalContent} {
|
|
9718
|
-
padding: 0 8px 32px;
|
|
9719
|
-
gap: 12px;
|
|
9720
|
-
}
|
|
9721
|
-
`;
|
|
9722
|
-
const dist$1 = 2;
|
|
9723
|
-
const shakeKeyframes$1 = keyframes `
|
|
9724
|
-
0%{ transform:none; }
|
|
9725
|
-
25%{ transform:translateX(${dist$1}px); }
|
|
9726
|
-
50%{ transform:translateX(-${dist$1}px); }
|
|
9727
|
-
75%{ transform:translateX(${dist$1}px); }
|
|
9728
|
-
100%{ transform:none; }
|
|
9729
|
-
`;
|
|
9730
|
-
const outlineKeyframes$1 = keyframes `
|
|
9731
|
-
0%{ opacity:1; }
|
|
9732
|
-
100%{ opacity:0; }
|
|
9733
|
-
`;
|
|
9734
|
-
const Container$3 = styled(motion.div) `
|
|
9735
|
-
/*
|
|
9736
|
-
background: var(
|
|
9737
|
-
--ck-body-background
|
|
9738
|
-
); // To stop the overlay issue during transition for the squircle spinner
|
|
9739
|
-
*/
|
|
9740
|
-
`;
|
|
9741
|
-
const ConnectingContainer$1 = styled(motion.div) `
|
|
9742
|
-
display: flex;
|
|
9743
|
-
align-items: center;
|
|
9744
|
-
justify-content: center;
|
|
9745
|
-
margin: 10px auto 16px;
|
|
9746
|
-
height: 120px;
|
|
9747
|
-
//transform: scale(1.001); // fixes shifting issue between states
|
|
9748
|
-
`;
|
|
9749
|
-
const ConnectingAnimation$1 = styled(motion.div) `
|
|
9750
|
-
user-select: none;
|
|
9751
|
-
position: relative;
|
|
9752
|
-
--spinner-error-opacity: 0;
|
|
9753
|
-
&:before {
|
|
9754
|
-
content: '';
|
|
9755
|
-
position: absolute;
|
|
9756
|
-
inset: 1px;
|
|
9757
|
-
opacity: 0;
|
|
9758
|
-
background: var(--ck-body-color-danger);
|
|
9759
|
-
${(props) => props.$circle &&
|
|
9760
|
-
css `
|
|
9761
|
-
inset: -5px;
|
|
9762
|
-
border-radius: 50%;
|
|
9763
|
-
background: none;
|
|
9764
|
-
box-shadow: inset 0 0 0 3.5px var(--ck-body-color-danger);
|
|
9765
|
-
`}
|
|
9766
|
-
}
|
|
9767
|
-
${(props) => props.$shake &&
|
|
9768
|
-
css `
|
|
9769
|
-
animation: ${shakeKeyframes$1} 220ms ease-out both;
|
|
9770
|
-
&:before {
|
|
9771
|
-
animation: ${outlineKeyframes$1} 220ms ease-out 750ms both;
|
|
9772
|
-
}
|
|
9773
|
-
`}
|
|
9774
|
-
`;
|
|
9775
|
-
const RetryButton = styled(motion.button) `
|
|
9776
|
-
z-index: 5;
|
|
9777
|
-
appearance: none;
|
|
9778
|
-
position: absolute;
|
|
9779
|
-
right: 10px;
|
|
9780
|
-
bottom: 10px;
|
|
9781
|
-
padding: 0;
|
|
9782
|
-
display: flex;
|
|
9783
|
-
align-items: center;
|
|
9784
|
-
justify-content: center;
|
|
9785
|
-
width: 32px;
|
|
9786
|
-
height: 32px;
|
|
9787
|
-
border-radius: 16px;
|
|
9788
|
-
cursor: pointer;
|
|
9789
|
-
overflow: hidden;
|
|
9790
|
-
background: none;
|
|
9791
|
-
|
|
9792
|
-
color: var(--ck-body-background-secondary);
|
|
9793
|
-
transition: color 200ms ease;
|
|
9794
|
-
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.15);
|
|
9795
|
-
|
|
9796
|
-
&:before {
|
|
9797
|
-
z-index: 3;
|
|
9798
|
-
content: '';
|
|
9799
|
-
position: absolute;
|
|
9800
|
-
inset: 0;
|
|
9801
|
-
opacity: 0;
|
|
9802
|
-
transition: opacity 200ms ease;
|
|
9803
|
-
background: var(--ck-body-color);
|
|
9804
|
-
}
|
|
9805
|
-
|
|
9806
|
-
&:hover:before {
|
|
9807
|
-
opacity: 0.1;
|
|
9808
|
-
}
|
|
9809
|
-
`;
|
|
9810
|
-
const RetryIconContainer = styled(motion.div) `
|
|
9811
|
-
position: absolute;
|
|
9812
|
-
inset: 0;
|
|
9813
|
-
|
|
9814
|
-
&:before {
|
|
9815
|
-
z-index: 1;
|
|
9816
|
-
content: '';
|
|
9817
|
-
position: absolute;
|
|
9818
|
-
inset: 3px;
|
|
9819
|
-
border-radius: 16px;
|
|
9820
|
-
background: conic-gradient(
|
|
9821
|
-
from 90deg,
|
|
9822
|
-
currentColor 10%,
|
|
9823
|
-
var(--ck-body-color) 80%
|
|
9824
|
-
);
|
|
9825
|
-
}
|
|
9826
|
-
|
|
9827
|
-
svg {
|
|
9828
|
-
z-index: 2;
|
|
9829
|
-
display: block;
|
|
9830
|
-
position: relative;
|
|
9831
|
-
width: 100%;
|
|
9832
|
-
height: 100%;
|
|
9833
|
-
}
|
|
9834
|
-
`;
|
|
9835
|
-
|
|
9836
|
-
const LogoContainer$1 = styled(motion.div) `
|
|
9837
|
-
z-index: 4;
|
|
9838
|
-
position: relative;
|
|
9839
|
-
overflow: hidden;
|
|
9840
|
-
svg {
|
|
9841
|
-
z-index: 3;
|
|
9842
|
-
position: relative;
|
|
9843
|
-
display: block;
|
|
9627
|
+
|
|
9628
|
+
${InnerContainer} {
|
|
9629
|
+
justify-content: space-between;
|
|
9630
|
+
width: 100%;
|
|
9631
|
+
max-width: 100%;
|
|
9844
9632
|
}
|
|
9845
9633
|
`;
|
|
9846
|
-
const
|
|
9847
|
-
|
|
9848
|
-
|
|
9634
|
+
const ProviderLabel = styled.span `
|
|
9635
|
+
display: flex;
|
|
9636
|
+
align-items: center;
|
|
9637
|
+
gap: 9px;
|
|
9638
|
+
width: 100%;
|
|
9849
9639
|
overflow: hidden;
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
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;
|
|
9853
9647
|
svg,
|
|
9854
9648
|
img {
|
|
9855
|
-
pointer-events: none;
|
|
9856
9649
|
display: block;
|
|
9650
|
+
position: relative;
|
|
9651
|
+
pointer-events: none;
|
|
9652
|
+
overflow: hidden;
|
|
9857
9653
|
width: 100%;
|
|
9858
9654
|
height: 100%;
|
|
9859
9655
|
}
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
inset: 1px;
|
|
9864
|
-
overflow: hidden;
|
|
9865
|
-
`;
|
|
9866
|
-
const Spinner$1 = styled(motion.div) `
|
|
9867
|
-
pointer-events: none;
|
|
9868
|
-
user-select: none;
|
|
9869
|
-
z-index: 1;
|
|
9870
|
-
position: absolute;
|
|
9871
|
-
inset: -25%;
|
|
9872
|
-
&:before {
|
|
9873
|
-
content: '';
|
|
9874
|
-
position: absolute;
|
|
9875
|
-
inset: 0;
|
|
9876
|
-
background: conic-gradient(
|
|
9877
|
-
from -90deg,
|
|
9878
|
-
transparent,
|
|
9879
|
-
transparent,
|
|
9880
|
-
transparent,
|
|
9881
|
-
transparent,
|
|
9882
|
-
transparent,
|
|
9883
|
-
var(--ck-spinner-color)
|
|
9884
|
-
);
|
|
9885
|
-
animation: rotateSpinner 1200ms linear infinite;
|
|
9656
|
+
|
|
9657
|
+
&[data-shape='squircle'] {
|
|
9658
|
+
border-radius: 22.5%;
|
|
9886
9659
|
}
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
transform: rotate(360deg);
|
|
9893
|
-
}
|
|
9660
|
+
&[data-shape='circle'] {
|
|
9661
|
+
border-radius: 100%;
|
|
9662
|
+
}
|
|
9663
|
+
&[data-shape='square'] {
|
|
9664
|
+
border-radius: 0;
|
|
9894
9665
|
}
|
|
9895
9666
|
`;
|
|
9896
9667
|
|
|
9897
|
-
const
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
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 })] }))] }) }));
|
|
9904
9759
|
};
|
|
9905
9760
|
|
|
9906
9761
|
const BrowserIconContainer = styled(motion.div) `
|
|
@@ -10084,19 +9939,25 @@ const createSIWEMessage = (address, nonce, chainId) => createSiweMessage({
|
|
|
10084
9939
|
function useConnectWithSiwe() {
|
|
10085
9940
|
const { client, user, updateUser } = useOpenfortCore();
|
|
10086
9941
|
const { log } = useOpenfort();
|
|
10087
|
-
const { address, connector } = useAccount();
|
|
9942
|
+
const { address, connector, chainId: accountChainId } = useAccount();
|
|
10088
9943
|
const chainId = useChainId();
|
|
10089
9944
|
const config = useConfig();
|
|
10090
|
-
|
|
10091
|
-
const connectWithSiwe = useCallback(async ({ onError, onConnect, } = {}) => {
|
|
10092
|
-
|
|
10093
|
-
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;
|
|
10094
9950
|
if (!address || !connectorType || !walletClientType) {
|
|
10095
9951
|
log("No address found", { address, connectorType, walletClientType });
|
|
10096
9952
|
onError && onError("No address found");
|
|
10097
9953
|
return;
|
|
10098
9954
|
}
|
|
10099
9955
|
try {
|
|
9956
|
+
if (accountChainId !== chainId) {
|
|
9957
|
+
switchChain(config, {
|
|
9958
|
+
chainId,
|
|
9959
|
+
});
|
|
9960
|
+
}
|
|
10100
9961
|
const { nonce } = await client.auth.initSIWE({ address });
|
|
10101
9962
|
const SIWEMessage = createSIWEMessage(address, nonce, chainId);
|
|
10102
9963
|
const signature = await signMessage(config, { message: SIWEMessage });
|
|
@@ -10135,7 +9996,7 @@ function useConnectWithSiwe() {
|
|
|
10135
9996
|
message = "Invalid signature. Please try again.";
|
|
10136
9997
|
}
|
|
10137
9998
|
else if (message.includes("An error occurred when attempting to switch chain")) {
|
|
10138
|
-
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.`;
|
|
10139
10000
|
}
|
|
10140
10001
|
else {
|
|
10141
10002
|
message = "Failed to connect with SIWE.";
|
|
@@ -10347,14 +10208,14 @@ const ConnectWithInjector = ({ switchConnectMethod, forceState }) => {
|
|
|
10347
10208
|
}, [status, expiryTimer]);
|
|
10348
10209
|
*/
|
|
10349
10210
|
if (!wallet) {
|
|
10350
|
-
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." }) })] }) }));
|
|
10351
10212
|
}
|
|
10352
10213
|
// OLD_TODO: Make this more generic
|
|
10353
10214
|
if (isWalletConnectConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector.id)) {
|
|
10354
|
-
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." }) })] }) }));
|
|
10355
10216
|
}
|
|
10356
10217
|
const hasError = status === states$3.FAILED || status === states$3.REJECTED || status === states$3.DUPLICATED;
|
|
10357
|
-
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 &&
|
|
10358
10219
|
(hasError), message: locales.tryAgainQuestion, xOffset: -6, children: jsx(RetryIconCircle, {}) }) }) })) }), walletInfo.iconShape === 'circle' ? (jsx(CircleSpinner, { logo: status === states$3.UNAVAILABLE ? (jsx("div", { style: {
|
|
10359
10220
|
transform: 'scale(1.14)',
|
|
10360
10221
|
position: 'relative',
|
|
@@ -10490,86 +10351,6 @@ const ConnectWithQRCode = ({ switchConnectMethod }) => {
|
|
|
10490
10351
|
download: true, children: locales.getWalletName }) }))] }));
|
|
10491
10352
|
};
|
|
10492
10353
|
|
|
10493
|
-
const LoadingTextWrapper = styled.div `
|
|
10494
|
-
display: flex;
|
|
10495
|
-
justify-content: center;
|
|
10496
|
-
align-items: center;
|
|
10497
|
-
flex-direction: column;
|
|
10498
|
-
gap: 12px;
|
|
10499
|
-
padding: 0 8px 16px;
|
|
10500
|
-
text-align: center;
|
|
10501
|
-
`;
|
|
10502
|
-
const ConnectingContainer = styled(motion.div) `
|
|
10503
|
-
display: flex;
|
|
10504
|
-
align-items: center;
|
|
10505
|
-
justify-content: center;
|
|
10506
|
-
margin: 10px auto 16px;
|
|
10507
|
-
height: 120px;
|
|
10508
|
-
`;
|
|
10509
|
-
const dist = 2;
|
|
10510
|
-
const shakeKeyframes = keyframes `
|
|
10511
|
-
0%{ transform:none; }
|
|
10512
|
-
25%{ transform:translateX(${dist}px); }
|
|
10513
|
-
50%{ transform:translateX(-${dist}px); }
|
|
10514
|
-
75%{ transform:translateX(${dist}px); }
|
|
10515
|
-
100%{ transform:none; }
|
|
10516
|
-
`;
|
|
10517
|
-
const outlineKeyframes = keyframes `
|
|
10518
|
-
0%{ opacity:0; }
|
|
10519
|
-
100%{ opacity:1; }
|
|
10520
|
-
`;
|
|
10521
|
-
const ConnectingAnimation = styled(motion.div) `
|
|
10522
|
-
position: relative;
|
|
10523
|
-
user-select: none;
|
|
10524
|
-
position: relative;
|
|
10525
|
-
--spinner-error-opacity: 0;
|
|
10526
|
-
&:before {
|
|
10527
|
-
content: '';
|
|
10528
|
-
position: absolute;
|
|
10529
|
-
inset: 1px;
|
|
10530
|
-
opacity: 0;
|
|
10531
|
-
background: ${(props) => props.$color};
|
|
10532
|
-
}
|
|
10533
|
-
${(props) => !!props.$color &&
|
|
10534
|
-
css `
|
|
10535
|
-
&:before {
|
|
10536
|
-
opacity: 1;
|
|
10537
|
-
}
|
|
10538
|
-
`}
|
|
10539
|
-
${(props) => props.$shake &&
|
|
10540
|
-
css `
|
|
10541
|
-
animation: ${shakeKeyframes} 220ms ease-out both;
|
|
10542
|
-
&:before {
|
|
10543
|
-
animation: ${outlineKeyframes} 220ms ease-out both;
|
|
10544
|
-
}
|
|
10545
|
-
`}
|
|
10546
|
-
`;
|
|
10547
|
-
const Loader = ({ header, description, icon, isError = false, isSuccess = false, isLoading = !isError && !isSuccess, onRetry, }) => {
|
|
10548
|
-
const { uiConfig: options } = useOpenfort();
|
|
10549
|
-
const { triggerResize } = useOpenfort();
|
|
10550
|
-
const locales = useLocales();
|
|
10551
|
-
useEffect(() => {
|
|
10552
|
-
return () => triggerResize();
|
|
10553
|
-
}, []);
|
|
10554
|
-
const renderLogo = () => {
|
|
10555
|
-
if (icon) {
|
|
10556
|
-
return icon;
|
|
10557
|
-
}
|
|
10558
|
-
if (options === null || options === void 0 ? void 0 : options.logo) {
|
|
10559
|
-
if (typeof options.logo === 'string') {
|
|
10560
|
-
return jsx("img", { src: options.logo, alt: "Logo", style: { width: '100%' } });
|
|
10561
|
-
}
|
|
10562
|
-
return options.logo;
|
|
10563
|
-
}
|
|
10564
|
-
return jsx(Logos.Openfort, {});
|
|
10565
|
-
};
|
|
10566
|
-
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: {
|
|
10567
|
-
padding: '12px',
|
|
10568
|
-
position: 'relative',
|
|
10569
|
-
width: '100%',
|
|
10570
|
-
}, 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 })] }))] })] }));
|
|
10571
|
-
};
|
|
10572
|
-
|
|
10573
10354
|
const states$2 = {
|
|
10574
10355
|
INIT: "init",
|
|
10575
10356
|
REDIRECT: "redirect",
|
|
@@ -12156,7 +11937,7 @@ const EmailLogin = () => {
|
|
|
12156
11937
|
};
|
|
12157
11938
|
|
|
12158
11939
|
const LogoGraphic = ({ size = "100%", logo }) => {
|
|
12159
|
-
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 }) }) }) }) }) }));
|
|
12160
11941
|
};
|
|
12161
11942
|
const FloatingGraphic = ({ height = "130px", logoCenter, logoTopRight, logoTopLeft, logoBottomRight, logoBottomLeft }) => {
|
|
12162
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 })] }));
|
|
@@ -13217,19 +12998,25 @@ const DownloadFooter = styled.div `
|
|
|
13217
12998
|
`;
|
|
13218
12999
|
const ConnectWithMobile = ({}) => {
|
|
13219
13000
|
var _a, _b, _c;
|
|
13220
|
-
const { connector, setRoute } = useOpenfort();
|
|
13221
|
-
const
|
|
13222
|
-
|
|
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);
|
|
13223
13011
|
const [description, setDescription] = useState(undefined);
|
|
13224
13012
|
const { connect: { getUri }, } = useWeb3();
|
|
13225
13013
|
const wcUri = getUri();
|
|
13226
13014
|
const [hasReturned, setHasReturned] = useState(false);
|
|
13227
|
-
const { isConnected } = useAccount();
|
|
13228
|
-
const [shouldRedirectToWalletApp, setShouldRedirectToWalletApp] = useState(false);
|
|
13229
13015
|
const siwe = useConnectWithSiwe();
|
|
13230
13016
|
const openApp = (url) => {
|
|
13231
13017
|
var _a;
|
|
13232
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 });
|
|
13233
13020
|
if (uri) {
|
|
13234
13021
|
if (url) {
|
|
13235
13022
|
window.location.href = uri;
|
|
@@ -13266,8 +13053,9 @@ const ConnectWithMobile = ({}) => {
|
|
|
13266
13053
|
openApp(wcUri);
|
|
13267
13054
|
break;
|
|
13268
13055
|
case states.CONNECTING:
|
|
13269
|
-
setDescription("Requesting signature...");
|
|
13056
|
+
setDescription("Requesting signature to verify wallet...");
|
|
13270
13057
|
siwe({
|
|
13058
|
+
walletClientType: walletId,
|
|
13271
13059
|
onConnect: () => {
|
|
13272
13060
|
setRoute(routes.PROFILE);
|
|
13273
13061
|
},
|
|
@@ -13276,23 +13064,11 @@ const ConnectWithMobile = ({}) => {
|
|
|
13276
13064
|
setDescription(error || "Connection failed");
|
|
13277
13065
|
}
|
|
13278
13066
|
});
|
|
13279
|
-
setTimeout(() => {
|
|
13280
|
-
setShouldRedirectToWalletApp(true);
|
|
13281
|
-
}, 1500);
|
|
13282
13067
|
break;
|
|
13283
13068
|
}
|
|
13284
13069
|
}, [status]);
|
|
13285
|
-
useEffect(() => {
|
|
13286
|
-
if (shouldRedirectToWalletApp && status === states.CONNECTING) {
|
|
13287
|
-
openApp();
|
|
13288
|
-
}
|
|
13289
|
-
}, [shouldRedirectToWalletApp, status]);
|
|
13290
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: () => {
|
|
13291
|
-
|
|
13292
|
-
setStatus(states.CONNECTING);
|
|
13293
|
-
return;
|
|
13294
|
-
}
|
|
13295
|
-
setStatus(states.INIT);
|
|
13071
|
+
setStatus(isConnected ? states.CONNECTING : states.INIT);
|
|
13296
13072
|
setDescription("");
|
|
13297
13073
|
} }), isConnected ? (jsx(Button, { onClick: () => {
|
|
13298
13074
|
openApp();
|