@block-auth.io/blockauth-sdk-react 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/dist/bundle.es.js +25 -0
- package/dist/bundle.es.js.map +1 -0
- package/dist/bundle.umd.js +11426 -0
- package/dist/bundle.umd.js.map +1 -0
- package/dist/components/FlowBlockAuth.d.ts +31 -0
- package/dist/components/btns/BtnBaseProvider.d.ts +10 -0
- package/dist/components/btns/BtnBlockAuth.d.ts +8 -0
- package/dist/components/btns/BtnGmail.d.ts +19 -0
- package/dist/components/btns/BtnGoogleBase.d.ts +32 -0
- package/dist/components/btns/BtnMetamask.d.ts +23 -0
- package/dist/components/btns/BtnMicrosoft.d.ts +20 -0
- package/dist/components/btns/BtnPhantom.d.ts +23 -0
- package/dist/components/btns/BtnSignin.d.ts +10 -0
- package/dist/components/btns/BtnWalletConnect.d.ts +32 -0
- package/dist/components/contents/ContentSignin.d.ts +5 -0
- package/dist/components/contents/ContentSignup.d.ts +76 -0
- package/dist/components/contents/ContentSignupEditable.d.ts +14 -0
- package/dist/components/dds/ChangeAccountComponent.d.ts +8 -0
- package/dist/components/dds/DropdownProfile.d.ts +26 -0
- package/dist/components/dds/DropdownProfileBtn.d.ts +12 -0
- package/dist/components/dds/DropdownProfileItem.d.ts +12 -0
- package/dist/components/editables/FiltersEditable.d.ts +16 -0
- package/dist/components/editables/ProvidersButtonsDnD.d.ts +6 -0
- package/dist/components/editables/ProvidersButtonsDnDItem.d.ts +12 -0
- package/dist/components/editables/ProvidersButtonsEditable.d.ts +11 -0
- package/dist/components/editables/WrapperEditables.d.ts +14 -0
- package/dist/components/modals/ModalSignin.d.ts +5 -0
- package/dist/components/modals/ModalSignup.d.ts +6 -0
- package/dist/components/sections/FooterSection.d.ts +8 -0
- package/dist/components/sections/LoginSection.d.ts +16 -0
- package/dist/components/sections/ProvidersSection.d.ts +21 -0
- package/dist/components/sections/internals/ProvidersButtons.d.ts +24 -0
- package/dist/components/sections/internals/ProvidersFilters.d.ts +28 -0
- package/dist/components/sections/internals/SelectedButton.d.ts +8 -0
- package/dist/components/txns/TxnsOverview.d.ts +5 -0
- package/dist/components/txns/internals/PermissionsRequiredModal.d.ts +4 -0
- package/dist/components/txns/internals/Txn.d.ts +22 -0
- package/dist/components/txns/internals/TxnError.d.ts +12 -0
- package/dist/components/txns/internals/TxnType.d.ts +8 -0
- package/dist/helpers/helperUI.d.ts +454 -0
- package/dist/hooks/useBlockAuthWs.d.ts +1 -0
- package/dist/hooks/useBlockAuthWsData.d.ts +1 -0
- package/dist/hooks/useRaisedShadow.d.ts +1 -0
- package/dist/index-C2iHITkO.js +131 -0
- package/dist/index-C2iHITkO.js.map +1 -0
- package/dist/index-DVru6tLI.js +300 -0
- package/dist/index-DVru6tLI.js.map +1 -0
- package/dist/main-BYFXzpCj.js +109272 -0
- package/dist/main-BYFXzpCj.js.map +1 -0
- package/dist/main.css +1 -0
- package/dist/main.d.ts +22 -0
- package/dist/output.css +2322 -0
- package/dist/services/BrowserBase.d.ts +41 -0
- package/dist/services/Metamask.d.ts +37 -0
- package/dist/services/Microsoft.d.ts +26 -0
- package/dist/services/Phantom.d.ts +11 -0
- package/dist/services/WalletConnect.d.ts +29 -0
- package/dist/stores/useStoreExtension.d.ts +13 -0
- package/dist/stores/useStoreGoogle.d.ts +1 -0
- package/dist/stores/useStoreMetamask.d.ts +1 -0
- package/dist/stores/useStoreMicrosoft.d.ts +1 -0
- package/dist/stores/useStoreModals.d.ts +12 -0
- package/dist/stores/useStorePhantom.d.ts +1 -0
- package/dist/stores/useStoreUI.d.ts +116 -0
- package/dist/stores/useStoreWS.d.ts +21 -0
- package/dist/stores/useStoreWeb3Providers.d.ts +1 -0
- package/dist/w3m-modal-Df7g4196.js +348 -0
- package/dist/w3m-modal-Df7g4196.js.map +1 -0
- package/package.json +175 -0
- package/public/output.css +2322 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
reset(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Obtains the current configuration of the extension
|
|
5
|
+
* using the localStorage as a source of truth
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
getUI(): any;
|
|
9
|
+
/**
|
|
10
|
+
* Auxiliary method to update the UI configuration
|
|
11
|
+
* using websocket events
|
|
12
|
+
* @param {*} isLocked
|
|
13
|
+
*/
|
|
14
|
+
setUILocked(isLocked: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* Obtains the current configuration of the extension
|
|
17
|
+
* using the localStorage as a source of truth
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
getSession(): any;
|
|
21
|
+
/**
|
|
22
|
+
* Obtains the configuration about the address
|
|
23
|
+
* and the service where the user is connected
|
|
24
|
+
* @returns {Object} {
|
|
25
|
+
* connected, service, did,
|
|
26
|
+
* iconUrl, account, networkId
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
getExternalService(): any;
|
|
30
|
+
/**
|
|
31
|
+
* Auxiliary method to update the SESSION configuration
|
|
32
|
+
* using websocket events
|
|
33
|
+
* @param {*} isLocked
|
|
34
|
+
*/
|
|
35
|
+
setSession({ installed, isUser, isUserActive, isLocked, did, token, externalService, serviceName, }?: any): void;
|
|
36
|
+
externalServiceDisconnect(): void;
|
|
37
|
+
getLang(): string;
|
|
38
|
+
setLang(lang: any): void;
|
|
39
|
+
subscribe(callback: any): void;
|
|
40
|
+
};
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
rpcUrl: string;
|
|
3
|
+
rpcExplorerUrl: string;
|
|
4
|
+
events(): void;
|
|
5
|
+
ethereum: Record<string, unknown>;
|
|
6
|
+
destroy(): void;
|
|
7
|
+
onChainChanged(chainId: any): Promise<any>;
|
|
8
|
+
onAccountsChange(accounts: any): Promise<any>;
|
|
9
|
+
isUnlocked(providerType?: string): Promise<any>;
|
|
10
|
+
getProvider(providerType?: string): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* This method just works with extension provider
|
|
13
|
+
*/
|
|
14
|
+
getAccount(position?: number): Promise<any>;
|
|
15
|
+
getSigner(account: any, providerType?: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* docs: https://docs.ethers.io/v5/api/providers/provider/#Provider-getBalance
|
|
18
|
+
*/
|
|
19
|
+
getBalance(account: any, providerType?: string, blockTag?: any): Promise<any>;
|
|
20
|
+
getContract(contractAddr: any, contractAbi: any, providerType?: string): Promise<any>;
|
|
21
|
+
getContractWithSigner(contractAddr: any, contractAbi: any, account: any, providerType?: string): Promise<any>;
|
|
22
|
+
getContractFromConfig(contractName: any, providerType?: string): Promise<any>;
|
|
23
|
+
addChain({ chainName, chainId, currencyName, currencySymbol, explorerUrl, }: {
|
|
24
|
+
chainName?: string;
|
|
25
|
+
chainId?: number;
|
|
26
|
+
currencyName?: string;
|
|
27
|
+
currencySymbol?: string;
|
|
28
|
+
explorerUrl?: any;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
addToken(addr: any, symbol: any, imageUrl?: string, decimals?: number): Promise<void>;
|
|
31
|
+
getPaginated(account: any, contractAddr: any, contractAbi: any, pageSize?: number, minId?: number, maxId?: number, func?: string): Promise<any[]>;
|
|
32
|
+
getOwnedByAccount(sc: any, account: any, start: any, end: any): Promise<any[]>;
|
|
33
|
+
signMessage(message: any, account: any, pwd: any, providerType?: string): Promise<any>;
|
|
34
|
+
verifyMessage(message: any, signature: any, account: any, providerType?: string): Promise<any>;
|
|
35
|
+
getChainId(providerType?: string): Promise<any>;
|
|
36
|
+
};
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
clientId: string;
|
|
3
|
+
tenantId: string;
|
|
4
|
+
redirectUri: string;
|
|
5
|
+
msalConfig: {
|
|
6
|
+
auth: {
|
|
7
|
+
clientId: string;
|
|
8
|
+
authority: string;
|
|
9
|
+
redirectUri: string;
|
|
10
|
+
};
|
|
11
|
+
cache: {
|
|
12
|
+
cacheLocation: string;
|
|
13
|
+
storeAuthStateInCookie: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
msalInstance: PublicClientApplication;
|
|
17
|
+
getProvider({ clientId, tenantId, authorityMode, redirectUri, }: {
|
|
18
|
+
clientId?: string;
|
|
19
|
+
tenantId?: string;
|
|
20
|
+
authorityMode?: string;
|
|
21
|
+
redirectUri?: string;
|
|
22
|
+
}): Promise<PublicClientApplication>;
|
|
23
|
+
popupStart(instance?: any): Promise<any>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
26
|
+
import { PublicClientApplication } from '@azure/msal-browser';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
getProvider: () => any;
|
|
3
|
+
extension: any;
|
|
4
|
+
publicKeyString: any;
|
|
5
|
+
chainId: any;
|
|
6
|
+
getAccount(): Promise<any>;
|
|
7
|
+
getChainId(): Promise<string>;
|
|
8
|
+
signMessage(message: any, account: any): Promise<any>;
|
|
9
|
+
verifyMessage(message: any, signature: any): Promise<any>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
projectId: string;
|
|
3
|
+
metadata: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
url: string;
|
|
7
|
+
icons: string[];
|
|
8
|
+
};
|
|
9
|
+
networks: {
|
|
10
|
+
id: string;
|
|
11
|
+
chainId: number;
|
|
12
|
+
chainNamespace: string;
|
|
13
|
+
name: string;
|
|
14
|
+
currency: string;
|
|
15
|
+
explorerUrl: string;
|
|
16
|
+
rpcUrl: string;
|
|
17
|
+
}[];
|
|
18
|
+
init(): Promise<void>;
|
|
19
|
+
appKit: import("@reown/appkit").AppKit;
|
|
20
|
+
configuredNetworks(): Set<string>;
|
|
21
|
+
isConnected(): Promise<any>;
|
|
22
|
+
getConnectors(): Promise<any>;
|
|
23
|
+
getAccount(walletInfo: any): Promise<any>;
|
|
24
|
+
getChainId(): Promise<any>;
|
|
25
|
+
signMessage(message: any): Promise<any>;
|
|
26
|
+
verifyMessage(message: any, signature: any, publicKeyString: any): Promise<any>;
|
|
27
|
+
disconnect(): Promise<any>;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example of use on a component:
|
|
3
|
+
* import { useStoreExtension } from 'stores/useStoreExtension'
|
|
4
|
+
* function Component() {
|
|
5
|
+
* const { installed, } = useStoreExtension()
|
|
6
|
+
* return (
|
|
7
|
+
* <div>
|
|
8
|
+
* <p>installed: {installed}</p>
|
|
9
|
+
* </div>
|
|
10
|
+
* )
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export const useStoreExtension: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStoreGoogle: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStoreMetamask: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStoreMicrosoft: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example of use on a component:
|
|
3
|
+
* import { useStoreModals } from 'stores/useStoreModals'
|
|
4
|
+
* function Component() {
|
|
5
|
+
* const { modals, setModal } = useStoreModals()
|
|
6
|
+
* return (
|
|
7
|
+
* <div>
|
|
8
|
+
* {modals.name && modals.name.enabled && <NamedModal />}
|
|
9
|
+
* </div>
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export const useStoreModals: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStorePhantom: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export namespace initialState {
|
|
2
|
+
let isServiceConnected: boolean;
|
|
3
|
+
let serviceName: string;
|
|
4
|
+
let serviceIcon: string;
|
|
5
|
+
let isSdkSignedIn: boolean;
|
|
6
|
+
let isSigning: boolean;
|
|
7
|
+
let isSigned: boolean;
|
|
8
|
+
let isSignedFirstCheck: boolean;
|
|
9
|
+
function onSuccess(): Promise<void>;
|
|
10
|
+
function onError(): Promise<void>;
|
|
11
|
+
function onLogout(): Promise<void>;
|
|
12
|
+
namespace uiConfig {
|
|
13
|
+
namespace config {
|
|
14
|
+
namespace content {
|
|
15
|
+
namespace btns {
|
|
16
|
+
namespace connect {
|
|
17
|
+
let es: string;
|
|
18
|
+
let en: string;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
namespace description {
|
|
22
|
+
let es_1: string;
|
|
23
|
+
export { es_1 as es };
|
|
24
|
+
let en_1: string;
|
|
25
|
+
export { en_1 as en };
|
|
26
|
+
}
|
|
27
|
+
namespace footer {
|
|
28
|
+
namespace first {
|
|
29
|
+
let es_2: string;
|
|
30
|
+
export { es_2 as es };
|
|
31
|
+
let en_2: string;
|
|
32
|
+
export { en_2 as en };
|
|
33
|
+
}
|
|
34
|
+
namespace second {
|
|
35
|
+
let es_3: string;
|
|
36
|
+
export { es_3 as es };
|
|
37
|
+
let en_3: string;
|
|
38
|
+
export { en_3 as en };
|
|
39
|
+
}
|
|
40
|
+
let url: string;
|
|
41
|
+
}
|
|
42
|
+
namespace lastStep {
|
|
43
|
+
let es_4: string;
|
|
44
|
+
export { es_4 as es };
|
|
45
|
+
let en_4: string;
|
|
46
|
+
export { en_4 as en };
|
|
47
|
+
}
|
|
48
|
+
namespace login {
|
|
49
|
+
let es_5: string;
|
|
50
|
+
export { es_5 as es };
|
|
51
|
+
let en_5: string;
|
|
52
|
+
export { en_5 as en };
|
|
53
|
+
}
|
|
54
|
+
namespace title {
|
|
55
|
+
let es_6: string;
|
|
56
|
+
export { es_6 as es };
|
|
57
|
+
let en_6: string;
|
|
58
|
+
export { en_6 as en };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let enableSearch: boolean;
|
|
62
|
+
let enableWebTypeFilter: boolean;
|
|
63
|
+
let providersColumns: number;
|
|
64
|
+
namespace providers {
|
|
65
|
+
namespace blockauth {
|
|
66
|
+
let enabled: boolean;
|
|
67
|
+
let orderIndex: number;
|
|
68
|
+
}
|
|
69
|
+
namespace google {
|
|
70
|
+
let enabled_1: boolean;
|
|
71
|
+
export { enabled_1 as enabled };
|
|
72
|
+
let orderIndex_1: number;
|
|
73
|
+
export { orderIndex_1 as orderIndex };
|
|
74
|
+
}
|
|
75
|
+
namespace microsoft {
|
|
76
|
+
let enabled_2: boolean;
|
|
77
|
+
export { enabled_2 as enabled };
|
|
78
|
+
let orderIndex_2: number;
|
|
79
|
+
export { orderIndex_2 as orderIndex };
|
|
80
|
+
}
|
|
81
|
+
namespace metamask {
|
|
82
|
+
let enabled_3: boolean;
|
|
83
|
+
export { enabled_3 as enabled };
|
|
84
|
+
let orderIndex_3: number;
|
|
85
|
+
export { orderIndex_3 as orderIndex };
|
|
86
|
+
}
|
|
87
|
+
namespace phantom {
|
|
88
|
+
let enabled_4: boolean;
|
|
89
|
+
export { enabled_4 as enabled };
|
|
90
|
+
let orderIndex_4: number;
|
|
91
|
+
export { orderIndex_4 as orderIndex };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
let showProviderNameOnMobile: boolean;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
let waitingForSuccessLogInSince: number;
|
|
98
|
+
let isAcceptingTxn: boolean;
|
|
99
|
+
let isSigningLoader: boolean;
|
|
100
|
+
let isAppActive: boolean;
|
|
101
|
+
let checkApp: boolean;
|
|
102
|
+
let isCheckingAppActive: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Example of use on a component:
|
|
106
|
+
* import { useStoreUI } from 'stores/useStoreUI'
|
|
107
|
+
* function Component() {
|
|
108
|
+
* const serviceName = useStoreUI((state) => state.serviceName)
|
|
109
|
+
* return (
|
|
110
|
+
* <div>
|
|
111
|
+
* <p>serviceName: {serviceName}</p>
|
|
112
|
+
* </div>
|
|
113
|
+
* )
|
|
114
|
+
* }
|
|
115
|
+
*/
|
|
116
|
+
export const useStoreUI: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example of use on a component:
|
|
3
|
+
* import { useStoreWS } from 'stores/useStoreWS'
|
|
4
|
+
* function Component() {
|
|
5
|
+
* const { socket, token, } = useStoreWS()
|
|
6
|
+
* return (
|
|
7
|
+
* <div>
|
|
8
|
+
* <button onClick={
|
|
9
|
+
* () => socket.emit('requests', { token })
|
|
10
|
+
* >
|
|
11
|
+
* Get Current requests
|
|
12
|
+
* </button>
|
|
13
|
+
* </div>
|
|
14
|
+
* <ul>
|
|
15
|
+
* {requests.map((request) => (
|
|
16
|
+
* <li key={request.id}>{request.id}</li>
|
|
17
|
+
* ))}
|
|
18
|
+
* </ul>
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export const useStoreWS: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStoreWeb3Providers: import("zustand").UseBoundStore<import("zustand").StoreApi<any>>;
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { i, b as r, M as ModalController, C as ChainController, O as OptionsController, aN as ApiController, A as AccountController, E as EventsController, x, R as RouterController, U as UiHelperUtil, j as initializeTheming, S as SnackController, aO as CoreHelperUtil, aP as ConstantsUtil, d as r$1, c as customElement, aQ as ThemeController } from "./main-BYFXzpCj.js";
|
|
2
|
+
const styles = i`
|
|
3
|
+
:host {
|
|
4
|
+
z-index: var(--w3m-z-index);
|
|
5
|
+
display: block;
|
|
6
|
+
backface-visibility: hidden;
|
|
7
|
+
will-change: opacity;
|
|
8
|
+
position: fixed;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
background-color: var(--wui-cover);
|
|
16
|
+
transition: opacity 0.2s var(--wui-ease-out-power-2);
|
|
17
|
+
will-change: opacity;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(.open) {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
wui-card {
|
|
25
|
+
max-width: var(--w3m-modal-width);
|
|
26
|
+
width: 100%;
|
|
27
|
+
position: relative;
|
|
28
|
+
animation: zoom-in 0.2s var(--wui-ease-out-power-2);
|
|
29
|
+
animation-fill-mode: backwards;
|
|
30
|
+
outline: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
wui-card[shake='true'] {
|
|
34
|
+
animation:
|
|
35
|
+
zoom-in 0.2s var(--wui-ease-out-power-2),
|
|
36
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
wui-flex {
|
|
40
|
+
overflow-x: hidden;
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (max-height: 700px) and (min-width: 431px) {
|
|
50
|
+
wui-flex {
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
wui-card {
|
|
55
|
+
margin: var(--wui-spacing-xxl) 0px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (max-width: 430px) {
|
|
60
|
+
wui-flex {
|
|
61
|
+
align-items: flex-end;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
wui-card {
|
|
65
|
+
max-width: 100%;
|
|
66
|
+
border-bottom-left-radius: 0;
|
|
67
|
+
border-bottom-right-radius: 0;
|
|
68
|
+
border-bottom: none;
|
|
69
|
+
animation: slide-in 0.2s var(--wui-ease-out-power-2);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
wui-card[shake='true'] {
|
|
73
|
+
animation:
|
|
74
|
+
slide-in 0.2s var(--wui-ease-out-power-2),
|
|
75
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes zoom-in {
|
|
80
|
+
0% {
|
|
81
|
+
transform: scale(0.95) translateY(0);
|
|
82
|
+
}
|
|
83
|
+
100% {
|
|
84
|
+
transform: scale(1) translateY(0);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@keyframes slide-in {
|
|
89
|
+
0% {
|
|
90
|
+
transform: scale(1) translateY(50px);
|
|
91
|
+
}
|
|
92
|
+
100% {
|
|
93
|
+
transform: scale(1) translateY(0);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes w3m-shake {
|
|
98
|
+
0% {
|
|
99
|
+
transform: scale(1) rotate(0deg);
|
|
100
|
+
}
|
|
101
|
+
20% {
|
|
102
|
+
transform: scale(1) rotate(-1deg);
|
|
103
|
+
}
|
|
104
|
+
40% {
|
|
105
|
+
transform: scale(1) rotate(1.5deg);
|
|
106
|
+
}
|
|
107
|
+
60% {
|
|
108
|
+
transform: scale(1) rotate(-1.5deg);
|
|
109
|
+
}
|
|
110
|
+
80% {
|
|
111
|
+
transform: scale(1) rotate(1deg);
|
|
112
|
+
}
|
|
113
|
+
100% {
|
|
114
|
+
transform: scale(1) rotate(0deg);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@keyframes w3m-view-height {
|
|
119
|
+
from {
|
|
120
|
+
height: var(--prev-height);
|
|
121
|
+
}
|
|
122
|
+
to {
|
|
123
|
+
height: var(--new-height);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
127
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
128
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
129
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
130
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
131
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
132
|
+
};
|
|
133
|
+
const SCROLL_LOCK = "scroll-lock";
|
|
134
|
+
let W3mModal = class W3mModal2 extends r {
|
|
135
|
+
constructor() {
|
|
136
|
+
super();
|
|
137
|
+
this.unsubscribe = [];
|
|
138
|
+
this.abortController = void 0;
|
|
139
|
+
this.open = ModalController.state.open;
|
|
140
|
+
this.caipAddress = ChainController.state.activeCaipAddress;
|
|
141
|
+
this.caipNetwork = ChainController.state.activeCaipNetwork;
|
|
142
|
+
this.isSiweEnabled = OptionsController.state.isSiweEnabled;
|
|
143
|
+
this.shake = ModalController.state.shake;
|
|
144
|
+
this.initializeTheming();
|
|
145
|
+
ApiController.prefetch();
|
|
146
|
+
this.unsubscribe.push(...[
|
|
147
|
+
ModalController.subscribeKey("open", (val) => val ? this.onOpen() : this.onClose()),
|
|
148
|
+
ModalController.subscribeKey("shake", (val) => this.shake = val),
|
|
149
|
+
AccountController.subscribeKey("siweStatus", (val) => this.onSiweStatusChange(val), "eip155"),
|
|
150
|
+
ChainController.subscribeKey("activeCaipNetwork", (val) => this.onNewNetwork(val)),
|
|
151
|
+
ChainController.subscribeKey("activeCaipAddress", (val) => this.onNewAddress(val)),
|
|
152
|
+
OptionsController.subscribeKey("isSiweEnabled", (val) => this.isSiweEnabled = val)
|
|
153
|
+
]);
|
|
154
|
+
EventsController.sendEvent({ type: "track", event: "MODAL_LOADED" });
|
|
155
|
+
}
|
|
156
|
+
disconnectedCallback() {
|
|
157
|
+
this.unsubscribe.forEach((unsubscribe) => unsubscribe());
|
|
158
|
+
this.onRemoveKeyboardListener();
|
|
159
|
+
}
|
|
160
|
+
render() {
|
|
161
|
+
return this.open ? x`
|
|
162
|
+
<wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
|
|
163
|
+
<wui-card
|
|
164
|
+
shake="${this.shake}"
|
|
165
|
+
role="alertdialog"
|
|
166
|
+
aria-modal="true"
|
|
167
|
+
tabindex="0"
|
|
168
|
+
data-testid="w3m-modal-card"
|
|
169
|
+
>
|
|
170
|
+
<w3m-header></w3m-header>
|
|
171
|
+
<w3m-router></w3m-router>
|
|
172
|
+
<w3m-snackbar></w3m-snackbar>
|
|
173
|
+
<w3m-alertbar></w3m-alertbar>
|
|
174
|
+
</wui-card>
|
|
175
|
+
</wui-flex>
|
|
176
|
+
<w3m-tooltip></w3m-tooltip>
|
|
177
|
+
` : null;
|
|
178
|
+
}
|
|
179
|
+
async onOverlayClick(event) {
|
|
180
|
+
if (event.target === event.currentTarget) {
|
|
181
|
+
await this.handleClose();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async handleClose() {
|
|
185
|
+
const isSiweSignScreen = RouterController.state.view === "ConnectingSiwe";
|
|
186
|
+
const isApproveSignScreen = RouterController.state.view === "ApproveTransaction";
|
|
187
|
+
if (this.isSiweEnabled) {
|
|
188
|
+
const { SIWEController } = await import("./index-DVru6tLI.js");
|
|
189
|
+
const isUnauthenticated = SIWEController.state.status !== "success";
|
|
190
|
+
if (isUnauthenticated && (isSiweSignScreen || isApproveSignScreen)) {
|
|
191
|
+
ModalController.shake();
|
|
192
|
+
} else {
|
|
193
|
+
ModalController.close();
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
ModalController.close();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
initializeTheming() {
|
|
200
|
+
const { themeVariables, themeMode } = ThemeController.state;
|
|
201
|
+
const defaultThemeMode = UiHelperUtil.getColorTheme(themeMode);
|
|
202
|
+
initializeTheming(themeVariables, defaultThemeMode);
|
|
203
|
+
}
|
|
204
|
+
onClose() {
|
|
205
|
+
this.open = false;
|
|
206
|
+
this.classList.remove("open");
|
|
207
|
+
this.onScrollUnlock();
|
|
208
|
+
SnackController.hide();
|
|
209
|
+
this.onRemoveKeyboardListener();
|
|
210
|
+
}
|
|
211
|
+
onOpen() {
|
|
212
|
+
this.open = true;
|
|
213
|
+
this.classList.add("open");
|
|
214
|
+
this.onScrollLock();
|
|
215
|
+
this.onAddKeyboardListener();
|
|
216
|
+
}
|
|
217
|
+
onScrollLock() {
|
|
218
|
+
const styleTag = document.createElement("style");
|
|
219
|
+
styleTag.dataset["w3m"] = SCROLL_LOCK;
|
|
220
|
+
styleTag.textContent = `
|
|
221
|
+
body {
|
|
222
|
+
touch-action: none;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
overscroll-behavior: contain;
|
|
225
|
+
}
|
|
226
|
+
w3m-modal {
|
|
227
|
+
pointer-events: auto;
|
|
228
|
+
}
|
|
229
|
+
`;
|
|
230
|
+
document.head.appendChild(styleTag);
|
|
231
|
+
}
|
|
232
|
+
onScrollUnlock() {
|
|
233
|
+
const styleTag = document.head.querySelector(`style[data-w3m="${SCROLL_LOCK}"]`);
|
|
234
|
+
if (styleTag) {
|
|
235
|
+
styleTag.remove();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
onAddKeyboardListener() {
|
|
239
|
+
var _a;
|
|
240
|
+
this.abortController = new AbortController();
|
|
241
|
+
const card = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("wui-card");
|
|
242
|
+
card == null ? void 0 : card.focus();
|
|
243
|
+
window.addEventListener("keydown", (event) => {
|
|
244
|
+
if (event.key === "Escape") {
|
|
245
|
+
this.handleClose();
|
|
246
|
+
} else if (event.key === "Tab") {
|
|
247
|
+
const { tagName } = event.target;
|
|
248
|
+
if (tagName && !tagName.includes("W3M-") && !tagName.includes("WUI-")) {
|
|
249
|
+
card == null ? void 0 : card.focus();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, this.abortController);
|
|
253
|
+
}
|
|
254
|
+
onRemoveKeyboardListener() {
|
|
255
|
+
var _a;
|
|
256
|
+
(_a = this.abortController) == null ? void 0 : _a.abort();
|
|
257
|
+
this.abortController = void 0;
|
|
258
|
+
}
|
|
259
|
+
onSiweStatusChange(nextStatus) {
|
|
260
|
+
if (nextStatus === "success") {
|
|
261
|
+
ModalController.close();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async onNewAddress(caipAddress) {
|
|
265
|
+
var _a;
|
|
266
|
+
const prevConnected = this.caipAddress ? CoreHelperUtil.getPlainAddress(this.caipAddress) : void 0;
|
|
267
|
+
const nextConnected = caipAddress ? CoreHelperUtil.getPlainAddress(caipAddress) : void 0;
|
|
268
|
+
const isSameAddress = prevConnected === nextConnected;
|
|
269
|
+
if (nextConnected && !isSameAddress && this.isSiweEnabled) {
|
|
270
|
+
const { SIWEController } = await import("./index-DVru6tLI.js");
|
|
271
|
+
const signed = AccountController.state.siweStatus === "success";
|
|
272
|
+
if (!prevConnected && nextConnected) {
|
|
273
|
+
this.onSiweNavigation();
|
|
274
|
+
} else if (signed && prevConnected && nextConnected && prevConnected !== nextConnected) {
|
|
275
|
+
if ((_a = SIWEController.state._client) == null ? void 0 : _a.options.signOutOnAccountChange) {
|
|
276
|
+
await SIWEController.signOut();
|
|
277
|
+
this.onSiweNavigation();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (!nextConnected) {
|
|
282
|
+
ModalController.close();
|
|
283
|
+
}
|
|
284
|
+
this.caipAddress = caipAddress;
|
|
285
|
+
}
|
|
286
|
+
async onNewNetwork(nextCaipNetwork) {
|
|
287
|
+
var _a, _b, _c, _d;
|
|
288
|
+
if (!this.caipAddress) {
|
|
289
|
+
this.caipNetwork = nextCaipNetwork;
|
|
290
|
+
RouterController.goBack();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const prevCaipNetworkId = (_b = (_a = this.caipNetwork) == null ? void 0 : _a.id) == null ? void 0 : _b.toString();
|
|
294
|
+
const nextNetworkId = (_c = nextCaipNetwork == null ? void 0 : nextCaipNetwork.id) == null ? void 0 : _c.toString();
|
|
295
|
+
if (prevCaipNetworkId && nextNetworkId && prevCaipNetworkId !== nextNetworkId) {
|
|
296
|
+
if (this.isSiweEnabled) {
|
|
297
|
+
const { SIWEController } = await import("./index-DVru6tLI.js");
|
|
298
|
+
if ((_d = SIWEController.state._client) == null ? void 0 : _d.options.signOutOnNetworkChange) {
|
|
299
|
+
await SIWEController.signOut();
|
|
300
|
+
this.onSiweNavigation();
|
|
301
|
+
} else {
|
|
302
|
+
RouterController.goBack();
|
|
303
|
+
}
|
|
304
|
+
} else {
|
|
305
|
+
RouterController.goBack();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
this.caipNetwork = nextCaipNetwork;
|
|
309
|
+
}
|
|
310
|
+
onSiweNavigation() {
|
|
311
|
+
const isEIP155Namespace = ChainController.state.activeChain === ConstantsUtil.CHAIN.EVM;
|
|
312
|
+
const authenticated = AccountController.state.siweStatus === "success";
|
|
313
|
+
if (!authenticated && isEIP155Namespace) {
|
|
314
|
+
if (this.open) {
|
|
315
|
+
RouterController.replace("ConnectingSiwe");
|
|
316
|
+
} else {
|
|
317
|
+
ModalController.open({
|
|
318
|
+
view: "ConnectingSiwe"
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
RouterController.goBack();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
W3mModal.styles = styles;
|
|
327
|
+
__decorate([
|
|
328
|
+
r$1()
|
|
329
|
+
], W3mModal.prototype, "open", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
r$1()
|
|
332
|
+
], W3mModal.prototype, "caipAddress", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
r$1()
|
|
335
|
+
], W3mModal.prototype, "caipNetwork", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
r$1()
|
|
338
|
+
], W3mModal.prototype, "isSiweEnabled", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
r$1()
|
|
341
|
+
], W3mModal.prototype, "shake", void 0);
|
|
342
|
+
W3mModal = __decorate([
|
|
343
|
+
customElement("w3m-modal")
|
|
344
|
+
], W3mModal);
|
|
345
|
+
export {
|
|
346
|
+
W3mModal
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=w3m-modal-Df7g4196.js.map
|