@basis-theory/basis-theory-js 1.52.0 → 1.53.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basis-theory/basis-theory-js",
3
- "version": "1.52.0",
3
+ "version": "1.53.1",
4
4
  "repository": "https://github.com/Basis-Theory/basis-theory-js",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -20,7 +20,7 @@ interface SanitizedElementOptions {
20
20
  iconPosition?: string;
21
21
  cardBrand?: string;
22
22
  autoComplete?: string;
23
- value?: string;
23
+ value?: CardElementValue<'static'> | CardExpirationDateValue<'static'> | string;
24
24
  }
25
25
  declare type ElementOptions = ElementInternalOptions & SanitizedElementOptions;
26
26
  declare type Transform = RegExp | [RegExp, string?] | null;
@@ -31,35 +31,39 @@ interface AutoCompleteOption {
31
31
  autoComplete?: AutoCompleteValue;
32
32
  }
33
33
  declare type CustomizableElementOptions = Pick<ElementOptions, 'style' | 'disabled'> & AutoCompleteOption;
34
- interface CardElementValue {
35
- number?: DataElementReference;
36
- expiration_month?: DataElementReference;
37
- expiration_year?: DataElementReference;
38
- cvc?: DataElementReference;
34
+ declare type ElementValueType = 'static' | 'reference';
35
+ interface CardElementValue<T extends ElementValueType> {
36
+ number?: T extends 'reference' ? DataElementReference : string;
37
+ expiration_month?: T extends 'reference' ? DataElementReference : string;
38
+ expiration_year?: T extends 'reference' ? DataElementReference : string;
39
+ cvc?: T extends 'reference' ? DataElementReference : string;
39
40
  }
40
- interface CardExpirationDateValue {
41
- month: DataElementReference;
42
- year: DataElementReference;
41
+ interface CardExpirationDateValue<T extends ElementValueType> {
42
+ month: T extends 'reference' ? DataElementReference : string;
43
+ year: T extends 'reference' ? DataElementReference : string;
43
44
  }
44
45
  declare type CreateCardElementOptions = CustomizableElementOptions & {
45
- value?: CardElementValue;
46
+ value?: CardElementValue<'static'>;
46
47
  };
47
48
  declare type UpdateCardElementOptions = CreateCardElementOptions;
48
- declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password' | 'value'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
49
+ declare type CreateTextElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'mask' | 'password'> & TransformOption & Required<Pick<ElementOptions, 'targetId'>> & {
49
50
  'aria-label'?: string;
51
+ value?: string;
50
52
  };
51
53
  declare type UpdateTextElementOptions = Omit<CreateTextElementOptions, 'targetId' | 'mask'>;
52
- declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition' | 'value'> & Required<Pick<ElementOptions, 'targetId'>> & {
54
+ declare type CreateCardNumberElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'iconPosition'> & Required<Pick<ElementOptions, 'targetId'>> & {
53
55
  'aria-label'?: string;
56
+ value?: string;
54
57
  };
55
58
  declare type UpdateCardNumberElementOptions = Omit<CreateCardNumberElementOptions, 'targetId'>;
56
59
  declare type CreateCardExpirationDateElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder'> & Required<Pick<ElementOptions, 'targetId'>> & {
57
60
  'aria-label'?: string;
58
- value?: CardExpirationDateValue;
61
+ value?: CardExpirationDateValue<'static'>;
59
62
  };
60
63
  declare type UpdateCardExpirationDateElementOptions = Omit<CreateCardExpirationDateElementOptions, 'targetId'>;
61
- declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand' | 'value'> & Required<Pick<ElementOptions, 'targetId'>> & {
64
+ declare type CreateCardVerificationCodeElementOptions = CustomizableElementOptions & Pick<ElementOptions, 'placeholder' | 'cardBrand'> & Required<Pick<ElementOptions, 'targetId'>> & {
62
65
  'aria-label'?: string;
66
+ value?: string;
63
67
  };
64
68
  declare type UpdateCardVerificationCodeElementOptions = Omit<CreateCardVerificationCodeElementOptions, 'targetId'>;
65
69
  export type { ElementInternalOptions, ElementType, ElementOptions, SanitizedElementOptions, Transform, CustomizableElementOptions, CreateCardElementOptions, UpdateCardElementOptions, CreateTextElementOptions, UpdateTextElementOptions, CreateCardNumberElementOptions, UpdateCardNumberElementOptions, CreateCardExpirationDateElementOptions, UpdateCardExpirationDateElementOptions, CreateCardVerificationCodeElementOptions, UpdateCardVerificationCodeElementOptions, CardElementValue, CardExpirationDateValue, };