coinley-checkout 0.1.3 → 0.1.5
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/dist/coinley-checkout.es.js +1641 -1115
- package/dist/coinley-checkout.es.js.map +1 -0
- package/dist/coinley-checkout.umd.js +1993 -32
- package/dist/coinley-checkout.umd.js.map +1 -0
- package/dist/style.css +1336 -1
- package/package.json +1 -1
@@ -1,5 +1,6 @@
|
|
1
|
-
import
|
2
|
-
var
|
1
|
+
import require$$0, { createContext, useContext, useState, useEffect, lazy, forwardRef, useImperativeHandle } from "react";
|
2
|
+
var jsxRuntime = { exports: {} };
|
3
|
+
var reactJsxRuntime_production_min = {};
|
3
4
|
/**
|
4
5
|
* @license React
|
5
6
|
* react-jsx-runtime.production.min.js
|
@@ -9,25 +10,30 @@ var Ae = { exports: {} }, le = {};
|
|
9
10
|
* This source code is licensed under the MIT license found in the
|
10
11
|
* LICENSE file in the root directory of this source tree.
|
11
12
|
*/
|
12
|
-
var
|
13
|
-
function
|
14
|
-
if (
|
15
|
-
return
|
16
|
-
|
17
|
-
var
|
18
|
-
function
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
var hasRequiredReactJsxRuntime_production_min;
|
14
|
+
function requireReactJsxRuntime_production_min() {
|
15
|
+
if (hasRequiredReactJsxRuntime_production_min)
|
16
|
+
return reactJsxRuntime_production_min;
|
17
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
18
|
+
var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
19
|
+
function q(c, a, g) {
|
20
|
+
var b, d = {}, e = null, h = null;
|
21
|
+
void 0 !== g && (e = "" + g);
|
22
|
+
void 0 !== a.key && (e = "" + a.key);
|
23
|
+
void 0 !== a.ref && (h = a.ref);
|
24
|
+
for (b in a)
|
25
|
+
m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
26
|
+
if (c && c.defaultProps)
|
27
|
+
for (b in a = c.defaultProps, a)
|
28
|
+
void 0 === d[b] && (d[b] = a[b]);
|
29
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
27
30
|
}
|
28
|
-
|
31
|
+
reactJsxRuntime_production_min.Fragment = l;
|
32
|
+
reactJsxRuntime_production_min.jsx = q;
|
33
|
+
reactJsxRuntime_production_min.jsxs = q;
|
34
|
+
return reactJsxRuntime_production_min;
|
29
35
|
}
|
30
|
-
var
|
36
|
+
var reactJsxRuntime_development = {};
|
31
37
|
/**
|
32
38
|
* @license React
|
33
39
|
* react-jsx-runtime.development.js
|
@@ -37,722 +43,1060 @@ var ue = {};
|
|
37
43
|
* This source code is licensed under the MIT license found in the
|
38
44
|
* LICENSE file in the root directory of this source tree.
|
39
45
|
*/
|
40
|
-
var
|
41
|
-
function
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
var hasRequiredReactJsxRuntime_development;
|
47
|
+
function requireReactJsxRuntime_development() {
|
48
|
+
if (hasRequiredReactJsxRuntime_development)
|
49
|
+
return reactJsxRuntime_development;
|
50
|
+
hasRequiredReactJsxRuntime_development = 1;
|
51
|
+
if (process.env.NODE_ENV !== "production") {
|
52
|
+
(function() {
|
53
|
+
var React = require$$0;
|
54
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
55
|
+
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
56
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
57
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
58
|
+
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
59
|
+
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
60
|
+
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
61
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
62
|
+
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
63
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
64
|
+
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
65
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
66
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
67
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
68
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
69
|
+
function getIteratorFn(maybeIterable) {
|
70
|
+
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
71
|
+
return null;
|
72
|
+
}
|
73
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
74
|
+
if (typeof maybeIterator === "function") {
|
75
|
+
return maybeIterator;
|
76
|
+
}
|
46
77
|
return null;
|
47
|
-
var r = U && e[U] || e[Y];
|
48
|
-
return typeof r == "function" ? r : null;
|
49
|
-
}
|
50
|
-
var A = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
51
|
-
function p(e) {
|
52
|
-
{
|
53
|
-
for (var r = arguments.length, s = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
54
|
-
s[l - 1] = arguments[l];
|
55
|
-
se("error", e, s);
|
56
78
|
}
|
57
|
-
|
58
|
-
|
79
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
80
|
+
function error(format) {
|
81
|
+
{
|
82
|
+
{
|
83
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
84
|
+
args[_key2 - 1] = arguments[_key2];
|
85
|
+
}
|
86
|
+
printWarning("error", format, args);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
function printWarning(level, format, args) {
|
91
|
+
{
|
92
|
+
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
93
|
+
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
94
|
+
if (stack !== "") {
|
95
|
+
format += "%s";
|
96
|
+
args = args.concat([stack]);
|
97
|
+
}
|
98
|
+
var argsWithFormat = args.map(function(item) {
|
99
|
+
return String(item);
|
100
|
+
});
|
101
|
+
argsWithFormat.unshift("Warning: " + format);
|
102
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
var enableScopeAPI = false;
|
106
|
+
var enableCacheElement = false;
|
107
|
+
var enableTransitionTracing = false;
|
108
|
+
var enableLegacyHidden = false;
|
109
|
+
var enableDebugTracing = false;
|
110
|
+
var REACT_MODULE_REFERENCE;
|
59
111
|
{
|
60
|
-
|
61
|
-
m !== "" && (r += "%s", s = s.concat([m]));
|
62
|
-
var h = s.map(function(f) {
|
63
|
-
return String(f);
|
64
|
-
});
|
65
|
-
h.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, h);
|
112
|
+
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
66
113
|
}
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
function Q(e) {
|
85
|
-
return e.displayName || "Context";
|
86
|
-
}
|
87
|
-
function I(e) {
|
88
|
-
if (e == null)
|
89
|
-
return null;
|
90
|
-
if (typeof e.tag == "number" && p("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 c:
|
96
|
-
return "Fragment";
|
97
|
-
case i:
|
98
|
-
return "Portal";
|
99
|
-
case d:
|
100
|
-
return "Profiler";
|
101
|
-
case x:
|
102
|
-
return "StrictMode";
|
103
|
-
case S:
|
104
|
-
return "Suspense";
|
105
|
-
case M:
|
106
|
-
return "SuspenseList";
|
114
|
+
function isValidElementType(type) {
|
115
|
+
if (typeof type === "string" || typeof type === "function") {
|
116
|
+
return true;
|
117
|
+
}
|
118
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
119
|
+
return true;
|
120
|
+
}
|
121
|
+
if (typeof type === "object" && type !== null) {
|
122
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
123
|
+
// types supported by any Flight configuration anywhere since
|
124
|
+
// we don't know which Flight build this will end up being used
|
125
|
+
// with.
|
126
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
127
|
+
return true;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
return false;
|
107
131
|
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
132
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
133
|
+
var displayName = outerType.displayName;
|
134
|
+
if (displayName) {
|
135
|
+
return displayName;
|
136
|
+
}
|
137
|
+
var functionName = innerType.displayName || innerType.name || "";
|
138
|
+
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
139
|
+
}
|
140
|
+
function getContextName(type) {
|
141
|
+
return type.displayName || "Context";
|
142
|
+
}
|
143
|
+
function getComponentNameFromType(type) {
|
144
|
+
if (type == null) {
|
145
|
+
return null;
|
146
|
+
}
|
147
|
+
{
|
148
|
+
if (typeof type.tag === "number") {
|
149
|
+
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
150
|
+
}
|
151
|
+
}
|
152
|
+
if (typeof type === "function") {
|
153
|
+
return type.displayName || type.name || null;
|
154
|
+
}
|
155
|
+
if (typeof type === "string") {
|
156
|
+
return type;
|
157
|
+
}
|
158
|
+
switch (type) {
|
159
|
+
case REACT_FRAGMENT_TYPE:
|
160
|
+
return "Fragment";
|
161
|
+
case REACT_PORTAL_TYPE:
|
162
|
+
return "Portal";
|
163
|
+
case REACT_PROFILER_TYPE:
|
164
|
+
return "Profiler";
|
165
|
+
case REACT_STRICT_MODE_TYPE:
|
166
|
+
return "StrictMode";
|
167
|
+
case REACT_SUSPENSE_TYPE:
|
168
|
+
return "Suspense";
|
169
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
170
|
+
return "SuspenseList";
|
171
|
+
}
|
172
|
+
if (typeof type === "object") {
|
173
|
+
switch (type.$$typeof) {
|
174
|
+
case REACT_CONTEXT_TYPE:
|
175
|
+
var context = type;
|
176
|
+
return getContextName(context) + ".Consumer";
|
177
|
+
case REACT_PROVIDER_TYPE:
|
178
|
+
var provider = type;
|
179
|
+
return getContextName(provider._context) + ".Provider";
|
180
|
+
case REACT_FORWARD_REF_TYPE:
|
181
|
+
return getWrappedName(type, type.render, "ForwardRef");
|
182
|
+
case REACT_MEMO_TYPE:
|
183
|
+
var outerName = type.displayName || null;
|
184
|
+
if (outerName !== null) {
|
185
|
+
return outerName;
|
186
|
+
}
|
187
|
+
return getComponentNameFromType(type.type) || "Memo";
|
188
|
+
case REACT_LAZY_TYPE: {
|
189
|
+
var lazyComponent = type;
|
190
|
+
var payload = lazyComponent._payload;
|
191
|
+
var init = lazyComponent._init;
|
192
|
+
try {
|
193
|
+
return getComponentNameFromType(init(payload));
|
194
|
+
} catch (x) {
|
195
|
+
return null;
|
196
|
+
}
|
127
197
|
}
|
128
198
|
}
|
129
199
|
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
warn
|
150
|
-
error
|
151
|
-
group
|
152
|
-
groupCollapsed
|
153
|
-
groupEnd
|
154
|
-
|
200
|
+
return null;
|
201
|
+
}
|
202
|
+
var assign = Object.assign;
|
203
|
+
var disabledDepth = 0;
|
204
|
+
var prevLog;
|
205
|
+
var prevInfo;
|
206
|
+
var prevWarn;
|
207
|
+
var prevError;
|
208
|
+
var prevGroup;
|
209
|
+
var prevGroupCollapsed;
|
210
|
+
var prevGroupEnd;
|
211
|
+
function disabledLog() {
|
212
|
+
}
|
213
|
+
disabledLog.__reactDisabledLog = true;
|
214
|
+
function disableLogs() {
|
215
|
+
{
|
216
|
+
if (disabledDepth === 0) {
|
217
|
+
prevLog = console.log;
|
218
|
+
prevInfo = console.info;
|
219
|
+
prevWarn = console.warn;
|
220
|
+
prevError = console.error;
|
221
|
+
prevGroup = console.group;
|
222
|
+
prevGroupCollapsed = console.groupCollapsed;
|
223
|
+
prevGroupEnd = console.groupEnd;
|
224
|
+
var props = {
|
225
|
+
configurable: true,
|
226
|
+
enumerable: true,
|
227
|
+
value: disabledLog,
|
228
|
+
writable: true
|
229
|
+
};
|
230
|
+
Object.defineProperties(console, {
|
231
|
+
info: props,
|
232
|
+
log: props,
|
233
|
+
warn: props,
|
234
|
+
error: props,
|
235
|
+
group: props,
|
236
|
+
groupCollapsed: props,
|
237
|
+
groupEnd: props
|
238
|
+
});
|
239
|
+
}
|
240
|
+
disabledDepth++;
|
155
241
|
}
|
156
|
-
j++;
|
157
242
|
}
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
243
|
+
function reenableLogs() {
|
244
|
+
{
|
245
|
+
disabledDepth--;
|
246
|
+
if (disabledDepth === 0) {
|
247
|
+
var props = {
|
248
|
+
configurable: true,
|
249
|
+
enumerable: true,
|
250
|
+
writable: true
|
251
|
+
};
|
252
|
+
Object.defineProperties(console, {
|
253
|
+
log: assign({}, props, {
|
254
|
+
value: prevLog
|
255
|
+
}),
|
256
|
+
info: assign({}, props, {
|
257
|
+
value: prevInfo
|
258
|
+
}),
|
259
|
+
warn: assign({}, props, {
|
260
|
+
value: prevWarn
|
261
|
+
}),
|
262
|
+
error: assign({}, props, {
|
263
|
+
value: prevError
|
264
|
+
}),
|
265
|
+
group: assign({}, props, {
|
266
|
+
value: prevGroup
|
267
|
+
}),
|
268
|
+
groupCollapsed: assign({}, props, {
|
269
|
+
value: prevGroupCollapsed
|
270
|
+
}),
|
271
|
+
groupEnd: assign({}, props, {
|
272
|
+
value: prevGroupEnd
|
273
|
+
})
|
274
|
+
});
|
275
|
+
}
|
276
|
+
if (disabledDepth < 0) {
|
277
|
+
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
278
|
+
}
|
190
279
|
}
|
191
|
-
j < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
192
280
|
}
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
281
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
282
|
+
var prefix;
|
283
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
284
|
+
{
|
285
|
+
if (prefix === void 0) {
|
286
|
+
try {
|
287
|
+
throw Error();
|
288
|
+
} catch (x) {
|
289
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
290
|
+
prefix = match && match[1] || "";
|
291
|
+
}
|
203
292
|
}
|
204
|
-
|
205
|
-
|
293
|
+
return "\n" + prefix + name;
|
294
|
+
}
|
206
295
|
}
|
207
|
-
|
208
|
-
|
209
|
-
{
|
210
|
-
var Ve = typeof WeakMap == "function" ? WeakMap : Map;
|
211
|
-
ye = new Ve();
|
212
|
-
}
|
213
|
-
function Te(e, r) {
|
214
|
-
if (!e || pe)
|
215
|
-
return "";
|
296
|
+
var reentry = false;
|
297
|
+
var componentFrameCache;
|
216
298
|
{
|
217
|
-
var
|
218
|
-
|
219
|
-
return s;
|
299
|
+
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
300
|
+
componentFrameCache = new PossiblyWeakMap();
|
220
301
|
}
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
302
|
+
function describeNativeComponentFrame(fn, construct) {
|
303
|
+
if (!fn || reentry) {
|
304
|
+
return "";
|
305
|
+
}
|
306
|
+
{
|
307
|
+
var frame = componentFrameCache.get(fn);
|
308
|
+
if (frame !== void 0) {
|
309
|
+
return frame;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
var control;
|
313
|
+
reentry = true;
|
314
|
+
var previousPrepareStackTrace = Error.prepareStackTrace;
|
315
|
+
Error.prepareStackTrace = void 0;
|
316
|
+
var previousDispatcher;
|
317
|
+
{
|
318
|
+
previousDispatcher = ReactCurrentDispatcher.current;
|
319
|
+
ReactCurrentDispatcher.current = null;
|
320
|
+
disableLogs();
|
321
|
+
}
|
322
|
+
try {
|
323
|
+
if (construct) {
|
324
|
+
var Fake = function() {
|
234
325
|
throw Error();
|
326
|
+
};
|
327
|
+
Object.defineProperty(Fake.prototype, "props", {
|
328
|
+
set: function() {
|
329
|
+
throw Error();
|
330
|
+
}
|
331
|
+
});
|
332
|
+
if (typeof Reflect === "object" && Reflect.construct) {
|
333
|
+
try {
|
334
|
+
Reflect.construct(Fake, []);
|
335
|
+
} catch (x) {
|
336
|
+
control = x;
|
337
|
+
}
|
338
|
+
Reflect.construct(fn, [], Fake);
|
339
|
+
} else {
|
340
|
+
try {
|
341
|
+
Fake.call();
|
342
|
+
} catch (x) {
|
343
|
+
control = x;
|
344
|
+
}
|
345
|
+
fn.call(Fake.prototype);
|
235
346
|
}
|
236
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
237
|
-
try {
|
238
|
-
Reflect.construct(f, []);
|
239
|
-
} catch (E) {
|
240
|
-
l = E;
|
241
|
-
}
|
242
|
-
Reflect.construct(e, [], f);
|
243
347
|
} else {
|
244
348
|
try {
|
245
|
-
|
246
|
-
} catch (
|
247
|
-
|
349
|
+
throw Error();
|
350
|
+
} catch (x) {
|
351
|
+
control = x;
|
248
352
|
}
|
249
|
-
|
353
|
+
fn();
|
250
354
|
}
|
251
|
-
}
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
355
|
+
} catch (sample) {
|
356
|
+
if (sample && control && typeof sample.stack === "string") {
|
357
|
+
var sampleLines = sample.stack.split("\n");
|
358
|
+
var controlLines = control.stack.split("\n");
|
359
|
+
var s = sampleLines.length - 1;
|
360
|
+
var c = controlLines.length - 1;
|
361
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
362
|
+
c--;
|
363
|
+
}
|
364
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
365
|
+
if (sampleLines[s] !== controlLines[c]) {
|
366
|
+
if (s !== 1 || c !== 1) {
|
367
|
+
do {
|
368
|
+
s--;
|
369
|
+
c--;
|
370
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
371
|
+
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
372
|
+
if (fn.displayName && _frame.includes("<anonymous>")) {
|
373
|
+
_frame = _frame.replace("<anonymous>", fn.displayName);
|
374
|
+
}
|
375
|
+
{
|
376
|
+
if (typeof fn === "function") {
|
377
|
+
componentFrameCache.set(fn, _frame);
|
378
|
+
}
|
379
|
+
}
|
380
|
+
return _frame;
|
381
|
+
}
|
382
|
+
} while (s >= 1 && c >= 0);
|
383
|
+
}
|
384
|
+
break;
|
385
|
+
}
|
386
|
+
}
|
387
|
+
}
|
388
|
+
} finally {
|
389
|
+
reentry = false;
|
390
|
+
{
|
391
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
392
|
+
reenableLogs();
|
256
393
|
}
|
257
|
-
|
394
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
258
395
|
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
for (; v >= 1 && b >= 0; v--, b--)
|
266
|
-
if (u[v] !== D[b]) {
|
267
|
-
if (v !== 1 || b !== 1)
|
268
|
-
do
|
269
|
-
if (v--, b--, b < 0 || u[v] !== D[b]) {
|
270
|
-
var R = `
|
271
|
-
` + u[v].replace(" at new ", " at ");
|
272
|
-
return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && ye.set(e, R), R;
|
273
|
-
}
|
274
|
-
while (v >= 1 && b >= 0);
|
275
|
-
break;
|
276
|
-
}
|
396
|
+
var name = fn ? fn.displayName || fn.name : "";
|
397
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
398
|
+
{
|
399
|
+
if (typeof fn === "function") {
|
400
|
+
componentFrameCache.set(fn, syntheticFrame);
|
401
|
+
}
|
277
402
|
}
|
278
|
-
|
279
|
-
pe = !1, te.current = h, he(), Error.prepareStackTrace = m;
|
403
|
+
return syntheticFrame;
|
280
404
|
}
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
return Te(e, !1);
|
286
|
-
}
|
287
|
-
function Je(e) {
|
288
|
-
var r = e.prototype;
|
289
|
-
return !!(r && r.isReactComponent);
|
290
|
-
}
|
291
|
-
function me(e, r, s) {
|
292
|
-
if (e == null)
|
293
|
-
return "";
|
294
|
-
if (typeof e == "function")
|
295
|
-
return Te(e, Je(e));
|
296
|
-
if (typeof e == "string")
|
297
|
-
return ge(e);
|
298
|
-
switch (e) {
|
299
|
-
case S:
|
300
|
-
return ge("Suspense");
|
301
|
-
case M:
|
302
|
-
return ge("SuspenseList");
|
405
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
406
|
+
{
|
407
|
+
return describeNativeComponentFrame(fn, false);
|
408
|
+
}
|
303
409
|
}
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
}
|
410
|
+
function shouldConstruct(Component) {
|
411
|
+
var prototype = Component.prototype;
|
412
|
+
return !!(prototype && prototype.isReactComponent);
|
413
|
+
}
|
414
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
415
|
+
if (type == null) {
|
416
|
+
return "";
|
417
|
+
}
|
418
|
+
if (typeof type === "function") {
|
419
|
+
{
|
420
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
316
421
|
}
|
317
422
|
}
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
423
|
+
if (typeof type === "string") {
|
424
|
+
return describeBuiltInComponentFrame(type);
|
425
|
+
}
|
426
|
+
switch (type) {
|
427
|
+
case REACT_SUSPENSE_TYPE:
|
428
|
+
return describeBuiltInComponentFrame("Suspense");
|
429
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
430
|
+
return describeBuiltInComponentFrame("SuspenseList");
|
431
|
+
}
|
432
|
+
if (typeof type === "object") {
|
433
|
+
switch (type.$$typeof) {
|
434
|
+
case REACT_FORWARD_REF_TYPE:
|
435
|
+
return describeFunctionComponentFrame(type.render);
|
436
|
+
case REACT_MEMO_TYPE:
|
437
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
438
|
+
case REACT_LAZY_TYPE: {
|
439
|
+
var lazyComponent = type;
|
440
|
+
var payload = lazyComponent._payload;
|
441
|
+
var init = lazyComponent._init;
|
442
|
+
try {
|
443
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
444
|
+
} catch (x) {
|
338
445
|
}
|
339
|
-
u = e[f](r, f, l, s, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
340
|
-
} catch (v) {
|
341
|
-
u = v;
|
342
446
|
}
|
343
|
-
u && !(u instanceof Error) && (Me(m), p("%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).", l || "React class", s, f, typeof u), Me(null)), u instanceof Error && !(u.message in De) && (De[u.message] = !0, Me(m), p("Failed %s type: %s", s, u.message), Me(null));
|
344
447
|
}
|
448
|
+
}
|
449
|
+
return "";
|
345
450
|
}
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
451
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
452
|
+
var loggedTypeFailures = {};
|
453
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
454
|
+
function setCurrentlyValidatingElement(element) {
|
455
|
+
{
|
456
|
+
if (element) {
|
457
|
+
var owner = element._owner;
|
458
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
459
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
460
|
+
} else {
|
461
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
462
|
+
}
|
463
|
+
}
|
355
464
|
}
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
465
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
466
|
+
{
|
467
|
+
var has = Function.call.bind(hasOwnProperty);
|
468
|
+
for (var typeSpecName in typeSpecs) {
|
469
|
+
if (has(typeSpecs, typeSpecName)) {
|
470
|
+
var error$1 = void 0;
|
471
|
+
try {
|
472
|
+
if (typeof typeSpecs[typeSpecName] !== "function") {
|
473
|
+
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
474
|
+
err.name = "Invariant Violation";
|
475
|
+
throw err;
|
476
|
+
}
|
477
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
478
|
+
} catch (ex) {
|
479
|
+
error$1 = ex;
|
480
|
+
}
|
481
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
482
|
+
setCurrentlyValidatingElement(element);
|
483
|
+
error("%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).", componentName || "React class", location, typeSpecName, typeof error$1);
|
484
|
+
setCurrentlyValidatingElement(null);
|
485
|
+
}
|
486
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
487
|
+
loggedTypeFailures[error$1.message] = true;
|
488
|
+
setCurrentlyValidatingElement(element);
|
489
|
+
error("Failed %s type: %s", location, error$1.message);
|
490
|
+
setCurrentlyValidatingElement(null);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
}
|
362
495
|
}
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
}
|
367
|
-
function ke(e) {
|
368
|
-
if (rt(e))
|
369
|
-
return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(e)), Ee(e);
|
370
|
-
}
|
371
|
-
var ce = A.ReactCurrentOwner, at = {
|
372
|
-
key: !0,
|
373
|
-
ref: !0,
|
374
|
-
__self: !0,
|
375
|
-
__source: !0
|
376
|
-
}, Oe, Pe, ve;
|
377
|
-
ve = {};
|
378
|
-
function nt(e) {
|
379
|
-
if (ie.call(e, "ref")) {
|
380
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
381
|
-
if (r && r.isReactWarning)
|
382
|
-
return !1;
|
496
|
+
var isArrayImpl = Array.isArray;
|
497
|
+
function isArray(a) {
|
498
|
+
return isArrayImpl(a);
|
383
499
|
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
return !1;
|
500
|
+
function typeName(value) {
|
501
|
+
{
|
502
|
+
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
503
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
504
|
+
return type;
|
505
|
+
}
|
391
506
|
}
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
507
|
+
function willCoercionThrow(value) {
|
508
|
+
{
|
509
|
+
try {
|
510
|
+
testStringCoercion(value);
|
511
|
+
return false;
|
512
|
+
} catch (e) {
|
513
|
+
return true;
|
514
|
+
}
|
515
|
+
}
|
398
516
|
}
|
399
|
-
|
400
|
-
|
401
|
-
{
|
402
|
-
var s = function() {
|
403
|
-
Oe || (Oe = !0, p("%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)", r));
|
404
|
-
};
|
405
|
-
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
406
|
-
get: s,
|
407
|
-
configurable: !0
|
408
|
-
});
|
517
|
+
function testStringCoercion(value) {
|
518
|
+
return "" + value;
|
409
519
|
}
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
get: s,
|
418
|
-
configurable: !0
|
419
|
-
});
|
520
|
+
function checkKeyStringCoercion(value) {
|
521
|
+
{
|
522
|
+
if (willCoercionThrow(value)) {
|
523
|
+
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
524
|
+
return testStringCoercion(value);
|
525
|
+
}
|
526
|
+
}
|
420
527
|
}
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
type: e,
|
428
|
-
key: r,
|
429
|
-
ref: s,
|
430
|
-
props: f,
|
431
|
-
// Record the component responsible for creating this element.
|
432
|
-
_owner: h
|
528
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
529
|
+
var RESERVED_PROPS = {
|
530
|
+
key: true,
|
531
|
+
ref: true,
|
532
|
+
__self: true,
|
533
|
+
__source: true
|
433
534
|
};
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
writable: !0,
|
438
|
-
value: !1
|
439
|
-
}), Object.defineProperty(u, "_self", {
|
440
|
-
configurable: !1,
|
441
|
-
enumerable: !1,
|
442
|
-
writable: !1,
|
443
|
-
value: l
|
444
|
-
}), Object.defineProperty(u, "_source", {
|
445
|
-
configurable: !1,
|
446
|
-
enumerable: !1,
|
447
|
-
writable: !1,
|
448
|
-
value: m
|
449
|
-
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
|
450
|
-
};
|
451
|
-
function ut(e, r, s, l, m) {
|
535
|
+
var specialPropKeyWarningShown;
|
536
|
+
var specialPropRefWarningShown;
|
537
|
+
var didWarnAboutStringRefs;
|
452
538
|
{
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
539
|
+
didWarnAboutStringRefs = {};
|
540
|
+
}
|
541
|
+
function hasValidRef(config) {
|
542
|
+
{
|
543
|
+
if (hasOwnProperty.call(config, "ref")) {
|
544
|
+
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
545
|
+
if (getter && getter.isReactWarning) {
|
546
|
+
return false;
|
547
|
+
}
|
548
|
+
}
|
461
549
|
}
|
462
|
-
|
463
|
-
|
464
|
-
|
550
|
+
return config.ref !== void 0;
|
551
|
+
}
|
552
|
+
function hasValidKey(config) {
|
553
|
+
{
|
554
|
+
if (hasOwnProperty.call(config, "key")) {
|
555
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
556
|
+
if (getter && getter.isReactWarning) {
|
557
|
+
return false;
|
558
|
+
}
|
559
|
+
}
|
465
560
|
}
|
466
|
-
return
|
561
|
+
return config.key !== void 0;
|
467
562
|
}
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
var be;
|
478
|
-
be = !1;
|
479
|
-
function Le(e) {
|
480
|
-
return typeof e == "object" && e !== null && e.$$typeof === n;
|
481
|
-
}
|
482
|
-
function ze() {
|
483
|
-
{
|
484
|
-
if (Ne.current) {
|
485
|
-
var e = I(Ne.current.type);
|
486
|
-
if (e)
|
487
|
-
return `
|
488
|
-
|
489
|
-
Check the render method of \`` + e + "`.";
|
563
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
564
|
+
{
|
565
|
+
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
566
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
567
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
568
|
+
error('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', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
569
|
+
didWarnAboutStringRefs[componentName] = true;
|
570
|
+
}
|
571
|
+
}
|
490
572
|
}
|
491
|
-
return "";
|
492
573
|
}
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
574
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
575
|
+
{
|
576
|
+
var warnAboutAccessingKey = function() {
|
577
|
+
if (!specialPropKeyWarningShown) {
|
578
|
+
specialPropKeyWarningShown = true;
|
579
|
+
error("%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)", displayName);
|
580
|
+
}
|
581
|
+
};
|
582
|
+
warnAboutAccessingKey.isReactWarning = true;
|
583
|
+
Object.defineProperty(props, "key", {
|
584
|
+
get: warnAboutAccessingKey,
|
585
|
+
configurable: true
|
586
|
+
});
|
501
587
|
}
|
502
|
-
return "";
|
503
588
|
}
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
589
|
+
function defineRefPropWarningGetter(props, displayName) {
|
590
|
+
{
|
591
|
+
var warnAboutAccessingRef = function() {
|
592
|
+
if (!specialPropRefWarningShown) {
|
593
|
+
specialPropRefWarningShown = true;
|
594
|
+
error("%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)", displayName);
|
595
|
+
}
|
596
|
+
};
|
597
|
+
warnAboutAccessingRef.isReactWarning = true;
|
598
|
+
Object.defineProperty(props, "ref", {
|
599
|
+
get: warnAboutAccessingRef,
|
600
|
+
configurable: true
|
601
|
+
});
|
514
602
|
}
|
515
|
-
return r;
|
516
603
|
}
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
604
|
+
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
605
|
+
var element = {
|
606
|
+
// This tag allows us to uniquely identify this as a React Element
|
607
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
608
|
+
// Built-in properties that belong on the element
|
609
|
+
type,
|
610
|
+
key,
|
611
|
+
ref,
|
612
|
+
props,
|
613
|
+
// Record the component responsible for creating this element.
|
614
|
+
_owner: owner
|
615
|
+
};
|
616
|
+
{
|
617
|
+
element._store = {};
|
618
|
+
Object.defineProperty(element._store, "validated", {
|
619
|
+
configurable: false,
|
620
|
+
enumerable: false,
|
621
|
+
writable: true,
|
622
|
+
value: false
|
623
|
+
});
|
624
|
+
Object.defineProperty(element, "_self", {
|
625
|
+
configurable: false,
|
626
|
+
enumerable: false,
|
627
|
+
writable: false,
|
628
|
+
value: self
|
629
|
+
});
|
630
|
+
Object.defineProperty(element, "_source", {
|
631
|
+
configurable: false,
|
632
|
+
enumerable: false,
|
633
|
+
writable: false,
|
634
|
+
value: source
|
635
|
+
});
|
636
|
+
if (Object.freeze) {
|
637
|
+
Object.freeze(element.props);
|
638
|
+
Object.freeze(element);
|
639
|
+
}
|
640
|
+
}
|
641
|
+
return element;
|
642
|
+
};
|
643
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
644
|
+
{
|
645
|
+
var propName;
|
646
|
+
var props = {};
|
647
|
+
var key = null;
|
648
|
+
var ref = null;
|
649
|
+
if (maybeKey !== void 0) {
|
650
|
+
{
|
651
|
+
checkKeyStringCoercion(maybeKey);
|
652
|
+
}
|
653
|
+
key = "" + maybeKey;
|
654
|
+
}
|
655
|
+
if (hasValidKey(config)) {
|
656
|
+
{
|
657
|
+
checkKeyStringCoercion(config.key);
|
658
|
+
}
|
659
|
+
key = "" + config.key;
|
660
|
+
}
|
661
|
+
if (hasValidRef(config)) {
|
662
|
+
ref = config.ref;
|
663
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
664
|
+
}
|
665
|
+
for (propName in config) {
|
666
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
667
|
+
props[propName] = config[propName];
|
668
|
+
}
|
669
|
+
}
|
670
|
+
if (type && type.defaultProps) {
|
671
|
+
var defaultProps = type.defaultProps;
|
672
|
+
for (propName in defaultProps) {
|
673
|
+
if (props[propName] === void 0) {
|
674
|
+
props[propName] = defaultProps[propName];
|
675
|
+
}
|
676
|
+
}
|
677
|
+
}
|
678
|
+
if (key || ref) {
|
679
|
+
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
680
|
+
if (key) {
|
681
|
+
defineKeyPropWarningGetter(props, displayName);
|
682
|
+
}
|
683
|
+
if (ref) {
|
684
|
+
defineRefPropWarningGetter(props, displayName);
|
685
|
+
}
|
686
|
+
}
|
687
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
688
|
+
}
|
529
689
|
}
|
530
|
-
|
531
|
-
|
532
|
-
{
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
690
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
691
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
692
|
+
function setCurrentlyValidatingElement$1(element) {
|
693
|
+
{
|
694
|
+
if (element) {
|
695
|
+
var owner = element._owner;
|
696
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
697
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
698
|
+
} else {
|
699
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
539
700
|
}
|
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 h = m.call(e), f; !(f = h.next()).done; )
|
546
|
-
Le(f.value) && Ye(f.value, r);
|
547
701
|
}
|
548
702
|
}
|
549
|
-
|
550
|
-
function gt(e) {
|
703
|
+
var propTypesMisspellWarningShown;
|
551
704
|
{
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
s = r.propTypes;
|
558
|
-
else if (typeof r == "object" && (r.$$typeof === o || // Note: Memo only checks outer props here.
|
559
|
-
// Inner props are checked in the reconciler.
|
560
|
-
r.$$typeof === C))
|
561
|
-
s = r.propTypes;
|
562
|
-
else
|
563
|
-
return;
|
564
|
-
if (s) {
|
565
|
-
var l = I(r);
|
566
|
-
Ke(s, e.props, "prop", l, e);
|
567
|
-
} else if (r.PropTypes !== void 0 && !be) {
|
568
|
-
be = !0;
|
569
|
-
var m = I(r);
|
570
|
-
p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
|
705
|
+
propTypesMisspellWarningShown = false;
|
706
|
+
}
|
707
|
+
function isValidElement(object) {
|
708
|
+
{
|
709
|
+
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
571
710
|
}
|
572
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
573
711
|
}
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
break;
|
712
|
+
function getDeclarationErrorAddendum() {
|
713
|
+
{
|
714
|
+
if (ReactCurrentOwner$1.current) {
|
715
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
716
|
+
if (name) {
|
717
|
+
return "\n\nCheck the render method of `" + name + "`.";
|
718
|
+
}
|
582
719
|
}
|
720
|
+
return "";
|
583
721
|
}
|
584
|
-
e.ref !== null && (re(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), re(null));
|
585
722
|
}
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
var D = dt(m);
|
595
|
-
D ? u += D : u += ze();
|
596
|
-
var v;
|
597
|
-
e === null ? v = "null" : we(e) ? v = "array" : e !== void 0 && e.$$typeof === n ? (v = "<" + (I(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, u);
|
723
|
+
function getSourceInfoErrorAddendum(source) {
|
724
|
+
{
|
725
|
+
if (source !== void 0) {
|
726
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
727
|
+
var lineNumber = source.lineNumber;
|
728
|
+
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
729
|
+
}
|
730
|
+
return "";
|
598
731
|
}
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
var
|
604
|
-
if (
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
p("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
|
-
Fe(R, e);
|
732
|
+
}
|
733
|
+
var ownerHasKeyUseWarning = {};
|
734
|
+
function getCurrentComponentErrorInfo(parentType) {
|
735
|
+
{
|
736
|
+
var info = getDeclarationErrorAddendum();
|
737
|
+
if (!info) {
|
738
|
+
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
739
|
+
if (parentName) {
|
740
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
741
|
+
}
|
742
|
+
}
|
743
|
+
return info;
|
614
744
|
}
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
let props = %s;
|
626
|
-
<%s key={someKey} {...props} />`, Se, V, jt, V), _e[V + Se] = !0;
|
745
|
+
}
|
746
|
+
function validateExplicitKey(element, parentType) {
|
747
|
+
{
|
748
|
+
if (!element._store || element._store.validated || element.key != null) {
|
749
|
+
return;
|
750
|
+
}
|
751
|
+
element._store.validated = true;
|
752
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
753
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
754
|
+
return;
|
627
755
|
}
|
756
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
757
|
+
var childOwner = "";
|
758
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
759
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
760
|
+
}
|
761
|
+
setCurrentlyValidatingElement$1(element);
|
762
|
+
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
763
|
+
setCurrentlyValidatingElement$1(null);
|
628
764
|
}
|
629
|
-
return e === c ? yt(b) : gt(b), b;
|
630
765
|
}
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
766
|
+
function validateChildKeys(node, parentType) {
|
767
|
+
{
|
768
|
+
if (typeof node !== "object") {
|
769
|
+
return;
|
770
|
+
}
|
771
|
+
if (isArray(node)) {
|
772
|
+
for (var i = 0; i < node.length; i++) {
|
773
|
+
var child = node[i];
|
774
|
+
if (isValidElement(child)) {
|
775
|
+
validateExplicitKey(child, parentType);
|
776
|
+
}
|
777
|
+
}
|
778
|
+
} else if (isValidElement(node)) {
|
779
|
+
if (node._store) {
|
780
|
+
node._store.validated = true;
|
781
|
+
}
|
782
|
+
} else if (node) {
|
783
|
+
var iteratorFn = getIteratorFn(node);
|
784
|
+
if (typeof iteratorFn === "function") {
|
785
|
+
if (iteratorFn !== node.entries) {
|
786
|
+
var iterator = iteratorFn.call(node);
|
787
|
+
var step;
|
788
|
+
while (!(step = iterator.next()).done) {
|
789
|
+
if (isValidElement(step.value)) {
|
790
|
+
validateExplicitKey(step.value, parentType);
|
791
|
+
}
|
792
|
+
}
|
793
|
+
}
|
794
|
+
}
|
795
|
+
}
|
796
|
+
}
|
797
|
+
}
|
798
|
+
function validatePropTypes(element) {
|
799
|
+
{
|
800
|
+
var type = element.type;
|
801
|
+
if (type === null || type === void 0 || typeof type === "string") {
|
802
|
+
return;
|
803
|
+
}
|
804
|
+
var propTypes;
|
805
|
+
if (typeof type === "function") {
|
806
|
+
propTypes = type.propTypes;
|
807
|
+
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
808
|
+
// Inner props are checked in the reconciler.
|
809
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
810
|
+
propTypes = type.propTypes;
|
811
|
+
} else {
|
812
|
+
return;
|
813
|
+
}
|
814
|
+
if (propTypes) {
|
815
|
+
var name = getComponentNameFromType(type);
|
816
|
+
checkPropTypes(propTypes, element.props, "prop", name, element);
|
817
|
+
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
818
|
+
propTypesMisspellWarningShown = true;
|
819
|
+
var _name = getComponentNameFromType(type);
|
820
|
+
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
821
|
+
}
|
822
|
+
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
823
|
+
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
824
|
+
}
|
825
|
+
}
|
826
|
+
}
|
827
|
+
function validateFragmentProps(fragment) {
|
828
|
+
{
|
829
|
+
var keys = Object.keys(fragment.props);
|
830
|
+
for (var i = 0; i < keys.length; i++) {
|
831
|
+
var key = keys[i];
|
832
|
+
if (key !== "children" && key !== "key") {
|
833
|
+
setCurrentlyValidatingElement$1(fragment);
|
834
|
+
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
835
|
+
setCurrentlyValidatingElement$1(null);
|
836
|
+
break;
|
837
|
+
}
|
838
|
+
}
|
839
|
+
if (fragment.ref !== null) {
|
840
|
+
setCurrentlyValidatingElement$1(fragment);
|
841
|
+
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
842
|
+
setCurrentlyValidatingElement$1(null);
|
843
|
+
}
|
844
|
+
}
|
845
|
+
}
|
846
|
+
var didWarnAboutKeySpread = {};
|
847
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
848
|
+
{
|
849
|
+
var validType = isValidElementType(type);
|
850
|
+
if (!validType) {
|
851
|
+
var info = "";
|
852
|
+
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
853
|
+
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
854
|
+
}
|
855
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
856
|
+
if (sourceInfo) {
|
857
|
+
info += sourceInfo;
|
858
|
+
} else {
|
859
|
+
info += getDeclarationErrorAddendum();
|
860
|
+
}
|
861
|
+
var typeString;
|
862
|
+
if (type === null) {
|
863
|
+
typeString = "null";
|
864
|
+
} else if (isArray(type)) {
|
865
|
+
typeString = "array";
|
866
|
+
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
867
|
+
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
868
|
+
info = " Did you accidentally export a JSX literal instead of a component?";
|
869
|
+
} else {
|
870
|
+
typeString = typeof type;
|
871
|
+
}
|
872
|
+
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
873
|
+
}
|
874
|
+
var element = jsxDEV(type, props, key, source, self);
|
875
|
+
if (element == null) {
|
876
|
+
return element;
|
877
|
+
}
|
878
|
+
if (validType) {
|
879
|
+
var children = props.children;
|
880
|
+
if (children !== void 0) {
|
881
|
+
if (isStaticChildren) {
|
882
|
+
if (isArray(children)) {
|
883
|
+
for (var i = 0; i < children.length; i++) {
|
884
|
+
validateChildKeys(children[i], type);
|
885
|
+
}
|
886
|
+
if (Object.freeze) {
|
887
|
+
Object.freeze(children);
|
888
|
+
}
|
889
|
+
} else {
|
890
|
+
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
891
|
+
}
|
892
|
+
} else {
|
893
|
+
validateChildKeys(children, type);
|
894
|
+
}
|
895
|
+
}
|
896
|
+
}
|
897
|
+
{
|
898
|
+
if (hasOwnProperty.call(props, "key")) {
|
899
|
+
var componentName = getComponentNameFromType(type);
|
900
|
+
var keys = Object.keys(props).filter(function(k) {
|
901
|
+
return k !== "key";
|
902
|
+
});
|
903
|
+
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
904
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
905
|
+
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
906
|
+
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
907
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
908
|
+
}
|
909
|
+
}
|
910
|
+
}
|
911
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
912
|
+
validateFragmentProps(element);
|
913
|
+
} else {
|
914
|
+
validatePropTypes(element);
|
915
|
+
}
|
916
|
+
return element;
|
917
|
+
}
|
918
|
+
}
|
919
|
+
function jsxWithValidationStatic(type, props, key) {
|
920
|
+
{
|
921
|
+
return jsxWithValidation(type, props, key, true);
|
922
|
+
}
|
923
|
+
}
|
924
|
+
function jsxWithValidationDynamic(type, props, key) {
|
925
|
+
{
|
926
|
+
return jsxWithValidation(type, props, key, false);
|
927
|
+
}
|
928
|
+
}
|
929
|
+
var jsx = jsxWithValidationDynamic;
|
930
|
+
var jsxs = jsxWithValidationStatic;
|
931
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
932
|
+
reactJsxRuntime_development.jsx = jsx;
|
933
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
934
|
+
})();
|
935
|
+
}
|
936
|
+
return reactJsxRuntime_development;
|
641
937
|
}
|
642
|
-
process.env.NODE_ENV === "production"
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
938
|
+
if (process.env.NODE_ENV === "production") {
|
939
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
940
|
+
} else {
|
941
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
942
|
+
}
|
943
|
+
var jsxRuntimeExports = jsxRuntime.exports;
|
944
|
+
const ThemeContext = createContext();
|
945
|
+
const useTheme = () => useContext(ThemeContext);
|
946
|
+
const ThemeProvider = ({ initialTheme = "light", children }) => {
|
947
|
+
const [theme, setTheme] = useState(initialTheme);
|
948
|
+
const toggleTheme = () => {
|
949
|
+
setTheme((prevTheme) => prevTheme === "light" ? "dark" : "light");
|
647
950
|
};
|
648
|
-
|
649
|
-
document.documentElement.classList.remove("light", "dark")
|
650
|
-
|
951
|
+
useEffect(() => {
|
952
|
+
document.documentElement.classList.remove("light", "dark");
|
953
|
+
document.documentElement.classList.add(theme);
|
954
|
+
}, [theme]);
|
955
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeContext.Provider, { value: { theme, setTheme, toggleTheme }, children });
|
651
956
|
};
|
652
|
-
let
|
957
|
+
let apiConfig = {
|
653
958
|
apiKey: null,
|
654
959
|
apiSecret: null,
|
655
960
|
apiUrl: "https://coinleyserver-production.up.railway.app"
|
656
961
|
};
|
657
|
-
const
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
962
|
+
const initializeApi = (config) => {
|
963
|
+
apiConfig = { ...apiConfig, ...config };
|
964
|
+
console.log("API initialized with:", apiConfig);
|
965
|
+
};
|
966
|
+
const getHeaders = () => {
|
967
|
+
return {
|
968
|
+
"Content-Type": "application/json",
|
969
|
+
"x-api-key": apiConfig.apiKey,
|
970
|
+
"x-api-secret": apiConfig.apiSecret
|
971
|
+
};
|
972
|
+
};
|
973
|
+
const createPayment = async (paymentData) => {
|
664
974
|
try {
|
665
|
-
console.log("Creating payment with data:",
|
666
|
-
|
975
|
+
console.log("Creating payment with data:", paymentData);
|
976
|
+
console.log("API URL:", `${apiConfig.apiUrl}/api/payments/create`);
|
977
|
+
const response = await fetch(`${apiConfig.apiUrl}/api/payments/create`, {
|
667
978
|
method: "POST",
|
668
|
-
headers:
|
669
|
-
body: JSON.stringify(
|
979
|
+
headers: getHeaders(),
|
980
|
+
body: JSON.stringify(paymentData)
|
670
981
|
});
|
671
|
-
|
672
|
-
|
673
|
-
|
982
|
+
console.log("Create payment response status:", response.status);
|
983
|
+
if (!response.ok) {
|
984
|
+
const errorData = await response.json();
|
985
|
+
console.error("Error creating payment:", errorData);
|
986
|
+
throw new Error(errorData.error || `Failed to create payment: ${response.status}`);
|
674
987
|
}
|
675
|
-
const
|
676
|
-
|
677
|
-
|
678
|
-
|
988
|
+
const data = await response.json();
|
989
|
+
console.log("Create payment response data:", data);
|
990
|
+
return data;
|
991
|
+
} catch (error) {
|
992
|
+
console.error("Create payment error:", error);
|
993
|
+
throw error;
|
679
994
|
}
|
680
|
-
}
|
995
|
+
};
|
996
|
+
const getPayment = async (paymentId) => {
|
681
997
|
try {
|
682
|
-
console.log("Getting payment:",
|
683
|
-
const
|
998
|
+
console.log("Getting payment:", paymentId);
|
999
|
+
const response = await fetch(`${apiConfig.apiUrl}/api/payments/${paymentId}`, {
|
684
1000
|
method: "GET",
|
685
|
-
headers:
|
1001
|
+
headers: getHeaders()
|
686
1002
|
});
|
687
|
-
if (!
|
688
|
-
const
|
689
|
-
|
1003
|
+
if (!response.ok) {
|
1004
|
+
const errorData = await response.json();
|
1005
|
+
console.error("Error getting payment:", errorData);
|
1006
|
+
throw new Error(errorData.error || `Failed to get payment: ${response.status}`);
|
690
1007
|
}
|
691
|
-
const
|
692
|
-
|
693
|
-
|
694
|
-
|
1008
|
+
const data = await response.json();
|
1009
|
+
console.log("Get payment response:", data);
|
1010
|
+
return data;
|
1011
|
+
} catch (error) {
|
1012
|
+
console.error("Get payment error:", error);
|
1013
|
+
throw error;
|
695
1014
|
}
|
696
|
-
}
|
1015
|
+
};
|
1016
|
+
const processPayment = async (processData) => {
|
697
1017
|
try {
|
698
|
-
console.log("Processing payment with data:",
|
699
|
-
|
1018
|
+
console.log("Processing payment with data:", processData);
|
1019
|
+
console.log("API URL:", `${apiConfig.apiUrl}/api/payments/process`);
|
1020
|
+
const response = await fetch(`${apiConfig.apiUrl}/api/payments/process`, {
|
700
1021
|
method: "POST",
|
701
|
-
headers:
|
702
|
-
body: JSON.stringify(
|
1022
|
+
headers: getHeaders(),
|
1023
|
+
body: JSON.stringify(processData)
|
703
1024
|
});
|
704
|
-
|
705
|
-
|
706
|
-
|
1025
|
+
console.log("Process payment response status:", response.status);
|
1026
|
+
if (!response.ok) {
|
1027
|
+
const errorData = await response.json();
|
1028
|
+
console.error("Error processing payment:", errorData);
|
1029
|
+
throw new Error(errorData.error || `Failed to process payment: ${response.status}`);
|
707
1030
|
}
|
708
|
-
const
|
709
|
-
|
710
|
-
|
711
|
-
|
1031
|
+
const data = await response.json();
|
1032
|
+
console.log("Process payment response data:", data);
|
1033
|
+
return data;
|
1034
|
+
} catch (error) {
|
1035
|
+
console.error("Process payment error:", error);
|
1036
|
+
throw error;
|
712
1037
|
}
|
713
|
-
}
|
1038
|
+
};
|
1039
|
+
const getMerchantPayments = async (options = {}) => {
|
714
1040
|
try {
|
715
|
-
const { page
|
716
|
-
|
717
|
-
|
1041
|
+
const { page = 1, limit = 10, status, currency, startDate, endDate, search } = options;
|
1042
|
+
const queryParams = new URLSearchParams();
|
1043
|
+
queryParams.append("page", page);
|
1044
|
+
queryParams.append("limit", limit);
|
1045
|
+
if (status)
|
1046
|
+
queryParams.append("status", status);
|
1047
|
+
if (currency)
|
1048
|
+
queryParams.append("currency", currency);
|
1049
|
+
if (startDate)
|
1050
|
+
queryParams.append("startDate", startDate);
|
1051
|
+
if (endDate)
|
1052
|
+
queryParams.append("endDate", endDate);
|
1053
|
+
if (search)
|
1054
|
+
queryParams.append("search", search);
|
1055
|
+
const url = `${apiConfig.apiUrl}/api/payments/merchant/list?${queryParams.toString()}`;
|
1056
|
+
const response = await fetch(url, {
|
718
1057
|
method: "GET",
|
719
|
-
headers:
|
1058
|
+
headers: getHeaders()
|
720
1059
|
});
|
721
|
-
if (!
|
722
|
-
const
|
723
|
-
throw new Error(
|
1060
|
+
if (!response.ok) {
|
1061
|
+
const errorData = await response.json();
|
1062
|
+
throw new Error(errorData.error || `Failed to get payments: ${response.status}`);
|
724
1063
|
}
|
725
|
-
return await
|
726
|
-
} catch (
|
727
|
-
|
1064
|
+
return await response.json();
|
1065
|
+
} catch (error) {
|
1066
|
+
console.error("Get merchant payments error:", error);
|
1067
|
+
throw error;
|
728
1068
|
}
|
729
|
-
}
|
1069
|
+
};
|
1070
|
+
const getMerchantPaymentStats = async () => {
|
730
1071
|
try {
|
731
|
-
const
|
1072
|
+
const response = await fetch(`${apiConfig.apiUrl}/api/payments/merchant/stats`, {
|
732
1073
|
method: "GET",
|
733
|
-
headers:
|
1074
|
+
headers: getHeaders()
|
734
1075
|
});
|
735
|
-
if (!
|
736
|
-
const
|
737
|
-
throw new Error(
|
1076
|
+
if (!response.ok) {
|
1077
|
+
const errorData = await response.json();
|
1078
|
+
throw new Error(errorData.error || `Failed to get payment stats: ${response.status}`);
|
738
1079
|
}
|
739
|
-
return await
|
740
|
-
} catch (
|
741
|
-
|
1080
|
+
return await response.json();
|
1081
|
+
} catch (error) {
|
1082
|
+
console.error("Get merchant payment stats error:", error);
|
1083
|
+
throw error;
|
742
1084
|
}
|
743
|
-
}
|
1085
|
+
};
|
1086
|
+
const getSupportedCurrencies = async () => {
|
744
1087
|
try {
|
745
|
-
const
|
1088
|
+
const response = await fetch(`${apiConfig.apiUrl}/api/payments/currencies`, {
|
746
1089
|
method: "GET",
|
747
|
-
headers:
|
1090
|
+
headers: getHeaders()
|
748
1091
|
});
|
749
|
-
if (!
|
750
|
-
const
|
751
|
-
throw new Error(
|
1092
|
+
if (!response.ok) {
|
1093
|
+
const errorData = await response.json();
|
1094
|
+
throw new Error(errorData.error || `Failed to get currencies: ${response.status}`);
|
752
1095
|
}
|
753
|
-
return await
|
754
|
-
} catch (
|
755
|
-
|
1096
|
+
return await response.json();
|
1097
|
+
} catch (error) {
|
1098
|
+
console.error("Get supported currencies error:", error);
|
1099
|
+
return {
|
756
1100
|
currencies: [
|
757
1101
|
{ id: "USDT", name: "Tether USD", network: "ethereum" },
|
758
1102
|
{ id: "USDC", name: "USD Coin", network: "ethereum" },
|
@@ -762,56 +1106,272 @@ const Ct = (a) => {
|
|
762
1106
|
]
|
763
1107
|
};
|
764
1108
|
}
|
765
|
-
}
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
1109
|
+
};
|
1110
|
+
const CoinleyContext = createContext();
|
1111
|
+
const useCoinley = () => useContext(CoinleyContext);
|
1112
|
+
const CoinleyProvider = ({
|
1113
|
+
apiKey,
|
1114
|
+
apiSecret,
|
1115
|
+
apiUrl = "https://coinleyserver-production.up.railway.app",
|
1116
|
+
debug = false,
|
1117
|
+
children
|
771
1118
|
}) => {
|
772
|
-
const [
|
773
|
-
|
774
|
-
|
775
|
-
|
1119
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
1120
|
+
const [error, setError] = useState(null);
|
1121
|
+
useEffect(() => {
|
1122
|
+
if (!apiKey || !apiSecret) {
|
1123
|
+
setError("API key and secret are required");
|
776
1124
|
return;
|
777
1125
|
}
|
778
1126
|
try {
|
779
|
-
|
780
|
-
|
781
|
-
|
1127
|
+
initializeApi({ apiKey, apiSecret, apiUrl });
|
1128
|
+
setIsInitialized(true);
|
1129
|
+
if (debug) {
|
1130
|
+
console.log("Coinley SDK initialized with:", { apiKey, apiUrl });
|
1131
|
+
}
|
1132
|
+
} catch (err) {
|
1133
|
+
setError(err.message);
|
1134
|
+
if (debug) {
|
1135
|
+
console.error("Coinley SDK initialization error:", err);
|
1136
|
+
}
|
782
1137
|
}
|
783
|
-
}, [
|
784
|
-
const
|
785
|
-
apiKey
|
786
|
-
apiSecret
|
787
|
-
apiUrl
|
788
|
-
isInitialized
|
789
|
-
error
|
790
|
-
debug
|
1138
|
+
}, [apiKey, apiSecret, apiUrl, debug]);
|
1139
|
+
const value = {
|
1140
|
+
apiKey,
|
1141
|
+
apiSecret,
|
1142
|
+
apiUrl,
|
1143
|
+
isInitialized,
|
1144
|
+
error,
|
1145
|
+
debug
|
791
1146
|
};
|
792
|
-
return /* @__PURE__ */
|
793
|
-
}
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
1147
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CoinleyContext.Provider, { value, children });
|
1148
|
+
};
|
1149
|
+
const isMetaMaskInstalled = () => {
|
1150
|
+
return typeof window !== "undefined" && typeof window.ethereum !== "undefined";
|
1151
|
+
};
|
1152
|
+
const connectWallet = async () => {
|
1153
|
+
if (!isMetaMaskInstalled()) {
|
1154
|
+
throw new Error("MetaMask is not installed");
|
1155
|
+
}
|
1156
|
+
try {
|
1157
|
+
const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
|
1158
|
+
return accounts;
|
1159
|
+
} catch (error) {
|
1160
|
+
console.error("Error connecting to wallet:", error);
|
1161
|
+
throw error;
|
1162
|
+
}
|
1163
|
+
};
|
1164
|
+
const getAccounts = async () => {
|
1165
|
+
if (!isMetaMaskInstalled()) {
|
1166
|
+
throw new Error("MetaMask is not installed");
|
1167
|
+
}
|
1168
|
+
try {
|
1169
|
+
const accounts = await window.ethereum.request({ method: "eth_accounts" });
|
1170
|
+
return accounts;
|
1171
|
+
} catch (error) {
|
1172
|
+
console.error("Error getting accounts:", error);
|
1173
|
+
throw error;
|
1174
|
+
}
|
1175
|
+
};
|
1176
|
+
const getChainId = async () => {
|
1177
|
+
if (!isMetaMaskInstalled()) {
|
1178
|
+
throw new Error("MetaMask is not installed");
|
1179
|
+
}
|
1180
|
+
try {
|
1181
|
+
const chainId = await window.ethereum.request({ method: "eth_chainId" });
|
1182
|
+
return chainId;
|
1183
|
+
} catch (error) {
|
1184
|
+
console.error("Error getting chain ID:", error);
|
1185
|
+
throw error;
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
const sendTransaction = async (txParams) => {
|
1189
|
+
if (!isMetaMaskInstalled()) {
|
1190
|
+
throw new Error("MetaMask is not installed");
|
1191
|
+
}
|
1192
|
+
try {
|
1193
|
+
const txHash = await window.ethereum.request({
|
1194
|
+
method: "eth_sendTransaction",
|
1195
|
+
params: [txParams]
|
1196
|
+
});
|
1197
|
+
return txHash;
|
1198
|
+
} catch (error) {
|
1199
|
+
console.error("Error sending transaction:", error);
|
1200
|
+
throw error;
|
1201
|
+
}
|
1202
|
+
};
|
1203
|
+
const sendToken = async (tokenAddress, toAddress, amount) => {
|
1204
|
+
if (!isMetaMaskInstalled()) {
|
1205
|
+
throw new Error("MetaMask is not installed");
|
1206
|
+
}
|
1207
|
+
try {
|
1208
|
+
const accounts = await window.ethereum.request({ method: "eth_requestAccounts" });
|
1209
|
+
const fromAddress = accounts[0];
|
1210
|
+
const transferFunctionSignature = "0xa9059cbb";
|
1211
|
+
const paddedToAddress = toAddress.slice(2).padStart(64, "0");
|
1212
|
+
const paddedAmount = amount.toString(16).padStart(64, "0");
|
1213
|
+
const data = `${transferFunctionSignature}${paddedToAddress}${paddedAmount}`;
|
1214
|
+
const txParams = {
|
1215
|
+
from: fromAddress,
|
1216
|
+
to: tokenAddress,
|
1217
|
+
data
|
1218
|
+
};
|
1219
|
+
const txHash = await window.ethereum.request({
|
1220
|
+
method: "eth_sendTransaction",
|
1221
|
+
params: [txParams]
|
1222
|
+
});
|
1223
|
+
return txHash;
|
1224
|
+
} catch (error) {
|
1225
|
+
console.error("Error sending token:", error);
|
1226
|
+
throw error;
|
1227
|
+
}
|
1228
|
+
};
|
1229
|
+
const isWalletConnected = async () => {
|
1230
|
+
try {
|
1231
|
+
const accounts = await getAccounts();
|
1232
|
+
return accounts.length > 0;
|
1233
|
+
} catch (error) {
|
1234
|
+
return false;
|
1235
|
+
}
|
1236
|
+
};
|
1237
|
+
const getNetworkName = (chainId) => {
|
1238
|
+
const networks = {
|
1239
|
+
"0x1": "Ethereum Mainnet",
|
1240
|
+
"0x3": "Ropsten Testnet",
|
1241
|
+
"0x4": "Rinkeby Testnet",
|
1242
|
+
"0x5": "Goerli Testnet",
|
1243
|
+
"0x2a": "Kovan Testnet",
|
1244
|
+
"0x38": "Binance Smart Chain",
|
1245
|
+
"0x89": "Polygon",
|
1246
|
+
"0xa86a": "Avalanche"
|
1247
|
+
};
|
1248
|
+
return networks[chainId] || `Unknown Network (${chainId})`;
|
1249
|
+
};
|
1250
|
+
const getTokenBalance = async (tokenAddress, userAddress) => {
|
1251
|
+
if (!isMetaMaskInstalled()) {
|
1252
|
+
throw new Error("MetaMask is not installed");
|
1253
|
+
}
|
1254
|
+
try {
|
1255
|
+
const balanceOfSignature = "0x70a08231";
|
1256
|
+
const paddedAddress = userAddress.slice(2).padStart(64, "0");
|
1257
|
+
const data = `${balanceOfSignature}${paddedAddress}`;
|
1258
|
+
const balance = await window.ethereum.request({
|
1259
|
+
method: "eth_call",
|
1260
|
+
params: [
|
1261
|
+
{
|
1262
|
+
to: tokenAddress,
|
1263
|
+
data
|
1264
|
+
},
|
1265
|
+
"latest"
|
1266
|
+
]
|
1267
|
+
});
|
1268
|
+
return parseInt(balance, 16).toString();
|
1269
|
+
} catch (error) {
|
1270
|
+
console.error("Error getting token balance:", error);
|
1271
|
+
throw error;
|
1272
|
+
}
|
1273
|
+
};
|
1274
|
+
const TOKEN_ADDRESSES = {
|
1275
|
+
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1276
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
1277
|
+
DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
1278
|
+
WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
1279
|
+
WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
|
1280
|
+
};
|
1281
|
+
const QRCode$1 = ({ walletAddress, amount, currency, theme = "light" }) => {
|
1282
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center", children: [
|
1283
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-white"} mb-3`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { width: "200px", height: "200px", backgroundColor: "#f0f0f0", display: "flex", alignItems: "center", justifyContent: "center" }, children: [
|
1284
|
+
"QR Code: ",
|
1285
|
+
currency
|
1286
|
+
] }) }),
|
1287
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-sm", children: "Scan with your wallet app to pay" }),
|
1288
|
+
walletAddress && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-3 w-full", children: [
|
1289
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs mb-1", children: [
|
1290
|
+
"Send ",
|
1291
|
+
amount,
|
1292
|
+
" ",
|
1293
|
+
currency,
|
1294
|
+
" to:"
|
1295
|
+
] }),
|
1296
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs font-mono p-2 rounded overflow-auto break-all bg-gray-100", children: walletAddress })
|
1297
|
+
] })
|
1298
|
+
] });
|
1299
|
+
};
|
1300
|
+
const QRCode$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
810
1301
|
__proto__: null,
|
811
|
-
default:
|
812
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
813
|
-
|
814
|
-
|
1302
|
+
default: QRCode$1
|
1303
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
1304
|
+
const PaymentStatus = ({ status, theme = "light", message }) => {
|
1305
|
+
console.log("PaymentStatus render:", { status, message });
|
1306
|
+
const renderIcon = () => {
|
1307
|
+
switch (status) {
|
1308
|
+
case "processing":
|
1309
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
|
1310
|
+
case "success":
|
1311
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1312
|
+
"svg",
|
1313
|
+
{
|
1314
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1315
|
+
className: "h-8 w-8 text-green-500",
|
1316
|
+
fill: "none",
|
1317
|
+
viewBox: "0 0 24 24",
|
1318
|
+
stroke: "currentColor",
|
1319
|
+
strokeWidth: 2,
|
1320
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
1321
|
+
}
|
1322
|
+
) });
|
1323
|
+
case "error":
|
1324
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1325
|
+
"svg",
|
1326
|
+
{
|
1327
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1328
|
+
className: "h-8 w-8 text-red-500",
|
1329
|
+
fill: "none",
|
1330
|
+
viewBox: "0 0 24 24",
|
1331
|
+
stroke: "currentColor",
|
1332
|
+
strokeWidth: 2,
|
1333
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
1334
|
+
}
|
1335
|
+
) });
|
1336
|
+
default:
|
1337
|
+
return null;
|
1338
|
+
}
|
1339
|
+
};
|
1340
|
+
const getStatusTitle = () => {
|
1341
|
+
switch (status) {
|
1342
|
+
case "processing":
|
1343
|
+
return "Processing Payment";
|
1344
|
+
case "success":
|
1345
|
+
return "Payment Successful";
|
1346
|
+
case "error":
|
1347
|
+
return "Payment Failed";
|
1348
|
+
default:
|
1349
|
+
return "Unknown Status";
|
1350
|
+
}
|
1351
|
+
};
|
1352
|
+
const getMessageClasses = () => {
|
1353
|
+
switch (status) {
|
1354
|
+
case "processing":
|
1355
|
+
return theme === "dark" ? "text-blue-300" : "text-blue-600";
|
1356
|
+
case "success":
|
1357
|
+
return theme === "dark" ? "text-green-300" : "text-green-600";
|
1358
|
+
case "error":
|
1359
|
+
return theme === "dark" ? "text-red-300" : "text-red-600";
|
1360
|
+
default:
|
1361
|
+
return theme === "dark" ? "text-gray-300" : "text-gray-600";
|
1362
|
+
}
|
1363
|
+
};
|
1364
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
1365
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
|
1366
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
|
1367
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
|
1368
|
+
status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
|
1369
|
+
status === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
|
1370
|
+
] });
|
1371
|
+
};
|
1372
|
+
const PaymentMethods = ({ onSelect, selected, theme = "light" }) => {
|
1373
|
+
console.log("PaymentMethods render:", { selected });
|
1374
|
+
const paymentMethods = [
|
815
1375
|
{
|
816
1376
|
id: "USDT",
|
817
1377
|
name: "USDT",
|
@@ -842,30 +1402,32 @@ const Ct = (a) => {
|
|
842
1402
|
description: "USD Coin on Solana",
|
843
1403
|
logo: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="
|
844
1404
|
}
|
845
|
-
]
|
846
|
-
|
1405
|
+
];
|
1406
|
+
const handleSelectPaymentMethod = (id) => {
|
1407
|
+
console.log("Method selected:", id);
|
1408
|
+
onSelect(id);
|
847
1409
|
};
|
848
|
-
return /* @__PURE__ */
|
849
|
-
/* @__PURE__ */
|
850
|
-
/* @__PURE__ */
|
1410
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-3 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
|
1412
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: paymentMethods.map((method) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
851
1413
|
"button",
|
852
1414
|
{
|
853
|
-
onClick: () =>
|
854
|
-
className: `w-full flex items-center p-3 rounded-lg transition-colors ${
|
1415
|
+
onClick: () => handleSelectPaymentMethod(method.id),
|
1416
|
+
className: `w-full flex items-center p-3 rounded-lg transition-colors ${selected === method.id ? theme === "dark" ? "bg-blue-900/30 border border-blue-500" : "bg-blue-50 border border-blue-500" : theme === "dark" ? "bg-gray-700 hover:bg-gray-600 border border-gray-700" : "bg-white hover:bg-gray-50 border border-gray-200"}`,
|
855
1417
|
children: [
|
856
|
-
/* @__PURE__ */
|
857
|
-
/* @__PURE__ */
|
858
|
-
/* @__PURE__ */
|
859
|
-
/* @__PURE__ */
|
1418
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-6 w-6" }) }),
|
1419
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 text-left", children: [
|
1420
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: method.name }),
|
1421
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-500"}`, children: method.description })
|
860
1422
|
] }),
|
861
|
-
|
1423
|
+
selected === method.id && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
862
1424
|
"svg",
|
863
1425
|
{
|
864
1426
|
xmlns: "http://www.w3.org/2000/svg",
|
865
1427
|
className: "h-5 w-5 text-blue-500",
|
866
1428
|
viewBox: "0 0 20 20",
|
867
1429
|
fill: "currentColor",
|
868
|
-
children: /* @__PURE__ */
|
1430
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
869
1431
|
"path",
|
870
1432
|
{
|
871
1433
|
fillRule: "evenodd",
|
@@ -877,297 +1439,185 @@ const Ct = (a) => {
|
|
877
1439
|
)
|
878
1440
|
]
|
879
1441
|
},
|
880
|
-
|
1442
|
+
method.id
|
881
1443
|
)) })
|
882
1444
|
] });
|
883
|
-
}
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
fill: "none",
|
909
|
-
viewBox: "0 0 24 24",
|
910
|
-
stroke: "currentColor",
|
911
|
-
strokeWidth: 2,
|
912
|
-
children: /* @__PURE__ */ t.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
913
|
-
}
|
914
|
-
) });
|
915
|
-
default:
|
916
|
-
return null;
|
1445
|
+
};
|
1446
|
+
const Logo = "data:image/png;base64,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";
|
1447
|
+
const QRCode = lazy(() => Promise.resolve().then(() => QRCode$2));
|
1448
|
+
const CoinleyModal = ({
|
1449
|
+
isOpen,
|
1450
|
+
onClose,
|
1451
|
+
payment,
|
1452
|
+
paymentStatus,
|
1453
|
+
selectedCurrency,
|
1454
|
+
onCurrencySelect,
|
1455
|
+
onPayment,
|
1456
|
+
error,
|
1457
|
+
theme = "light",
|
1458
|
+
merchantName,
|
1459
|
+
transactionHash,
|
1460
|
+
walletConnected,
|
1461
|
+
onConnectWallet,
|
1462
|
+
testMode = false
|
1463
|
+
}) => {
|
1464
|
+
const [step, setStep] = useState("select-currency");
|
1465
|
+
const [isMetaMaskAvailable, setIsMetaMaskAvailable] = useState(false);
|
1466
|
+
const [paymentMethod, setPaymentMethod] = useState("wallet");
|
1467
|
+
useEffect(() => {
|
1468
|
+
if (typeof window !== "undefined") {
|
1469
|
+
setIsMetaMaskAvailable(isMetaMaskInstalled());
|
917
1470
|
}
|
918
|
-
},
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
1471
|
+
}, []);
|
1472
|
+
useEffect(() => {
|
1473
|
+
if (paymentStatus === "loading") {
|
1474
|
+
setStep("processing");
|
1475
|
+
} else if (paymentStatus === "success") {
|
1476
|
+
setStep("success");
|
1477
|
+
} else if (paymentStatus === "error") {
|
1478
|
+
setStep("error");
|
1479
|
+
} else if (paymentStatus === "idle" && payment) {
|
1480
|
+
setStep("select-currency");
|
928
1481
|
}
|
929
|
-
},
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1482
|
+
}, [paymentStatus, payment]);
|
1483
|
+
const handleCurrencySelect = (currency) => {
|
1484
|
+
onCurrencySelect(currency);
|
1485
|
+
setStep("confirm");
|
1486
|
+
};
|
1487
|
+
const handlePaymentConfirm = () => {
|
1488
|
+
onPayment(paymentMethod === "qrcode");
|
1489
|
+
};
|
1490
|
+
const handleBack = () => {
|
1491
|
+
if (step === "confirm") {
|
1492
|
+
setStep("select-currency");
|
939
1493
|
}
|
940
1494
|
};
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
return
|
953
|
-
}
|
954
|
-
|
955
|
-
|
956
|
-
}
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
}
|
964
|
-
|
965
|
-
if (!
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
}, Rt = async (a) => {
|
973
|
-
if (!G())
|
974
|
-
throw new Error("MetaMask is not installed");
|
975
|
-
try {
|
976
|
-
return await window.ethereum.request({
|
977
|
-
method: "eth_sendTransaction",
|
978
|
-
params: [a]
|
979
|
-
});
|
980
|
-
} catch (n) {
|
981
|
-
throw console.error("Error sending transaction:", n), n;
|
982
|
-
}
|
983
|
-
}, qt = async (a, n, i) => {
|
984
|
-
if (!G())
|
985
|
-
throw new Error("MetaMask is not installed");
|
986
|
-
try {
|
987
|
-
const x = (await window.ethereum.request({ method: "eth_requestAccounts" }))[0], d = "0xa9059cbb", w = n.slice(2).padStart(64, "0"), L = i.toString(16).padStart(64, "0"), o = `${d}${w}${L}`, S = {
|
988
|
-
from: x,
|
989
|
-
to: a,
|
990
|
-
data: o
|
991
|
-
};
|
992
|
-
return await window.ethereum.request({
|
993
|
-
method: "eth_sendTransaction",
|
994
|
-
params: [S]
|
995
|
-
});
|
996
|
-
} catch (c) {
|
997
|
-
throw console.error("Error sending token:", c), c;
|
998
|
-
}
|
999
|
-
}, Vt = async () => {
|
1000
|
-
try {
|
1001
|
-
return (await Pt()).length > 0;
|
1002
|
-
} catch {
|
1003
|
-
return !1;
|
1004
|
-
}
|
1005
|
-
}, Xt = (a) => ({
|
1006
|
-
"0x1": "Ethereum Mainnet",
|
1007
|
-
"0x3": "Ropsten Testnet",
|
1008
|
-
"0x4": "Rinkeby Testnet",
|
1009
|
-
"0x5": "Goerli Testnet",
|
1010
|
-
"0x2a": "Kovan Testnet",
|
1011
|
-
"0x38": "Binance Smart Chain",
|
1012
|
-
"0x89": "Polygon",
|
1013
|
-
"0xa86a": "Avalanche"
|
1014
|
-
})[a] || `Unknown Network (${a})`, Jt = async (a, n) => {
|
1015
|
-
if (!G())
|
1016
|
-
throw new Error("MetaMask is not installed");
|
1017
|
-
try {
|
1018
|
-
const i = "0x70a08231", c = n.slice(2).padStart(64, "0"), x = `${i}${c}`, d = await window.ethereum.request({
|
1019
|
-
method: "eth_call",
|
1020
|
-
params: [
|
1021
|
-
{
|
1022
|
-
to: a,
|
1023
|
-
data: x
|
1024
|
-
},
|
1025
|
-
"latest"
|
1026
|
-
]
|
1027
|
-
});
|
1028
|
-
return parseInt(d, 16).toString();
|
1029
|
-
} catch (i) {
|
1030
|
-
throw console.error("Error getting token balance:", i), i;
|
1031
|
-
}
|
1032
|
-
}, Kt = {
|
1033
|
-
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1034
|
-
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
1035
|
-
DAI: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
|
1036
|
-
WETH: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
1037
|
-
WBTC: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
|
1038
|
-
}, zt = "data:image/png;base64,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", Ut = wt(() => Promise.resolve().then(() => Et)), Yt = ({
|
1039
|
-
isOpen: a,
|
1040
|
-
onClose: n,
|
1041
|
-
payment: i,
|
1042
|
-
paymentStatus: c,
|
1043
|
-
selectedCurrency: x,
|
1044
|
-
onCurrencySelect: d,
|
1045
|
-
onPayment: w,
|
1046
|
-
error: L,
|
1047
|
-
theme: o = "light",
|
1048
|
-
merchantName: S,
|
1049
|
-
transactionHash: M,
|
1050
|
-
walletConnected: C,
|
1051
|
-
onConnectWallet: z,
|
1052
|
-
testMode: N = !1
|
1053
|
-
}) => {
|
1054
|
-
const [U, Y] = O("select-currency"), [W, A] = O(!1), [p, se] = O("wallet");
|
1055
|
-
X(() => {
|
1056
|
-
typeof window < "u" && A(G());
|
1057
|
-
}, []), X(() => {
|
1058
|
-
c === "loading" ? Y("processing") : c === "success" ? Y("success") : c === "error" ? Y("error") : c === "idle" && i && Y("select-currency");
|
1059
|
-
}, [c, i]);
|
1060
|
-
const _ = (T) => {
|
1061
|
-
d(T), Y("confirm");
|
1062
|
-
}, $ = () => {
|
1063
|
-
w(p === "qrcode");
|
1064
|
-
}, J = () => {
|
1065
|
-
U === "confirm" && Y("select-currency");
|
1066
|
-
}, oe = () => {
|
1067
|
-
n();
|
1068
|
-
}, F = (T) => parseFloat(T).toFixed(2), K = (T) => T ? T.length <= 14 ? T : `${T.slice(0, 8)}...${T.slice(-6)}` : "", B = (T) => {
|
1069
|
-
se(T);
|
1070
|
-
}, ee = `fixed inset-0 z-50 overflow-y-auto ${o === "dark" ? "bg-gray-900/75" : "bg-black/50"}`, Q = `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"}`, I = `text-xl font-bold mb-4 ${o === "dark" ? "text-white" : "text-gray-900"}`, k = `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"}`, j = `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"}`, H = "py-2 px-4 text-sm font-medium focus:outline-none transition-colors", Z = `${o === "dark" ? "bg-gray-700 text-white" : "bg-gray-100 text-gray-800"} rounded-t-md`, q = `${o === "dark" ? "text-gray-400 hover:text-gray-300" : "text-gray-500 hover:text-gray-700"}`;
|
1071
|
-
return a ? /* @__PURE__ */ t.jsx("div", { className: ee, children: /* @__PURE__ */ t.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ t.jsxs("div", { className: Q, children: [
|
1072
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex justify-between items-center mb-6", children: [
|
1073
|
-
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center", children: [
|
1074
|
-
/* @__PURE__ */ t.jsx("img", { src: zt, alt: "Coinley Logo", className: "h-8 mr-2" }),
|
1075
|
-
/* @__PURE__ */ t.jsx("h2", { className: I, children: "Coinley Pay" })
|
1495
|
+
const handleClose = () => {
|
1496
|
+
onClose();
|
1497
|
+
};
|
1498
|
+
const formatAmount = (amount) => {
|
1499
|
+
return parseFloat(amount).toFixed(2);
|
1500
|
+
};
|
1501
|
+
const formatTransactionHash = (hash) => {
|
1502
|
+
if (!hash)
|
1503
|
+
return "";
|
1504
|
+
if (hash.length <= 14)
|
1505
|
+
return hash;
|
1506
|
+
return `${hash.slice(0, 8)}...${hash.slice(-6)}`;
|
1507
|
+
};
|
1508
|
+
const togglePaymentMethod = (method) => {
|
1509
|
+
setPaymentMethod(method);
|
1510
|
+
};
|
1511
|
+
const modalBaseClasses = `fixed inset-0 z-50 overflow-y-auto ${theme === "dark" ? "bg-gray-900/75" : "bg-black/50"}`;
|
1512
|
+
const modalContentClasses = `relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${theme === "dark" ? "bg-gray-800 text-white" : "bg-white text-gray-800"}`;
|
1513
|
+
const headerClasses = `text-xl font-bold mb-4 ${theme === "dark" ? "text-white" : "text-gray-900"}`;
|
1514
|
+
const buttonPrimaryClasses = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${theme === "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"}`;
|
1515
|
+
const buttonSecondaryClasses = `w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${theme === "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"}`;
|
1516
|
+
const tabButtonClasses = `py-2 px-4 text-sm font-medium focus:outline-none transition-colors`;
|
1517
|
+
const activeTabClasses = `${theme === "dark" ? "bg-gray-700 text-white" : "bg-gray-100 text-gray-800"} rounded-t-md`;
|
1518
|
+
const inactiveTabClasses = `${theme === "dark" ? "text-gray-400 hover:text-gray-300" : "text-gray-500 hover:text-gray-700"}`;
|
1519
|
+
if (!isOpen)
|
1520
|
+
return null;
|
1521
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: modalBaseClasses, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: modalContentClasses, children: [
|
1522
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mb-6", children: [
|
1523
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
1524
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: Logo, alt: "Coinley Logo", className: "h-8 mr-2" }),
|
1525
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: headerClasses, children: "Coinley Pay" })
|
1076
1526
|
] }),
|
1077
|
-
/* @__PURE__ */
|
1527
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1078
1528
|
"button",
|
1079
1529
|
{
|
1080
|
-
onClick:
|
1081
|
-
className: `text-gray-500 hover:text-gray-700 focus:outline-none ${
|
1082
|
-
children: /* @__PURE__ */
|
1530
|
+
onClick: handleClose,
|
1531
|
+
className: `text-gray-500 hover:text-gray-700 focus:outline-none ${theme === "dark" ? "text-gray-400 hover:text-gray-300" : ""}`,
|
1532
|
+
children: /* @__PURE__ */ jsxRuntimeExports.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__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
1083
1533
|
}
|
1084
1534
|
)
|
1085
1535
|
] }),
|
1086
|
-
/* @__PURE__ */
|
1087
|
-
|
1088
|
-
/* @__PURE__ */
|
1089
|
-
/* @__PURE__ */
|
1090
|
-
/* @__PURE__ */
|
1091
|
-
/* @__PURE__ */
|
1536
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
|
1537
|
+
payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `mb-6 p-4 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1538
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: merchantName }),
|
1539
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mt-2", children: [
|
1540
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `font-medium ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Amount:" }),
|
1541
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold text-xl", children: [
|
1092
1542
|
"$",
|
1093
|
-
|
1543
|
+
formatAmount(payment.totalAmount || payment.amount)
|
1094
1544
|
] })
|
1095
1545
|
] }),
|
1096
|
-
/* @__PURE__ */
|
1546
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: [
|
1097
1547
|
"Payment ID: ",
|
1098
|
-
|
1548
|
+
payment.id.slice(0, 8),
|
1099
1549
|
"..."
|
1100
1550
|
] }) })
|
1101
1551
|
] }),
|
1102
|
-
|
1103
|
-
|
1552
|
+
step === "select-currency" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1553
|
+
PaymentMethods,
|
1104
1554
|
{
|
1105
|
-
onSelect:
|
1106
|
-
selected:
|
1107
|
-
theme
|
1555
|
+
onSelect: handleCurrencySelect,
|
1556
|
+
selected: selectedCurrency,
|
1557
|
+
theme
|
1108
1558
|
}
|
1109
1559
|
),
|
1110
|
-
|
1111
|
-
/* @__PURE__ */
|
1112
|
-
/* @__PURE__ */
|
1113
|
-
/* @__PURE__ */
|
1114
|
-
/* @__PURE__ */
|
1115
|
-
/* @__PURE__ */
|
1116
|
-
/* @__PURE__ */
|
1560
|
+
step === "confirm" && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1561
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1562
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-lg font-medium mb-2 ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Payment Details" }),
|
1563
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
1564
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
1565
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Currency:" }),
|
1566
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedCurrency })
|
1117
1567
|
] }),
|
1118
|
-
/* @__PURE__ */
|
1119
|
-
/* @__PURE__ */
|
1120
|
-
/* @__PURE__ */
|
1568
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
1569
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Network:" }),
|
1570
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL" ? "Solana" : "Ethereum" })
|
1121
1571
|
] }),
|
1122
|
-
/* @__PURE__ */
|
1123
|
-
/* @__PURE__ */
|
1124
|
-
/* @__PURE__ */
|
1572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
1573
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: theme === "dark" ? "text-gray-300" : "text-gray-600", children: "Fee:" }),
|
1574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
1125
1575
|
] })
|
1126
1576
|
] })
|
1127
1577
|
] }),
|
1128
|
-
/* @__PURE__ */
|
1129
|
-
/* @__PURE__ */
|
1578
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
|
1579
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1130
1580
|
"button",
|
1131
1581
|
{
|
1132
|
-
onClick: () =>
|
1133
|
-
className: `${
|
1582
|
+
onClick: () => togglePaymentMethod("wallet"),
|
1583
|
+
className: `${tabButtonClasses} ${paymentMethod === "wallet" ? activeTabClasses : inactiveTabClasses}`,
|
1134
1584
|
children: "Connect Wallet"
|
1135
1585
|
}
|
1136
1586
|
),
|
1137
|
-
/* @__PURE__ */
|
1587
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1138
1588
|
"button",
|
1139
1589
|
{
|
1140
|
-
onClick: () =>
|
1141
|
-
className: `${
|
1590
|
+
onClick: () => togglePaymentMethod("qrcode"),
|
1591
|
+
className: `${tabButtonClasses} ${paymentMethod === "qrcode" ? activeTabClasses : inactiveTabClasses}`,
|
1142
1592
|
children: "QR Code"
|
1143
1593
|
}
|
1144
1594
|
)
|
1145
1595
|
] }) }),
|
1146
|
-
|
1596
|
+
testMode ? (
|
1147
1597
|
// Test mode payment option
|
1148
|
-
/* @__PURE__ */
|
1149
|
-
/* @__PURE__ */
|
1150
|
-
/* @__PURE__ */
|
1151
|
-
/* @__PURE__ */
|
1152
|
-
/* @__PURE__ */
|
1598
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
1599
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-blue-500 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.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__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
1600
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1601
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Test Mode Payment" }),
|
1602
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: 'Click "Pay Now" to simulate a successful payment' })
|
1153
1603
|
] })
|
1154
1604
|
] }) })
|
1155
|
-
) :
|
1605
|
+
) : paymentMethod === "qrcode" ? (
|
1156
1606
|
// QR Code payment option
|
1157
|
-
/* @__PURE__ */
|
1158
|
-
|
1607
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1608
|
+
QRCode,
|
1159
1609
|
{
|
1160
|
-
walletAddress:
|
1161
|
-
amount:
|
1162
|
-
currency:
|
1163
|
-
theme
|
1610
|
+
walletAddress: payment.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
1611
|
+
amount: payment.totalAmount || payment.amount,
|
1612
|
+
currency: selectedCurrency,
|
1613
|
+
theme
|
1164
1614
|
}
|
1165
1615
|
) })
|
1166
|
-
) :
|
1616
|
+
) : isMetaMaskAvailable ? (
|
1167
1617
|
// MetaMask available option
|
1168
|
-
/* @__PURE__ */
|
1169
|
-
/* @__PURE__ */
|
1170
|
-
/* @__PURE__ */
|
1618
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-blue-900/20" : "bg-blue-50"}`, children: [
|
1619
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
1620
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1171
1621
|
"img",
|
1172
1622
|
{
|
1173
1623
|
src: "https://metamask.io/images/metamask-fox.svg",
|
@@ -1175,290 +1625,366 @@ const Ct = (a) => {
|
|
1175
1625
|
className: "w-8 h-8 mr-2"
|
1176
1626
|
}
|
1177
1627
|
),
|
1178
|
-
/* @__PURE__ */
|
1179
|
-
/* @__PURE__ */
|
1180
|
-
/* @__PURE__ */
|
1628
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1629
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "Pay with MetaMask" }),
|
1630
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: walletConnected ? "Your wallet is connected. Click 'Pay Now' to proceed." : "Click 'Connect Wallet' to proceed with payment." })
|
1181
1631
|
] })
|
1182
1632
|
] }),
|
1183
|
-
!
|
1633
|
+
!walletConnected && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1184
1634
|
"button",
|
1185
1635
|
{
|
1186
|
-
onClick:
|
1187
|
-
className: `mt-3 ${
|
1636
|
+
onClick: onConnectWallet,
|
1637
|
+
className: `mt-3 ${buttonPrimaryClasses}`,
|
1188
1638
|
children: "Connect Wallet"
|
1189
1639
|
}
|
1190
1640
|
)
|
1191
1641
|
] })
|
1192
1642
|
) : (
|
1193
1643
|
// MetaMask not available warning
|
1194
|
-
/* @__PURE__ */
|
1195
|
-
/* @__PURE__ */
|
1196
|
-
/* @__PURE__ */
|
1197
|
-
/* @__PURE__ */
|
1198
|
-
/* @__PURE__ */
|
1199
|
-
/* @__PURE__ */
|
1644
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `p-4 rounded-lg mb-4 ${theme === "dark" ? "bg-yellow-900/20" : "bg-yellow-50"}`, children: [
|
1645
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
1646
|
+
/* @__PURE__ */ jsxRuntimeExports.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__ */ jsxRuntimeExports.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" }) }),
|
1647
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1648
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `font-medium ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: "MetaMask Not Detected" }),
|
1649
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please install MetaMask extension to make payments" })
|
1200
1650
|
] })
|
1201
1651
|
] }),
|
1202
|
-
/* @__PURE__ */
|
1652
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1203
1653
|
"a",
|
1204
1654
|
{
|
1205
1655
|
href: "https://metamask.io/download/",
|
1206
1656
|
target: "_blank",
|
1207
1657
|
rel: "noopener noreferrer",
|
1208
|
-
className: `block mt-3 text-center ${
|
1658
|
+
className: `block mt-3 text-center ${buttonPrimaryClasses}`,
|
1209
1659
|
children: "Install MetaMask"
|
1210
1660
|
}
|
1211
1661
|
)
|
1212
1662
|
] })
|
1213
1663
|
),
|
1214
|
-
/* @__PURE__ */
|
1215
|
-
/* @__PURE__ */
|
1664
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
|
1665
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1216
1666
|
"button",
|
1217
1667
|
{
|
1218
1668
|
type: "button",
|
1219
|
-
onClick:
|
1220
|
-
className:
|
1669
|
+
onClick: handleBack,
|
1670
|
+
className: buttonSecondaryClasses,
|
1221
1671
|
children: "Back"
|
1222
1672
|
}
|
1223
1673
|
),
|
1224
|
-
/* @__PURE__ */
|
1674
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1225
1675
|
"button",
|
1226
1676
|
{
|
1227
1677
|
type: "button",
|
1228
|
-
onClick:
|
1229
|
-
className:
|
1230
|
-
disabled: !
|
1678
|
+
onClick: handlePaymentConfirm,
|
1679
|
+
className: buttonPrimaryClasses,
|
1680
|
+
disabled: !testMode && paymentMethod === "wallet" && isMetaMaskAvailable && !walletConnected,
|
1231
1681
|
children: "Pay Now"
|
1232
1682
|
}
|
1233
1683
|
)
|
1234
1684
|
] })
|
1235
1685
|
] }),
|
1236
|
-
|
1237
|
-
|
1686
|
+
step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1687
|
+
PaymentStatus,
|
1238
1688
|
{
|
1239
1689
|
status: "processing",
|
1240
|
-
theme
|
1690
|
+
theme,
|
1241
1691
|
message: "Processing your payment..."
|
1242
1692
|
}
|
1243
1693
|
),
|
1244
|
-
|
1245
|
-
/* @__PURE__ */
|
1246
|
-
|
1694
|
+
step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1696
|
+
PaymentStatus,
|
1247
1697
|
{
|
1248
1698
|
status: "success",
|
1249
|
-
theme
|
1699
|
+
theme,
|
1250
1700
|
message: "Payment successful!"
|
1251
1701
|
}
|
1252
1702
|
),
|
1253
|
-
|
1254
|
-
/* @__PURE__ */
|
1255
|
-
/* @__PURE__ */
|
1256
|
-
/* @__PURE__ */
|
1703
|
+
transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `mt-4 p-3 rounded-lg ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: [
|
1704
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme === "dark" ? "text-gray-300" : "text-gray-600"} mb-1`, children: "Transaction Hash:" }),
|
1705
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-mono break-all ${theme === "dark" ? "text-white" : "text-gray-800"}`, children: formatTransactionHash(transactionHash) }),
|
1706
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1257
1707
|
"a",
|
1258
1708
|
{
|
1259
|
-
href: `https://etherscan.io/tx/${
|
1709
|
+
href: `https://etherscan.io/tx/${transactionHash}`,
|
1260
1710
|
target: "_blank",
|
1261
1711
|
rel: "noopener noreferrer",
|
1262
|
-
className: `text-xs ${
|
1712
|
+
className: `text-xs ${theme === "dark" ? "text-blue-400" : "text-blue-600"} mt-2 inline-block`,
|
1263
1713
|
children: "View on Etherscan →"
|
1264
1714
|
}
|
1265
1715
|
)
|
1266
1716
|
] })
|
1267
1717
|
] }),
|
1268
|
-
|
1269
|
-
/* @__PURE__ */
|
1270
|
-
|
1718
|
+
step === "error" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
1719
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1720
|
+
PaymentStatus,
|
1271
1721
|
{
|
1272
1722
|
status: "error",
|
1273
|
-
theme
|
1274
|
-
message:
|
1723
|
+
theme,
|
1724
|
+
message: error || "An error occurred while processing your payment."
|
1275
1725
|
}
|
1276
1726
|
),
|
1277
|
-
/* @__PURE__ */
|
1727
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1278
1728
|
"button",
|
1279
1729
|
{
|
1280
1730
|
type: "button",
|
1281
|
-
onClick:
|
1282
|
-
className: `mt-4 ${
|
1731
|
+
onClick: handleBack,
|
1732
|
+
className: `mt-4 ${buttonSecondaryClasses}`,
|
1283
1733
|
children: "Try Again"
|
1284
1734
|
}
|
1285
1735
|
)
|
1286
1736
|
] })
|
1287
1737
|
] }),
|
1288
|
-
/* @__PURE__ */
|
1289
|
-
] }) }) })
|
1290
|
-
}
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
const
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1738
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-center text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Powered by Coinley - Secure Cryptocurrency Payments" }) })
|
1739
|
+
] }) }) });
|
1740
|
+
};
|
1741
|
+
const CoinleyCheckout = forwardRef(({
|
1742
|
+
apiKey,
|
1743
|
+
apiSecret,
|
1744
|
+
apiUrl,
|
1745
|
+
customerEmail,
|
1746
|
+
merchantName = "Merchant",
|
1747
|
+
onSuccess,
|
1748
|
+
onError,
|
1749
|
+
onClose,
|
1750
|
+
theme,
|
1751
|
+
autoOpen = false,
|
1752
|
+
debug = false,
|
1753
|
+
testMode = false
|
1754
|
+
}, ref) => {
|
1755
|
+
const coinleyContext = useCoinley();
|
1756
|
+
const { theme: contextTheme } = useTheme();
|
1757
|
+
const [isOpen, setIsOpen] = useState(autoOpen);
|
1758
|
+
const [payment, setPayment] = useState(null);
|
1759
|
+
const [paymentStatus, setPaymentStatus] = useState("idle");
|
1760
|
+
const [selectedCurrency, setSelectedCurrency] = useState("USDT");
|
1761
|
+
const [error, setError] = useState(null);
|
1762
|
+
const [transactionHash, setTransactionHash] = useState(null);
|
1763
|
+
const [walletConnected, setWalletConnected] = useState(false);
|
1764
|
+
apiKey || (coinleyContext == null ? void 0 : coinleyContext.apiKey);
|
1765
|
+
apiSecret || (coinleyContext == null ? void 0 : coinleyContext.apiSecret);
|
1766
|
+
apiUrl || (coinleyContext == null ? void 0 : coinleyContext.apiUrl);
|
1767
|
+
const effectiveTheme = theme || contextTheme;
|
1768
|
+
const effectiveDebug = debug || (coinleyContext == null ? void 0 : coinleyContext.debug);
|
1769
|
+
useImperativeHandle(ref, () => ({
|
1770
|
+
open: (paymentDetails) => {
|
1771
|
+
handleOpen(paymentDetails);
|
1310
1772
|
},
|
1311
1773
|
close: () => {
|
1312
|
-
|
1774
|
+
handleClose();
|
1313
1775
|
},
|
1314
|
-
getPayment: () =>
|
1776
|
+
getPayment: () => payment
|
1315
1777
|
}));
|
1316
|
-
const
|
1317
|
-
|
1778
|
+
const log = (message, data) => {
|
1779
|
+
if (effectiveDebug) {
|
1780
|
+
console.log(`[Coinley SDK] ${message}`, data);
|
1781
|
+
}
|
1318
1782
|
};
|
1319
|
-
|
1320
|
-
|
1321
|
-
if (
|
1783
|
+
useEffect(() => {
|
1784
|
+
const checkWalletConnection = async () => {
|
1785
|
+
if (isMetaMaskInstalled()) {
|
1322
1786
|
try {
|
1323
|
-
const
|
1324
|
-
|
1325
|
-
} catch (
|
1326
|
-
|
1787
|
+
const accounts = await window.ethereum.request({ method: "eth_accounts" });
|
1788
|
+
setWalletConnected(accounts && accounts.length > 0);
|
1789
|
+
} catch (err) {
|
1790
|
+
log("Error checking wallet connection:", err);
|
1791
|
+
setWalletConnected(false);
|
1327
1792
|
}
|
1328
|
-
else
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1793
|
+
} else {
|
1794
|
+
setWalletConnected(false);
|
1795
|
+
}
|
1796
|
+
};
|
1797
|
+
checkWalletConnection();
|
1798
|
+
}, []);
|
1799
|
+
useEffect(() => {
|
1800
|
+
const handleAccountsChanged = (accounts) => {
|
1801
|
+
setWalletConnected(accounts.length > 0);
|
1334
1802
|
};
|
1335
|
-
|
1336
|
-
|
1803
|
+
if (typeof window !== "undefined" && window.ethereum) {
|
1804
|
+
window.ethereum.on("accountsChanged", handleAccountsChanged);
|
1805
|
+
}
|
1806
|
+
return () => {
|
1807
|
+
if (typeof window !== "undefined" && window.ethereum) {
|
1808
|
+
window.ethereum.removeListener("accountsChanged", handleAccountsChanged);
|
1809
|
+
}
|
1337
1810
|
};
|
1338
1811
|
}, []);
|
1339
|
-
const
|
1340
|
-
if (!
|
1341
|
-
|
1812
|
+
const handleOpen = async (paymentDetails) => {
|
1813
|
+
if (!paymentDetails || !paymentDetails.amount) {
|
1814
|
+
setError("Payment amount is required");
|
1815
|
+
if (onError)
|
1816
|
+
onError(new Error("Payment amount is required"));
|
1342
1817
|
return;
|
1343
1818
|
}
|
1344
|
-
|
1819
|
+
setPaymentStatus("loading");
|
1820
|
+
setIsOpen(true);
|
1345
1821
|
try {
|
1346
|
-
|
1347
|
-
const
|
1348
|
-
amount:
|
1349
|
-
currency:
|
1350
|
-
customerEmail:
|
1351
|
-
callbackUrl:
|
1352
|
-
metadata:
|
1822
|
+
log("Creating payment with details:", paymentDetails);
|
1823
|
+
const paymentResponse = await createPayment({
|
1824
|
+
amount: paymentDetails.amount,
|
1825
|
+
currency: paymentDetails.currency || "USDT",
|
1826
|
+
customerEmail: paymentDetails.customerEmail || customerEmail,
|
1827
|
+
callbackUrl: paymentDetails.callbackUrl,
|
1828
|
+
metadata: paymentDetails.metadata || {}
|
1353
1829
|
});
|
1354
|
-
|
1355
|
-
|
1830
|
+
log("Payment created:", paymentResponse);
|
1831
|
+
setPayment(paymentResponse.payment);
|
1832
|
+
setPaymentStatus("idle");
|
1833
|
+
setError(null);
|
1834
|
+
log("Payment created and state updated:", {
|
1835
|
+
payment: paymentResponse.payment,
|
1356
1836
|
status: "idle"
|
1357
1837
|
});
|
1358
|
-
} catch (
|
1359
|
-
|
1838
|
+
} catch (err) {
|
1839
|
+
log("Error creating payment:", err);
|
1840
|
+
setError(err.message || "Failed to create payment");
|
1841
|
+
setPaymentStatus("error");
|
1842
|
+
if (onError)
|
1843
|
+
onError(err);
|
1844
|
+
}
|
1845
|
+
};
|
1846
|
+
const handleClose = () => {
|
1847
|
+
setIsOpen(false);
|
1848
|
+
setTransactionHash(null);
|
1849
|
+
if (onClose)
|
1850
|
+
onClose();
|
1851
|
+
};
|
1852
|
+
const handlePaymentMethodSelect = (currency) => {
|
1853
|
+
log("Currency selected:", currency);
|
1854
|
+
setSelectedCurrency(currency);
|
1855
|
+
};
|
1856
|
+
const connectToWallet = async () => {
|
1857
|
+
if (!isMetaMaskInstalled()) {
|
1858
|
+
setError("MetaMask is not installed. Please install MetaMask to make payments.");
|
1859
|
+
return false;
|
1360
1860
|
}
|
1361
|
-
}, Z = () => {
|
1362
|
-
W(!1), B(null), L && L();
|
1363
|
-
}, q = (g) => {
|
1364
|
-
j("Currency selected:", g), J(g);
|
1365
|
-
}, T = async () => {
|
1366
|
-
if (!G())
|
1367
|
-
return F("MetaMask is not installed. Please install MetaMask to make payments."), !1;
|
1368
1861
|
try {
|
1369
|
-
const
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1862
|
+
const accounts = await connectWallet();
|
1863
|
+
setWalletConnected(accounts.length > 0);
|
1864
|
+
return accounts.length > 0;
|
1865
|
+
} catch (err) {
|
1866
|
+
log("Error connecting to wallet:", err);
|
1867
|
+
setError(err.message || "Failed to connect to wallet");
|
1868
|
+
return false;
|
1373
1869
|
}
|
1374
|
-
}
|
1375
|
-
|
1376
|
-
|
1870
|
+
};
|
1871
|
+
const handlePayment = async (isQrCodeMode = false) => {
|
1872
|
+
if (!payment) {
|
1873
|
+
setError("No active payment to process");
|
1377
1874
|
return;
|
1378
1875
|
}
|
1379
|
-
|
1876
|
+
log("Starting payment process...", { isQrCodeMode });
|
1877
|
+
setPaymentStatus("loading");
|
1878
|
+
setTransactionHash(null);
|
1380
1879
|
try {
|
1381
|
-
|
1382
|
-
let
|
1383
|
-
if (
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1880
|
+
log("Processing payment:", { paymentId: payment.id, currency: selectedCurrency, isQrCodeMode });
|
1881
|
+
let txHash;
|
1882
|
+
if (testMode) {
|
1883
|
+
log("Test mode: Generating mock transaction...");
|
1884
|
+
txHash = `0x${Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("")}`;
|
1885
|
+
} else if (isQrCodeMode) {
|
1886
|
+
log("QR code payment: User confirms payment was sent");
|
1887
|
+
txHash = `qrcode_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
|
1888
|
+
} else {
|
1889
|
+
if (!walletConnected) {
|
1890
|
+
const connected = await connectToWallet();
|
1891
|
+
if (!connected) {
|
1892
|
+
throw new Error("Please connect your wallet to proceed with payment");
|
1893
|
+
}
|
1894
|
+
}
|
1895
|
+
const merchantAddress = payment.walletAddress || "0x742d35Cc6634C0532925a3b844Bc454e4438f44e";
|
1896
|
+
const txParams = {
|
1897
|
+
from: await window.ethereum.request({ method: "eth_requestAccounts" }).then((accounts) => accounts[0]),
|
1898
|
+
to: merchantAddress,
|
1393
1899
|
value: "0x0",
|
1394
1900
|
// For ERC-20 tokens, value is 0
|
1395
1901
|
data: "0x"
|
1396
1902
|
// Would include token transfer data for ERC-20
|
1397
1903
|
};
|
1398
|
-
|
1904
|
+
log("Sending transaction to wallet for approval...");
|
1905
|
+
txHash = await sendTransaction(txParams);
|
1399
1906
|
}
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1907
|
+
log("Transaction hash:", txHash);
|
1908
|
+
setTransactionHash(txHash);
|
1909
|
+
log("Sending process payment request to API...");
|
1910
|
+
const processResponse = await processPayment({
|
1911
|
+
paymentId: payment.id,
|
1912
|
+
transactionHash: txHash,
|
1913
|
+
network: selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL" ? "solana" : "ethereum"
|
1405
1914
|
});
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1915
|
+
log("Payment processed successfully:", processResponse);
|
1916
|
+
setPaymentStatus("success");
|
1917
|
+
if (onSuccess) {
|
1918
|
+
log("Calling onSuccess callback...");
|
1919
|
+
onSuccess(payment.id, txHash);
|
1920
|
+
}
|
1921
|
+
} catch (err) {
|
1922
|
+
log("Payment error:", err);
|
1923
|
+
setError(err.message || "Failed to process payment");
|
1924
|
+
setPaymentStatus("error");
|
1925
|
+
if (onError)
|
1926
|
+
onError(err);
|
1409
1927
|
}
|
1410
1928
|
};
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1929
|
+
useEffect(() => {
|
1930
|
+
if (autoOpen && payment) {
|
1931
|
+
setIsOpen(true);
|
1932
|
+
}
|
1933
|
+
}, [autoOpen, payment]);
|
1934
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1935
|
+
CoinleyModal,
|
1415
1936
|
{
|
1416
|
-
isOpen
|
1417
|
-
onClose:
|
1418
|
-
payment
|
1419
|
-
paymentStatus
|
1420
|
-
selectedCurrency
|
1421
|
-
onCurrencySelect:
|
1422
|
-
onPayment:
|
1423
|
-
error
|
1424
|
-
theme:
|
1425
|
-
merchantName
|
1426
|
-
transactionHash
|
1427
|
-
walletConnected
|
1428
|
-
onConnectWallet:
|
1429
|
-
testMode
|
1937
|
+
isOpen,
|
1938
|
+
onClose: handleClose,
|
1939
|
+
payment,
|
1940
|
+
paymentStatus,
|
1941
|
+
selectedCurrency,
|
1942
|
+
onCurrencySelect: handlePaymentMethodSelect,
|
1943
|
+
onPayment: handlePayment,
|
1944
|
+
error,
|
1945
|
+
theme: effectiveTheme,
|
1946
|
+
merchantName,
|
1947
|
+
transactionHash,
|
1948
|
+
walletConnected,
|
1949
|
+
onConnectWallet: connectToWallet,
|
1950
|
+
testMode
|
1430
1951
|
}
|
1431
1952
|
) });
|
1432
1953
|
});
|
1433
|
-
|
1434
|
-
const
|
1954
|
+
CoinleyCheckout.displayName = "CoinleyCheckout";
|
1955
|
+
const styles = "";
|
1956
|
+
const DEFAULT_CONFIG = {
|
1435
1957
|
apiUrl: "https://coinleyserver-production.up.railway.app",
|
1436
|
-
debug:
|
1437
|
-
testMode:
|
1958
|
+
debug: false,
|
1959
|
+
testMode: false,
|
1438
1960
|
theme: "light"
|
1439
|
-
}
|
1961
|
+
};
|
1962
|
+
const VERSION = "1.0.4";
|
1440
1963
|
export {
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1964
|
+
CoinleyCheckout,
|
1965
|
+
CoinleyModal,
|
1966
|
+
CoinleyProvider,
|
1967
|
+
DEFAULT_CONFIG,
|
1968
|
+
PaymentMethods,
|
1969
|
+
PaymentStatus,
|
1970
|
+
QRCode$1 as QRCode,
|
1971
|
+
TOKEN_ADDRESSES,
|
1972
|
+
ThemeProvider,
|
1973
|
+
VERSION,
|
1974
|
+
connectWallet,
|
1975
|
+
createPayment,
|
1976
|
+
getAccounts,
|
1977
|
+
getChainId,
|
1978
|
+
getMerchantPaymentStats,
|
1979
|
+
getMerchantPayments,
|
1980
|
+
getNetworkName,
|
1981
|
+
getPayment,
|
1982
|
+
getSupportedCurrencies,
|
1983
|
+
getTokenBalance,
|
1984
|
+
isMetaMaskInstalled,
|
1985
|
+
isWalletConnected,
|
1986
|
+
processPayment,
|
1987
|
+
sendToken,
|
1988
|
+
sendTransaction
|
1464
1989
|
};
|
1990
|
+
//# sourceMappingURL=coinley-checkout.es.js.map
|