@pay-com/js 1.2.1 → 1.2.3
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/lib/dts/types/index.d.ts +59 -9
- package/lib/index.d.ts +59 -9
- package/package.json +1 -1
package/lib/dts/types/index.d.ts
CHANGED
|
@@ -107,9 +107,29 @@ export interface CheckoutToggles {
|
|
|
107
107
|
withCvvTooltip?: boolean
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance.
|
|
112
|
+
*/
|
|
113
|
+
type PaypalButtonStyle = {
|
|
114
|
+
color?: 'gold' | 'blue' | 'silver' | 'white' | 'black'
|
|
115
|
+
height?: number
|
|
116
|
+
label?:
|
|
117
|
+
| 'paypal'
|
|
118
|
+
| 'checkout'
|
|
119
|
+
| 'buynow'
|
|
120
|
+
| 'pay'
|
|
121
|
+
| 'installment'
|
|
122
|
+
| 'subscribe'
|
|
123
|
+
| 'donate'
|
|
124
|
+
layout?: 'vertical' | 'horizontal'
|
|
125
|
+
shape?: 'rect' | 'pill'
|
|
126
|
+
tagline?: boolean
|
|
127
|
+
}
|
|
128
|
+
|
|
110
129
|
export interface PaypalOpts {
|
|
111
130
|
container: string
|
|
112
|
-
onClickValidation
|
|
131
|
+
onClickValidation?: () => Promise<boolean>
|
|
132
|
+
style?: PaypalButtonStyle
|
|
113
133
|
}
|
|
114
134
|
|
|
115
135
|
export interface RenderOpts {
|
|
@@ -227,6 +247,28 @@ export interface ApmStyle {
|
|
|
227
247
|
input?: PayCssConfig
|
|
228
248
|
}
|
|
229
249
|
|
|
250
|
+
type JssObject = {
|
|
251
|
+
[K in keyof PayCssConfig]?: PayCssConfig[K]
|
|
252
|
+
} & {
|
|
253
|
+
[selector: `& ${string}`]: JssObject | string | number | undefined
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
type CheckboxStyleOverrides = {
|
|
257
|
+
':selected'?: CSS.Properties
|
|
258
|
+
} & CSS.Properties
|
|
259
|
+
|
|
260
|
+
export type DynamicFieldStyles = {
|
|
261
|
+
label?: CSS.Properties
|
|
262
|
+
input?: CSS.Properties
|
|
263
|
+
date?: CSS.Properties
|
|
264
|
+
select?: JssObject
|
|
265
|
+
radio?: {
|
|
266
|
+
color?: CSS.Properties['color']
|
|
267
|
+
label?: CSS.Properties
|
|
268
|
+
}
|
|
269
|
+
checkbox?: CheckboxStyleOverrides
|
|
270
|
+
}
|
|
271
|
+
|
|
230
272
|
export interface UniversalOpts {
|
|
231
273
|
container: string
|
|
232
274
|
cardForm?: Omit<RenderOpts, 'container' | 'style'>
|
|
@@ -270,6 +312,7 @@ export interface UniversalOpts {
|
|
|
270
312
|
}
|
|
271
313
|
}
|
|
272
314
|
ctp?: CTPStyles
|
|
315
|
+
paymentMethodFields?: DynamicFieldStyles
|
|
273
316
|
}
|
|
274
317
|
paymentMethods?: Array<string>
|
|
275
318
|
alternatives?: 'button' | 'radio'
|
|
@@ -497,10 +540,16 @@ export type AddressType = {
|
|
|
497
540
|
postalCode: string
|
|
498
541
|
}
|
|
499
542
|
|
|
543
|
+
export type HeadlessPaymentOptions = {
|
|
544
|
+
saveSourceForFutureUse?: boolean
|
|
545
|
+
onValidateSession?: () => Promise<boolean>
|
|
546
|
+
}
|
|
547
|
+
|
|
500
548
|
export type HeadlessFn = (
|
|
501
549
|
method: string,
|
|
502
550
|
paymentMethodData?: unknown,
|
|
503
|
-
billingDetails?: AddressType
|
|
551
|
+
billingDetails?: AddressType,
|
|
552
|
+
options?: HeadlessPaymentOptions
|
|
504
553
|
) => Promise<unknown>
|
|
505
554
|
|
|
506
555
|
export type CanMakePaymentsFn = () => Promise<unknown>
|
|
@@ -583,13 +632,6 @@ export type CustomFieldsValidation = {
|
|
|
583
632
|
pattern?: string
|
|
584
633
|
}
|
|
585
634
|
|
|
586
|
-
export type PaymentMethod = {
|
|
587
|
-
paymentMethodType: string
|
|
588
|
-
name: string
|
|
589
|
-
redirect?: boolean
|
|
590
|
-
fields?: CustomField[]
|
|
591
|
-
}
|
|
592
|
-
|
|
593
635
|
export type CardBrand =
|
|
594
636
|
| 'visa'
|
|
595
637
|
| 'mastercard'
|
|
@@ -598,6 +640,14 @@ export type CardBrand =
|
|
|
598
640
|
| 'jcl'
|
|
599
641
|
| 'unionpay'
|
|
600
642
|
|
|
643
|
+
export type PaymentMethod = {
|
|
644
|
+
paymentMethodType: string
|
|
645
|
+
name: string
|
|
646
|
+
redirect?: boolean
|
|
647
|
+
fields?: CustomField[]
|
|
648
|
+
supportedCardBrands?: CardBrand[]
|
|
649
|
+
}
|
|
650
|
+
|
|
601
651
|
export type ExistingCard = {
|
|
602
652
|
bin: string
|
|
603
653
|
brand: CardBrand
|
package/lib/index.d.ts
CHANGED
|
@@ -112,9 +112,29 @@ interface CheckoutToggles {
|
|
|
112
112
|
withCvvTooltip?: boolean
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance.
|
|
117
|
+
*/
|
|
118
|
+
type PaypalButtonStyle = {
|
|
119
|
+
color?: 'gold' | 'blue' | 'silver' | 'white' | 'black'
|
|
120
|
+
height?: number
|
|
121
|
+
label?:
|
|
122
|
+
| 'paypal'
|
|
123
|
+
| 'checkout'
|
|
124
|
+
| 'buynow'
|
|
125
|
+
| 'pay'
|
|
126
|
+
| 'installment'
|
|
127
|
+
| 'subscribe'
|
|
128
|
+
| 'donate'
|
|
129
|
+
layout?: 'vertical' | 'horizontal'
|
|
130
|
+
shape?: 'rect' | 'pill'
|
|
131
|
+
tagline?: boolean
|
|
132
|
+
}
|
|
133
|
+
|
|
115
134
|
interface PaypalOpts {
|
|
116
135
|
container: string
|
|
117
|
-
onClickValidation
|
|
136
|
+
onClickValidation?: () => Promise<boolean>
|
|
137
|
+
style?: PaypalButtonStyle
|
|
118
138
|
}
|
|
119
139
|
|
|
120
140
|
interface RenderOpts {
|
|
@@ -232,6 +252,28 @@ interface ApmStyle {
|
|
|
232
252
|
input?: PayCssConfig
|
|
233
253
|
}
|
|
234
254
|
|
|
255
|
+
type JssObject = {
|
|
256
|
+
[K in keyof PayCssConfig]?: PayCssConfig[K]
|
|
257
|
+
} & {
|
|
258
|
+
[selector: `& ${string}`]: JssObject | string | number | undefined
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
type CheckboxStyleOverrides = {
|
|
262
|
+
':selected'?: CSS.Properties
|
|
263
|
+
} & CSS.Properties
|
|
264
|
+
|
|
265
|
+
type DynamicFieldStyles = {
|
|
266
|
+
label?: CSS.Properties
|
|
267
|
+
input?: CSS.Properties
|
|
268
|
+
date?: CSS.Properties
|
|
269
|
+
select?: JssObject
|
|
270
|
+
radio?: {
|
|
271
|
+
color?: CSS.Properties['color']
|
|
272
|
+
label?: CSS.Properties
|
|
273
|
+
}
|
|
274
|
+
checkbox?: CheckboxStyleOverrides
|
|
275
|
+
}
|
|
276
|
+
|
|
235
277
|
interface UniversalOpts {
|
|
236
278
|
container: string
|
|
237
279
|
cardForm?: Omit<RenderOpts, 'container' | 'style'>
|
|
@@ -275,6 +317,7 @@ interface UniversalOpts {
|
|
|
275
317
|
}
|
|
276
318
|
}
|
|
277
319
|
ctp?: CTPStyles
|
|
320
|
+
paymentMethodFields?: DynamicFieldStyles
|
|
278
321
|
}
|
|
279
322
|
paymentMethods?: Array<string>
|
|
280
323
|
alternatives?: 'button' | 'radio'
|
|
@@ -496,10 +539,16 @@ type AddressType = {
|
|
|
496
539
|
postalCode: string
|
|
497
540
|
}
|
|
498
541
|
|
|
542
|
+
type HeadlessPaymentOptions = {
|
|
543
|
+
saveSourceForFutureUse?: boolean
|
|
544
|
+
onValidateSession?: () => Promise<boolean>
|
|
545
|
+
}
|
|
546
|
+
|
|
499
547
|
type HeadlessFn = (
|
|
500
548
|
method: string,
|
|
501
549
|
paymentMethodData?: unknown,
|
|
502
|
-
billingDetails?: AddressType
|
|
550
|
+
billingDetails?: AddressType,
|
|
551
|
+
options?: HeadlessPaymentOptions
|
|
503
552
|
) => Promise<unknown>
|
|
504
553
|
|
|
505
554
|
type CanMakePaymentsFn = () => Promise<unknown>
|
|
@@ -582,13 +631,6 @@ type CustomFieldsValidation = {
|
|
|
582
631
|
pattern?: string
|
|
583
632
|
}
|
|
584
633
|
|
|
585
|
-
type PaymentMethod = {
|
|
586
|
-
paymentMethodType: string
|
|
587
|
-
name: string
|
|
588
|
-
redirect?: boolean
|
|
589
|
-
fields?: CustomField[]
|
|
590
|
-
}
|
|
591
|
-
|
|
592
634
|
type CardBrand =
|
|
593
635
|
| 'visa'
|
|
594
636
|
| 'mastercard'
|
|
@@ -597,6 +639,14 @@ type CardBrand =
|
|
|
597
639
|
| 'jcl'
|
|
598
640
|
| 'unionpay'
|
|
599
641
|
|
|
642
|
+
type PaymentMethod = {
|
|
643
|
+
paymentMethodType: string
|
|
644
|
+
name: string
|
|
645
|
+
redirect?: boolean
|
|
646
|
+
fields?: CustomField[]
|
|
647
|
+
supportedCardBrands?: CardBrand[]
|
|
648
|
+
}
|
|
649
|
+
|
|
600
650
|
type ExistingCard = {
|
|
601
651
|
bin: string
|
|
602
652
|
brand: CardBrand
|