@multiversx/sdk-dapp-liquidity 1.0.12 → 1.0.14
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/ConstantsUtil-BinYIDR2.mjs +8 -0
- package/ConstantsUtil-CbnVdQ5P.js +8 -0
- package/add-D-ECcdUh.mjs +19 -0
- package/add-Diz8heiY.js +20 -0
- package/all-wallets-_iOQf3bl.js +11 -0
- package/all-wallets-puIIQy3Y.mjs +10 -0
- package/app-store-BGTKFL27.js +22 -0
- package/app-store-Bsf7w3pv.mjs +21 -0
- package/apple-Cw8e8IGH.mjs +22 -0
- package/apple-DF7n_Yzl.js +23 -0
- package/arrow-bottom-Cp2C4fQv.mjs +12 -0
- package/arrow-bottom-DTvIR3s3.js +13 -0
- package/arrow-bottom-circle-CN6i5mHz.mjs +15 -0
- package/arrow-bottom-circle-CzPwiwWH.js +16 -0
- package/arrow-left-9VFYHQSW.js +13 -0
- package/arrow-left-BDQHoEvX.mjs +12 -0
- package/arrow-right-BxkuSpWU.mjs +12 -0
- package/arrow-right-DBLQ6w92.js +13 -0
- package/arrow-top-BiQd5Aey.js +13 -0
- package/arrow-top-BrLVX4Rj.mjs +12 -0
- package/bank-B7EC6Kdz.mjs +18 -0
- package/bank-CvPn9sfV.js +19 -0
- package/{bignumber-CKZkoo0g.mjs → bignumber-2Z7uapuD.mjs} +6 -6
- package/{bignumber-B8vjg9qn.js → bignumber-D1Wl54dL.js} +6 -6
- package/bin-BXO1kNZh.js +9 -0
- package/bin-CwiYVJ1L.mjs +8 -0
- package/bitcoin-C3kBVar_.mjs +17 -0
- package/bitcoin-DAvQGpeP.js +3251 -0
- package/bitcoin-dNBGbS2B.mjs +3251 -0
- package/bitcoin-k6bvmzMA.js +18 -0
- package/browser-ShRLuKKz.mjs +18 -0
- package/browser-t7nfT7HL.js +19 -0
- package/card-BJg5bdoM.mjs +18 -0
- package/card-hxUDXttT.js +19 -0
- package/checkmark-BpR0Yy93.mjs +15 -0
- package/checkmark-D9AVWgl5.js +16 -0
- package/checkmark-bold-D3Xcby1U.mjs +12 -0
- package/checkmark-bold-De02hde8.js +13 -0
- package/chevron-bottom-DcBf7T5F.js +13 -0
- package/chevron-bottom-DfGpWIz7.mjs +12 -0
- package/chevron-left-BKvYVnUo.js +13 -0
- package/chevron-left-DGSG9WJQ.mjs +12 -0
- package/chevron-right-BLgYIEeO.js +13 -0
- package/chevron-right-C2nsTx_Y.mjs +12 -0
- package/chevron-top-CwFOEFy8.js +13 -0
- package/chevron-top-vk-9DvUU.mjs +12 -0
- package/chrome-store-4H_ie3vA.mjs +65 -0
- package/chrome-store-BWarxVMl.js +66 -0
- package/circle-BtqWJU0_.mjs +8 -0
- package/circle-DYjG6o7-.js +9 -0
- package/clock-Ba5SM-pl.mjs +12 -0
- package/clock-DPzNREdU.js +13 -0
- package/close-CJHKFOyp.mjs +12 -0
- package/close-DDWnJdJe.js +13 -0
- package/coinPlaceholder-Cbba3D1H.mjs +12 -0
- package/coinPlaceholder-DdxQIc2D.js +13 -0
- package/compass-CugCxeSC.js +13 -0
- package/compass-DbN5DkTl.mjs +12 -0
- package/copy-CHSZprYJ.mjs +19 -0
- package/copy-En5h5Uhu.js +20 -0
- package/cursor-DCRkvEhr.mjs +7 -0
- package/cursor-DnEQtrUK.js +8 -0
- package/cursor-transparent-CU8lk-xg.js +17 -0
- package/cursor-transparent-CliETg4d.mjs +16 -0
- package/desktop-BgD7aypB.js +14 -0
- package/desktop-Cg5I32-p.mjs +13 -0
- package/disconnect-CCyMbAdw.js +13 -0
- package/disconnect-Cp2vRWB2.mjs +12 -0
- package/discord-B1d-qeSk.mjs +21 -0
- package/discord-BEB5klec.js +22 -0
- package/email-CorlePKz.js +873 -0
- package/email-Znno7H8_.mjs +878 -0
- package/embedded-wallet-B9ro9Tel.js +549 -0
- package/embedded-wallet-CnTWeseG.mjs +552 -0
- package/ethereum-BRcsRjUU.mjs +14 -0
- package/ethereum-CZ_xe09e.js +15 -0
- package/etherscan-BZKGpKp8.mjs +10 -0
- package/etherscan-DtLi-C3z.js +11 -0
- package/exclamation-triangle-BLNnBLEc.js +9 -0
- package/exclamation-triangle-CFThXxRT.mjs +8 -0
- package/extension-CwUepr-W.mjs +12 -0
- package/extension-DOD67G1k.js +13 -0
- package/external-link-CZkQS5XK.js +13 -0
- package/external-link-ClYNKSPt.mjs +12 -0
- package/facebook-CFjrd4my.mjs +30 -0
- package/facebook-CbE6K6AK.js +31 -0
- package/farcaster-Ba7_C-Vm.js +17 -0
- package/farcaster-DyVJtVS9.mjs +16 -0
- package/filters-CpHaFNjT.mjs +12 -0
- package/filters-w5LC-r6e.js +13 -0
- package/github-CeO70C3E.mjs +22 -0
- package/github-uLFBWAa5.js +23 -0
- package/google-CyOdUlbw.mjs +22 -0
- package/google-ILGK-opP.js +23 -0
- package/help-circle-Dh3dRNoB.mjs +16 -0
- package/help-circle-HUMbz_KN.js +17 -0
- package/id-Cy3Qkrvb.js +17 -0
- package/id-D-Q0uPFM.mjs +16 -0
- package/if-defined-CJ5EZLw2.js +815 -0
- package/if-defined-DjC5UMfF.mjs +815 -0
- package/image-BTGOf8bb.mjs +8 -0
- package/image-WFQO5bWa.js +9 -0
- package/index--O5ypTeK.mjs +70 -0
- package/index--Vg7VI9t.js +173 -0
- package/index-2iRSO1sa.mjs +9964 -0
- package/index-42Rpweo5.mjs +95 -0
- package/index-70kjE43k.mjs +90 -0
- package/index-8VyNYS01.js +273 -0
- package/index-B-dx8l0g.mjs +82 -0
- package/index-BB0nW9RB.mjs +198 -0
- package/index-BBwuv2SS.js +97 -0
- package/index-BIe-kofv.mjs +273 -0
- package/index-BQf6VHil.js +278 -0
- package/index-BWIZXhFv.mjs +630 -0
- package/index-BXkamf-I.js +337 -0
- package/index-BYTxCmKH.js +64 -0
- package/index-BYoOxo0S.js +218 -0
- package/index-Ba0tVdql.js +200 -0
- package/index-BdOAPWyt.mjs +210 -0
- package/index-BirWzf8c.mjs +71 -0
- package/index-BnCJUHtW.mjs +346 -0
- package/index-BuL2FC61.mjs +216 -0
- package/index-BxSUTfaY.js +88 -0
- package/index-C49C5Rxf.js +743 -0
- package/index-CNMDBpW7.js +346 -0
- package/index-CP0CGjqQ.mjs +263 -0
- package/index-CQaHcTZM.mjs +86 -0
- package/index-CRGXQei1.js +178 -0
- package/index-CSykUIfV.mjs +176 -0
- package/index-CWIHaLkQ.mjs +101 -0
- package/index-CZSDJd0P.mjs +1070 -0
- package/index-CZaV8JgR.mjs +49 -0
- package/index-CZjdy6QP.js +101 -0
- package/index-C_lIGGlC.js +632 -0
- package/index-CcgeRPs2.mjs +57 -0
- package/index-CeY_DRuc.js +566 -0
- package/index-ChFNkSxT.js +92 -0
- package/index-CkjZc20w.js +677 -0
- package/index-CtFcWwAd.js +72 -0
- package/index-D0mOfznC.mjs +362 -0
- package/index-DAtWLY21.js +84 -0
- package/index-DEs8H3w2.js +262 -0
- package/index-DLnxotbC.mjs +566 -0
- package/index-DN4fGDgg.mjs +743 -0
- package/index-DT_mc1hV.mjs +335 -0
- package/index-DZEwxUMS.js +59 -0
- package/index-DaRH_4bD.js +9939 -0
- package/index-Daok2ZKn.js +73 -0
- package/index-DomzHmwk.js +210 -0
- package/index-Dx7NyDyv.mjs +101 -0
- package/index-DyGir6_2.mjs +675 -0
- package/index-GglJmM2C.js +2237 -0
- package/index-H5b7UTeJ.mjs +173 -0
- package/index-NNZ1lNuc.mjs +168 -0
- package/index-RJd-gQcv.mjs +2235 -0
- package/index-dnFzVpGy.js +103 -0
- package/index-kwVLu8EV.js +168 -0
- package/index-miQwZPmn.js +51 -0
- package/index-oCj_SpOa.mjs +62 -0
- package/index-pNK-h_x9.js +1069 -0
- package/index-r6Kre1rx.js +362 -0
- package/index-xBD0nXoB.mjs +276 -0
- package/index.js +3 -3
- package/index.mjs +3 -3
- package/info-BKNAiN0k.js +8 -0
- package/info-DQE0s-A4.mjs +7 -0
- package/info-circle-C3uTocjH.js +17 -0
- package/info-circle-CIn6yeQo.mjs +16 -0
- package/lightbulb-CB-BmIop.js +8 -0
- package/lightbulb-Gv7IbnzO.mjs +7 -0
- package/mail-CFYm95wn.mjs +12 -0
- package/mail-GEwk-Fzr.js +13 -0
- package/mobile-CZ7ZBfa5.js +14 -0
- package/mobile-OIbnpFsU.mjs +13 -0
- package/more-C8N_RV55.mjs +15 -0
- package/more-CiQpPZwq.js +16 -0
- package/network-placeholder-CxEcczEx.mjs +18 -0
- package/network-placeholder-DwR8E8hP.js +19 -0
- package/nftPlaceholder-BFexVcGX.js +13 -0
- package/nftPlaceholder-MiYL110I.mjs +12 -0
- package/off-BNiMlpUU.mjs +8 -0
- package/off-iJHSK3Z7.js +9 -0
- package/onramp-Bs8HHFFY.js +1474 -0
- package/onramp-C6fuQfX7.mjs +1480 -0
- package/package.json +11 -11
- package/play-store-B4ssIYUA.js +37 -0
- package/play-store-D6nmQXhX.mjs +36 -0
- package/plus-Bh7z7Oc0.js +18 -0
- package/plus-C8ioZuCD.mjs +17 -0
- package/qr-code-CSVwaBLf.mjs +10 -0
- package/qr-code-YgtXPokK.js +11 -0
- package/react-BWxe90Ar.mjs +6342 -0
- package/react-BzZcQig5.js +6342 -0
- package/react-C_wTMVq_.js +23003 -0
- package/react-M-DnxvZl.mjs +23003 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +2 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +2 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.js +3 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +3 -2
- package/reactjs/components/Connect/CustomConnectButton.js +3 -2
- package/reactjs/components/Connect/CustomConnectButton.mjs +3 -2
- package/reactjs/components/Connect/SwitchChainButton.js +4 -3
- package/reactjs/components/Connect/SwitchChainButton.mjs +4 -3
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -1
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +1 -1
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +1 -1
- package/reactjs/hooks/useAccount.d.ts +4 -4
- package/reactjs/hooks/useAccount.js +3 -2
- package/reactjs/hooks/useAccount.mjs +3 -2
- package/reactjs/hooks/useGetChainId.js +1 -1
- package/reactjs/hooks/useGetChainId.mjs +1 -1
- package/reactjs/index.js +3 -3
- package/reactjs/index.mjs +3 -3
- package/reactjs/init/init.js +4 -3
- package/reactjs/init/init.mjs +4 -3
- package/reactjs/init/tests/init.spec.js +2 -2
- package/reactjs/init/tests/init.spec.mjs +2 -2
- package/reactjs/queries/useGetEvmTokensBalances.query.js +3 -2
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +3 -2
- package/reactjs/reexports.js +3 -3
- package/reactjs/reexports.mjs +3 -3
- package/reactjs/utils/getCleanStringAmount.js +1 -1
- package/reactjs/utils/getCleanStringAmount.mjs +1 -1
- package/reactjs/utils/hasEnoughFunds.js +1 -1
- package/reactjs/utils/hasEnoughFunds.mjs +1 -1
- package/reactjs/utils/isStringFloat.js +1 -1
- package/reactjs/utils/isStringFloat.mjs +1 -1
- package/reactjs/utils/roundAmount.js +1 -1
- package/reactjs/utils/roundAmount.mjs +1 -1
- package/receive-CK0hRQPr.js +212 -0
- package/receive-CQcD6bZf.mjs +212 -0
- package/recycle-horizontal--x5cMoTE.js +14 -0
- package/recycle-horizontal-QI0xtDHK.mjs +13 -0
- package/ref-CqxfRkBm.mjs +41 -0
- package/ref-FGI2cUQB.js +41 -0
- package/refresh-CFNHjhDi.js +13 -0
- package/refresh-CSOC1NUY.mjs +12 -0
- package/reown-logo-BfU5xFX5.js +17 -0
- package/reown-logo-CZAEp1jU.mjs +16 -0
- package/search-Do_rb-9-.mjs +12 -0
- package/search-V9CGMHkm.js +13 -0
- package/send-D-5G7tDL.mjs +1204 -0
- package/send-D4yYsIHV.mjs +19 -0
- package/send-DoiSHLsX.js +1202 -0
- package/send-_jfNFrys.js +20 -0
- package/socials-BL7-97fT.mjs +758 -0
- package/socials-DF0CK9cN.js +756 -0
- package/solana-BQ0Jh8lh.js +18 -0
- package/solana-YAkDp6j_.mjs +17 -0
- package/swapHorizontal-DOIo-Ccx.mjs +12 -0
- package/swapHorizontal-OHKtz4Gu.js +13 -0
- package/swapHorizontalBold-D7QmFj-c.js +13 -0
- package/swapHorizontalBold-DDroA0Af.mjs +12 -0
- package/swapHorizontalMedium-CU_v0kFz.mjs +20 -0
- package/swapHorizontalMedium-D-yMmtml.js +21 -0
- package/swapHorizontalRoundedBold-CHvbmnjw.js +13 -0
- package/swapHorizontalRoundedBold-DXMH0sgK.mjs +12 -0
- package/swapVertical-CH7fTK6w.js +13 -0
- package/swapVertical-HJZ6rFcr.mjs +12 -0
- package/swaps-CETflhdU.js +1952 -0
- package/swaps-DRUV6d3p.mjs +1954 -0
- package/telegram-CsCauOwj.mjs +20 -0
- package/telegram-DKEcF_Tq.js +21 -0
- package/three-dots-B-7hr8Nl.js +10 -0
- package/three-dots-LNZ_fjP7.mjs +9 -0
- package/transactions-BTTsGV2W.mjs +37 -0
- package/transactions-mpNNlClw.js +37 -0
- package/twitch-CCWVT2ij.js +23 -0
- package/twitch-Dg1CCQvd.mjs +22 -0
- package/twitterIcon-BjR09Cj9.mjs +10 -0
- package/twitterIcon-CeEs0iDJ.js +11 -0
- package/verify-B8WZq7kt.mjs +12 -0
- package/verify-filled-BeqC1imk.mjs +12 -0
- package/verify-filled-C-mv3ApD.js +13 -0
- package/verify-yATdPqt-.js +13 -0
- package/w3m-modal-3GziKj7h.js +1254 -0
- package/w3m-modal-81Z5PngE.mjs +1255 -0
- package/wallet-BMXEH23x.js +13 -0
- package/wallet-CNAVQCfm.mjs +12 -0
- package/wallet-placeholder-CQ-7CmVN.mjs +18 -0
- package/wallet-placeholder-CdoQy2e6.js +19 -0
- package/walletconnect-ACr-R1QZ.mjs +38 -0
- package/walletconnect-BWSkiS2F.js +39 -0
- package/warning-circle-CYnuYwpt.js +17 -0
- package/warning-circle-HV2lOiCj.mjs +16 -0
- package/x-CW5dozRj.js +17 -0
- package/x-Cgm2OFpL.mjs +16 -0
- package/x-mark-CR8SpZvu.js +8 -0
- package/x-mark-u0KJjUJ1.mjs +7 -0
- package/index-B4Eq5P3w.mjs +0 -91
- package/index-C4WV9nam.js +0 -329
- package/index-CWMcKi_X.js +0 -107
- package/index-D8E0O3qL.mjs +0 -68744
- package/index-DJ8CdHSw.mjs +0 -107
- package/index-nigVQYBu.js +0 -68665
- package/react-C43nEIqn.js +0 -3133
- package/react-DKUsVej7.js +0 -50
- package/react-Dp0H8q2z.mjs +0 -50
- package/react-wMhOUFOm.mjs +0 -3133
- package/w3m-modal-DLyg7Voy.js +0 -356
- package/w3m-modal-hC-B8qZP.mjs +0 -356
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
import { i, c as resetStyles, e as elementStyles, f as i$1, x } from "./bitcoin-dNBGbS2B.mjs";
|
|
2
|
+
import { n, c as customElement, r, U as UiHelperUtil } from "./if-defined-DjC5UMfF.mjs";
|
|
3
|
+
import "./index-CcgeRPs2.mjs";
|
|
4
|
+
import "./index-Dx7NyDyv.mjs";
|
|
5
|
+
import { b as W3mFrameHelpers, C as ConstantsUtil } from "./react-M-DnxvZl.mjs";
|
|
6
|
+
import { R as RouterController, k as ConnectorController, d as CoreHelperUtil, S as SnackController, E as EventsController, C as ConnectionController, c as ChainController, O as OptionsController, M as ModalController, l as ConstantsUtil$1 } from "./react-BWxe90Ar.mjs";
|
|
7
|
+
import "./index-42Rpweo5.mjs";
|
|
8
|
+
import { e, n as n$1 } from "./ref-CqxfRkBm.mjs";
|
|
9
|
+
import "./index-DT_mc1hV.mjs";
|
|
10
|
+
import "./index-oCj_SpOa.mjs";
|
|
11
|
+
const styles$4 = i`
|
|
12
|
+
:host {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input {
|
|
18
|
+
width: 50px;
|
|
19
|
+
height: 50px;
|
|
20
|
+
background: var(--wui-color-gray-glass-010);
|
|
21
|
+
border-radius: var(--wui-border-radius-xs);
|
|
22
|
+
border: 1px solid var(--wui-color-gray-glass-005);
|
|
23
|
+
font-family: var(--wui-font-family);
|
|
24
|
+
font-size: var(--wui-font-size-large);
|
|
25
|
+
font-weight: var(--wui-font-weight-regular);
|
|
26
|
+
letter-spacing: var(--wui-letter-spacing-large);
|
|
27
|
+
text-align: center;
|
|
28
|
+
color: var(--wui-color-fg-100);
|
|
29
|
+
caret-color: var(--wui-color-accent-100);
|
|
30
|
+
transition:
|
|
31
|
+
background-color var(--wui-ease-inout-power-1) var(--wui-duration-md),
|
|
32
|
+
border-color var(--wui-ease-inout-power-1) var(--wui-duration-md),
|
|
33
|
+
box-shadow var(--wui-ease-inout-power-1) var(--wui-duration-md);
|
|
34
|
+
will-change: background-color, border-color, box-shadow;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
-webkit-appearance: none;
|
|
37
|
+
-moz-appearance: textfield;
|
|
38
|
+
padding: 0px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
input::-webkit-outer-spin-button,
|
|
42
|
+
input::-webkit-inner-spin-button {
|
|
43
|
+
-webkit-appearance: none;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input[type='number'] {
|
|
48
|
+
-moz-appearance: textfield;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
input:disabled {
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
border: 1px solid var(--wui-color-gray-glass-010);
|
|
54
|
+
background: var(--wui-color-gray-glass-005);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
input:focus:enabled {
|
|
58
|
+
background-color: var(--wui-color-gray-glass-015);
|
|
59
|
+
border: 1px solid var(--wui-color-accent-100);
|
|
60
|
+
-webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
61
|
+
-moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
62
|
+
box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (hover: hover) and (pointer: fine) {
|
|
66
|
+
input:hover:enabled {
|
|
67
|
+
background-color: var(--wui-color-gray-glass-015);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
var __decorate$8 = function(decorators, target, key, desc) {
|
|
72
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
73
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
74
|
+
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;
|
|
75
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
76
|
+
};
|
|
77
|
+
let WuiInputNumeric = class WuiInputNumeric2 extends i$1 {
|
|
78
|
+
constructor() {
|
|
79
|
+
super(...arguments);
|
|
80
|
+
this.disabled = false;
|
|
81
|
+
this.value = "";
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
return x`<input
|
|
85
|
+
type="number"
|
|
86
|
+
maxlength="1"
|
|
87
|
+
inputmode="numeric"
|
|
88
|
+
autofocus
|
|
89
|
+
?disabled=${this.disabled}
|
|
90
|
+
value=${this.value}
|
|
91
|
+
/> `;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
WuiInputNumeric.styles = [resetStyles, elementStyles, styles$4];
|
|
95
|
+
__decorate$8([
|
|
96
|
+
n({ type: Boolean })
|
|
97
|
+
], WuiInputNumeric.prototype, "disabled", void 0);
|
|
98
|
+
__decorate$8([
|
|
99
|
+
n({ type: String })
|
|
100
|
+
], WuiInputNumeric.prototype, "value", void 0);
|
|
101
|
+
WuiInputNumeric = __decorate$8([
|
|
102
|
+
customElement("wui-input-numeric")
|
|
103
|
+
], WuiInputNumeric);
|
|
104
|
+
const styles$3 = i`
|
|
105
|
+
:host {
|
|
106
|
+
position: relative;
|
|
107
|
+
display: block;
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
var __decorate$7 = function(decorators, target, key, desc) {
|
|
111
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
112
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
113
|
+
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;
|
|
114
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
115
|
+
};
|
|
116
|
+
let WuiOtp = class WuiOtp2 extends i$1 {
|
|
117
|
+
constructor() {
|
|
118
|
+
super(...arguments);
|
|
119
|
+
this.length = 6;
|
|
120
|
+
this.otp = "";
|
|
121
|
+
this.values = Array.from({ length: this.length }).map(() => "");
|
|
122
|
+
this.numerics = [];
|
|
123
|
+
this.shouldInputBeEnabled = (index) => {
|
|
124
|
+
const previousInputs = this.values.slice(0, index);
|
|
125
|
+
return previousInputs.every((input) => input !== "");
|
|
126
|
+
};
|
|
127
|
+
this.handleKeyDown = (e2, index) => {
|
|
128
|
+
const inputElement = e2.target;
|
|
129
|
+
const input = this.getInputElement(inputElement);
|
|
130
|
+
const keyArr = ["ArrowLeft", "ArrowRight", "Shift", "Delete"];
|
|
131
|
+
if (!input) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (keyArr.includes(e2.key)) {
|
|
135
|
+
e2.preventDefault();
|
|
136
|
+
}
|
|
137
|
+
const currentCaretPos = input.selectionStart;
|
|
138
|
+
switch (e2.key) {
|
|
139
|
+
case "ArrowLeft":
|
|
140
|
+
if (currentCaretPos) {
|
|
141
|
+
input.setSelectionRange(currentCaretPos + 1, currentCaretPos + 1);
|
|
142
|
+
}
|
|
143
|
+
this.focusInputField("prev", index);
|
|
144
|
+
break;
|
|
145
|
+
case "ArrowRight":
|
|
146
|
+
this.focusInputField("next", index);
|
|
147
|
+
break;
|
|
148
|
+
case "Shift":
|
|
149
|
+
this.focusInputField("next", index);
|
|
150
|
+
break;
|
|
151
|
+
case "Delete":
|
|
152
|
+
if (input.value === "") {
|
|
153
|
+
this.focusInputField("prev", index);
|
|
154
|
+
} else {
|
|
155
|
+
this.updateInput(input, index, "");
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
case "Backspace":
|
|
159
|
+
if (input.value === "") {
|
|
160
|
+
this.focusInputField("prev", index);
|
|
161
|
+
} else {
|
|
162
|
+
this.updateInput(input, index, "");
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
this.focusInputField = (dir, index) => {
|
|
168
|
+
if (dir === "next") {
|
|
169
|
+
const nextIndex = index + 1;
|
|
170
|
+
if (!this.shouldInputBeEnabled(nextIndex)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const numeric = this.numerics[nextIndex < this.length ? nextIndex : index];
|
|
174
|
+
const input = numeric ? this.getInputElement(numeric) : void 0;
|
|
175
|
+
if (input) {
|
|
176
|
+
input.disabled = false;
|
|
177
|
+
input.focus();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (dir === "prev") {
|
|
181
|
+
const nextIndex = index - 1;
|
|
182
|
+
const numeric = this.numerics[nextIndex > -1 ? nextIndex : index];
|
|
183
|
+
const input = numeric ? this.getInputElement(numeric) : void 0;
|
|
184
|
+
if (input) {
|
|
185
|
+
input.focus();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
firstUpdated() {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
if (this.otp) {
|
|
193
|
+
this.values = this.otp.split("");
|
|
194
|
+
}
|
|
195
|
+
const numericElements = (_a = this.shadowRoot) == null ? void 0 : _a.querySelectorAll("wui-input-numeric");
|
|
196
|
+
if (numericElements) {
|
|
197
|
+
this.numerics = Array.from(numericElements);
|
|
198
|
+
}
|
|
199
|
+
(_b = this.numerics[0]) == null ? void 0 : _b.focus();
|
|
200
|
+
}
|
|
201
|
+
render() {
|
|
202
|
+
return x`
|
|
203
|
+
<wui-flex gap="xxs" data-testid="wui-otp-input">
|
|
204
|
+
${Array.from({ length: this.length }).map((_, index) => x`
|
|
205
|
+
<wui-input-numeric
|
|
206
|
+
@input=${(e2) => this.handleInput(e2, index)}
|
|
207
|
+
@click=${(e2) => this.selectInput(e2)}
|
|
208
|
+
@keydown=${(e2) => this.handleKeyDown(e2, index)}
|
|
209
|
+
.disabled=${!this.shouldInputBeEnabled(index)}
|
|
210
|
+
.value=${this.values[index] || ""}
|
|
211
|
+
>
|
|
212
|
+
</wui-input-numeric>
|
|
213
|
+
`)}
|
|
214
|
+
</wui-flex>
|
|
215
|
+
`;
|
|
216
|
+
}
|
|
217
|
+
updateInput(element, index, value) {
|
|
218
|
+
const numeric = this.numerics[index];
|
|
219
|
+
const input = element || (numeric ? this.getInputElement(numeric) : void 0);
|
|
220
|
+
if (input) {
|
|
221
|
+
input.value = value;
|
|
222
|
+
this.values = this.values.map((val, i2) => i2 === index ? value : val);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
selectInput(e2) {
|
|
226
|
+
const targetElement = e2.target;
|
|
227
|
+
if (targetElement) {
|
|
228
|
+
const inputElement = this.getInputElement(targetElement);
|
|
229
|
+
inputElement == null ? void 0 : inputElement.select();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
handleInput(e2, index) {
|
|
233
|
+
const inputElement = e2.target;
|
|
234
|
+
const input = this.getInputElement(inputElement);
|
|
235
|
+
if (input) {
|
|
236
|
+
const inputValue = input.value;
|
|
237
|
+
if (e2.inputType === "insertFromPaste") {
|
|
238
|
+
this.handlePaste(input, inputValue, index);
|
|
239
|
+
} else {
|
|
240
|
+
const isValid = UiHelperUtil.isNumber(inputValue);
|
|
241
|
+
if (isValid && e2.data) {
|
|
242
|
+
this.updateInput(input, index, e2.data);
|
|
243
|
+
this.focusInputField("next", index);
|
|
244
|
+
} else {
|
|
245
|
+
this.updateInput(input, index, "");
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
this.dispatchInputChangeEvent();
|
|
250
|
+
}
|
|
251
|
+
handlePaste(input, inputValue, index) {
|
|
252
|
+
const value = inputValue[0];
|
|
253
|
+
const isValid = value && UiHelperUtil.isNumber(value);
|
|
254
|
+
if (isValid) {
|
|
255
|
+
this.updateInput(input, index, value);
|
|
256
|
+
const inputString = inputValue.substring(1);
|
|
257
|
+
if (index + 1 < this.length && inputString.length) {
|
|
258
|
+
const nextNumeric = this.numerics[index + 1];
|
|
259
|
+
const nextInput = nextNumeric ? this.getInputElement(nextNumeric) : void 0;
|
|
260
|
+
if (nextInput) {
|
|
261
|
+
this.handlePaste(nextInput, inputString, index + 1);
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
this.focusInputField("next", index);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
this.updateInput(input, index, "");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
getInputElement(el) {
|
|
271
|
+
var _a;
|
|
272
|
+
if ((_a = el.shadowRoot) == null ? void 0 : _a.querySelector("input")) {
|
|
273
|
+
return el.shadowRoot.querySelector("input");
|
|
274
|
+
}
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
dispatchInputChangeEvent() {
|
|
278
|
+
const value = this.values.join("");
|
|
279
|
+
this.dispatchEvent(new CustomEvent("inputChange", {
|
|
280
|
+
detail: value,
|
|
281
|
+
bubbles: true,
|
|
282
|
+
composed: true
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
WuiOtp.styles = [resetStyles, styles$3];
|
|
287
|
+
__decorate$7([
|
|
288
|
+
n({ type: Number })
|
|
289
|
+
], WuiOtp.prototype, "length", void 0);
|
|
290
|
+
__decorate$7([
|
|
291
|
+
n({ type: String })
|
|
292
|
+
], WuiOtp.prototype, "otp", void 0);
|
|
293
|
+
__decorate$7([
|
|
294
|
+
r()
|
|
295
|
+
], WuiOtp.prototype, "values", void 0);
|
|
296
|
+
WuiOtp = __decorate$7([
|
|
297
|
+
customElement("wui-otp")
|
|
298
|
+
], WuiOtp);
|
|
299
|
+
const styles$2 = i`
|
|
300
|
+
wui-loading-spinner {
|
|
301
|
+
margin: 9px auto;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.email-display,
|
|
305
|
+
.email-display wui-text {
|
|
306
|
+
max-width: 100%;
|
|
307
|
+
}
|
|
308
|
+
`;
|
|
309
|
+
var __decorate$6 = function(decorators, target, key, desc) {
|
|
310
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
311
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
312
|
+
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;
|
|
313
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
314
|
+
};
|
|
315
|
+
const OTP_LENGTH = 6;
|
|
316
|
+
let W3mEmailOtpWidget = class W3mEmailOtpWidget2 extends i$1 {
|
|
317
|
+
firstUpdated() {
|
|
318
|
+
this.startOTPTimeout();
|
|
319
|
+
}
|
|
320
|
+
disconnectedCallback() {
|
|
321
|
+
clearTimeout(this.OTPTimeout);
|
|
322
|
+
}
|
|
323
|
+
constructor() {
|
|
324
|
+
var _a;
|
|
325
|
+
super();
|
|
326
|
+
this.loading = false;
|
|
327
|
+
this.timeoutTimeLeft = W3mFrameHelpers.getTimeToNextEmailLogin();
|
|
328
|
+
this.error = "";
|
|
329
|
+
this.otp = "";
|
|
330
|
+
this.email = (_a = RouterController.state.data) == null ? void 0 : _a.email;
|
|
331
|
+
this.authConnector = ConnectorController.getAuthConnector();
|
|
332
|
+
}
|
|
333
|
+
render() {
|
|
334
|
+
if (!this.email) {
|
|
335
|
+
throw new Error("w3m-email-otp-widget: No email provided");
|
|
336
|
+
}
|
|
337
|
+
const isResendDisabled = Boolean(this.timeoutTimeLeft);
|
|
338
|
+
const footerLabels = this.getFooterLabels(isResendDisabled);
|
|
339
|
+
return x`
|
|
340
|
+
<wui-flex
|
|
341
|
+
flexDirection="column"
|
|
342
|
+
alignItems="center"
|
|
343
|
+
.padding=${["l", "0", "l", "0"]}
|
|
344
|
+
gap="l"
|
|
345
|
+
>
|
|
346
|
+
<wui-flex
|
|
347
|
+
class="email-display"
|
|
348
|
+
flexDirection="column"
|
|
349
|
+
alignItems="center"
|
|
350
|
+
.padding=${["0", "xl", "0", "xl"]}
|
|
351
|
+
>
|
|
352
|
+
<wui-text variant="paragraph-400" color="fg-100" align="center">
|
|
353
|
+
Enter the code we sent to
|
|
354
|
+
</wui-text>
|
|
355
|
+
<wui-text variant="paragraph-500" color="fg-100" lineClamp="1" align="center">
|
|
356
|
+
${this.email}
|
|
357
|
+
</wui-text>
|
|
358
|
+
</wui-flex>
|
|
359
|
+
|
|
360
|
+
<wui-text variant="small-400" color="fg-200">The code expires in 20 minutes</wui-text>
|
|
361
|
+
|
|
362
|
+
${this.loading ? x`<wui-loading-spinner size="xl" color="accent-100"></wui-loading-spinner>` : x` <wui-flex flexDirection="column" alignItems="center" gap="xs">
|
|
363
|
+
<wui-otp
|
|
364
|
+
dissabled
|
|
365
|
+
length="6"
|
|
366
|
+
@inputChange=${this.onOtpInputChange.bind(this)}
|
|
367
|
+
.otp=${this.otp}
|
|
368
|
+
></wui-otp>
|
|
369
|
+
${this.error ? x`
|
|
370
|
+
<wui-text variant="small-400" align="center" color="error-100">
|
|
371
|
+
${this.error}. Try Again
|
|
372
|
+
</wui-text>
|
|
373
|
+
` : null}
|
|
374
|
+
</wui-flex>`}
|
|
375
|
+
|
|
376
|
+
<wui-flex alignItems="center" gap="xs">
|
|
377
|
+
<wui-text variant="small-400" color="fg-200">${footerLabels.title}</wui-text>
|
|
378
|
+
<wui-link @click=${this.onResendCode.bind(this)} .disabled=${isResendDisabled}>
|
|
379
|
+
${footerLabels.action}
|
|
380
|
+
</wui-link>
|
|
381
|
+
</wui-flex>
|
|
382
|
+
</wui-flex>
|
|
383
|
+
`;
|
|
384
|
+
}
|
|
385
|
+
startOTPTimeout() {
|
|
386
|
+
this.timeoutTimeLeft = W3mFrameHelpers.getTimeToNextEmailLogin();
|
|
387
|
+
this.OTPTimeout = setInterval(() => {
|
|
388
|
+
if (this.timeoutTimeLeft > 0) {
|
|
389
|
+
this.timeoutTimeLeft = W3mFrameHelpers.getTimeToNextEmailLogin();
|
|
390
|
+
} else {
|
|
391
|
+
clearInterval(this.OTPTimeout);
|
|
392
|
+
}
|
|
393
|
+
}, 1e3);
|
|
394
|
+
}
|
|
395
|
+
async onOtpInputChange(event) {
|
|
396
|
+
var _a;
|
|
397
|
+
try {
|
|
398
|
+
if (!this.loading) {
|
|
399
|
+
this.otp = event.detail;
|
|
400
|
+
if (this.authConnector && this.otp.length === OTP_LENGTH) {
|
|
401
|
+
this.loading = true;
|
|
402
|
+
await ((_a = this.onOtpSubmit) == null ? void 0 : _a.call(this, this.otp));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
} catch (error) {
|
|
406
|
+
this.error = CoreHelperUtil.parseError(error);
|
|
407
|
+
this.loading = false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async onResendCode() {
|
|
411
|
+
try {
|
|
412
|
+
if (this.onOtpResend) {
|
|
413
|
+
if (!this.loading && !this.timeoutTimeLeft) {
|
|
414
|
+
this.error = "";
|
|
415
|
+
this.otp = "";
|
|
416
|
+
const authConnector = ConnectorController.getAuthConnector();
|
|
417
|
+
if (!authConnector || !this.email) {
|
|
418
|
+
throw new Error("w3m-email-otp-widget: Unable to resend email");
|
|
419
|
+
}
|
|
420
|
+
this.loading = true;
|
|
421
|
+
await this.onOtpResend(this.email);
|
|
422
|
+
this.startOTPTimeout();
|
|
423
|
+
SnackController.showSuccess("Code email resent");
|
|
424
|
+
}
|
|
425
|
+
} else if (this.onStartOver) {
|
|
426
|
+
this.onStartOver();
|
|
427
|
+
}
|
|
428
|
+
} catch (error) {
|
|
429
|
+
SnackController.showError(error);
|
|
430
|
+
} finally {
|
|
431
|
+
this.loading = false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
getFooterLabels(isResendDisabled) {
|
|
435
|
+
if (this.onStartOver) {
|
|
436
|
+
return {
|
|
437
|
+
title: "Something wrong?",
|
|
438
|
+
action: `Try again ${isResendDisabled ? `in ${this.timeoutTimeLeft}s` : ""}`
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
title: `Didn't receive it?`,
|
|
443
|
+
action: `Resend ${isResendDisabled ? `in ${this.timeoutTimeLeft}s` : "Code"}`
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
W3mEmailOtpWidget.styles = styles$2;
|
|
448
|
+
__decorate$6([
|
|
449
|
+
r()
|
|
450
|
+
], W3mEmailOtpWidget.prototype, "loading", void 0);
|
|
451
|
+
__decorate$6([
|
|
452
|
+
r()
|
|
453
|
+
], W3mEmailOtpWidget.prototype, "timeoutTimeLeft", void 0);
|
|
454
|
+
__decorate$6([
|
|
455
|
+
r()
|
|
456
|
+
], W3mEmailOtpWidget.prototype, "error", void 0);
|
|
457
|
+
W3mEmailOtpWidget = __decorate$6([
|
|
458
|
+
customElement("w3m-email-otp-widget")
|
|
459
|
+
], W3mEmailOtpWidget);
|
|
460
|
+
var __decorate$5 = function(decorators, target, key, desc) {
|
|
461
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
462
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
463
|
+
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;
|
|
464
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
465
|
+
};
|
|
466
|
+
let W3mEmailVerifyOtpView = class W3mEmailVerifyOtpView2 extends W3mEmailOtpWidget {
|
|
467
|
+
constructor() {
|
|
468
|
+
super(...arguments);
|
|
469
|
+
this.onOtpSubmit = async (otp) => {
|
|
470
|
+
var _a;
|
|
471
|
+
try {
|
|
472
|
+
if (this.authConnector) {
|
|
473
|
+
await this.authConnector.provider.connectOtp({ otp });
|
|
474
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" });
|
|
475
|
+
const connectionsByNamespace = ConnectionController.getConnections(ChainController.state.activeChain);
|
|
476
|
+
const hasConnections = connectionsByNamespace.length > 0;
|
|
477
|
+
if (ChainController.state.activeChain) {
|
|
478
|
+
await ConnectionController.connectExternal(this.authConnector, ChainController.state.activeChain);
|
|
479
|
+
} else {
|
|
480
|
+
throw new Error("Active chain is not set on ChainControll");
|
|
481
|
+
}
|
|
482
|
+
EventsController.sendEvent({
|
|
483
|
+
type: "track",
|
|
484
|
+
event: "CONNECT_SUCCESS",
|
|
485
|
+
properties: { method: "email", name: this.authConnector.name || "Unknown" }
|
|
486
|
+
});
|
|
487
|
+
const isMultiWalletEnabled = (_a = OptionsController.state.remoteFeatures) == null ? void 0 : _a.multiWallet;
|
|
488
|
+
if (OptionsController.state.siwx) {
|
|
489
|
+
ModalController.close();
|
|
490
|
+
} else if (hasConnections && isMultiWalletEnabled) {
|
|
491
|
+
RouterController.replace("ProfileWallets");
|
|
492
|
+
SnackController.showSuccess("New Wallet Added");
|
|
493
|
+
} else {
|
|
494
|
+
ModalController.close();
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
} catch (error) {
|
|
498
|
+
EventsController.sendEvent({
|
|
499
|
+
type: "track",
|
|
500
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
501
|
+
properties: { message: CoreHelperUtil.parseError(error) }
|
|
502
|
+
});
|
|
503
|
+
throw error;
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
this.onOtpResend = async (email) => {
|
|
507
|
+
if (this.authConnector) {
|
|
508
|
+
await this.authConnector.provider.connectEmail({ email });
|
|
509
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_SENT" });
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
W3mEmailVerifyOtpView = __decorate$5([
|
|
515
|
+
customElement("w3m-email-verify-otp-view")
|
|
516
|
+
], W3mEmailVerifyOtpView);
|
|
517
|
+
const styles$1 = i`
|
|
518
|
+
wui-icon-box {
|
|
519
|
+
height: var(--wui-icon-box-size-xl);
|
|
520
|
+
width: var(--wui-icon-box-size-xl);
|
|
521
|
+
}
|
|
522
|
+
`;
|
|
523
|
+
var __decorate$4 = function(decorators, target, key, desc) {
|
|
524
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
525
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
526
|
+
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;
|
|
527
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
528
|
+
};
|
|
529
|
+
let W3mEmailVerifyDeviceView = class W3mEmailVerifyDeviceView2 extends i$1 {
|
|
530
|
+
constructor() {
|
|
531
|
+
var _a;
|
|
532
|
+
super();
|
|
533
|
+
this.email = (_a = RouterController.state.data) == null ? void 0 : _a.email;
|
|
534
|
+
this.authConnector = ConnectorController.getAuthConnector();
|
|
535
|
+
this.loading = false;
|
|
536
|
+
this.listenForDeviceApproval();
|
|
537
|
+
}
|
|
538
|
+
render() {
|
|
539
|
+
if (!this.email) {
|
|
540
|
+
throw new Error("w3m-email-verify-device-view: No email provided");
|
|
541
|
+
}
|
|
542
|
+
if (!this.authConnector) {
|
|
543
|
+
throw new Error("w3m-email-verify-device-view: No auth connector provided");
|
|
544
|
+
}
|
|
545
|
+
return x`
|
|
546
|
+
<wui-flex
|
|
547
|
+
flexDirection="column"
|
|
548
|
+
alignItems="center"
|
|
549
|
+
.padding=${["xxl", "s", "xxl", "s"]}
|
|
550
|
+
gap="l"
|
|
551
|
+
>
|
|
552
|
+
<wui-icon-box
|
|
553
|
+
size="xl"
|
|
554
|
+
iconcolor="accent-100"
|
|
555
|
+
backgroundcolor="accent-100"
|
|
556
|
+
icon="verify"
|
|
557
|
+
background="opaque"
|
|
558
|
+
></wui-icon-box>
|
|
559
|
+
|
|
560
|
+
<wui-flex flexDirection="column" alignItems="center" gap="s">
|
|
561
|
+
<wui-flex flexDirection="column" alignItems="center">
|
|
562
|
+
<wui-text variant="paragraph-400" color="fg-100">
|
|
563
|
+
Approve the login link we sent to
|
|
564
|
+
</wui-text>
|
|
565
|
+
<wui-text variant="paragraph-400" color="fg-100"><b>${this.email}</b></wui-text>
|
|
566
|
+
</wui-flex>
|
|
567
|
+
|
|
568
|
+
<wui-text variant="small-400" color="fg-200" align="center">
|
|
569
|
+
The code expires in 20 minutes
|
|
570
|
+
</wui-text>
|
|
571
|
+
|
|
572
|
+
<wui-flex alignItems="center" id="w3m-resend-section" gap="xs">
|
|
573
|
+
<wui-text variant="small-400" color="fg-100" align="center">
|
|
574
|
+
Didn't receive it?
|
|
575
|
+
</wui-text>
|
|
576
|
+
<wui-link @click=${this.onResendCode.bind(this)} .disabled=${this.loading}>
|
|
577
|
+
Resend email
|
|
578
|
+
</wui-link>
|
|
579
|
+
</wui-flex>
|
|
580
|
+
</wui-flex>
|
|
581
|
+
</wui-flex>
|
|
582
|
+
`;
|
|
583
|
+
}
|
|
584
|
+
async listenForDeviceApproval() {
|
|
585
|
+
if (this.authConnector) {
|
|
586
|
+
try {
|
|
587
|
+
await this.authConnector.provider.connectDevice();
|
|
588
|
+
EventsController.sendEvent({ type: "track", event: "DEVICE_REGISTERED_FOR_EMAIL" });
|
|
589
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_SENT" });
|
|
590
|
+
RouterController.replace("EmailVerifyOtp", { email: this.email });
|
|
591
|
+
} catch (error) {
|
|
592
|
+
RouterController.goBack();
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
async onResendCode() {
|
|
597
|
+
try {
|
|
598
|
+
if (!this.loading) {
|
|
599
|
+
if (!this.authConnector || !this.email) {
|
|
600
|
+
throw new Error("w3m-email-login-widget: Unable to resend email");
|
|
601
|
+
}
|
|
602
|
+
this.loading = true;
|
|
603
|
+
await this.authConnector.provider.connectEmail({ email: this.email });
|
|
604
|
+
this.listenForDeviceApproval();
|
|
605
|
+
SnackController.showSuccess("Code email resent");
|
|
606
|
+
}
|
|
607
|
+
} catch (error) {
|
|
608
|
+
SnackController.showError(error);
|
|
609
|
+
} finally {
|
|
610
|
+
this.loading = false;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
W3mEmailVerifyDeviceView.styles = styles$1;
|
|
615
|
+
__decorate$4([
|
|
616
|
+
r()
|
|
617
|
+
], W3mEmailVerifyDeviceView.prototype, "loading", void 0);
|
|
618
|
+
W3mEmailVerifyDeviceView = __decorate$4([
|
|
619
|
+
customElement("w3m-email-verify-device-view")
|
|
620
|
+
], W3mEmailVerifyDeviceView);
|
|
621
|
+
const styles = i`
|
|
622
|
+
wui-email-input {
|
|
623
|
+
width: 100%;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
form {
|
|
627
|
+
width: 100%;
|
|
628
|
+
display: block;
|
|
629
|
+
position: relative;
|
|
630
|
+
}
|
|
631
|
+
`;
|
|
632
|
+
var __decorate$3 = function(decorators, target, key, desc) {
|
|
633
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
634
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
635
|
+
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;
|
|
636
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
637
|
+
};
|
|
638
|
+
let W3mUpdateEmailWalletView = class W3mUpdateEmailWalletView2 extends i$1 {
|
|
639
|
+
constructor() {
|
|
640
|
+
var _a, _b;
|
|
641
|
+
super(...arguments);
|
|
642
|
+
this.formRef = e();
|
|
643
|
+
this.initialEmail = ((_a = RouterController.state.data) == null ? void 0 : _a.email) ?? "";
|
|
644
|
+
this.redirectView = (_b = RouterController.state.data) == null ? void 0 : _b.redirectView;
|
|
645
|
+
this.email = "";
|
|
646
|
+
this.loading = false;
|
|
647
|
+
}
|
|
648
|
+
firstUpdated() {
|
|
649
|
+
var _a;
|
|
650
|
+
(_a = this.formRef.value) == null ? void 0 : _a.addEventListener("keydown", (event) => {
|
|
651
|
+
if (event.key === "Enter") {
|
|
652
|
+
this.onSubmitEmail(event);
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
render() {
|
|
657
|
+
return x`
|
|
658
|
+
<wui-flex flexDirection="column" padding="m" gap="m">
|
|
659
|
+
<form ${n$1(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}>
|
|
660
|
+
<wui-email-input
|
|
661
|
+
value=${this.initialEmail}
|
|
662
|
+
.disabled=${this.loading}
|
|
663
|
+
@inputChange=${this.onEmailInputChange.bind(this)}
|
|
664
|
+
>
|
|
665
|
+
</wui-email-input>
|
|
666
|
+
<input type="submit" hidden />
|
|
667
|
+
</form>
|
|
668
|
+
${this.buttonsTemplate()}
|
|
669
|
+
</wui-flex>
|
|
670
|
+
`;
|
|
671
|
+
}
|
|
672
|
+
onEmailInputChange(event) {
|
|
673
|
+
this.email = event.detail;
|
|
674
|
+
}
|
|
675
|
+
async onSubmitEmail(event) {
|
|
676
|
+
try {
|
|
677
|
+
if (this.loading) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
this.loading = true;
|
|
681
|
+
event.preventDefault();
|
|
682
|
+
const authConnector = ConnectorController.getAuthConnector();
|
|
683
|
+
if (!authConnector) {
|
|
684
|
+
throw new Error("w3m-update-email-wallet: Auth connector not found");
|
|
685
|
+
}
|
|
686
|
+
const response = await authConnector.provider.updateEmail({ email: this.email });
|
|
687
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_EDIT" });
|
|
688
|
+
if (response.action === "VERIFY_SECONDARY_OTP") {
|
|
689
|
+
RouterController.push("UpdateEmailSecondaryOtp", {
|
|
690
|
+
email: this.initialEmail,
|
|
691
|
+
newEmail: this.email,
|
|
692
|
+
redirectView: this.redirectView
|
|
693
|
+
});
|
|
694
|
+
} else {
|
|
695
|
+
RouterController.push("UpdateEmailPrimaryOtp", {
|
|
696
|
+
email: this.initialEmail,
|
|
697
|
+
newEmail: this.email,
|
|
698
|
+
redirectView: this.redirectView
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
} catch (error) {
|
|
702
|
+
SnackController.showError(error);
|
|
703
|
+
this.loading = false;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
buttonsTemplate() {
|
|
707
|
+
const showSubmit = !this.loading && this.email.length > 3 && this.email !== this.initialEmail;
|
|
708
|
+
if (!this.redirectView) {
|
|
709
|
+
return x`
|
|
710
|
+
<wui-button
|
|
711
|
+
size="md"
|
|
712
|
+
variant="main"
|
|
713
|
+
fullWidth
|
|
714
|
+
@click=${this.onSubmitEmail.bind(this)}
|
|
715
|
+
.disabled=${!showSubmit}
|
|
716
|
+
.loading=${this.loading}
|
|
717
|
+
>
|
|
718
|
+
Save
|
|
719
|
+
</wui-button>
|
|
720
|
+
`;
|
|
721
|
+
}
|
|
722
|
+
return x`
|
|
723
|
+
<wui-flex gap="s">
|
|
724
|
+
<wui-button size="md" variant="neutral" fullWidth @click=${RouterController.goBack}>
|
|
725
|
+
Cancel
|
|
726
|
+
</wui-button>
|
|
727
|
+
|
|
728
|
+
<wui-button
|
|
729
|
+
size="md"
|
|
730
|
+
variant="main"
|
|
731
|
+
fullWidth
|
|
732
|
+
@click=${this.onSubmitEmail.bind(this)}
|
|
733
|
+
.disabled=${!showSubmit}
|
|
734
|
+
.loading=${this.loading}
|
|
735
|
+
>
|
|
736
|
+
Save
|
|
737
|
+
</wui-button>
|
|
738
|
+
</wui-flex>
|
|
739
|
+
`;
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
W3mUpdateEmailWalletView.styles = styles;
|
|
743
|
+
__decorate$3([
|
|
744
|
+
r()
|
|
745
|
+
], W3mUpdateEmailWalletView.prototype, "email", void 0);
|
|
746
|
+
__decorate$3([
|
|
747
|
+
r()
|
|
748
|
+
], W3mUpdateEmailWalletView.prototype, "loading", void 0);
|
|
749
|
+
W3mUpdateEmailWalletView = __decorate$3([
|
|
750
|
+
customElement("w3m-update-email-wallet-view")
|
|
751
|
+
], W3mUpdateEmailWalletView);
|
|
752
|
+
var __decorate$2 = function(decorators, target, key, desc) {
|
|
753
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
754
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
755
|
+
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;
|
|
756
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
757
|
+
};
|
|
758
|
+
let W3mUpdateEmailPrimaryOtpView = class W3mUpdateEmailPrimaryOtpView2 extends W3mEmailOtpWidget {
|
|
759
|
+
constructor() {
|
|
760
|
+
var _a;
|
|
761
|
+
super();
|
|
762
|
+
this.email = (_a = RouterController.state.data) == null ? void 0 : _a.email;
|
|
763
|
+
this.onOtpSubmit = async (otp) => {
|
|
764
|
+
try {
|
|
765
|
+
if (this.authConnector) {
|
|
766
|
+
await this.authConnector.provider.updateEmailPrimaryOtp({ otp });
|
|
767
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" });
|
|
768
|
+
RouterController.replace("UpdateEmailSecondaryOtp", RouterController.state.data);
|
|
769
|
+
}
|
|
770
|
+
} catch (error) {
|
|
771
|
+
EventsController.sendEvent({
|
|
772
|
+
type: "track",
|
|
773
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
774
|
+
properties: { message: CoreHelperUtil.parseError(error) }
|
|
775
|
+
});
|
|
776
|
+
throw error;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
this.onStartOver = () => {
|
|
780
|
+
RouterController.replace("UpdateEmailWallet", RouterController.state.data);
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
W3mUpdateEmailPrimaryOtpView = __decorate$2([
|
|
785
|
+
customElement("w3m-update-email-primary-otp-view")
|
|
786
|
+
], W3mUpdateEmailPrimaryOtpView);
|
|
787
|
+
var __decorate$1 = function(decorators, target, key, desc) {
|
|
788
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
789
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
790
|
+
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;
|
|
791
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
792
|
+
};
|
|
793
|
+
let W3mUpdateEmailSecondaryOtpView = class W3mUpdateEmailSecondaryOtpView2 extends W3mEmailOtpWidget {
|
|
794
|
+
constructor() {
|
|
795
|
+
var _a, _b;
|
|
796
|
+
super();
|
|
797
|
+
this.email = (_a = RouterController.state.data) == null ? void 0 : _a.newEmail;
|
|
798
|
+
this.redirectView = (_b = RouterController.state.data) == null ? void 0 : _b.redirectView;
|
|
799
|
+
this.onOtpSubmit = async (otp) => {
|
|
800
|
+
try {
|
|
801
|
+
if (this.authConnector) {
|
|
802
|
+
await this.authConnector.provider.updateEmailSecondaryOtp({ otp });
|
|
803
|
+
EventsController.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" });
|
|
804
|
+
if (this.redirectView) {
|
|
805
|
+
RouterController.reset(this.redirectView);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
} catch (error) {
|
|
809
|
+
EventsController.sendEvent({
|
|
810
|
+
type: "track",
|
|
811
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
812
|
+
properties: { message: CoreHelperUtil.parseError(error) }
|
|
813
|
+
});
|
|
814
|
+
throw error;
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
this.onStartOver = () => {
|
|
818
|
+
RouterController.replace("UpdateEmailWallet", RouterController.state.data);
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
W3mUpdateEmailSecondaryOtpView = __decorate$1([
|
|
823
|
+
customElement("w3m-update-email-secondary-otp-view")
|
|
824
|
+
], W3mUpdateEmailSecondaryOtpView);
|
|
825
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
826
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
827
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
828
|
+
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;
|
|
829
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
830
|
+
};
|
|
831
|
+
let W3mEmailLoginView = class W3mEmailLoginView2 extends i$1 {
|
|
832
|
+
constructor() {
|
|
833
|
+
var _a;
|
|
834
|
+
super();
|
|
835
|
+
this.authConnector = ConnectorController.getAuthConnector();
|
|
836
|
+
this.isEmailEnabled = (_a = OptionsController.state.remoteFeatures) == null ? void 0 : _a.email;
|
|
837
|
+
this.isAuthEnabled = this.checkIfAuthEnabled(ConnectorController.state.connectors);
|
|
838
|
+
this.connectors = ConnectorController.state.connectors;
|
|
839
|
+
ConnectorController.subscribeKey("connectors", (val) => {
|
|
840
|
+
this.connectors = val;
|
|
841
|
+
this.isAuthEnabled = this.checkIfAuthEnabled(this.connectors);
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
render() {
|
|
845
|
+
if (!this.isEmailEnabled) {
|
|
846
|
+
throw new Error("w3m-email-login-view: Email is not enabled");
|
|
847
|
+
}
|
|
848
|
+
if (!this.isAuthEnabled) {
|
|
849
|
+
throw new Error("w3m-email-login-view: No auth connector provided");
|
|
850
|
+
}
|
|
851
|
+
return x`<wui-flex
|
|
852
|
+
flexDirection="column"
|
|
853
|
+
.padding=${["3xs", "m", "m", "m"]}
|
|
854
|
+
gap="l"
|
|
855
|
+
>
|
|
856
|
+
<w3m-email-login-widget></w3m-email-login-widget>
|
|
857
|
+
</wui-flex> `;
|
|
858
|
+
}
|
|
859
|
+
checkIfAuthEnabled(connectors) {
|
|
860
|
+
const namespacesWithAuthConnector = connectors.filter((c) => c.type === ConstantsUtil.CONNECTOR_TYPE_AUTH).map((i2) => i2.chain);
|
|
861
|
+
const authSupportedNamespaces = ConstantsUtil$1.AUTH_CONNECTOR_SUPPORTED_CHAINS;
|
|
862
|
+
return authSupportedNamespaces.some((ns) => namespacesWithAuthConnector.includes(ns));
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
__decorate([
|
|
866
|
+
r()
|
|
867
|
+
], W3mEmailLoginView.prototype, "connectors", void 0);
|
|
868
|
+
W3mEmailLoginView = __decorate([
|
|
869
|
+
customElement("w3m-email-login-view")
|
|
870
|
+
], W3mEmailLoginView);
|
|
871
|
+
export {
|
|
872
|
+
W3mEmailLoginView,
|
|
873
|
+
W3mEmailVerifyDeviceView,
|
|
874
|
+
W3mEmailVerifyOtpView,
|
|
875
|
+
W3mUpdateEmailPrimaryOtpView,
|
|
876
|
+
W3mUpdateEmailSecondaryOtpView,
|
|
877
|
+
W3mUpdateEmailWalletView
|
|
878
|
+
};
|