astra-modal-test 1.0.5 → 1.0.7
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/.github/workflows/code-quality.yml +43 -0
- package/.github/workflows/publish.yml +64 -0
- package/README.md +204 -0
- package/dist/SwapController-CsNqEWIM.js +447 -0
- package/dist/add-Dm_oSEbv.js +19 -0
- package/dist/all-wallets-DfLlzQJ3.js +10 -0
- package/dist/app-store-BMdJkp6P.js +21 -0
- package/dist/apple-BetlVMKw.js +22 -0
- package/dist/arrow-bottom-BddPptxy.js +12 -0
- package/dist/arrow-bottom-circle-CvdJJniv.js +15 -0
- package/dist/arrow-left-Bbq-z1nQ.js +12 -0
- package/dist/arrow-right-Bu4_SVLC.js +12 -0
- package/dist/arrow-top-CynlXB-M.js +12 -0
- package/dist/astra-sdk.es.js +4 -4
- package/dist/bank-B9QscNnS.js +18 -0
- package/dist/bin-v-tshf8_.js +8 -0
- package/dist/bitcoin-C01gkYyN.js +17 -0
- package/dist/browser-9uNaCY31.js +18 -0
- package/dist/card-hKR9lRzU.js +18 -0
- package/dist/{ccip-oZOrZYR9.js → ccip-CUCziAPw.js} +52 -49
- package/dist/checkmark-D1M40aM5.js +15 -0
- package/dist/checkmark-bold-1_UGl24m.js +12 -0
- package/dist/chevron-bottom-BleoRNRL.js +12 -0
- package/dist/chevron-left-C9JMU-3B.js +12 -0
- package/dist/chevron-right-Daue4WBx.js +12 -0
- package/dist/chevron-top-yuXekbUC.js +12 -0
- package/dist/chrome-store-BsUFRR7F.js +65 -0
- package/dist/circle-BCxdhM5X.js +8 -0
- package/dist/clock-7a-DWZQa.js +12 -0
- package/dist/close-DMQYuJ0z.js +12 -0
- package/dist/clsx.m-DCYaa4RU.js +20 -0
- package/dist/coinPlaceholder-DjQ-HnSH.js +12 -0
- package/dist/compass-AMecXNVm.js +12 -0
- package/dist/copy-CgIPGYbU.js +19 -0
- package/dist/cursor-DpYbTNcO.js +7 -0
- package/dist/cursor-transparent-C8iPJkn8.js +16 -0
- package/dist/desktop-BWVQVGng.js +13 -0
- package/dist/disconnect-C6IQRrtF.js +12 -0
- package/dist/discord-gH3i-QsC.js +21 -0
- package/dist/email-BxYwJC5T.js +10 -0
- package/dist/embedded-wallet-DCcVNgkc.js +464 -0
- package/dist/ethereum-CGWsmZaC.js +14 -0
- package/dist/etherscan-D4EFsAJ4.js +10 -0
- package/dist/exclamation-triangle-DNwQ1Xq6.js +8 -0
- package/dist/extension-DxQPsN2z.js +12 -0
- package/dist/external-link-BeEzrdgR.js +12 -0
- package/dist/facebook-B2Ix8_d3.js +30 -0
- package/dist/farcaster-BB83p8dC.js +16 -0
- package/dist/filters-PzdIomB1.js +12 -0
- package/dist/github-gcp1rxX0.js +22 -0
- package/dist/google-Qv9lTZcz.js +22 -0
- package/dist/help-circle-BLXTMjzX.js +16 -0
- package/dist/id-BHg2CRhj.js +16 -0
- package/dist/image-DWi1V30x.js +8 -0
- package/dist/index-4lbsZ6RQ.js +33 -0
- package/dist/index-64U3D9_n.js +21034 -0
- package/dist/index-CRU49I0g.js +15911 -0
- package/dist/index-ChxXyuZj.js +572 -0
- package/dist/index-ClS956E1.js +74511 -0
- package/dist/index-Cs4fWw01.js +386 -0
- package/dist/index-DfWqgW4h.js +709 -0
- package/dist/index-VYNI76FM.js +315 -0
- package/dist/index-qfkTLN90.js +10785 -0
- package/dist/index-r2ztgVN2.js +1060 -0
- package/dist/index-wvh7Yd5J.js +70 -0
- package/dist/info-Bl5tmiBJ.js +7 -0
- package/dist/info-circle-D2uYywg-.js +16 -0
- package/dist/lightbulb-HvXH2AVF.js +7 -0
- package/dist/mail-DXOPfnog.js +12 -0
- package/dist/mobile-Dd0Gj4vZ.js +13 -0
- package/dist/more-DYcnClbB.js +15 -0
- package/dist/network-placeholder-CfRZGQfi.js +18 -0
- package/dist/nftPlaceholder-DHmFkY55.js +12 -0
- package/dist/off-CG2Y30qN.js +8 -0
- package/dist/onramp-DoAMTeNm.js +917 -0
- package/dist/play-store-B5EYBQto.js +36 -0
- package/dist/plus-DPo25_zL.js +17 -0
- package/dist/qr-code-BRTO19PL.js +10 -0
- package/dist/receive-BvclNdV_.js +179 -0
- package/dist/recycle-horizontal-ng_b2eJV.js +13 -0
- package/dist/refresh-3kiwRV0w.js +12 -0
- package/dist/reown-logo-_9cuIfJD.js +16 -0
- package/dist/search-CoJvIxpi.js +12 -0
- package/dist/secp256k1-wZyK2iIX.js +1257 -0
- package/dist/send-BVKGSR-Z.js +19 -0
- package/dist/send-Bkj5YtHe.js +1039 -0
- package/dist/socials-DL42HlL5.js +589 -0
- package/dist/solana-BjP-_Ioa.js +17 -0
- package/dist/swapHorizontal-Do3uBbum.js +12 -0
- package/dist/swapHorizontalBold-D7N75BE-.js +12 -0
- package/dist/swapHorizontalMedium-BahEVO2x.js +20 -0
- package/dist/swapHorizontalRoundedBold-D6Hoi132.js +12 -0
- package/dist/swapVertical-P-fnrADh.js +12 -0
- package/dist/swaps-DZgbVJZ2.js +1713 -0
- package/dist/telegram-DmaL2iB8.js +20 -0
- package/dist/three-dots-oXyAsUA6.js +9 -0
- package/dist/transactions-BjB5yZN7.js +35 -0
- package/dist/twitch-0UGrMr2K.js +22 -0
- package/dist/twitterIcon-B97KAbaJ.js +10 -0
- package/dist/ui-r6nnVhBA.js +812 -0
- package/dist/user-BG1yp56Q.js +7 -0
- package/dist/verify-CgzkMSuV.js +12 -0
- package/dist/verify-filled-D-TRpWtN.js +12 -0
- package/dist/w3m-modal-Drsibcs0.js +1041 -0
- package/dist/wallet-CAHsZdfj.js +12 -0
- package/dist/wallet-placeholder-agbbreqw.js +18 -0
- package/dist/walletconnect-Yd8iXqY9.js +36 -0
- package/dist/warning-circle-C0hqC6h_.js +16 -0
- package/dist/x-mark-D9_ai2sI.js +7 -0
- package/dist/x-z6v1Jegg.js +16 -0
- package/eslint.config.mjs +1 -1
- package/package.json +14 -13
- package/src/apis/lspApi.js +47 -24
- package/src/assets/ln.png +0 -0
- package/src/assets/network/Arbitrum.png +0 -0
- package/src/assets/network/Polygon.png +0 -0
- package/src/assets/network/Solana.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +13 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +17 -3
- package/src/comps/AstraModal.jsx +22 -16
- package/src/comps/AstraModalLogo.jsx +9 -9
- package/src/comps/AstraNetwork.jsx +174 -45
- package/src/comps/CheckErc20Button.jsx +1 -1
- package/src/comps/CommonStyle.jsx +4 -0
- package/src/comps/ConnectButton.jsx +16 -33
- package/src/comps/ResultModal.jsx +45 -39
- package/src/comps/ToLightning.jsx +207 -80
- package/src/comps/ToToken.jsx +278 -217
- package/src/constants/index.js +20 -4
- package/src/hooks/useContract.js +164 -125
- package/src/hooks/useGetMinAndMax.js +48 -0
- package/src/hooks/useLspApi.js +56 -39
- package/src/hooks/useParseInvoice.js +82 -72
- package/src/index.jsx +43 -10
- package/src/main.jsx +36 -5
- package/src/utils/index.js +136 -24
- package/vite.config.js +7 -1
- package/dist/astra-sdk.umd.js +0 -12578
- package/dist/hooks.module-BBZfodGH.js +0 -506
- package/dist/index-BKKAfRrw.js +0 -87520
- package/dist/index-C2MAIRET.js +0 -2929
- package/dist/index-CsRxokSv.js +0 -445
- package/dist/index-DQ6iiHxJ.js +0 -13720
- package/dist/index-SJhlkSif.js +0 -133
- package/dist/w3m-modal-CYJpmgnf.js +0 -267
- package/src/constants/contracts/abi/bridge.js +0 -1281
- package/src/constants/contracts/abi/index.js +0 -3
- package/src/constants/contracts/abi/usdt.js +0 -130
- package/src/constants/contracts/abi/watcher.js +0 -437
- package/src/constants/contracts/index.js +0 -37
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
import { E, F as U, G as M, H as C, I as d, J as v, K as u, av as m, as as P, aX as S, R as l, a3 as h, Y as O, S as f, V, O as N, aB as x, Q as c, aI as W, aQ as B, aS as H, aO as q, P as G } from "./index-ClS956E1.js";
|
|
2
|
+
const K = E`
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
input {
|
|
9
|
+
width: 50px;
|
|
10
|
+
height: 50px;
|
|
11
|
+
background: var(--wui-color-gray-glass-010);
|
|
12
|
+
border-radius: var(--wui-border-radius-xs);
|
|
13
|
+
border: 1px solid var(--wui-color-gray-glass-005);
|
|
14
|
+
font-family: var(--wui-font-family);
|
|
15
|
+
font-size: var(--wui-font-size-large);
|
|
16
|
+
font-weight: var(--wui-font-weight-regular);
|
|
17
|
+
letter-spacing: var(--wui-letter-spacing-large);
|
|
18
|
+
text-align: center;
|
|
19
|
+
color: var(--wui-color-fg-100);
|
|
20
|
+
caret-color: var(--wui-color-accent-100);
|
|
21
|
+
transition:
|
|
22
|
+
background-color var(--wui-ease-inout-power-1) var(--wui-duration-md),
|
|
23
|
+
border-color var(--wui-ease-inout-power-1) var(--wui-duration-md),
|
|
24
|
+
box-shadow var(--wui-ease-inout-power-1) var(--wui-duration-md);
|
|
25
|
+
will-change: background-color, border-color, box-shadow;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
-webkit-appearance: none;
|
|
28
|
+
-moz-appearance: textfield;
|
|
29
|
+
padding: 0px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
input::-webkit-outer-spin-button,
|
|
33
|
+
input::-webkit-inner-spin-button {
|
|
34
|
+
-webkit-appearance: none;
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
input[type='number'] {
|
|
39
|
+
-moz-appearance: textfield;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
input:disabled {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
border: 1px solid var(--wui-color-gray-glass-010);
|
|
45
|
+
background: var(--wui-color-gray-glass-005);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
input:focus:enabled {
|
|
49
|
+
background-color: var(--wui-color-gray-glass-015);
|
|
50
|
+
border: 1px solid var(--wui-color-accent-100);
|
|
51
|
+
-webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
52
|
+
-moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
53
|
+
box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (hover: hover) and (pointer: fine) {
|
|
57
|
+
input:hover:enabled {
|
|
58
|
+
background-color: var(--wui-color-gray-glass-015);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
var $ = function(a, e, t, n) {
|
|
63
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
64
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
65
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
66
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
67
|
+
};
|
|
68
|
+
let g = class extends v {
|
|
69
|
+
constructor() {
|
|
70
|
+
super(...arguments), this.disabled = !1, this.value = "";
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return u`<input
|
|
74
|
+
type="number"
|
|
75
|
+
maxlength="1"
|
|
76
|
+
inputmode="numeric"
|
|
77
|
+
autofocus
|
|
78
|
+
?disabled=${this.disabled}
|
|
79
|
+
value=${this.value}
|
|
80
|
+
/> `;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
g.styles = [U, M, K];
|
|
84
|
+
$([
|
|
85
|
+
C({ type: Boolean })
|
|
86
|
+
], g.prototype, "disabled", void 0);
|
|
87
|
+
$([
|
|
88
|
+
C({ type: String })
|
|
89
|
+
], g.prototype, "value", void 0);
|
|
90
|
+
g = $([
|
|
91
|
+
d("wui-input-numeric")
|
|
92
|
+
], g);
|
|
93
|
+
const Y = E`
|
|
94
|
+
:host {
|
|
95
|
+
position: relative;
|
|
96
|
+
display: block;
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
var _ = function(a, e, t, n) {
|
|
100
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
101
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
102
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
103
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
104
|
+
};
|
|
105
|
+
let w = class extends v {
|
|
106
|
+
constructor() {
|
|
107
|
+
super(...arguments), this.length = 6, this.otp = "", this.values = Array.from({ length: this.length }).map(() => ""), this.numerics = [], this.shouldInputBeEnabled = (e) => this.values.slice(0, e).every((n) => n !== ""), this.handleKeyDown = (e, t) => {
|
|
108
|
+
const n = e.target, o = this.getInputElement(n), i = ["ArrowLeft", "ArrowRight", "Shift", "Delete"];
|
|
109
|
+
if (!o)
|
|
110
|
+
return;
|
|
111
|
+
i.includes(e.key) && e.preventDefault();
|
|
112
|
+
const r = o.selectionStart;
|
|
113
|
+
switch (e.key) {
|
|
114
|
+
case "ArrowLeft":
|
|
115
|
+
r && o.setSelectionRange(r + 1, r + 1), this.focusInputField("prev", t);
|
|
116
|
+
break;
|
|
117
|
+
case "ArrowRight":
|
|
118
|
+
this.focusInputField("next", t);
|
|
119
|
+
break;
|
|
120
|
+
case "Shift":
|
|
121
|
+
this.focusInputField("next", t);
|
|
122
|
+
break;
|
|
123
|
+
case "Delete":
|
|
124
|
+
o.value === "" ? this.focusInputField("prev", t) : this.updateInput(o, t, "");
|
|
125
|
+
break;
|
|
126
|
+
case "Backspace":
|
|
127
|
+
o.value === "" ? this.focusInputField("prev", t) : this.updateInput(o, t, "");
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}, this.focusInputField = (e, t) => {
|
|
131
|
+
if (e === "next") {
|
|
132
|
+
const n = t + 1;
|
|
133
|
+
if (!this.shouldInputBeEnabled(n))
|
|
134
|
+
return;
|
|
135
|
+
const o = this.numerics[n < this.length ? n : t], i = o ? this.getInputElement(o) : void 0;
|
|
136
|
+
i && (i.disabled = !1, i.focus());
|
|
137
|
+
}
|
|
138
|
+
if (e === "prev") {
|
|
139
|
+
const n = t - 1, o = this.numerics[n > -1 ? n : t], i = o ? this.getInputElement(o) : void 0;
|
|
140
|
+
i && i.focus();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
firstUpdated() {
|
|
145
|
+
var t, n;
|
|
146
|
+
this.otp && (this.values = this.otp.split(""));
|
|
147
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("wui-input-numeric");
|
|
148
|
+
e && (this.numerics = Array.from(e)), (n = this.numerics[0]) == null || n.focus();
|
|
149
|
+
}
|
|
150
|
+
render() {
|
|
151
|
+
return u`
|
|
152
|
+
<wui-flex gap="xxs" data-testid="wui-otp-input">
|
|
153
|
+
${Array.from({ length: this.length }).map((e, t) => u`
|
|
154
|
+
<wui-input-numeric
|
|
155
|
+
@input=${(n) => this.handleInput(n, t)}
|
|
156
|
+
@click=${(n) => this.selectInput(n)}
|
|
157
|
+
@keydown=${(n) => this.handleKeyDown(n, t)}
|
|
158
|
+
.disabled=${!this.shouldInputBeEnabled(t)}
|
|
159
|
+
.value=${this.values[t] || ""}
|
|
160
|
+
>
|
|
161
|
+
</wui-input-numeric>
|
|
162
|
+
`)}
|
|
163
|
+
</wui-flex>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
updateInput(e, t, n) {
|
|
167
|
+
const o = this.numerics[t], i = e || (o ? this.getInputElement(o) : void 0);
|
|
168
|
+
i && (i.value = n, this.values = this.values.map((r, s) => s === t ? n : r));
|
|
169
|
+
}
|
|
170
|
+
selectInput(e) {
|
|
171
|
+
const t = e.target;
|
|
172
|
+
if (t) {
|
|
173
|
+
const n = this.getInputElement(t);
|
|
174
|
+
n == null || n.select();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
handleInput(e, t) {
|
|
178
|
+
const n = e.target, o = this.getInputElement(n);
|
|
179
|
+
if (o) {
|
|
180
|
+
const i = o.value;
|
|
181
|
+
e.inputType === "insertFromPaste" ? this.handlePaste(o, i, t) : P.isNumber(i) && e.data ? (this.updateInput(o, t, e.data), this.focusInputField("next", t)) : this.updateInput(o, t, "");
|
|
182
|
+
}
|
|
183
|
+
this.dispatchInputChangeEvent();
|
|
184
|
+
}
|
|
185
|
+
handlePaste(e, t, n) {
|
|
186
|
+
const o = t[0];
|
|
187
|
+
if (o && P.isNumber(o)) {
|
|
188
|
+
this.updateInput(e, n, o);
|
|
189
|
+
const r = t.substring(1);
|
|
190
|
+
if (n + 1 < this.length && r.length) {
|
|
191
|
+
const s = this.numerics[n + 1], y = s ? this.getInputElement(s) : void 0;
|
|
192
|
+
y && this.handlePaste(y, r, n + 1);
|
|
193
|
+
} else
|
|
194
|
+
this.focusInputField("next", n);
|
|
195
|
+
} else
|
|
196
|
+
this.updateInput(e, n, "");
|
|
197
|
+
}
|
|
198
|
+
getInputElement(e) {
|
|
199
|
+
var t;
|
|
200
|
+
return (t = e.shadowRoot) != null && t.querySelector("input") ? e.shadowRoot.querySelector("input") : null;
|
|
201
|
+
}
|
|
202
|
+
dispatchInputChangeEvent() {
|
|
203
|
+
const e = this.values.join("");
|
|
204
|
+
this.dispatchEvent(new CustomEvent("inputChange", {
|
|
205
|
+
detail: e,
|
|
206
|
+
bubbles: !0,
|
|
207
|
+
composed: !0
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
w.styles = [U, Y];
|
|
212
|
+
_([
|
|
213
|
+
C({ type: Number })
|
|
214
|
+
], w.prototype, "length", void 0);
|
|
215
|
+
_([
|
|
216
|
+
C({ type: String })
|
|
217
|
+
], w.prototype, "otp", void 0);
|
|
218
|
+
_([
|
|
219
|
+
m()
|
|
220
|
+
], w.prototype, "values", void 0);
|
|
221
|
+
w = _([
|
|
222
|
+
d("wui-otp")
|
|
223
|
+
], w);
|
|
224
|
+
const Q = E`
|
|
225
|
+
wui-loading-spinner {
|
|
226
|
+
margin: 9px auto;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.email-display,
|
|
230
|
+
.email-display wui-text {
|
|
231
|
+
max-width: 100%;
|
|
232
|
+
}
|
|
233
|
+
`;
|
|
234
|
+
var R = function(a, e, t, n) {
|
|
235
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
236
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
237
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
238
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
239
|
+
}, T;
|
|
240
|
+
let p = T = class extends v {
|
|
241
|
+
firstUpdated() {
|
|
242
|
+
this.startOTPTimeout();
|
|
243
|
+
}
|
|
244
|
+
disconnectedCallback() {
|
|
245
|
+
clearTimeout(this.OTPTimeout);
|
|
246
|
+
}
|
|
247
|
+
constructor() {
|
|
248
|
+
var e;
|
|
249
|
+
super(), this.loading = !1, this.timeoutTimeLeft = S.getTimeToNextEmailLogin(), this.error = "", this.otp = "", this.email = (e = l.state.data) == null ? void 0 : e.email, this.authConnector = h.getAuthConnector();
|
|
250
|
+
}
|
|
251
|
+
render() {
|
|
252
|
+
if (!this.email)
|
|
253
|
+
throw new Error("w3m-email-otp-widget: No email provided");
|
|
254
|
+
const e = !!this.timeoutTimeLeft, t = this.getFooterLabels(e);
|
|
255
|
+
return u`
|
|
256
|
+
<wui-flex
|
|
257
|
+
flexDirection="column"
|
|
258
|
+
alignItems="center"
|
|
259
|
+
.padding=${["l", "0", "l", "0"]}
|
|
260
|
+
gap="l"
|
|
261
|
+
>
|
|
262
|
+
<wui-flex
|
|
263
|
+
class="email-display"
|
|
264
|
+
flexDirection="column"
|
|
265
|
+
alignItems="center"
|
|
266
|
+
.padding=${["0", "xl", "0", "xl"]}
|
|
267
|
+
>
|
|
268
|
+
<wui-text variant="paragraph-400" color="fg-100" align="center">
|
|
269
|
+
Enter the code we sent to
|
|
270
|
+
</wui-text>
|
|
271
|
+
<wui-text variant="paragraph-500" color="fg-100" lineClamp="1" align="center">
|
|
272
|
+
${this.email}
|
|
273
|
+
</wui-text>
|
|
274
|
+
</wui-flex>
|
|
275
|
+
|
|
276
|
+
<wui-text variant="small-400" color="fg-200">The code expires in 20 minutes</wui-text>
|
|
277
|
+
|
|
278
|
+
${this.loading ? u`<wui-loading-spinner size="xl" color="accent-100"></wui-loading-spinner>` : u` <wui-flex flexDirection="column" alignItems="center" gap="xs">
|
|
279
|
+
<wui-otp
|
|
280
|
+
dissabled
|
|
281
|
+
length="6"
|
|
282
|
+
@inputChange=${this.onOtpInputChange.bind(this)}
|
|
283
|
+
.otp=${this.otp}
|
|
284
|
+
></wui-otp>
|
|
285
|
+
${this.error ? u`
|
|
286
|
+
<wui-text variant="small-400" align="center" color="error-100">
|
|
287
|
+
${this.error}. Try Again
|
|
288
|
+
</wui-text>
|
|
289
|
+
` : null}
|
|
290
|
+
</wui-flex>`}
|
|
291
|
+
|
|
292
|
+
<wui-flex alignItems="center" gap="xs">
|
|
293
|
+
<wui-text variant="small-400" color="fg-200">${t.title}</wui-text>
|
|
294
|
+
<wui-link @click=${this.onResendCode.bind(this)} .disabled=${e}>
|
|
295
|
+
${t.action}
|
|
296
|
+
</wui-link>
|
|
297
|
+
</wui-flex>
|
|
298
|
+
</wui-flex>
|
|
299
|
+
`;
|
|
300
|
+
}
|
|
301
|
+
startOTPTimeout() {
|
|
302
|
+
this.timeoutTimeLeft = S.getTimeToNextEmailLogin(), this.OTPTimeout = setInterval(() => {
|
|
303
|
+
this.timeoutTimeLeft > 0 ? this.timeoutTimeLeft = S.getTimeToNextEmailLogin() : clearInterval(this.OTPTimeout);
|
|
304
|
+
}, 1e3);
|
|
305
|
+
}
|
|
306
|
+
async onOtpInputChange(e) {
|
|
307
|
+
var t;
|
|
308
|
+
try {
|
|
309
|
+
this.loading || (this.otp = e.detail, this.shouldSubmitOnOtpChange() && (this.loading = !0, await ((t = this.onOtpSubmit) == null ? void 0 : t.call(this, this.otp))));
|
|
310
|
+
} catch (n) {
|
|
311
|
+
this.error = O.parseError(n), this.loading = !1;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async onResendCode() {
|
|
315
|
+
try {
|
|
316
|
+
if (this.onOtpResend) {
|
|
317
|
+
if (!this.loading && !this.timeoutTimeLeft) {
|
|
318
|
+
if (this.error = "", this.otp = "", !h.getAuthConnector() || !this.email)
|
|
319
|
+
throw new Error("w3m-email-otp-widget: Unable to resend email");
|
|
320
|
+
this.loading = !0, await this.onOtpResend(this.email), this.startOTPTimeout(), f.showSuccess("Code email resent");
|
|
321
|
+
}
|
|
322
|
+
} else this.onStartOver && this.onStartOver();
|
|
323
|
+
} catch (e) {
|
|
324
|
+
f.showError(e);
|
|
325
|
+
} finally {
|
|
326
|
+
this.loading = !1;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
getFooterLabels(e) {
|
|
330
|
+
return this.onStartOver ? {
|
|
331
|
+
title: "Something wrong?",
|
|
332
|
+
action: `Try again ${e ? `in ${this.timeoutTimeLeft}s` : ""}`
|
|
333
|
+
} : {
|
|
334
|
+
title: "Didn't receive it?",
|
|
335
|
+
action: `Resend ${e ? `in ${this.timeoutTimeLeft}s` : "Code"}`
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
shouldSubmitOnOtpChange() {
|
|
339
|
+
return this.authConnector && this.otp.length === T.OTP_LENGTH;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
p.OTP_LENGTH = 6;
|
|
343
|
+
p.styles = Q;
|
|
344
|
+
R([
|
|
345
|
+
m()
|
|
346
|
+
], p.prototype, "loading", void 0);
|
|
347
|
+
R([
|
|
348
|
+
m()
|
|
349
|
+
], p.prototype, "timeoutTimeLeft", void 0);
|
|
350
|
+
R([
|
|
351
|
+
m()
|
|
352
|
+
], p.prototype, "error", void 0);
|
|
353
|
+
p = T = R([
|
|
354
|
+
d("w3m-email-otp-widget")
|
|
355
|
+
], p);
|
|
356
|
+
var J = function(a, e, t, n) {
|
|
357
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
358
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
359
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
360
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
361
|
+
};
|
|
362
|
+
let L = class extends p {
|
|
363
|
+
constructor() {
|
|
364
|
+
super(...arguments), this.onOtpSubmit = async (e) => {
|
|
365
|
+
var t, n, o;
|
|
366
|
+
try {
|
|
367
|
+
if (this.authConnector) {
|
|
368
|
+
const i = V.state.activeChain, r = N.getConnections(i), s = (t = x.state.remoteFeatures) == null ? void 0 : t.multiWallet, y = r.length > 0;
|
|
369
|
+
if (await this.authConnector.provider.connectOtp({ otp: e }), c.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" }), i)
|
|
370
|
+
await N.connectExternal(this.authConnector, i);
|
|
371
|
+
else
|
|
372
|
+
throw new Error("Active chain is not set on ChainControll");
|
|
373
|
+
if (c.sendEvent({
|
|
374
|
+
type: "track",
|
|
375
|
+
event: "CONNECT_SUCCESS",
|
|
376
|
+
properties: {
|
|
377
|
+
method: "email",
|
|
378
|
+
name: this.authConnector.name || "Unknown",
|
|
379
|
+
caipNetworkId: (n = V.getActiveCaipNetwork()) == null ? void 0 : n.caipNetworkId
|
|
380
|
+
}
|
|
381
|
+
}), (o = x.state.remoteFeatures) != null && o.emailCapture)
|
|
382
|
+
return;
|
|
383
|
+
if (x.state.siwx) {
|
|
384
|
+
W.close();
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (y && s) {
|
|
388
|
+
l.replace("ProfileWallets"), f.showSuccess("New Wallet Added");
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
W.close();
|
|
392
|
+
}
|
|
393
|
+
} catch (i) {
|
|
394
|
+
throw c.sendEvent({
|
|
395
|
+
type: "track",
|
|
396
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
397
|
+
properties: { message: O.parseError(i) }
|
|
398
|
+
}), i;
|
|
399
|
+
}
|
|
400
|
+
}, this.onOtpResend = async (e) => {
|
|
401
|
+
this.authConnector && (await this.authConnector.provider.connectEmail({ email: e }), c.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_SENT" }));
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
L = J([
|
|
406
|
+
d("w3m-email-verify-otp-view")
|
|
407
|
+
], L);
|
|
408
|
+
const X = E`
|
|
409
|
+
wui-icon-box {
|
|
410
|
+
height: var(--wui-icon-box-size-xl);
|
|
411
|
+
width: var(--wui-icon-box-size-xl);
|
|
412
|
+
}
|
|
413
|
+
`;
|
|
414
|
+
var k = function(a, e, t, n) {
|
|
415
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
416
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
417
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
418
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
419
|
+
};
|
|
420
|
+
let I = class extends v {
|
|
421
|
+
constructor() {
|
|
422
|
+
var e;
|
|
423
|
+
super(), this.email = (e = l.state.data) == null ? void 0 : e.email, this.authConnector = h.getAuthConnector(), this.loading = !1, this.listenForDeviceApproval();
|
|
424
|
+
}
|
|
425
|
+
render() {
|
|
426
|
+
if (!this.email)
|
|
427
|
+
throw new Error("w3m-email-verify-device-view: No email provided");
|
|
428
|
+
if (!this.authConnector)
|
|
429
|
+
throw new Error("w3m-email-verify-device-view: No auth connector provided");
|
|
430
|
+
return u`
|
|
431
|
+
<wui-flex
|
|
432
|
+
flexDirection="column"
|
|
433
|
+
alignItems="center"
|
|
434
|
+
.padding=${["xxl", "s", "xxl", "s"]}
|
|
435
|
+
gap="l"
|
|
436
|
+
>
|
|
437
|
+
<wui-icon-box
|
|
438
|
+
size="xl"
|
|
439
|
+
iconcolor="accent-100"
|
|
440
|
+
backgroundcolor="accent-100"
|
|
441
|
+
icon="verify"
|
|
442
|
+
background="opaque"
|
|
443
|
+
></wui-icon-box>
|
|
444
|
+
|
|
445
|
+
<wui-flex flexDirection="column" alignItems="center" gap="s">
|
|
446
|
+
<wui-flex flexDirection="column" alignItems="center">
|
|
447
|
+
<wui-text variant="paragraph-400" color="fg-100">
|
|
448
|
+
Approve the login link we sent to
|
|
449
|
+
</wui-text>
|
|
450
|
+
<wui-text variant="paragraph-400" color="fg-100"><b>${this.email}</b></wui-text>
|
|
451
|
+
</wui-flex>
|
|
452
|
+
|
|
453
|
+
<wui-text variant="small-400" color="fg-200" align="center">
|
|
454
|
+
The code expires in 20 minutes
|
|
455
|
+
</wui-text>
|
|
456
|
+
|
|
457
|
+
<wui-flex alignItems="center" id="w3m-resend-section" gap="xs">
|
|
458
|
+
<wui-text variant="small-400" color="fg-100" align="center">
|
|
459
|
+
Didn't receive it?
|
|
460
|
+
</wui-text>
|
|
461
|
+
<wui-link @click=${this.onResendCode.bind(this)} .disabled=${this.loading}>
|
|
462
|
+
Resend email
|
|
463
|
+
</wui-link>
|
|
464
|
+
</wui-flex>
|
|
465
|
+
</wui-flex>
|
|
466
|
+
</wui-flex>
|
|
467
|
+
`;
|
|
468
|
+
}
|
|
469
|
+
async listenForDeviceApproval() {
|
|
470
|
+
if (this.authConnector)
|
|
471
|
+
try {
|
|
472
|
+
await this.authConnector.provider.connectDevice(), c.sendEvent({ type: "track", event: "DEVICE_REGISTERED_FOR_EMAIL" }), c.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_SENT" }), l.replace("EmailVerifyOtp", { email: this.email });
|
|
473
|
+
} catch {
|
|
474
|
+
l.goBack();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
async onResendCode() {
|
|
478
|
+
try {
|
|
479
|
+
if (!this.loading) {
|
|
480
|
+
if (!this.authConnector || !this.email)
|
|
481
|
+
throw new Error("w3m-email-login-widget: Unable to resend email");
|
|
482
|
+
this.loading = !0, await this.authConnector.provider.connectEmail({ email: this.email }), this.listenForDeviceApproval(), f.showSuccess("Code email resent");
|
|
483
|
+
}
|
|
484
|
+
} catch (e) {
|
|
485
|
+
f.showError(e);
|
|
486
|
+
} finally {
|
|
487
|
+
this.loading = !1;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
I.styles = X;
|
|
492
|
+
k([
|
|
493
|
+
m()
|
|
494
|
+
], I.prototype, "loading", void 0);
|
|
495
|
+
I = k([
|
|
496
|
+
d("w3m-email-verify-device-view")
|
|
497
|
+
], I);
|
|
498
|
+
const Z = E`
|
|
499
|
+
wui-email-input {
|
|
500
|
+
width: 100%;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
form {
|
|
504
|
+
width: 100%;
|
|
505
|
+
display: block;
|
|
506
|
+
position: relative;
|
|
507
|
+
}
|
|
508
|
+
`;
|
|
509
|
+
var D = function(a, e, t, n) {
|
|
510
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
511
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
512
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
513
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
514
|
+
};
|
|
515
|
+
let b = class extends v {
|
|
516
|
+
constructor() {
|
|
517
|
+
var e, t;
|
|
518
|
+
super(...arguments), this.formRef = B(), this.initialEmail = ((e = l.state.data) == null ? void 0 : e.email) ?? "", this.redirectView = (t = l.state.data) == null ? void 0 : t.redirectView, this.email = "", this.loading = !1;
|
|
519
|
+
}
|
|
520
|
+
firstUpdated() {
|
|
521
|
+
var e;
|
|
522
|
+
(e = this.formRef.value) == null || e.addEventListener("keydown", (t) => {
|
|
523
|
+
t.key === "Enter" && this.onSubmitEmail(t);
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
render() {
|
|
527
|
+
return u`
|
|
528
|
+
<wui-flex flexDirection="column" padding="m" gap="m">
|
|
529
|
+
<form ${H(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}>
|
|
530
|
+
<wui-email-input
|
|
531
|
+
value=${this.initialEmail}
|
|
532
|
+
.disabled=${this.loading}
|
|
533
|
+
@inputChange=${this.onEmailInputChange.bind(this)}
|
|
534
|
+
>
|
|
535
|
+
</wui-email-input>
|
|
536
|
+
<input type="submit" hidden />
|
|
537
|
+
</form>
|
|
538
|
+
${this.buttonsTemplate()}
|
|
539
|
+
</wui-flex>
|
|
540
|
+
`;
|
|
541
|
+
}
|
|
542
|
+
onEmailInputChange(e) {
|
|
543
|
+
this.email = e.detail;
|
|
544
|
+
}
|
|
545
|
+
async onSubmitEmail(e) {
|
|
546
|
+
try {
|
|
547
|
+
if (this.loading)
|
|
548
|
+
return;
|
|
549
|
+
this.loading = !0, e.preventDefault();
|
|
550
|
+
const t = h.getAuthConnector();
|
|
551
|
+
if (!t)
|
|
552
|
+
throw new Error("w3m-update-email-wallet: Auth connector not found");
|
|
553
|
+
const n = await t.provider.updateEmail({ email: this.email });
|
|
554
|
+
c.sendEvent({ type: "track", event: "EMAIL_EDIT" }), n.action === "VERIFY_SECONDARY_OTP" ? l.push("UpdateEmailSecondaryOtp", {
|
|
555
|
+
email: this.initialEmail,
|
|
556
|
+
newEmail: this.email,
|
|
557
|
+
redirectView: this.redirectView
|
|
558
|
+
}) : l.push("UpdateEmailPrimaryOtp", {
|
|
559
|
+
email: this.initialEmail,
|
|
560
|
+
newEmail: this.email,
|
|
561
|
+
redirectView: this.redirectView
|
|
562
|
+
});
|
|
563
|
+
} catch (t) {
|
|
564
|
+
f.showError(t), this.loading = !1;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
buttonsTemplate() {
|
|
568
|
+
const e = !this.loading && this.email.length > 3 && this.email !== this.initialEmail;
|
|
569
|
+
return this.redirectView ? u`
|
|
570
|
+
<wui-flex gap="s">
|
|
571
|
+
<wui-button size="md" variant="neutral" fullWidth @click=${l.goBack}>
|
|
572
|
+
Cancel
|
|
573
|
+
</wui-button>
|
|
574
|
+
|
|
575
|
+
<wui-button
|
|
576
|
+
size="md"
|
|
577
|
+
variant="main"
|
|
578
|
+
fullWidth
|
|
579
|
+
@click=${this.onSubmitEmail.bind(this)}
|
|
580
|
+
.disabled=${!e}
|
|
581
|
+
.loading=${this.loading}
|
|
582
|
+
>
|
|
583
|
+
Save
|
|
584
|
+
</wui-button>
|
|
585
|
+
</wui-flex>
|
|
586
|
+
` : u`
|
|
587
|
+
<wui-button
|
|
588
|
+
size="md"
|
|
589
|
+
variant="main"
|
|
590
|
+
fullWidth
|
|
591
|
+
@click=${this.onSubmitEmail.bind(this)}
|
|
592
|
+
.disabled=${!e}
|
|
593
|
+
.loading=${this.loading}
|
|
594
|
+
>
|
|
595
|
+
Save
|
|
596
|
+
</wui-button>
|
|
597
|
+
`;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
b.styles = Z;
|
|
601
|
+
D([
|
|
602
|
+
m()
|
|
603
|
+
], b.prototype, "email", void 0);
|
|
604
|
+
D([
|
|
605
|
+
m()
|
|
606
|
+
], b.prototype, "loading", void 0);
|
|
607
|
+
b = D([
|
|
608
|
+
d("w3m-update-email-wallet-view")
|
|
609
|
+
], b);
|
|
610
|
+
var ee = function(a, e, t, n) {
|
|
611
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
612
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
613
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
614
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
615
|
+
};
|
|
616
|
+
let F = class extends p {
|
|
617
|
+
constructor() {
|
|
618
|
+
var e;
|
|
619
|
+
super(), this.email = (e = l.state.data) == null ? void 0 : e.email, this.onOtpSubmit = async (t) => {
|
|
620
|
+
try {
|
|
621
|
+
this.authConnector && (await this.authConnector.provider.updateEmailPrimaryOtp({ otp: t }), c.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" }), l.replace("UpdateEmailSecondaryOtp", l.state.data));
|
|
622
|
+
} catch (n) {
|
|
623
|
+
throw c.sendEvent({
|
|
624
|
+
type: "track",
|
|
625
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
626
|
+
properties: { message: O.parseError(n) }
|
|
627
|
+
}), n;
|
|
628
|
+
}
|
|
629
|
+
}, this.onStartOver = () => {
|
|
630
|
+
l.replace("UpdateEmailWallet", l.state.data);
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
F = ee([
|
|
635
|
+
d("w3m-update-email-primary-otp-view")
|
|
636
|
+
], F);
|
|
637
|
+
var te = function(a, e, t, n) {
|
|
638
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
639
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
640
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
641
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
642
|
+
};
|
|
643
|
+
let j = class extends p {
|
|
644
|
+
constructor() {
|
|
645
|
+
var e, t;
|
|
646
|
+
super(), this.email = (e = l.state.data) == null ? void 0 : e.newEmail, this.redirectView = (t = l.state.data) == null ? void 0 : t.redirectView, this.onOtpSubmit = async (n) => {
|
|
647
|
+
try {
|
|
648
|
+
this.authConnector && (await this.authConnector.provider.updateEmailSecondaryOtp({ otp: n }), c.sendEvent({ type: "track", event: "EMAIL_VERIFICATION_CODE_PASS" }), this.redirectView && l.reset(this.redirectView));
|
|
649
|
+
} catch (o) {
|
|
650
|
+
throw c.sendEvent({
|
|
651
|
+
type: "track",
|
|
652
|
+
event: "EMAIL_VERIFICATION_CODE_FAIL",
|
|
653
|
+
properties: { message: O.parseError(o) }
|
|
654
|
+
}), o;
|
|
655
|
+
}
|
|
656
|
+
}, this.onStartOver = () => {
|
|
657
|
+
l.replace("UpdateEmailWallet", l.state.data);
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
j = te([
|
|
662
|
+
d("w3m-update-email-secondary-otp-view")
|
|
663
|
+
], j);
|
|
664
|
+
var z = function(a, e, t, n) {
|
|
665
|
+
var o = arguments.length, i = o < 3 ? e : n === null ? n = Object.getOwnPropertyDescriptor(e, t) : n, r;
|
|
666
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(a, e, t, n);
|
|
667
|
+
else for (var s = a.length - 1; s >= 0; s--) (r = a[s]) && (i = (o < 3 ? r(i) : o > 3 ? r(e, t, i) : r(e, t)) || i);
|
|
668
|
+
return o > 3 && i && Object.defineProperty(e, t, i), i;
|
|
669
|
+
};
|
|
670
|
+
let A = class extends v {
|
|
671
|
+
constructor() {
|
|
672
|
+
var e;
|
|
673
|
+
super(), this.authConnector = h.getAuthConnector(), this.isEmailEnabled = (e = x.state.remoteFeatures) == null ? void 0 : e.email, this.isAuthEnabled = this.checkIfAuthEnabled(h.state.connectors), this.connectors = h.state.connectors, h.subscribeKey("connectors", (t) => {
|
|
674
|
+
this.connectors = t, this.isAuthEnabled = this.checkIfAuthEnabled(this.connectors);
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
render() {
|
|
678
|
+
if (!this.isEmailEnabled)
|
|
679
|
+
throw new Error("w3m-email-login-view: Email is not enabled");
|
|
680
|
+
if (!this.isAuthEnabled)
|
|
681
|
+
throw new Error("w3m-email-login-view: No auth connector provided");
|
|
682
|
+
return u`<wui-flex
|
|
683
|
+
flexDirection="column"
|
|
684
|
+
.padding=${["3xs", "m", "m", "m"]}
|
|
685
|
+
gap="l"
|
|
686
|
+
>
|
|
687
|
+
<w3m-email-login-widget></w3m-email-login-widget>
|
|
688
|
+
</wui-flex> `;
|
|
689
|
+
}
|
|
690
|
+
checkIfAuthEnabled(e) {
|
|
691
|
+
const t = e.filter((o) => o.type === q.CONNECTOR_TYPE_AUTH).map((o) => o.chain);
|
|
692
|
+
return G.AUTH_CONNECTOR_SUPPORTED_CHAINS.some((o) => t.includes(o));
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
z([
|
|
696
|
+
m()
|
|
697
|
+
], A.prototype, "connectors", void 0);
|
|
698
|
+
A = z([
|
|
699
|
+
d("w3m-email-login-view")
|
|
700
|
+
], A);
|
|
701
|
+
export {
|
|
702
|
+
L as W,
|
|
703
|
+
I as a,
|
|
704
|
+
b,
|
|
705
|
+
F as c,
|
|
706
|
+
j as d,
|
|
707
|
+
A as e,
|
|
708
|
+
p as f
|
|
709
|
+
};
|