mainstack-payments 1.0.55 → 1.0.57
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { I as b, u as A, a as v, b as E, v as H, C as k, F as x, T as z } from "./index-
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { I as b, u as A, a as v, b as E, v as H, C as k, F as x, T as z } from "./index-e5249507.js";
|
|
3
3
|
import { customSnackbar as B, SnackbarType as M, ExpandMoreIcon as $ } from "mainstack-design-system";
|
|
4
4
|
import { memo as j, useState as T, useCallback as P } from "react";
|
|
5
5
|
import "react-dom";
|
|
6
6
|
import "axios";
|
|
7
7
|
const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none", children: [
|
|
8
8
|
/* @__PURE__ */ c("g", { clipPath: "url(#clip0_3703_1664)", children: [
|
|
9
|
-
/* @__PURE__ */
|
|
9
|
+
/* @__PURE__ */ a(
|
|
10
10
|
"path",
|
|
11
11
|
{
|
|
12
12
|
fillRule: "evenodd",
|
|
@@ -15,7 +15,7 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
15
15
|
fill: "#00D533"
|
|
16
16
|
}
|
|
17
17
|
),
|
|
18
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ a(
|
|
19
19
|
"path",
|
|
20
20
|
{
|
|
21
21
|
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",
|
|
@@ -23,7 +23,7 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
23
23
|
}
|
|
24
24
|
)
|
|
25
25
|
] }),
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ a("defs", { children: /* @__PURE__ */ a("clipPath", { id: "clip0_3703_1664", children: /* @__PURE__ */ a("rect", { width: "32", height: "32", rx: "16", fill: "white" }) }) })
|
|
27
27
|
] }), V = j(
|
|
28
28
|
({
|
|
29
29
|
Request: i,
|
|
@@ -31,16 +31,16 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
31
31
|
amount: l,
|
|
32
32
|
currency: p,
|
|
33
33
|
redirectUrl: o,
|
|
34
|
-
checkForErrors:
|
|
34
|
+
checkForErrors: h
|
|
35
35
|
}) => {
|
|
36
|
-
const
|
|
36
|
+
const m = A(), { mutate: r, isLoading: I } = v(i), { mutate: f, isLoading: L } = E(i), [_, C] = T(!1), u = I || L || _, g = P(async () => {
|
|
37
37
|
var w;
|
|
38
38
|
const n = H(), y = {
|
|
39
39
|
...d,
|
|
40
40
|
reference: n
|
|
41
41
|
};
|
|
42
42
|
try {
|
|
43
|
-
await
|
|
43
|
+
await r(
|
|
44
44
|
{
|
|
45
45
|
amount: l,
|
|
46
46
|
reference: n,
|
|
@@ -57,7 +57,7 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
const { client_secret:
|
|
60
|
+
const { client_secret: t } = await f(
|
|
61
61
|
{
|
|
62
62
|
amount: l,
|
|
63
63
|
currency: p,
|
|
@@ -73,10 +73,10 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
const { error: e } = await
|
|
79
|
-
clientSecret:
|
|
76
|
+
if (m) {
|
|
77
|
+
C(!0);
|
|
78
|
+
const { error: e } = await m.confirmPayment({
|
|
79
|
+
clientSecret: t,
|
|
80
80
|
confirmParams: {
|
|
81
81
|
payment_method_data: {
|
|
82
82
|
// @ts-ignore
|
|
@@ -90,25 +90,25 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
90
90
|
e.message ?? "Couldn't load Cash App integration"
|
|
91
91
|
);
|
|
92
92
|
}
|
|
93
|
-
} catch (
|
|
94
|
-
|
|
95
|
-
((w =
|
|
93
|
+
} catch (t) {
|
|
94
|
+
C(!1), console.error(t), B(
|
|
95
|
+
((w = t == null ? void 0 : t.raw) == null ? void 0 : w.message) ?? (t == null ? void 0 : t.message) ?? t ?? "We couldn't complete your payment",
|
|
96
96
|
M.error
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
m,
|
|
101
|
+
r,
|
|
102
102
|
f,
|
|
103
103
|
l,
|
|
104
104
|
p,
|
|
105
105
|
d,
|
|
106
106
|
o,
|
|
107
|
-
|
|
107
|
+
C
|
|
108
108
|
]), S = P(async () => {
|
|
109
|
-
await
|
|
110
|
-
}, [
|
|
111
|
-
return /* @__PURE__ */
|
|
109
|
+
await h() || g();
|
|
110
|
+
}, [h, g]);
|
|
111
|
+
return /* @__PURE__ */ a(
|
|
112
112
|
k,
|
|
113
113
|
{
|
|
114
114
|
onClick: S,
|
|
@@ -116,8 +116,8 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
116
116
|
isLoading: u,
|
|
117
117
|
children: /* @__PURE__ */ c(x, { justifyContent: "space-between", w: "full", alignItems: "center", children: [
|
|
118
118
|
/* @__PURE__ */ c(x, { alignItems: "center", gap: "12px", children: [
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ a(F, { boxSize: "32px" }),
|
|
120
|
+
/* @__PURE__ */ a(
|
|
121
121
|
z,
|
|
122
122
|
{
|
|
123
123
|
color: "#111215",
|
|
@@ -130,7 +130,7 @@ const F = (i) => /* @__PURE__ */ c(b, { viewBox: "0 0 32 32", ...i, fill: "none"
|
|
|
130
130
|
}
|
|
131
131
|
)
|
|
132
132
|
] }),
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ a($, { transform: "rotate(-90deg)", boxSize: "24px" })
|
|
134
134
|
] })
|
|
135
135
|
}
|
|
136
136
|
);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { I as _, u as S, a as b, b as E, C as z, F as h, T as M, v as $ } from "./index-
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { I as _, u as S, a as b, b as E, C as z, F as h, T as M, v as $ } from "./index-e5249507.js";
|
|
3
3
|
import { ExpandMoreIcon as j, customSnackbar as k, SnackbarType as v } from "mainstack-design-system";
|
|
4
4
|
import { useState as B } from "react";
|
|
5
5
|
import "react-dom";
|
|
6
6
|
import "axios";
|
|
7
7
|
const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none", children: [
|
|
8
|
-
/* @__PURE__ */
|
|
8
|
+
/* @__PURE__ */ n("g", { clipPath: "url(#clip0_2605_970)", children: /* @__PURE__ */ n(
|
|
9
9
|
"path",
|
|
10
10
|
{
|
|
11
11
|
d: "M16 32C7.163 32 0 24.837 0 16C0 7.163 7.163 0 16 0C24.837 0 32 7.163 32 16C32 24.837 24.837 32 16 32ZM21.002 9.855L21.812 6.614L19.216 5.968L18.573 8.543C18.1498 8.40049 17.7157 8.29247 17.275 8.22L17.919 5.645L15.323 5L14.513 8.241C11.53 8.783 9.004 10.978 8.233 14.064C7.462 17.15 8.659 20.27 11.037 22.144L10.227 25.386L12.823 26.032L13.466 23.457C13.8892 23.5995 14.3233 23.7075 14.764 23.78L14.12 26.355L16.716 27L17.526 23.759C18.575 23.5709 19.5756 23.1744 20.4687 22.593C21.3619 22.0116 22.1294 21.2571 22.726 20.374L19.879 19.666C19.2215 20.3303 18.4022 20.8116 17.5018 21.0624C16.6014 21.3132 15.6512 21.3248 14.745 21.096C11.879 20.384 10.125 17.524 10.828 14.709C11.531 11.894 14.427 10.19 17.294 10.903C18.2012 11.1247 19.0347 11.5798 19.7118 12.223C20.3889 12.8663 20.8861 13.6753 21.154 14.57L24 15.278C23.8889 14.2194 23.5663 13.1938 23.0513 12.2623C22.5363 11.3307 21.8394 10.5121 21.002 9.855Z",
|
|
12
12
|
fill: "#131316"
|
|
13
13
|
}
|
|
14
14
|
) }),
|
|
15
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ n("clipPath", { id: "clip0_2605_970", children: /* @__PURE__ */ n("rect", { width: "32", height: "32", fill: "white" }) }) })
|
|
16
16
|
] }), A = ({
|
|
17
17
|
Request: s,
|
|
18
18
|
metadata: C,
|
|
@@ -45,7 +45,7 @@ const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none"
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
|
-
const { client_secret:
|
|
48
|
+
const { client_secret: e } = await w(
|
|
49
49
|
{
|
|
50
50
|
amount: r,
|
|
51
51
|
currency: l,
|
|
@@ -64,7 +64,7 @@ const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none"
|
|
|
64
64
|
if (m) {
|
|
65
65
|
p(!0);
|
|
66
66
|
const { error: t } = await m.confirmPayment({
|
|
67
|
-
clientSecret:
|
|
67
|
+
clientSecret: e,
|
|
68
68
|
confirmParams: {
|
|
69
69
|
payment_method_data: {
|
|
70
70
|
// @ts-ignore
|
|
@@ -76,14 +76,14 @@ const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none"
|
|
|
76
76
|
if (t)
|
|
77
77
|
throw new Error(t.message ?? "Couldn't load wallet integration");
|
|
78
78
|
}
|
|
79
|
-
} catch (
|
|
80
|
-
p(!1), k(
|
|
81
|
-
((f =
|
|
79
|
+
} catch (e) {
|
|
80
|
+
p(!1), console.error(e), k(
|
|
81
|
+
((f = e == null ? void 0 : e.raw) == null ? void 0 : f.message) ?? (e == null ? void 0 : e.message) ?? e ?? "We couldn't complete your payment",
|
|
82
82
|
v.error
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ n(
|
|
87
87
|
z,
|
|
88
88
|
{
|
|
89
89
|
onClick: async () => {
|
|
@@ -93,8 +93,8 @@ const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none"
|
|
|
93
93
|
isLoading: d,
|
|
94
94
|
children: /* @__PURE__ */ c(h, { justifyContent: "space-between", w: "full", alignItems: "center", children: [
|
|
95
95
|
/* @__PURE__ */ c(h, { alignItems: "center", gap: "12px", children: [
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ n(F, { boxSize: "32px" }),
|
|
97
|
+
/* @__PURE__ */ n(
|
|
98
98
|
M,
|
|
99
99
|
{
|
|
100
100
|
color: "#111215",
|
|
@@ -107,7 +107,7 @@ const F = (s) => /* @__PURE__ */ c(_, { viewBox: "0 0 32 32", ...s, fill: "none"
|
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
] }),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ n(j, { transform: "rotate(-90deg)", boxSize: "24px" })
|
|
111
111
|
] })
|
|
112
112
|
}
|
|
113
113
|
);
|