@pay-com/js 1.2.1 → 1.2.2

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.
@@ -227,6 +227,28 @@ export interface ApmStyle {
227
227
  input?: PayCssConfig
228
228
  }
229
229
 
230
+ type JssObject = {
231
+ [K in keyof PayCssConfig]?: PayCssConfig[K]
232
+ } & {
233
+ [selector: `& ${string}`]: JssObject | string | number | undefined
234
+ }
235
+
236
+ type CheckboxStyleOverrides = {
237
+ ':selected'?: CSS.Properties
238
+ } & CSS.Properties
239
+
240
+ export type DynamicFieldStyles = {
241
+ label?: CSS.Properties
242
+ input?: CSS.Properties
243
+ date?: CSS.Properties
244
+ select?: JssObject
245
+ radio?: {
246
+ color?: CSS.Properties['color']
247
+ label?: CSS.Properties
248
+ }
249
+ checkbox?: CheckboxStyleOverrides
250
+ }
251
+
230
252
  export interface UniversalOpts {
231
253
  container: string
232
254
  cardForm?: Omit<RenderOpts, 'container' | 'style'>
@@ -270,6 +292,7 @@ export interface UniversalOpts {
270
292
  }
271
293
  }
272
294
  ctp?: CTPStyles
295
+ paymentMethodFields?: DynamicFieldStyles
273
296
  }
274
297
  paymentMethods?: Array<string>
275
298
  alternatives?: 'button' | 'radio'
@@ -497,10 +520,15 @@ export type AddressType = {
497
520
  postalCode: string
498
521
  }
499
522
 
523
+ export type HeadlessPaymentOptions = {
524
+ saveSourceForFutureUse?: boolean
525
+ }
526
+
500
527
  export type HeadlessFn = (
501
528
  method: string,
502
529
  paymentMethodData?: unknown,
503
- billingDetails?: AddressType
530
+ billingDetails?: AddressType,
531
+ options?: HeadlessPaymentOptions
504
532
  ) => Promise<unknown>
505
533
 
506
534
  export type CanMakePaymentsFn = () => Promise<unknown>
@@ -583,13 +611,6 @@ export type CustomFieldsValidation = {
583
611
  pattern?: string
584
612
  }
585
613
 
586
- export type PaymentMethod = {
587
- paymentMethodType: string
588
- name: string
589
- redirect?: boolean
590
- fields?: CustomField[]
591
- }
592
-
593
614
  export type CardBrand =
594
615
  | 'visa'
595
616
  | 'mastercard'
@@ -598,6 +619,14 @@ export type CardBrand =
598
619
  | 'jcl'
599
620
  | 'unionpay'
600
621
 
622
+ export type PaymentMethod = {
623
+ paymentMethodType: string
624
+ name: string
625
+ redirect?: boolean
626
+ fields?: CustomField[]
627
+ supportedCardBrands?: CardBrand[]
628
+ }
629
+
601
630
  export type ExistingCard = {
602
631
  bin: string
603
632
  brand: CardBrand
package/lib/index.d.ts CHANGED
@@ -232,6 +232,28 @@ interface ApmStyle {
232
232
  input?: PayCssConfig
233
233
  }
234
234
 
235
+ type JssObject = {
236
+ [K in keyof PayCssConfig]?: PayCssConfig[K]
237
+ } & {
238
+ [selector: `& ${string}`]: JssObject | string | number | undefined
239
+ }
240
+
241
+ type CheckboxStyleOverrides = {
242
+ ':selected'?: CSS.Properties
243
+ } & CSS.Properties
244
+
245
+ type DynamicFieldStyles = {
246
+ label?: CSS.Properties
247
+ input?: CSS.Properties
248
+ date?: CSS.Properties
249
+ select?: JssObject
250
+ radio?: {
251
+ color?: CSS.Properties['color']
252
+ label?: CSS.Properties
253
+ }
254
+ checkbox?: CheckboxStyleOverrides
255
+ }
256
+
235
257
  interface UniversalOpts {
236
258
  container: string
237
259
  cardForm?: Omit<RenderOpts, 'container' | 'style'>
@@ -275,6 +297,7 @@ interface UniversalOpts {
275
297
  }
276
298
  }
277
299
  ctp?: CTPStyles
300
+ paymentMethodFields?: DynamicFieldStyles
278
301
  }
279
302
  paymentMethods?: Array<string>
280
303
  alternatives?: 'button' | 'radio'
@@ -496,10 +519,15 @@ type AddressType = {
496
519
  postalCode: string
497
520
  }
498
521
 
522
+ type HeadlessPaymentOptions = {
523
+ saveSourceForFutureUse?: boolean
524
+ }
525
+
499
526
  type HeadlessFn = (
500
527
  method: string,
501
528
  paymentMethodData?: unknown,
502
- billingDetails?: AddressType
529
+ billingDetails?: AddressType,
530
+ options?: HeadlessPaymentOptions
503
531
  ) => Promise<unknown>
504
532
 
505
533
  type CanMakePaymentsFn = () => Promise<unknown>
@@ -582,13 +610,6 @@ type CustomFieldsValidation = {
582
610
  pattern?: string
583
611
  }
584
612
 
585
- type PaymentMethod = {
586
- paymentMethodType: string
587
- name: string
588
- redirect?: boolean
589
- fields?: CustomField[]
590
- }
591
-
592
613
  type CardBrand =
593
614
  | 'visa'
594
615
  | 'mastercard'
@@ -597,6 +618,14 @@ type CardBrand =
597
618
  | 'jcl'
598
619
  | 'unionpay'
599
620
 
621
+ type PaymentMethod = {
622
+ paymentMethodType: string
623
+ name: string
624
+ redirect?: boolean
625
+ fields?: CustomField[]
626
+ supportedCardBrands?: CardBrand[]
627
+ }
628
+
600
629
  type ExistingCard = {
601
630
  bin: string
602
631
  brand: CardBrand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pay-com/js",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Pay.com JS loading utility",
5
5
  "keywords": [
6
6
  "Pay.com",