@paykit-sdk/react 1.1.91 → 1.1.95
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/hooks/use-async-fn.d.mts +1 -1
- package/dist/hooks/use-async-fn.d.ts +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +31 -69
- package/dist/index.mjs +31 -70
- package/dist/resources/checkout.js +6 -21
- package/dist/resources/checkout.mjs +6 -21
- package/dist/resources/customer.js +6 -21
- package/dist/resources/customer.mjs +6 -21
- package/dist/resources/payment.js +9 -24
- package/dist/resources/payment.mjs +9 -24
- package/dist/resources/refund.js +3 -6
- package/dist/resources/refund.mjs +3 -6
- package/dist/resources/subscription.js +7 -26
- package/dist/resources/subscription.mjs +7 -26
- package/package.json +15 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointPath } from '@paykit-sdk/core';
|
|
2
2
|
|
|
3
3
|
type AsyncResult<T> = [data: T, error: undefined] | [data: undefined, error: Error];
|
|
4
|
-
declare const useAsyncFn: <Args extends unknown[], Response>(path: EndpointPath, apiUrl: string, headersEsque
|
|
4
|
+
declare const useAsyncFn: <Args extends unknown[], Response>(path: EndpointPath, apiUrl: string, headersEsque?: Record<string, string> | (() => Record<string, string>)) => {
|
|
5
5
|
run: (...args: Args) => Promise<AsyncResult<Response>>;
|
|
6
6
|
loading: boolean;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointPath } from '@paykit-sdk/core';
|
|
2
2
|
|
|
3
3
|
type AsyncResult<T> = [data: T, error: undefined] | [data: undefined, error: Error];
|
|
4
|
-
declare const useAsyncFn: <Args extends unknown[], Response>(path: EndpointPath, apiUrl: string, headersEsque
|
|
4
|
+
declare const useAsyncFn: <Args extends unknown[], Response>(path: EndpointPath, apiUrl: string, headersEsque?: Record<string, string> | (() => Record<string, string>)) => {
|
|
5
5
|
run: (...args: Args) => Promise<AsyncResult<Response>>;
|
|
6
6
|
loading: boolean;
|
|
7
7
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -4,11 +4,12 @@ export { useCustomer } from './resources/customer.mjs';
|
|
|
4
4
|
export { useSubscription } from './resources/subscription.mjs';
|
|
5
5
|
export { useCheckout } from './resources/checkout.mjs';
|
|
6
6
|
export { useRefund } from './resources/refund.mjs';
|
|
7
|
+
export { usePayment } from './resources/payment.mjs';
|
|
7
8
|
import '@paykit-sdk/core';
|
|
8
9
|
|
|
9
10
|
interface PaykitProviderProps extends React.PropsWithChildren {
|
|
10
11
|
apiUrl: string;
|
|
11
|
-
headers
|
|
12
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
12
13
|
}
|
|
13
14
|
declare const PaykitProvider: ({ apiUrl, headers, children }: PaykitProviderProps) => react_jsx_runtime.JSX.Element;
|
|
14
15
|
declare const usePaykitContext: () => PaykitProviderProps;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ export { useCustomer } from './resources/customer.js';
|
|
|
4
4
|
export { useSubscription } from './resources/subscription.js';
|
|
5
5
|
export { useCheckout } from './resources/checkout.js';
|
|
6
6
|
export { useRefund } from './resources/refund.js';
|
|
7
|
+
export { usePayment } from './resources/payment.js';
|
|
7
8
|
import '@paykit-sdk/core';
|
|
8
9
|
|
|
9
10
|
interface PaykitProviderProps extends React.PropsWithChildren {
|
|
10
11
|
apiUrl: string;
|
|
11
|
-
headers
|
|
12
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
12
13
|
}
|
|
13
14
|
declare const PaykitProvider: ({ apiUrl, headers, children }: PaykitProviderProps) => react_jsx_runtime.JSX.Element;
|
|
14
15
|
declare const usePaykitContext: () => PaykitProviderProps;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,8 @@ var PaykitProvider = ({ apiUrl, headers, children }) => {
|
|
|
31
31
|
};
|
|
32
32
|
var usePaykitContext = () => {
|
|
33
33
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
34
|
-
if (!ctx)
|
|
34
|
+
if (!ctx)
|
|
35
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
35
36
|
return ctx;
|
|
36
37
|
};
|
|
37
38
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -67,100 +68,61 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
67
68
|
// src/resources/customer.ts
|
|
68
69
|
var useCustomer = () => {
|
|
69
70
|
const ctx = usePaykitContext();
|
|
70
|
-
const retrieve = useAsyncFn(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
const create = useAsyncFn(
|
|
76
|
-
"/customer/create",
|
|
77
|
-
ctx.apiUrl,
|
|
78
|
-
ctx.headers
|
|
79
|
-
);
|
|
80
|
-
const update = useAsyncFn(
|
|
81
|
-
"/customer/update",
|
|
82
|
-
ctx.apiUrl,
|
|
83
|
-
ctx.headers
|
|
84
|
-
);
|
|
85
|
-
const remove = useAsyncFn(
|
|
86
|
-
"/customer/delete",
|
|
87
|
-
ctx.apiUrl,
|
|
88
|
-
ctx.headers
|
|
89
|
-
);
|
|
71
|
+
const retrieve = useAsyncFn("/customer/retrieve", ctx.apiUrl, ctx.headers);
|
|
72
|
+
const create = useAsyncFn("/customer/create", ctx.apiUrl, ctx.headers);
|
|
73
|
+
const update = useAsyncFn("/customer/update", ctx.apiUrl, ctx.headers);
|
|
74
|
+
const remove = useAsyncFn("/customer/delete", ctx.apiUrl, ctx.headers);
|
|
90
75
|
return { retrieve, create, update, remove };
|
|
91
76
|
};
|
|
92
77
|
|
|
93
78
|
// src/resources/subscription.ts
|
|
94
79
|
var useSubscription = () => {
|
|
95
80
|
const ctx = usePaykitContext();
|
|
96
|
-
const create = useAsyncFn(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
const update = useAsyncFn(
|
|
102
|
-
"/subscription/update",
|
|
103
|
-
ctx.apiUrl,
|
|
104
|
-
ctx.headers
|
|
105
|
-
);
|
|
106
|
-
const retrieve = useAsyncFn(
|
|
107
|
-
"/subscription/retrieve",
|
|
108
|
-
ctx.apiUrl,
|
|
109
|
-
ctx.headers
|
|
110
|
-
);
|
|
111
|
-
const cancel = useAsyncFn(
|
|
112
|
-
"/subscription/cancel",
|
|
113
|
-
ctx.apiUrl,
|
|
114
|
-
ctx.headers
|
|
115
|
-
);
|
|
116
|
-
const remove = useAsyncFn(
|
|
117
|
-
"/subscription/delete",
|
|
118
|
-
ctx.apiUrl,
|
|
119
|
-
ctx.headers
|
|
120
|
-
);
|
|
81
|
+
const create = useAsyncFn("/subscription/create", ctx.apiUrl, ctx.headers);
|
|
82
|
+
const update = useAsyncFn("/subscription/update", ctx.apiUrl, ctx.headers);
|
|
83
|
+
const retrieve = useAsyncFn("/subscription/retrieve", ctx.apiUrl, ctx.headers);
|
|
84
|
+
const cancel = useAsyncFn("/subscription/cancel", ctx.apiUrl, ctx.headers);
|
|
85
|
+
const remove = useAsyncFn("/subscription/delete", ctx.apiUrl, ctx.headers);
|
|
121
86
|
return { create, update, retrieve, cancel, remove };
|
|
122
87
|
};
|
|
123
88
|
|
|
124
89
|
// src/resources/checkout.ts
|
|
125
90
|
var useCheckout = () => {
|
|
126
91
|
const ctx = usePaykitContext();
|
|
127
|
-
const create = useAsyncFn(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
);
|
|
132
|
-
const retrieve = useAsyncFn(
|
|
133
|
-
"/checkout/retrieve",
|
|
134
|
-
ctx.apiUrl,
|
|
135
|
-
ctx.headers
|
|
136
|
-
);
|
|
137
|
-
const update = useAsyncFn(
|
|
138
|
-
"/checkout/update",
|
|
139
|
-
ctx.apiUrl,
|
|
140
|
-
ctx.headers
|
|
141
|
-
);
|
|
142
|
-
const remove = useAsyncFn(
|
|
143
|
-
"/checkout/delete",
|
|
144
|
-
ctx.apiUrl,
|
|
145
|
-
ctx.headers
|
|
146
|
-
);
|
|
92
|
+
const create = useAsyncFn("/checkout/create", ctx.apiUrl, ctx.headers);
|
|
93
|
+
const retrieve = useAsyncFn("/checkout/retrieve", ctx.apiUrl, ctx.headers);
|
|
94
|
+
const update = useAsyncFn("/checkout/update", ctx.apiUrl, ctx.headers);
|
|
95
|
+
const remove = useAsyncFn("/checkout/delete", ctx.apiUrl, ctx.headers);
|
|
147
96
|
return { create, retrieve, update, remove };
|
|
148
97
|
};
|
|
149
98
|
|
|
150
99
|
// src/resources/refund.ts
|
|
151
100
|
var useRefund = () => {
|
|
152
101
|
const ctx = usePaykitContext();
|
|
153
|
-
const create = useAsyncFn(
|
|
154
|
-
|
|
102
|
+
const create = useAsyncFn("/refund/create", ctx.apiUrl, ctx.headers);
|
|
103
|
+
return { create };
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/resources/payment.ts
|
|
107
|
+
var usePayment = () => {
|
|
108
|
+
const ctx = usePaykitContext();
|
|
109
|
+
const create = useAsyncFn("/payment/create", ctx.apiUrl, ctx.headers);
|
|
110
|
+
const retrieve = useAsyncFn("/payment/retrieve", ctx.apiUrl, ctx.headers);
|
|
111
|
+
const update = useAsyncFn("/payment/update", ctx.apiUrl, ctx.headers);
|
|
112
|
+
const remove = useAsyncFn("/payment/delete", ctx.apiUrl, ctx.headers);
|
|
113
|
+
const capture = useAsyncFn("/payment/capture", ctx.apiUrl, ctx.headers);
|
|
114
|
+
const cancel = useAsyncFn(
|
|
115
|
+
"/payment/cancel",
|
|
155
116
|
ctx.apiUrl,
|
|
156
117
|
ctx.headers
|
|
157
118
|
);
|
|
158
|
-
return { create };
|
|
119
|
+
return { create, retrieve, update, remove, capture, cancel };
|
|
159
120
|
};
|
|
160
121
|
|
|
161
122
|
exports.PaykitProvider = PaykitProvider;
|
|
162
123
|
exports.useCheckout = useCheckout;
|
|
163
124
|
exports.useCustomer = useCustomer;
|
|
164
125
|
exports.usePaykitContext = usePaykitContext;
|
|
126
|
+
exports.usePayment = usePayment;
|
|
165
127
|
exports.useRefund = useRefund;
|
|
166
128
|
exports.useSubscription = useSubscription;
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,8 @@ var PaykitProvider = ({ apiUrl, headers, children }) => {
|
|
|
9
9
|
};
|
|
10
10
|
var usePaykitContext = () => {
|
|
11
11
|
const ctx = React.useContext(PaykitContext);
|
|
12
|
-
if (!ctx)
|
|
12
|
+
if (!ctx)
|
|
13
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
13
14
|
return ctx;
|
|
14
15
|
};
|
|
15
16
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -45,95 +46,55 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
45
46
|
// src/resources/customer.ts
|
|
46
47
|
var useCustomer = () => {
|
|
47
48
|
const ctx = usePaykitContext();
|
|
48
|
-
const retrieve = useAsyncFn(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
);
|
|
53
|
-
const create = useAsyncFn(
|
|
54
|
-
"/customer/create",
|
|
55
|
-
ctx.apiUrl,
|
|
56
|
-
ctx.headers
|
|
57
|
-
);
|
|
58
|
-
const update = useAsyncFn(
|
|
59
|
-
"/customer/update",
|
|
60
|
-
ctx.apiUrl,
|
|
61
|
-
ctx.headers
|
|
62
|
-
);
|
|
63
|
-
const remove = useAsyncFn(
|
|
64
|
-
"/customer/delete",
|
|
65
|
-
ctx.apiUrl,
|
|
66
|
-
ctx.headers
|
|
67
|
-
);
|
|
49
|
+
const retrieve = useAsyncFn("/customer/retrieve", ctx.apiUrl, ctx.headers);
|
|
50
|
+
const create = useAsyncFn("/customer/create", ctx.apiUrl, ctx.headers);
|
|
51
|
+
const update = useAsyncFn("/customer/update", ctx.apiUrl, ctx.headers);
|
|
52
|
+
const remove = useAsyncFn("/customer/delete", ctx.apiUrl, ctx.headers);
|
|
68
53
|
return { retrieve, create, update, remove };
|
|
69
54
|
};
|
|
70
55
|
|
|
71
56
|
// src/resources/subscription.ts
|
|
72
57
|
var useSubscription = () => {
|
|
73
58
|
const ctx = usePaykitContext();
|
|
74
|
-
const create = useAsyncFn(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
);
|
|
79
|
-
const update = useAsyncFn(
|
|
80
|
-
"/subscription/update",
|
|
81
|
-
ctx.apiUrl,
|
|
82
|
-
ctx.headers
|
|
83
|
-
);
|
|
84
|
-
const retrieve = useAsyncFn(
|
|
85
|
-
"/subscription/retrieve",
|
|
86
|
-
ctx.apiUrl,
|
|
87
|
-
ctx.headers
|
|
88
|
-
);
|
|
89
|
-
const cancel = useAsyncFn(
|
|
90
|
-
"/subscription/cancel",
|
|
91
|
-
ctx.apiUrl,
|
|
92
|
-
ctx.headers
|
|
93
|
-
);
|
|
94
|
-
const remove = useAsyncFn(
|
|
95
|
-
"/subscription/delete",
|
|
96
|
-
ctx.apiUrl,
|
|
97
|
-
ctx.headers
|
|
98
|
-
);
|
|
59
|
+
const create = useAsyncFn("/subscription/create", ctx.apiUrl, ctx.headers);
|
|
60
|
+
const update = useAsyncFn("/subscription/update", ctx.apiUrl, ctx.headers);
|
|
61
|
+
const retrieve = useAsyncFn("/subscription/retrieve", ctx.apiUrl, ctx.headers);
|
|
62
|
+
const cancel = useAsyncFn("/subscription/cancel", ctx.apiUrl, ctx.headers);
|
|
63
|
+
const remove = useAsyncFn("/subscription/delete", ctx.apiUrl, ctx.headers);
|
|
99
64
|
return { create, update, retrieve, cancel, remove };
|
|
100
65
|
};
|
|
101
66
|
|
|
102
67
|
// src/resources/checkout.ts
|
|
103
68
|
var useCheckout = () => {
|
|
104
69
|
const ctx = usePaykitContext();
|
|
105
|
-
const create = useAsyncFn(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
);
|
|
110
|
-
const retrieve = useAsyncFn(
|
|
111
|
-
"/checkout/retrieve",
|
|
112
|
-
ctx.apiUrl,
|
|
113
|
-
ctx.headers
|
|
114
|
-
);
|
|
115
|
-
const update = useAsyncFn(
|
|
116
|
-
"/checkout/update",
|
|
117
|
-
ctx.apiUrl,
|
|
118
|
-
ctx.headers
|
|
119
|
-
);
|
|
120
|
-
const remove = useAsyncFn(
|
|
121
|
-
"/checkout/delete",
|
|
122
|
-
ctx.apiUrl,
|
|
123
|
-
ctx.headers
|
|
124
|
-
);
|
|
70
|
+
const create = useAsyncFn("/checkout/create", ctx.apiUrl, ctx.headers);
|
|
71
|
+
const retrieve = useAsyncFn("/checkout/retrieve", ctx.apiUrl, ctx.headers);
|
|
72
|
+
const update = useAsyncFn("/checkout/update", ctx.apiUrl, ctx.headers);
|
|
73
|
+
const remove = useAsyncFn("/checkout/delete", ctx.apiUrl, ctx.headers);
|
|
125
74
|
return { create, retrieve, update, remove };
|
|
126
75
|
};
|
|
127
76
|
|
|
128
77
|
// src/resources/refund.ts
|
|
129
78
|
var useRefund = () => {
|
|
130
79
|
const ctx = usePaykitContext();
|
|
131
|
-
const create = useAsyncFn(
|
|
132
|
-
|
|
80
|
+
const create = useAsyncFn("/refund/create", ctx.apiUrl, ctx.headers);
|
|
81
|
+
return { create };
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/resources/payment.ts
|
|
85
|
+
var usePayment = () => {
|
|
86
|
+
const ctx = usePaykitContext();
|
|
87
|
+
const create = useAsyncFn("/payment/create", ctx.apiUrl, ctx.headers);
|
|
88
|
+
const retrieve = useAsyncFn("/payment/retrieve", ctx.apiUrl, ctx.headers);
|
|
89
|
+
const update = useAsyncFn("/payment/update", ctx.apiUrl, ctx.headers);
|
|
90
|
+
const remove = useAsyncFn("/payment/delete", ctx.apiUrl, ctx.headers);
|
|
91
|
+
const capture = useAsyncFn("/payment/capture", ctx.apiUrl, ctx.headers);
|
|
92
|
+
const cancel = useAsyncFn(
|
|
93
|
+
"/payment/cancel",
|
|
133
94
|
ctx.apiUrl,
|
|
134
95
|
ctx.headers
|
|
135
96
|
);
|
|
136
|
-
return { create };
|
|
97
|
+
return { create, retrieve, update, remove, capture, cancel };
|
|
137
98
|
};
|
|
138
99
|
|
|
139
|
-
export { PaykitProvider, useCheckout, useCustomer, usePaykitContext, useRefund, useSubscription };
|
|
100
|
+
export { PaykitProvider, useCheckout, useCustomer, usePaykitContext, usePayment, useRefund, useSubscription };
|
|
@@ -27,7 +27,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
var PaykitContext = React__namespace.createContext(void 0);
|
|
28
28
|
var usePaykitContext = () => {
|
|
29
29
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
30
|
-
if (!ctx)
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
31
32
|
return ctx;
|
|
32
33
|
};
|
|
33
34
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -63,26 +64,10 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
63
64
|
// src/resources/checkout.ts
|
|
64
65
|
var useCheckout = () => {
|
|
65
66
|
const ctx = usePaykitContext();
|
|
66
|
-
const create = useAsyncFn(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
const retrieve = useAsyncFn(
|
|
72
|
-
"/checkout/retrieve",
|
|
73
|
-
ctx.apiUrl,
|
|
74
|
-
ctx.headers
|
|
75
|
-
);
|
|
76
|
-
const update = useAsyncFn(
|
|
77
|
-
"/checkout/update",
|
|
78
|
-
ctx.apiUrl,
|
|
79
|
-
ctx.headers
|
|
80
|
-
);
|
|
81
|
-
const remove = useAsyncFn(
|
|
82
|
-
"/checkout/delete",
|
|
83
|
-
ctx.apiUrl,
|
|
84
|
-
ctx.headers
|
|
85
|
-
);
|
|
67
|
+
const create = useAsyncFn("/checkout/create", ctx.apiUrl, ctx.headers);
|
|
68
|
+
const retrieve = useAsyncFn("/checkout/retrieve", ctx.apiUrl, ctx.headers);
|
|
69
|
+
const update = useAsyncFn("/checkout/update", ctx.apiUrl, ctx.headers);
|
|
70
|
+
const remove = useAsyncFn("/checkout/delete", ctx.apiUrl, ctx.headers);
|
|
86
71
|
return { create, retrieve, update, remove };
|
|
87
72
|
};
|
|
88
73
|
|
|
@@ -5,7 +5,8 @@ import 'react/jsx-runtime';
|
|
|
5
5
|
var PaykitContext = React.createContext(void 0);
|
|
6
6
|
var usePaykitContext = () => {
|
|
7
7
|
const ctx = React.useContext(PaykitContext);
|
|
8
|
-
if (!ctx)
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
9
10
|
return ctx;
|
|
10
11
|
};
|
|
11
12
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -41,26 +42,10 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
41
42
|
// src/resources/checkout.ts
|
|
42
43
|
var useCheckout = () => {
|
|
43
44
|
const ctx = usePaykitContext();
|
|
44
|
-
const create = useAsyncFn(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
const retrieve = useAsyncFn(
|
|
50
|
-
"/checkout/retrieve",
|
|
51
|
-
ctx.apiUrl,
|
|
52
|
-
ctx.headers
|
|
53
|
-
);
|
|
54
|
-
const update = useAsyncFn(
|
|
55
|
-
"/checkout/update",
|
|
56
|
-
ctx.apiUrl,
|
|
57
|
-
ctx.headers
|
|
58
|
-
);
|
|
59
|
-
const remove = useAsyncFn(
|
|
60
|
-
"/checkout/delete",
|
|
61
|
-
ctx.apiUrl,
|
|
62
|
-
ctx.headers
|
|
63
|
-
);
|
|
45
|
+
const create = useAsyncFn("/checkout/create", ctx.apiUrl, ctx.headers);
|
|
46
|
+
const retrieve = useAsyncFn("/checkout/retrieve", ctx.apiUrl, ctx.headers);
|
|
47
|
+
const update = useAsyncFn("/checkout/update", ctx.apiUrl, ctx.headers);
|
|
48
|
+
const remove = useAsyncFn("/checkout/delete", ctx.apiUrl, ctx.headers);
|
|
64
49
|
return { create, retrieve, update, remove };
|
|
65
50
|
};
|
|
66
51
|
|
|
@@ -27,7 +27,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
var PaykitContext = React__namespace.createContext(void 0);
|
|
28
28
|
var usePaykitContext = () => {
|
|
29
29
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
30
|
-
if (!ctx)
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
31
32
|
return ctx;
|
|
32
33
|
};
|
|
33
34
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -63,26 +64,10 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
63
64
|
// src/resources/customer.ts
|
|
64
65
|
var useCustomer = () => {
|
|
65
66
|
const ctx = usePaykitContext();
|
|
66
|
-
const retrieve = useAsyncFn(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
const create = useAsyncFn(
|
|
72
|
-
"/customer/create",
|
|
73
|
-
ctx.apiUrl,
|
|
74
|
-
ctx.headers
|
|
75
|
-
);
|
|
76
|
-
const update = useAsyncFn(
|
|
77
|
-
"/customer/update",
|
|
78
|
-
ctx.apiUrl,
|
|
79
|
-
ctx.headers
|
|
80
|
-
);
|
|
81
|
-
const remove = useAsyncFn(
|
|
82
|
-
"/customer/delete",
|
|
83
|
-
ctx.apiUrl,
|
|
84
|
-
ctx.headers
|
|
85
|
-
);
|
|
67
|
+
const retrieve = useAsyncFn("/customer/retrieve", ctx.apiUrl, ctx.headers);
|
|
68
|
+
const create = useAsyncFn("/customer/create", ctx.apiUrl, ctx.headers);
|
|
69
|
+
const update = useAsyncFn("/customer/update", ctx.apiUrl, ctx.headers);
|
|
70
|
+
const remove = useAsyncFn("/customer/delete", ctx.apiUrl, ctx.headers);
|
|
86
71
|
return { retrieve, create, update, remove };
|
|
87
72
|
};
|
|
88
73
|
|
|
@@ -5,7 +5,8 @@ import 'react/jsx-runtime';
|
|
|
5
5
|
var PaykitContext = React.createContext(void 0);
|
|
6
6
|
var usePaykitContext = () => {
|
|
7
7
|
const ctx = React.useContext(PaykitContext);
|
|
8
|
-
if (!ctx)
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
9
10
|
return ctx;
|
|
10
11
|
};
|
|
11
12
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -41,26 +42,10 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
41
42
|
// src/resources/customer.ts
|
|
42
43
|
var useCustomer = () => {
|
|
43
44
|
const ctx = usePaykitContext();
|
|
44
|
-
const retrieve = useAsyncFn(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
const create = useAsyncFn(
|
|
50
|
-
"/customer/create",
|
|
51
|
-
ctx.apiUrl,
|
|
52
|
-
ctx.headers
|
|
53
|
-
);
|
|
54
|
-
const update = useAsyncFn(
|
|
55
|
-
"/customer/update",
|
|
56
|
-
ctx.apiUrl,
|
|
57
|
-
ctx.headers
|
|
58
|
-
);
|
|
59
|
-
const remove = useAsyncFn(
|
|
60
|
-
"/customer/delete",
|
|
61
|
-
ctx.apiUrl,
|
|
62
|
-
ctx.headers
|
|
63
|
-
);
|
|
45
|
+
const retrieve = useAsyncFn("/customer/retrieve", ctx.apiUrl, ctx.headers);
|
|
46
|
+
const create = useAsyncFn("/customer/create", ctx.apiUrl, ctx.headers);
|
|
47
|
+
const update = useAsyncFn("/customer/update", ctx.apiUrl, ctx.headers);
|
|
48
|
+
const remove = useAsyncFn("/customer/delete", ctx.apiUrl, ctx.headers);
|
|
64
49
|
return { retrieve, create, update, remove };
|
|
65
50
|
};
|
|
66
51
|
|
|
@@ -27,7 +27,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
var PaykitContext = React__namespace.createContext(void 0);
|
|
28
28
|
var usePaykitContext = () => {
|
|
29
29
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
30
|
-
if (!ctx)
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
31
32
|
return ctx;
|
|
32
33
|
};
|
|
33
34
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -63,32 +64,16 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
63
64
|
// src/resources/payment.ts
|
|
64
65
|
var usePayment = () => {
|
|
65
66
|
const ctx = usePaykitContext();
|
|
66
|
-
const create = useAsyncFn(
|
|
67
|
-
|
|
67
|
+
const create = useAsyncFn("/payment/create", ctx.apiUrl, ctx.headers);
|
|
68
|
+
const retrieve = useAsyncFn("/payment/retrieve", ctx.apiUrl, ctx.headers);
|
|
69
|
+
const update = useAsyncFn("/payment/update", ctx.apiUrl, ctx.headers);
|
|
70
|
+
const remove = useAsyncFn("/payment/delete", ctx.apiUrl, ctx.headers);
|
|
71
|
+
const capture = useAsyncFn("/payment/capture", ctx.apiUrl, ctx.headers);
|
|
72
|
+
const cancel = useAsyncFn(
|
|
73
|
+
"/payment/cancel",
|
|
68
74
|
ctx.apiUrl,
|
|
69
75
|
ctx.headers
|
|
70
76
|
);
|
|
71
|
-
const retrieve = useAsyncFn(
|
|
72
|
-
"/payment/retrieve",
|
|
73
|
-
ctx.apiUrl,
|
|
74
|
-
ctx.headers
|
|
75
|
-
);
|
|
76
|
-
const update = useAsyncFn(
|
|
77
|
-
"/payment/update",
|
|
78
|
-
ctx.apiUrl,
|
|
79
|
-
ctx.headers
|
|
80
|
-
);
|
|
81
|
-
const remove = useAsyncFn(
|
|
82
|
-
"/payment/delete",
|
|
83
|
-
ctx.apiUrl,
|
|
84
|
-
ctx.headers
|
|
85
|
-
);
|
|
86
|
-
const capture = useAsyncFn(
|
|
87
|
-
"/payment/capture",
|
|
88
|
-
ctx.apiUrl,
|
|
89
|
-
ctx.headers
|
|
90
|
-
);
|
|
91
|
-
const cancel = useAsyncFn("/payment/cancel", ctx.apiUrl, ctx.headers);
|
|
92
77
|
return { create, retrieve, update, remove, capture, cancel };
|
|
93
78
|
};
|
|
94
79
|
|
|
@@ -5,7 +5,8 @@ import 'react/jsx-runtime';
|
|
|
5
5
|
var PaykitContext = React.createContext(void 0);
|
|
6
6
|
var usePaykitContext = () => {
|
|
7
7
|
const ctx = React.useContext(PaykitContext);
|
|
8
|
-
if (!ctx)
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
9
10
|
return ctx;
|
|
10
11
|
};
|
|
11
12
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -41,32 +42,16 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
41
42
|
// src/resources/payment.ts
|
|
42
43
|
var usePayment = () => {
|
|
43
44
|
const ctx = usePaykitContext();
|
|
44
|
-
const create = useAsyncFn(
|
|
45
|
-
|
|
45
|
+
const create = useAsyncFn("/payment/create", ctx.apiUrl, ctx.headers);
|
|
46
|
+
const retrieve = useAsyncFn("/payment/retrieve", ctx.apiUrl, ctx.headers);
|
|
47
|
+
const update = useAsyncFn("/payment/update", ctx.apiUrl, ctx.headers);
|
|
48
|
+
const remove = useAsyncFn("/payment/delete", ctx.apiUrl, ctx.headers);
|
|
49
|
+
const capture = useAsyncFn("/payment/capture", ctx.apiUrl, ctx.headers);
|
|
50
|
+
const cancel = useAsyncFn(
|
|
51
|
+
"/payment/cancel",
|
|
46
52
|
ctx.apiUrl,
|
|
47
53
|
ctx.headers
|
|
48
54
|
);
|
|
49
|
-
const retrieve = useAsyncFn(
|
|
50
|
-
"/payment/retrieve",
|
|
51
|
-
ctx.apiUrl,
|
|
52
|
-
ctx.headers
|
|
53
|
-
);
|
|
54
|
-
const update = useAsyncFn(
|
|
55
|
-
"/payment/update",
|
|
56
|
-
ctx.apiUrl,
|
|
57
|
-
ctx.headers
|
|
58
|
-
);
|
|
59
|
-
const remove = useAsyncFn(
|
|
60
|
-
"/payment/delete",
|
|
61
|
-
ctx.apiUrl,
|
|
62
|
-
ctx.headers
|
|
63
|
-
);
|
|
64
|
-
const capture = useAsyncFn(
|
|
65
|
-
"/payment/capture",
|
|
66
|
-
ctx.apiUrl,
|
|
67
|
-
ctx.headers
|
|
68
|
-
);
|
|
69
|
-
const cancel = useAsyncFn("/payment/cancel", ctx.apiUrl, ctx.headers);
|
|
70
55
|
return { create, retrieve, update, remove, capture, cancel };
|
|
71
56
|
};
|
|
72
57
|
|
package/dist/resources/refund.js
CHANGED
|
@@ -27,7 +27,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
var PaykitContext = React__namespace.createContext(void 0);
|
|
28
28
|
var usePaykitContext = () => {
|
|
29
29
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
30
|
-
if (!ctx)
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
31
32
|
return ctx;
|
|
32
33
|
};
|
|
33
34
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -63,11 +64,7 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
63
64
|
// src/resources/refund.ts
|
|
64
65
|
var useRefund = () => {
|
|
65
66
|
const ctx = usePaykitContext();
|
|
66
|
-
const create = useAsyncFn(
|
|
67
|
-
"/refund/create",
|
|
68
|
-
ctx.apiUrl,
|
|
69
|
-
ctx.headers
|
|
70
|
-
);
|
|
67
|
+
const create = useAsyncFn("/refund/create", ctx.apiUrl, ctx.headers);
|
|
71
68
|
return { create };
|
|
72
69
|
};
|
|
73
70
|
|
|
@@ -5,7 +5,8 @@ import 'react/jsx-runtime';
|
|
|
5
5
|
var PaykitContext = React.createContext(void 0);
|
|
6
6
|
var usePaykitContext = () => {
|
|
7
7
|
const ctx = React.useContext(PaykitContext);
|
|
8
|
-
if (!ctx)
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
9
10
|
return ctx;
|
|
10
11
|
};
|
|
11
12
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -41,11 +42,7 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
41
42
|
// src/resources/refund.ts
|
|
42
43
|
var useRefund = () => {
|
|
43
44
|
const ctx = usePaykitContext();
|
|
44
|
-
const create = useAsyncFn(
|
|
45
|
-
"/refund/create",
|
|
46
|
-
ctx.apiUrl,
|
|
47
|
-
ctx.headers
|
|
48
|
-
);
|
|
45
|
+
const create = useAsyncFn("/refund/create", ctx.apiUrl, ctx.headers);
|
|
49
46
|
return { create };
|
|
50
47
|
};
|
|
51
48
|
|
|
@@ -27,7 +27,8 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
27
27
|
var PaykitContext = React__namespace.createContext(void 0);
|
|
28
28
|
var usePaykitContext = () => {
|
|
29
29
|
const ctx = React__namespace.useContext(PaykitContext);
|
|
30
|
-
if (!ctx)
|
|
30
|
+
if (!ctx)
|
|
31
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
31
32
|
return ctx;
|
|
32
33
|
};
|
|
33
34
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -63,31 +64,11 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
63
64
|
// src/resources/subscription.ts
|
|
64
65
|
var useSubscription = () => {
|
|
65
66
|
const ctx = usePaykitContext();
|
|
66
|
-
const create = useAsyncFn(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
);
|
|
71
|
-
const update = useAsyncFn(
|
|
72
|
-
"/subscription/update",
|
|
73
|
-
ctx.apiUrl,
|
|
74
|
-
ctx.headers
|
|
75
|
-
);
|
|
76
|
-
const retrieve = useAsyncFn(
|
|
77
|
-
"/subscription/retrieve",
|
|
78
|
-
ctx.apiUrl,
|
|
79
|
-
ctx.headers
|
|
80
|
-
);
|
|
81
|
-
const cancel = useAsyncFn(
|
|
82
|
-
"/subscription/cancel",
|
|
83
|
-
ctx.apiUrl,
|
|
84
|
-
ctx.headers
|
|
85
|
-
);
|
|
86
|
-
const remove = useAsyncFn(
|
|
87
|
-
"/subscription/delete",
|
|
88
|
-
ctx.apiUrl,
|
|
89
|
-
ctx.headers
|
|
90
|
-
);
|
|
67
|
+
const create = useAsyncFn("/subscription/create", ctx.apiUrl, ctx.headers);
|
|
68
|
+
const update = useAsyncFn("/subscription/update", ctx.apiUrl, ctx.headers);
|
|
69
|
+
const retrieve = useAsyncFn("/subscription/retrieve", ctx.apiUrl, ctx.headers);
|
|
70
|
+
const cancel = useAsyncFn("/subscription/cancel", ctx.apiUrl, ctx.headers);
|
|
71
|
+
const remove = useAsyncFn("/subscription/delete", ctx.apiUrl, ctx.headers);
|
|
91
72
|
return { create, update, retrieve, cancel, remove };
|
|
92
73
|
};
|
|
93
74
|
|
|
@@ -5,7 +5,8 @@ import 'react/jsx-runtime';
|
|
|
5
5
|
var PaykitContext = React.createContext(void 0);
|
|
6
6
|
var usePaykitContext = () => {
|
|
7
7
|
const ctx = React.useContext(PaykitContext);
|
|
8
|
-
if (!ctx)
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Your app must be wrapped in PayKitProvider to use PayKit hooks.");
|
|
9
10
|
return ctx;
|
|
10
11
|
};
|
|
11
12
|
var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
@@ -41,31 +42,11 @@ var useAsyncFn = (path, apiUrl, headersEsque) => {
|
|
|
41
42
|
// src/resources/subscription.ts
|
|
42
43
|
var useSubscription = () => {
|
|
43
44
|
const ctx = usePaykitContext();
|
|
44
|
-
const create = useAsyncFn(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
const update = useAsyncFn(
|
|
50
|
-
"/subscription/update",
|
|
51
|
-
ctx.apiUrl,
|
|
52
|
-
ctx.headers
|
|
53
|
-
);
|
|
54
|
-
const retrieve = useAsyncFn(
|
|
55
|
-
"/subscription/retrieve",
|
|
56
|
-
ctx.apiUrl,
|
|
57
|
-
ctx.headers
|
|
58
|
-
);
|
|
59
|
-
const cancel = useAsyncFn(
|
|
60
|
-
"/subscription/cancel",
|
|
61
|
-
ctx.apiUrl,
|
|
62
|
-
ctx.headers
|
|
63
|
-
);
|
|
64
|
-
const remove = useAsyncFn(
|
|
65
|
-
"/subscription/delete",
|
|
66
|
-
ctx.apiUrl,
|
|
67
|
-
ctx.headers
|
|
68
|
-
);
|
|
45
|
+
const create = useAsyncFn("/subscription/create", ctx.apiUrl, ctx.headers);
|
|
46
|
+
const update = useAsyncFn("/subscription/update", ctx.apiUrl, ctx.headers);
|
|
47
|
+
const retrieve = useAsyncFn("/subscription/retrieve", ctx.apiUrl, ctx.headers);
|
|
48
|
+
const cancel = useAsyncFn("/subscription/cancel", ctx.apiUrl, ctx.headers);
|
|
49
|
+
const remove = useAsyncFn("/subscription/delete", ctx.apiUrl, ctx.headers);
|
|
69
50
|
return { create, update, retrieve, cancel, remove };
|
|
70
51
|
};
|
|
71
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paykit-sdk/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.95",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,29 +14,23 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup",
|
|
19
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
20
|
-
"prepublishOnly": "rm -rf dist && npm run build",
|
|
21
|
-
"typecheck": "tsc --noEmit"
|
|
22
|
-
},
|
|
23
17
|
"publishConfig": {
|
|
24
18
|
"access": "public"
|
|
25
19
|
},
|
|
26
20
|
"peerDependencies": {
|
|
27
21
|
"react": ">=16.8.0",
|
|
28
22
|
"react-dom": ">=16.8.0",
|
|
29
|
-
"@paykit-sdk/core": ">=1.1.
|
|
23
|
+
"@paykit-sdk/core": ">=1.1.96"
|
|
30
24
|
},
|
|
31
25
|
"devDependencies": {
|
|
32
26
|
"@swc/core": "^1.12.9",
|
|
33
|
-
"@types/react": "^
|
|
34
|
-
"@types/react-dom": "^
|
|
35
|
-
"react": "^
|
|
36
|
-
"react-dom": "^
|
|
27
|
+
"@types/react": "^19.2.2",
|
|
28
|
+
"@types/react-dom": "^19.2.2",
|
|
29
|
+
"react": "^19.2.0",
|
|
30
|
+
"react-dom": "^19.2.0",
|
|
37
31
|
"tsup": "^8.0.0",
|
|
38
32
|
"typescript": "^5.0.0",
|
|
39
|
-
"@paykit-sdk/core": "
|
|
33
|
+
"@paykit-sdk/core": "1.1.96"
|
|
40
34
|
},
|
|
41
35
|
"description": "React hooks and components for PayKit SDK - Universal payment processing with Stripe, Polar, and more",
|
|
42
36
|
"keywords": [
|
|
@@ -50,6 +44,11 @@
|
|
|
50
44
|
"checkout"
|
|
51
45
|
],
|
|
52
46
|
"author": "Emmanuel Odii",
|
|
53
|
-
"license": "
|
|
54
|
-
"homepage": "https://usepaykit.dev"
|
|
55
|
-
|
|
47
|
+
"license": "ISC",
|
|
48
|
+
"homepage": "https://usepaykit.dev",
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
52
|
+
"typecheck": "tsc --noEmit"
|
|
53
|
+
}
|
|
54
|
+
}
|