@getopenpay/openpay-js 0.1.1-alpha.2 → 0.1.1

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 CHANGED
@@ -1,17 +1,23 @@
1
1
  import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
2
2
  import { z } from 'zod';
3
3
 
4
- declare const AllFieldNames = z.union([FieldNameEnum, PrivateFieldNameEnum]);
4
+ declare const AllFieldNames: z.ZodUnion<[z.ZodNativeEnum<typeof FieldName>, z.ZodNativeEnum<typeof PrivateFieldName>]>;
5
5
 
6
6
  declare type AllFieldNames = z.infer<typeof AllFieldNames>;
7
7
 
8
8
  /**
9
9
  * Payment requests
10
10
  */
11
- declare const Amount = z.object({
12
- amountAtom: z.number(),
13
- currency: RequiredString,
14
- });
11
+ declare const Amount: z.ZodObject<{
12
+ amountAtom: z.ZodNumber;
13
+ currency: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ currency: string;
16
+ amountAtom: number;
17
+ }, {
18
+ currency: string;
19
+ amountAtom: number;
20
+ }>;
15
21
 
16
22
  declare type Amount = z.infer<typeof Amount>;
17
23
 
@@ -26,18 +32,23 @@ declare type CdeMessage = {
26
32
  /**
27
33
  * Core models
28
34
  */
29
- declare const CheckoutPaymentMethod = z.object({
30
- provider: z.string(),
31
- processor_name: nullOrUndefOr(z.string()),
32
- metadata: nullOrUndefOr(z.record(z.string(), z.any())),
33
- });
35
+ declare const CheckoutPaymentMethod: z.ZodObject<{
36
+ provider: z.ZodString;
37
+ processor_name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
38
+ metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ provider: string;
41
+ processor_name?: string | null | undefined;
42
+ metadata?: Record<string, any> | null | undefined;
43
+ }, {
44
+ provider: string;
45
+ processor_name?: string | null | undefined;
46
+ metadata?: Record<string, any> | null | undefined;
47
+ }>;
34
48
 
35
49
  declare type CheckoutPaymentMethod = z.infer<typeof CheckoutPaymentMethod>;
36
50
 
37
- export declare type Config = Omit<ElementsFormProps, 'children'> & {
38
- formTarget?: string;
39
- onPaymentRequestLoad?: (paymentRequests: Record<'apple_pay' | 'google_pay', PaymentRequestStatus>) => void;
40
- };
51
+ export declare type Config = ElementsFormProps;
41
52
 
42
53
  declare class ConnectionManager {
43
54
  private connections;
@@ -50,17 +61,9 @@ declare type ElementProps<PlaceholderType extends z.ZodTypeAny = z.ZodString> =
50
61
  styles?: ElementsStyle<z.ZodOptional<PlaceholderType>>;
51
62
  };
52
63
 
53
- declare type ElementsFormChildrenProps = {
54
- submit: () => void;
55
- applePay: PaymentRequestStatus;
56
- googlePay: PaymentRequestStatus;
57
- loaded: boolean;
58
- };
59
-
60
- declare type ElementsFormProps = {
64
+ export declare type ElementsFormProps = {
61
65
  className?: string;
62
66
  checkoutSecureToken: string;
63
- children: (props: ElementsFormChildrenProps) => JSX.Element;
64
67
  onFocus?: (elementId: string) => void;
65
68
  onBlur?: (elementId: string) => void;
66
69
  onChange?: (elementId: string) => void;
@@ -72,12 +75,61 @@ declare type ElementsFormProps = {
72
75
  onSetupPaymentMethodSuccess?: (paymentMethodId: string) => void;
73
76
  onCheckoutError?: (message: string) => void;
74
77
  baseUrl?: string;
78
+ formTarget?: string;
79
+ onPaymentRequestLoad?: (paymentRequests: Record<'apple_pay' | 'google_pay', PaymentRequestStatus>) => void;
75
80
  };
76
81
 
77
- declare const ElementsStyle = <T extends z.ZodTypeAny>(placeholderType: T) =>
78
- BaseElementsStyle.extend({
79
- placeholder: placeholderType,
80
- });
82
+ declare const ElementsStyle: <T extends z.ZodTypeAny>(placeholderType: T) => z.ZodObject<z.objectUtil.extendShape<{
83
+ backgroundColor: z.ZodOptional<z.ZodString>;
84
+ color: z.ZodOptional<z.ZodString>;
85
+ fontFamily: z.ZodOptional<z.ZodString>;
86
+ fontSize: z.ZodOptional<z.ZodString>;
87
+ fontWeight: z.ZodOptional<z.ZodString>;
88
+ margin: z.ZodOptional<z.ZodString>;
89
+ padding: z.ZodOptional<z.ZodString>;
90
+ }, {
91
+ placeholder: T;
92
+ }>, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
93
+ backgroundColor: z.ZodOptional<z.ZodString>;
94
+ color: z.ZodOptional<z.ZodString>;
95
+ fontFamily: z.ZodOptional<z.ZodString>;
96
+ fontSize: z.ZodOptional<z.ZodString>;
97
+ fontWeight: z.ZodOptional<z.ZodString>;
98
+ margin: z.ZodOptional<z.ZodString>;
99
+ padding: z.ZodOptional<z.ZodString>;
100
+ }, {
101
+ placeholder: T;
102
+ }>>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<z.objectUtil.extendShape<{
103
+ backgroundColor: z.ZodOptional<z.ZodString>;
104
+ color: z.ZodOptional<z.ZodString>;
105
+ fontFamily: z.ZodOptional<z.ZodString>;
106
+ fontSize: z.ZodOptional<z.ZodString>;
107
+ fontWeight: z.ZodOptional<z.ZodString>;
108
+ margin: z.ZodOptional<z.ZodString>;
109
+ padding: z.ZodOptional<z.ZodString>;
110
+ }, {
111
+ placeholder: T;
112
+ }>>, any>[k]; } : never, z.baseObjectInputType<z.objectUtil.extendShape<{
113
+ backgroundColor: z.ZodOptional<z.ZodString>;
114
+ color: z.ZodOptional<z.ZodString>;
115
+ fontFamily: z.ZodOptional<z.ZodString>;
116
+ fontSize: z.ZodOptional<z.ZodString>;
117
+ fontWeight: z.ZodOptional<z.ZodString>;
118
+ margin: z.ZodOptional<z.ZodString>;
119
+ padding: z.ZodOptional<z.ZodString>;
120
+ }, {
121
+ placeholder: T;
122
+ }>> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<z.objectUtil.extendShape<{
123
+ backgroundColor: z.ZodOptional<z.ZodString>;
124
+ color: z.ZodOptional<z.ZodString>;
125
+ fontFamily: z.ZodOptional<z.ZodString>;
126
+ fontSize: z.ZodOptional<z.ZodString>;
127
+ fontWeight: z.ZodOptional<z.ZodString>;
128
+ margin: z.ZodOptional<z.ZodString>;
129
+ padding: z.ZodOptional<z.ZodString>;
130
+ }, {
131
+ placeholder: T;
132
+ }>>[k_1]; } : never>;
81
133
 
82
134
  declare type ElementsStyle<T extends z.ZodTypeAny> = z.infer<ReturnType<typeof ElementsStyle<T>>>;
83
135
 
@@ -86,19 +138,17 @@ export declare type ElementType = 'card' | 'card-number' | 'card-expiry' | 'card
86
138
  /**
87
139
  * Expected input fields
88
140
  */
89
-
90
- // Supplied by the user
91
141
  export declare enum FieldName {
92
- FIRST_NAME = 'firstName',
93
- LAST_NAME = 'lastName',
94
- EMAIL = 'email',
95
- ZIP_CODE = 'zipCode',
96
- CITY = 'city',
97
- STATE = 'state',
98
- COUNTRY = 'country',
99
- ADDRESS = 'address',
100
- PHONE = 'phone',
101
- PROMOTION_CODE = 'promotionCode',
142
+ FIRST_NAME = "firstName",
143
+ LAST_NAME = "lastName",
144
+ EMAIL = "email",
145
+ ZIP_CODE = "zipCode",
146
+ CITY = "city",
147
+ STATE = "state",
148
+ COUNTRY = "country",
149
+ ADDRESS = "address",
150
+ PHONE = "phone",
151
+ PROMOTION_CODE = "promotionCode"
102
152
  }
103
153
 
104
154
  export declare class OpenPayForm {
@@ -144,4 +194,10 @@ declare type PaymentRequestStatus = {
144
194
  startFlow: (params?: PaymentRequestStartParams) => Promise<void>;
145
195
  };
146
196
 
197
+ declare enum PrivateFieldName {
198
+ CARD_NUMBER = "cardNumber",
199
+ CARD_EXPIRY = "cardExpiry",
200
+ CARD_CVC = "cardCvc"
201
+ }
202
+
147
203
  export { }