@bloque/payments-react 0.0.3 → 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/README.md +2 -2
- 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 -25
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ import { Bloque } from '@bloque/payments';
|
|
|
70
70
|
|
|
71
71
|
const bloque = new Bloque({
|
|
72
72
|
apiKey: process.env.BLOQUE_API_KEY!,
|
|
73
|
-
|
|
73
|
+
mode: 'production',
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
app.post('/api/payments', async (req, res) => {
|
|
@@ -278,7 +278,7 @@ import { Bloque } from '@bloque/payments';
|
|
|
278
278
|
|
|
279
279
|
const bloque = new Bloque({
|
|
280
280
|
apiKey: process.env.BLOQUE_API_KEY!,
|
|
281
|
-
|
|
281
|
+
mode: 'production',
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
app.post('/api/payments', async (req, res) => {
|
|
@@ -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",
|
|
@@ -33,31 +33,8 @@
|
|
|
33
33
|
"access": "public",
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "rslib build",
|
|
38
|
-
"clean": "rm -rf node_modules && rm -rf dist",
|
|
39
|
-
"check": "biome check --write",
|
|
40
|
-
"dev": "rslib build --watch",
|
|
41
|
-
"storybook": "storybook dev",
|
|
42
|
-
"typecheck": "tsgo --noEmit"
|
|
43
|
-
},
|
|
44
36
|
"dependencies": {
|
|
45
|
-
"@bloque/payments-elements": "
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@rsbuild/core": "catalog:",
|
|
49
|
-
"@rsbuild/plugin-react": "^1.4.2",
|
|
50
|
-
"@rslib/core": "catalog:",
|
|
51
|
-
"@storybook/addon-docs": "^10.1.4",
|
|
52
|
-
"@storybook/addon-onboarding": "^10.1.4",
|
|
53
|
-
"@storybook/react": "^10.1.4",
|
|
54
|
-
"@types/react": "^19.2.7",
|
|
55
|
-
"@typescript/native-preview": "catalog:",
|
|
56
|
-
"react": "^19.2.1",
|
|
57
|
-
"storybook": "^10.1.4",
|
|
58
|
-
"storybook-addon-rslib": "^3.1.0",
|
|
59
|
-
"storybook-react-rsbuild": "^3.1.0",
|
|
60
|
-
"typescript": "catalog:"
|
|
37
|
+
"@bloque/payments-elements": "0.0.5"
|
|
61
38
|
},
|
|
62
39
|
"peerDependencies": {
|
|
63
40
|
"react": ">=16.9.0",
|