@directcryptopay/sdk 0.2.4 → 0.3.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.
Files changed (127) hide show
  1. package/README.md +51 -87
  2. package/dist/core/config.d.ts +9 -46
  3. package/dist/core/iframe.d.ts +16 -0
  4. package/dist/dcp-sdk.umd.js +1 -12811
  5. package/dist/dcp.d.ts +12 -5
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +219 -2
  8. package/dist/types.d.ts +26 -164
  9. package/package.json +3 -13
  10. package/dist/ExchangeController-CbO41bcH.js +0 -217
  11. package/dist/HelpersUtil-DHm6EVSE.js +0 -120
  12. package/dist/NavigationUtil-kj9LEOOd.js +0 -8
  13. package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
  14. package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
  15. package/dist/PhArrowDown-C9AkNvLs.js +0 -73
  16. package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
  17. package/dist/PhArrowRight-DM1tna0G.js +0 -73
  18. package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
  19. package/dist/PhArrowUp-DmktzOWy.js +0 -73
  20. package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
  21. package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
  22. package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
  23. package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
  24. package/dist/PhBank-4_9QzqIB.js +0 -73
  25. package/dist/PhBrowser-B-JSznId.js +0 -73
  26. package/dist/PhCaretDown-vV5oHMNi.js +0 -73
  27. package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
  28. package/dist/PhCaretRight-CqQN4TT3.js +0 -73
  29. package/dist/PhCaretUp-Df7UCAHy.js +0 -73
  30. package/dist/PhCheck-gtpfK4ed.js +0 -73
  31. package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
  32. package/dist/PhClock-SDCW-NmF.js +0 -73
  33. package/dist/PhCompass-B7hgtdx-.js +0 -73
  34. package/dist/PhCopy-BcnhyXCy.js +0 -73
  35. package/dist/PhCreditCard-BJjByVgu.js +0 -73
  36. package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
  37. package/dist/PhDesktop-B3VKPuJx.js +0 -73
  38. package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
  39. package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
  40. package/dist/PhEnvelope-67uzHbI9.js +0 -73
  41. package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
  42. package/dist/PhGlobe-TMm_6qGk.js +0 -73
  43. package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
  44. package/dist/PhImage-gY96WtHR.js +0 -73
  45. package/dist/PhInfo-DRQM_ZDP.js +0 -73
  46. package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
  47. package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
  48. package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
  49. package/dist/PhPlus-BfTsQnUz.js +0 -73
  50. package/dist/PhPower-CxYUGOWn.js +0 -73
  51. package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
  52. package/dist/PhQrCode-BuJ97NYJ.js +0 -73
  53. package/dist/PhQuestion-kJoP8Mja.js +0 -73
  54. package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
  55. package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
  56. package/dist/PhSignOut-jk97OSVt.js +0 -73
  57. package/dist/PhSpinner-CiYOhwMg.js +0 -73
  58. package/dist/PhTrash-pxerMqzd.js +0 -73
  59. package/dist/PhUser-BMg0VV4A.js +0 -73
  60. package/dist/PhVault-DYQvx5A-.js +0 -73
  61. package/dist/PhWarning-NLC5Mj87.js +0 -73
  62. package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
  63. package/dist/PhX-Bx4wpwm3.js +0 -73
  64. package/dist/SwapController-Ch0FFTEt.js +0 -457
  65. package/dist/ccip-BrGhNXIM.js +0 -150
  66. package/dist/core/api.d.ts +0 -39
  67. package/dist/core/logic.d.ts +0 -2
  68. package/dist/core/wallet.d.ts +0 -55
  69. package/dist/data-capture-CpafmuCb.js +0 -490
  70. package/dist/email-Dcg4jlai.js +0 -344
  71. package/dist/embedded-wallet-DeoRdAPw.js +0 -820
  72. package/dist/features-B9Nde43h.js +0 -274
  73. package/dist/hashTypedData-a7b8tdkO.js +0 -197
  74. package/dist/if-defined-k21LutCn.js +0 -10
  75. package/dist/index-9vLw53Xl.js +0 -228
  76. package/dist/index-B5wUyynz.js +0 -107
  77. package/dist/index-B8LkUrww.js +0 -86
  78. package/dist/index-BA0VwKg0.js +0 -8189
  79. package/dist/index-BB9JJ24N.js +0 -125
  80. package/dist/index-BCkEvPQ6.js +0 -172
  81. package/dist/index-BDeO_csr.js +0 -171
  82. package/dist/index-Bb7babLF.js +0 -1281
  83. package/dist/index-BjOhprVS.js +0 -199
  84. package/dist/index-BjyMgZsf.js +0 -218
  85. package/dist/index-BkThIDLX.js +0 -159
  86. package/dist/index-BmFs6nb7.js +0 -209
  87. package/dist/index-C1QEJL-2.js +0 -572
  88. package/dist/index-C4qc4PdD.js +0 -387
  89. package/dist/index-CAPvUh14.js +0 -1750
  90. package/dist/index-CBMU3PTE.js +0 -65
  91. package/dist/index-CGwPkJLF.js +0 -355
  92. package/dist/index-CNGEqX3D.js +0 -153
  93. package/dist/index-CRlCq6IB.js +0 -7981
  94. package/dist/index-Cg_o-i9X.js +0 -118
  95. package/dist/index-D1BvhCbI.js +0 -62
  96. package/dist/index-DFi8TiHc.js +0 -128
  97. package/dist/index-DLwuveL9.js +0 -555
  98. package/dist/index-DMn7ktUQ.js +0 -56
  99. package/dist/index-DOXwtuwa.js +0 -117
  100. package/dist/index-DPPOW_Tp.js +0 -118
  101. package/dist/index-DQpzHpW-.js +0 -517
  102. package/dist/index-DXHg5C-W.js +0 -276
  103. package/dist/index-DcYjZV4H.js +0 -110
  104. package/dist/index-DeL88Lwc.js +0 -41655
  105. package/dist/index-DrWVlf8b.js +0 -46
  106. package/dist/index-Dsfuc4rB.js +0 -123
  107. package/dist/index-DuTny38n.js +0 -1175
  108. package/dist/index-Nfjb6bV0.js +0 -21991
  109. package/dist/index-WwwdQSN2.js +0 -85
  110. package/dist/index-Yha9Afch.js +0 -174
  111. package/dist/index-cbQHN7GC.js +0 -100
  112. package/dist/index-hyG3cYsv.js +0 -1083
  113. package/dist/index-qLxmmPaL.js +0 -257
  114. package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
  115. package/dist/onramp-BSiyOX4L.js +0 -855
  116. package/dist/parseSignature-CdCMAPZN.js +0 -3304
  117. package/dist/pay-with-exchange-CduNoMEz.js +0 -525
  118. package/dist/property-Bd8U3_QP.js +0 -618
  119. package/dist/receive-CrmptJlq.js +0 -232
  120. package/dist/ref-SOwYtCZb.js +0 -107
  121. package/dist/send-oMcHMEr6.js +0 -1166
  122. package/dist/socials-C0A4-FbY.js +0 -620
  123. package/dist/swaps-CbJJ9Ciu.js +0 -1760
  124. package/dist/transactions-BDfCoBS5.js +0 -37
  125. package/dist/ui/Modal.d.ts +0 -9
  126. package/dist/ui/index.d.ts +0 -6
  127. package/dist/w3m-modal-BjsTkny7.js +0 -1706
@@ -1,65 +0,0 @@
1
- import { cU as h, cV as l, cX as u, cY as f } from "./index-DeL88Lwc.js";
2
- import { n as p, c as m } from "./index-DuTny38n.js";
3
- const g = h`
4
- :host {
5
- display: block;
6
- width: 100px;
7
- height: 100px;
8
- }
9
-
10
- svg {
11
- width: 100px;
12
- height: 100px;
13
- }
14
-
15
- rect {
16
- fill: none;
17
- stroke: ${(r) => r.colors.accent100};
18
- stroke-width: 3px;
19
- stroke-linecap: round;
20
- animation: dash 1s linear infinite;
21
- }
22
-
23
- @keyframes dash {
24
- to {
25
- stroke-dashoffset: 0px;
26
- }
27
- }
28
- `;
29
- var c = function(r, e, a, s) {
30
- var n = arguments.length, t = n < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, a) : s, o;
31
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") t = Reflect.decorate(r, e, a, s);
32
- else for (var d = r.length - 1; d >= 0; d--) (o = r[d]) && (t = (n < 3 ? o(t) : n > 3 ? o(e, a, t) : o(e, a)) || t);
33
- return n > 3 && t && Object.defineProperty(e, a, t), t;
34
- };
35
- let i = class extends u {
36
- constructor() {
37
- super(...arguments), this.radius = 36;
38
- }
39
- render() {
40
- return this.svgLoaderTemplate();
41
- }
42
- svgLoaderTemplate() {
43
- const e = this.radius > 50 ? 50 : this.radius, s = 36 - e, n = 116 + s, t = 245 + s, o = 360 + s * 1.75;
44
- return f`
45
- <svg viewBox="0 0 110 110" width="110" height="110">
46
- <rect
47
- x="2"
48
- y="2"
49
- width="106"
50
- height="106"
51
- rx=${e}
52
- stroke-dasharray="${n} ${t}"
53
- stroke-dashoffset=${o}
54
- />
55
- </svg>
56
- `;
57
- }
58
- };
59
- i.styles = [l, g];
60
- c([
61
- p({ type: Number })
62
- ], i.prototype, "radius", void 0);
63
- i = c([
64
- m("wui-loading-thumbnail")
65
- ], i);
@@ -1,355 +0,0 @@
1
- import { cU as C, cV as O, cW as P, cX as b, cY as l, c_ as E, dq as g, d0 as S, d8 as I, cG as R, cH as $ } from "./index-DeL88Lwc.js";
2
- import { n as h, c as v, r as d, U as T } from "./index-DuTny38n.js";
3
- import "./index-DcYjZV4H.js";
4
- import "./index-B8LkUrww.js";
5
- const L = C`
6
- :host {
7
- position: relative;
8
- display: inline-block;
9
- }
10
-
11
- input {
12
- width: 48px;
13
- height: 48px;
14
- background: ${({ tokens: n }) => n.theme.foregroundPrimary};
15
- border-radius: ${({ borderRadius: n }) => n[4]};
16
- border: 1px solid ${({ tokens: n }) => n.theme.borderPrimary};
17
- font-family: ${({ fontFamily: n }) => n.regular};
18
- font-size: ${({ textSize: n }) => n.large};
19
- line-height: 18px;
20
- letter-spacing: -0.16px;
21
- text-align: center;
22
- color: ${({ tokens: n }) => n.theme.textPrimary};
23
- caret-color: ${({ tokens: n }) => n.core.textAccentPrimary};
24
- transition:
25
- background-color ${({ durations: n }) => n.lg}
26
- ${({ easings: n }) => n["ease-out-power-2"]},
27
- border-color ${({ durations: n }) => n.lg}
28
- ${({ easings: n }) => n["ease-out-power-2"]},
29
- box-shadow ${({ durations: n }) => n.lg}
30
- ${({ easings: n }) => n["ease-out-power-2"]};
31
- will-change: background-color, border-color, box-shadow;
32
- box-sizing: border-box;
33
- -webkit-appearance: none;
34
- -moz-appearance: textfield;
35
- padding: ${({ spacing: n }) => n[4]};
36
- }
37
-
38
- input::-webkit-outer-spin-button,
39
- input::-webkit-inner-spin-button {
40
- -webkit-appearance: none;
41
- margin: 0;
42
- }
43
-
44
- input[type='number'] {
45
- -moz-appearance: textfield;
46
- }
47
-
48
- input:disabled {
49
- cursor: not-allowed;
50
- opacity: 0.5;
51
- }
52
-
53
- input:focus-visible:enabled {
54
- background-color: transparent;
55
- border: 1px solid ${({ tokens: n }) => n.theme.borderSecondary};
56
- box-shadow: 0px 0px 0px 4px ${({ tokens: n }) => n.core.foregroundAccent040};
57
- }
58
- `;
59
- var y = function(n, t, e, i) {
60
- var r = arguments.length, o = r < 3 ? t : i === null ? i = Object.getOwnPropertyDescriptor(t, e) : i, s;
61
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(n, t, e, i);
62
- else for (var a = n.length - 1; a >= 0; a--) (s = n[a]) && (o = (r < 3 ? s(o) : r > 3 ? s(t, e, o) : s(t, e)) || o);
63
- return r > 3 && o && Object.defineProperty(t, e, o), o;
64
- };
65
- let p = class extends b {
66
- constructor() {
67
- super(...arguments), this.disabled = !1, this.value = "";
68
- }
69
- render() {
70
- return l`<input
71
- type="number"
72
- maxlength="1"
73
- inputmode="numeric"
74
- autofocus
75
- ?disabled=${this.disabled}
76
- value=${this.value}
77
- /> `;
78
- }
79
- };
80
- p.styles = [O, P, L];
81
- y([
82
- h({ type: Boolean })
83
- ], p.prototype, "disabled", void 0);
84
- y([
85
- h({ type: String })
86
- ], p.prototype, "value", void 0);
87
- p = y([
88
- v("wui-input-numeric")
89
- ], p);
90
- const _ = E`
91
- :host {
92
- position: relative;
93
- display: block;
94
- }
95
- `;
96
- var m = function(n, t, e, i) {
97
- var r = arguments.length, o = r < 3 ? t : i === null ? i = Object.getOwnPropertyDescriptor(t, e) : i, s;
98
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(n, t, e, i);
99
- else for (var a = n.length - 1; a >= 0; a--) (s = n[a]) && (o = (r < 3 ? s(o) : r > 3 ? s(t, e, o) : s(t, e)) || o);
100
- return r > 3 && o && Object.defineProperty(t, e, o), o;
101
- };
102
- let c = class extends b {
103
- constructor() {
104
- super(...arguments), this.length = 6, this.otp = "", this.values = Array.from({ length: this.length }).map(() => ""), this.numerics = [], this.shouldInputBeEnabled = (t) => this.values.slice(0, t).every((i) => i !== ""), this.handleKeyDown = (t, e) => {
105
- const i = t.target, r = this.getInputElement(i), o = ["ArrowLeft", "ArrowRight", "Shift", "Delete"];
106
- if (!r)
107
- return;
108
- o.includes(t.key) && t.preventDefault();
109
- const s = r.selectionStart;
110
- switch (t.key) {
111
- case "ArrowLeft":
112
- s && r.setSelectionRange(s + 1, s + 1), this.focusInputField("prev", e);
113
- break;
114
- case "ArrowRight":
115
- this.focusInputField("next", e);
116
- break;
117
- case "Shift":
118
- this.focusInputField("next", e);
119
- break;
120
- case "Delete":
121
- r.value === "" ? this.focusInputField("prev", e) : this.updateInput(r, e, "");
122
- break;
123
- case "Backspace":
124
- r.value === "" ? this.focusInputField("prev", e) : this.updateInput(r, e, "");
125
- break;
126
- }
127
- }, this.focusInputField = (t, e) => {
128
- if (t === "next") {
129
- const i = e + 1;
130
- if (!this.shouldInputBeEnabled(i))
131
- return;
132
- const r = this.numerics[i < this.length ? i : e], o = r ? this.getInputElement(r) : void 0;
133
- o && (o.disabled = !1, o.focus());
134
- }
135
- if (t === "prev") {
136
- const i = e - 1, r = this.numerics[i > -1 ? i : e], o = r ? this.getInputElement(r) : void 0;
137
- o && o.focus();
138
- }
139
- };
140
- }
141
- firstUpdated() {
142
- var e, i;
143
- this.otp && (this.values = this.otp.split(""));
144
- const t = (e = this.shadowRoot) == null ? void 0 : e.querySelectorAll("wui-input-numeric");
145
- t && (this.numerics = Array.from(t)), (i = this.numerics[0]) == null || i.focus();
146
- }
147
- render() {
148
- return l`
149
- <wui-flex gap="1" data-testid="wui-otp-input">
150
- ${Array.from({ length: this.length }).map((t, e) => l`
151
- <wui-input-numeric
152
- @input=${(i) => this.handleInput(i, e)}
153
- @click=${(i) => this.selectInput(i)}
154
- @keydown=${(i) => this.handleKeyDown(i, e)}
155
- .disabled=${!this.shouldInputBeEnabled(e)}
156
- .value=${this.values[e] || ""}
157
- >
158
- </wui-input-numeric>
159
- `)}
160
- </wui-flex>
161
- `;
162
- }
163
- updateInput(t, e, i) {
164
- const r = this.numerics[e], o = t || (r ? this.getInputElement(r) : void 0);
165
- o && (o.value = i, this.values = this.values.map((s, a) => a === e ? i : s));
166
- }
167
- selectInput(t) {
168
- const e = t.target;
169
- if (e) {
170
- const i = this.getInputElement(e);
171
- i == null || i.select();
172
- }
173
- }
174
- handleInput(t, e) {
175
- const i = t.target, r = this.getInputElement(i);
176
- if (r) {
177
- const o = r.value;
178
- t.inputType === "insertFromPaste" ? this.handlePaste(r, o, e) : T.isNumber(o) && t.data ? (this.updateInput(r, e, t.data), this.focusInputField("next", e)) : this.updateInput(r, e, "");
179
- }
180
- this.dispatchInputChangeEvent();
181
- }
182
- handlePaste(t, e, i) {
183
- const r = e[0];
184
- if (r && T.isNumber(r)) {
185
- this.updateInput(t, i, r);
186
- const s = e.substring(1);
187
- if (i + 1 < this.length && s.length) {
188
- const a = this.numerics[i + 1], x = a ? this.getInputElement(a) : void 0;
189
- x && this.handlePaste(x, s, i + 1);
190
- } else
191
- this.focusInputField("next", i);
192
- } else
193
- this.updateInput(t, i, "");
194
- }
195
- getInputElement(t) {
196
- var e;
197
- return (e = t.shadowRoot) != null && e.querySelector("input") ? t.shadowRoot.querySelector("input") : null;
198
- }
199
- dispatchInputChangeEvent() {
200
- const t = this.values.join("");
201
- this.dispatchEvent(new CustomEvent("inputChange", {
202
- detail: t,
203
- bubbles: !0,
204
- composed: !0
205
- }));
206
- }
207
- };
208
- c.styles = [O, _];
209
- m([
210
- h({ type: Number })
211
- ], c.prototype, "length", void 0);
212
- m([
213
- h({ type: String })
214
- ], c.prototype, "otp", void 0);
215
- m([
216
- d()
217
- ], c.prototype, "values", void 0);
218
- c = m([
219
- v("wui-otp")
220
- ], c);
221
- const k = E`
222
- wui-loading-spinner {
223
- margin: 9px auto;
224
- }
225
-
226
- .email-display,
227
- .email-display wui-text {
228
- max-width: 100%;
229
- }
230
- `;
231
- var f = function(n, t, e, i) {
232
- var r = arguments.length, o = r < 3 ? t : i === null ? i = Object.getOwnPropertyDescriptor(t, e) : i, s;
233
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(n, t, e, i);
234
- else for (var a = n.length - 1; a >= 0; a--) (s = n[a]) && (o = (r < 3 ? s(o) : r > 3 ? s(t, e, o) : s(t, e)) || o);
235
- return r > 3 && o && Object.defineProperty(t, e, o), o;
236
- }, w;
237
- let u = w = class extends b {
238
- firstUpdated() {
239
- this.startOTPTimeout();
240
- }
241
- disconnectedCallback() {
242
- clearTimeout(this.OTPTimeout);
243
- }
244
- constructor() {
245
- var t;
246
- super(), this.loading = !1, this.timeoutTimeLeft = g.getTimeToNextEmailLogin(), this.error = "", this.otp = "", this.email = (t = S.state.data) == null ? void 0 : t.email, this.authConnector = I.getAuthConnector();
247
- }
248
- render() {
249
- if (!this.email)
250
- throw new Error("w3m-email-otp-widget: No email provided");
251
- const t = !!this.timeoutTimeLeft, e = this.getFooterLabels(t);
252
- return l`
253
- <wui-flex
254
- flexDirection="column"
255
- alignItems="center"
256
- .padding=${["4", "0", "4", "0"]}
257
- gap="4"
258
- >
259
- <wui-flex
260
- class="email-display"
261
- flexDirection="column"
262
- alignItems="center"
263
- .padding=${["0", "5", "0", "5"]}
264
- >
265
- <wui-text variant="md-regular" color="primary" align="center">
266
- Enter the code we sent to
267
- </wui-text>
268
- <wui-text variant="md-medium" color="primary" lineClamp="1" align="center">
269
- ${this.email}
270
- </wui-text>
271
- </wui-flex>
272
-
273
- <wui-text variant="sm-regular" color="secondary">The code expires in 20 minutes</wui-text>
274
-
275
- ${this.loading ? l`<wui-loading-spinner size="xl" color="accent-primary"></wui-loading-spinner>` : l` <wui-flex flexDirection="column" alignItems="center" gap="2">
276
- <wui-otp
277
- dissabled
278
- length="6"
279
- @inputChange=${this.onOtpInputChange.bind(this)}
280
- .otp=${this.otp}
281
- ></wui-otp>
282
- ${this.error ? l`
283
- <wui-text variant="sm-regular" align="center" color="error">
284
- ${this.error}. Try Again
285
- </wui-text>
286
- ` : null}
287
- </wui-flex>`}
288
-
289
- <wui-flex alignItems="center" gap="2">
290
- <wui-text variant="sm-regular" color="secondary">${e.title}</wui-text>
291
- <wui-link @click=${this.onResendCode.bind(this)} .disabled=${t}>
292
- ${e.action}
293
- </wui-link>
294
- </wui-flex>
295
- </wui-flex>
296
- `;
297
- }
298
- startOTPTimeout() {
299
- this.timeoutTimeLeft = g.getTimeToNextEmailLogin(), this.OTPTimeout = setInterval(() => {
300
- this.timeoutTimeLeft > 0 ? this.timeoutTimeLeft = g.getTimeToNextEmailLogin() : clearInterval(this.OTPTimeout);
301
- }, 1e3);
302
- }
303
- async onOtpInputChange(t) {
304
- var e;
305
- try {
306
- this.loading || (this.otp = t.detail, this.shouldSubmitOnOtpChange() && (this.loading = !0, await ((e = this.onOtpSubmit) == null ? void 0 : e.call(this, this.otp))));
307
- } catch (i) {
308
- this.error = R.parseError(i), this.loading = !1;
309
- }
310
- }
311
- async onResendCode() {
312
- try {
313
- if (this.onOtpResend) {
314
- if (!this.loading && !this.timeoutTimeLeft) {
315
- if (this.error = "", this.otp = "", !I.getAuthConnector() || !this.email)
316
- throw new Error("w3m-email-otp-widget: Unable to resend email");
317
- this.loading = !0, await this.onOtpResend(this.email), this.startOTPTimeout(), $.showSuccess("Code email resent");
318
- }
319
- } else this.onStartOver && this.onStartOver();
320
- } catch (t) {
321
- $.showError(t);
322
- } finally {
323
- this.loading = !1;
324
- }
325
- }
326
- getFooterLabels(t) {
327
- return this.onStartOver ? {
328
- title: "Something wrong?",
329
- action: `Try again ${t ? `in ${this.timeoutTimeLeft}s` : ""}`
330
- } : {
331
- title: "Didn't receive it?",
332
- action: `Resend ${t ? `in ${this.timeoutTimeLeft}s` : "Code"}`
333
- };
334
- }
335
- shouldSubmitOnOtpChange() {
336
- return this.authConnector && this.otp.length === w.OTP_LENGTH;
337
- }
338
- };
339
- u.OTP_LENGTH = 6;
340
- u.styles = k;
341
- f([
342
- d()
343
- ], u.prototype, "loading", void 0);
344
- f([
345
- d()
346
- ], u.prototype, "timeoutTimeLeft", void 0);
347
- f([
348
- d()
349
- ], u.prototype, "error", void 0);
350
- u = w = f([
351
- v("w3m-email-otp-widget")
352
- ], u);
353
- export {
354
- u as W
355
- };
@@ -1,153 +0,0 @@
1
- import { cU as d, cV as c, cW as m, cX as f, cZ as v, cY as h } from "./index-DeL88Lwc.js";
2
- import { n as r, c as y, U as b } from "./index-DuTny38n.js";
3
- import { e as g, n as w } from "./ref-SOwYtCZb.js";
4
- const x = d`
5
- :host {
6
- position: relative;
7
- display: inline-block;
8
- }
9
-
10
- :host([data-error='true']) > input {
11
- color: ${({ tokens: t }) => t.core.textError};
12
- }
13
-
14
- :host([data-error='false']) > input {
15
- color: ${({ tokens: t }) => t.theme.textSecondary};
16
- }
17
-
18
- input {
19
- background: transparent;
20
- height: auto;
21
- box-sizing: border-box;
22
- color: ${({ tokens: t }) => t.theme.textPrimary};
23
- font-feature-settings: 'case' on;
24
- font-size: ${({ textSize: t }) => t.h4};
25
- caret-color: ${({ tokens: t }) => t.core.backgroundAccentPrimary};
26
- line-height: ${({ typography: t }) => t["h4-regular-mono"].lineHeight};
27
- letter-spacing: ${({ typography: t }) => t["h4-regular-mono"].letterSpacing};
28
- -webkit-appearance: none;
29
- -moz-appearance: textfield;
30
- padding: 0px;
31
- font-family: ${({ fontFamily: t }) => t.mono};
32
- }
33
-
34
- :host([data-width-variant='auto']) input {
35
- width: 100%;
36
- }
37
-
38
- :host([data-width-variant='fit']) input {
39
- width: 1ch;
40
- }
41
-
42
- .wui-input-amount-fit-mirror {
43
- position: absolute;
44
- visibility: hidden;
45
- white-space: pre;
46
- font-size: var(--local-font-size);
47
- line-height: 130%;
48
- letter-spacing: -1.28px;
49
- font-family: ${({ fontFamily: t }) => t.mono};
50
- }
51
-
52
- .wui-input-amount-fit-width {
53
- display: inline-block;
54
- position: relative;
55
- }
56
-
57
- input::-webkit-outer-spin-button,
58
- input::-webkit-inner-spin-button {
59
- -webkit-appearance: none;
60
- margin: 0;
61
- }
62
-
63
- input::placeholder {
64
- color: ${({ tokens: t }) => t.theme.textSecondary};
65
- }
66
- `;
67
- var a = function(t, e, n, s) {
68
- var p = arguments.length, o = p < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, n) : s, l;
69
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(t, e, n, s);
70
- else for (var u = t.length - 1; u >= 0; u--) (l = t[u]) && (o = (p < 3 ? l(o) : p > 3 ? l(e, n, o) : l(e, n)) || o);
71
- return p > 3 && o && Object.defineProperty(e, n, o), o;
72
- };
73
- let i = class extends f {
74
- constructor() {
75
- super(...arguments), this.inputElementRef = g(), this.disabled = !1, this.value = "", this.placeholder = "0", this.widthVariant = "auto", this.maxDecimals = void 0, this.maxIntegers = void 0, this.fontSize = "h4", this.error = !1;
76
- }
77
- firstUpdated() {
78
- this.resizeInput();
79
- }
80
- updated() {
81
- this.style.setProperty("--local-font-size", v.textSize[this.fontSize]), this.resizeInput();
82
- }
83
- render() {
84
- var e;
85
- return this.dataset.widthVariant = this.widthVariant, this.dataset.error = String(this.error), (e = this.inputElementRef) != null && e.value && this.value && (this.inputElementRef.value.value = this.value), this.widthVariant === "auto" ? this.inputTemplate() : h`
86
- <div class="wui-input-amount-fit-width">
87
- <span class="wui-input-amount-fit-mirror"></span>
88
- ${this.inputTemplate()}
89
- </div>
90
- `;
91
- }
92
- inputTemplate() {
93
- return h`<input
94
- ${w(this.inputElementRef)}
95
- type="text"
96
- inputmode="decimal"
97
- pattern="[0-9,.]*"
98
- placeholder=${this.placeholder}
99
- ?disabled=${this.disabled}
100
- autofocus
101
- value=${this.value ?? ""}
102
- @input=${this.dispatchInputChangeEvent.bind(this)}
103
- />`;
104
- }
105
- dispatchInputChangeEvent() {
106
- this.inputElementRef.value && (this.inputElementRef.value.value = b.maskInput({
107
- value: this.inputElementRef.value.value,
108
- decimals: this.maxDecimals,
109
- integers: this.maxIntegers
110
- }), this.dispatchEvent(new CustomEvent("inputChange", {
111
- detail: this.inputElementRef.value.value,
112
- bubbles: !0,
113
- composed: !0
114
- })), this.resizeInput());
115
- }
116
- resizeInput() {
117
- if (this.widthVariant === "fit") {
118
- const e = this.inputElementRef.value;
119
- if (e) {
120
- const n = e.previousElementSibling;
121
- n && (n.textContent = e.value || "0", e.style.width = `${n.offsetWidth}px`);
122
- }
123
- }
124
- }
125
- };
126
- i.styles = [c, m, x];
127
- a([
128
- r({ type: Boolean })
129
- ], i.prototype, "disabled", void 0);
130
- a([
131
- r({ type: String })
132
- ], i.prototype, "value", void 0);
133
- a([
134
- r({ type: String })
135
- ], i.prototype, "placeholder", void 0);
136
- a([
137
- r({ type: String })
138
- ], i.prototype, "widthVariant", void 0);
139
- a([
140
- r({ type: Number })
141
- ], i.prototype, "maxDecimals", void 0);
142
- a([
143
- r({ type: Number })
144
- ], i.prototype, "maxIntegers", void 0);
145
- a([
146
- r({ type: String })
147
- ], i.prototype, "fontSize", void 0);
148
- a([
149
- r({ type: Boolean })
150
- ], i.prototype, "error", void 0);
151
- i = a([
152
- y("wui-input-amount")
153
- ], i);