mainstack-payments 2.0.7 → 2.0.8
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/{CashAppPayment-D4Ml8WuY.js → CashAppPayment-CpquRmvy.js} +50 -50
- package/build/{CryptoPayments-6A3VCTqi.js → CryptoPayments-NwBMYtta.js} +35 -35
- package/build/{index-DvHbcsZ0.js → index-Di1ugn5_.js} +85 -85
- package/build/mainstack-payments.js +1 -1
- package/build/{payments-CjiNVkeO.js → payments-B3Hm80pK.js} +145 -143
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { u as z, a as H, v as M, b as N, c as B, E as R, C as $ } from "./index-
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { u as z, a as H, v as M, b as N, c as B, E as R, C as $ } from "./index-Di1ugn5_.js";
|
|
3
3
|
import { toast as w, BodyText as j, ChevronRightIcon as k } from "mainstack-design-system";
|
|
4
|
-
import { u as V } from "./payments-
|
|
4
|
+
import { u as V } from "./payments-B3Hm80pK.js";
|
|
5
5
|
import { memo as Z, useState as D, useCallback as L } from "react";
|
|
6
|
-
const T = (
|
|
6
|
+
const T = (s) => /* @__PURE__ */ i(
|
|
7
7
|
"svg",
|
|
8
8
|
{
|
|
9
9
|
viewBox: "0 0 32 32",
|
|
10
10
|
fill: "none",
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
-
...
|
|
12
|
+
...s,
|
|
13
13
|
children: [
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
14
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_3703_1664)", children: [
|
|
15
|
+
/* @__PURE__ */ a(
|
|
16
16
|
"path",
|
|
17
17
|
{
|
|
18
18
|
fillRule: "evenodd",
|
|
@@ -21,7 +21,7 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
21
21
|
fill: "#00D533"
|
|
22
22
|
}
|
|
23
23
|
),
|
|
24
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ a(
|
|
25
25
|
"path",
|
|
26
26
|
{
|
|
27
27
|
d: "M17.3184 14.4455C20.6877 15.1617 22.2274 16.5636 22.2274 18.9255C22.2274 21.8817 19.8186 24.0607 16.0531 24.3045L15.6872 26.0569C15.6567 26.2245 15.5042 26.3464 15.3213 26.3464H12.4247C12.1808 26.3464 12.0132 26.1179 12.0589 25.8893L12.5162 23.9388C10.6562 23.4055 9.14687 22.3693 8.27799 21.1045C8.17133 20.9369 8.2018 20.7236 8.35418 20.6017L10.3665 19.0322C10.5343 18.895 10.7781 18.9407 10.9002 19.1084C11.9673 20.6017 13.6138 21.4855 15.5958 21.4855C17.3796 21.4855 18.7211 20.6169 18.7211 19.3674C18.7211 18.4074 18.0503 17.9655 15.7788 17.4931C11.9065 16.655 10.3667 15.2226 10.3667 12.8607C10.3667 10.1179 12.6687 8.06074 16.1447 7.78645L16.5258 5.97312C16.5562 5.8055 16.7088 5.68359 16.8916 5.68359H19.7425C19.9713 5.68359 20.1541 5.89693 20.1084 6.1255L19.6663 8.15217C21.1604 8.60931 22.3799 9.43216 23.1423 10.4531C23.2642 10.6055 23.2337 10.8341 23.0813 10.956L21.2366 12.4645C21.0689 12.6017 20.8403 12.5712 20.7182 12.4036C19.773 11.2455 18.3094 10.5903 16.7086 10.5903C14.9248 10.5903 13.812 11.3674 13.812 12.4645C13.7815 13.3788 14.6506 13.8665 17.3184 14.4455Z",
|
|
@@ -29,34 +29,34 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
29
29
|
}
|
|
30
30
|
)
|
|
31
31
|
] }),
|
|
32
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a("clipPath", { id: "clip0_3703_1664", children: /* @__PURE__ */ a("rect", { width: "32", height: "32", rx: "16", fill: "white" }) }) })
|
|
33
33
|
]
|
|
34
34
|
}
|
|
35
35
|
), W = Z(
|
|
36
36
|
({
|
|
37
|
-
ProductRequest:
|
|
37
|
+
ProductRequest: s,
|
|
38
38
|
PaymentRequest: v,
|
|
39
|
-
metadata:
|
|
39
|
+
metadata: c,
|
|
40
40
|
subAmount: x,
|
|
41
|
-
totalAmount:
|
|
42
|
-
currency:
|
|
41
|
+
totalAmount: d,
|
|
42
|
+
currency: l,
|
|
43
43
|
redirectUrl: n,
|
|
44
|
-
checkForErrors:
|
|
45
|
-
feesResponse:
|
|
44
|
+
checkForErrors: p,
|
|
45
|
+
feesResponse: C,
|
|
46
46
|
ip: I
|
|
47
47
|
}) => {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
...
|
|
51
|
-
reference:
|
|
48
|
+
const o = V(), { mutate: h, isLoading: _ } = z(s), { mutate: u, isLoading: A } = H(v), [b, m] = D(!1), f = _ || A || b, y = L(async () => {
|
|
49
|
+
const P = M(), g = {
|
|
50
|
+
...c,
|
|
51
|
+
reference: P
|
|
52
52
|
};
|
|
53
53
|
try {
|
|
54
|
-
const
|
|
54
|
+
const t = await h(
|
|
55
55
|
N({
|
|
56
56
|
metadata: g,
|
|
57
57
|
amount: x,
|
|
58
|
-
totalAmount:
|
|
59
|
-
currency:
|
|
58
|
+
totalAmount: d,
|
|
59
|
+
currency: l
|
|
60
60
|
}),
|
|
61
61
|
{
|
|
62
62
|
onSuccess: (e) => e,
|
|
@@ -65,23 +65,23 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
|
-
let
|
|
69
|
-
if (
|
|
70
|
-
initResponse:
|
|
71
|
-
feesResponse:
|
|
68
|
+
let r = null;
|
|
69
|
+
if (C && (r = B({
|
|
70
|
+
initResponse: t,
|
|
71
|
+
feesResponse: C,
|
|
72
72
|
metadata: g,
|
|
73
|
-
currency:
|
|
73
|
+
currency: l,
|
|
74
74
|
ip: I,
|
|
75
75
|
paymentMethod: R.CASHAPP
|
|
76
|
-
})), !
|
|
76
|
+
})), !r) {
|
|
77
77
|
w.error({
|
|
78
78
|
title: "",
|
|
79
79
|
description: "Payment initialization data is missing. Please try again."
|
|
80
80
|
});
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const { client_secret: S } = await
|
|
84
|
-
|
|
83
|
+
const { client_secret: S } = await u(
|
|
84
|
+
r,
|
|
85
85
|
{
|
|
86
86
|
onSuccess: () => {
|
|
87
87
|
},
|
|
@@ -90,9 +90,9 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
const { error: e } = await
|
|
93
|
+
if (o) {
|
|
94
|
+
m(!0);
|
|
95
|
+
const { error: e } = await o.confirmPayment({
|
|
96
96
|
// @ts-ignore
|
|
97
97
|
clientSecret: S,
|
|
98
98
|
confirmParams: {
|
|
@@ -100,7 +100,7 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
100
100
|
// @ts-ignore
|
|
101
101
|
type: "cashapp"
|
|
102
102
|
},
|
|
103
|
-
return_url: n.includes("?") ? `${n}&reference=${
|
|
103
|
+
return_url: n.includes("?") ? `${n}&reference=${t.reference}` : `${n}?reference=${t.reference}`
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
if (e)
|
|
@@ -108,36 +108,36 @@ const T = (l) => /* @__PURE__ */ s(
|
|
|
108
108
|
e.message ?? "Couldn't load Cash App integration"
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
|
-
} catch (
|
|
112
|
-
|
|
111
|
+
} catch (t) {
|
|
112
|
+
m(!1), console.error(t), w.error({
|
|
113
113
|
title: "",
|
|
114
|
-
description: (
|
|
114
|
+
description: (t == null ? void 0 : t.message) ?? t ?? "We couldn't complete your payment"
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
}, [
|
|
118
|
-
m,
|
|
119
|
-
u,
|
|
120
|
-
y,
|
|
121
|
-
p,
|
|
122
118
|
o,
|
|
119
|
+
h,
|
|
120
|
+
u,
|
|
123
121
|
d,
|
|
122
|
+
l,
|
|
123
|
+
c,
|
|
124
124
|
n,
|
|
125
|
-
|
|
125
|
+
m
|
|
126
126
|
]), E = L(async () => {
|
|
127
|
-
await
|
|
128
|
-
}, [
|
|
129
|
-
return /* @__PURE__ */
|
|
127
|
+
await p() || y();
|
|
128
|
+
}, [p, y]);
|
|
129
|
+
return /* @__PURE__ */ a(
|
|
130
130
|
$,
|
|
131
131
|
{
|
|
132
132
|
onClick: E,
|
|
133
133
|
disabled: f,
|
|
134
134
|
isLoading: f,
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ i("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
|
|
136
|
+
/* @__PURE__ */ i("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
|
|
137
|
+
/* @__PURE__ */ a(T, { className: "mpl:size-32" }),
|
|
138
|
+
/* @__PURE__ */ a(j, { size: "extrasmall", weight: "medium", children: "Cash App Pay" })
|
|
139
139
|
] }),
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ a(k, { className: "mpl:size-20" })
|
|
141
141
|
] })
|
|
142
142
|
}
|
|
143
143
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { u as S, a as z, C as M, v as N, b as $, c as j, E as B } from "./index-
|
|
2
|
+
import { u as S, a as z, C as M, v as N, b as $, c as j, E as B } from "./index-Di1ugn5_.js";
|
|
3
3
|
import { BodyText as R, ChevronRightIcon as T, toast as h } from "mainstack-design-system";
|
|
4
|
-
import { u as Z } from "./payments-
|
|
4
|
+
import { u as Z } from "./payments-B3Hm80pK.js";
|
|
5
5
|
import { useState as k } from "react";
|
|
6
|
-
const O = (
|
|
6
|
+
const O = (a) => /* @__PURE__ */ r(
|
|
7
7
|
"svg",
|
|
8
8
|
{
|
|
9
9
|
viewBox: "0 0 32 32",
|
|
10
10
|
fill: "none",
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
-
...
|
|
12
|
+
...a,
|
|
13
13
|
children: [
|
|
14
14
|
/* @__PURE__ */ t("g", { clipPath: "url(#clip0_2605_970)", children: /* @__PURE__ */ t(
|
|
15
15
|
"path",
|
|
@@ -22,46 +22,46 @@ const O = (i) => /* @__PURE__ */ r(
|
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
), F = ({
|
|
25
|
-
ProductRequest:
|
|
25
|
+
ProductRequest: a,
|
|
26
26
|
PaymentRequest: u,
|
|
27
27
|
metadata: C,
|
|
28
28
|
subAmount: f,
|
|
29
29
|
totalAmount: g,
|
|
30
|
-
currency:
|
|
31
|
-
redirectUrl:
|
|
30
|
+
currency: o,
|
|
31
|
+
redirectUrl: i,
|
|
32
32
|
checkForErrors: P,
|
|
33
|
-
feesResponse:
|
|
33
|
+
feesResponse: l,
|
|
34
34
|
ip: L
|
|
35
35
|
}) => {
|
|
36
|
-
const c = Z(), { mutate: w, isLoading: x } = S(
|
|
37
|
-
const
|
|
36
|
+
const c = Z(), { mutate: w, isLoading: x } = S(a), { mutate: I, isLoading: v } = z(u), [_, m] = k(!1), d = x || v || _, E = async () => {
|
|
37
|
+
const p = N(), y = {
|
|
38
38
|
...C,
|
|
39
|
-
reference:
|
|
39
|
+
reference: p
|
|
40
40
|
};
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const e = await w(
|
|
43
43
|
$({
|
|
44
44
|
metadata: y,
|
|
45
45
|
amount: f,
|
|
46
46
|
totalAmount: g,
|
|
47
|
-
currency:
|
|
47
|
+
currency: o
|
|
48
48
|
}),
|
|
49
49
|
{
|
|
50
|
-
onSuccess: (
|
|
51
|
-
onError: (
|
|
52
|
-
throw
|
|
50
|
+
onSuccess: (n) => n,
|
|
51
|
+
onError: (n) => {
|
|
52
|
+
throw n;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
|
-
let
|
|
57
|
-
if (
|
|
58
|
-
initResponse:
|
|
59
|
-
feesResponse:
|
|
56
|
+
let s = null;
|
|
57
|
+
if (l && (s = j({
|
|
58
|
+
initResponse: e,
|
|
59
|
+
feesResponse: l,
|
|
60
60
|
metadata: y,
|
|
61
|
-
currency:
|
|
61
|
+
currency: o,
|
|
62
62
|
ip: L,
|
|
63
63
|
paymentMethod: B.CRYPTO
|
|
64
|
-
})), !
|
|
64
|
+
})), !s) {
|
|
65
65
|
h.error({
|
|
66
66
|
title: "",
|
|
67
67
|
description: "Payment initialization data is missing. Please try again."
|
|
@@ -69,18 +69,18 @@ const O = (i) => /* @__PURE__ */ r(
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
const { client_secret: b } = await I(
|
|
72
|
-
|
|
72
|
+
s,
|
|
73
73
|
{
|
|
74
74
|
onSuccess: () => {
|
|
75
75
|
},
|
|
76
|
-
onError: (
|
|
77
|
-
throw
|
|
76
|
+
onError: (n) => {
|
|
77
|
+
throw n;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
if (c) {
|
|
82
|
-
|
|
83
|
-
const { error:
|
|
82
|
+
m(!0);
|
|
83
|
+
const { error: n } = await c.confirmPayment({
|
|
84
84
|
// @ts-ignore
|
|
85
85
|
clientSecret: b,
|
|
86
86
|
confirmParams: {
|
|
@@ -88,16 +88,16 @@ const O = (i) => /* @__PURE__ */ r(
|
|
|
88
88
|
// @ts-ignore
|
|
89
89
|
type: "crypto"
|
|
90
90
|
},
|
|
91
|
-
return_url:
|
|
91
|
+
return_url: i.includes("?") ? `${i}&reference=${e.reference}` : `${i}?reference=${e.reference}`
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
-
if (
|
|
95
|
-
throw new Error(
|
|
94
|
+
if (n)
|
|
95
|
+
throw new Error(n.message ?? "Couldn't load wallet integration");
|
|
96
96
|
}
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
97
|
+
} catch (e) {
|
|
98
|
+
m(!1), console.error(e), h.error({
|
|
99
99
|
title: "",
|
|
100
|
-
description: (
|
|
100
|
+
description: (e == null ? void 0 : e.message) ?? e ?? "We couldn't complete your payment"
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
};
|
|
@@ -107,8 +107,8 @@ const O = (i) => /* @__PURE__ */ r(
|
|
|
107
107
|
onClick: async () => {
|
|
108
108
|
await P() || E();
|
|
109
109
|
},
|
|
110
|
-
disabled:
|
|
111
|
-
isLoading:
|
|
110
|
+
disabled: d,
|
|
111
|
+
isLoading: d,
|
|
112
112
|
children: /* @__PURE__ */ r("div", { className: "mpl:flex mpl:justify-between mpl:w-full mpl:items-center", children: [
|
|
113
113
|
/* @__PURE__ */ r("div", { className: "mpl:flex mpl:items-center mpl:gap-12", children: [
|
|
114
114
|
/* @__PURE__ */ t(O, { className: "mpl:size-32" }),
|