@directcryptopay/sdk 0.2.3 → 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-CPMQq6Q-.js +0 -217
  11. package/dist/HelpersUtil-DfMFC7Bf.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-Cti0Cyxa.js +0 -457
  65. package/dist/ccip-CKZd2XJ7.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-7D5CL385.js +0 -490
  70. package/dist/email-AmK0INbZ.js +0 -344
  71. package/dist/embedded-wallet-Pn0I_XLn.js +0 -820
  72. package/dist/features-x8XNprEe.js +0 -274
  73. package/dist/hashTypedData-B50-z0AA.js +0 -197
  74. package/dist/if-defined-CdZSZ6UL.js +0 -10
  75. package/dist/index-4ewUtPPp.js +0 -7981
  76. package/dist/index-51l86yqx.js +0 -276
  77. package/dist/index-B6K56LF_.js +0 -85
  78. package/dist/index-BAmv9PxJ.js +0 -257
  79. package/dist/index-BEswjY9r.js +0 -117
  80. package/dist/index-BSKRq56S.js +0 -355
  81. package/dist/index-BaygXQxx.js +0 -172
  82. package/dist/index-BcPxaHr5.js +0 -118
  83. package/dist/index-Bjt7nGaJ.js +0 -199
  84. package/dist/index-BkTSyAJb.js +0 -21991
  85. package/dist/index-Bmnl7l2U.js +0 -555
  86. package/dist/index-BvPvouSq.js +0 -56
  87. package/dist/index-C-6iznUO.js +0 -174
  88. package/dist/index-C1QEJL-2.js +0 -572
  89. package/dist/index-C4M5s_AM.js +0 -228
  90. package/dist/index-CEqcN8QP.js +0 -1175
  91. package/dist/index-CM3YaYca.js +0 -8189
  92. package/dist/index-CclBLA5r.js +0 -517
  93. package/dist/index-ChTxJOiF.js +0 -46
  94. package/dist/index-CmAv0Tzr.js +0 -86
  95. package/dist/index-CmvoKY4x.js +0 -125
  96. package/dist/index-D7PmdQ9B.js +0 -1750
  97. package/dist/index-D7k2Pc4e.js +0 -1083
  98. package/dist/index-D7lmgqUR.js +0 -153
  99. package/dist/index-DG_-qYze.js +0 -107
  100. package/dist/index-DHot9Fdb.js +0 -218
  101. package/dist/index-DV2LrPtU.js +0 -123
  102. package/dist/index-DYBaJQ2W.js +0 -65
  103. package/dist/index-D_8VUmn1.js +0 -41543
  104. package/dist/index-D_gLn3rT.js +0 -100
  105. package/dist/index-DqcVUSC9.js +0 -62
  106. package/dist/index-I7VDqINw.js +0 -128
  107. package/dist/index-Oz72I9VP.js +0 -209
  108. package/dist/index-UclsHkJ0.js +0 -118
  109. package/dist/index-X8zir_1j.js +0 -110
  110. package/dist/index-XvlWKGCu.js +0 -1281
  111. package/dist/index-dO97xPlt.js +0 -171
  112. package/dist/index-uBeF6OAB.js +0 -387
  113. package/dist/index-zeA_RiCV.js +0 -159
  114. package/dist/localBatchGatewayRequest-BUZHGdjw.js +0 -91
  115. package/dist/onramp-CdnBuF0r.js +0 -855
  116. package/dist/parseSignature-CcyTNGr4.js +0 -3304
  117. package/dist/pay-with-exchange-CSM6WCOV.js +0 -525
  118. package/dist/property-Bd8U3_QP.js +0 -618
  119. package/dist/receive-DooMu4Dx.js +0 -232
  120. package/dist/ref-CpgjXAw7.js +0 -107
  121. package/dist/send-3T7CyYic.js +0 -1166
  122. package/dist/socials-Dt-iHL17.js +0 -620
  123. package/dist/swaps-CjA9Es42.js +0 -1760
  124. package/dist/transactions-nRm9DVzn.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-NV25AXhM.js +0 -1706
@@ -1,117 +0,0 @@
1
- import { cU as l, cV as b, cW as p, cX as h, cY as v } from "./index-D_8VUmn1.js";
2
- import { n as r, c as f } from "./index-CEqcN8QP.js";
3
- const m = l`
4
- button {
5
- background-color: transparent;
6
- padding: ${({ spacing: t }) => t[1]};
7
- }
8
-
9
- button:focus-visible {
10
- box-shadow: 0 0 0 4px ${({ tokens: t }) => t.core.foregroundAccent020};
11
- }
12
-
13
- button[data-variant='accent']:hover:enabled,
14
- button[data-variant='accent']:focus-visible {
15
- background-color: ${({ tokens: t }) => t.core.foregroundAccent010};
16
- }
17
-
18
- button[data-variant='primary']:hover:enabled,
19
- button[data-variant='primary']:focus-visible,
20
- button[data-variant='secondary']:hover:enabled,
21
- button[data-variant='secondary']:focus-visible {
22
- background-color: ${({ tokens: t }) => t.theme.foregroundSecondary};
23
- }
24
-
25
- button[data-size='xs'] > wui-icon {
26
- width: 8px;
27
- height: 8px;
28
- }
29
-
30
- button[data-size='sm'] > wui-icon {
31
- width: 12px;
32
- height: 12px;
33
- }
34
-
35
- button[data-size='xs'],
36
- button[data-size='sm'] {
37
- border-radius: ${({ borderRadius: t }) => t[1]};
38
- }
39
-
40
- button[data-size='md'],
41
- button[data-size='lg'] {
42
- border-radius: ${({ borderRadius: t }) => t[2]};
43
- }
44
-
45
- button[data-size='md'] > wui-icon {
46
- width: 16px;
47
- height: 16px;
48
- }
49
-
50
- button[data-size='lg'] > wui-icon {
51
- width: 20px;
52
- height: 20px;
53
- }
54
-
55
- button:disabled {
56
- background-color: transparent;
57
- cursor: not-allowed;
58
- opacity: 0.5;
59
- }
60
-
61
- button:hover:not(:disabled) {
62
- background-color: var(--wui-color-accent-glass-015);
63
- }
64
-
65
- button:focus-visible:not(:disabled) {
66
- background-color: var(--wui-color-accent-glass-015);
67
- box-shadow:
68
- inset 0 0 0 1px var(--wui-color-accent-100),
69
- 0 0 0 4px var(--wui-color-accent-glass-020);
70
- }
71
- `;
72
- var i = function(t, o, n, c) {
73
- var s = arguments.length, e = s < 3 ? o : c === null ? c = Object.getOwnPropertyDescriptor(o, n) : c, d;
74
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") e = Reflect.decorate(t, o, n, c);
75
- else for (var u = t.length - 1; u >= 0; u--) (d = t[u]) && (e = (s < 3 ? d(e) : s > 3 ? d(o, n, e) : d(o, n)) || e);
76
- return s > 3 && e && Object.defineProperty(o, n, e), e;
77
- };
78
- let a = class extends h {
79
- constructor() {
80
- super(...arguments), this.size = "md", this.disabled = !1, this.icon = "copy", this.iconColor = "default", this.variant = "accent";
81
- }
82
- render() {
83
- const o = {
84
- accent: "accent-primary",
85
- primary: "inverse",
86
- secondary: "default"
87
- };
88
- return v`
89
- <button data-variant=${this.variant} ?disabled=${this.disabled} data-size=${this.size}>
90
- <wui-icon
91
- color=${o[this.variant] || this.iconColor}
92
- size=${this.size}
93
- name=${this.icon}
94
- ></wui-icon>
95
- </button>
96
- `;
97
- }
98
- };
99
- a.styles = [b, p, m];
100
- i([
101
- r()
102
- ], a.prototype, "size", void 0);
103
- i([
104
- r({ type: Boolean })
105
- ], a.prototype, "disabled", void 0);
106
- i([
107
- r()
108
- ], a.prototype, "icon", void 0);
109
- i([
110
- r()
111
- ], a.prototype, "iconColor", void 0);
112
- i([
113
- r()
114
- ], a.prototype, "variant", void 0);
115
- a = i([
116
- f("wui-icon-link")
117
- ], a);
@@ -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-D_8VUmn1.js";
2
- import { n as h, c as v, r as d, U as T } from "./index-CEqcN8QP.js";
3
- import "./index-X8zir_1j.js";
4
- import "./index-CmAv0Tzr.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,172 +0,0 @@
1
- import { cU as l, cV as p, cW as h, cX as b, cY as y } from "./index-D_8VUmn1.js";
2
- import { n as r, c as f } from "./index-CEqcN8QP.js";
3
- import { o as v } from "./if-defined-CdZSZ6UL.js";
4
- const m = l`
5
- :host {
6
- position: relative;
7
- }
8
-
9
- button {
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- background-color: transparent;
14
- padding: ${({ spacing: t }) => t[1]};
15
- }
16
-
17
- /* -- Colors --------------------------------------------------- */
18
- button[data-type='accent'] wui-icon {
19
- color: ${({ tokens: t }) => t.core.iconAccentPrimary};
20
- }
21
-
22
- button[data-type='neutral'][data-variant='primary'] wui-icon {
23
- color: ${({ tokens: t }) => t.theme.iconInverse};
24
- }
25
-
26
- button[data-type='neutral'][data-variant='secondary'] wui-icon {
27
- color: ${({ tokens: t }) => t.theme.iconDefault};
28
- }
29
-
30
- button[data-type='success'] wui-icon {
31
- color: ${({ tokens: t }) => t.core.iconSuccess};
32
- }
33
-
34
- button[data-type='error'] wui-icon {
35
- color: ${({ tokens: t }) => t.core.iconError};
36
- }
37
-
38
- /* -- Sizes --------------------------------------------------- */
39
- button[data-size='xs'] {
40
- width: 16px;
41
- height: 16px;
42
-
43
- border-radius: ${({ borderRadius: t }) => t[1]};
44
- }
45
-
46
- button[data-size='sm'] {
47
- width: 20px;
48
- height: 20px;
49
- border-radius: ${({ borderRadius: t }) => t[1]};
50
- }
51
-
52
- button[data-size='md'] {
53
- width: 24px;
54
- height: 24px;
55
- border-radius: ${({ borderRadius: t }) => t[2]};
56
- }
57
-
58
- button[data-size='lg'] {
59
- width: 28px;
60
- height: 28px;
61
- border-radius: ${({ borderRadius: t }) => t[2]};
62
- }
63
-
64
- button[data-size='xs'] wui-icon {
65
- width: 8px;
66
- height: 8px;
67
- }
68
-
69
- button[data-size='sm'] wui-icon {
70
- width: 12px;
71
- height: 12px;
72
- }
73
-
74
- button[data-size='md'] wui-icon {
75
- width: 16px;
76
- height: 16px;
77
- }
78
-
79
- button[data-size='lg'] wui-icon {
80
- width: 20px;
81
- height: 20px;
82
- }
83
-
84
- /* -- Hover --------------------------------------------------- */
85
- @media (hover: hover) {
86
- button[data-type='accent']:hover:enabled {
87
- background-color: ${({ tokens: t }) => t.core.foregroundAccent010};
88
- }
89
-
90
- button[data-variant='primary'][data-type='neutral']:hover:enabled {
91
- background-color: ${({ tokens: t }) => t.theme.foregroundSecondary};
92
- }
93
-
94
- button[data-variant='secondary'][data-type='neutral']:hover:enabled {
95
- background-color: ${({ tokens: t }) => t.theme.foregroundSecondary};
96
- }
97
-
98
- button[data-type='success']:hover:enabled {
99
- background-color: ${({ tokens: t }) => t.core.backgroundSuccess};
100
- }
101
-
102
- button[data-type='error']:hover:enabled {
103
- background-color: ${({ tokens: t }) => t.core.backgroundError};
104
- }
105
- }
106
-
107
- /* -- Focus --------------------------------------------------- */
108
- button:focus-visible {
109
- box-shadow: 0 0 0 4px ${({ tokens: t }) => t.core.foregroundAccent020};
110
- }
111
-
112
- /* -- Properties --------------------------------------------------- */
113
- button[data-full-width='true'] {
114
- width: 100%;
115
- }
116
-
117
- :host([fullWidth]) {
118
- width: 100%;
119
- }
120
-
121
- button[disabled] {
122
- opacity: 0.5;
123
- cursor: not-allowed;
124
- }
125
- `;
126
- var i = function(t, a, n, d) {
127
- var c = arguments.length, o = c < 3 ? a : d === null ? d = Object.getOwnPropertyDescriptor(a, n) : d, s;
128
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(t, a, n, d);
129
- else for (var u = t.length - 1; u >= 0; u--) (s = t[u]) && (o = (c < 3 ? s(o) : c > 3 ? s(a, n, o) : s(a, n)) || o);
130
- return c > 3 && o && Object.defineProperty(a, n, o), o;
131
- };
132
- let e = class extends b {
133
- constructor() {
134
- super(...arguments), this.icon = "card", this.variant = "primary", this.type = "accent", this.size = "md", this.iconSize = void 0, this.fullWidth = !1, this.disabled = !1;
135
- }
136
- render() {
137
- return y`<button
138
- data-variant=${this.variant}
139
- data-type=${this.type}
140
- data-size=${this.size}
141
- data-full-width=${this.fullWidth}
142
- ?disabled=${this.disabled}
143
- >
144
- <wui-icon color="inherit" name=${this.icon} size=${v(this.iconSize)}></wui-icon>
145
- </button>`;
146
- }
147
- };
148
- e.styles = [p, h, m];
149
- i([
150
- r()
151
- ], e.prototype, "icon", void 0);
152
- i([
153
- r()
154
- ], e.prototype, "variant", void 0);
155
- i([
156
- r()
157
- ], e.prototype, "type", void 0);
158
- i([
159
- r()
160
- ], e.prototype, "size", void 0);
161
- i([
162
- r()
163
- ], e.prototype, "iconSize", void 0);
164
- i([
165
- r({ type: Boolean })
166
- ], e.prototype, "fullWidth", void 0);
167
- i([
168
- r({ type: Boolean })
169
- ], e.prototype, "disabled", void 0);
170
- e = i([
171
- f("wui-icon-button")
172
- ], e);