@tender-cash/agent-sdk-react 0.1.0 → 0.1.2
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/tender-cash-agent-sdk-react.cjs.js +3 -3
- package/dist/tender-cash-agent-sdk-react.cjs.js.map +1 -1
- package/dist/tender-cash-agent-sdk-react.es.js +30 -24
- package/dist/tender-cash-agent-sdk-react.es.js.map +1 -1
- package/dist/types/module/lib/utils/index.d.ts +1 -1
- package/dist/types/module/screens/details.d.ts +1 -1
- package/dist/types/module/types.d.ts +5 -1
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ import xe, { useEffect as ae, useCallback as Ne, useState as J, useRef as se, fo
|
|
|
6
6
|
/**
|
|
7
7
|
* agent-sdk-react.js
|
|
8
8
|
* @summary
|
|
9
|
-
* @version v0.1.
|
|
9
|
+
* @version v0.1.2
|
|
10
10
|
* @author Tender
|
|
11
11
|
* @license Released under the MIT license.
|
|
12
12
|
* @copyright Tender Cash
|
|
@@ -9437,7 +9437,7 @@ function Sl(e, t, r) {
|
|
|
9437
9437
|
function dr(...e) {
|
|
9438
9438
|
return uc(ga(e));
|
|
9439
9439
|
}
|
|
9440
|
-
var Ea = /* @__PURE__ */ ((e) => (e.test = "
|
|
9440
|
+
var Ea = /* @__PURE__ */ ((e) => (e.test = "http://localhost:9090", e.live = "https://secureapi.tender.cash", e))(Ea || {});
|
|
9441
9441
|
const g0 = {
|
|
9442
9442
|
CHAINS: "/system/chains",
|
|
9443
9443
|
COINS: "/system/coins",
|
|
@@ -10443,17 +10443,19 @@ const Dt = new Bx(), wx = ({ nextScreen: e, setPageLoading: t }) => {
|
|
|
10443
10443
|
i(R), s(!1), t(!1), e(ze.DETAILS), p(B.txId);
|
|
10444
10444
|
}
|
|
10445
10445
|
}, m = (C) => {
|
|
10446
|
-
var b, g;
|
|
10446
|
+
var b, g, y;
|
|
10447
10447
|
ne.debug("API Confirm-Response", { response: C });
|
|
10448
10448
|
const h = C;
|
|
10449
10449
|
if ((b = h == null ? void 0 : h.data) != null && b.data) {
|
|
10450
|
-
const
|
|
10450
|
+
const E = {
|
|
10451
|
+
...l,
|
|
10451
10452
|
status: h.data.data.status,
|
|
10452
10453
|
amountPaid: h.data.data.amountReceived,
|
|
10453
10454
|
balance: h.data.data.balanceRequired,
|
|
10454
|
-
|
|
10455
|
+
excess: (parseFloat(h.data.data.amountReceived || "0") - parseFloat(((g = h.data.data) == null ? void 0 : g.amount) || "0")).toFixed(4),
|
|
10456
|
+
coin: (y = h.data.data.currency) == null ? void 0 : y.name
|
|
10455
10457
|
};
|
|
10456
|
-
i((
|
|
10458
|
+
i((B) => ({ ...B, ...E })), o && o({ status: h.data.data.status, message: h.data.message, data: E }), [Ze.OVER, Ze.COMPLETE].includes(h.data.data.status) && r && (Dt.clearQueue(), clearInterval(r));
|
|
10457
10459
|
}
|
|
10458
10460
|
}, f = async (C, h) => {
|
|
10459
10461
|
ne.debug("confirming...");
|
|
@@ -10469,7 +10471,7 @@ const Dt = new Bx(), wx = ({ nextScreen: e, setPageLoading: t }) => {
|
|
|
10469
10471
|
} catch (g) {
|
|
10470
10472
|
ne.error("no payment yet..", { error: g });
|
|
10471
10473
|
} finally {
|
|
10472
|
-
s(!1)
|
|
10474
|
+
s(!1);
|
|
10473
10475
|
}
|
|
10474
10476
|
}, p = (C) => {
|
|
10475
10477
|
r = setInterval(() => f(C, !0), a);
|
|
@@ -10779,16 +10781,17 @@ const Sx = ({
|
|
|
10779
10781
|
amountPaid: r,
|
|
10780
10782
|
coin: n,
|
|
10781
10783
|
status: a = "pending",
|
|
10782
|
-
balance: o
|
|
10784
|
+
balance: o,
|
|
10785
|
+
excess: l
|
|
10783
10786
|
}) => {
|
|
10784
|
-
const [
|
|
10785
|
-
return /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
10787
|
+
const [i, x] = Ma(), s = za[a], c = Ax[s], v = a == Ze.COMPLETE, u = a == Ze.PARTIAL, m = Ua[s];
|
|
10788
|
+
return console.log("excess", l, o), /* @__PURE__ */ F.jsxs(F.Fragment, { children: [
|
|
10786
10789
|
/* @__PURE__ */ F.jsx(
|
|
10787
10790
|
O0,
|
|
10788
10791
|
{
|
|
10789
|
-
title: `${Tl(
|
|
10792
|
+
title: `${Tl(s)} Payment received`,
|
|
10790
10793
|
description: "The customer made a partial or part payment of the requested amount.",
|
|
10791
|
-
icon:
|
|
10794
|
+
icon: c
|
|
10792
10795
|
}
|
|
10793
10796
|
),
|
|
10794
10797
|
/* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-col ta-border-t-1 ta-px-6 ta-gap-2", children: [
|
|
@@ -10806,12 +10809,12 @@ const Sx = ({
|
|
|
10806
10809
|
] }),
|
|
10807
10810
|
/* @__PURE__ */ F.jsx("p", { className: "ta-text-[13px] ta-underline ta-underline-offset-4 ta-break-all", children: e })
|
|
10808
10811
|
] }),
|
|
10809
|
-
/* @__PURE__ */ F.jsx("div", { className: "ta-flex ta-flex-row ta-w-1/4 ta-my-auto ta-justify-end", children: /* @__PURE__ */ F.jsx(ft, { className: "!ta-px-3 !ta-py-1 ta-flex-row !ta-bg-white !ta-border-[#D0D5DD] ta-rounded-2xl", variant: "outline", onClick: () =>
|
|
10812
|
+
/* @__PURE__ */ F.jsx("div", { className: "ta-flex ta-flex-row ta-w-1/4 ta-my-auto ta-justify-end", children: /* @__PURE__ */ F.jsx(ft, { className: "!ta-px-3 !ta-py-1 ta-flex-row !ta-bg-white !ta-border-[#D0D5DD] ta-rounded-2xl", variant: "outline", onClick: () => x(e), children: /* @__PURE__ */ F.jsxs("span", { className: "ta-flex ta-flex-row ta-text-[14px] ta-text-[#344054] ta-font-medium ta-gap-1 ta-justify-center ta-items-center", children: [
|
|
10810
10813
|
/* @__PURE__ */ F.jsx(Fa, { size: 18 }),
|
|
10811
10814
|
/* @__PURE__ */ F.jsx("span", { children: "Copy" })
|
|
10812
10815
|
] }) }) })
|
|
10813
10816
|
] }),
|
|
10814
|
-
|
|
10817
|
+
v ? /* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-col ta-p-4 ta-justify-center ta-items-center", children: [
|
|
10815
10818
|
/* @__PURE__ */ F.jsx("p", { children: "YOU PAID" }),
|
|
10816
10819
|
/* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-row ta-gap-2", children: [
|
|
10817
10820
|
/* @__PURE__ */ F.jsx("span", { className: "ta-text-[38px] leading-[48px] ta-font-bold", children: r || t }),
|
|
@@ -10826,16 +10829,16 @@ const Sx = ({
|
|
|
10826
10829
|
] })
|
|
10827
10830
|
] }),
|
|
10828
10831
|
/* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-col ta-p-4 ta-justify-center ta-items-center ta-w-1/2", children: [
|
|
10829
|
-
/* @__PURE__ */ F.jsx("p", { className: "ta-text-[12px] ta-text-secondary", children:
|
|
10832
|
+
/* @__PURE__ */ F.jsx("p", { className: "ta-text-[12px] ta-text-secondary", children: s == "over" ? "EXCESS" : "REMAINING" }),
|
|
10830
10833
|
/* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-row ta-gap-2", children: [
|
|
10831
|
-
/* @__PURE__ */ F.jsx("span", { className: "ta-text-[38px] leading-[48px] ta-font-bold", children: o }),
|
|
10834
|
+
/* @__PURE__ */ F.jsx("span", { className: "ta-text-[38px] leading-[48px] ta-font-bold", children: s == "over" ? l : o }),
|
|
10832
10835
|
/* @__PURE__ */ F.jsx("span", { className: "ta-text-xl ta-mt-auto ta-mb-4 ta-text-secondary ta-font-bold", children: n.toUpperCase() })
|
|
10833
10836
|
] })
|
|
10834
10837
|
] })
|
|
10835
10838
|
] }),
|
|
10836
|
-
/* @__PURE__ */ F.jsx("div", { className: "ta-text-[14px] ta-text-secondary ta-my-4", children: /* @__PURE__ */ F.jsx("p", { className: "ta-text-sm ta-text-secondary", children:
|
|
10839
|
+
/* @__PURE__ */ F.jsx("div", { className: "ta-text-[14px] ta-text-secondary ta-my-4", children: /* @__PURE__ */ F.jsx("p", { className: "ta-text-sm ta-text-secondary", children: m }) })
|
|
10837
10840
|
] }),
|
|
10838
|
-
/* @__PURE__ */ F.jsx(pr, { children:
|
|
10841
|
+
/* @__PURE__ */ F.jsx(pr, { children: u ? /* @__PURE__ */ F.jsxs("div", { className: "ta-flex ta-flex-row ta-w-full ta-items-center ta-gap-4", children: [
|
|
10839
10842
|
/* @__PURE__ */ F.jsxs("span", { children: [
|
|
10840
10843
|
/* @__PURE__ */ F.jsx(Le, { size: 16 }),
|
|
10841
10844
|
" "
|
|
@@ -10851,8 +10854,9 @@ const Sx = ({
|
|
|
10851
10854
|
loading: a,
|
|
10852
10855
|
status: o,
|
|
10853
10856
|
balance: l,
|
|
10854
|
-
|
|
10855
|
-
|
|
10857
|
+
excess: i,
|
|
10858
|
+
cancelPayment: x,
|
|
10859
|
+
confirmPayment: s
|
|
10856
10860
|
}) => o == Ze.PENDING ? /* @__PURE__ */ F.jsx(
|
|
10857
10861
|
Sx,
|
|
10858
10862
|
{
|
|
@@ -10863,8 +10867,8 @@ const Sx = ({
|
|
|
10863
10867
|
loading: a,
|
|
10864
10868
|
status: o,
|
|
10865
10869
|
balance: l,
|
|
10866
|
-
cancelPayment:
|
|
10867
|
-
confirmPayment:
|
|
10870
|
+
cancelPayment: x,
|
|
10871
|
+
confirmPayment: s
|
|
10868
10872
|
}
|
|
10869
10873
|
) : /* @__PURE__ */ F.jsx(
|
|
10870
10874
|
kx,
|
|
@@ -10875,7 +10879,8 @@ const Sx = ({
|
|
|
10875
10879
|
coin: String(n),
|
|
10876
10880
|
loading: a,
|
|
10877
10881
|
status: o,
|
|
10878
|
-
balance: l
|
|
10882
|
+
balance: l,
|
|
10883
|
+
excess: i
|
|
10879
10884
|
}
|
|
10880
10885
|
), Tx = ({
|
|
10881
10886
|
title: e = "An Error Occured",
|
|
@@ -10944,7 +10949,8 @@ const Sx = ({
|
|
|
10944
10949
|
cancelPayment: u.cancelPayment,
|
|
10945
10950
|
confirmPayment: u.confirmPayment,
|
|
10946
10951
|
balance: u.balance,
|
|
10947
|
-
status: u.status
|
|
10952
|
+
status: u.status,
|
|
10953
|
+
excess: u.excess
|
|
10948
10954
|
}
|
|
10949
10955
|
),
|
|
10950
10956
|
e === ze.INFO && /* @__PURE__ */ F.jsx(
|