@lnfi-network/nodeflow-sdk 1.0.0-alpha.0
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 +276 -0
- package/dist/SwapController-C-2g6oSP.js +447 -0
- package/dist/add-DDBnz1-Q.js +19 -0
- package/dist/all-wallets-XTwjZKGg.js +10 -0
- package/dist/app-store-sCzhkWOo.js +21 -0
- package/dist/apple-C4IG4u61.js +22 -0
- package/dist/arrow-bottom-D5KjiSxX.js +12 -0
- package/dist/arrow-bottom-circle-BwWTHJky.js +15 -0
- package/dist/arrow-left-hn1Ftfvb.js +12 -0
- package/dist/arrow-right-CkV03q5Q.js +12 -0
- package/dist/arrow-top-BFm9X5g1.js +12 -0
- package/dist/bank-BUCrVHdo.js +18 -0
- package/dist/bin-BKleaahE.js +8 -0
- package/dist/bitcoin-C7iWQVuy.js +17 -0
- package/dist/browser-CpOtTIku.js +18 -0
- package/dist/build-info.json +1 -0
- package/dist/card-CJ3tg2Ri.js +18 -0
- package/dist/ccip-DyUNuvL1.js +239 -0
- package/dist/checkmark-CvSC6zeV.js +15 -0
- package/dist/checkmark-bold-DyZJqlJ7.js +12 -0
- package/dist/chevron-bottom-T9v1OvPA.js +12 -0
- package/dist/chevron-left-B4I8A8BR.js +12 -0
- package/dist/chevron-right-DGcVStvL.js +12 -0
- package/dist/chevron-top-BtD7BPVB.js +12 -0
- package/dist/chrome-store-BTKxY14m.js +65 -0
- package/dist/circle-DLLZtCBf.js +8 -0
- package/dist/clock-BNIDUPYZ.js +12 -0
- package/dist/close-BscNWH3j.js +12 -0
- package/dist/coinPlaceholder-JCYCAADZ.js +12 -0
- package/dist/compass-D7B-kHmZ.js +12 -0
- package/dist/copy-DHBc9gJO.js +19 -0
- package/dist/cursor-DKduK293.js +7 -0
- package/dist/cursor-transparent-8DkjrHTm.js +16 -0
- package/dist/desktop-ChlWl7Ma.js +13 -0
- package/dist/disconnect-CML_GEin.js +12 -0
- package/dist/discord-CgAM6i7H.js +21 -0
- package/dist/email-8mepCwp-.js +10 -0
- package/dist/embedded-wallet-scU49N5X.js +464 -0
- package/dist/ethereum-CA-_7cWX.js +14 -0
- package/dist/etherscan-B4h2i8Uc.js +10 -0
- package/dist/exclamation-triangle-ftOWMqSf.js +8 -0
- package/dist/extension-7iqlSonF.js +12 -0
- package/dist/external-link-DAvuMfW6.js +12 -0
- package/dist/facebook-CsyBIxMB.js +30 -0
- package/dist/farcaster-DfetCk1r.js +16 -0
- package/dist/filters-CsU-LYSd.js +12 -0
- package/dist/font/ClashDisplay-Variable.ttf +0 -0
- package/dist/font/ClashDisplay-Variable.woff +0 -0
- package/dist/font/ClashDisplay-Variable.woff2 +0 -0
- package/dist/github-DjxwfOOF.js +22 -0
- package/dist/google--g4VSi6h.js +22 -0
- package/dist/help-circle-BPA985E7.js +16 -0
- package/dist/id-BCUBMri8.js +16 -0
- package/dist/image-gYCDO7su.js +8 -0
- package/dist/index-B9q3HG5u.js +709 -0
- package/dist/index-BEm1bPeX.js +63547 -0
- package/dist/index-CCgAY-U4.js +70 -0
- package/dist/index-CRbuhHbe.js +33 -0
- package/dist/index-DYL5OPkx.js +1060 -0
- package/dist/info-CIaFQJ_e.js +7 -0
- package/dist/info-circle-BPz5hFQa.js +16 -0
- package/dist/lightbulb-BDmHvdbq.js +7 -0
- package/dist/mail-DQiXQ-4_.js +12 -0
- package/dist/mobile-CG_8sNWZ.js +13 -0
- package/dist/more-B1H_I3-I.js +15 -0
- package/dist/network-placeholder-1RWeD7Yp.js +18 -0
- package/dist/nftPlaceholder-Cg-f-eaw.js +12 -0
- package/dist/nodeflow-sdk.es.js +15 -0
- package/dist/off-DB-2L-AT.js +8 -0
- package/dist/onramp-DI5eQmAC.js +917 -0
- package/dist/play-store-DKJRWbqp.js +36 -0
- package/dist/plus-By1Ef8nV.js +17 -0
- package/dist/qr-code-DGuZgP-9.js +10 -0
- package/dist/receive-BEsZr88v.js +179 -0
- package/dist/recycle-horizontal-DubwRDbc.js +13 -0
- package/dist/refresh-Dwfvwy6t.js +12 -0
- package/dist/reown-logo-oDEjOrqY.js +16 -0
- package/dist/search-DX_QdW9h.js +12 -0
- package/dist/send-Bd5bwLNJ.js +1039 -0
- package/dist/send-Dq4B7ftm.js +19 -0
- package/dist/socials-BnnwB5_t.js +589 -0
- package/dist/solana-B7Ds9KBT.js +17 -0
- package/dist/swapHorizontal-CF6_7qU-.js +12 -0
- package/dist/swapHorizontalBold-C-YFgVbc.js +12 -0
- package/dist/swapHorizontalMedium-BGOdc8_e.js +20 -0
- package/dist/swapHorizontalRoundedBold-D_vYgwwO.js +12 -0
- package/dist/swapVertical-j2pWqia1.js +12 -0
- package/dist/swaps-Bh2kuHjL.js +1713 -0
- package/dist/telegram-bh_htnzP.js +20 -0
- package/dist/three-dots-B31D_Ocu.js +9 -0
- package/dist/transactions-Ch56TR3p.js +35 -0
- package/dist/twitch-DUloatpE.js +22 -0
- package/dist/twitterIcon-CNo6b91J.js +10 -0
- package/dist/ui-C7PJmqHY.js +812 -0
- package/dist/user-DqFnAlKR.js +7 -0
- package/dist/verify-BmaaygAV.js +12 -0
- package/dist/verify-filled-BwLeEdJj.js +12 -0
- package/dist/vite.svg +1 -0
- package/dist/w3m-modal-BijXCMl6.js +1041 -0
- package/dist/wallet-DyP6_6JN.js +12 -0
- package/dist/wallet-placeholder-BZC82rR0.js +18 -0
- package/dist/walletconnect-DT69luRK.js +36 -0
- package/dist/warning-circle-CGbg6QZn.js +16 -0
- package/dist/x-BfEtqtAc.js +16 -0
- package/dist/x-mark-CSmIdhvb.js +7 -0
- package/package.json +53 -0
|
@@ -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, aa as m, a7 as D, aW as A, R as l, a3 as h, Y as O, S as f, V, O as N, aA as x, Q as c, aH as W, aP as H, aR as B, aN as q, P as G } from "./index-BEm1bPeX.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) : D.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 && D.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 J = 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
|
+
}, S;
|
|
240
|
+
let p = S = 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 = A.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 = A.getTimeToNextEmailLogin(), this.OTPTimeout = setInterval(() => {
|
|
303
|
+
this.timeoutTimeLeft > 0 ? this.timeoutTimeLeft = A.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 === S.OTP_LENGTH;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
p.OTP_LENGTH = 6;
|
|
343
|
+
p.styles = J;
|
|
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 = S = R([
|
|
354
|
+
d("w3m-email-otp-widget")
|
|
355
|
+
], p);
|
|
356
|
+
var Q = 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 = Q([
|
|
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 P = 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 = H(), 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 ${B(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
|
+
P([
|
|
602
|
+
m()
|
|
603
|
+
], b.prototype, "email", void 0);
|
|
604
|
+
P([
|
|
605
|
+
m()
|
|
606
|
+
], b.prototype, "loading", void 0);
|
|
607
|
+
b = P([
|
|
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 T = 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
|
+
], T.prototype, "connectors", void 0);
|
|
698
|
+
T = z([
|
|
699
|
+
d("w3m-email-login-view")
|
|
700
|
+
], T);
|
|
701
|
+
export {
|
|
702
|
+
L as W,
|
|
703
|
+
I as a,
|
|
704
|
+
b,
|
|
705
|
+
F as c,
|
|
706
|
+
j as d,
|
|
707
|
+
T as e,
|
|
708
|
+
p as f
|
|
709
|
+
};
|