@superlogic/spree-pay 0.5.2 → 0.5.4
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/build/{CryptoComTab-EKWP4XOV.js → CryptoComTab-WXKBRJF3.js} +5 -5
- package/build/{CryptoTab-XJZHGZ5E.js → CryptoTab-G55XLBX2.js} +8 -11
- package/build/{chunk-VBGTP4XP.js → chunk-H7S3CTS3.js} +1 -1
- package/build/{chunk-ABVIUWRK.js → chunk-QJCZPYQC.js} +5 -4
- package/build/{chunk-ECIGRDXS.js → chunk-RZ43EXC2.js} +451 -13
- package/build/index.cjs +666 -224
- package/build/index.css +9 -0
- package/build/index.js +14 -17
- package/package.json +5 -3
package/build/index.cjs
CHANGED
|
@@ -30,6 +30,448 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
+
// ../../node_modules/@ebay/nice-modal-react/lib/esm/index.js
|
|
34
|
+
function getModal(modalId) {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = MODAL_REGISTRY[modalId]) === null || _a === void 0 ? void 0 : _a.comp;
|
|
37
|
+
}
|
|
38
|
+
function showModal(modalId, args) {
|
|
39
|
+
return {
|
|
40
|
+
type: "nice-modal/show",
|
|
41
|
+
payload: {
|
|
42
|
+
modalId,
|
|
43
|
+
args
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function setModalFlags(modalId, flags) {
|
|
48
|
+
return {
|
|
49
|
+
type: "nice-modal/set-flags",
|
|
50
|
+
payload: {
|
|
51
|
+
modalId,
|
|
52
|
+
flags
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function hideModal(modalId) {
|
|
57
|
+
return {
|
|
58
|
+
type: "nice-modal/hide",
|
|
59
|
+
payload: {
|
|
60
|
+
modalId
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function removeModal(modalId) {
|
|
65
|
+
return {
|
|
66
|
+
type: "nice-modal/remove",
|
|
67
|
+
payload: {
|
|
68
|
+
modalId
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function show(modal, args) {
|
|
73
|
+
var modalId = getModalId(modal);
|
|
74
|
+
if (typeof modal !== "string" && !MODAL_REGISTRY[modalId]) {
|
|
75
|
+
register(modalId, modal);
|
|
76
|
+
}
|
|
77
|
+
dispatch(showModal(modalId, args));
|
|
78
|
+
if (!modalCallbacks[modalId]) {
|
|
79
|
+
var theResolve_1;
|
|
80
|
+
var theReject_1;
|
|
81
|
+
var promise = new Promise(function(resolve, reject) {
|
|
82
|
+
theResolve_1 = resolve;
|
|
83
|
+
theReject_1 = reject;
|
|
84
|
+
});
|
|
85
|
+
modalCallbacks[modalId] = {
|
|
86
|
+
resolve: theResolve_1,
|
|
87
|
+
reject: theReject_1,
|
|
88
|
+
promise
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return modalCallbacks[modalId].promise;
|
|
92
|
+
}
|
|
93
|
+
function hide(modal) {
|
|
94
|
+
var modalId = getModalId(modal);
|
|
95
|
+
dispatch(hideModal(modalId));
|
|
96
|
+
delete modalCallbacks[modalId];
|
|
97
|
+
if (!hideModalCallbacks[modalId]) {
|
|
98
|
+
var theResolve_2;
|
|
99
|
+
var theReject_2;
|
|
100
|
+
var promise = new Promise(function(resolve, reject) {
|
|
101
|
+
theResolve_2 = resolve;
|
|
102
|
+
theReject_2 = reject;
|
|
103
|
+
});
|
|
104
|
+
hideModalCallbacks[modalId] = {
|
|
105
|
+
resolve: theResolve_2,
|
|
106
|
+
reject: theReject_2,
|
|
107
|
+
promise
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return hideModalCallbacks[modalId].promise;
|
|
111
|
+
}
|
|
112
|
+
function useModal(modal, args) {
|
|
113
|
+
var modals = (0, import_react.useContext)(NiceModalContext);
|
|
114
|
+
var contextModalId = (0, import_react.useContext)(NiceModalIdContext);
|
|
115
|
+
var modalId = null;
|
|
116
|
+
var isUseComponent = modal && typeof modal !== "string";
|
|
117
|
+
if (!modal) {
|
|
118
|
+
modalId = contextModalId;
|
|
119
|
+
} else {
|
|
120
|
+
modalId = getModalId(modal);
|
|
121
|
+
}
|
|
122
|
+
if (!modalId)
|
|
123
|
+
throw new Error("No modal id found in NiceModal.useModal.");
|
|
124
|
+
var mid = modalId;
|
|
125
|
+
(0, import_react.useEffect)(function() {
|
|
126
|
+
if (isUseComponent && !MODAL_REGISTRY[mid]) {
|
|
127
|
+
register(mid, modal, args);
|
|
128
|
+
}
|
|
129
|
+
}, [isUseComponent, mid, modal, args]);
|
|
130
|
+
var modalInfo = modals[mid];
|
|
131
|
+
var showCallback = (0, import_react.useCallback)(function(args2) {
|
|
132
|
+
return show(mid, args2);
|
|
133
|
+
}, [mid]);
|
|
134
|
+
var hideCallback = (0, import_react.useCallback)(function() {
|
|
135
|
+
return hide(mid);
|
|
136
|
+
}, [mid]);
|
|
137
|
+
var removeCallback = (0, import_react.useCallback)(function() {
|
|
138
|
+
return remove(mid);
|
|
139
|
+
}, [mid]);
|
|
140
|
+
var resolveCallback = (0, import_react.useCallback)(function(args2) {
|
|
141
|
+
var _a;
|
|
142
|
+
(_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args2);
|
|
143
|
+
delete modalCallbacks[mid];
|
|
144
|
+
}, [mid]);
|
|
145
|
+
var rejectCallback = (0, import_react.useCallback)(function(args2) {
|
|
146
|
+
var _a;
|
|
147
|
+
(_a = modalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.reject(args2);
|
|
148
|
+
delete modalCallbacks[mid];
|
|
149
|
+
}, [mid]);
|
|
150
|
+
var resolveHide = (0, import_react.useCallback)(function(args2) {
|
|
151
|
+
var _a;
|
|
152
|
+
(_a = hideModalCallbacks[mid]) === null || _a === void 0 ? void 0 : _a.resolve(args2);
|
|
153
|
+
delete hideModalCallbacks[mid];
|
|
154
|
+
}, [mid]);
|
|
155
|
+
return (0, import_react.useMemo)(function() {
|
|
156
|
+
return {
|
|
157
|
+
id: mid,
|
|
158
|
+
args: modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,
|
|
159
|
+
visible: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible),
|
|
160
|
+
keepMounted: !!(modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted),
|
|
161
|
+
show: showCallback,
|
|
162
|
+
hide: hideCallback,
|
|
163
|
+
remove: removeCallback,
|
|
164
|
+
resolve: resolveCallback,
|
|
165
|
+
reject: rejectCallback,
|
|
166
|
+
resolveHide
|
|
167
|
+
};
|
|
168
|
+
}, [
|
|
169
|
+
mid,
|
|
170
|
+
modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.args,
|
|
171
|
+
modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.visible,
|
|
172
|
+
modalInfo === null || modalInfo === void 0 ? void 0 : modalInfo.keepMounted,
|
|
173
|
+
showCallback,
|
|
174
|
+
hideCallback,
|
|
175
|
+
removeCallback,
|
|
176
|
+
resolveCallback,
|
|
177
|
+
rejectCallback,
|
|
178
|
+
resolveHide
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
var import_react, __assign, __rest, symModalId, initialState, NiceModalContext, NiceModalIdContext, MODAL_REGISTRY, ALREADY_MOUNTED, uidSeed, dispatch, getUid, reducer, modalCallbacks, hideModalCallbacks, getModalId, remove, setFlags, create, register, unregister, NiceModalPlaceholder, InnerContextProvider, Provider, ModalDef, ModalHolder, antdModal, antdDrawer, muiDialog, bootstrapDialog, NiceModal, esm_default;
|
|
182
|
+
var init_esm = __esm({
|
|
183
|
+
"../../node_modules/@ebay/nice-modal-react/lib/esm/index.js"() {
|
|
184
|
+
"use strict";
|
|
185
|
+
import_react = __toESM(require("react"));
|
|
186
|
+
__assign = function() {
|
|
187
|
+
__assign = Object.assign || function(t) {
|
|
188
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
189
|
+
s = arguments[i];
|
|
190
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
191
|
+
t[p] = s[p];
|
|
192
|
+
}
|
|
193
|
+
return t;
|
|
194
|
+
};
|
|
195
|
+
return __assign.apply(this, arguments);
|
|
196
|
+
};
|
|
197
|
+
__rest = function(s, e) {
|
|
198
|
+
var t = {};
|
|
199
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
200
|
+
t[p] = s[p];
|
|
201
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
202
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
203
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
204
|
+
t[p[i]] = s[p[i]];
|
|
205
|
+
}
|
|
206
|
+
return t;
|
|
207
|
+
};
|
|
208
|
+
symModalId = /* @__PURE__ */ Symbol("NiceModalId");
|
|
209
|
+
initialState = {};
|
|
210
|
+
NiceModalContext = import_react.default.createContext(initialState);
|
|
211
|
+
NiceModalIdContext = import_react.default.createContext(null);
|
|
212
|
+
MODAL_REGISTRY = {};
|
|
213
|
+
ALREADY_MOUNTED = {};
|
|
214
|
+
uidSeed = 0;
|
|
215
|
+
dispatch = function() {
|
|
216
|
+
throw new Error("No dispatch method detected, did you embed your app with NiceModal.Provider?");
|
|
217
|
+
};
|
|
218
|
+
getUid = function() {
|
|
219
|
+
return "_nice_modal_" + uidSeed++;
|
|
220
|
+
};
|
|
221
|
+
reducer = function(state, action) {
|
|
222
|
+
var _a, _b, _c;
|
|
223
|
+
if (state === void 0) {
|
|
224
|
+
state = initialState;
|
|
225
|
+
}
|
|
226
|
+
switch (action.type) {
|
|
227
|
+
case "nice-modal/show": {
|
|
228
|
+
var _d = action.payload, modalId = _d.modalId, args = _d.args;
|
|
229
|
+
return __assign(__assign({}, state), (_a = {}, _a[modalId] = __assign(__assign({}, state[modalId]), {
|
|
230
|
+
id: modalId,
|
|
231
|
+
args,
|
|
232
|
+
// If modal is not mounted, mount it first then make it visible.
|
|
233
|
+
// There is logic inside HOC wrapper to make it visible after its first mount.
|
|
234
|
+
// This mechanism ensures the entering transition.
|
|
235
|
+
visible: !!ALREADY_MOUNTED[modalId],
|
|
236
|
+
delayVisible: !ALREADY_MOUNTED[modalId]
|
|
237
|
+
}), _a));
|
|
238
|
+
}
|
|
239
|
+
case "nice-modal/hide": {
|
|
240
|
+
var modalId = action.payload.modalId;
|
|
241
|
+
if (!state[modalId])
|
|
242
|
+
return state;
|
|
243
|
+
return __assign(__assign({}, state), (_b = {}, _b[modalId] = __assign(__assign({}, state[modalId]), { visible: false }), _b));
|
|
244
|
+
}
|
|
245
|
+
case "nice-modal/remove": {
|
|
246
|
+
var modalId = action.payload.modalId;
|
|
247
|
+
var newState = __assign({}, state);
|
|
248
|
+
delete newState[modalId];
|
|
249
|
+
return newState;
|
|
250
|
+
}
|
|
251
|
+
case "nice-modal/set-flags": {
|
|
252
|
+
var _e = action.payload, modalId = _e.modalId, flags = _e.flags;
|
|
253
|
+
return __assign(__assign({}, state), (_c = {}, _c[modalId] = __assign(__assign({}, state[modalId]), flags), _c));
|
|
254
|
+
}
|
|
255
|
+
default:
|
|
256
|
+
return state;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
modalCallbacks = {};
|
|
260
|
+
hideModalCallbacks = {};
|
|
261
|
+
getModalId = function(modal) {
|
|
262
|
+
if (typeof modal === "string")
|
|
263
|
+
return modal;
|
|
264
|
+
if (!modal[symModalId]) {
|
|
265
|
+
modal[symModalId] = getUid();
|
|
266
|
+
}
|
|
267
|
+
return modal[symModalId];
|
|
268
|
+
};
|
|
269
|
+
remove = function(modal) {
|
|
270
|
+
var modalId = getModalId(modal);
|
|
271
|
+
dispatch(removeModal(modalId));
|
|
272
|
+
delete modalCallbacks[modalId];
|
|
273
|
+
delete hideModalCallbacks[modalId];
|
|
274
|
+
};
|
|
275
|
+
setFlags = function(modalId, flags) {
|
|
276
|
+
dispatch(setModalFlags(modalId, flags));
|
|
277
|
+
};
|
|
278
|
+
create = function(Comp) {
|
|
279
|
+
return function(_a) {
|
|
280
|
+
var _b;
|
|
281
|
+
var defaultVisible = _a.defaultVisible, keepMounted = _a.keepMounted, id = _a.id, props = __rest(_a, ["defaultVisible", "keepMounted", "id"]);
|
|
282
|
+
var _c = useModal(id), args = _c.args, show2 = _c.show;
|
|
283
|
+
var modals = (0, import_react.useContext)(NiceModalContext);
|
|
284
|
+
var shouldMount = !!modals[id];
|
|
285
|
+
(0, import_react.useEffect)(function() {
|
|
286
|
+
if (defaultVisible) {
|
|
287
|
+
show2();
|
|
288
|
+
}
|
|
289
|
+
ALREADY_MOUNTED[id] = true;
|
|
290
|
+
return function() {
|
|
291
|
+
delete ALREADY_MOUNTED[id];
|
|
292
|
+
};
|
|
293
|
+
}, [id, show2, defaultVisible]);
|
|
294
|
+
(0, import_react.useEffect)(function() {
|
|
295
|
+
if (keepMounted)
|
|
296
|
+
setFlags(id, { keepMounted: true });
|
|
297
|
+
}, [id, keepMounted]);
|
|
298
|
+
var delayVisible = (_b = modals[id]) === null || _b === void 0 ? void 0 : _b.delayVisible;
|
|
299
|
+
(0, import_react.useEffect)(function() {
|
|
300
|
+
if (delayVisible) {
|
|
301
|
+
show2(args);
|
|
302
|
+
}
|
|
303
|
+
}, [delayVisible, args, show2]);
|
|
304
|
+
if (!shouldMount)
|
|
305
|
+
return null;
|
|
306
|
+
return import_react.default.createElement(
|
|
307
|
+
NiceModalIdContext.Provider,
|
|
308
|
+
{ value: id },
|
|
309
|
+
import_react.default.createElement(Comp, __assign({}, props, args))
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
register = function(id, comp, props) {
|
|
314
|
+
if (!MODAL_REGISTRY[id]) {
|
|
315
|
+
MODAL_REGISTRY[id] = { comp, props };
|
|
316
|
+
} else {
|
|
317
|
+
MODAL_REGISTRY[id].props = props;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
unregister = function(id) {
|
|
321
|
+
delete MODAL_REGISTRY[id];
|
|
322
|
+
};
|
|
323
|
+
NiceModalPlaceholder = function() {
|
|
324
|
+
var modals = (0, import_react.useContext)(NiceModalContext);
|
|
325
|
+
var visibleModalIds = Object.keys(modals).filter(function(id) {
|
|
326
|
+
return !!modals[id];
|
|
327
|
+
});
|
|
328
|
+
visibleModalIds.forEach(function(id) {
|
|
329
|
+
if (!MODAL_REGISTRY[id] && !ALREADY_MOUNTED[id]) {
|
|
330
|
+
console.warn("No modal found for id: " + id + ". Please check the id or if it is registered or declared via JSX.");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
var toRender = visibleModalIds.filter(function(id) {
|
|
335
|
+
return MODAL_REGISTRY[id];
|
|
336
|
+
}).map(function(id) {
|
|
337
|
+
return __assign({ id }, MODAL_REGISTRY[id]);
|
|
338
|
+
});
|
|
339
|
+
return import_react.default.createElement(import_react.default.Fragment, null, toRender.map(function(t) {
|
|
340
|
+
return import_react.default.createElement(t.comp, __assign({ key: t.id, id: t.id }, t.props));
|
|
341
|
+
}));
|
|
342
|
+
};
|
|
343
|
+
InnerContextProvider = function(_a) {
|
|
344
|
+
var children = _a.children;
|
|
345
|
+
var arr = (0, import_react.useReducer)(reducer, initialState);
|
|
346
|
+
var modals = arr[0];
|
|
347
|
+
dispatch = arr[1];
|
|
348
|
+
return import_react.default.createElement(
|
|
349
|
+
NiceModalContext.Provider,
|
|
350
|
+
{ value: modals },
|
|
351
|
+
children,
|
|
352
|
+
import_react.default.createElement(NiceModalPlaceholder, null)
|
|
353
|
+
);
|
|
354
|
+
};
|
|
355
|
+
Provider = function(_a) {
|
|
356
|
+
var children = _a.children, givenDispatch = _a.dispatch, givenModals = _a.modals;
|
|
357
|
+
if (!givenDispatch || !givenModals) {
|
|
358
|
+
return import_react.default.createElement(InnerContextProvider, null, children);
|
|
359
|
+
}
|
|
360
|
+
dispatch = givenDispatch;
|
|
361
|
+
return import_react.default.createElement(
|
|
362
|
+
NiceModalContext.Provider,
|
|
363
|
+
{ value: givenModals },
|
|
364
|
+
children,
|
|
365
|
+
import_react.default.createElement(NiceModalPlaceholder, null)
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
ModalDef = function(_a) {
|
|
369
|
+
var id = _a.id, component = _a.component;
|
|
370
|
+
(0, import_react.useEffect)(function() {
|
|
371
|
+
register(id, component);
|
|
372
|
+
return function() {
|
|
373
|
+
unregister(id);
|
|
374
|
+
};
|
|
375
|
+
}, [id, component]);
|
|
376
|
+
return null;
|
|
377
|
+
};
|
|
378
|
+
ModalHolder = function(_a) {
|
|
379
|
+
var _b;
|
|
380
|
+
var modal = _a.modal, _c = _a.handler, handler = _c === void 0 ? {} : _c, restProps = __rest(_a, ["modal", "handler"]);
|
|
381
|
+
var mid = (0, import_react.useMemo)(function() {
|
|
382
|
+
return getUid();
|
|
383
|
+
}, []);
|
|
384
|
+
var ModalComp = typeof modal === "string" ? (_b = MODAL_REGISTRY[modal]) === null || _b === void 0 ? void 0 : _b.comp : modal;
|
|
385
|
+
if (!handler) {
|
|
386
|
+
throw new Error("No handler found in NiceModal.ModalHolder.");
|
|
387
|
+
}
|
|
388
|
+
if (!ModalComp) {
|
|
389
|
+
throw new Error("No modal found for id: " + modal + " in NiceModal.ModalHolder.");
|
|
390
|
+
}
|
|
391
|
+
handler.show = (0, import_react.useCallback)(function(args) {
|
|
392
|
+
return show(mid, args);
|
|
393
|
+
}, [mid]);
|
|
394
|
+
handler.hide = (0, import_react.useCallback)(function() {
|
|
395
|
+
return hide(mid);
|
|
396
|
+
}, [mid]);
|
|
397
|
+
return import_react.default.createElement(ModalComp, __assign({ id: mid }, restProps));
|
|
398
|
+
};
|
|
399
|
+
antdModal = function(modal) {
|
|
400
|
+
return {
|
|
401
|
+
visible: modal.visible,
|
|
402
|
+
onOk: function() {
|
|
403
|
+
return modal.hide();
|
|
404
|
+
},
|
|
405
|
+
onCancel: function() {
|
|
406
|
+
return modal.hide();
|
|
407
|
+
},
|
|
408
|
+
afterClose: function() {
|
|
409
|
+
modal.resolveHide();
|
|
410
|
+
if (!modal.keepMounted)
|
|
411
|
+
modal.remove();
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
antdDrawer = function(modal) {
|
|
416
|
+
return {
|
|
417
|
+
visible: modal.visible,
|
|
418
|
+
onClose: function() {
|
|
419
|
+
return modal.hide();
|
|
420
|
+
},
|
|
421
|
+
afterVisibleChange: function(v) {
|
|
422
|
+
if (!v) {
|
|
423
|
+
modal.resolveHide();
|
|
424
|
+
}
|
|
425
|
+
!v && !modal.keepMounted && modal.remove();
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
muiDialog = function(modal) {
|
|
430
|
+
return {
|
|
431
|
+
open: modal.visible,
|
|
432
|
+
onClose: function() {
|
|
433
|
+
return modal.hide();
|
|
434
|
+
},
|
|
435
|
+
onExited: function() {
|
|
436
|
+
modal.resolveHide();
|
|
437
|
+
!modal.keepMounted && modal.remove();
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
bootstrapDialog = function(modal) {
|
|
442
|
+
return {
|
|
443
|
+
show: modal.visible,
|
|
444
|
+
onHide: function() {
|
|
445
|
+
return modal.hide();
|
|
446
|
+
},
|
|
447
|
+
onExited: function() {
|
|
448
|
+
modal.resolveHide();
|
|
449
|
+
!modal.keepMounted && modal.remove();
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
NiceModal = {
|
|
454
|
+
Provider,
|
|
455
|
+
ModalDef,
|
|
456
|
+
ModalHolder,
|
|
457
|
+
NiceModalContext,
|
|
458
|
+
create,
|
|
459
|
+
register,
|
|
460
|
+
getModal,
|
|
461
|
+
show,
|
|
462
|
+
hide,
|
|
463
|
+
remove,
|
|
464
|
+
useModal,
|
|
465
|
+
reducer,
|
|
466
|
+
antdModal,
|
|
467
|
+
antdDrawer,
|
|
468
|
+
muiDialog,
|
|
469
|
+
bootstrapDialog
|
|
470
|
+
};
|
|
471
|
+
esm_default = NiceModal;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
|
|
33
475
|
// src/types/payments.ts
|
|
34
476
|
var isNewCard, PaymentType, PaymentStatus;
|
|
35
477
|
var init_payments = __esm({
|
|
@@ -133,7 +575,7 @@ var init_errors = __esm({
|
|
|
133
575
|
var version;
|
|
134
576
|
var init_package = __esm({
|
|
135
577
|
"package.json"() {
|
|
136
|
-
version = "0.5.
|
|
578
|
+
version = "0.5.4";
|
|
137
579
|
}
|
|
138
580
|
});
|
|
139
581
|
|
|
@@ -259,28 +701,28 @@ var init_logger = __esm({
|
|
|
259
701
|
});
|
|
260
702
|
|
|
261
703
|
// src/context/SpreePayActionsContext.tsx
|
|
262
|
-
var
|
|
704
|
+
var import_react2, import_jsx_runtime, processLogger, SpreePayActionsContext, SpreePayProvider, useSpreePay, useSpreePaymentMethod, useSpreePayEnv, useSpreePayRegister;
|
|
263
705
|
var init_SpreePayActionsContext = __esm({
|
|
264
706
|
"src/context/SpreePayActionsContext.tsx"() {
|
|
265
707
|
"use strict";
|
|
266
|
-
|
|
708
|
+
import_react2 = require("react");
|
|
267
709
|
init_errors();
|
|
268
710
|
init_logger();
|
|
269
711
|
import_jsx_runtime = require("react/jsx-runtime");
|
|
270
712
|
processLogger = logger.child("process");
|
|
271
|
-
SpreePayActionsContext = (0,
|
|
713
|
+
SpreePayActionsContext = (0, import_react2.createContext)(void 0);
|
|
272
714
|
SpreePayProvider = ({ children, env }) => {
|
|
273
|
-
const processRef = (0,
|
|
274
|
-
const inFlightRef = (0,
|
|
275
|
-
const [selectedPaymentMethod, setSelectedPaymentMethod] = (0,
|
|
715
|
+
const processRef = (0, import_react2.useRef)(null);
|
|
716
|
+
const inFlightRef = (0, import_react2.useRef)(false);
|
|
717
|
+
const [selectedPaymentMethod, setSelectedPaymentMethod] = (0, import_react2.useState)({
|
|
276
718
|
type: "CREDIT_CARD" /* CREDIT_CARD */,
|
|
277
719
|
method: null
|
|
278
720
|
});
|
|
279
|
-
const [isInternalProcessing, setInternalProcessing] = (0,
|
|
280
|
-
const
|
|
721
|
+
const [isInternalProcessing, setInternalProcessing] = (0, import_react2.useState)(false);
|
|
722
|
+
const register2 = (0, import_react2.useCallback)((fn) => {
|
|
281
723
|
processRef.current = fn;
|
|
282
724
|
}, []);
|
|
283
|
-
const process = (0,
|
|
725
|
+
const process = (0, import_react2.useCallback)(
|
|
284
726
|
async (data) => {
|
|
285
727
|
if (!processRef.current) {
|
|
286
728
|
const error = new Error("SpreePay process function not registered");
|
|
@@ -330,14 +772,14 @@ var init_SpreePayActionsContext = __esm({
|
|
|
330
772
|
enabled: Boolean(selectedPaymentMethod.method),
|
|
331
773
|
isInternalProcessing,
|
|
332
774
|
process,
|
|
333
|
-
register,
|
|
775
|
+
register: register2,
|
|
334
776
|
selectedPaymentMethod,
|
|
335
777
|
setSelectedPaymentMethod
|
|
336
778
|
};
|
|
337
779
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpreePayActionsContext.Provider, { value, children });
|
|
338
780
|
};
|
|
339
781
|
useSpreePay = () => {
|
|
340
|
-
const ctx = (0,
|
|
782
|
+
const ctx = (0, import_react2.useContext)(SpreePayActionsContext);
|
|
341
783
|
if (!ctx) throw new Error("useSpreePay must be used within a SpreePayProvider");
|
|
342
784
|
return {
|
|
343
785
|
process: ctx.process,
|
|
@@ -347,7 +789,7 @@ var init_SpreePayActionsContext = __esm({
|
|
|
347
789
|
};
|
|
348
790
|
};
|
|
349
791
|
useSpreePaymentMethod = () => {
|
|
350
|
-
const ctx = (0,
|
|
792
|
+
const ctx = (0, import_react2.useContext)(SpreePayActionsContext);
|
|
351
793
|
if (!ctx) throw new Error("useSpreePay must be used within a SpreePayProvider");
|
|
352
794
|
return {
|
|
353
795
|
setSelectedPaymentMethod: ctx.setSelectedPaymentMethod,
|
|
@@ -356,12 +798,12 @@ var init_SpreePayActionsContext = __esm({
|
|
|
356
798
|
};
|
|
357
799
|
};
|
|
358
800
|
useSpreePayEnv = () => {
|
|
359
|
-
const ctx = (0,
|
|
801
|
+
const ctx = (0, import_react2.useContext)(SpreePayActionsContext);
|
|
360
802
|
if (!ctx) throw new Error("useSpreePay must be used within a SpreePayProvider");
|
|
361
803
|
return ctx.env;
|
|
362
804
|
};
|
|
363
805
|
useSpreePayRegister = () => {
|
|
364
|
-
const ctx = (0,
|
|
806
|
+
const ctx = (0, import_react2.useContext)(SpreePayActionsContext);
|
|
365
807
|
if (!ctx) throw new Error("useSpreePayRegister must be used within a SpreePayProvider");
|
|
366
808
|
return { register: ctx.register };
|
|
367
809
|
};
|
|
@@ -457,20 +899,20 @@ var init_config = __esm({
|
|
|
457
899
|
});
|
|
458
900
|
|
|
459
901
|
// src/context/StaticConfigContext.tsx
|
|
460
|
-
var
|
|
902
|
+
var import_react3, import_jsx_runtime2, StaticConfigContext, StaticConfigProvider, useStaticConfig;
|
|
461
903
|
var init_StaticConfigContext = __esm({
|
|
462
904
|
"src/context/StaticConfigContext.tsx"() {
|
|
463
905
|
"use strict";
|
|
464
906
|
"use client";
|
|
465
|
-
|
|
907
|
+
import_react3 = require("react");
|
|
466
908
|
init_logger();
|
|
467
909
|
init_SpreePayActionsContext();
|
|
468
910
|
init_config();
|
|
469
911
|
import_jsx_runtime2 = require("react/jsx-runtime");
|
|
470
|
-
StaticConfigContext = (0,
|
|
912
|
+
StaticConfigContext = (0, import_react3.createContext)(null);
|
|
471
913
|
StaticConfigProvider = ({ children, props }) => {
|
|
472
914
|
const { environment, tenantId } = useSpreePayEnv();
|
|
473
|
-
const staticConfig = (0,
|
|
915
|
+
const staticConfig = (0, import_react3.useMemo)(() => {
|
|
474
916
|
const envConfig = config[environment];
|
|
475
917
|
const isKnownTenant = tenantId in envConfig;
|
|
476
918
|
if (!isKnownTenant) {
|
|
@@ -482,11 +924,11 @@ var init_StaticConfigContext = __esm({
|
|
|
482
924
|
const appKey = isKnownTenant ? tenantId : "moca";
|
|
483
925
|
return envConfig[appKey];
|
|
484
926
|
}, [environment, tenantId]);
|
|
485
|
-
const value = (0,
|
|
927
|
+
const value = (0, import_react3.useMemo)(() => ({ staticConfig, appProps: props }), [staticConfig, props]);
|
|
486
928
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StaticConfigContext.Provider, { value, children });
|
|
487
929
|
};
|
|
488
930
|
useStaticConfig = () => {
|
|
489
|
-
const ctx = (0,
|
|
931
|
+
const ctx = (0, import_react3.useContext)(StaticConfigContext);
|
|
490
932
|
if (!ctx) throw new Error("useStaticConfig must be used within StaticConfigProvider");
|
|
491
933
|
return ctx;
|
|
492
934
|
};
|
|
@@ -531,17 +973,17 @@ function PortalContainerProvider({
|
|
|
531
973
|
container,
|
|
532
974
|
children
|
|
533
975
|
}) {
|
|
534
|
-
return
|
|
976
|
+
return import_react4.default.createElement(PortalContainerContext.Provider, { value: { container } }, children);
|
|
535
977
|
}
|
|
536
978
|
function usePortalContainer() {
|
|
537
|
-
return
|
|
979
|
+
return import_react4.default.useContext(PortalContainerContext).container;
|
|
538
980
|
}
|
|
539
|
-
var
|
|
981
|
+
var import_react4, PortalContainerContext;
|
|
540
982
|
var init_portal = __esm({
|
|
541
983
|
"src/ui/portal.ts"() {
|
|
542
984
|
"use strict";
|
|
543
|
-
|
|
544
|
-
PortalContainerContext =
|
|
985
|
+
import_react4 = __toESM(require("react"), 1);
|
|
986
|
+
PortalContainerContext = import_react4.default.createContext({ container: null });
|
|
545
987
|
}
|
|
546
988
|
});
|
|
547
989
|
|
|
@@ -636,18 +1078,18 @@ var init_dialog = __esm({
|
|
|
636
1078
|
});
|
|
637
1079
|
|
|
638
1080
|
// src/modals/Iframe3ds.tsx
|
|
639
|
-
var
|
|
1081
|
+
var import_react5, import_jsx_runtime4, Iframe3ds;
|
|
640
1082
|
var init_Iframe3ds = __esm({
|
|
641
1083
|
"src/modals/Iframe3ds.tsx"() {
|
|
642
1084
|
"use strict";
|
|
643
|
-
|
|
644
|
-
|
|
1085
|
+
import_react5 = require("react");
|
|
1086
|
+
init_esm();
|
|
645
1087
|
init_eventBus();
|
|
646
1088
|
init_dialog();
|
|
647
1089
|
import_jsx_runtime4 = require("react/jsx-runtime");
|
|
648
|
-
Iframe3ds =
|
|
649
|
-
const modal =
|
|
650
|
-
(0,
|
|
1090
|
+
Iframe3ds = esm_default.create(({ url }) => {
|
|
1091
|
+
const modal = useModal();
|
|
1092
|
+
(0, import_react5.useEffect)(() => {
|
|
651
1093
|
return bus.on("paymentIntent", (data) => {
|
|
652
1094
|
modal.resolve(data.paymentIntent);
|
|
653
1095
|
modal.remove();
|
|
@@ -1010,16 +1452,16 @@ var init_useSlapiBalance = __esm({
|
|
|
1010
1452
|
});
|
|
1011
1453
|
|
|
1012
1454
|
// src/context/LoginStatusContext.tsx
|
|
1013
|
-
var
|
|
1455
|
+
var import_react7, import_jsx_runtime5, LoginStatusContext, LoginStatusProvider, useIsLoggedIn;
|
|
1014
1456
|
var init_LoginStatusContext = __esm({
|
|
1015
1457
|
"src/context/LoginStatusContext.tsx"() {
|
|
1016
1458
|
"use strict";
|
|
1017
1459
|
"use client";
|
|
1018
|
-
|
|
1460
|
+
import_react7 = require("react");
|
|
1019
1461
|
import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1020
|
-
LoginStatusContext = (0,
|
|
1462
|
+
LoginStatusContext = (0, import_react7.createContext)(false);
|
|
1021
1463
|
LoginStatusProvider = ({ isLoggedIn, children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoginStatusContext.Provider, { value: isLoggedIn, children });
|
|
1022
|
-
useIsLoggedIn = () => (0,
|
|
1464
|
+
useIsLoggedIn = () => (0, import_react7.useContext)(LoginStatusContext);
|
|
1023
1465
|
}
|
|
1024
1466
|
});
|
|
1025
1467
|
|
|
@@ -1234,11 +1676,11 @@ var init_InfoBanner = __esm({
|
|
|
1234
1676
|
});
|
|
1235
1677
|
|
|
1236
1678
|
// src/components/common/PointsSwitch.tsx
|
|
1237
|
-
var
|
|
1679
|
+
var import_react8, import_jsx_runtime10, PointsSwitch;
|
|
1238
1680
|
var init_PointsSwitch = __esm({
|
|
1239
1681
|
"src/components/common/PointsSwitch.tsx"() {
|
|
1240
1682
|
"use strict";
|
|
1241
|
-
|
|
1683
|
+
import_react8 = require("react");
|
|
1242
1684
|
init_StaticConfigContext();
|
|
1243
1685
|
init_useSlapiBalance();
|
|
1244
1686
|
init_useSpreePayConfig();
|
|
@@ -1255,7 +1697,7 @@ var init_PointsSwitch = __esm({
|
|
|
1255
1697
|
const { balance } = useSlapiBalance();
|
|
1256
1698
|
const hasForeignCurrency = !!(currencyCode && exchangeRate && foreignCurrencyAmount);
|
|
1257
1699
|
const formatPointsValue = (usd) => hasForeignCurrency ? formatCurrency(usd / exchangeRate, currencyCode) : formatCurrency(usd);
|
|
1258
|
-
const id = (0,
|
|
1700
|
+
const id = (0, import_react8.useId)();
|
|
1259
1701
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
1260
1702
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1261
1703
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1936,11 +2378,11 @@ var init_input = __esm({
|
|
|
1936
2378
|
});
|
|
1937
2379
|
|
|
1938
2380
|
// ../../node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1939
|
-
var
|
|
2381
|
+
var React14, ReactDOM2, import_react_slot5, import_jsx_runtime35, NODES2, Primitive2;
|
|
1940
2382
|
var init_dist = __esm({
|
|
1941
2383
|
"../../node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive/dist/index.mjs"() {
|
|
1942
2384
|
"use strict";
|
|
1943
|
-
|
|
2385
|
+
React14 = __toESM(require("react"), 1);
|
|
1944
2386
|
ReactDOM2 = __toESM(require("react-dom"), 1);
|
|
1945
2387
|
import_react_slot5 = require("@radix-ui/react-slot");
|
|
1946
2388
|
import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -1965,7 +2407,7 @@ var init_dist = __esm({
|
|
|
1965
2407
|
];
|
|
1966
2408
|
Primitive2 = NODES2.reduce((primitive, node) => {
|
|
1967
2409
|
const Slot2 = (0, import_react_slot5.createSlot)(`Primitive.${node}`);
|
|
1968
|
-
const Node2 =
|
|
2410
|
+
const Node2 = React14.forwardRef((props, forwardedRef) => {
|
|
1969
2411
|
const { asChild, ...primitiveProps } = props;
|
|
1970
2412
|
const Comp = asChild ? Slot2 : node;
|
|
1971
2413
|
if (typeof window !== "undefined") {
|
|
@@ -1983,17 +2425,17 @@ var init_dist = __esm({
|
|
|
1983
2425
|
function isValidOrientation(orientation) {
|
|
1984
2426
|
return ORIENTATIONS.includes(orientation);
|
|
1985
2427
|
}
|
|
1986
|
-
var
|
|
2428
|
+
var React15, import_jsx_runtime36, NAME, DEFAULT_ORIENTATION, ORIENTATIONS, Separator, Root6;
|
|
1987
2429
|
var init_dist2 = __esm({
|
|
1988
2430
|
"../../node_modules/@radix-ui/react-separator/dist/index.mjs"() {
|
|
1989
2431
|
"use strict";
|
|
1990
|
-
|
|
2432
|
+
React15 = __toESM(require("react"), 1);
|
|
1991
2433
|
init_dist();
|
|
1992
2434
|
import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1993
2435
|
NAME = "Separator";
|
|
1994
2436
|
DEFAULT_ORIENTATION = "horizontal";
|
|
1995
2437
|
ORIENTATIONS = ["horizontal", "vertical"];
|
|
1996
|
-
Separator =
|
|
2438
|
+
Separator = React15.forwardRef((props, forwardedRef) => {
|
|
1997
2439
|
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
1998
2440
|
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
1999
2441
|
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
@@ -2050,10 +2492,10 @@ function useBaseERC20Token() {
|
|
|
2050
2492
|
const { address } = (0, import_wagmi2.useAccount)();
|
|
2051
2493
|
const baseClient = (0, import_wagmi2.usePublicClient)({ chainId: BASE_CHAIN_ID });
|
|
2052
2494
|
const defaultClient = (0, import_wagmi2.usePublicClient)();
|
|
2053
|
-
const [rows, setRows] =
|
|
2054
|
-
const [isLoading, setLoading] =
|
|
2055
|
-
const [error, setError] =
|
|
2056
|
-
|
|
2495
|
+
const [rows, setRows] = React16.useState([]);
|
|
2496
|
+
const [isLoading, setLoading] = React16.useState(false);
|
|
2497
|
+
const [error, setError] = React16.useState(null);
|
|
2498
|
+
React16.useEffect(() => {
|
|
2057
2499
|
let cancelled = false;
|
|
2058
2500
|
async function run() {
|
|
2059
2501
|
const client = baseClient ?? defaultClient;
|
|
@@ -2108,11 +2550,11 @@ function useBaseERC20Token() {
|
|
|
2108
2550
|
}, [address, baseClient, defaultClient]);
|
|
2109
2551
|
return { isLoading, error: error ?? null, erc20Balances: rows };
|
|
2110
2552
|
}
|
|
2111
|
-
var
|
|
2553
|
+
var React16, import_viem5, import_wagmi2;
|
|
2112
2554
|
var init_useBaseERC20Token = __esm({
|
|
2113
2555
|
"src/hooks/useBaseERC20Token.ts"() {
|
|
2114
2556
|
"use strict";
|
|
2115
|
-
|
|
2557
|
+
React16 = __toESM(require("react"), 1);
|
|
2116
2558
|
import_viem5 = require("viem");
|
|
2117
2559
|
import_wagmi2 = require("wagmi");
|
|
2118
2560
|
init_baseTokens();
|
|
@@ -2157,12 +2599,12 @@ var init_useBaseTokens = __esm({
|
|
|
2157
2599
|
});
|
|
2158
2600
|
|
|
2159
2601
|
// src/modals/CryptoSelectModal.tsx
|
|
2160
|
-
var
|
|
2602
|
+
var import_react18, import_jsx_runtime38, CryptoSelectModal;
|
|
2161
2603
|
var init_CryptoSelectModal = __esm({
|
|
2162
2604
|
"src/modals/CryptoSelectModal.tsx"() {
|
|
2163
2605
|
"use strict";
|
|
2164
|
-
|
|
2165
|
-
|
|
2606
|
+
import_react18 = require("react");
|
|
2607
|
+
init_esm();
|
|
2166
2608
|
init_input();
|
|
2167
2609
|
init_separator();
|
|
2168
2610
|
init_symbolLogos();
|
|
@@ -2172,13 +2614,13 @@ var init_CryptoSelectModal = __esm({
|
|
|
2172
2614
|
init_useBaseTokens();
|
|
2173
2615
|
init_dialog();
|
|
2174
2616
|
import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2175
|
-
CryptoSelectModal =
|
|
2176
|
-
const modal =
|
|
2617
|
+
CryptoSelectModal = esm_default.create(() => {
|
|
2618
|
+
const modal = useModal();
|
|
2177
2619
|
const { isLoading, error, erc20Balances } = useBaseERC20Token();
|
|
2178
2620
|
const { isLoadingNative, nativeError, nativeBalance } = useBaseNativeToken();
|
|
2179
2621
|
const { tokens, tokensIsLoading } = useBaseTokens();
|
|
2180
|
-
const [search, setSearch] = (0,
|
|
2181
|
-
const filteredCoins = (0,
|
|
2622
|
+
const [search, setSearch] = (0, import_react18.useState)("");
|
|
2623
|
+
const filteredCoins = (0, import_react18.useMemo)(() => {
|
|
2182
2624
|
return tokens.filter(
|
|
2183
2625
|
(coin) => coin.name.toLowerCase().includes(search.toLowerCase()) || coin.symbol.toLowerCase().includes(search.toLowerCase())
|
|
2184
2626
|
);
|
|
@@ -2282,16 +2724,16 @@ var init_CryptoSelectModal = __esm({
|
|
|
2282
2724
|
});
|
|
2283
2725
|
|
|
2284
2726
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
2285
|
-
var
|
|
2727
|
+
var import_jsx_runtime39, SelectCoinButton;
|
|
2286
2728
|
var init_SelectCoinButton = __esm({
|
|
2287
2729
|
"src/components/CryptoTab/Crypto/SelectCoinButton.tsx"() {
|
|
2288
2730
|
"use strict";
|
|
2289
|
-
|
|
2731
|
+
init_esm();
|
|
2290
2732
|
init_CryptoSelectModal();
|
|
2291
2733
|
import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2292
2734
|
SelectCoinButton = () => {
|
|
2293
2735
|
const openModal = () => {
|
|
2294
|
-
|
|
2736
|
+
esm_default.show(CryptoSelectModal);
|
|
2295
2737
|
};
|
|
2296
2738
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2297
2739
|
"button",
|
|
@@ -2338,11 +2780,11 @@ var init_SelectedCoin = __esm({
|
|
|
2338
2780
|
});
|
|
2339
2781
|
|
|
2340
2782
|
// src/components/CryptoTab/Crypto/Crypto.tsx
|
|
2341
|
-
var
|
|
2783
|
+
var import_react19, import_wagmi4, import_jsx_runtime41, Crypto;
|
|
2342
2784
|
var init_Crypto = __esm({
|
|
2343
2785
|
"src/components/CryptoTab/Crypto/Crypto.tsx"() {
|
|
2344
2786
|
"use strict";
|
|
2345
|
-
|
|
2787
|
+
import_react19 = require("react");
|
|
2346
2788
|
import_wagmi4 = require("wagmi");
|
|
2347
2789
|
init_SpreePayActionsContext();
|
|
2348
2790
|
init_useCryptoPayment();
|
|
@@ -2360,21 +2802,21 @@ var init_Crypto = __esm({
|
|
|
2360
2802
|
const { cryptoPayment } = useCryptoPayment();
|
|
2361
2803
|
const { spreePayConfig } = useSpreePayConfig();
|
|
2362
2804
|
const isWalletConnected = Boolean(address);
|
|
2363
|
-
const { register } = useSpreePayRegister();
|
|
2364
|
-
const handlePay = (0,
|
|
2805
|
+
const { register: register2 } = useSpreePayRegister();
|
|
2806
|
+
const handlePay = (0, import_react19.useCallback)(
|
|
2365
2807
|
async (data) => {
|
|
2366
2808
|
try {
|
|
2367
2809
|
const res = await cryptoPayment(data);
|
|
2368
2810
|
return settlePaymentResult(res, "Crypto payment failed");
|
|
2369
2811
|
} catch (e) {
|
|
2370
|
-
|
|
2812
|
+
throw toPaymentError(e, "Crypto payment failed");
|
|
2371
2813
|
}
|
|
2372
2814
|
},
|
|
2373
2815
|
[cryptoPayment]
|
|
2374
2816
|
);
|
|
2375
|
-
(0,
|
|
2376
|
-
|
|
2377
|
-
}, [
|
|
2817
|
+
(0, import_react19.useEffect)(() => {
|
|
2818
|
+
register2(handlePay);
|
|
2819
|
+
}, [register2, handlePay]);
|
|
2378
2820
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col items-baseline gap-4", children: [
|
|
2379
2821
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
2380
2822
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: "text-lg leading-7 font-medium text-(--brand-primary) md:text-[22px]", children: "Pay with Crypto" }),
|
|
@@ -2408,13 +2850,13 @@ function getCachedWagmiConfig(projectId, appName) {
|
|
|
2408
2850
|
}
|
|
2409
2851
|
return cfg2;
|
|
2410
2852
|
}
|
|
2411
|
-
var
|
|
2853
|
+
var import_react20, import_react_query, import_rainbowkit2, import_styles, import_wagmi5, import_chains, import_jsx_runtime42, queryClient, CHAINS, wagmiConfigCache, CryptoWrapper;
|
|
2412
2854
|
var init_CryptoWrapper = __esm({
|
|
2413
2855
|
"src/components/CryptoTab/Crypto/CryptoWrapper.tsx"() {
|
|
2414
2856
|
"use strict";
|
|
2415
|
-
|
|
2857
|
+
import_react20 = require("react");
|
|
2416
2858
|
import_react_query = require("@tanstack/react-query");
|
|
2417
|
-
|
|
2859
|
+
init_esm();
|
|
2418
2860
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
2419
2861
|
import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
2420
2862
|
import_wagmi5 = require("wagmi");
|
|
@@ -2429,12 +2871,12 @@ var init_CryptoWrapper = __esm({
|
|
|
2429
2871
|
CryptoWrapper = () => {
|
|
2430
2872
|
const isLoggedIn = useIsLoggedIn();
|
|
2431
2873
|
const { spreePayConfig, configIsLoading } = useSpreePayConfig();
|
|
2432
|
-
const wagmiConfig = (0,
|
|
2874
|
+
const wagmiConfig = (0, import_react20.useMemo)(() => {
|
|
2433
2875
|
if (!spreePayConfig) return null;
|
|
2434
2876
|
return getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
|
|
2435
2877
|
}, [spreePayConfig]);
|
|
2436
2878
|
if (!isLoggedIn || configIsLoading || !wagmiConfig) return null;
|
|
2437
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_wagmi5.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_rainbowkit2.RainbowKitProvider, { theme: (0, import_rainbowkit2.lightTheme)({ borderRadius: "large" }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_wagmi5.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_rainbowkit2.RainbowKitProvider, { theme: (0, import_rainbowkit2.lightTheme)({ borderRadius: "large" }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(esm_default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Crypto, {}) }) }) }) });
|
|
2438
2880
|
};
|
|
2439
2881
|
}
|
|
2440
2882
|
});
|
|
@@ -2481,11 +2923,11 @@ var init_CryptoTab2 = __esm({
|
|
|
2481
2923
|
});
|
|
2482
2924
|
|
|
2483
2925
|
// src/hooks/payments/useCryptoComPayment.ts
|
|
2484
|
-
var
|
|
2926
|
+
var cryptoComLogger, useCryptoComPayment;
|
|
2485
2927
|
var init_useCryptoComPayment = __esm({
|
|
2486
2928
|
"src/hooks/payments/useCryptoComPayment.ts"() {
|
|
2487
2929
|
"use strict";
|
|
2488
|
-
|
|
2930
|
+
init_esm();
|
|
2489
2931
|
init_SpreePayActionsContext();
|
|
2490
2932
|
init_Iframe3ds();
|
|
2491
2933
|
init_slapi();
|
|
@@ -2516,7 +2958,7 @@ var init_useCryptoComPayment = __esm({
|
|
|
2516
2958
|
let { status } = paymentResData;
|
|
2517
2959
|
if (paymentResData.redirectUrl) {
|
|
2518
2960
|
cryptoComLogger.debug("Opening CDC payment redirect", { paymentId: paymentResData.id });
|
|
2519
|
-
const paymentIntent = await
|
|
2961
|
+
const paymentIntent = await esm_default.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
2520
2962
|
cryptoComLogger.info("CDC payment redirect completed", { paymentIntent });
|
|
2521
2963
|
if (paymentIntent === "success") {
|
|
2522
2964
|
cryptoComLogger.debug("Validating CDC payment", { paymentId: paymentResData.id });
|
|
@@ -2619,11 +3061,11 @@ var init_Checkout = __esm({
|
|
|
2619
3061
|
});
|
|
2620
3062
|
|
|
2621
3063
|
// src/components/CryptoComTab/CryptoComTab.tsx
|
|
2622
|
-
var
|
|
3064
|
+
var import_react21, import_jsx_runtime45, CryptoComTab;
|
|
2623
3065
|
var init_CryptoComTab = __esm({
|
|
2624
3066
|
"src/components/CryptoComTab/CryptoComTab.tsx"() {
|
|
2625
3067
|
"use strict";
|
|
2626
|
-
|
|
3068
|
+
import_react21 = require("react");
|
|
2627
3069
|
init_SpreePayActionsContext();
|
|
2628
3070
|
init_useCryptoComPayment();
|
|
2629
3071
|
init_useSpreePayConfig();
|
|
@@ -2632,23 +3074,23 @@ var init_CryptoComTab = __esm({
|
|
|
2632
3074
|
init_Checkout();
|
|
2633
3075
|
import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2634
3076
|
CryptoComTab = () => {
|
|
2635
|
-
const { register } = useSpreePayRegister();
|
|
3077
|
+
const { register: register2 } = useSpreePayRegister();
|
|
2636
3078
|
const { cryptoComPayment } = useCryptoComPayment();
|
|
2637
3079
|
const { spreePayConfig } = useSpreePayConfig();
|
|
2638
|
-
const handlePay = (0,
|
|
3080
|
+
const handlePay = (0, import_react21.useCallback)(
|
|
2639
3081
|
async (data) => {
|
|
2640
3082
|
try {
|
|
2641
3083
|
const res = await cryptoComPayment(data);
|
|
2642
3084
|
return settlePaymentResult(res, "Crypto payment failed");
|
|
2643
3085
|
} catch (e) {
|
|
2644
|
-
|
|
3086
|
+
throw toPaymentError(e, "Crypto payment failed");
|
|
2645
3087
|
}
|
|
2646
3088
|
},
|
|
2647
3089
|
[cryptoComPayment]
|
|
2648
3090
|
);
|
|
2649
|
-
(0,
|
|
2650
|
-
|
|
2651
|
-
}, [
|
|
3091
|
+
(0, import_react21.useEffect)(() => {
|
|
3092
|
+
register2(handlePay);
|
|
3093
|
+
}, [register2, handlePay]);
|
|
2652
3094
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex w-full flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: [
|
|
2653
3095
|
spreePayConfig?.cryptoCom.infoMessage && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(InfoBanner, { message: spreePayConfig.cryptoCom.infoMessage }),
|
|
2654
3096
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Legal, {}),
|
|
@@ -2690,20 +3132,20 @@ __export(index_exports, {
|
|
|
2690
3132
|
module.exports = __toCommonJS(index_exports);
|
|
2691
3133
|
|
|
2692
3134
|
// src/SpreePay.tsx
|
|
2693
|
-
var
|
|
2694
|
-
|
|
3135
|
+
var import_react25 = require("react");
|
|
3136
|
+
init_esm();
|
|
2695
3137
|
var import_swr5 = require("swr");
|
|
2696
3138
|
|
|
2697
3139
|
// src/SpreePayContent.tsx
|
|
2698
|
-
var
|
|
3140
|
+
var import_react22 = require("react");
|
|
2699
3141
|
|
|
2700
3142
|
// src/components/CreditCardTab/CreditCardTab.tsx
|
|
2701
|
-
var
|
|
3143
|
+
var import_react17 = require("react");
|
|
2702
3144
|
init_SpreePayActionsContext();
|
|
2703
3145
|
init_StaticConfigContext();
|
|
2704
3146
|
|
|
2705
3147
|
// src/hooks/payments/useCardPayment.ts
|
|
2706
|
-
|
|
3148
|
+
init_esm();
|
|
2707
3149
|
init_SpreePayActionsContext();
|
|
2708
3150
|
init_StaticConfigContext();
|
|
2709
3151
|
init_Iframe3ds();
|
|
@@ -2773,7 +3215,7 @@ var useCardPayment = () => {
|
|
|
2773
3215
|
cardPaymentLogger.debug("Starting 3DS flow", {
|
|
2774
3216
|
paymentId: paymentResData.id
|
|
2775
3217
|
});
|
|
2776
|
-
const paymentIntent = await
|
|
3218
|
+
const paymentIntent = await esm_default.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
2777
3219
|
if (paymentIntent) {
|
|
2778
3220
|
cardPaymentLogger.debug("3DS completed, validating", {
|
|
2779
3221
|
paymentId: paymentResData.id,
|
|
@@ -2920,7 +3362,7 @@ init_logger();
|
|
|
2920
3362
|
init_useSpreePayConfig();
|
|
2921
3363
|
|
|
2922
3364
|
// src/hooks/payments/utils.ts
|
|
2923
|
-
|
|
3365
|
+
init_esm();
|
|
2924
3366
|
init_Iframe3ds();
|
|
2925
3367
|
init_slapi();
|
|
2926
3368
|
init_errors();
|
|
@@ -2968,7 +3410,7 @@ async function longPollCardStatus(paymentId) {
|
|
|
2968
3410
|
return detail.status;
|
|
2969
3411
|
}
|
|
2970
3412
|
if (!shown3ds && detail.card?.redirectUrl) {
|
|
2971
|
-
const paymentIntent = await
|
|
3413
|
+
const paymentIntent = await esm_default.show(Iframe3ds, { url: detail.card?.redirectUrl });
|
|
2972
3414
|
shown3ds = true;
|
|
2973
3415
|
if (paymentIntent) {
|
|
2974
3416
|
await SlapiPaymentService.validate3DS({ paymentId });
|
|
@@ -3089,7 +3531,7 @@ var usePointsPayment = (mode = "web2") => {
|
|
|
3089
3531
|
};
|
|
3090
3532
|
|
|
3091
3533
|
// src/hooks/payments/useSplitCardPayments.ts
|
|
3092
|
-
|
|
3534
|
+
init_esm();
|
|
3093
3535
|
init_SpreePayActionsContext();
|
|
3094
3536
|
init_StaticConfigContext();
|
|
3095
3537
|
init_Iframe3ds();
|
|
@@ -3153,7 +3595,7 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
3153
3595
|
});
|
|
3154
3596
|
if (paymentResData.redirectUrl) {
|
|
3155
3597
|
splitPaymentLogger.debug("Starting 3DS flow for card portion", { paymentId: paymentResData.id });
|
|
3156
|
-
const paymentIntent = await
|
|
3598
|
+
const paymentIntent = await esm_default.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
3157
3599
|
if (paymentIntent) {
|
|
3158
3600
|
splitPaymentLogger.debug("3DS completed, validating", { paymentId: paymentResData.id });
|
|
3159
3601
|
await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
@@ -3228,14 +3670,14 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
3228
3670
|
};
|
|
3229
3671
|
|
|
3230
3672
|
// src/hooks/useCards.ts
|
|
3231
|
-
var
|
|
3673
|
+
var import_react6 = require("react");
|
|
3232
3674
|
var import_swr2 = __toESM(require("swr"), 1);
|
|
3233
3675
|
init_SpreePayActionsContext();
|
|
3234
3676
|
var URL2 = "/v1/payments/cards";
|
|
3235
3677
|
var useCards = () => {
|
|
3236
3678
|
const { origin } = useSpreePayEnv();
|
|
3237
3679
|
const { data, isLoading, mutate } = (0, import_swr2.default)(origin ? `${URL2}?origin=${origin}` : URL2);
|
|
3238
|
-
const cards = (0,
|
|
3680
|
+
const cards = (0, import_react6.useMemo)(() => data?.data.filter((c) => c.active) ?? [], [data]);
|
|
3239
3681
|
return {
|
|
3240
3682
|
cards,
|
|
3241
3683
|
cardsIsLoading: isLoading,
|
|
@@ -3252,7 +3694,7 @@ init_split();
|
|
|
3252
3694
|
init_CheckoutButton();
|
|
3253
3695
|
|
|
3254
3696
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
3255
|
-
var
|
|
3697
|
+
var import_react11 = require("react");
|
|
3256
3698
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
|
3257
3699
|
var import_stripe_js = require("@stripe/stripe-js");
|
|
3258
3700
|
init_LoginStatusContext();
|
|
@@ -3261,13 +3703,13 @@ init_useSpreePayConfig();
|
|
|
3261
3703
|
init_InfoBanner();
|
|
3262
3704
|
|
|
3263
3705
|
// src/components/CreditCardTab/CreditCard/CardsList.tsx
|
|
3264
|
-
var
|
|
3706
|
+
var import_react9 = require("react");
|
|
3265
3707
|
init_utils();
|
|
3266
3708
|
init_slapi();
|
|
3267
3709
|
init_payments();
|
|
3268
3710
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3269
3711
|
var CardListItem = ({ card, isSelected, onSelect, onRemove }) => {
|
|
3270
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
3712
|
+
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
3271
3713
|
const removeDisabled = isSelected || isRemoving;
|
|
3272
3714
|
const handleRemove = async (e) => {
|
|
3273
3715
|
e.stopPropagation();
|
|
@@ -3332,7 +3774,7 @@ var CardListItem = ({ card, isSelected, onSelect, onRemove }) => {
|
|
|
3332
3774
|
};
|
|
3333
3775
|
var CardsList = ({ selectedCard, setCard, newCards, onRemoveNewCard }) => {
|
|
3334
3776
|
const { cards, cardsIsLoading, mutateCards } = useCards();
|
|
3335
|
-
const allCards = (0,
|
|
3777
|
+
const allCards = (0, import_react9.useMemo)(() => [...cards, ...newCards], [cards, newCards]);
|
|
3336
3778
|
const handleRemove = async (card) => {
|
|
3337
3779
|
if (isNewCard(card)) {
|
|
3338
3780
|
onRemoveNewCard(card);
|
|
@@ -3358,7 +3800,7 @@ var CardsList = ({ selectedCard, setCard, newCards, onRemoveNewCard }) => {
|
|
|
3358
3800
|
};
|
|
3359
3801
|
|
|
3360
3802
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
3361
|
-
var
|
|
3803
|
+
var import_react10 = require("react");
|
|
3362
3804
|
var import_react_stripe_js = require("@stripe/react-stripe-js");
|
|
3363
3805
|
|
|
3364
3806
|
// src/ui/button.tsx
|
|
@@ -3441,14 +3883,14 @@ var stripeElementClasses = {
|
|
|
3441
3883
|
focus: "border-(--b-tertiary) ring-(--b-tertiary)/50 ring-2"
|
|
3442
3884
|
};
|
|
3443
3885
|
var CreditCardForm = ({ cancel, saveCard }) => {
|
|
3444
|
-
const [cardError, setCardError] = (0,
|
|
3445
|
-
const [stripeStyles, setStripeStyles] = (0,
|
|
3446
|
-
const [shouldSaveCard, setShouldSaveCard] = (0,
|
|
3447
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
3886
|
+
const [cardError, setCardError] = (0, import_react10.useState)(void 0);
|
|
3887
|
+
const [stripeStyles, setStripeStyles] = (0, import_react10.useState)({});
|
|
3888
|
+
const [shouldSaveCard, setShouldSaveCard] = (0, import_react10.useState)(true);
|
|
3889
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react10.useState)(false);
|
|
3448
3890
|
const elements = (0, import_react_stripe_js.useElements)();
|
|
3449
3891
|
const stripe = (0, import_react_stripe_js.useStripe)();
|
|
3450
|
-
const [id] = (0,
|
|
3451
|
-
const formRef = (0,
|
|
3892
|
+
const [id] = (0, import_react10.useState)(() => crypto.randomUUID());
|
|
3893
|
+
const formRef = (0, import_react10.useCallback)((node) => {
|
|
3452
3894
|
if (!node) return;
|
|
3453
3895
|
const container = node.closest(".sl-spreepay");
|
|
3454
3896
|
if (!container) return;
|
|
@@ -3573,11 +4015,11 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
3573
4015
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
3574
4016
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3575
4017
|
var StripeWrapper = ({ onCancel, saveNewCard, publicKey }) => {
|
|
3576
|
-
const stripePromise = (0,
|
|
4018
|
+
const stripePromise = (0, import_react11.useMemo)(() => (0, import_stripe_js.loadStripe)(publicKey), [publicKey]);
|
|
3577
4019
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_stripe_js2.Elements, { stripe: stripePromise, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreditCardForm, { cancel: onCancel, saveCard: saveNewCard }) });
|
|
3578
4020
|
};
|
|
3579
4021
|
var CreditCard = ({ newCards, setNewCards }) => {
|
|
3580
|
-
const [showForm, setShowForm] = (0,
|
|
4022
|
+
const [showForm, setShowForm] = (0, import_react11.useState)(false);
|
|
3581
4023
|
const isLoggedIn = useIsLoggedIn();
|
|
3582
4024
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
3583
4025
|
const { spreePayConfig } = useSpreePayConfig();
|
|
@@ -3594,7 +4036,7 @@ var CreditCard = ({ newCards, setNewCards }) => {
|
|
|
3594
4036
|
setCard(newCard);
|
|
3595
4037
|
setShowForm(false);
|
|
3596
4038
|
};
|
|
3597
|
-
const removeNewCard = (0,
|
|
4039
|
+
const removeNewCard = (0, import_react11.useCallback)(
|
|
3598
4040
|
(card) => {
|
|
3599
4041
|
setNewCards((prev) => prev.filter((c) => c.id !== card.id));
|
|
3600
4042
|
},
|
|
@@ -3639,7 +4081,7 @@ var CreditCard = ({ newCards, setNewCards }) => {
|
|
|
3639
4081
|
};
|
|
3640
4082
|
|
|
3641
4083
|
// src/components/CreditCardTab/Points/Points.tsx
|
|
3642
|
-
var
|
|
4084
|
+
var import_react16 = require("react");
|
|
3643
4085
|
init_LoginStatusContext();
|
|
3644
4086
|
init_SpreePayActionsContext();
|
|
3645
4087
|
init_StaticConfigContext();
|
|
@@ -3647,7 +4089,7 @@ init_useSpreePayConfig();
|
|
|
3647
4089
|
init_common();
|
|
3648
4090
|
|
|
3649
4091
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
3650
|
-
var
|
|
4092
|
+
var import_react15 = require("react");
|
|
3651
4093
|
var import_airkit2 = require("@mocanetwork/airkit");
|
|
3652
4094
|
init_SpreePayActionsContext();
|
|
3653
4095
|
init_StaticConfigContext();
|
|
@@ -3657,7 +4099,7 @@ init_format();
|
|
|
3657
4099
|
init_logger();
|
|
3658
4100
|
|
|
3659
4101
|
// src/components/CreditCardTab/Points/PointsSelector.tsx
|
|
3660
|
-
var
|
|
4102
|
+
var import_react14 = require("react");
|
|
3661
4103
|
init_SpreePayActionsContext();
|
|
3662
4104
|
init_StaticConfigContext();
|
|
3663
4105
|
init_useSlapiBalance();
|
|
@@ -3685,10 +4127,10 @@ function Input({ className, type, ...props }) {
|
|
|
3685
4127
|
}
|
|
3686
4128
|
|
|
3687
4129
|
// src/ui/slider.tsx
|
|
3688
|
-
var
|
|
4130
|
+
var React13 = __toESM(require("react"), 1);
|
|
3689
4131
|
|
|
3690
4132
|
// ../../node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
3691
|
-
var
|
|
4133
|
+
var React12 = __toESM(require("react"), 1);
|
|
3692
4134
|
|
|
3693
4135
|
// ../../node_modules/@radix-ui/number/dist/index.mjs
|
|
3694
4136
|
function clamp(value, [min, max]) {
|
|
@@ -3707,7 +4149,7 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
3707
4149
|
}
|
|
3708
4150
|
|
|
3709
4151
|
// ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
3710
|
-
var
|
|
4152
|
+
var React3 = __toESM(require("react"), 1);
|
|
3711
4153
|
function setRef(ref, value) {
|
|
3712
4154
|
if (typeof ref === "function") {
|
|
3713
4155
|
return ref(value);
|
|
@@ -3740,41 +4182,41 @@ function composeRefs(...refs) {
|
|
|
3740
4182
|
};
|
|
3741
4183
|
}
|
|
3742
4184
|
function useComposedRefs(...refs) {
|
|
3743
|
-
return
|
|
4185
|
+
return React3.useCallback(composeRefs(...refs), refs);
|
|
3744
4186
|
}
|
|
3745
4187
|
|
|
3746
4188
|
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
3747
|
-
var
|
|
4189
|
+
var React4 = __toESM(require("react"), 1);
|
|
3748
4190
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3749
4191
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
3750
4192
|
let defaultContexts = [];
|
|
3751
4193
|
function createContext32(rootComponentName, defaultContext) {
|
|
3752
|
-
const BaseContext =
|
|
4194
|
+
const BaseContext = React4.createContext(defaultContext);
|
|
3753
4195
|
const index = defaultContexts.length;
|
|
3754
4196
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
3755
|
-
const
|
|
4197
|
+
const Provider2 = (props) => {
|
|
3756
4198
|
const { scope, children, ...context } = props;
|
|
3757
4199
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
3758
|
-
const value =
|
|
4200
|
+
const value = React4.useMemo(() => context, Object.values(context));
|
|
3759
4201
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Context.Provider, { value, children });
|
|
3760
4202
|
};
|
|
3761
|
-
|
|
4203
|
+
Provider2.displayName = rootComponentName + "Provider";
|
|
3762
4204
|
function useContext22(consumerName, scope) {
|
|
3763
4205
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
3764
|
-
const context =
|
|
4206
|
+
const context = React4.useContext(Context);
|
|
3765
4207
|
if (context) return context;
|
|
3766
4208
|
if (defaultContext !== void 0) return defaultContext;
|
|
3767
4209
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
3768
4210
|
}
|
|
3769
|
-
return [
|
|
4211
|
+
return [Provider2, useContext22];
|
|
3770
4212
|
}
|
|
3771
4213
|
const createScope = () => {
|
|
3772
4214
|
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
3773
|
-
return
|
|
4215
|
+
return React4.createContext(defaultContext);
|
|
3774
4216
|
});
|
|
3775
4217
|
return function useScope(scope) {
|
|
3776
4218
|
const contexts = scope?.[scopeName] || scopeContexts;
|
|
3777
|
-
return
|
|
4219
|
+
return React4.useMemo(
|
|
3778
4220
|
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
3779
4221
|
[scope, contexts]
|
|
3780
4222
|
);
|
|
@@ -3797,7 +4239,7 @@ function composeContextScopes(...scopes) {
|
|
|
3797
4239
|
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
3798
4240
|
return { ...nextScopes2, ...currentScope };
|
|
3799
4241
|
}, {});
|
|
3800
|
-
return
|
|
4242
|
+
return React4.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
3801
4243
|
};
|
|
3802
4244
|
};
|
|
3803
4245
|
createScope.scopeName = baseScope.scopeName;
|
|
@@ -3805,16 +4247,16 @@ function composeContextScopes(...scopes) {
|
|
|
3805
4247
|
}
|
|
3806
4248
|
|
|
3807
4249
|
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
3808
|
-
var
|
|
4250
|
+
var React6 = __toESM(require("react"), 1);
|
|
3809
4251
|
|
|
3810
4252
|
// ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
3811
|
-
var
|
|
3812
|
-
var useLayoutEffect2 = globalThis?.document ?
|
|
4253
|
+
var React5 = __toESM(require("react"), 1);
|
|
4254
|
+
var useLayoutEffect2 = globalThis?.document ? React5.useLayoutEffect : () => {
|
|
3813
4255
|
};
|
|
3814
4256
|
|
|
3815
4257
|
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
3816
4258
|
var React22 = __toESM(require("react"), 1);
|
|
3817
|
-
var useInsertionEffect =
|
|
4259
|
+
var useInsertionEffect = React6[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
3818
4260
|
function useControllableState({
|
|
3819
4261
|
prop,
|
|
3820
4262
|
defaultProp,
|
|
@@ -3829,8 +4271,8 @@ function useControllableState({
|
|
|
3829
4271
|
const isControlled = prop !== void 0;
|
|
3830
4272
|
const value = isControlled ? prop : uncontrolledProp;
|
|
3831
4273
|
if (true) {
|
|
3832
|
-
const isControlledRef =
|
|
3833
|
-
|
|
4274
|
+
const isControlledRef = React6.useRef(prop !== void 0);
|
|
4275
|
+
React6.useEffect(() => {
|
|
3834
4276
|
const wasControlled = isControlledRef.current;
|
|
3835
4277
|
if (wasControlled !== isControlled) {
|
|
3836
4278
|
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
@@ -3842,7 +4284,7 @@ function useControllableState({
|
|
|
3842
4284
|
isControlledRef.current = isControlled;
|
|
3843
4285
|
}, [isControlled, caller]);
|
|
3844
4286
|
}
|
|
3845
|
-
const setValue =
|
|
4287
|
+
const setValue = React6.useCallback(
|
|
3846
4288
|
(nextValue) => {
|
|
3847
4289
|
if (isControlled) {
|
|
3848
4290
|
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
@@ -3861,13 +4303,13 @@ function useUncontrolledState({
|
|
|
3861
4303
|
defaultProp,
|
|
3862
4304
|
onChange
|
|
3863
4305
|
}) {
|
|
3864
|
-
const [value, setValue] =
|
|
3865
|
-
const prevValueRef =
|
|
3866
|
-
const onChangeRef =
|
|
4306
|
+
const [value, setValue] = React6.useState(defaultProp);
|
|
4307
|
+
const prevValueRef = React6.useRef(value);
|
|
4308
|
+
const onChangeRef = React6.useRef(onChange);
|
|
3867
4309
|
useInsertionEffect(() => {
|
|
3868
4310
|
onChangeRef.current = onChange;
|
|
3869
4311
|
}, [onChange]);
|
|
3870
|
-
|
|
4312
|
+
React6.useEffect(() => {
|
|
3871
4313
|
if (prevValueRef.current !== value) {
|
|
3872
4314
|
onChangeRef.current?.(value);
|
|
3873
4315
|
prevValueRef.current = value;
|
|
@@ -3880,19 +4322,19 @@ function isFunction(value) {
|
|
|
3880
4322
|
}
|
|
3881
4323
|
|
|
3882
4324
|
// ../../node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
3883
|
-
var
|
|
4325
|
+
var React7 = __toESM(require("react"), 1);
|
|
3884
4326
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3885
|
-
var DirectionContext =
|
|
4327
|
+
var DirectionContext = React7.createContext(void 0);
|
|
3886
4328
|
function useDirection(localDir) {
|
|
3887
|
-
const globalDir =
|
|
4329
|
+
const globalDir = React7.useContext(DirectionContext);
|
|
3888
4330
|
return localDir || globalDir || "ltr";
|
|
3889
4331
|
}
|
|
3890
4332
|
|
|
3891
4333
|
// ../../node_modules/@radix-ui/react-use-previous/dist/index.mjs
|
|
3892
|
-
var
|
|
4334
|
+
var React8 = __toESM(require("react"), 1);
|
|
3893
4335
|
function usePrevious(value) {
|
|
3894
|
-
const ref =
|
|
3895
|
-
return
|
|
4336
|
+
const ref = React8.useRef({ value, previous: value });
|
|
4337
|
+
return React8.useMemo(() => {
|
|
3896
4338
|
if (ref.current.value !== value) {
|
|
3897
4339
|
ref.current.previous = ref.current.value;
|
|
3898
4340
|
ref.current.value = value;
|
|
@@ -3902,9 +4344,9 @@ function usePrevious(value) {
|
|
|
3902
4344
|
}
|
|
3903
4345
|
|
|
3904
4346
|
// ../../node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
3905
|
-
var
|
|
4347
|
+
var React9 = __toESM(require("react"), 1);
|
|
3906
4348
|
function useSize(element) {
|
|
3907
|
-
const [size, setSize] =
|
|
4349
|
+
const [size, setSize] = React9.useState(void 0);
|
|
3908
4350
|
useLayoutEffect2(() => {
|
|
3909
4351
|
if (element) {
|
|
3910
4352
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
@@ -3939,7 +4381,7 @@ function useSize(element) {
|
|
|
3939
4381
|
}
|
|
3940
4382
|
|
|
3941
4383
|
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
3942
|
-
var
|
|
4384
|
+
var React10 = __toESM(require("react"), 1);
|
|
3943
4385
|
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
3944
4386
|
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
3945
4387
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -3964,7 +4406,7 @@ var NODES = [
|
|
|
3964
4406
|
];
|
|
3965
4407
|
var Primitive = NODES.reduce((primitive, node) => {
|
|
3966
4408
|
const Slot2 = (0, import_react_slot2.createSlot)(`Primitive.${node}`);
|
|
3967
|
-
const Node2 =
|
|
4409
|
+
const Node2 = React10.forwardRef((props, forwardedRef) => {
|
|
3968
4410
|
const { asChild, ...primitiveProps } = props;
|
|
3969
4411
|
const Comp = asChild ? Slot2 : node;
|
|
3970
4412
|
if (typeof window !== "undefined") {
|
|
@@ -3977,10 +4419,10 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
3977
4419
|
}, {});
|
|
3978
4420
|
|
|
3979
4421
|
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
3980
|
-
var
|
|
4422
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
3981
4423
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
3982
4424
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3983
|
-
var
|
|
4425
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
3984
4426
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
3985
4427
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3986
4428
|
function createCollection(name) {
|
|
@@ -3992,14 +4434,14 @@ function createCollection(name) {
|
|
|
3992
4434
|
);
|
|
3993
4435
|
const CollectionProvider = (props) => {
|
|
3994
4436
|
const { scope, children } = props;
|
|
3995
|
-
const ref =
|
|
3996
|
-
const itemMap =
|
|
4437
|
+
const ref = import_react12.default.useRef(null);
|
|
4438
|
+
const itemMap = import_react12.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
3997
4439
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
3998
4440
|
};
|
|
3999
4441
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
4000
4442
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
4001
4443
|
const CollectionSlotImpl = (0, import_react_slot3.createSlot)(COLLECTION_SLOT_NAME);
|
|
4002
|
-
const CollectionSlot =
|
|
4444
|
+
const CollectionSlot = import_react12.default.forwardRef(
|
|
4003
4445
|
(props, forwardedRef) => {
|
|
4004
4446
|
const { scope, children } = props;
|
|
4005
4447
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
@@ -4011,13 +4453,13 @@ function createCollection(name) {
|
|
|
4011
4453
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
4012
4454
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
4013
4455
|
const CollectionItemSlotImpl = (0, import_react_slot3.createSlot)(ITEM_SLOT_NAME);
|
|
4014
|
-
const CollectionItemSlot =
|
|
4456
|
+
const CollectionItemSlot = import_react12.default.forwardRef(
|
|
4015
4457
|
(props, forwardedRef) => {
|
|
4016
4458
|
const { scope, children, ...itemData } = props;
|
|
4017
|
-
const ref =
|
|
4459
|
+
const ref = import_react12.default.useRef(null);
|
|
4018
4460
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
4019
4461
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
4020
|
-
|
|
4462
|
+
import_react12.default.useEffect(() => {
|
|
4021
4463
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
4022
4464
|
return () => void context.itemMap.delete(ref);
|
|
4023
4465
|
});
|
|
@@ -4027,7 +4469,7 @@ function createCollection(name) {
|
|
|
4027
4469
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
4028
4470
|
function useCollection2(scope) {
|
|
4029
4471
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
4030
|
-
const getItems =
|
|
4472
|
+
const getItems = import_react12.default.useCallback(() => {
|
|
4031
4473
|
const collectionNode = context.collectionRef.current;
|
|
4032
4474
|
if (!collectionNode) return [];
|
|
4033
4475
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
@@ -4062,7 +4504,7 @@ var [createSliderContext, createSliderScope] = createContextScope(SLIDER_NAME, [
|
|
|
4062
4504
|
createCollectionScope
|
|
4063
4505
|
]);
|
|
4064
4506
|
var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
4065
|
-
var Slider =
|
|
4507
|
+
var Slider = React12.forwardRef(
|
|
4066
4508
|
(props, forwardedRef) => {
|
|
4067
4509
|
const {
|
|
4068
4510
|
name,
|
|
@@ -4082,8 +4524,8 @@ var Slider = React11.forwardRef(
|
|
|
4082
4524
|
form,
|
|
4083
4525
|
...sliderProps
|
|
4084
4526
|
} = props;
|
|
4085
|
-
const thumbRefs =
|
|
4086
|
-
const valueIndexToChangeRef =
|
|
4527
|
+
const thumbRefs = React12.useRef(/* @__PURE__ */ new Set());
|
|
4528
|
+
const valueIndexToChangeRef = React12.useRef(0);
|
|
4087
4529
|
const isHorizontal = orientation === "horizontal";
|
|
4088
4530
|
const SliderOrientation = isHorizontal ? SliderHorizontal : SliderVertical;
|
|
4089
4531
|
const [values = [], setValues] = useControllableState({
|
|
@@ -4095,7 +4537,7 @@ var Slider = React11.forwardRef(
|
|
|
4095
4537
|
onValueChange(value2);
|
|
4096
4538
|
}
|
|
4097
4539
|
});
|
|
4098
|
-
const valuesBeforeSlideStartRef =
|
|
4540
|
+
const valuesBeforeSlideStartRef = React12.useRef(values);
|
|
4099
4541
|
function handleSlideStart(value2) {
|
|
4100
4542
|
const closestIndex = getClosestValueIndex(values, value2);
|
|
4101
4543
|
updateValues(value2, closestIndex);
|
|
@@ -4180,7 +4622,7 @@ var [SliderOrientationProvider, useSliderOrientationContext] = createSliderConte
|
|
|
4180
4622
|
size: "width",
|
|
4181
4623
|
direction: 1
|
|
4182
4624
|
});
|
|
4183
|
-
var SliderHorizontal =
|
|
4625
|
+
var SliderHorizontal = React12.forwardRef(
|
|
4184
4626
|
(props, forwardedRef) => {
|
|
4185
4627
|
const {
|
|
4186
4628
|
min,
|
|
@@ -4193,9 +4635,9 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
4193
4635
|
onStepKeyDown,
|
|
4194
4636
|
...sliderProps
|
|
4195
4637
|
} = props;
|
|
4196
|
-
const [slider, setSlider] =
|
|
4638
|
+
const [slider, setSlider] = React12.useState(null);
|
|
4197
4639
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setSlider(node));
|
|
4198
|
-
const rectRef =
|
|
4640
|
+
const rectRef = React12.useRef(void 0);
|
|
4199
4641
|
const direction = useDirection(dir);
|
|
4200
4642
|
const isDirectionLTR = direction === "ltr";
|
|
4201
4643
|
const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
|
|
@@ -4249,7 +4691,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
4249
4691
|
);
|
|
4250
4692
|
}
|
|
4251
4693
|
);
|
|
4252
|
-
var SliderVertical =
|
|
4694
|
+
var SliderVertical = React12.forwardRef(
|
|
4253
4695
|
(props, forwardedRef) => {
|
|
4254
4696
|
const {
|
|
4255
4697
|
min,
|
|
@@ -4261,9 +4703,9 @@ var SliderVertical = React11.forwardRef(
|
|
|
4261
4703
|
onStepKeyDown,
|
|
4262
4704
|
...sliderProps
|
|
4263
4705
|
} = props;
|
|
4264
|
-
const sliderRef =
|
|
4706
|
+
const sliderRef = React12.useRef(null);
|
|
4265
4707
|
const ref = useComposedRefs(forwardedRef, sliderRef);
|
|
4266
|
-
const rectRef =
|
|
4708
|
+
const rectRef = React12.useRef(void 0);
|
|
4267
4709
|
const isSlidingFromBottom = !inverted;
|
|
4268
4710
|
function getValueFromPointer(pointerPosition) {
|
|
4269
4711
|
const rect = rectRef.current || sliderRef.current.getBoundingClientRect();
|
|
@@ -4314,7 +4756,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
4314
4756
|
);
|
|
4315
4757
|
}
|
|
4316
4758
|
);
|
|
4317
|
-
var SliderImpl =
|
|
4759
|
+
var SliderImpl = React12.forwardRef(
|
|
4318
4760
|
(props, forwardedRef) => {
|
|
4319
4761
|
const {
|
|
4320
4762
|
__scopeSlider,
|
|
@@ -4370,7 +4812,7 @@ var SliderImpl = React11.forwardRef(
|
|
|
4370
4812
|
}
|
|
4371
4813
|
);
|
|
4372
4814
|
var TRACK_NAME = "SliderTrack";
|
|
4373
|
-
var SliderTrack =
|
|
4815
|
+
var SliderTrack = React12.forwardRef(
|
|
4374
4816
|
(props, forwardedRef) => {
|
|
4375
4817
|
const { __scopeSlider, ...trackProps } = props;
|
|
4376
4818
|
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
@@ -4387,12 +4829,12 @@ var SliderTrack = React11.forwardRef(
|
|
|
4387
4829
|
);
|
|
4388
4830
|
SliderTrack.displayName = TRACK_NAME;
|
|
4389
4831
|
var RANGE_NAME = "SliderRange";
|
|
4390
|
-
var SliderRange =
|
|
4832
|
+
var SliderRange = React12.forwardRef(
|
|
4391
4833
|
(props, forwardedRef) => {
|
|
4392
4834
|
const { __scopeSlider, ...rangeProps } = props;
|
|
4393
4835
|
const context = useSliderContext(RANGE_NAME, __scopeSlider);
|
|
4394
4836
|
const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
|
|
4395
|
-
const ref =
|
|
4837
|
+
const ref = React12.useRef(null);
|
|
4396
4838
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
4397
4839
|
const valuesCount = context.values.length;
|
|
4398
4840
|
const percentages = context.values.map(
|
|
@@ -4418,24 +4860,24 @@ var SliderRange = React11.forwardRef(
|
|
|
4418
4860
|
);
|
|
4419
4861
|
SliderRange.displayName = RANGE_NAME;
|
|
4420
4862
|
var THUMB_NAME = "SliderThumb";
|
|
4421
|
-
var SliderThumb =
|
|
4863
|
+
var SliderThumb = React12.forwardRef(
|
|
4422
4864
|
(props, forwardedRef) => {
|
|
4423
4865
|
const getItems = useCollection(props.__scopeSlider);
|
|
4424
|
-
const [thumb, setThumb] =
|
|
4866
|
+
const [thumb, setThumb] = React12.useState(null);
|
|
4425
4867
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
4426
|
-
const index =
|
|
4868
|
+
const index = React12.useMemo(
|
|
4427
4869
|
() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
|
|
4428
4870
|
[getItems, thumb]
|
|
4429
4871
|
);
|
|
4430
4872
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SliderThumbImpl, { ...props, ref: composedRefs, index });
|
|
4431
4873
|
}
|
|
4432
4874
|
);
|
|
4433
|
-
var SliderThumbImpl =
|
|
4875
|
+
var SliderThumbImpl = React12.forwardRef(
|
|
4434
4876
|
(props, forwardedRef) => {
|
|
4435
4877
|
const { __scopeSlider, index, name, ...thumbProps } = props;
|
|
4436
4878
|
const context = useSliderContext(THUMB_NAME, __scopeSlider);
|
|
4437
4879
|
const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
|
|
4438
|
-
const [thumb, setThumb] =
|
|
4880
|
+
const [thumb, setThumb] = React12.useState(null);
|
|
4439
4881
|
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
4440
4882
|
const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
|
|
4441
4883
|
const size = useSize(thumb);
|
|
@@ -4444,7 +4886,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
4444
4886
|
const label = getLabel(index, context.values.length);
|
|
4445
4887
|
const orientationSize = size?.[orientation.size];
|
|
4446
4888
|
const thumbInBoundsOffset = orientationSize ? getThumbInBoundsOffset(orientationSize, percent, orientation.direction) : 0;
|
|
4447
|
-
|
|
4889
|
+
React12.useEffect(() => {
|
|
4448
4890
|
if (thumb) {
|
|
4449
4891
|
context.thumbs.add(thumb);
|
|
4450
4892
|
return () => {
|
|
@@ -4497,12 +4939,12 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
4497
4939
|
);
|
|
4498
4940
|
SliderThumb.displayName = THUMB_NAME;
|
|
4499
4941
|
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
4500
|
-
var SliderBubbleInput =
|
|
4942
|
+
var SliderBubbleInput = React12.forwardRef(
|
|
4501
4943
|
({ __scopeSlider, value, ...props }, forwardedRef) => {
|
|
4502
|
-
const ref =
|
|
4944
|
+
const ref = React12.useRef(null);
|
|
4503
4945
|
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
4504
4946
|
const prevValue = usePrevious(value);
|
|
4505
|
-
|
|
4947
|
+
React12.useEffect(() => {
|
|
4506
4948
|
const input = ref.current;
|
|
4507
4949
|
if (!input) return;
|
|
4508
4950
|
const inputProto = window.HTMLInputElement.prototype;
|
|
@@ -4593,7 +5035,7 @@ init_utils2();
|
|
|
4593
5035
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4594
5036
|
function Slider2(props) {
|
|
4595
5037
|
const { className, defaultValue, value, min = 0, max = 100, ...rest } = props;
|
|
4596
|
-
const _values =
|
|
5038
|
+
const _values = React13.useMemo(
|
|
4597
5039
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
4598
5040
|
[value, defaultValue, min, max]
|
|
4599
5041
|
);
|
|
@@ -4660,7 +5102,7 @@ var PointsSelector = (props) => {
|
|
|
4660
5102
|
const maxByAmount = pointsConversionRatio && pointsConversionRatio > 0 ? (amount ?? 0) / pointsConversionRatio : 0;
|
|
4661
5103
|
const max = Math.min(maxByAmount, balance?.availablePoints ?? 0);
|
|
4662
5104
|
const step = 10;
|
|
4663
|
-
const [splitTokens, setSplitTokens] = (0,
|
|
5105
|
+
const [splitTokens, setSplitTokens] = (0, import_react14.useState)(0);
|
|
4664
5106
|
const usdAmount = getSplitAmount(amount ?? 0, splitTokens, pointsConversionRatio);
|
|
4665
5107
|
const pointsValue = String(Math.round(splitTokens));
|
|
4666
5108
|
const usdWithFee = usdAmount + getTransactionFee(usdAmount, transactionFeePercentage);
|
|
@@ -4758,14 +5200,14 @@ var SplitBlock = (props) => {
|
|
|
4758
5200
|
const { spreePayConfig } = useSpreePayConfig();
|
|
4759
5201
|
const { appProps } = useStaticConfig();
|
|
4760
5202
|
const { currencyCode, exchangeRate, foreignCurrencyAmount } = appProps;
|
|
4761
|
-
const [address, setAddress] = (0,
|
|
4762
|
-
const [walletReady, setWalletReady] = (0,
|
|
5203
|
+
const [address, setAddress] = (0, import_react15.useState)(null);
|
|
5204
|
+
const [walletReady, setWalletReady] = (0, import_react15.useState)(false);
|
|
4763
5205
|
const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
|
|
4764
5206
|
const { useWeb3Points, environment } = useSpreePayEnv();
|
|
4765
5207
|
const hasForeignCurrency = !!(currencyCode && exchangeRate && foreignCurrencyAmount);
|
|
4766
5208
|
const formatPointsValue = (usd) => hasForeignCurrency ? formatCurrency(usd / exchangeRate, currencyCode) : formatCurrency(usd);
|
|
4767
|
-
const prevPointsChainRef = (0,
|
|
4768
|
-
const initWallet = (0,
|
|
5209
|
+
const prevPointsChainRef = (0, import_react15.useRef)(spreePayConfig?.pointsChain);
|
|
5210
|
+
const initWallet = (0, import_react15.useCallback)(
|
|
4769
5211
|
async (pointsChain) => {
|
|
4770
5212
|
if (!pointsChain) return;
|
|
4771
5213
|
try {
|
|
@@ -4788,7 +5230,7 @@ var SplitBlock = (props) => {
|
|
|
4788
5230
|
},
|
|
4789
5231
|
[onToggle, environment]
|
|
4790
5232
|
);
|
|
4791
|
-
(0,
|
|
5233
|
+
(0, import_react15.useEffect)(() => {
|
|
4792
5234
|
if (!useWeb3Points) return;
|
|
4793
5235
|
const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
|
|
4794
5236
|
prevPointsChainRef.current = spreePayConfig?.pointsChain;
|
|
@@ -4819,8 +5261,8 @@ var SplitBlock = (props) => {
|
|
|
4819
5261
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4820
5262
|
var Points = () => {
|
|
4821
5263
|
const isLoggedIn = useIsLoggedIn();
|
|
4822
|
-
const [usePoints, setUsePoints] = (0,
|
|
4823
|
-
const [selectedPointsType, setSelectedPointsType] = (0,
|
|
5264
|
+
const [usePoints, setUsePoints] = (0, import_react16.useState)(false);
|
|
5265
|
+
const [selectedPointsType, setSelectedPointsType] = (0, import_react16.useState)(null);
|
|
4824
5266
|
const { setSelectedPaymentMethod, selectedPaymentMethod } = useSpreePaymentMethod();
|
|
4825
5267
|
const { spreePayConfig } = useSpreePayConfig();
|
|
4826
5268
|
const { appProps } = useStaticConfig();
|
|
@@ -4859,15 +5301,15 @@ var CreditCardTab = () => {
|
|
|
4859
5301
|
const { useWeb3Points } = useSpreePayEnv();
|
|
4860
5302
|
const { appProps } = useStaticConfig();
|
|
4861
5303
|
const { spreePayConfig } = useSpreePayConfig();
|
|
4862
|
-
const { register } = useSpreePayRegister();
|
|
5304
|
+
const { register: register2 } = useSpreePayRegister();
|
|
4863
5305
|
const { cards, mutateCards } = useCards();
|
|
4864
5306
|
const { mutateBalance } = useSlapiBalance();
|
|
4865
|
-
const [newCards, setNewCards] = (0,
|
|
5307
|
+
const [newCards, setNewCards] = (0, import_react17.useState)([]);
|
|
4866
5308
|
const isWeb3Enabled = Boolean(useWeb3Points);
|
|
4867
5309
|
const { cardPayment } = useCardPayment();
|
|
4868
5310
|
const { splitPayment } = useSplitCardPayments(isWeb3Enabled ? "web3" : "web2");
|
|
4869
5311
|
const { pointsPayment } = usePointsPayment(isWeb3Enabled ? "web3" : "web2");
|
|
4870
|
-
const handlePay = (0,
|
|
5312
|
+
const handlePay = (0, import_react17.useCallback)(
|
|
4871
5313
|
async (data) => {
|
|
4872
5314
|
const pointsAmount = selectedPaymentMethod.pointsAmount ?? 0;
|
|
4873
5315
|
const usdAmount = getSplitAmount(appProps.amount ?? 0, pointsAmount, spreePayConfig?.pointsConversionRatio);
|
|
@@ -4885,12 +5327,12 @@ var CreditCardTab = () => {
|
|
|
4885
5327
|
}
|
|
4886
5328
|
return settlePaymentResult(res, failureMessage, failureCode);
|
|
4887
5329
|
} catch (e) {
|
|
4888
|
-
|
|
5330
|
+
throw toPaymentError(e, failureMessage, failureCode);
|
|
4889
5331
|
} finally {
|
|
4890
|
-
mutateBalance();
|
|
5332
|
+
mutateBalance().catch(() => void 0);
|
|
4891
5333
|
if (selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && selectedPaymentMethod.method && isNewCard(selectedPaymentMethod.method)) {
|
|
4892
5334
|
const knownIds = new Set(cards.map((c) => c.id));
|
|
4893
|
-
const updated = await mutateCards();
|
|
5335
|
+
const updated = await mutateCards().catch(() => void 0);
|
|
4894
5336
|
const newSavedCard = (updated?.data ?? []).find((c) => c.active && !knownIds.has(c.id));
|
|
4895
5337
|
setSelectedPaymentMethod({
|
|
4896
5338
|
...selectedPaymentMethod,
|
|
@@ -4899,7 +5341,7 @@ var CreditCardTab = () => {
|
|
|
4899
5341
|
});
|
|
4900
5342
|
setNewCards([]);
|
|
4901
5343
|
} else {
|
|
4902
|
-
mutateCards();
|
|
5344
|
+
mutateCards().catch(() => void 0);
|
|
4903
5345
|
}
|
|
4904
5346
|
}
|
|
4905
5347
|
},
|
|
@@ -4916,9 +5358,9 @@ var CreditCardTab = () => {
|
|
|
4916
5358
|
mutateBalance
|
|
4917
5359
|
]
|
|
4918
5360
|
);
|
|
4919
|
-
(0,
|
|
4920
|
-
|
|
4921
|
-
}, [
|
|
5361
|
+
(0, import_react17.useEffect)(() => {
|
|
5362
|
+
register2(handlePay);
|
|
5363
|
+
}, [register2, handlePay]);
|
|
4922
5364
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
4923
5365
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CreditCard, { newCards, setNewCards }) }),
|
|
4924
5366
|
!spreePayConfig?.creditCard.hidePoints && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 pt-5 pb-5 md:px-7 md:pt-6 md:pb-7", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Points, {}) }),
|
|
@@ -5002,8 +5444,8 @@ var TabButtons = (props) => {
|
|
|
5002
5444
|
init_LoginStatusContext();
|
|
5003
5445
|
init_SpreePayActionsContext();
|
|
5004
5446
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5005
|
-
var CryptoTab2 = (0,
|
|
5006
|
-
var CryptoComTab2 = (0,
|
|
5447
|
+
var CryptoTab2 = (0, import_react22.lazy)(() => Promise.resolve().then(() => (init_CryptoTab2(), CryptoTab_exports)).then((module2) => ({ default: module2.CryptoTab })));
|
|
5448
|
+
var CryptoComTab2 = (0, import_react22.lazy)(
|
|
5007
5449
|
() => Promise.resolve().then(() => (init_CryptoComTab2(), CryptoComTab_exports)).then((module2) => ({ default: module2.CryptoComTab }))
|
|
5008
5450
|
);
|
|
5009
5451
|
var TabLoadingFallback = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex items-center justify-center px-5 py-8 md:px-7", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
@@ -5013,7 +5455,7 @@ var TabLoadingFallback = () => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("di
|
|
|
5013
5455
|
var SpreePayContent = () => {
|
|
5014
5456
|
const isLoggedIn = useIsLoggedIn();
|
|
5015
5457
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
5016
|
-
(0,
|
|
5458
|
+
(0, import_react22.useEffect)(() => {
|
|
5017
5459
|
if (!isLoggedIn) {
|
|
5018
5460
|
setSelectedPaymentMethod({ type: "CREDIT_CARD" /* CREDIT_CARD */, method: null });
|
|
5019
5461
|
}
|
|
@@ -5024,7 +5466,7 @@ var SpreePayContent = () => {
|
|
|
5024
5466
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
5025
5467
|
] }),
|
|
5026
5468
|
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CreditCardTab, {}),
|
|
5027
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5469
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_react22.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TabLoadingFallback, {}), children: [
|
|
5028
5470
|
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CryptoTab2, {}),
|
|
5029
5471
|
selectedPaymentMethod.type === "CDC" /* CDC */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CryptoComTab2, {})
|
|
5030
5472
|
] })
|
|
@@ -5032,11 +5474,11 @@ var SpreePayContent = () => {
|
|
|
5032
5474
|
};
|
|
5033
5475
|
|
|
5034
5476
|
// src/components/ErrorBoundary.tsx
|
|
5035
|
-
var
|
|
5477
|
+
var import_react23 = require("react");
|
|
5036
5478
|
init_utils();
|
|
5037
5479
|
init_logger();
|
|
5038
5480
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5039
|
-
var ErrorBoundary = class extends
|
|
5481
|
+
var ErrorBoundary = class extends import_react23.Component {
|
|
5040
5482
|
constructor(props) {
|
|
5041
5483
|
super(props);
|
|
5042
5484
|
this.state = { hasError: false, error: null };
|
|
@@ -5088,22 +5530,22 @@ init_StaticConfigContext();
|
|
|
5088
5530
|
init_client();
|
|
5089
5531
|
|
|
5090
5532
|
// src/hooks/useKeycloakSSO.ts
|
|
5091
|
-
var
|
|
5533
|
+
var import_react24 = require("react");
|
|
5092
5534
|
var import_keycloak_js = __toESM(require("keycloak-js"), 1);
|
|
5093
5535
|
init_logger();
|
|
5094
5536
|
var refreshAheadSeconds = 60;
|
|
5095
5537
|
var keycloakLogger = logger.child("keycloak");
|
|
5096
5538
|
function useKeycloakSSO(config2) {
|
|
5097
5539
|
const { url, realm, clientId, ssoPageURI, enabled } = config2;
|
|
5098
|
-
const initRef = (0,
|
|
5099
|
-
const kcRef = (0,
|
|
5100
|
-
const refreshTimerRef = (0,
|
|
5101
|
-
const scheduleRefreshRef = (0,
|
|
5540
|
+
const initRef = (0, import_react24.useRef)(false);
|
|
5541
|
+
const kcRef = (0, import_react24.useRef)(null);
|
|
5542
|
+
const refreshTimerRef = (0, import_react24.useRef)(null);
|
|
5543
|
+
const scheduleRefreshRef = (0, import_react24.useRef)(() => {
|
|
5102
5544
|
});
|
|
5103
|
-
const [error, setError] = (0,
|
|
5104
|
-
const [isChecking, setIsChecking] = (0,
|
|
5105
|
-
const [accessToken, setAccessToken] = (0,
|
|
5106
|
-
const scheduleRefresh = (0,
|
|
5545
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
5546
|
+
const [isChecking, setIsChecking] = (0, import_react24.useState)(enabled);
|
|
5547
|
+
const [accessToken, setAccessToken] = (0, import_react24.useState)(null);
|
|
5548
|
+
const scheduleRefresh = (0, import_react24.useCallback)(() => {
|
|
5107
5549
|
const kc = kcRef.current;
|
|
5108
5550
|
if (!kc || !kc.tokenParsed || !kc.tokenParsed.exp) {
|
|
5109
5551
|
return;
|
|
@@ -5127,10 +5569,10 @@ function useKeycloakSSO(config2) {
|
|
|
5127
5569
|
});
|
|
5128
5570
|
}, delayMs);
|
|
5129
5571
|
}, []);
|
|
5130
|
-
(0,
|
|
5572
|
+
(0, import_react24.useEffect)(() => {
|
|
5131
5573
|
scheduleRefreshRef.current = scheduleRefresh;
|
|
5132
5574
|
}, [scheduleRefresh]);
|
|
5133
|
-
(0,
|
|
5575
|
+
(0, import_react24.useEffect)(() => {
|
|
5134
5576
|
if (initRef.current || !enabled) return;
|
|
5135
5577
|
initRef.current = true;
|
|
5136
5578
|
const kc = new import_keycloak_js.default({ url, realm, clientId });
|
|
@@ -5183,14 +5625,14 @@ var isTokenExpired = (token) => {
|
|
|
5183
5625
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5184
5626
|
var unauthenticatedFetcher = () => Promise.resolve(null);
|
|
5185
5627
|
var SpreePayInner = () => {
|
|
5186
|
-
const [portalEl, setPortalEl] = (0,
|
|
5187
|
-
const rootRef = (0,
|
|
5628
|
+
const [portalEl, setPortalEl] = (0, import_react25.useState)(null);
|
|
5629
|
+
const rootRef = (0, import_react25.useCallback)((node) => {
|
|
5188
5630
|
if (!node) return;
|
|
5189
5631
|
const el = node.querySelector(":scope > .sl-spreepay__portal");
|
|
5190
5632
|
setPortalEl(el ?? null);
|
|
5191
5633
|
}, []);
|
|
5192
5634
|
const { environment, tenantId, keycloakClientId, accessToken: envAccessToken, ssoPageURI } = useSpreePayEnv();
|
|
5193
|
-
(0,
|
|
5635
|
+
(0, import_react25.useEffect)(() => {
|
|
5194
5636
|
configureLogger({ environment });
|
|
5195
5637
|
logger.logVersion();
|
|
5196
5638
|
}, [environment]);
|
|
@@ -5204,7 +5646,7 @@ var SpreePayInner = () => {
|
|
|
5204
5646
|
enabled: !envTokenValid
|
|
5205
5647
|
});
|
|
5206
5648
|
const _accessToken = envTokenValid ? envAccessToken : accessToken;
|
|
5207
|
-
const slapiFetcher = (0,
|
|
5649
|
+
const slapiFetcher = (0, import_react25.useMemo)(() => {
|
|
5208
5650
|
if (_accessToken) {
|
|
5209
5651
|
return registerApi({
|
|
5210
5652
|
accessToken: _accessToken,
|
|
@@ -5230,7 +5672,7 @@ var SpreePayInner = () => {
|
|
|
5230
5672
|
revalidateOnFocus: false,
|
|
5231
5673
|
revalidateIfStale: false
|
|
5232
5674
|
},
|
|
5233
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(esm_default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(LoginStatusProvider, { isLoggedIn: Boolean(_accessToken), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SpreePayContent, {}) }) }) })
|
|
5234
5676
|
}
|
|
5235
5677
|
);
|
|
5236
5678
|
};
|
|
@@ -5244,9 +5686,9 @@ var SpreePay = (props) => {
|
|
|
5244
5686
|
};
|
|
5245
5687
|
|
|
5246
5688
|
// src/hooks/useCapture3DS.ts
|
|
5247
|
-
var
|
|
5689
|
+
var import_react26 = require("react");
|
|
5248
5690
|
var useCapture3DS = ({ paymentIntent }) => {
|
|
5249
|
-
(0,
|
|
5691
|
+
(0, import_react26.useEffect)(() => {
|
|
5250
5692
|
if (typeof window !== "undefined" && window.parent && paymentIntent) {
|
|
5251
5693
|
window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent });
|
|
5252
5694
|
}
|