@blocklet/payment-react 1.14.10 → 1.14.11
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/es/contexts/payment.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type PaymentContextType = {
|
|
|
15
15
|
settings: Settings;
|
|
16
16
|
refresh: () => void;
|
|
17
17
|
getCurrency: (currencyId: string) => TPaymentCurrency | undefined;
|
|
18
|
+
getMethod: (methodId: string) => TPaymentMethodExpanded | undefined;
|
|
18
19
|
setLivemode: (livemode: boolean) => void;
|
|
19
20
|
api: Axios;
|
|
20
21
|
};
|
package/es/contexts/payment.js
CHANGED
|
@@ -14,6 +14,9 @@ const getCurrency = (currencyId, methods) => {
|
|
|
14
14
|
const currencies = methods.reduce((acc, x) => acc.concat(x.payment_currencies), []);
|
|
15
15
|
return currencies.find((x) => x.id === currencyId);
|
|
16
16
|
};
|
|
17
|
+
const getMethod = (methodId, methods) => {
|
|
18
|
+
return methods.find((x) => x.id === methodId);
|
|
19
|
+
};
|
|
17
20
|
function PaymentProvider({ session, connect, children, baseUrl }) {
|
|
18
21
|
if (baseUrl) {
|
|
19
22
|
window.__PAYMENT_KIT_BASE_URL = baseUrl;
|
|
@@ -37,6 +40,7 @@ function PaymentProvider({ session, connect, children, baseUrl }) {
|
|
|
37
40
|
livemode: !!livemode,
|
|
38
41
|
settings: data,
|
|
39
42
|
getCurrency: (currencyId) => getCurrency(currencyId, data.paymentMethods),
|
|
43
|
+
getMethod: (methodId) => getMethod(methodId, data.paymentMethods),
|
|
40
44
|
refresh: run,
|
|
41
45
|
setLivemode,
|
|
42
46
|
api
|
|
@@ -15,6 +15,7 @@ export type PaymentContextType = {
|
|
|
15
15
|
settings: Settings;
|
|
16
16
|
refresh: () => void;
|
|
17
17
|
getCurrency: (currencyId: string) => TPaymentCurrency | undefined;
|
|
18
|
+
getMethod: (methodId: string) => TPaymentMethodExpanded | undefined;
|
|
18
19
|
setLivemode: (livemode: boolean) => void;
|
|
19
20
|
api: Axios;
|
|
20
21
|
};
|
package/lib/contexts/payment.js
CHANGED
|
@@ -32,6 +32,9 @@ const getCurrency = (currencyId, methods) => {
|
|
|
32
32
|
const currencies = methods.reduce((acc, x) => acc.concat(x.payment_currencies), []);
|
|
33
33
|
return currencies.find(x => x.id === currencyId);
|
|
34
34
|
};
|
|
35
|
+
const getMethod = (methodId, methods) => {
|
|
36
|
+
return methods.find(x => x.id === methodId);
|
|
37
|
+
};
|
|
35
38
|
function PaymentProvider({
|
|
36
39
|
session,
|
|
37
40
|
connect,
|
|
@@ -68,6 +71,7 @@ function PaymentProvider({
|
|
|
68
71
|
livemode: !!livemode,
|
|
69
72
|
settings: data,
|
|
70
73
|
getCurrency: currencyId => getCurrency(currencyId, data.paymentMethods),
|
|
74
|
+
getMethod: methodId => getMethod(methodId, data.paymentMethods),
|
|
71
75
|
refresh: run,
|
|
72
76
|
setLivemode,
|
|
73
77
|
api: _api.default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.11",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@babel/core": "^7.25.2",
|
|
92
92
|
"@babel/preset-env": "^7.25.2",
|
|
93
93
|
"@babel/preset-react": "^7.24.7",
|
|
94
|
-
"@blocklet/payment-types": "1.14.
|
|
94
|
+
"@blocklet/payment-types": "1.14.11",
|
|
95
95
|
"@storybook/addon-essentials": "^7.6.20",
|
|
96
96
|
"@storybook/addon-interactions": "^7.6.20",
|
|
97
97
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"vite-plugin-babel": "^1.2.0",
|
|
121
121
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "d975924387383081c749f0949221eb60b9c92fd2"
|
|
124
124
|
}
|
package/src/contexts/payment.tsx
CHANGED
|
@@ -20,6 +20,7 @@ export type PaymentContextType = {
|
|
|
20
20
|
settings: Settings;
|
|
21
21
|
refresh: () => void;
|
|
22
22
|
getCurrency: (currencyId: string) => TPaymentCurrency | undefined;
|
|
23
|
+
getMethod: (methodId: string) => TPaymentMethodExpanded | undefined;
|
|
23
24
|
setLivemode: (livemode: boolean) => void;
|
|
24
25
|
api: Axios;
|
|
25
26
|
};
|
|
@@ -46,6 +47,10 @@ const getCurrency = (currencyId: string, methods: TPaymentMethodExpanded[]) => {
|
|
|
46
47
|
return currencies.find((x) => x.id === currencyId);
|
|
47
48
|
};
|
|
48
49
|
|
|
50
|
+
const getMethod = (methodId: string, methods: TPaymentMethodExpanded[]) => {
|
|
51
|
+
return methods.find((x) => x.id === methodId);
|
|
52
|
+
};
|
|
53
|
+
|
|
49
54
|
function PaymentProvider({ session, connect, children, baseUrl }: PaymentContextProps) {
|
|
50
55
|
if (baseUrl) {
|
|
51
56
|
// This is hack but efficient to share
|
|
@@ -73,6 +78,7 @@ function PaymentProvider({ session, connect, children, baseUrl }: PaymentContext
|
|
|
73
78
|
livemode: !!livemode,
|
|
74
79
|
settings: data,
|
|
75
80
|
getCurrency: (currencyId: string) => getCurrency(currencyId, data.paymentMethods),
|
|
81
|
+
getMethod: (methodId: string) => getMethod(methodId, data.paymentMethods),
|
|
76
82
|
refresh: run,
|
|
77
83
|
setLivemode,
|
|
78
84
|
api,
|