coinley-checkout 0.1.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 +8 -0
- package/dist/coinley-checkout.es.js +1419 -0
- package/dist/coinley-checkout.umd.js +32 -0
- package/dist/rocketlaunch.png +0 -0
- package/dist/style.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +40 -0
@@ -0,0 +1,1419 @@
|
|
1
|
+
import Qe, { createContext as Ze, useContext as Be, useState as O, useEffect as B, forwardRef as pr, useImperativeHandle as Nr } from "react";
|
2
|
+
var Te = { exports: {} }, oe = {};
|
3
|
+
/**
|
4
|
+
* @license React
|
5
|
+
* react-jsx-runtime.production.min.js
|
6
|
+
*
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
8
|
+
*
|
9
|
+
* This source code is licensed under the MIT license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
11
|
+
*/
|
12
|
+
var We;
|
13
|
+
function vr() {
|
14
|
+
if (We)
|
15
|
+
return oe;
|
16
|
+
We = 1;
|
17
|
+
var n = Qe, a = Symbol.for("react.element"), i = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, x = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
|
18
|
+
function j(S, o, D) {
|
19
|
+
var y, T = {}, P = null, N = null;
|
20
|
+
D !== void 0 && (P = "" + D), o.key !== void 0 && (P = "" + o.key), o.ref !== void 0 && (N = o.ref);
|
21
|
+
for (y in o)
|
22
|
+
l.call(o, y) && !f.hasOwnProperty(y) && (T[y] = o[y]);
|
23
|
+
if (S && S.defaultProps)
|
24
|
+
for (y in o = S.defaultProps, o)
|
25
|
+
T[y] === void 0 && (T[y] = o[y]);
|
26
|
+
return { $$typeof: a, type: S, key: P, ref: N, props: T, _owner: x.current };
|
27
|
+
}
|
28
|
+
return oe.Fragment = i, oe.jsx = j, oe.jsxs = j, oe;
|
29
|
+
}
|
30
|
+
var ie = {};
|
31
|
+
/**
|
32
|
+
* @license React
|
33
|
+
* react-jsx-runtime.development.js
|
34
|
+
*
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
36
|
+
*
|
37
|
+
* This source code is licensed under the MIT license found in the
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
39
|
+
*/
|
40
|
+
var Ge;
|
41
|
+
function br() {
|
42
|
+
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
|
43
|
+
var n = Qe, a = Symbol.for("react.element"), i = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), j = Symbol.for("react.provider"), S = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), N = Symbol.for("react.offscreen"), R = Symbol.iterator, z = "@@iterator";
|
44
|
+
function W(e) {
|
45
|
+
if (e === null || typeof e != "object")
|
46
|
+
return null;
|
47
|
+
var t = R && e[R] || e[z];
|
48
|
+
return typeof t == "function" ? t : null;
|
49
|
+
}
|
50
|
+
var I = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
51
|
+
function v(e) {
|
52
|
+
{
|
53
|
+
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), c = 1; c < t; c++)
|
54
|
+
s[c - 1] = arguments[c];
|
55
|
+
K("error", e, s);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
function K(e, t, s) {
|
59
|
+
{
|
60
|
+
var c = I.ReactDebugCurrentFrame, M = c.getStackAddendum();
|
61
|
+
M !== "" && (t += "%s", s = s.concat([M]));
|
62
|
+
var m = s.map(function(g) {
|
63
|
+
return String(g);
|
64
|
+
});
|
65
|
+
m.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, m);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
var _ = !1, H = !1, ee = !1, re = !1, Y = !1, V;
|
69
|
+
V = Symbol.for("react.module.reference");
|
70
|
+
function Q(e) {
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === l || e === f || Y || e === x || e === D || e === y || re || e === N || _ || H || ee || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === T || e.$$typeof === j || e.$$typeof === S || e.$$typeof === o || // This needs to include all possible module reference object
|
72
|
+
// types supported by any Flight configuration anywhere since
|
73
|
+
// we don't know which Flight build this will end up being used
|
74
|
+
// with.
|
75
|
+
e.$$typeof === V || e.getModuleId !== void 0));
|
76
|
+
}
|
77
|
+
function G(e, t, s) {
|
78
|
+
var c = e.displayName;
|
79
|
+
if (c)
|
80
|
+
return c;
|
81
|
+
var M = t.displayName || t.name || "";
|
82
|
+
return M !== "" ? s + "(" + M + ")" : s;
|
83
|
+
}
|
84
|
+
function U(e) {
|
85
|
+
return e.displayName || "Context";
|
86
|
+
}
|
87
|
+
function h(e) {
|
88
|
+
if (e == null)
|
89
|
+
return null;
|
90
|
+
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
91
|
+
return e.displayName || e.name || null;
|
92
|
+
if (typeof e == "string")
|
93
|
+
return e;
|
94
|
+
switch (e) {
|
95
|
+
case l:
|
96
|
+
return "Fragment";
|
97
|
+
case i:
|
98
|
+
return "Portal";
|
99
|
+
case f:
|
100
|
+
return "Profiler";
|
101
|
+
case x:
|
102
|
+
return "StrictMode";
|
103
|
+
case D:
|
104
|
+
return "Suspense";
|
105
|
+
case y:
|
106
|
+
return "SuspenseList";
|
107
|
+
}
|
108
|
+
if (typeof e == "object")
|
109
|
+
switch (e.$$typeof) {
|
110
|
+
case S:
|
111
|
+
var t = e;
|
112
|
+
return U(t) + ".Consumer";
|
113
|
+
case j:
|
114
|
+
var s = e;
|
115
|
+
return U(s._context) + ".Provider";
|
116
|
+
case o:
|
117
|
+
return G(e, e.render, "ForwardRef");
|
118
|
+
case T:
|
119
|
+
var c = e.displayName || null;
|
120
|
+
return c !== null ? c : h(e.type) || "Memo";
|
121
|
+
case P: {
|
122
|
+
var M = e, m = M._payload, g = M._init;
|
123
|
+
try {
|
124
|
+
return h(g(m));
|
125
|
+
} catch {
|
126
|
+
return null;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
return null;
|
131
|
+
}
|
132
|
+
var $ = Object.assign, w = 0, ce, te, le, ne, ue, u, b;
|
133
|
+
function de() {
|
134
|
+
}
|
135
|
+
de.__reactDisabledLog = !0;
|
136
|
+
function xe() {
|
137
|
+
{
|
138
|
+
if (w === 0) {
|
139
|
+
ce = console.log, te = console.info, le = console.warn, ne = console.error, ue = console.group, u = console.groupCollapsed, b = console.groupEnd;
|
140
|
+
var e = {
|
141
|
+
configurable: !0,
|
142
|
+
enumerable: !0,
|
143
|
+
value: de,
|
144
|
+
writable: !0
|
145
|
+
};
|
146
|
+
Object.defineProperties(console, {
|
147
|
+
info: e,
|
148
|
+
log: e,
|
149
|
+
warn: e,
|
150
|
+
error: e,
|
151
|
+
group: e,
|
152
|
+
groupCollapsed: e,
|
153
|
+
groupEnd: e
|
154
|
+
});
|
155
|
+
}
|
156
|
+
w++;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
function fe() {
|
160
|
+
{
|
161
|
+
if (w--, w === 0) {
|
162
|
+
var e = {
|
163
|
+
configurable: !0,
|
164
|
+
enumerable: !0,
|
165
|
+
writable: !0
|
166
|
+
};
|
167
|
+
Object.defineProperties(console, {
|
168
|
+
log: $({}, e, {
|
169
|
+
value: ce
|
170
|
+
}),
|
171
|
+
info: $({}, e, {
|
172
|
+
value: te
|
173
|
+
}),
|
174
|
+
warn: $({}, e, {
|
175
|
+
value: le
|
176
|
+
}),
|
177
|
+
error: $({}, e, {
|
178
|
+
value: ne
|
179
|
+
}),
|
180
|
+
group: $({}, e, {
|
181
|
+
value: ue
|
182
|
+
}),
|
183
|
+
groupCollapsed: $({}, e, {
|
184
|
+
value: u
|
185
|
+
}),
|
186
|
+
groupEnd: $({}, e, {
|
187
|
+
value: b
|
188
|
+
})
|
189
|
+
});
|
190
|
+
}
|
191
|
+
w < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
192
|
+
}
|
193
|
+
}
|
194
|
+
var he = I.ReactCurrentDispatcher, je;
|
195
|
+
function ge(e, t, s) {
|
196
|
+
{
|
197
|
+
if (je === void 0)
|
198
|
+
try {
|
199
|
+
throw Error();
|
200
|
+
} catch (M) {
|
201
|
+
var c = M.stack.trim().match(/\n( *(at )?)/);
|
202
|
+
je = c && c[1] || "";
|
203
|
+
}
|
204
|
+
return `
|
205
|
+
` + je + e;
|
206
|
+
}
|
207
|
+
}
|
208
|
+
var we = !1, Me;
|
209
|
+
{
|
210
|
+
var Je = typeof WeakMap == "function" ? WeakMap : Map;
|
211
|
+
Me = new Je();
|
212
|
+
}
|
213
|
+
function Ie(e, t) {
|
214
|
+
if (!e || we)
|
215
|
+
return "";
|
216
|
+
{
|
217
|
+
var s = Me.get(e);
|
218
|
+
if (s !== void 0)
|
219
|
+
return s;
|
220
|
+
}
|
221
|
+
var c;
|
222
|
+
we = !0;
|
223
|
+
var M = Error.prepareStackTrace;
|
224
|
+
Error.prepareStackTrace = void 0;
|
225
|
+
var m;
|
226
|
+
m = he.current, he.current = null, xe();
|
227
|
+
try {
|
228
|
+
if (t) {
|
229
|
+
var g = function() {
|
230
|
+
throw Error();
|
231
|
+
};
|
232
|
+
if (Object.defineProperty(g.prototype, "props", {
|
233
|
+
set: function() {
|
234
|
+
throw Error();
|
235
|
+
}
|
236
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
237
|
+
try {
|
238
|
+
Reflect.construct(g, []);
|
239
|
+
} catch (E) {
|
240
|
+
c = E;
|
241
|
+
}
|
242
|
+
Reflect.construct(e, [], g);
|
243
|
+
} else {
|
244
|
+
try {
|
245
|
+
g.call();
|
246
|
+
} catch (E) {
|
247
|
+
c = E;
|
248
|
+
}
|
249
|
+
e.call(g.prototype);
|
250
|
+
}
|
251
|
+
} else {
|
252
|
+
try {
|
253
|
+
throw Error();
|
254
|
+
} catch (E) {
|
255
|
+
c = E;
|
256
|
+
}
|
257
|
+
e();
|
258
|
+
}
|
259
|
+
} catch (E) {
|
260
|
+
if (E && c && typeof E.stack == "string") {
|
261
|
+
for (var d = E.stack.split(`
|
262
|
+
`), C = c.stack.split(`
|
263
|
+
`), p = d.length - 1, L = C.length - 1; p >= 1 && L >= 0 && d[p] !== C[L]; )
|
264
|
+
L--;
|
265
|
+
for (; p >= 1 && L >= 0; p--, L--)
|
266
|
+
if (d[p] !== C[L]) {
|
267
|
+
if (p !== 1 || L !== 1)
|
268
|
+
do
|
269
|
+
if (p--, L--, L < 0 || d[p] !== C[L]) {
|
270
|
+
var A = `
|
271
|
+
` + d[p].replace(" at new ", " at ");
|
272
|
+
return e.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", e.displayName)), typeof e == "function" && Me.set(e, A), A;
|
273
|
+
}
|
274
|
+
while (p >= 1 && L >= 0);
|
275
|
+
break;
|
276
|
+
}
|
277
|
+
}
|
278
|
+
} finally {
|
279
|
+
we = !1, he.current = m, fe(), Error.prepareStackTrace = M;
|
280
|
+
}
|
281
|
+
var q = e ? e.displayName || e.name : "", Z = q ? ge(q) : "";
|
282
|
+
return typeof e == "function" && Me.set(e, Z), Z;
|
283
|
+
}
|
284
|
+
function qe(e, t, s) {
|
285
|
+
return Ie(e, !1);
|
286
|
+
}
|
287
|
+
function Xe(e) {
|
288
|
+
var t = e.prototype;
|
289
|
+
return !!(t && t.isReactComponent);
|
290
|
+
}
|
291
|
+
function ye(e, t, s) {
|
292
|
+
if (e == null)
|
293
|
+
return "";
|
294
|
+
if (typeof e == "function")
|
295
|
+
return Ie(e, Xe(e));
|
296
|
+
if (typeof e == "string")
|
297
|
+
return ge(e);
|
298
|
+
switch (e) {
|
299
|
+
case D:
|
300
|
+
return ge("Suspense");
|
301
|
+
case y:
|
302
|
+
return ge("SuspenseList");
|
303
|
+
}
|
304
|
+
if (typeof e == "object")
|
305
|
+
switch (e.$$typeof) {
|
306
|
+
case o:
|
307
|
+
return qe(e.render);
|
308
|
+
case T:
|
309
|
+
return ye(e.type, t, s);
|
310
|
+
case P: {
|
311
|
+
var c = e, M = c._payload, m = c._init;
|
312
|
+
try {
|
313
|
+
return ye(m(M), t, s);
|
314
|
+
} catch {
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
return "";
|
319
|
+
}
|
320
|
+
var ae = Object.prototype.hasOwnProperty, Ce = {}, Ee = I.ReactDebugCurrentFrame;
|
321
|
+
function me(e) {
|
322
|
+
if (e) {
|
323
|
+
var t = e._owner, s = ye(e.type, e._source, t ? t.type : null);
|
324
|
+
Ee.setExtraStackFrame(s);
|
325
|
+
} else
|
326
|
+
Ee.setExtraStackFrame(null);
|
327
|
+
}
|
328
|
+
function Ke(e, t, s, c, M) {
|
329
|
+
{
|
330
|
+
var m = Function.call.bind(ae);
|
331
|
+
for (var g in e)
|
332
|
+
if (m(e, g)) {
|
333
|
+
var d = void 0;
|
334
|
+
try {
|
335
|
+
if (typeof e[g] != "function") {
|
336
|
+
var C = Error((c || "React class") + ": " + s + " type `" + g + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[g] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
337
|
+
throw C.name = "Invariant Violation", C;
|
338
|
+
}
|
339
|
+
d = e[g](t, g, c, s, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
340
|
+
} catch (p) {
|
341
|
+
d = p;
|
342
|
+
}
|
343
|
+
d && !(d instanceof Error) && (me(M), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", s, g, typeof d), me(null)), d instanceof Error && !(d.message in Ce) && (Ce[d.message] = !0, me(M), v("Failed %s type: %s", s, d.message), me(null));
|
344
|
+
}
|
345
|
+
}
|
346
|
+
}
|
347
|
+
var er = Array.isArray;
|
348
|
+
function pe(e) {
|
349
|
+
return er(e);
|
350
|
+
}
|
351
|
+
function rr(e) {
|
352
|
+
{
|
353
|
+
var t = typeof Symbol == "function" && Symbol.toStringTag, s = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
354
|
+
return s;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
function tr(e) {
|
358
|
+
try {
|
359
|
+
return ke(e), !1;
|
360
|
+
} catch {
|
361
|
+
return !0;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
function ke(e) {
|
365
|
+
return "" + e;
|
366
|
+
}
|
367
|
+
function Ae(e) {
|
368
|
+
if (tr(e))
|
369
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rr(e)), ke(e);
|
370
|
+
}
|
371
|
+
var se = I.ReactCurrentOwner, nr = {
|
372
|
+
key: !0,
|
373
|
+
ref: !0,
|
374
|
+
__self: !0,
|
375
|
+
__source: !0
|
376
|
+
}, Oe, Pe, Ne;
|
377
|
+
Ne = {};
|
378
|
+
function ar(e) {
|
379
|
+
if (ae.call(e, "ref")) {
|
380
|
+
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
381
|
+
if (t && t.isReactWarning)
|
382
|
+
return !1;
|
383
|
+
}
|
384
|
+
return e.ref !== void 0;
|
385
|
+
}
|
386
|
+
function sr(e) {
|
387
|
+
if (ae.call(e, "key")) {
|
388
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
389
|
+
if (t && t.isReactWarning)
|
390
|
+
return !1;
|
391
|
+
}
|
392
|
+
return e.key !== void 0;
|
393
|
+
}
|
394
|
+
function or(e, t) {
|
395
|
+
if (typeof e.ref == "string" && se.current && t && se.current.stateNode !== t) {
|
396
|
+
var s = h(se.current.type);
|
397
|
+
Ne[s] || (v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', h(se.current.type), e.ref), Ne[s] = !0);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
function ir(e, t) {
|
401
|
+
{
|
402
|
+
var s = function() {
|
403
|
+
Oe || (Oe = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
404
|
+
};
|
405
|
+
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
406
|
+
get: s,
|
407
|
+
configurable: !0
|
408
|
+
});
|
409
|
+
}
|
410
|
+
}
|
411
|
+
function cr(e, t) {
|
412
|
+
{
|
413
|
+
var s = function() {
|
414
|
+
Pe || (Pe = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
415
|
+
};
|
416
|
+
s.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
417
|
+
get: s,
|
418
|
+
configurable: !0
|
419
|
+
});
|
420
|
+
}
|
421
|
+
}
|
422
|
+
var lr = function(e, t, s, c, M, m, g) {
|
423
|
+
var d = {
|
424
|
+
// This tag allows us to uniquely identify this as a React Element
|
425
|
+
$$typeof: a,
|
426
|
+
// Built-in properties that belong on the element
|
427
|
+
type: e,
|
428
|
+
key: t,
|
429
|
+
ref: s,
|
430
|
+
props: g,
|
431
|
+
// Record the component responsible for creating this element.
|
432
|
+
_owner: m
|
433
|
+
};
|
434
|
+
return d._store = {}, Object.defineProperty(d._store, "validated", {
|
435
|
+
configurable: !1,
|
436
|
+
enumerable: !1,
|
437
|
+
writable: !0,
|
438
|
+
value: !1
|
439
|
+
}), Object.defineProperty(d, "_self", {
|
440
|
+
configurable: !1,
|
441
|
+
enumerable: !1,
|
442
|
+
writable: !1,
|
443
|
+
value: c
|
444
|
+
}), Object.defineProperty(d, "_source", {
|
445
|
+
configurable: !1,
|
446
|
+
enumerable: !1,
|
447
|
+
writable: !1,
|
448
|
+
value: M
|
449
|
+
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
450
|
+
};
|
451
|
+
function ur(e, t, s, c, M) {
|
452
|
+
{
|
453
|
+
var m, g = {}, d = null, C = null;
|
454
|
+
s !== void 0 && (Ae(s), d = "" + s), sr(t) && (Ae(t.key), d = "" + t.key), ar(t) && (C = t.ref, or(t, M));
|
455
|
+
for (m in t)
|
456
|
+
ae.call(t, m) && !nr.hasOwnProperty(m) && (g[m] = t[m]);
|
457
|
+
if (e && e.defaultProps) {
|
458
|
+
var p = e.defaultProps;
|
459
|
+
for (m in p)
|
460
|
+
g[m] === void 0 && (g[m] = p[m]);
|
461
|
+
}
|
462
|
+
if (d || C) {
|
463
|
+
var L = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
464
|
+
d && ir(g, L), C && cr(g, L);
|
465
|
+
}
|
466
|
+
return lr(e, d, C, M, c, se.current, g);
|
467
|
+
}
|
468
|
+
}
|
469
|
+
var ve = I.ReactCurrentOwner, Re = I.ReactDebugCurrentFrame;
|
470
|
+
function J(e) {
|
471
|
+
if (e) {
|
472
|
+
var t = e._owner, s = ye(e.type, e._source, t ? t.type : null);
|
473
|
+
Re.setExtraStackFrame(s);
|
474
|
+
} else
|
475
|
+
Re.setExtraStackFrame(null);
|
476
|
+
}
|
477
|
+
var be;
|
478
|
+
be = !1;
|
479
|
+
function Le(e) {
|
480
|
+
return typeof e == "object" && e !== null && e.$$typeof === a;
|
481
|
+
}
|
482
|
+
function ze() {
|
483
|
+
{
|
484
|
+
if (ve.current) {
|
485
|
+
var e = h(ve.current.type);
|
486
|
+
if (e)
|
487
|
+
return `
|
488
|
+
|
489
|
+
Check the render method of \`` + e + "`.";
|
490
|
+
}
|
491
|
+
return "";
|
492
|
+
}
|
493
|
+
}
|
494
|
+
function dr(e) {
|
495
|
+
{
|
496
|
+
if (e !== void 0) {
|
497
|
+
var t = e.fileName.replace(/^.*[\\\/]/, ""), s = e.lineNumber;
|
498
|
+
return `
|
499
|
+
|
500
|
+
Check your code at ` + t + ":" + s + ".";
|
501
|
+
}
|
502
|
+
return "";
|
503
|
+
}
|
504
|
+
}
|
505
|
+
var _e = {};
|
506
|
+
function fr(e) {
|
507
|
+
{
|
508
|
+
var t = ze();
|
509
|
+
if (!t) {
|
510
|
+
var s = typeof e == "string" ? e : e.displayName || e.name;
|
511
|
+
s && (t = `
|
512
|
+
|
513
|
+
Check the top-level render call using <` + s + ">.");
|
514
|
+
}
|
515
|
+
return t;
|
516
|
+
}
|
517
|
+
}
|
518
|
+
function Ye(e, t) {
|
519
|
+
{
|
520
|
+
if (!e._store || e._store.validated || e.key != null)
|
521
|
+
return;
|
522
|
+
e._store.validated = !0;
|
523
|
+
var s = fr(t);
|
524
|
+
if (_e[s])
|
525
|
+
return;
|
526
|
+
_e[s] = !0;
|
527
|
+
var c = "";
|
528
|
+
e && e._owner && e._owner !== ve.current && (c = " It was passed a child from " + h(e._owner.type) + "."), J(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', s, c), J(null);
|
529
|
+
}
|
530
|
+
}
|
531
|
+
function Ue(e, t) {
|
532
|
+
{
|
533
|
+
if (typeof e != "object")
|
534
|
+
return;
|
535
|
+
if (pe(e))
|
536
|
+
for (var s = 0; s < e.length; s++) {
|
537
|
+
var c = e[s];
|
538
|
+
Le(c) && Ye(c, t);
|
539
|
+
}
|
540
|
+
else if (Le(e))
|
541
|
+
e._store && (e._store.validated = !0);
|
542
|
+
else if (e) {
|
543
|
+
var M = W(e);
|
544
|
+
if (typeof M == "function" && M !== e.entries)
|
545
|
+
for (var m = M.call(e), g; !(g = m.next()).done; )
|
546
|
+
Le(g.value) && Ye(g.value, t);
|
547
|
+
}
|
548
|
+
}
|
549
|
+
}
|
550
|
+
function gr(e) {
|
551
|
+
{
|
552
|
+
var t = e.type;
|
553
|
+
if (t == null || typeof t == "string")
|
554
|
+
return;
|
555
|
+
var s;
|
556
|
+
if (typeof t == "function")
|
557
|
+
s = t.propTypes;
|
558
|
+
else if (typeof t == "object" && (t.$$typeof === o || // Note: Memo only checks outer props here.
|
559
|
+
// Inner props are checked in the reconciler.
|
560
|
+
t.$$typeof === T))
|
561
|
+
s = t.propTypes;
|
562
|
+
else
|
563
|
+
return;
|
564
|
+
if (s) {
|
565
|
+
var c = h(t);
|
566
|
+
Ke(s, e.props, "prop", c, e);
|
567
|
+
} else if (t.PropTypes !== void 0 && !be) {
|
568
|
+
be = !0;
|
569
|
+
var M = h(t);
|
570
|
+
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", M || "Unknown");
|
571
|
+
}
|
572
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
573
|
+
}
|
574
|
+
}
|
575
|
+
function Mr(e) {
|
576
|
+
{
|
577
|
+
for (var t = Object.keys(e.props), s = 0; s < t.length; s++) {
|
578
|
+
var c = t[s];
|
579
|
+
if (c !== "children" && c !== "key") {
|
580
|
+
J(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), J(null);
|
581
|
+
break;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
e.ref !== null && (J(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
585
|
+
}
|
586
|
+
}
|
587
|
+
var $e = {};
|
588
|
+
function Fe(e, t, s, c, M, m) {
|
589
|
+
{
|
590
|
+
var g = Q(e);
|
591
|
+
if (!g) {
|
592
|
+
var d = "";
|
593
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (d += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
594
|
+
var C = dr(M);
|
595
|
+
C ? d += C : d += ze();
|
596
|
+
var p;
|
597
|
+
e === null ? p = "null" : pe(e) ? p = "array" : e !== void 0 && e.$$typeof === a ? (p = "<" + (h(e.type) || "Unknown") + " />", d = " Did you accidentally export a JSX literal instead of a component?") : p = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", p, d);
|
598
|
+
}
|
599
|
+
var L = ur(e, t, s, M, m);
|
600
|
+
if (L == null)
|
601
|
+
return L;
|
602
|
+
if (g) {
|
603
|
+
var A = t.children;
|
604
|
+
if (A !== void 0)
|
605
|
+
if (c)
|
606
|
+
if (pe(A)) {
|
607
|
+
for (var q = 0; q < A.length; q++)
|
608
|
+
Ue(A[q], e);
|
609
|
+
Object.freeze && Object.freeze(A);
|
610
|
+
} else
|
611
|
+
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
612
|
+
else
|
613
|
+
Ue(A, e);
|
614
|
+
}
|
615
|
+
if (ae.call(t, "key")) {
|
616
|
+
var Z = h(e), E = Object.keys(t).filter(function(wr) {
|
617
|
+
return wr !== "key";
|
618
|
+
}), Se = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
|
619
|
+
if (!$e[Z + Se]) {
|
620
|
+
var jr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
|
621
|
+
v(`A props object containing a "key" prop is being spread into JSX:
|
622
|
+
let props = %s;
|
623
|
+
<%s {...props} />
|
624
|
+
React keys must be passed directly to JSX without using spread:
|
625
|
+
let props = %s;
|
626
|
+
<%s key={someKey} {...props} />`, Se, Z, jr, Z), $e[Z + Se] = !0;
|
627
|
+
}
|
628
|
+
}
|
629
|
+
return e === l ? Mr(L) : gr(L), L;
|
630
|
+
}
|
631
|
+
}
|
632
|
+
function yr(e, t, s) {
|
633
|
+
return Fe(e, t, s, !0);
|
634
|
+
}
|
635
|
+
function mr(e, t, s) {
|
636
|
+
return Fe(e, t, s, !1);
|
637
|
+
}
|
638
|
+
var xr = mr, hr = yr;
|
639
|
+
ie.Fragment = l, ie.jsx = xr, ie.jsxs = hr;
|
640
|
+
}()), ie;
|
641
|
+
}
|
642
|
+
process.env.NODE_ENV === "production" ? Te.exports = vr() : Te.exports = br();
|
643
|
+
var r = Te.exports;
|
644
|
+
const He = Ze(), Lr = () => Be(He), zr = ({ initialTheme: n = "light", children: a }) => {
|
645
|
+
const [i, l] = O(n), x = () => {
|
646
|
+
l((f) => f === "light" ? "dark" : "light");
|
647
|
+
};
|
648
|
+
return B(() => {
|
649
|
+
document.documentElement.classList.remove("light", "dark"), document.documentElement.classList.add(i);
|
650
|
+
}, [i]), /* @__PURE__ */ r.jsx(He.Provider, { value: { theme: i, setTheme: l, toggleTheme: x }, children: a });
|
651
|
+
};
|
652
|
+
let k = {
|
653
|
+
apiKey: null,
|
654
|
+
apiSecret: null,
|
655
|
+
apiUrl: "http://localhost:9000"
|
656
|
+
};
|
657
|
+
const Sr = (n) => {
|
658
|
+
k = { ...k, ...n }, console.log("API initialized with:", k);
|
659
|
+
}, X = () => ({
|
660
|
+
"Content-Type": "application/json",
|
661
|
+
"x-api-key": k.apiKey,
|
662
|
+
"x-api-secret": k.apiSecret
|
663
|
+
}), Dr = async (n) => {
|
664
|
+
try {
|
665
|
+
console.log("Creating payment with data:", n), console.log("API URL:", `${k.apiUrl}/api/payments/create`);
|
666
|
+
const a = await fetch(`${k.apiUrl}/api/payments/create`, {
|
667
|
+
method: "POST",
|
668
|
+
headers: X(),
|
669
|
+
body: JSON.stringify(n)
|
670
|
+
});
|
671
|
+
if (console.log("Create payment response status:", a.status), !a.ok) {
|
672
|
+
const l = await a.json();
|
673
|
+
throw console.error("Error creating payment:", l), new Error(l.error || `Failed to create payment: ${a.status}`);
|
674
|
+
}
|
675
|
+
const i = await a.json();
|
676
|
+
return console.log("Create payment response data:", i), i;
|
677
|
+
} catch (a) {
|
678
|
+
throw console.error("Create payment error:", a), a;
|
679
|
+
}
|
680
|
+
}, _r = async (n) => {
|
681
|
+
try {
|
682
|
+
console.log("Getting payment:", n);
|
683
|
+
const a = await fetch(`${k.apiUrl}/api/payments/${n}`, {
|
684
|
+
method: "GET",
|
685
|
+
headers: X()
|
686
|
+
});
|
687
|
+
if (!a.ok) {
|
688
|
+
const l = await a.json();
|
689
|
+
throw console.error("Error getting payment:", l), new Error(l.error || `Failed to get payment: ${a.status}`);
|
690
|
+
}
|
691
|
+
const i = await a.json();
|
692
|
+
return console.log("Get payment response:", i), i;
|
693
|
+
} catch (a) {
|
694
|
+
throw console.error("Get payment error:", a), a;
|
695
|
+
}
|
696
|
+
}, Tr = async (n) => {
|
697
|
+
try {
|
698
|
+
console.log("Processing payment with data:", n), console.log("API URL:", `${k.apiUrl}/api/payments/process`);
|
699
|
+
const a = await fetch(`${k.apiUrl}/api/payments/process`, {
|
700
|
+
method: "POST",
|
701
|
+
headers: X(),
|
702
|
+
body: JSON.stringify(n)
|
703
|
+
});
|
704
|
+
if (console.log("Process payment response status:", a.status), !a.ok) {
|
705
|
+
const l = await a.json();
|
706
|
+
throw console.error("Error processing payment:", l), new Error(l.error || `Failed to process payment: ${a.status}`);
|
707
|
+
}
|
708
|
+
const i = await a.json();
|
709
|
+
return console.log("Process payment response data:", i), i;
|
710
|
+
} catch (a) {
|
711
|
+
throw console.error("Process payment error:", a), a;
|
712
|
+
}
|
713
|
+
}, Yr = async (n = {}) => {
|
714
|
+
try {
|
715
|
+
const { page: a = 1, limit: i = 10, status: l, currency: x, startDate: f, endDate: j, search: S } = n, o = new URLSearchParams();
|
716
|
+
o.append("page", a), o.append("limit", i), l && o.append("status", l), x && o.append("currency", x), f && o.append("startDate", f), j && o.append("endDate", j), S && o.append("search", S);
|
717
|
+
const D = `${k.apiUrl}/api/payments/merchant/list?${o.toString()}`, y = await fetch(D, {
|
718
|
+
method: "GET",
|
719
|
+
headers: X()
|
720
|
+
});
|
721
|
+
if (!y.ok) {
|
722
|
+
const T = await y.json();
|
723
|
+
throw new Error(T.error || `Failed to get payments: ${y.status}`);
|
724
|
+
}
|
725
|
+
return await y.json();
|
726
|
+
} catch (a) {
|
727
|
+
throw console.error("Get merchant payments error:", a), a;
|
728
|
+
}
|
729
|
+
}, Ur = async () => {
|
730
|
+
try {
|
731
|
+
const n = await fetch(`${k.apiUrl}/api/payments/merchant/stats`, {
|
732
|
+
method: "GET",
|
733
|
+
headers: X()
|
734
|
+
});
|
735
|
+
if (!n.ok) {
|
736
|
+
const a = await n.json();
|
737
|
+
throw new Error(a.error || `Failed to get payment stats: ${n.status}`);
|
738
|
+
}
|
739
|
+
return await n.json();
|
740
|
+
} catch (n) {
|
741
|
+
throw console.error("Get merchant payment stats error:", n), n;
|
742
|
+
}
|
743
|
+
}, $r = async () => {
|
744
|
+
try {
|
745
|
+
const n = await fetch(`${k.apiUrl}/api/payments/currencies`, {
|
746
|
+
method: "GET",
|
747
|
+
headers: X()
|
748
|
+
});
|
749
|
+
if (!n.ok) {
|
750
|
+
const a = await n.json();
|
751
|
+
throw new Error(a.error || `Failed to get currencies: ${n.status}`);
|
752
|
+
}
|
753
|
+
return await n.json();
|
754
|
+
} catch (n) {
|
755
|
+
return console.error("Get supported currencies error:", n), {
|
756
|
+
currencies: [
|
757
|
+
{ id: "USDT", name: "Tether USD", network: "ethereum" },
|
758
|
+
{ id: "USDC", name: "USD Coin", network: "ethereum" },
|
759
|
+
{ id: "BNB", name: "Binance Coin", network: "binance" },
|
760
|
+
{ id: "SOL", name: "Solana", network: "solana" },
|
761
|
+
{ id: "USDC_SOL", name: "USD Coin (Solana)", network: "solana" }
|
762
|
+
]
|
763
|
+
};
|
764
|
+
}
|
765
|
+
}, Ve = Ze(), Ir = () => Be(Ve), Fr = ({
|
766
|
+
apiKey: n,
|
767
|
+
apiSecret: a,
|
768
|
+
apiUrl: i = "http://localhost:9000",
|
769
|
+
debug: l = !1,
|
770
|
+
children: x
|
771
|
+
}) => {
|
772
|
+
const [f, j] = O(!1), [S, o] = O(null);
|
773
|
+
B(() => {
|
774
|
+
if (!n || !a) {
|
775
|
+
o("API key and secret are required");
|
776
|
+
return;
|
777
|
+
}
|
778
|
+
try {
|
779
|
+
Sr({ apiKey: n, apiSecret: a, apiUrl: i }), j(!0), l && console.log("Coinley SDK initialized with:", { apiKey: n, apiUrl: i });
|
780
|
+
} catch (y) {
|
781
|
+
o(y.message), l && console.error("Coinley SDK initialization error:", y);
|
782
|
+
}
|
783
|
+
}, [n, a, i, l]);
|
784
|
+
const D = {
|
785
|
+
apiKey: n,
|
786
|
+
apiSecret: a,
|
787
|
+
apiUrl: i,
|
788
|
+
isInitialized: f,
|
789
|
+
error: S,
|
790
|
+
debug: l
|
791
|
+
};
|
792
|
+
return /* @__PURE__ */ r.jsx(Ve.Provider, { value: D, children: x });
|
793
|
+
}, Cr = ({ onSelect: n, selected: a, theme: i = "light" }) => {
|
794
|
+
console.log("PaymentMethods render:", { selected: a });
|
795
|
+
const l = [
|
796
|
+
{
|
797
|
+
id: "USDT",
|
798
|
+
name: "USDT",
|
799
|
+
description: "Tether USD",
|
800
|
+
logo: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzI2QTE3QiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0xNy45MjIgMTcuMzgzdi0uMDAyYy0uMTEuMDA4LS42NzcuMDQyLTEuOTQyLjA0Mi0xLjAxIDAtMS43MjEtLjAzLTEuOTcxLS4wNDJ2LjAwM2MtMy44ODgtLjE3MS02Ljc5LS44NDgtNi43OS0xLjY1OCAwLS44MDkgMi45MDItMS40ODYgNi43OS0xLjY2di4wNDdjLjI1NC4wMTguOTgyLjA0NSAxLjk4OC4wNDUgMS4yMDcgMCAxLjgxMi0uMDM2IDEuOTI1LS4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9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="
|
825
|
+
}
|
826
|
+
], x = (f) => {
|
827
|
+
console.log("Method selected:", f), n(f);
|
828
|
+
};
|
829
|
+
return /* @__PURE__ */ r.jsxs("div", { children: [
|
830
|
+
/* @__PURE__ */ r.jsx("h3", { className: `text-lg font-medium mb-3 ${i === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
|
831
|
+
/* @__PURE__ */ r.jsx("div", { className: "space-y-2", children: l.map((f) => /* @__PURE__ */ r.jsxs(
|
832
|
+
"button",
|
833
|
+
{
|
834
|
+
onClick: () => x(f.id),
|
835
|
+
className: `w-full flex items-center p-3 rounded-lg transition-colors ${a === f.id ? i === "dark" ? "bg-blue-900/30 border border-blue-500" : "bg-blue-50 border border-blue-500" : i === "dark" ? "bg-gray-700 hover:bg-gray-600 border border-gray-700" : "bg-white hover:bg-gray-50 border border-gray-200"}`,
|
836
|
+
children: [
|
837
|
+
/* @__PURE__ */ r.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3", children: /* @__PURE__ */ r.jsx("img", { src: f.logo, alt: f.name, className: "h-6 w-6" }) }),
|
838
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex-1 text-left", children: [
|
839
|
+
/* @__PURE__ */ r.jsx("h4", { className: `font-medium ${i === "dark" ? "text-white" : "text-gray-900"}`, children: f.name }),
|
840
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm ${i === "dark" ? "text-gray-300" : "text-gray-500"}`, children: f.description })
|
841
|
+
] }),
|
842
|
+
a === f.id && /* @__PURE__ */ r.jsx(
|
843
|
+
"svg",
|
844
|
+
{
|
845
|
+
xmlns: "http://www.w3.org/2000/svg",
|
846
|
+
className: "h-5 w-5 text-blue-500",
|
847
|
+
viewBox: "0 0 20 20",
|
848
|
+
fill: "currentColor",
|
849
|
+
children: /* @__PURE__ */ r.jsx(
|
850
|
+
"path",
|
851
|
+
{
|
852
|
+
fillRule: "evenodd",
|
853
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
854
|
+
clipRule: "evenodd"
|
855
|
+
}
|
856
|
+
)
|
857
|
+
}
|
858
|
+
)
|
859
|
+
]
|
860
|
+
},
|
861
|
+
f.id
|
862
|
+
)) })
|
863
|
+
] });
|
864
|
+
}, De = ({ status: n, theme: a = "light", message: i }) => {
|
865
|
+
console.log("PaymentStatus render:", { status: n, message: i });
|
866
|
+
const l = () => {
|
867
|
+
switch (n) {
|
868
|
+
case "processing":
|
869
|
+
return /* @__PURE__ */ r.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
|
870
|
+
case "success":
|
871
|
+
return /* @__PURE__ */ r.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ r.jsx(
|
872
|
+
"svg",
|
873
|
+
{
|
874
|
+
xmlns: "http://www.w3.org/2000/svg",
|
875
|
+
className: "h-8 w-8 text-green-500",
|
876
|
+
fill: "none",
|
877
|
+
viewBox: "0 0 24 24",
|
878
|
+
stroke: "currentColor",
|
879
|
+
strokeWidth: 2,
|
880
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
881
|
+
}
|
882
|
+
) });
|
883
|
+
case "error":
|
884
|
+
return /* @__PURE__ */ r.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ r.jsx(
|
885
|
+
"svg",
|
886
|
+
{
|
887
|
+
xmlns: "http://www.w3.org/2000/svg",
|
888
|
+
className: "h-8 w-8 text-red-500",
|
889
|
+
fill: "none",
|
890
|
+
viewBox: "0 0 24 24",
|
891
|
+
stroke: "currentColor",
|
892
|
+
strokeWidth: 2,
|
893
|
+
children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
894
|
+
}
|
895
|
+
) });
|
896
|
+
default:
|
897
|
+
return null;
|
898
|
+
}
|
899
|
+
}, x = () => {
|
900
|
+
switch (n) {
|
901
|
+
case "processing":
|
902
|
+
return "Processing Payment";
|
903
|
+
case "success":
|
904
|
+
return "Payment Successful";
|
905
|
+
case "error":
|
906
|
+
return "Payment Failed";
|
907
|
+
default:
|
908
|
+
return "Unknown Status";
|
909
|
+
}
|
910
|
+
}, f = () => {
|
911
|
+
switch (n) {
|
912
|
+
case "processing":
|
913
|
+
return a === "dark" ? "text-blue-300" : "text-blue-600";
|
914
|
+
case "success":
|
915
|
+
return a === "dark" ? "text-green-300" : "text-green-600";
|
916
|
+
case "error":
|
917
|
+
return a === "dark" ? "text-red-300" : "text-red-600";
|
918
|
+
default:
|
919
|
+
return a === "dark" ? "text-gray-300" : "text-gray-600";
|
920
|
+
}
|
921
|
+
};
|
922
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
923
|
+
/* @__PURE__ */ r.jsx("div", { className: "mb-4", children: l() }),
|
924
|
+
/* @__PURE__ */ r.jsx("h3", { className: `text-xl font-bold mb-2 ${a === "dark" ? "text-white" : "text-gray-900"}`, children: x() }),
|
925
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-center ${f()}`, children: i }),
|
926
|
+
n === "processing" && /* @__PURE__ */ r.jsx("div", { className: `mt-4 text-xs ${a === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
|
927
|
+
n === "success" && /* @__PURE__ */ r.jsx("div", { className: `mt-4 p-2 rounded ${a === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ r.jsx("p", { className: `text-xs ${a === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
|
928
|
+
] });
|
929
|
+
}, F = () => typeof window < "u" && typeof window.ethereum < "u", Er = async () => {
|
930
|
+
if (!F())
|
931
|
+
throw new Error("MetaMask is not installed");
|
932
|
+
try {
|
933
|
+
return await window.ethereum.request({ method: "eth_requestAccounts" });
|
934
|
+
} catch (n) {
|
935
|
+
throw console.error("Error connecting to wallet:", n), n;
|
936
|
+
}
|
937
|
+
}, kr = async () => {
|
938
|
+
if (!F())
|
939
|
+
throw new Error("MetaMask is not installed");
|
940
|
+
try {
|
941
|
+
return await window.ethereum.request({ method: "eth_accounts" });
|
942
|
+
} catch (n) {
|
943
|
+
throw console.error("Error getting accounts:", n), n;
|
944
|
+
}
|
945
|
+
}, Wr = async () => {
|
946
|
+
if (!F())
|
947
|
+
throw new Error("MetaMask is not installed");
|
948
|
+
try {
|
949
|
+
return await window.ethereum.request({ method: "eth_chainId" });
|
950
|
+
} catch (n) {
|
951
|
+
throw console.error("Error getting chain ID:", n), n;
|
952
|
+
}
|
953
|
+
}, Ar = async (n) => {
|
954
|
+
if (!F())
|
955
|
+
throw new Error("MetaMask is not installed");
|
956
|
+
try {
|
957
|
+
return await window.ethereum.request({
|
958
|
+
method: "eth_sendTransaction",
|
959
|
+
params: [n]
|
960
|
+
});
|
961
|
+
} catch (a) {
|
962
|
+
throw console.error("Error sending transaction:", a), a;
|
963
|
+
}
|
964
|
+
}, Gr = async (n, a, i) => {
|
965
|
+
if (!F())
|
966
|
+
throw new Error("MetaMask is not installed");
|
967
|
+
try {
|
968
|
+
const x = (await window.ethereum.request({ method: "eth_requestAccounts" }))[0], f = "0xa9059cbb", j = a.slice(2).padStart(64, "0"), S = i.toString(16).padStart(64, "0"), o = `${f}${j}${S}`, D = {
|
969
|
+
from: x,
|
970
|
+
to: n,
|
971
|
+
data: o
|
972
|
+
};
|
973
|
+
return await window.ethereum.request({
|
974
|
+
method: "eth_sendTransaction",
|
975
|
+
params: [D]
|
976
|
+
});
|
977
|
+
} catch (l) {
|
978
|
+
throw console.error("Error sending token:", l), l;
|
979
|
+
}
|
980
|
+
}, Qr = async () => {
|
981
|
+
try {
|
982
|
+
return (await kr()).length > 0;
|
983
|
+
} catch {
|
984
|
+
return !1;
|
985
|
+
}
|
986
|
+
}, Zr = (n) => ({
|
987
|
+
"0x1": "Ethereum Mainnet",
|
988
|
+
"0x3": "Ropsten Testnet",
|
989
|
+
"0x4": "Rinkeby Testnet",
|
990
|
+
"0x5": "Goerli Testnet",
|
991
|
+
"0x2a": "Kovan Testnet",
|
992
|
+
"0x38": "Binance Smart Chain",
|
993
|
+
"0x89": "Polygon",
|
994
|
+
"0xa86a": "Avalanche"
|
995
|
+
})[n] || `Unknown Network (${n})`, Br = async (n, a) => {
|
996
|
+
if (!F())
|
997
|
+
throw new Error("MetaMask is not installed");
|
998
|
+
try {
|
999
|
+
const i = "0x70a08231", l = a.slice(2).padStart(64, "0"), x = `${i}${l}`, f = await window.ethereum.request({
|
1000
|
+
method: "eth_call",
|
1001
|
+
params: [
|
1002
|
+
{
|
1003
|
+
to: n,
|
1004
|
+
data: x
|
1005
|
+
},
|
1006
|
+
"latest"
|
1007
|
+
]
|
1008
|
+
});
|
1009
|
+
return parseInt(f, 16).toString();
|
1010
|
+
} catch (i) {
|
1011
|
+
throw console.error("Error getting token balance:", i), i;
|
1012
|
+
}
|
1013
|
+
}, Hr = {
|
1014
|
+
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1015
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
1016
|
+
DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
1017
|
+
WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
1018
|
+
WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
|
1019
|
+
}, Or = ({
|
1020
|
+
isOpen: n,
|
1021
|
+
onClose: a,
|
1022
|
+
payment: i,
|
1023
|
+
paymentStatus: l,
|
1024
|
+
selectedCurrency: x,
|
1025
|
+
onCurrencySelect: f,
|
1026
|
+
onPayment: j,
|
1027
|
+
error: S,
|
1028
|
+
theme: o = "light",
|
1029
|
+
merchantName: D,
|
1030
|
+
transactionHash: y,
|
1031
|
+
walletConnected: T,
|
1032
|
+
onConnectWallet: P,
|
1033
|
+
testMode: N = !1
|
1034
|
+
}) => {
|
1035
|
+
const [R, z] = O("select-currency"), [W, I] = O(!1);
|
1036
|
+
B(() => {
|
1037
|
+
I(F());
|
1038
|
+
}, []), B(() => {
|
1039
|
+
l === "loading" ? z("processing") : l === "success" ? z("success") : l === "error" ? z("error") : l === "idle" && i && z("select-currency");
|
1040
|
+
}, [l, i]);
|
1041
|
+
const v = (h) => {
|
1042
|
+
f(h), z("confirm");
|
1043
|
+
}, K = () => {
|
1044
|
+
j();
|
1045
|
+
}, _ = () => {
|
1046
|
+
R === "confirm" && z("select-currency");
|
1047
|
+
}, H = () => {
|
1048
|
+
a();
|
1049
|
+
}, ee = (h) => parseFloat(h).toFixed(2), re = (h) => h ? h.length <= 14 ? h : `${h.slice(0, 8)}...${h.slice(-6)}` : "", Y = `fixed inset-0 z-50 overflow-y-auto ${o === "dark" ? "bg-gray-900/75" : "bg-black/50"}`, V = `relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${o === "dark" ? "bg-gray-800 text-white" : "bg-white text-gray-800"}`, Q = `text-xl font-bold mb-4 ${o === "dark" ? "text-white" : "text-gray-900"}`, G = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o === "dark" ? "bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500" : "bg-blue-500 hover:bg-blue-600 text-white focus:ring-blue-500"}`, U = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o === "dark" ? "bg-gray-700 hover:bg-gray-600 text-white focus:ring-gray-500" : "bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500"}`;
|
1050
|
+
return n ? /* @__PURE__ */ r.jsx("div", { className: Y, children: /* @__PURE__ */ r.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ r.jsxs("div", { className: V, children: [
|
1051
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex justify-between items-center mb-6", children: [
|
1052
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
1053
|
+
/* @__PURE__ */ r.jsx(
|
1054
|
+
"svg",
|
1055
|
+
{
|
1056
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1057
|
+
viewBox: "0 0 24 24",
|
1058
|
+
fill: "currentColor",
|
1059
|
+
className: "w-6 h-6 mr-2 text-blue-500",
|
1060
|
+
children: /* @__PURE__ */ r.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.31-8.86c-1.77-.45-2.34-.94-2.34-1.67 0-.84.79-1.43 2.1-1.43 1.38 0 1.9.66 1.94 1.64h1.71c-.05-1.34-.87-2.57-2.49-2.97V5H10.9v1.69c-1.51.32-2.72 1.3-2.72 2.81 0 1.79 1.49 2.69 3.66 3.21 1.95.46 2.34 1.15 2.34 1.87 0 .53-.39 1.39-2.1 1.39-1.6 0-2.23-.72-2.32-1.64H8.04c.1 1.7 1.36 2.66 2.86 2.97V19h2.34v-1.67c1.52-.29 2.72-1.16 2.73-2.77-.01-2.2-1.9-2.96-3.66-3.42z" })
|
1061
|
+
}
|
1062
|
+
),
|
1063
|
+
/* @__PURE__ */ r.jsx("h2", { className: Q, children: "Coinley Pay" })
|
1064
|
+
] }),
|
1065
|
+
/* @__PURE__ */ r.jsx(
|
1066
|
+
"button",
|
1067
|
+
{
|
1068
|
+
onClick: H,
|
1069
|
+
className: `text-gray-500 hover:text-gray-700 focus:outline-none ${o === "dark" ? "text-gray-400 hover:text-gray-300" : ""}`,
|
1070
|
+
children: /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
1071
|
+
}
|
1072
|
+
)
|
1073
|
+
] }),
|
1074
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mb-6", children: [
|
1075
|
+
i && /* @__PURE__ */ r.jsxs("div", { className: `mb-6 p-4 rounded-lg ${o === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1076
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm ${o === "dark" ? "text-gray-300" : "text-gray-600"}`, children: D }),
|
1077
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex justify-between items-center mt-2", children: [
|
1078
|
+
/* @__PURE__ */ r.jsx("span", { className: `font-medium ${o === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Amount:" }),
|
1079
|
+
/* @__PURE__ */ r.jsxs("span", { className: "font-bold text-xl", children: [
|
1080
|
+
"$",
|
1081
|
+
ee(i.totalAmount || i.amount)
|
1082
|
+
] })
|
1083
|
+
] }),
|
1084
|
+
/* @__PURE__ */ r.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ r.jsxs("span", { className: `${o === "dark" ? "text-gray-400" : "text-gray-500"}`, children: [
|
1085
|
+
"Payment ID: ",
|
1086
|
+
i.id.slice(0, 8),
|
1087
|
+
"..."
|
1088
|
+
] }) })
|
1089
|
+
] }),
|
1090
|
+
R === "select-currency" && /* @__PURE__ */ r.jsx(
|
1091
|
+
Cr,
|
1092
|
+
{
|
1093
|
+
onSelect: v,
|
1094
|
+
selected: x,
|
1095
|
+
theme: o
|
1096
|
+
}
|
1097
|
+
),
|
1098
|
+
R === "confirm" && i && /* @__PURE__ */ r.jsxs("div", { children: [
|
1099
|
+
/* @__PURE__ */ r.jsxs("div", { className: `p-4 rounded-lg mb-4 ${o === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1100
|
+
/* @__PURE__ */ r.jsx("h3", { className: `text-lg font-medium mb-2 ${o === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Details" }),
|
1101
|
+
/* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
1102
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex justify-between", children: [
|
1103
|
+
/* @__PURE__ */ r.jsx("span", { className: o === "dark" ? "text-gray-300" : "text-gray-600", children: "Currency:" }),
|
1104
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium", children: x })
|
1105
|
+
] }),
|
1106
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex justify-between", children: [
|
1107
|
+
/* @__PURE__ */ r.jsx("span", { className: o === "dark" ? "text-gray-300" : "text-gray-600", children: "Network:" }),
|
1108
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium", children: x === "SOL" || x === "USDC_SOL" ? "Solana" : "Ethereum" })
|
1109
|
+
] }),
|
1110
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex justify-between", children: [
|
1111
|
+
/* @__PURE__ */ r.jsx("span", { className: o === "dark" ? "text-gray-300" : "text-gray-600", children: "Fee:" }),
|
1112
|
+
/* @__PURE__ */ r.jsx("span", { className: "font-medium", children: "1.75%" })
|
1113
|
+
] })
|
1114
|
+
] })
|
1115
|
+
] }),
|
1116
|
+
N ? (
|
1117
|
+
// Test mode payment option
|
1118
|
+
/* @__PURE__ */ r.jsx("div", { className: `p-4 rounded-lg mb-4 ${o === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
1119
|
+
/* @__PURE__ */ r.jsx("div", { className: "bg-blue-500 rounded-full p-2 mr-3", children: /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
1120
|
+
/* @__PURE__ */ r.jsxs("div", { children: [
|
1121
|
+
/* @__PURE__ */ r.jsx("h3", { className: `font-medium ${o === "dark" ? "text-white" : "text-gray-800"}`, children: "Test Mode Payment" }),
|
1122
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm ${o === "dark" ? "text-gray-300" : "text-gray-600"}`, children: 'Click "Pay Now" to simulate a successful payment' })
|
1123
|
+
] })
|
1124
|
+
] }) })
|
1125
|
+
) : W ? (
|
1126
|
+
// MetaMask available option
|
1127
|
+
/* @__PURE__ */ r.jsxs("div", { className: `p-4 rounded-lg mb-4 ${o === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: [
|
1128
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
1129
|
+
/* @__PURE__ */ r.jsx(
|
1130
|
+
"img",
|
1131
|
+
{
|
1132
|
+
src: "https://metamask.io/images/metamask-fox.svg",
|
1133
|
+
alt: "MetaMask",
|
1134
|
+
className: "w-8 h-8 mr-2"
|
1135
|
+
}
|
1136
|
+
),
|
1137
|
+
/* @__PURE__ */ r.jsxs("div", { children: [
|
1138
|
+
/* @__PURE__ */ r.jsx("h3", { className: `font-medium ${o === "dark" ? "text-white" : "text-gray-800"}`, children: "Pay with MetaMask" }),
|
1139
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm ${o === "dark" ? "text-gray-300" : "text-gray-600"}`, children: T ? "Your wallet is connected. Click 'Pay Now' to proceed." : "Click 'Connect Wallet' to proceed with payment." })
|
1140
|
+
] })
|
1141
|
+
] }),
|
1142
|
+
!T && /* @__PURE__ */ r.jsx(
|
1143
|
+
"button",
|
1144
|
+
{
|
1145
|
+
onClick: P,
|
1146
|
+
className: `mt-3 ${G}`,
|
1147
|
+
children: "Connect Wallet"
|
1148
|
+
}
|
1149
|
+
)
|
1150
|
+
] })
|
1151
|
+
) : (
|
1152
|
+
// MetaMask not available warning
|
1153
|
+
/* @__PURE__ */ r.jsxs("div", { className: `p-4 rounded-lg mb-4 ${o === "dark" ? "bg-yellow-900/20" : "bg-yellow-50"}`, children: [
|
1154
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center", children: [
|
1155
|
+
/* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ r.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
1156
|
+
/* @__PURE__ */ r.jsxs("div", { children: [
|
1157
|
+
/* @__PURE__ */ r.jsx("h3", { className: `font-medium ${o === "dark" ? "text-white" : "text-gray-800"}`, children: "MetaMask Not Detected" }),
|
1158
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm ${o === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please install MetaMask extension to make payments" })
|
1159
|
+
] })
|
1160
|
+
] }),
|
1161
|
+
/* @__PURE__ */ r.jsx(
|
1162
|
+
"a",
|
1163
|
+
{
|
1164
|
+
href: "https://metamask.io/download/",
|
1165
|
+
target: "_blank",
|
1166
|
+
rel: "noopener noreferrer",
|
1167
|
+
className: `block mt-3 text-center ${G}`,
|
1168
|
+
children: "Install MetaMask"
|
1169
|
+
}
|
1170
|
+
)
|
1171
|
+
] })
|
1172
|
+
),
|
1173
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
|
1174
|
+
/* @__PURE__ */ r.jsx(
|
1175
|
+
"button",
|
1176
|
+
{
|
1177
|
+
type: "button",
|
1178
|
+
onClick: _,
|
1179
|
+
className: U,
|
1180
|
+
children: "Back"
|
1181
|
+
}
|
1182
|
+
),
|
1183
|
+
/* @__PURE__ */ r.jsx(
|
1184
|
+
"button",
|
1185
|
+
{
|
1186
|
+
type: "button",
|
1187
|
+
onClick: K,
|
1188
|
+
className: G,
|
1189
|
+
disabled: !N && W && !T,
|
1190
|
+
children: "Pay Now"
|
1191
|
+
}
|
1192
|
+
)
|
1193
|
+
] })
|
1194
|
+
] }),
|
1195
|
+
R === "processing" && /* @__PURE__ */ r.jsx(
|
1196
|
+
De,
|
1197
|
+
{
|
1198
|
+
status: "processing",
|
1199
|
+
theme: o,
|
1200
|
+
message: "Processing your payment..."
|
1201
|
+
}
|
1202
|
+
),
|
1203
|
+
R === "success" && /* @__PURE__ */ r.jsxs("div", { children: [
|
1204
|
+
/* @__PURE__ */ r.jsx(
|
1205
|
+
De,
|
1206
|
+
{
|
1207
|
+
status: "success",
|
1208
|
+
theme: o,
|
1209
|
+
message: "Payment successful!"
|
1210
|
+
}
|
1211
|
+
),
|
1212
|
+
y && /* @__PURE__ */ r.jsxs("div", { className: `mt-4 p-3 rounded-lg ${o === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1213
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-xs ${o === "dark" ? "text-gray-300" : "text-gray-600"} mb-1`, children: "Transaction Hash:" }),
|
1214
|
+
/* @__PURE__ */ r.jsx("p", { className: `text-sm font-mono break-all ${o === "dark" ? "text-white" : "text-gray-800"}`, children: re(y) }),
|
1215
|
+
/* @__PURE__ */ r.jsx(
|
1216
|
+
"a",
|
1217
|
+
{
|
1218
|
+
href: `https://etherscan.io/tx/${y}`,
|
1219
|
+
target: "_blank",
|
1220
|
+
rel: "noopener noreferrer",
|
1221
|
+
className: `text-xs ${o === "dark" ? "text-blue-400" : "text-blue-600"} mt-2 inline-block`,
|
1222
|
+
children: "View on Etherscan →"
|
1223
|
+
}
|
1224
|
+
)
|
1225
|
+
] })
|
1226
|
+
] }),
|
1227
|
+
R === "error" && /* @__PURE__ */ r.jsxs("div", { children: [
|
1228
|
+
/* @__PURE__ */ r.jsx(
|
1229
|
+
De,
|
1230
|
+
{
|
1231
|
+
status: "error",
|
1232
|
+
theme: o,
|
1233
|
+
message: S || "An error occurred while processing your payment."
|
1234
|
+
}
|
1235
|
+
),
|
1236
|
+
/* @__PURE__ */ r.jsx(
|
1237
|
+
"button",
|
1238
|
+
{
|
1239
|
+
type: "button",
|
1240
|
+
onClick: _,
|
1241
|
+
className: `mt-4 ${U}`,
|
1242
|
+
children: "Try Again"
|
1243
|
+
}
|
1244
|
+
)
|
1245
|
+
] })
|
1246
|
+
] }),
|
1247
|
+
/* @__PURE__ */ r.jsx("div", { className: `text-center text-xs ${o === "dark" ? "text-gray-400" : "text-gray-500"}`, children: /* @__PURE__ */ r.jsx("p", { children: "Powered by Coinley - Secure Cryptocurrency Payments" }) })
|
1248
|
+
] }) }) }) : null;
|
1249
|
+
}, Pr = pr(({
|
1250
|
+
apiKey: n,
|
1251
|
+
apiSecret: a,
|
1252
|
+
apiUrl: i,
|
1253
|
+
customerEmail: l,
|
1254
|
+
merchantName: x = "Merchant",
|
1255
|
+
onSuccess: f,
|
1256
|
+
onError: j,
|
1257
|
+
onClose: S,
|
1258
|
+
theme: o,
|
1259
|
+
autoOpen: D = !1,
|
1260
|
+
debug: y = !1,
|
1261
|
+
testMode: T = !1
|
1262
|
+
// Add testMode flag for development
|
1263
|
+
}, P) => {
|
1264
|
+
const N = Ir(), { theme: R } = Lr(), [z, W] = O(D), [I, v] = O(null), [K, _] = O("idle"), [H, ee] = O("USDT"), [re, Y] = O(null), [V, Q] = O(null), [G, U] = O(!1);
|
1265
|
+
n || (N == null || N.apiKey), a || (N == null || N.apiSecret), i || (N == null || N.apiUrl);
|
1266
|
+
const h = o || R, $ = y || (N == null ? void 0 : N.debug);
|
1267
|
+
Nr(P, () => ({
|
1268
|
+
open: (u) => {
|
1269
|
+
ce(u);
|
1270
|
+
},
|
1271
|
+
close: () => {
|
1272
|
+
te();
|
1273
|
+
},
|
1274
|
+
getPayment: () => I
|
1275
|
+
}));
|
1276
|
+
const w = (u, b) => {
|
1277
|
+
$ && console.log(`[Coinley SDK] ${u}`, b);
|
1278
|
+
};
|
1279
|
+
B(() => {
|
1280
|
+
(async () => {
|
1281
|
+
if (F())
|
1282
|
+
try {
|
1283
|
+
const b = await window.ethereum.request({ method: "eth_accounts" });
|
1284
|
+
U(b && b.length > 0);
|
1285
|
+
} catch (b) {
|
1286
|
+
w("Error checking wallet connection:", b), U(!1);
|
1287
|
+
}
|
1288
|
+
else
|
1289
|
+
U(!1);
|
1290
|
+
})();
|
1291
|
+
}, []), B(() => {
|
1292
|
+
const u = (b) => {
|
1293
|
+
U(b.length > 0);
|
1294
|
+
};
|
1295
|
+
return window.ethereum && window.ethereum.on("accountsChanged", u), () => {
|
1296
|
+
window.ethereum && window.ethereum.removeListener("accountsChanged", u);
|
1297
|
+
};
|
1298
|
+
}, []);
|
1299
|
+
const ce = async (u) => {
|
1300
|
+
if (!u || !u.amount) {
|
1301
|
+
Y("Payment amount is required"), j && j(new Error("Payment amount is required"));
|
1302
|
+
return;
|
1303
|
+
}
|
1304
|
+
_("loading"), W(!0);
|
1305
|
+
try {
|
1306
|
+
w("Creating payment with details:", u);
|
1307
|
+
const b = await Dr({
|
1308
|
+
amount: u.amount,
|
1309
|
+
currency: u.currency || "USDT",
|
1310
|
+
customerEmail: u.customerEmail || l,
|
1311
|
+
callbackUrl: u.callbackUrl,
|
1312
|
+
metadata: u.metadata || {}
|
1313
|
+
});
|
1314
|
+
w("Payment created:", b), v(b.payment), _("idle"), Y(null);
|
1315
|
+
} catch (b) {
|
1316
|
+
w("Error creating payment:", b), Y(b.message || "Failed to create payment"), _("error"), j && j(b);
|
1317
|
+
}
|
1318
|
+
}, te = () => {
|
1319
|
+
W(!1), Q(null), S && S();
|
1320
|
+
}, le = (u) => {
|
1321
|
+
w("Currency selected:", u), ee(u);
|
1322
|
+
}, ne = async () => {
|
1323
|
+
if (!F())
|
1324
|
+
return Y("MetaMask is not installed. Please install MetaMask to make payments."), !1;
|
1325
|
+
try {
|
1326
|
+
const u = await Er();
|
1327
|
+
return U(u.length > 0), u.length > 0;
|
1328
|
+
} catch (u) {
|
1329
|
+
return w("Error connecting to wallet:", u), Y(u.message || "Failed to connect to wallet"), !1;
|
1330
|
+
}
|
1331
|
+
}, ue = async () => {
|
1332
|
+
if (!I) {
|
1333
|
+
Y("No active payment to process");
|
1334
|
+
return;
|
1335
|
+
}
|
1336
|
+
w("Starting payment process..."), _("loading"), Q(null);
|
1337
|
+
try {
|
1338
|
+
w("Processing payment:", { paymentId: I.id, currency: H });
|
1339
|
+
let u;
|
1340
|
+
if (T)
|
1341
|
+
w("Test mode: Generating mock transaction..."), u = `0x${Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("")}`;
|
1342
|
+
else {
|
1343
|
+
if (!G && !await ne())
|
1344
|
+
throw new Error("Please connect your wallet to proceed with payment");
|
1345
|
+
const de = I.merchantAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e", xe = {
|
1346
|
+
from: await window.ethereum.request({ method: "eth_requestAccounts" }).then((fe) => fe[0]),
|
1347
|
+
to: de,
|
1348
|
+
value: "0x0",
|
1349
|
+
// For ERC-20 tokens, value is 0
|
1350
|
+
data: "0x"
|
1351
|
+
// Would include token transfer data for ERC-20
|
1352
|
+
};
|
1353
|
+
w("Sending transaction to wallet for approval..."), u = await Ar(xe);
|
1354
|
+
}
|
1355
|
+
w("Transaction hash:", u), Q(u), w("Sending process payment request to API...");
|
1356
|
+
const b = await Tr({
|
1357
|
+
paymentId: I.id,
|
1358
|
+
transactionHash: u,
|
1359
|
+
network: "ethereum"
|
1360
|
+
// Or determine based on selected currency
|
1361
|
+
});
|
1362
|
+
w("Payment processed successfully:", b), _("success"), f && (w("Calling onSuccess callback..."), f(I.id, u));
|
1363
|
+
} catch (u) {
|
1364
|
+
w("Payment error:", u), Y(u.message || "Failed to process payment"), _("error"), j && j(u);
|
1365
|
+
}
|
1366
|
+
};
|
1367
|
+
return B(() => {
|
1368
|
+
D && I && W(!0);
|
1369
|
+
}, [D, I]), /* @__PURE__ */ r.jsx(r.Fragment, { children: z && /* @__PURE__ */ r.jsx(
|
1370
|
+
Or,
|
1371
|
+
{
|
1372
|
+
isOpen: z,
|
1373
|
+
onClose: te,
|
1374
|
+
payment: I,
|
1375
|
+
paymentStatus: K,
|
1376
|
+
selectedCurrency: H,
|
1377
|
+
onCurrencySelect: le,
|
1378
|
+
onPayment: ue,
|
1379
|
+
error: re,
|
1380
|
+
theme: h,
|
1381
|
+
merchantName: x,
|
1382
|
+
transactionHash: V,
|
1383
|
+
walletConnected: G,
|
1384
|
+
onConnectWallet: ne,
|
1385
|
+
testMode: T
|
1386
|
+
}
|
1387
|
+
) });
|
1388
|
+
});
|
1389
|
+
Pr.displayName = "CoinleyCheckout";
|
1390
|
+
const Vr = {
|
1391
|
+
apiUrl: "http://localhost:9000",
|
1392
|
+
debug: !1,
|
1393
|
+
testMode: !1,
|
1394
|
+
theme: "light"
|
1395
|
+
}, Jr = "1.0.0";
|
1396
|
+
export {
|
1397
|
+
Pr as CoinleyCheckout,
|
1398
|
+
Or as CoinleyModal,
|
1399
|
+
Fr as CoinleyProvider,
|
1400
|
+
Vr as DEFAULT_CONFIG,
|
1401
|
+
Hr as TOKEN_ADDRESSES,
|
1402
|
+
zr as ThemeProvider,
|
1403
|
+
Jr as VERSION,
|
1404
|
+
Er as connectWallet,
|
1405
|
+
Dr as createPayment,
|
1406
|
+
kr as getAccounts,
|
1407
|
+
Wr as getChainId,
|
1408
|
+
Ur as getMerchantPaymentStats,
|
1409
|
+
Yr as getMerchantPayments,
|
1410
|
+
Zr as getNetworkName,
|
1411
|
+
_r as getPayment,
|
1412
|
+
$r as getSupportedCurrencies,
|
1413
|
+
Br as getTokenBalance,
|
1414
|
+
F as isMetaMaskInstalled,
|
1415
|
+
Qr as isWalletConnected,
|
1416
|
+
Tr as processPayment,
|
1417
|
+
Gr as sendToken,
|
1418
|
+
Ar as sendTransaction
|
1419
|
+
};
|