@bloque/payments-react 0.0.4 → 0.0.5
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/bloque-checkout.d.ts +8 -6
- package/dist/bloque-checkout.js +3 -18
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@bloque/payments-elements';
|
|
2
|
-
import type { AppearanceConfig, CheckoutConfig, PaymentMethodType, PaymentSubmitPayload } from '@bloque/payments-elements';
|
|
2
|
+
import type { AppearanceConfig, CheckoutConfig, PaymentMethodType, PaymentResponse, PaymentSubmitPayload } from '@bloque/payments-elements';
|
|
3
3
|
declare global {
|
|
4
4
|
namespace JSX {
|
|
5
5
|
interface IntrinsicElements {
|
|
@@ -14,11 +14,13 @@ export interface BloqueCheckoutProps {
|
|
|
14
14
|
availableMethods?: PaymentMethodType[];
|
|
15
15
|
requireEmail?: boolean;
|
|
16
16
|
showMethodSelector?: boolean;
|
|
17
|
-
onSubmit?: (payload: PaymentSubmitPayload) => Promise<
|
|
18
|
-
onSuccess?: (
|
|
19
|
-
onError?: (
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
onSubmit?: (payload: PaymentSubmitPayload) => Promise<PaymentResponse | undefined>;
|
|
18
|
+
onSuccess?: (response: PaymentResponse) => void;
|
|
19
|
+
onError?: (error: {
|
|
20
|
+
message: string;
|
|
21
|
+
data: unknown;
|
|
22
|
+
type: string;
|
|
23
|
+
}) => void;
|
|
22
24
|
className?: string;
|
|
23
25
|
style?: React.CSSProperties;
|
|
24
26
|
}
|
package/dist/bloque-checkout.js
CHANGED
|
@@ -13,6 +13,8 @@ function BloqueCheckout({ config, appearance, amount, availableMethods, requireE
|
|
|
13
13
|
element.requireEmail = requireEmail;
|
|
14
14
|
element.showMethodSelector = showMethodSelector;
|
|
15
15
|
if (onSubmit) element.onSubmit = onSubmit;
|
|
16
|
+
if (onSuccess) element.onSuccess = onSuccess;
|
|
17
|
+
if (onError) element.onError = onError;
|
|
16
18
|
}, [
|
|
17
19
|
config,
|
|
18
20
|
appearance,
|
|
@@ -20,24 +22,7 @@ function BloqueCheckout({ config, appearance, amount, availableMethods, requireE
|
|
|
20
22
|
availableMethods,
|
|
21
23
|
requireEmail,
|
|
22
24
|
showMethodSelector,
|
|
23
|
-
onSubmit
|
|
24
|
-
]);
|
|
25
|
-
useEffect(()=>{
|
|
26
|
-
const element = checkoutRef.current;
|
|
27
|
-
if (!element) return;
|
|
28
|
-
const handleSuccess = (event)=>{
|
|
29
|
-
if (onSuccess) onSuccess(event);
|
|
30
|
-
};
|
|
31
|
-
const handleError = (event)=>{
|
|
32
|
-
if (onError) onError(event);
|
|
33
|
-
};
|
|
34
|
-
element.addEventListener('payment-success', handleSuccess);
|
|
35
|
-
element.addEventListener('payment-error', handleError);
|
|
36
|
-
return ()=>{
|
|
37
|
-
element.removeEventListener('payment-success', handleSuccess);
|
|
38
|
-
element.removeEventListener('payment-error', handleError);
|
|
39
|
-
};
|
|
40
|
-
}, [
|
|
25
|
+
onSubmit,
|
|
41
26
|
onSuccess,
|
|
42
27
|
onError
|
|
43
28
|
]);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export type { AppearanceConfig, CheckoutConfig, PaymentSubmitPayload, } from '@bloque/payments-elements';
|
|
1
|
+
export type { AppearanceConfig, CheckoutConfig, PaymentResponse, PaymentSubmitPayload, SDKInitOptions, } from '@bloque/payments-elements';
|
|
2
|
+
export { init } from '@bloque/payments-elements';
|
|
2
3
|
export type { BloqueCheckoutProps } from './bloque-checkout';
|
|
3
4
|
export { BloqueCheckout } from './bloque-checkout';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/payments-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "React wrapper for Bloque payments web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@bloque/payments-elements": "0.0.
|
|
37
|
+
"@bloque/payments-elements": "0.0.5"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=16.9.0",
|