@chainrails/react 0.2.12 → 0.2.14
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/PaymentModal/index.d.ts +1 -1
- package/dist/chainrails-sdk.es.js +140 -128
- package/dist/chainrails-sdk.es.mjs +140 -128
- package/dist/chainrails-sdk.umd.js +3 -3
- package/dist/hooks/usePaymentModal.d.ts +7 -1
- package/dist/hooks/usePaymentModal.d.ts.map +1 -1
- package/dist/hooks/usePaymentSession.d.ts +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import { Chainrails } from "@chainrails/sdk";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
type PaymentModalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
sessionToken?: string | null;
|
|
5
|
-
amount?:
|
|
5
|
+
amount?: string;
|
|
6
6
|
session_url?: string;
|
|
7
7
|
styles?: {
|
|
8
8
|
accentColor?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as I, useRef as re, useEffect as C, useMemo as ye, useSyncExternalStore as Tt, useCallback as At, useLayoutEffect as vt, useDebugValue as Pt } from "react";
|
|
2
2
|
import { jsxs as we, jsx as B } from "react/jsx-runtime";
|
|
3
3
|
import './index.css';class G extends Error {
|
|
4
4
|
response;
|
|
@@ -50,7 +50,7 @@ const be = (() => {
|
|
|
50
50
|
throw r;
|
|
51
51
|
}
|
|
52
52
|
return e && !t;
|
|
53
|
-
})(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ut = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", $e = ["get", "post", "put", "patch", "head", "delete"],
|
|
53
|
+
})(), It = typeof globalThis.AbortController == "function", Be = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", Ut = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", $e = ["get", "post", "put", "patch", "head", "delete"], kt = {
|
|
54
54
|
json: "application/json",
|
|
55
55
|
text: "text/*",
|
|
56
56
|
formData: "multipart/form-data",
|
|
@@ -59,7 +59,7 @@ const be = (() => {
|
|
|
59
59
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
60
60
|
// We still feature-check at runtime before exposing the shortcut.
|
|
61
61
|
bytes: "*/*"
|
|
62
|
-
}, W = 2147483647,
|
|
62
|
+
}, W = 2147483647, xt = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, ze = Symbol("stop");
|
|
63
63
|
class Le {
|
|
64
64
|
options;
|
|
65
65
|
constructor(t) {
|
|
@@ -104,7 +104,7 @@ const Dt = (e) => new Le(e), Ot = {
|
|
|
104
104
|
if (e instanceof FormData) {
|
|
105
105
|
let t = 0;
|
|
106
106
|
for (const [s, n] of e)
|
|
107
|
-
t +=
|
|
107
|
+
t += xt, t += new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length, t += typeof n == "string" ? new TextEncoder().encode(n).length : n.size;
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
110
|
if (e instanceof Blob)
|
|
@@ -332,7 +332,7 @@ class N {
|
|
|
332
332
|
const o = n.#o, a = [];
|
|
333
333
|
o && !o.bodyUsed && a.push(o.body?.cancel()), n.request.bodyUsed || a.push(n.request.body?.cancel()), await Promise.all(a);
|
|
334
334
|
});
|
|
335
|
-
for (const [o, a] of Object.entries(
|
|
335
|
+
for (const [o, a] of Object.entries(kt))
|
|
336
336
|
o === "bytes" && typeof globalThis.Response?.prototype?.bytes != "function" || (i[o] = async () => {
|
|
337
337
|
n.request.headers.set("accept", n.request.headers.get("accept") || a);
|
|
338
338
|
const c = await i;
|
|
@@ -816,12 +816,12 @@ function Ss(e) {
|
|
|
816
816
|
const t = (n) => e().update(ot(n)).digest(), s = e();
|
|
817
817
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
818
818
|
}
|
|
819
|
-
const Rs = BigInt(0),
|
|
820
|
-
for (let e = 0, t =
|
|
819
|
+
const Rs = BigInt(0), x = BigInt(1), Ts = BigInt(2), As = BigInt(7), vs = BigInt(256), Ps = BigInt(113), it = [], at = [], ct = [];
|
|
820
|
+
for (let e = 0, t = x, s = 1, n = 0; e < 24; e++) {
|
|
821
821
|
[s, n] = [n, (2 * s + 3 * n) % 5], it.push(2 * (5 * n + s)), at.push((e + 1) * (e + 2) / 2 % 64);
|
|
822
822
|
let r = Rs;
|
|
823
823
|
for (let i = 0; i < 7; i++)
|
|
824
|
-
t = (t <<
|
|
824
|
+
t = (t << x ^ (t >> As) * Ps) % vs, t & Ts && (r ^= x << (x << /* @__PURE__ */ BigInt(i)) - x);
|
|
825
825
|
ct.push(r);
|
|
826
826
|
}
|
|
827
827
|
const ut = cs(ct, !0), Is = ut[0], Us = ut[1], Ie = (e, t, s) => s > 32 ? fs(e, t, s) : us(e, t, s), Ue = (e, t, s) => s > 32 ? hs(e, t, s) : ls(e, t, s);
|
|
@@ -831,9 +831,9 @@ function Cs(e, t = 24) {
|
|
|
831
831
|
for (let o = 0; o < 10; o++)
|
|
832
832
|
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
833
833
|
for (let o = 0; o < 10; o += 2) {
|
|
834
|
-
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a],
|
|
834
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, u = s[c], l = s[c + 1], w = Ie(u, l, 1) ^ s[a], p = Ue(u, l, 1) ^ s[a + 1];
|
|
835
835
|
for (let y = 0; y < 50; y += 10)
|
|
836
|
-
e[o + y] ^= w, e[o + y + 1] ^=
|
|
836
|
+
e[o + y] ^= w, e[o + y + 1] ^= p;
|
|
837
837
|
}
|
|
838
838
|
let r = e[2], i = e[3];
|
|
839
839
|
for (let o = 0; o < 24; o++) {
|
|
@@ -915,9 +915,9 @@ class ce extends Es {
|
|
|
915
915
|
return t || (t = new ce(s, n, r, o, i)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = i, t.suffix = n, t.outputLen = r, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
const
|
|
918
|
+
const ks = (e, t, s) => Ss(() => new ce(t, e, s)), xs = ks(1, 136, 256 / 8);
|
|
919
919
|
function Ds(e, t) {
|
|
920
|
-
return
|
|
920
|
+
return xs(ie(e, { strict: !1 }) ? rs(e) : e);
|
|
921
921
|
}
|
|
922
922
|
class Os extends v {
|
|
923
923
|
constructor({ address: t }) {
|
|
@@ -1176,8 +1176,8 @@ class h {
|
|
|
1176
1176
|
static getPayModalUrl(t) {
|
|
1177
1177
|
if (!h.app)
|
|
1178
1178
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1179
|
-
const s = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = t && t > 0 ? "/pay/" : "/deposit/",
|
|
1180
|
-
return s +
|
|
1179
|
+
const s = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", n = Number(t), r = t && !isNaN(Number(t)) && n > 0 ? "/pay/" : "/deposit/", i = `${t && !isNaN(Number(t)) && n > 0 ? n * 100 : ""}`;
|
|
1180
|
+
return s + r + i;
|
|
1181
1181
|
}
|
|
1182
1182
|
}
|
|
1183
1183
|
let te = null;
|
|
@@ -1201,83 +1201,83 @@ function Ys() {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function m() {
|
|
1205
1205
|
return te || Ys(), te;
|
|
1206
1206
|
}
|
|
1207
1207
|
class Xs {
|
|
1208
1208
|
async getById(t) {
|
|
1209
|
-
return await
|
|
1209
|
+
return await m().get("intents/" + t).json();
|
|
1210
1210
|
}
|
|
1211
1211
|
async getForSender(t) {
|
|
1212
|
-
return await
|
|
1212
|
+
return await m().get("intents/user/" + t).json();
|
|
1213
1213
|
}
|
|
1214
1214
|
async getForAddress(t) {
|
|
1215
|
-
return await
|
|
1215
|
+
return await m().get("intents/address/" + t).json();
|
|
1216
1216
|
}
|
|
1217
1217
|
async getForSession(t) {
|
|
1218
|
-
return await
|
|
1218
|
+
return await m().get("modal/sessions/intents/" + t).json();
|
|
1219
1219
|
}
|
|
1220
1220
|
async getAll(t) {
|
|
1221
|
-
return await
|
|
1221
|
+
return await m().get("intents", { searchParams: t }).json();
|
|
1222
1222
|
}
|
|
1223
1223
|
async create(t) {
|
|
1224
|
-
return await
|
|
1224
|
+
return await m().post("intents", { json: t }).json();
|
|
1225
1225
|
}
|
|
1226
1226
|
async createForSession(t) {
|
|
1227
|
-
return await
|
|
1227
|
+
return await m().post("modal/sessions/intents", { json: t }).json();
|
|
1228
1228
|
}
|
|
1229
1229
|
async update(t, s) {
|
|
1230
|
-
return await
|
|
1230
|
+
return await m().post("intents", { json: s }).json();
|
|
1231
1231
|
}
|
|
1232
1232
|
async triggerProcessing(t) {
|
|
1233
|
-
return await
|
|
1233
|
+
return await m().post(`intents/${t}/trigger-processing`).json();
|
|
1234
1234
|
}
|
|
1235
1235
|
async triggerProcessingForSession(t) {
|
|
1236
|
-
return await
|
|
1236
|
+
return await m().post(`modal/sessions/intents/${t}/process`).json();
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
1239
|
class Js {
|
|
1240
1240
|
async getFromSpecificBridge(t) {
|
|
1241
|
-
return await
|
|
1241
|
+
return await m().get("quotes/single", { searchParams: t }).json();
|
|
1242
1242
|
}
|
|
1243
1243
|
async getFromAllBridges(t) {
|
|
1244
|
-
return await
|
|
1244
|
+
return await m().get("quotes/multiple", { searchParams: t }).json();
|
|
1245
1245
|
}
|
|
1246
1246
|
async getBestAcrossBridges(t) {
|
|
1247
|
-
return await
|
|
1247
|
+
return await m().get("quotes/best", { searchParams: t }).json();
|
|
1248
1248
|
}
|
|
1249
1249
|
async getAll(t) {
|
|
1250
|
-
return await
|
|
1250
|
+
return await m().get("quotes/multi-source", { searchParams: t }).json();
|
|
1251
1251
|
}
|
|
1252
1252
|
async getAllForSession(t) {
|
|
1253
|
-
return await
|
|
1253
|
+
return await m().get("modal/sessions/quotes", { searchParams: t }).json();
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
class Gs {
|
|
1257
1257
|
async getOptimalRoutes(t) {
|
|
1258
|
-
return await
|
|
1258
|
+
return await m().get("router/optimal-route", { searchParams: t }).json();
|
|
1259
1259
|
}
|
|
1260
1260
|
async getAllSupportedBridges() {
|
|
1261
|
-
return await
|
|
1261
|
+
return await m().get("router/supported-bridges/all").json();
|
|
1262
1262
|
}
|
|
1263
1263
|
async getSupportedBridges(t) {
|
|
1264
|
-
return await
|
|
1264
|
+
return await m().get("router/supported-bridges/route", { searchParams: t }).json();
|
|
1265
1265
|
}
|
|
1266
1266
|
async getSupportedRoutes(t, s) {
|
|
1267
|
-
return await
|
|
1267
|
+
return await m().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
class Zs {
|
|
1271
1271
|
async getSupported(t) {
|
|
1272
|
-
return await
|
|
1272
|
+
return await m().get("chains", { searchParams: t }).json();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
class Qs {
|
|
1276
1276
|
async getClientInfo() {
|
|
1277
|
-
return await
|
|
1277
|
+
return await m().get("client/auth/client-info").json();
|
|
1278
1278
|
}
|
|
1279
1279
|
async getClientInfoForSession() {
|
|
1280
|
-
return await
|
|
1280
|
+
return await m().get("modal/sessions/client").json();
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
class en {
|
|
@@ -1291,7 +1291,7 @@ class en {
|
|
|
1291
1291
|
destinationChain: ee[t.destinationChain],
|
|
1292
1292
|
amount: t.amount
|
|
1293
1293
|
};
|
|
1294
|
-
return
|
|
1294
|
+
return m().post("modal/sessions", { json: s }).json().then((n) => ({ ...n, amount: s.amount }));
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
const vn = {
|
|
@@ -1327,25 +1327,25 @@ function Pn(e) {
|
|
|
1327
1327
|
onSuccess: c,
|
|
1328
1328
|
session_url: u,
|
|
1329
1329
|
sessionToken: l
|
|
1330
|
-
} = e, [w,
|
|
1331
|
-
|
|
1330
|
+
} = e, [w, p] = I(0), [y, b] = I(""), k = re(null);
|
|
1331
|
+
C(() => {
|
|
1332
1332
|
const f = document.body.style.overflow;
|
|
1333
1333
|
n ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = f || "";
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1334
|
+
const g = (E) => {
|
|
1335
|
+
E.data === "closed" && (o(), a?.()), E.data === "completed" && (window.setTimeout(o, 2e3), c?.());
|
|
1336
1336
|
};
|
|
1337
|
-
return window.addEventListener("message",
|
|
1338
|
-
document.body.style.overflow = f || "", window.removeEventListener("message",
|
|
1337
|
+
return window.addEventListener("message", g), () => {
|
|
1338
|
+
document.body.style.overflow = f || "", window.removeEventListener("message", g);
|
|
1339
1339
|
};
|
|
1340
|
-
}, [n, a, c]),
|
|
1340
|
+
}, [n, a, c]), C(() => {
|
|
1341
1341
|
h.config({
|
|
1342
1342
|
api_key: l || "",
|
|
1343
1343
|
// @ts-expect-error
|
|
1344
1344
|
env: e.env === "internal" ? "internal" : "production"
|
|
1345
1345
|
}).then((f) => {
|
|
1346
|
-
window.chainrails = f,
|
|
1346
|
+
window.chainrails = f, b(h.getPayModalUrl(t));
|
|
1347
1347
|
});
|
|
1348
|
-
}, [n, t]),
|
|
1348
|
+
}, [n, t]), C(() => {
|
|
1349
1349
|
if (!l) return;
|
|
1350
1350
|
const f = {
|
|
1351
1351
|
type: "session",
|
|
@@ -1353,10 +1353,10 @@ function Pn(e) {
|
|
|
1353
1353
|
environment: h.getEnv() || ue.PRODUCTION,
|
|
1354
1354
|
styles: s
|
|
1355
1355
|
};
|
|
1356
|
-
|
|
1357
|
-
}, [l, w, n,
|
|
1356
|
+
k.current?.contentWindow?.postMessage(f, "https://app.chainrails.io"), k.current?.contentWindow?.postMessage(f, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1357
|
+
}, [l, w, n, s]);
|
|
1358
1358
|
function d() {
|
|
1359
|
-
|
|
1359
|
+
p(Math.random());
|
|
1360
1360
|
}
|
|
1361
1361
|
return /* @__PURE__ */ we("div", {
|
|
1362
1362
|
className: tn("payment-modal-wrapper", w === 0 || r ? "loading" : "not-loading", n ? "open" : "closed"),
|
|
@@ -1383,11 +1383,11 @@ function Pn(e) {
|
|
|
1383
1383
|
onLoad: d,
|
|
1384
1384
|
className: `payment-modal ${w === 0 || r ? "invisible" : "visible"}`,
|
|
1385
1385
|
"data-id": t,
|
|
1386
|
-
ref:
|
|
1386
|
+
ref: k
|
|
1387
1387
|
}, l)]
|
|
1388
1388
|
});
|
|
1389
1389
|
}
|
|
1390
|
-
const sn = Symbol(), le = Symbol(),
|
|
1390
|
+
const sn = Symbol(), le = Symbol(), D = "a", pt = "f", ke = "p", gt = "c", mt = "t", fe = "h", O = "w", he = "o", de = "k";
|
|
1391
1391
|
let nn = (e, t) => new Proxy(e, t);
|
|
1392
1392
|
const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) => e && (ne.has(e) ? ne.get(e) : se(e) === Object.prototype || se(e) === Array.prototype), q = (e) => typeof e == "object" && e !== null, rn = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), on = (e) => {
|
|
1393
1393
|
if (Array.isArray(e))
|
|
@@ -1403,19 +1403,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1403
1403
|
let n = !1;
|
|
1404
1404
|
const r = (a, c) => {
|
|
1405
1405
|
if (!n) {
|
|
1406
|
-
let u = s[
|
|
1407
|
-
if (u || (u = {}, s[
|
|
1408
|
-
u[
|
|
1406
|
+
let u = s[D].get(e);
|
|
1407
|
+
if (u || (u = {}, s[D].set(e, u)), a === O)
|
|
1408
|
+
u[O] = !0;
|
|
1409
1409
|
else {
|
|
1410
1410
|
let l = u[a];
|
|
1411
1411
|
l || (l = /* @__PURE__ */ new Set(), u[a] = l), l.add(c);
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
1414
|
}, i = () => {
|
|
1415
|
-
n = !0, s[
|
|
1415
|
+
n = !0, s[D].delete(e);
|
|
1416
1416
|
}, o = {
|
|
1417
1417
|
get(a, c) {
|
|
1418
|
-
return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[
|
|
1418
|
+
return c === le ? e : (r(de, c), wt(Reflect.get(a, c), s[D], s[gt], s[mt]));
|
|
1419
1419
|
},
|
|
1420
1420
|
has(a, c) {
|
|
1421
1421
|
return c === sn ? (i(), !0) : (r(fe, c), Reflect.has(a, c));
|
|
@@ -1424,7 +1424,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1424
1424
|
return r(he, c), Reflect.getOwnPropertyDescriptor(a, c);
|
|
1425
1425
|
},
|
|
1426
1426
|
ownKeys(a) {
|
|
1427
|
-
return r(
|
|
1427
|
+
return r(O), Reflect.ownKeys(a);
|
|
1428
1428
|
}
|
|
1429
1429
|
};
|
|
1430
1430
|
return t && (o.set = o.deleteProperty = () => !1), [o, s];
|
|
@@ -1442,7 +1442,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1442
1442
|
}
|
|
1443
1443
|
const [i, o] = r;
|
|
1444
1444
|
let a = s && s.get(i);
|
|
1445
|
-
return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][
|
|
1445
|
+
return (!a || a[1][pt] !== !!o) && (a = an(i, !!o), a[1][ke] = nn(o || i, a[0]), s && s.set(i, a)), a[1][D] = t, a[1][gt] = s, a[1][mt] = n, a[1][ke];
|
|
1446
1446
|
}, cn = (e, t) => {
|
|
1447
1447
|
const s = Reflect.ownKeys(e), n = Reflect.ownKeys(t);
|
|
1448
1448
|
return s.length !== n.length || s.some((r, i) => r !== n[i]);
|
|
@@ -1463,7 +1463,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1463
1463
|
for (const a of i[fe] || [])
|
|
1464
1464
|
if (o = Reflect.has(e, a) !== Reflect.has(t, a), o)
|
|
1465
1465
|
return o;
|
|
1466
|
-
if (i[
|
|
1466
|
+
if (i[O] === !0) {
|
|
1467
1467
|
if (o = cn(e, t), o)
|
|
1468
1468
|
return o;
|
|
1469
1469
|
} else
|
|
@@ -1478,7 +1478,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1478
1478
|
if (o === null)
|
|
1479
1479
|
throw new Error("invalid used");
|
|
1480
1480
|
return o;
|
|
1481
|
-
}, un = (e) => yt(e) && e[le] || null,
|
|
1481
|
+
}, un = (e) => yt(e) && e[le] || null, xe = (e, t = !0) => {
|
|
1482
1482
|
ne.set(e, t);
|
|
1483
1483
|
}, ln = (e, t, s) => {
|
|
1484
1484
|
const n = [], r = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
|
|
@@ -1488,19 +1488,19 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1488
1488
|
q(o) && r.add(o);
|
|
1489
1489
|
const w = q(o) && t.get(pe(o));
|
|
1490
1490
|
if (w) {
|
|
1491
|
-
if ((c = w[fe]) === null || c === void 0 || c.forEach((
|
|
1492
|
-
const y = `:has(${String(
|
|
1491
|
+
if ((c = w[fe]) === null || c === void 0 || c.forEach((p) => {
|
|
1492
|
+
const y = `:has(${String(p)})`;
|
|
1493
1493
|
n.push(a ? [...a, y] : [y]);
|
|
1494
|
-
}), w[
|
|
1495
|
-
const
|
|
1496
|
-
n.push(a ? [...a,
|
|
1494
|
+
}), w[O] === !0) {
|
|
1495
|
+
const p = ":ownKeys";
|
|
1496
|
+
n.push(a ? [...a, p] : [p]);
|
|
1497
1497
|
} else
|
|
1498
|
-
(u = w[he]) === null || u === void 0 || u.forEach((
|
|
1499
|
-
const y = `:hasOwn(${String(
|
|
1498
|
+
(u = w[he]) === null || u === void 0 || u.forEach((p) => {
|
|
1499
|
+
const y = `:hasOwn(${String(p)})`;
|
|
1500
1500
|
n.push(a ? [...a, y] : [y]);
|
|
1501
1501
|
});
|
|
1502
|
-
(l = w[de]) === null || l === void 0 || l.forEach((
|
|
1503
|
-
"value" in (Object.getOwnPropertyDescriptor(o,
|
|
1502
|
+
(l = w[de]) === null || l === void 0 || l.forEach((p) => {
|
|
1503
|
+
"value" in (Object.getOwnPropertyDescriptor(o, p) || {}) && i(o[p], a ? [...a, p] : [p]);
|
|
1504
1504
|
});
|
|
1505
1505
|
} else a && n.push(a);
|
|
1506
1506
|
};
|
|
@@ -1510,7 +1510,7 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1510
1510
|
if (s?.[0] === t)
|
|
1511
1511
|
return s[1];
|
|
1512
1512
|
const n = Array.isArray(e) ? [] : Object.create(Object.getPrototypeOf(e));
|
|
1513
|
-
return
|
|
1513
|
+
return xe(n, !0), De.set(e, [t, n]), Reflect.ownKeys(e).forEach((r) => {
|
|
1514
1514
|
if (Object.getOwnPropertyDescriptor(n, r))
|
|
1515
1515
|
return;
|
|
1516
1516
|
const i = Reflect.get(e, r), { enumerable: o } = Reflect.getOwnPropertyDescriptor(
|
|
@@ -1524,9 +1524,9 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1524
1524
|
configurable: !0
|
|
1525
1525
|
};
|
|
1526
1526
|
if (me.has(i))
|
|
1527
|
-
|
|
1528
|
-
else if (
|
|
1529
|
-
const [c, u] =
|
|
1527
|
+
xe(i, !1);
|
|
1528
|
+
else if (U.has(i)) {
|
|
1529
|
+
const [c, u] = U.get(
|
|
1530
1530
|
i
|
|
1531
1531
|
);
|
|
1532
1532
|
a.value = Et(c, u());
|
|
@@ -1545,10 +1545,10 @@ const se = Object.getPrototypeOf, ne = /* @__PURE__ */ new WeakMap(), yt = (e) =
|
|
|
1545
1545
|
if (c && (Oe(u, o) || F.has(o) && Oe(u, F.get(o))))
|
|
1546
1546
|
return !0;
|
|
1547
1547
|
s(i), ge(o) && (o = un(o) || o);
|
|
1548
|
-
const l = !
|
|
1548
|
+
const l = !U.has(o) && pn(o) ? St(o) : o;
|
|
1549
1549
|
return t(i, l), Reflect.set(r, i, l, a), n(["set", [i], o, u]), !0;
|
|
1550
1550
|
}
|
|
1551
|
-
}),
|
|
1551
|
+
}), U = /* @__PURE__ */ new WeakMap(), me = /* @__PURE__ */ new WeakSet(), De = /* @__PURE__ */ new WeakMap(), J = [1], F = /* @__PURE__ */ new WeakMap();
|
|
1552
1552
|
let Oe = Object.is, dn = (e, t) => new Proxy(e, t), pn = fn, gn = Et, mn = hn;
|
|
1553
1553
|
function St(e = {}) {
|
|
1554
1554
|
if (!ge(e))
|
|
@@ -1558,59 +1558,59 @@ function St(e = {}) {
|
|
|
1558
1558
|
return t;
|
|
1559
1559
|
let s = J[0];
|
|
1560
1560
|
const n = /* @__PURE__ */ new Set(), r = (d, f = ++J[0]) => {
|
|
1561
|
-
s !== f && (i = s = f, n.forEach((
|
|
1561
|
+
s !== f && (i = s = f, n.forEach((g) => g(d, f)));
|
|
1562
1562
|
};
|
|
1563
1563
|
let i = s;
|
|
1564
1564
|
const o = (d = J[0]) => (i !== d && (i = d, c.forEach(([f]) => {
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
})), s), a = (d) => (f,
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1565
|
+
const g = f[1](d);
|
|
1566
|
+
g > s && (s = g);
|
|
1567
|
+
})), s), a = (d) => (f, g) => {
|
|
1568
|
+
const E = [...f];
|
|
1569
|
+
E[1] = [d, ...E[1]], r(E, g);
|
|
1570
1570
|
}, c = /* @__PURE__ */ new Map(), u = (d, f) => {
|
|
1571
|
-
const
|
|
1572
|
-
if (
|
|
1571
|
+
const g = !me.has(f) && U.get(f);
|
|
1572
|
+
if (g) {
|
|
1573
1573
|
if ((_ ? "production" : void 0) !== "production" && c.has(d))
|
|
1574
1574
|
throw new Error("prop listener already exists");
|
|
1575
1575
|
if (n.size) {
|
|
1576
|
-
const
|
|
1577
|
-
c.set(d, [
|
|
1576
|
+
const E = g[2](a(d));
|
|
1577
|
+
c.set(d, [g, E]);
|
|
1578
1578
|
} else
|
|
1579
|
-
c.set(d, [
|
|
1579
|
+
c.set(d, [g]);
|
|
1580
1580
|
}
|
|
1581
1581
|
}, l = (d) => {
|
|
1582
1582
|
var f;
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
}, w = (d) => (n.add(d), n.size === 1 && c.forEach(([
|
|
1586
|
-
if ((_ ? "production" : void 0) !== "production" &&
|
|
1583
|
+
const g = c.get(d);
|
|
1584
|
+
g && (c.delete(d), (f = g[1]) == null || f.call(g));
|
|
1585
|
+
}, w = (d) => (n.add(d), n.size === 1 && c.forEach(([g, E], M) => {
|
|
1586
|
+
if ((_ ? "production" : void 0) !== "production" && E)
|
|
1587
1587
|
throw new Error("remove already exists");
|
|
1588
|
-
const Rt =
|
|
1589
|
-
c.set(M, [
|
|
1588
|
+
const Rt = g[2](a(M));
|
|
1589
|
+
c.set(M, [g, Rt]);
|
|
1590
1590
|
}), () => {
|
|
1591
|
-
n.delete(d), n.size === 0 && c.forEach(([
|
|
1592
|
-
|
|
1591
|
+
n.delete(d), n.size === 0 && c.forEach(([g, E], M) => {
|
|
1592
|
+
E && (E(), c.set(M, [g]));
|
|
1593
1593
|
});
|
|
1594
1594
|
});
|
|
1595
|
-
let
|
|
1595
|
+
let p = !0;
|
|
1596
1596
|
const y = mn(
|
|
1597
|
-
() =>
|
|
1597
|
+
() => p,
|
|
1598
1598
|
u,
|
|
1599
1599
|
l,
|
|
1600
1600
|
r
|
|
1601
|
-
),
|
|
1602
|
-
F.set(e,
|
|
1603
|
-
const
|
|
1604
|
-
return
|
|
1601
|
+
), b = dn(e, y);
|
|
1602
|
+
F.set(e, b);
|
|
1603
|
+
const k = [e, o, w];
|
|
1604
|
+
return U.set(b, k), Reflect.ownKeys(e).forEach((d) => {
|
|
1605
1605
|
const f = Object.getOwnPropertyDescriptor(
|
|
1606
1606
|
e,
|
|
1607
1607
|
d
|
|
1608
1608
|
);
|
|
1609
|
-
"value" in f && f.writable && (
|
|
1610
|
-
}),
|
|
1609
|
+
"value" in f && f.writable && (b[d] = e[d]);
|
|
1610
|
+
}), p = !1, b;
|
|
1611
1611
|
}
|
|
1612
1612
|
function yn(e, t, s) {
|
|
1613
|
-
const n =
|
|
1613
|
+
const n = U.get(e);
|
|
1614
1614
|
(_ ? "production" : void 0) !== "production" && !n && console.warn("Please use proxy object");
|
|
1615
1615
|
let r;
|
|
1616
1616
|
const i = [], o = n[2];
|
|
@@ -1625,14 +1625,14 @@ function yn(e, t, s) {
|
|
|
1625
1625
|
};
|
|
1626
1626
|
}
|
|
1627
1627
|
function Ne(e) {
|
|
1628
|
-
const t =
|
|
1628
|
+
const t = U.get(e);
|
|
1629
1629
|
(_ ? "production" : void 0) !== "production" && !t && console.warn("Please use proxy object");
|
|
1630
1630
|
const [s, n] = t;
|
|
1631
1631
|
return gn(s, n());
|
|
1632
1632
|
}
|
|
1633
1633
|
const wn = {}, bn = (e, t) => {
|
|
1634
1634
|
const s = re(void 0);
|
|
1635
|
-
|
|
1635
|
+
C(() => {
|
|
1636
1636
|
s.current = ln(e, t);
|
|
1637
1637
|
}), Pt(s.current);
|
|
1638
1638
|
}, En = bn, Sn = /* @__PURE__ */ new WeakMap();
|
|
@@ -1682,27 +1682,27 @@ function In({
|
|
|
1682
1682
|
onCancel: t,
|
|
1683
1683
|
onSuccess: s
|
|
1684
1684
|
}) {
|
|
1685
|
-
const n = Rn(A), [r, i] =
|
|
1685
|
+
const n = Rn(A), [r, i] = I(!1), [o, a] = I(Date.now()), c = n?.data?.sessionToken, u = n?.data?.amount;
|
|
1686
1686
|
function l() {
|
|
1687
1687
|
c && i(!0);
|
|
1688
1688
|
}
|
|
1689
1689
|
function w() {
|
|
1690
1690
|
i(!1);
|
|
1691
1691
|
}
|
|
1692
|
-
const
|
|
1692
|
+
const p = () => {
|
|
1693
1693
|
const y = Date.now();
|
|
1694
1694
|
A.isPending = !0, A.error = null, A.data = null, fetch(e, {
|
|
1695
1695
|
headers: {
|
|
1696
1696
|
"Content-Type": "application/json"
|
|
1697
1697
|
}
|
|
1698
|
-
}).then((
|
|
1699
|
-
y < o || (A.data =
|
|
1700
|
-
}).catch((
|
|
1701
|
-
y < o || (A.error =
|
|
1698
|
+
}).then((b) => b.json()).then((b) => {
|
|
1699
|
+
y < o || (A.data = b, A.isPending = !1, a(y));
|
|
1700
|
+
}).catch((b) => {
|
|
1701
|
+
y < o || (A.error = b?.toString(), A.isPending = !1, a(y));
|
|
1702
1702
|
});
|
|
1703
1703
|
};
|
|
1704
|
-
return
|
|
1705
|
-
|
|
1704
|
+
return C(() => {
|
|
1705
|
+
p();
|
|
1706
1706
|
}, [e]), {
|
|
1707
1707
|
sessionToken: c,
|
|
1708
1708
|
amount: u,
|
|
@@ -1710,30 +1710,42 @@ function In({
|
|
|
1710
1710
|
session_url: e,
|
|
1711
1711
|
open: l,
|
|
1712
1712
|
close: w,
|
|
1713
|
-
refetch:
|
|
1713
|
+
refetch: p,
|
|
1714
1714
|
onSuccess: s,
|
|
1715
1715
|
onCancel: t
|
|
1716
1716
|
};
|
|
1717
1717
|
}
|
|
1718
1718
|
function Un({
|
|
1719
1719
|
sessionToken: e,
|
|
1720
|
-
|
|
1721
|
-
|
|
1720
|
+
amount: t,
|
|
1721
|
+
onCancel: s,
|
|
1722
|
+
onSuccess: n
|
|
1722
1723
|
}) {
|
|
1723
|
-
const [
|
|
1724
|
-
function
|
|
1725
|
-
|
|
1724
|
+
const [r, i] = I(!1), [o, a] = I(e), [c, u] = I(t);
|
|
1725
|
+
function l({
|
|
1726
|
+
sessionToken: y,
|
|
1727
|
+
amount: b
|
|
1728
|
+
}) {
|
|
1729
|
+
a(y), u(b);
|
|
1730
|
+
}
|
|
1731
|
+
C(() => {
|
|
1732
|
+
a(e);
|
|
1733
|
+
}, [e]);
|
|
1734
|
+
function w() {
|
|
1735
|
+
i(!0);
|
|
1726
1736
|
}
|
|
1727
|
-
function
|
|
1728
|
-
|
|
1737
|
+
function p() {
|
|
1738
|
+
i(!1);
|
|
1729
1739
|
}
|
|
1730
1740
|
return {
|
|
1731
|
-
sessionToken:
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1741
|
+
sessionToken: o,
|
|
1742
|
+
updateSession: l,
|
|
1743
|
+
amount: c,
|
|
1744
|
+
isOpen: r,
|
|
1745
|
+
open: w,
|
|
1746
|
+
close: p,
|
|
1747
|
+
onSuccess: n,
|
|
1748
|
+
onCancel: s
|
|
1737
1749
|
};
|
|
1738
1750
|
}
|
|
1739
1751
|
export {
|