strapi5-plugin-for-stripe 1.0.0 → 1.0.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/README.md +5 -5
- package/dist/_chunks/App-Cs1bX9aF.js +564 -0
- package/dist/_chunks/App-TlX-jgR6.mjs +564 -0
- package/dist/_chunks/SettingsPage-C2RxHIk_.mjs +160 -0
- package/dist/_chunks/SettingsPage-CC-uxoJi.js +160 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/admin/index.js +81 -0
- package/dist/admin/index.mjs +82 -0
- package/dist/server/index.js +306 -0
- package/dist/server/index.mjs +304 -0
- package/package.json +2 -2
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Flex, Box, Typography, Switch, TextInput, SingleSelect, SingleSelectOption, Button, Alert } from "@strapi/design-system";
|
|
4
|
+
import { useFetchClient } from "@strapi/strapi/admin";
|
|
5
|
+
const SettingsPage = () => {
|
|
6
|
+
const [data, setData] = useState(null);
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
const [error, setError] = useState("");
|
|
9
|
+
const [success, setSuccess] = useState("");
|
|
10
|
+
const { get, put } = useFetchClient();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const load = async () => {
|
|
13
|
+
const res = await get("/strapi5-plugin-for-stripe/settings");
|
|
14
|
+
setData({
|
|
15
|
+
environment: res.data?.environment ?? "test",
|
|
16
|
+
currency: res.data?.currency ?? "eur",
|
|
17
|
+
checkout: res.data?.checkout ?? {},
|
|
18
|
+
webhook: res.data?.webhook ?? {}
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
load();
|
|
22
|
+
}, []);
|
|
23
|
+
const save = async () => {
|
|
24
|
+
setError("");
|
|
25
|
+
setSuccess("");
|
|
26
|
+
if (!data.checkout?.successUrl || !data.checkout?.cancelUrl) {
|
|
27
|
+
setError("Both Success URL and Cancel URL are required.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setLoading(true);
|
|
31
|
+
try {
|
|
32
|
+
await put("/strapi5-plugin-for-stripe/settings", data);
|
|
33
|
+
setSuccess("Settings saved.");
|
|
34
|
+
} catch (err) {
|
|
35
|
+
setError(
|
|
36
|
+
err?.response?.data?.error?.message || err?.response?.data?.message || err?.message || "An unexpected error occurred."
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
setLoading(false);
|
|
40
|
+
};
|
|
41
|
+
if (!data) return null;
|
|
42
|
+
const isLive = data.environment === "live";
|
|
43
|
+
return /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", minHeight: "100vh", children: /* @__PURE__ */ jsxs(
|
|
44
|
+
Box,
|
|
45
|
+
{
|
|
46
|
+
padding: 7,
|
|
47
|
+
width: "100%",
|
|
48
|
+
maxWidth: "1000px",
|
|
49
|
+
background: "neutral0",
|
|
50
|
+
borderRadius: "8px",
|
|
51
|
+
shadow: "tableShadow",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "beta", children: "Stripe Settings" }) }),
|
|
54
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 7, children: /* @__PURE__ */ jsxs(Flex, { wrap: "wrap", gap: 6, justifyContent: "space-between", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Box, { width: "48%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "center", gap: 3, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: "Environment" }),
|
|
57
|
+
/* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, children: [
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
Switch,
|
|
60
|
+
{
|
|
61
|
+
selected: isLive,
|
|
62
|
+
onChange: (checked) => setData({
|
|
63
|
+
...data,
|
|
64
|
+
environment: checked ? "live" : "test"
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
Typography,
|
|
70
|
+
{
|
|
71
|
+
fontWeight: "bold",
|
|
72
|
+
textColor: isLive ? "success600" : "warning600",
|
|
73
|
+
children: isLive ? "LIVE" : "TEST"
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] })
|
|
77
|
+
] }) }),
|
|
78
|
+
/* @__PURE__ */ jsx(Box, { width: "48%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: "Checkout success URL" }),
|
|
80
|
+
/* @__PURE__ */ jsx(Box, { width: "80%", children: /* @__PURE__ */ jsx(
|
|
81
|
+
TextInput,
|
|
82
|
+
{
|
|
83
|
+
value: data.checkout?.successUrl || "",
|
|
84
|
+
onChange: (e) => setData({
|
|
85
|
+
...data,
|
|
86
|
+
checkout: {
|
|
87
|
+
...data.checkout,
|
|
88
|
+
successUrl: e.target.value
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
] }) }),
|
|
94
|
+
/* @__PURE__ */ jsx(Box, { width: "48%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
|
95
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: "Checkout cancel URL" }),
|
|
96
|
+
/* @__PURE__ */ jsx(Box, { width: "80%", children: /* @__PURE__ */ jsx(
|
|
97
|
+
TextInput,
|
|
98
|
+
{
|
|
99
|
+
value: data.checkout?.cancelUrl || "",
|
|
100
|
+
onChange: (e) => setData({
|
|
101
|
+
...data,
|
|
102
|
+
checkout: {
|
|
103
|
+
...data.checkout,
|
|
104
|
+
cancelUrl: e.target.value
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
) })
|
|
109
|
+
] }) }),
|
|
110
|
+
/* @__PURE__ */ jsx(Box, { width: "48%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: "Webhook forward URL" }),
|
|
112
|
+
/* @__PURE__ */ jsx(Box, { width: "80%", children: /* @__PURE__ */ jsx(
|
|
113
|
+
TextInput,
|
|
114
|
+
{
|
|
115
|
+
value: data.webhook?.forwardUrl || "",
|
|
116
|
+
onChange: (e) => setData({
|
|
117
|
+
...data,
|
|
118
|
+
webhook: {
|
|
119
|
+
...data.webhook,
|
|
120
|
+
forwardUrl: e.target.value
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
) })
|
|
125
|
+
] }) }),
|
|
126
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
|
127
|
+
/* @__PURE__ */ jsx(Typography, { textAlign: "center", children: "Currency" }),
|
|
128
|
+
/* @__PURE__ */ jsx(Box, { width: "38%", children: /* @__PURE__ */ jsxs(
|
|
129
|
+
SingleSelect,
|
|
130
|
+
{
|
|
131
|
+
value: data.currency || "eur",
|
|
132
|
+
onChange: (value) => {
|
|
133
|
+
setData({
|
|
134
|
+
...data,
|
|
135
|
+
currency: value
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
required: true,
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "eur", children: "EUR (€)" }),
|
|
141
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "usd", children: "USD ($)" }),
|
|
142
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "gbp", children: "GBP (£)" }),
|
|
143
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "cad", children: "CAD (CA$)" })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
) })
|
|
147
|
+
] }) })
|
|
148
|
+
] }) }),
|
|
149
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", marginTop: 7, children: /* @__PURE__ */ jsx(Button, { loading, onClick: save, children: "Save" }) }),
|
|
150
|
+
/* @__PURE__ */ jsxs(Box, { paddingTop: 6, children: [
|
|
151
|
+
error && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "danger", title: "Save failed", children: error }) }),
|
|
152
|
+
success && /* @__PURE__ */ jsx(Box, { paddingBottom: 4, children: /* @__PURE__ */ jsx(Alert, { variant: "success", title: "Success", children: success }) })
|
|
153
|
+
] })
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
) });
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
SettingsPage as default
|
|
160
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const designSystem = require("@strapi/design-system");
|
|
6
|
+
const admin = require("@strapi/strapi/admin");
|
|
7
|
+
const SettingsPage = () => {
|
|
8
|
+
const [data, setData] = react.useState(null);
|
|
9
|
+
const [loading, setLoading] = react.useState(false);
|
|
10
|
+
const [error, setError] = react.useState("");
|
|
11
|
+
const [success, setSuccess] = react.useState("");
|
|
12
|
+
const { get, put } = admin.useFetchClient();
|
|
13
|
+
react.useEffect(() => {
|
|
14
|
+
const load = async () => {
|
|
15
|
+
const res = await get("/strapi5-plugin-for-stripe/settings");
|
|
16
|
+
setData({
|
|
17
|
+
environment: res.data?.environment ?? "test",
|
|
18
|
+
currency: res.data?.currency ?? "eur",
|
|
19
|
+
checkout: res.data?.checkout ?? {},
|
|
20
|
+
webhook: res.data?.webhook ?? {}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
load();
|
|
24
|
+
}, []);
|
|
25
|
+
const save = async () => {
|
|
26
|
+
setError("");
|
|
27
|
+
setSuccess("");
|
|
28
|
+
if (!data.checkout?.successUrl || !data.checkout?.cancelUrl) {
|
|
29
|
+
setError("Both Success URL and Cancel URL are required.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setLoading(true);
|
|
33
|
+
try {
|
|
34
|
+
await put("/strapi5-plugin-for-stripe/settings", data);
|
|
35
|
+
setSuccess("Settings saved.");
|
|
36
|
+
} catch (err) {
|
|
37
|
+
setError(
|
|
38
|
+
err?.response?.data?.error?.message || err?.response?.data?.message || err?.message || "An unexpected error occurred."
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
setLoading(false);
|
|
42
|
+
};
|
|
43
|
+
if (!data) return null;
|
|
44
|
+
const isLive = data.environment === "live";
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", minHeight: "100vh", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
46
|
+
designSystem.Box,
|
|
47
|
+
{
|
|
48
|
+
padding: 7,
|
|
49
|
+
width: "100%",
|
|
50
|
+
maxWidth: "1000px",
|
|
51
|
+
background: "neutral0",
|
|
52
|
+
borderRadius: "8px",
|
|
53
|
+
shadow: "tableShadow",
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Stripe Settings" }) }),
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 7, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { wrap: "wrap", gap: 6, justifyContent: "space-between", children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "48%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 3, children: [
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: "Environment" }),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
designSystem.Switch,
|
|
62
|
+
{
|
|
63
|
+
selected: isLive,
|
|
64
|
+
onChange: (checked) => setData({
|
|
65
|
+
...data,
|
|
66
|
+
environment: checked ? "live" : "test"
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
designSystem.Typography,
|
|
72
|
+
{
|
|
73
|
+
fontWeight: "bold",
|
|
74
|
+
textColor: isLive ? "success600" : "warning600",
|
|
75
|
+
children: isLive ? "LIVE" : "TEST"
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
] }) }),
|
|
80
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "48%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
81
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: "Checkout success URL" }),
|
|
82
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "80%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
+
designSystem.TextInput,
|
|
84
|
+
{
|
|
85
|
+
value: data.checkout?.successUrl || "",
|
|
86
|
+
onChange: (e) => setData({
|
|
87
|
+
...data,
|
|
88
|
+
checkout: {
|
|
89
|
+
...data.checkout,
|
|
90
|
+
successUrl: e.target.value
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
) })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "48%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: "Checkout cancel URL" }),
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "80%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
+
designSystem.TextInput,
|
|
100
|
+
{
|
|
101
|
+
value: data.checkout?.cancelUrl || "",
|
|
102
|
+
onChange: (e) => setData({
|
|
103
|
+
...data,
|
|
104
|
+
checkout: {
|
|
105
|
+
...data.checkout,
|
|
106
|
+
cancelUrl: e.target.value
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
) })
|
|
111
|
+
] }) }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "48%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: "Webhook forward URL" }),
|
|
114
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "80%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
+
designSystem.TextInput,
|
|
116
|
+
{
|
|
117
|
+
value: data.webhook?.forwardUrl || "",
|
|
118
|
+
onChange: (e) => setData({
|
|
119
|
+
...data,
|
|
120
|
+
webhook: {
|
|
121
|
+
...data.webhook,
|
|
122
|
+
forwardUrl: e.target.value
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
) })
|
|
127
|
+
] }) }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", children: "Currency" }),
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "38%", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
131
|
+
designSystem.SingleSelect,
|
|
132
|
+
{
|
|
133
|
+
value: data.currency || "eur",
|
|
134
|
+
onChange: (value) => {
|
|
135
|
+
setData({
|
|
136
|
+
...data,
|
|
137
|
+
currency: value
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
required: true,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "eur", children: "EUR (€)" }),
|
|
143
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "usd", children: "USD ($)" }),
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "gbp", children: "GBP (£)" }),
|
|
145
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "cad", children: "CAD (CA$)" })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
] }) })
|
|
150
|
+
] }) }),
|
|
151
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", marginTop: 7, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { loading, onClick: save, children: "Save" }) }),
|
|
152
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingTop: 6, children: [
|
|
153
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "danger", title: "Save failed", children: error }) }),
|
|
154
|
+
success && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { variant: "success", title: "Success", children: success }) })
|
|
155
|
+
] })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
) });
|
|
159
|
+
};
|
|
160
|
+
exports.default = SettingsPage;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
5
|
+
const v = glob[path];
|
|
6
|
+
if (v) {
|
|
7
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
8
|
+
}
|
|
9
|
+
return new Promise((_, reject) => {
|
|
10
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
11
|
+
reject.bind(
|
|
12
|
+
null,
|
|
13
|
+
new Error(
|
|
14
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const PLUGIN_ID = "strapi5-plugin-for-stripe";
|
|
21
|
+
const Initializer = ({ setPlugin }) => {
|
|
22
|
+
const ref = react.useRef(setPlugin);
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
ref.current(PLUGIN_ID);
|
|
25
|
+
}, []);
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx("span", { children: "💸" });
|
|
29
|
+
const index = {
|
|
30
|
+
register(app) {
|
|
31
|
+
app.addMenuLink({
|
|
32
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
33
|
+
icon: PluginIcon,
|
|
34
|
+
intlLabel: {
|
|
35
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
36
|
+
defaultMessage: "Strapi 5 Plugin for Stripe"
|
|
37
|
+
},
|
|
38
|
+
Component: async () => {
|
|
39
|
+
const { App } = await Promise.resolve().then(() => require("../_chunks/App-Cs1bX9aF.js"));
|
|
40
|
+
return App;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
app.registerPlugin({
|
|
44
|
+
id: PLUGIN_ID,
|
|
45
|
+
initializer: Initializer,
|
|
46
|
+
isReady: false,
|
|
47
|
+
name: "Strapi 5 Plugin for Stripe"
|
|
48
|
+
});
|
|
49
|
+
app.createSettingSection(
|
|
50
|
+
{
|
|
51
|
+
id: PLUGIN_ID,
|
|
52
|
+
intlLabel: { id: PLUGIN_ID, defaultMessage: "Stripe configuration" }
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
id: PLUGIN_ID,
|
|
57
|
+
intlLabel: {
|
|
58
|
+
id: `${PLUGIN_ID}.settings.title`,
|
|
59
|
+
defaultMessage: "Stripe"
|
|
60
|
+
},
|
|
61
|
+
to: `/settings/${PLUGIN_ID}`,
|
|
62
|
+
Component: async () => Promise.resolve().then(() => require("../_chunks/SettingsPage-CC-uxoJi.js")),
|
|
63
|
+
permissions: []
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
async registerTrads({ locales }) {
|
|
69
|
+
return Promise.all(
|
|
70
|
+
locales.map(async (locale) => {
|
|
71
|
+
try {
|
|
72
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("../_chunks/en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3);
|
|
73
|
+
return { data, locale };
|
|
74
|
+
} catch {
|
|
75
|
+
return { data: {}, locale };
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
module.exports = index;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
4
|
+
const v = glob[path];
|
|
5
|
+
if (v) {
|
|
6
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
7
|
+
}
|
|
8
|
+
return new Promise((_, reject) => {
|
|
9
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
10
|
+
reject.bind(
|
|
11
|
+
null,
|
|
12
|
+
new Error(
|
|
13
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const PLUGIN_ID = "strapi5-plugin-for-stripe";
|
|
20
|
+
const Initializer = ({ setPlugin }) => {
|
|
21
|
+
const ref = useRef(setPlugin);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
ref.current(PLUGIN_ID);
|
|
24
|
+
}, []);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
const PluginIcon = () => /* @__PURE__ */ jsx("span", { children: "💸" });
|
|
28
|
+
const index = {
|
|
29
|
+
register(app) {
|
|
30
|
+
app.addMenuLink({
|
|
31
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
32
|
+
icon: PluginIcon,
|
|
33
|
+
intlLabel: {
|
|
34
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
35
|
+
defaultMessage: "Strapi 5 Plugin for Stripe"
|
|
36
|
+
},
|
|
37
|
+
Component: async () => {
|
|
38
|
+
const { App } = await import("../_chunks/App-TlX-jgR6.mjs");
|
|
39
|
+
return App;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
app.registerPlugin({
|
|
43
|
+
id: PLUGIN_ID,
|
|
44
|
+
initializer: Initializer,
|
|
45
|
+
isReady: false,
|
|
46
|
+
name: "Strapi 5 Plugin for Stripe"
|
|
47
|
+
});
|
|
48
|
+
app.createSettingSection(
|
|
49
|
+
{
|
|
50
|
+
id: PLUGIN_ID,
|
|
51
|
+
intlLabel: { id: PLUGIN_ID, defaultMessage: "Stripe configuration" }
|
|
52
|
+
},
|
|
53
|
+
[
|
|
54
|
+
{
|
|
55
|
+
id: PLUGIN_ID,
|
|
56
|
+
intlLabel: {
|
|
57
|
+
id: `${PLUGIN_ID}.settings.title`,
|
|
58
|
+
defaultMessage: "Stripe"
|
|
59
|
+
},
|
|
60
|
+
to: `/settings/${PLUGIN_ID}`,
|
|
61
|
+
Component: async () => import("../_chunks/SettingsPage-C2RxHIk_.mjs"),
|
|
62
|
+
permissions: []
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
async registerTrads({ locales }) {
|
|
68
|
+
return Promise.all(
|
|
69
|
+
locales.map(async (locale) => {
|
|
70
|
+
try {
|
|
71
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("../_chunks/en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3);
|
|
72
|
+
return { data, locale };
|
|
73
|
+
} catch {
|
|
74
|
+
return { data: {}, locale };
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
index as default
|
|
82
|
+
};
|