@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,855 +0,0 @@
1
- import { cU as O, cX as b, dG as c, dH as C, cM as T, cY as u, df as $, cE as I, dh as E, d0 as D, cG as B, cF as z, d3 as V, d4 as M, d1 as K, di as F, cH as W } from "./index-DeL88Lwc.js";
2
- import { r as l, c as g, n as p } from "./index-DuTny38n.js";
3
- import { o as m } from "./if-defined-k21LutCn.js";
4
- import "./index-DPPOW_Tp.js";
5
- import { O as j } from "./index-qLxmmPaL.js";
6
- import "./index-DFi8TiHc.js";
7
- import "./index-B8LkUrww.js";
8
- import "./index-DQpzHpW-.js";
9
- import "./index-BDeO_csr.js";
10
- import "./index-BmFs6nb7.js";
11
- import "./index-Cg_o-i9X.js";
12
- import "./index-DcYjZV4H.js";
13
- import "./index-CBMU3PTE.js";
14
- import "./index-9vLw53Xl.js";
15
- const Y = O`
16
- :host > wui-grid {
17
- max-height: 360px;
18
- overflow: auto;
19
- }
20
-
21
- wui-flex {
22
- transition: opacity ${({ easings: t }) => t["ease-out-power-1"]}
23
- ${({ durations: t }) => t.md};
24
- will-change: opacity;
25
- }
26
-
27
- wui-grid::-webkit-scrollbar {
28
- display: none;
29
- }
30
-
31
- wui-flex.disabled {
32
- opacity: 0.3;
33
- pointer-events: none;
34
- user-select: none;
35
- }
36
- `;
37
- var A = function(t, e, i, o) {
38
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
39
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
40
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
41
- return n > 3 && r && Object.defineProperty(e, i, r), r;
42
- };
43
- let P = class extends b {
44
- constructor() {
45
- super(), this.unsubscribe = [], this.selectedCurrency = c.state.paymentCurrency, this.currencies = c.state.paymentCurrencies, this.currencyImages = C.state.currencyImages, this.checked = j.state.isLegalCheckboxChecked, this.unsubscribe.push(c.subscribe((e) => {
46
- this.selectedCurrency = e.paymentCurrency, this.currencies = e.paymentCurrencies;
47
- }), C.subscribeKey("currencyImages", (e) => this.currencyImages = e), j.subscribeKey("isLegalCheckboxChecked", (e) => {
48
- this.checked = e;
49
- }));
50
- }
51
- disconnectedCallback() {
52
- this.unsubscribe.forEach((e) => e());
53
- }
54
- render() {
55
- var a;
56
- const { termsConditionsUrl: e, privacyPolicyUrl: i } = T.state, o = (a = T.state.features) == null ? void 0 : a.legalCheckbox, s = !!(e || i) && !!o && !this.checked;
57
- return u`
58
- <w3m-legal-checkbox></w3m-legal-checkbox>
59
- <wui-flex
60
- flexDirection="column"
61
- .padding=${["0", "3", "3", "3"]}
62
- gap="2"
63
- class=${m(s ? "disabled" : void 0)}
64
- >
65
- ${this.currenciesTemplate(s)}
66
- </wui-flex>
67
- `;
68
- }
69
- currenciesTemplate(e = !1) {
70
- return this.currencies.map((i) => {
71
- var o;
72
- return u`
73
- <wui-list-item
74
- imageSrc=${m((o = this.currencyImages) == null ? void 0 : o[i.id])}
75
- @click=${() => this.selectCurrency(i)}
76
- variant="image"
77
- tabIdx=${m(e ? -1 : void 0)}
78
- >
79
- <wui-text variant="md-medium" color="primary">${i.id}</wui-text>
80
- </wui-list-item>
81
- `;
82
- });
83
- }
84
- selectCurrency(e) {
85
- e && (c.setPaymentCurrency(e), $.close());
86
- }
87
- };
88
- P.styles = Y;
89
- A([
90
- l()
91
- ], P.prototype, "selectedCurrency", void 0);
92
- A([
93
- l()
94
- ], P.prototype, "currencies", void 0);
95
- A([
96
- l()
97
- ], P.prototype, "currencyImages", void 0);
98
- A([
99
- l()
100
- ], P.prototype, "checked", void 0);
101
- P = A([
102
- g("w3m-onramp-fiat-select-view")
103
- ], P);
104
- const N = O`
105
- button {
106
- padding: ${({ spacing: t }) => t[3]};
107
- border-radius: ${({ borderRadius: t }) => t[4]};
108
- border: none;
109
- outline: none;
110
- background-color: ${({ tokens: t }) => t.core.glass010};
111
- width: 100%;
112
- display: flex;
113
- align-items: center;
114
- justify-content: flex-start;
115
- gap: ${({ spacing: t }) => t[3]};
116
- transition: background-color ${({ easings: t }) => t["ease-out-power-1"]}
117
- ${({ durations: t }) => t.md};
118
- will-change: background-color;
119
- cursor: pointer;
120
- }
121
-
122
- button:hover {
123
- background-color: ${({ tokens: t }) => t.theme.foregroundPrimary};
124
- }
125
-
126
- .provider-image {
127
- width: ${({ spacing: t }) => t[10]};
128
- min-width: ${({ spacing: t }) => t[10]};
129
- height: ${({ spacing: t }) => t[10]};
130
- border-radius: calc(
131
- ${({ borderRadius: t }) => t[4]} - calc(${({ spacing: t }) => t[3]} / 2)
132
- );
133
- position: relative;
134
- overflow: hidden;
135
- }
136
-
137
- .network-icon {
138
- width: ${({ spacing: t }) => t[3]};
139
- height: ${({ spacing: t }) => t[3]};
140
- border-radius: calc(${({ spacing: t }) => t[3]} / 2);
141
- overflow: hidden;
142
- box-shadow:
143
- 0 0 0 3px ${({ tokens: t }) => t.theme.foregroundPrimary},
144
- 0 0 0 3px ${({ tokens: t }) => t.theme.backgroundPrimary};
145
- transition: box-shadow ${({ easings: t }) => t["ease-out-power-1"]}
146
- ${({ durations: t }) => t.md};
147
- will-change: box-shadow;
148
- }
149
-
150
- button:hover .network-icon {
151
- box-shadow:
152
- 0 0 0 3px ${({ tokens: t }) => t.core.glass010},
153
- 0 0 0 3px ${({ tokens: t }) => t.theme.backgroundPrimary};
154
- }
155
- `;
156
- var v = function(t, e, i, o) {
157
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
158
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
159
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
160
- return n > 3 && r && Object.defineProperty(e, i, r), r;
161
- };
162
- let h = class extends b {
163
- constructor() {
164
- super(...arguments), this.disabled = !1, this.color = "inherit", this.label = "", this.feeRange = "", this.loading = !1, this.onClick = null;
165
- }
166
- render() {
167
- return u`
168
- <button ?disabled=${this.disabled} @click=${this.onClick} ontouchstart>
169
- <wui-visual name=${m(this.name)} class="provider-image"></wui-visual>
170
- <wui-flex flexDirection="column" gap="01">
171
- <wui-text variant="md-regular" color="primary">${this.label}</wui-text>
172
- <wui-flex alignItems="center" justifyContent="flex-start" gap="4">
173
- <wui-text variant="sm-medium" color="primary">
174
- <wui-text variant="sm-regular" color="secondary">Fees</wui-text>
175
- ${this.feeRange}
176
- </wui-text>
177
- <wui-flex gap="2">
178
- <wui-icon name="bank" size="sm" color="default"></wui-icon>
179
- <wui-icon name="card" size="sm" color="default"></wui-icon>
180
- </wui-flex>
181
- ${this.networksTemplate()}
182
- </wui-flex>
183
- </wui-flex>
184
- ${this.loading ? u`<wui-loading-spinner color="secondary" size="md"></wui-loading-spinner>` : u`<wui-icon name="chevronRight" color="default" size="sm"></wui-icon>`}
185
- </button>
186
- `;
187
- }
188
- networksTemplate() {
189
- var o;
190
- const e = I.getAllRequestedCaipNetworks(), i = (o = e == null ? void 0 : e.filter((n) => {
191
- var r;
192
- return (r = n == null ? void 0 : n.assets) == null ? void 0 : r.imageId;
193
- })) == null ? void 0 : o.slice(0, 5);
194
- return u`
195
- <wui-flex class="networks">
196
- ${i == null ? void 0 : i.map((n) => u`
197
- <wui-flex class="network-icon">
198
- <wui-image src=${m(E.getNetworkImage(n))}></wui-image>
199
- </wui-flex>
200
- `)}
201
- </wui-flex>
202
- `;
203
- }
204
- };
205
- h.styles = [N];
206
- v([
207
- p({ type: Boolean })
208
- ], h.prototype, "disabled", void 0);
209
- v([
210
- p()
211
- ], h.prototype, "color", void 0);
212
- v([
213
- p()
214
- ], h.prototype, "name", void 0);
215
- v([
216
- p()
217
- ], h.prototype, "label", void 0);
218
- v([
219
- p()
220
- ], h.prototype, "feeRange", void 0);
221
- v([
222
- p({ type: Boolean })
223
- ], h.prototype, "loading", void 0);
224
- v([
225
- p()
226
- ], h.prototype, "onClick", void 0);
227
- h = v([
228
- g("w3m-onramp-provider-item")
229
- ], h);
230
- var S = function(t, e, i, o) {
231
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
232
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
233
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
234
- return n > 3 && r && Object.defineProperty(e, i, r), r;
235
- };
236
- let U = class extends b {
237
- constructor() {
238
- super(), this.unsubscribe = [], this.providers = c.state.providers, this.unsubscribe.push(c.subscribeKey("providers", (e) => {
239
- this.providers = e;
240
- }));
241
- }
242
- render() {
243
- return u`
244
- <wui-flex flexDirection="column" .padding=${["0", "3", "3", "3"]} gap="2">
245
- ${this.onRampProvidersTemplate()}
246
- </wui-flex>
247
- `;
248
- }
249
- onRampProvidersTemplate() {
250
- return this.providers.filter((e) => e.supportedChains.includes(I.state.activeChain ?? "eip155")).map((e) => u`
251
- <w3m-onramp-provider-item
252
- label=${e.label}
253
- name=${e.name}
254
- feeRange=${e.feeRange}
255
- @click=${() => {
256
- this.onClickProvider(e);
257
- }}
258
- ?disabled=${!e.url}
259
- data-testid=${`onramp-provider-${e.name}`}
260
- ></w3m-onramp-provider-item>
261
- `);
262
- }
263
- onClickProvider(e) {
264
- var i;
265
- c.setSelectedProvider(e), D.push("BuyInProgress"), B.openHref(((i = c.state.selectedProvider) == null ? void 0 : i.url) || e.url, "popupWindow", "width=600,height=800,scrollbars=yes"), z.sendEvent({
266
- type: "track",
267
- event: "SELECT_BUY_PROVIDER",
268
- properties: {
269
- provider: e.name,
270
- isSmartAccount: V(I.state.activeChain) === M.ACCOUNT_TYPES.SMART_ACCOUNT
271
- }
272
- });
273
- }
274
- };
275
- S([
276
- l()
277
- ], U.prototype, "providers", void 0);
278
- U = S([
279
- g("w3m-onramp-providers-view")
280
- ], U);
281
- const q = O`
282
- :host > wui-grid {
283
- max-height: 360px;
284
- overflow: auto;
285
- }
286
-
287
- wui-flex {
288
- transition: opacity ${({ easings: t }) => t["ease-out-power-1"]}
289
- ${({ durations: t }) => t.md};
290
- will-change: opacity;
291
- }
292
-
293
- wui-grid::-webkit-scrollbar {
294
- display: none;
295
- }
296
-
297
- wui-flex.disabled {
298
- opacity: 0.3;
299
- pointer-events: none;
300
- user-select: none;
301
- }
302
- `;
303
- var _ = function(t, e, i, o) {
304
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
305
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
306
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
307
- return n > 3 && r && Object.defineProperty(e, i, r), r;
308
- };
309
- let k = class extends b {
310
- constructor() {
311
- super(), this.unsubscribe = [], this.selectedCurrency = c.state.purchaseCurrencies, this.tokens = c.state.purchaseCurrencies, this.tokenImages = C.state.tokenImages, this.checked = j.state.isLegalCheckboxChecked, this.unsubscribe.push(c.subscribe((e) => {
312
- this.selectedCurrency = e.purchaseCurrencies, this.tokens = e.purchaseCurrencies;
313
- }), C.subscribeKey("tokenImages", (e) => this.tokenImages = e), j.subscribeKey("isLegalCheckboxChecked", (e) => {
314
- this.checked = e;
315
- }));
316
- }
317
- disconnectedCallback() {
318
- this.unsubscribe.forEach((e) => e());
319
- }
320
- render() {
321
- var a;
322
- const { termsConditionsUrl: e, privacyPolicyUrl: i } = T.state, o = (a = T.state.features) == null ? void 0 : a.legalCheckbox, s = !!(e || i) && !!o && !this.checked;
323
- return u`
324
- <w3m-legal-checkbox></w3m-legal-checkbox>
325
- <wui-flex
326
- flexDirection="column"
327
- .padding=${["0", "3", "3", "3"]}
328
- gap="2"
329
- class=${m(s ? "disabled" : void 0)}
330
- >
331
- ${this.currenciesTemplate(s)}
332
- </wui-flex>
333
- `;
334
- }
335
- currenciesTemplate(e = !1) {
336
- return this.tokens.map((i) => {
337
- var o;
338
- return u`
339
- <wui-list-item
340
- imageSrc=${m((o = this.tokenImages) == null ? void 0 : o[i.symbol])}
341
- @click=${() => this.selectToken(i)}
342
- variant="image"
343
- tabIdx=${m(e ? -1 : void 0)}
344
- >
345
- <wui-flex gap="1" alignItems="center">
346
- <wui-text variant="md-medium" color="primary">${i.name}</wui-text>
347
- <wui-text variant="sm-regular" color="secondary">${i.symbol}</wui-text>
348
- </wui-flex>
349
- </wui-list-item>
350
- `;
351
- });
352
- }
353
- selectToken(e) {
354
- e && (c.setPurchaseCurrency(e), $.close());
355
- }
356
- };
357
- k.styles = q;
358
- _([
359
- l()
360
- ], k.prototype, "selectedCurrency", void 0);
361
- _([
362
- l()
363
- ], k.prototype, "tokens", void 0);
364
- _([
365
- l()
366
- ], k.prototype, "tokenImages", void 0);
367
- _([
368
- l()
369
- ], k.prototype, "checked", void 0);
370
- k = _([
371
- g("w3m-onramp-token-select-view")
372
- ], k);
373
- const X = O`
374
- @keyframes shake {
375
- 0% {
376
- transform: translateX(0);
377
- }
378
- 25% {
379
- transform: translateX(3px);
380
- }
381
- 50% {
382
- transform: translateX(-3px);
383
- }
384
- 75% {
385
- transform: translateX(3px);
386
- }
387
- 100% {
388
- transform: translateX(0);
389
- }
390
- }
391
-
392
- wui-flex:first-child:not(:only-child) {
393
- position: relative;
394
- }
395
-
396
- wui-loading-thumbnail {
397
- position: absolute;
398
- }
399
-
400
- wui-visual {
401
- border-radius: calc(
402
- ${({ borderRadius: t }) => t[1]} * 9 - ${({ borderRadius: t }) => t[3]}
403
- );
404
- position: relative;
405
- overflow: hidden;
406
- }
407
-
408
- wui-icon-box {
409
- position: absolute;
410
- right: calc(${({ spacing: t }) => t[1]} * -1);
411
- bottom: calc(${({ spacing: t }) => t[1]} * -1);
412
- opacity: 0;
413
- transform: scale(0.5);
414
- transition:
415
- opacity ${({ durations: t }) => t.lg} ${({ easings: t }) => t["ease-out-power-2"]},
416
- transform ${({ durations: t }) => t.lg}
417
- ${({ easings: t }) => t["ease-out-power-2"]};
418
- will-change: opacity, transform;
419
- }
420
-
421
- wui-text[align='center'] {
422
- width: 100%;
423
- padding: 0px ${({ spacing: t }) => t[4]};
424
- }
425
-
426
- [data-error='true'] wui-icon-box {
427
- opacity: 1;
428
- transform: scale(1);
429
- }
430
-
431
- [data-error='true'] > wui-flex:first-child {
432
- animation: shake 250ms ${({ easings: t }) => t["ease-out-power-2"]} both;
433
- }
434
-
435
- [data-retry='false'] wui-link {
436
- display: none;
437
- }
438
-
439
- [data-retry='true'] wui-link {
440
- display: block;
441
- opacity: 1;
442
- }
443
-
444
- wui-link {
445
- padding: ${({ spacing: t }) => t["01"]} ${({ spacing: t }) => t[2]};
446
- }
447
- `;
448
- var y = function(t, e, i, o) {
449
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
450
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
451
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
452
- return n > 3 && r && Object.defineProperty(e, i, r), r;
453
- };
454
- let d = class extends b {
455
- constructor() {
456
- super(), this.unsubscribe = [], this.selectedOnRampProvider = c.state.selectedProvider, this.uri = K.state.wcUri, this.ready = !1, this.showRetry = !1, this.buffering = !1, this.error = !1, this.isMobile = !1, this.onRetry = void 0, this.unsubscribe.push(c.subscribeKey("selectedProvider", (e) => {
457
- this.selectedOnRampProvider = e;
458
- }));
459
- }
460
- disconnectedCallback() {
461
- this.intervalId && clearInterval(this.intervalId);
462
- }
463
- render() {
464
- var o, n;
465
- let e = "Continue in external window";
466
- this.error ? e = "Buy failed" : this.selectedOnRampProvider && (e = `Buy in ${(o = this.selectedOnRampProvider) == null ? void 0 : o.label}`);
467
- const i = this.error ? "Buy can be declined from your side or due to and error on the provider app" : "We’ll notify you once your Buy is processed";
468
- return u`
469
- <wui-flex
470
- data-error=${m(this.error)}
471
- data-retry=${this.showRetry}
472
- flexDirection="column"
473
- alignItems="center"
474
- .padding=${["10", "5", "5", "5"]}
475
- gap="5"
476
- >
477
- <wui-flex justifyContent="center" alignItems="center">
478
- <wui-visual
479
- name=${m((n = this.selectedOnRampProvider) == null ? void 0 : n.name)}
480
- size="lg"
481
- class="provider-image"
482
- >
483
- </wui-visual>
484
-
485
- ${this.error ? null : this.loaderTemplate()}
486
-
487
- <wui-icon-box
488
- color="error"
489
- icon="close"
490
- size="sm"
491
- border
492
- borderColor="wui-color-bg-125"
493
- ></wui-icon-box>
494
- </wui-flex>
495
-
496
- <wui-flex
497
- flexDirection="column"
498
- alignItems="center"
499
- gap="2"
500
- .padding=${["4", "0", "0", "0"]}
501
- >
502
- <wui-text variant="md-medium" color=${this.error ? "error" : "primary"}>
503
- ${e}
504
- </wui-text>
505
- <wui-text align="center" variant="sm-medium" color="secondary">${i}</wui-text>
506
- </wui-flex>
507
-
508
- ${this.error ? this.tryAgainTemplate() : null}
509
- </wui-flex>
510
-
511
- <wui-flex .padding=${["0", "5", "5", "5"]} justifyContent="center">
512
- <wui-link @click=${this.onCopyUri} color="secondary">
513
- <wui-icon size="sm" color="default" slot="iconLeft" name="copy"></wui-icon>
514
- Copy link
515
- </wui-link>
516
- </wui-flex>
517
- `;
518
- }
519
- onTryAgain() {
520
- this.selectedOnRampProvider && (this.error = !1, B.openHref(this.selectedOnRampProvider.url, "popupWindow", "width=600,height=800,scrollbars=yes"));
521
- }
522
- tryAgainTemplate() {
523
- var e;
524
- return (e = this.selectedOnRampProvider) != null && e.url ? u`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}>
525
- <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
526
- Try again
527
- </wui-button>` : null;
528
- }
529
- loaderTemplate() {
530
- const e = F.state.themeVariables["--w3m-border-radius-master"], i = e ? parseInt(e.replace("px", ""), 10) : 4;
531
- return u`<wui-loading-thumbnail radius=${i * 9}></wui-loading-thumbnail>`;
532
- }
533
- onCopyUri() {
534
- var e;
535
- if (!((e = this.selectedOnRampProvider) != null && e.url)) {
536
- W.showError("No link found"), D.goBack();
537
- return;
538
- }
539
- try {
540
- B.copyToClopboard(this.selectedOnRampProvider.url), W.showSuccess("Link copied");
541
- } catch {
542
- W.showError("Failed to copy");
543
- }
544
- }
545
- };
546
- d.styles = X;
547
- y([
548
- l()
549
- ], d.prototype, "intervalId", void 0);
550
- y([
551
- l()
552
- ], d.prototype, "selectedOnRampProvider", void 0);
553
- y([
554
- l()
555
- ], d.prototype, "uri", void 0);
556
- y([
557
- l()
558
- ], d.prototype, "ready", void 0);
559
- y([
560
- l()
561
- ], d.prototype, "showRetry", void 0);
562
- y([
563
- l()
564
- ], d.prototype, "buffering", void 0);
565
- y([
566
- l()
567
- ], d.prototype, "error", void 0);
568
- y([
569
- p({ type: Boolean })
570
- ], d.prototype, "isMobile", void 0);
571
- y([
572
- p()
573
- ], d.prototype, "onRetry", void 0);
574
- d = y([
575
- g("w3m-buy-in-progress-view")
576
- ], d);
577
- var H = function(t, e, i, o) {
578
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
579
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
580
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
581
- return n > 3 && r && Object.defineProperty(e, i, r), r;
582
- };
583
- let L = class extends b {
584
- render() {
585
- return u`
586
- <wui-flex
587
- flexDirection="column"
588
- .padding=${["6", "10", "5", "10"]}
589
- alignItems="center"
590
- gap="5"
591
- >
592
- <wui-visual name="onrampCard"></wui-visual>
593
- <wui-flex flexDirection="column" gap="2" alignItems="center">
594
- <wui-text align="center" variant="md-medium" color="primary">
595
- Quickly and easily buy digital assets!
596
- </wui-text>
597
- <wui-text align="center" variant="sm-regular" color="secondary">
598
- Simply select your preferred onramp provider and add digital assets to your account
599
- using your credit card or bank transfer
600
- </wui-text>
601
- </wui-flex>
602
- <wui-button @click=${D.goBack}>
603
- <wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon>
604
- Buy
605
- </wui-button>
606
- </wui-flex>
607
- `;
608
- }
609
- };
610
- L = H([
611
- g("w3m-what-is-a-buy-view")
612
- ], L);
613
- const Q = O`
614
- :host {
615
- width: 100%;
616
- }
617
-
618
- wui-loading-spinner {
619
- position: absolute;
620
- top: 50%;
621
- right: 20px;
622
- transform: translateY(-50%);
623
- }
624
-
625
- .currency-container {
626
- position: absolute;
627
- top: 50%;
628
- transform: translateY(-50%);
629
- right: ${({ spacing: t }) => t[2]};
630
- height: 40px;
631
- padding: ${({ spacing: t }) => t[2]} ${({ spacing: t }) => t[2]}
632
- ${({ spacing: t }) => t[2]} ${({ spacing: t }) => t[2]};
633
- min-width: 95px;
634
- border-radius: ${({ borderRadius: t }) => t.round};
635
- border: 1px solid ${({ tokens: t }) => t.theme.foregroundPrimary};
636
- background: ${({ tokens: t }) => t.theme.foregroundPrimary};
637
- cursor: pointer;
638
- }
639
-
640
- .currency-container > wui-image {
641
- height: 24px;
642
- width: 24px;
643
- border-radius: 50%;
644
- }
645
- `;
646
- var R = function(t, e, i, o) {
647
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
648
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
649
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
650
- return n > 3 && r && Object.defineProperty(e, i, r), r;
651
- };
652
- let w = class extends b {
653
- constructor() {
654
- var e;
655
- super(), this.unsubscribe = [], this.type = "Token", this.value = 0, this.currencies = [], this.selectedCurrency = (e = this.currencies) == null ? void 0 : e[0], this.currencyImages = C.state.currencyImages, this.tokenImages = C.state.tokenImages, this.unsubscribe.push(c.subscribeKey("purchaseCurrency", (i) => {
656
- !i || this.type === "Fiat" || (this.selectedCurrency = this.formatPurchaseCurrency(i));
657
- }), c.subscribeKey("paymentCurrency", (i) => {
658
- !i || this.type === "Token" || (this.selectedCurrency = this.formatPaymentCurrency(i));
659
- }), c.subscribe((i) => {
660
- this.type === "Fiat" ? this.currencies = i.purchaseCurrencies.map(this.formatPurchaseCurrency) : this.currencies = i.paymentCurrencies.map(this.formatPaymentCurrency);
661
- }), C.subscribe((i) => {
662
- this.currencyImages = { ...i.currencyImages }, this.tokenImages = { ...i.tokenImages };
663
- }));
664
- }
665
- firstUpdated() {
666
- c.getAvailableCurrencies();
667
- }
668
- disconnectedCallback() {
669
- this.unsubscribe.forEach((e) => e());
670
- }
671
- render() {
672
- var o;
673
- const e = ((o = this.selectedCurrency) == null ? void 0 : o.symbol) || "", i = this.currencyImages[e] || this.tokenImages[e];
674
- return u`<wui-input-text type="number" size="lg" value=${this.value}>
675
- ${this.selectedCurrency ? u` <wui-flex
676
- class="currency-container"
677
- justifyContent="space-between"
678
- alignItems="center"
679
- gap="1"
680
- @click=${() => $.open({ view: `OnRamp${this.type}Select` })}
681
- >
682
- <wui-image src=${m(i)}></wui-image>
683
- <wui-text color="primary">${this.selectedCurrency.symbol}</wui-text>
684
- </wui-flex>` : u`<wui-loading-spinner></wui-loading-spinner>`}
685
- </wui-input-text>`;
686
- }
687
- formatPaymentCurrency(e) {
688
- return {
689
- name: e.id,
690
- symbol: e.id
691
- };
692
- }
693
- formatPurchaseCurrency(e) {
694
- return {
695
- name: e.name,
696
- symbol: e.symbol
697
- };
698
- }
699
- };
700
- w.styles = Q;
701
- R([
702
- p({ type: String })
703
- ], w.prototype, "type", void 0);
704
- R([
705
- p({ type: Number })
706
- ], w.prototype, "value", void 0);
707
- R([
708
- l()
709
- ], w.prototype, "currencies", void 0);
710
- R([
711
- l()
712
- ], w.prototype, "selectedCurrency", void 0);
713
- R([
714
- l()
715
- ], w.prototype, "currencyImages", void 0);
716
- R([
717
- l()
718
- ], w.prototype, "tokenImages", void 0);
719
- w = R([
720
- g("w3m-onramp-input")
721
- ], w);
722
- const G = O`
723
- :host > wui-flex {
724
- width: 100%;
725
- max-width: 360px;
726
- }
727
-
728
- :host > wui-flex > wui-flex {
729
- border-radius: ${({ borderRadius: t }) => t[8]};
730
- width: 100%;
731
- }
732
-
733
- .amounts-container {
734
- width: 100%;
735
- }
736
- `;
737
- var x = function(t, e, i, o) {
738
- var n = arguments.length, r = n < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, i) : o, s;
739
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(t, e, i, o);
740
- else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (r = (n < 3 ? s(r) : n > 3 ? s(e, i, r) : s(e, i)) || r);
741
- return n > 3 && r && Object.defineProperty(e, i, r), r;
742
- };
743
- const J = {
744
- USD: "$",
745
- EUR: "€",
746
- GBP: "£"
747
- }, Z = [100, 250, 500, 1e3];
748
- let f = class extends b {
749
- constructor() {
750
- super(), this.unsubscribe = [], this.disabled = !1, this.caipAddress = I.state.activeCaipAddress, this.loading = $.state.loading, this.paymentCurrency = c.state.paymentCurrency, this.paymentAmount = c.state.paymentAmount, this.purchaseAmount = c.state.purchaseAmount, this.quoteLoading = c.state.quotesLoading, this.unsubscribe.push(I.subscribeKey("activeCaipAddress", (e) => this.caipAddress = e), $.subscribeKey("loading", (e) => {
751
- this.loading = e;
752
- }), c.subscribe((e) => {
753
- this.paymentCurrency = e.paymentCurrency, this.paymentAmount = e.paymentAmount, this.purchaseAmount = e.purchaseAmount, this.quoteLoading = e.quotesLoading;
754
- }));
755
- }
756
- disconnectedCallback() {
757
- this.unsubscribe.forEach((e) => e());
758
- }
759
- render() {
760
- return u`
761
- <wui-flex flexDirection="column" justifyContent="center" alignItems="center">
762
- <wui-flex flexDirection="column" alignItems="center" gap="2">
763
- <w3m-onramp-input
764
- type="Fiat"
765
- @inputChange=${this.onPaymentAmountChange.bind(this)}
766
- .value=${this.paymentAmount || 0}
767
- ></w3m-onramp-input>
768
- <w3m-onramp-input
769
- type="Token"
770
- .value=${this.purchaseAmount || 0}
771
- .loading=${this.quoteLoading}
772
- ></w3m-onramp-input>
773
- <wui-flex justifyContent="space-evenly" class="amounts-container" gap="2">
774
- ${Z.map((e) => {
775
- var i;
776
- return u`<wui-button
777
- variant=${this.paymentAmount === e ? "accent-secondary" : "neutral-secondary"}
778
- size="md"
779
- textVariant="md-medium"
780
- fullWidth
781
- @click=${() => this.selectPresetAmount(e)}
782
- >${`${J[((i = this.paymentCurrency) == null ? void 0 : i.id) || "USD"]} ${e}`}</wui-button
783
- >`;
784
- })}
785
- </wui-flex>
786
- ${this.templateButton()}
787
- </wui-flex>
788
- </wui-flex>
789
- `;
790
- }
791
- templateButton() {
792
- return this.caipAddress ? u`<wui-button
793
- @click=${this.getQuotes.bind(this)}
794
- variant="accent-primary"
795
- fullWidth
796
- size="lg"
797
- borderRadius="xs"
798
- >
799
- Get quotes
800
- </wui-button>` : u`<wui-button
801
- @click=${this.openModal.bind(this)}
802
- variant="accent"
803
- fullWidth
804
- size="lg"
805
- borderRadius="xs"
806
- >
807
- Connect wallet
808
- </wui-button>`;
809
- }
810
- getQuotes() {
811
- this.loading || $.open({ view: "OnRampProviders" });
812
- }
813
- openModal() {
814
- $.open({ view: "Connect" });
815
- }
816
- async onPaymentAmountChange(e) {
817
- c.setPaymentAmount(Number(e.detail)), await c.getQuote();
818
- }
819
- async selectPresetAmount(e) {
820
- c.setPaymentAmount(e), await c.getQuote();
821
- }
822
- };
823
- f.styles = G;
824
- x([
825
- p({ type: Boolean })
826
- ], f.prototype, "disabled", void 0);
827
- x([
828
- l()
829
- ], f.prototype, "caipAddress", void 0);
830
- x([
831
- l()
832
- ], f.prototype, "loading", void 0);
833
- x([
834
- l()
835
- ], f.prototype, "paymentCurrency", void 0);
836
- x([
837
- l()
838
- ], f.prototype, "paymentAmount", void 0);
839
- x([
840
- l()
841
- ], f.prototype, "purchaseAmount", void 0);
842
- x([
843
- l()
844
- ], f.prototype, "quoteLoading", void 0);
845
- f = x([
846
- g("w3m-onramp-widget")
847
- ], f);
848
- export {
849
- d as W3mBuyInProgressView,
850
- U as W3mOnRampProvidersView,
851
- P as W3mOnrampFiatSelectView,
852
- k as W3mOnrampTokensView,
853
- f as W3mOnrampWidget,
854
- L as W3mWhatIsABuyView
855
- };