@getopenpay/openpay-js-react 0.0.1-alpha.6eb47d5 → 0.0.1-alpha.7d1dabb
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/index.d.ts +43 -11
- package/dist/index.js +2014 -1228
- package/package.json +13 -3
- package/.env.development +0 -1
- package/.env.production +0 -1
- package/.env.staging +0 -1
- package/.eslintrc.cjs +0 -18
- package/.github/workflows/alpha-release.yml +0 -39
- package/.github/workflows/release.yml +0 -30
- package/Makefile +0 -37
- package/example/.eslintrc.json +0 -3
- package/example/Makefile +0 -10
- package/example/README.md +0 -36
- package/example/next.config.mjs +0 -4
- package/example/package-lock.json +0 -5283
- package/example/package.json +0 -27
- package/example/postcss.config.mjs +0 -8
- package/example/public/next.svg +0 -1
- package/example/public/vercel.svg +0 -1
- package/example/src/app/elements/_components/FormWrapper.tsx +0 -18
- package/example/src/app/elements/_components/InputField.tsx +0 -11
- package/example/src/app/elements/card/page.tsx +0 -54
- package/example/src/app/elements/card-cvc/page.tsx +0 -29
- package/example/src/app/elements/card-expiry/page.tsx +0 -29
- package/example/src/app/elements/card-number/page.tsx +0 -29
- package/example/src/app/favicon.ico +0 -0
- package/example/src/app/globals.css +0 -14
- package/example/src/app/layout.tsx +0 -22
- package/example/src/app/page.tsx +0 -119
- package/example/tailwind.config.ts +0 -11
- package/example/tsconfig.json +0 -26
- package/lib/components/_common/frame.tsx +0 -73
- package/lib/components/card-cvc.tsx +0 -11
- package/lib/components/card-expiry.tsx +0 -11
- package/lib/components/card-number.tsx +0 -11
- package/lib/components/card.tsx +0 -11
- package/lib/components/form.tsx +0 -100
- package/lib/hooks/context.ts +0 -17
- package/lib/hooks/use-openpay-elements.ts +0 -12
- package/lib/index.ts +0 -16
- package/lib/utils/constants.ts +0 -1
- package/lib/utils/element.ts +0 -5
- package/lib/utils/event.ts +0 -66
- package/lib/utils/style.ts +0 -17
- package/lib/vite-env.d.ts +0 -1
- package/ngrok.example.yml +0 -6
- package/playwright.config.ts +0 -37
- package/tests/card-cvc.test.ts +0 -68
- package/tests/card-element.test.ts +0 -113
- package/tests/card-expiry.test.ts +0 -61
- package/tests/card-number.test.ts +0 -61
- package/tests/constants.ts +0 -97
- package/tsconfig.build.json +0 -28
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -13
- package/vite.config.ts +0 -36
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
|
|
5
4
|
export declare const CardCvcElement: FC<ElementProps>;
|
|
@@ -11,29 +10,42 @@ export declare const CardExpiryElement: FC<ElementProps>;
|
|
|
11
10
|
export declare const CardNumberElement: FC<ElementProps>;
|
|
12
11
|
|
|
13
12
|
declare type ElementProps = {
|
|
14
|
-
styles?:
|
|
13
|
+
styles?: ElementsStyle;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
declare type ElementsContextValue = {
|
|
18
|
-
|
|
19
|
-
createToken: () => void;
|
|
20
|
-
dispatchEvent: (event: MessageEvent, frame: HTMLIFrameElement) => void;
|
|
17
|
+
formId: string;
|
|
21
18
|
formHeight: string;
|
|
19
|
+
referer?: string;
|
|
20
|
+
checkoutSecureToken?: string;
|
|
21
|
+
registerIframe: (iframe: HTMLIFrameElement) => void;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export declare const ElementsForm: FC<ElementsFormProps>;
|
|
25
25
|
|
|
26
|
-
declare
|
|
26
|
+
declare type ElementsFormChildrenProps = {
|
|
27
|
+
submit: () => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
declare type ElementsFormProps = {
|
|
27
31
|
className?: string;
|
|
32
|
+
checkoutSecureToken?: string;
|
|
33
|
+
children: (props: ElementsFormChildrenProps) => JSX.Element;
|
|
28
34
|
onFocus?: (elementId: string) => void;
|
|
29
35
|
onBlur?: (elementId: string) => void;
|
|
30
36
|
onChange?: (elementId: string) => void;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
onLoad?: (totalAmountAtoms: number, currency?: string) => void;
|
|
38
|
+
onLoadError?: (message: string) => void;
|
|
39
|
+
onValidationError?: (field: FieldName, errors: string[], elementId?: string) => void;
|
|
40
|
+
onCheckoutStarted?: () => void;
|
|
41
|
+
onCheckoutSuccess?: (invoiceUrls: string[]) => void;
|
|
42
|
+
onCheckoutError?: (message: string) => void;
|
|
43
|
+
};
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Styles
|
|
47
|
+
*/
|
|
48
|
+
declare const ElementsStyle: z.ZodObject<{
|
|
37
49
|
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
38
50
|
color: z.ZodOptional<z.ZodString>;
|
|
39
51
|
fontFamily: z.ZodOptional<z.ZodString>;
|
|
@@ -59,6 +71,26 @@ declare const ElementStyleSchema: z.ZodObject<{
|
|
|
59
71
|
padding?: string | undefined;
|
|
60
72
|
}>;
|
|
61
73
|
|
|
74
|
+
declare type ElementsStyle = z.infer<typeof ElementsStyle>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Expected input fields
|
|
78
|
+
*/
|
|
79
|
+
export declare enum FieldName {
|
|
80
|
+
CARD_NUMBER = "cardNumber",
|
|
81
|
+
CARD_EXPIRY = "cardExpiry",
|
|
82
|
+
CARD_CVC = "cardCvc",
|
|
83
|
+
FIRST_NAME = "firstName",
|
|
84
|
+
LAST_NAME = "lastName",
|
|
85
|
+
EMAIL = "email",
|
|
86
|
+
ZIP_CODE = "zipCode",
|
|
87
|
+
CITY = "city",
|
|
88
|
+
STATE = "state",
|
|
89
|
+
COUNTRY = "country",
|
|
90
|
+
ADDRESS = "address",
|
|
91
|
+
PHONE = "phone"
|
|
92
|
+
}
|
|
93
|
+
|
|
62
94
|
export declare const useOpenPayElements: () => ElementsContextValue;
|
|
63
95
|
|
|
64
96
|
export { }
|