@stripe/stripe-js 9.9.0 → 9.10.0

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.js CHANGED
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "9.9.0",
74
+ version: "9.10.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
172
172
  var expectedVersion = RELEASE_TRAIN;
173
173
 
174
174
  if (isTestKey && version !== expectedVersion) {
175
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
176
176
  }
177
177
 
178
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "9.9.0",
70
+ version: "9.10.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
168
168
  var expectedVersion = RELEASE_TRAIN;
169
169
 
170
170
  if (isTestKey && version !== expectedVersion) {
171
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
172
172
  }
173
173
 
174
174
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.js CHANGED
@@ -71,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
71
71
 
72
72
  stripe._registerWrapper({
73
73
  name: 'stripe-js',
74
- version: "9.9.0",
74
+ version: "9.10.0",
75
75
  startTime: startTime
76
76
  });
77
77
  };
@@ -172,7 +172,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
172
172
  var expectedVersion = RELEASE_TRAIN;
173
173
 
174
174
  if (isTestKey && version !== expectedVersion) {
175
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
175
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
176
176
  }
177
177
 
178
178
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.mjs CHANGED
@@ -67,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
67
67
 
68
68
  stripe._registerWrapper({
69
69
  name: 'stripe-js',
70
- version: "9.9.0",
70
+ version: "9.10.0",
71
71
  startTime: startTime
72
72
  });
73
73
  };
@@ -168,7 +168,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
168
168
  var expectedVersion = RELEASE_TRAIN;
169
169
 
170
170
  if (isTestKey && version !== expectedVersion) {
171
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
171
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.10.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
172
172
  }
173
173
 
174
174
  var stripe = maybeStripe.apply(undefined, args);
@@ -22,6 +22,7 @@ import {
22
22
  StripeCheckoutFormConfirmEvent,
23
23
  ExpressCheckoutPaymentMethodsOption,
24
24
  StripeContactDetailsElement,
25
+ StripeTermsElement,
25
26
  } from './elements';
26
27
 
27
28
  type SavedPaymentMethodOption = {
@@ -391,10 +392,23 @@ export type StripeCheckoutAddressElementOptions = {
391
392
  display?: {
392
393
  name?: 'full' | 'split' | 'organization';
393
394
  };
395
+ /**
396
+ * Control which additional fields to display in the AddressElement.
397
+ */
398
+ fields?: {
399
+ phone?: 'always' | 'never' | 'auto';
400
+ /**
401
+ * Requires beta access:
402
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
403
+ */
404
+ name?: 'never' | 'auto';
405
+ };
394
406
  };
395
407
 
396
408
  export type StripeCheckoutContactDetailsElementOptions = Record<string, never>;
397
409
 
410
+ export type StripeCheckoutTermsElementOptions = Record<string, never>;
411
+
398
412
  /**
399
413
  * Wallet button theme options for CheckoutForm.
400
414
  */
@@ -638,6 +652,27 @@ export type StripeCheckoutRunServerUpdateResult =
638
652
  | {type: 'success'; session: StripeCheckoutSession}
639
653
  | {type: 'error'; error: AnyBuyerError};
640
654
 
655
+ type ValidateElementsValidationError = {
656
+ message: string;
657
+ element:
658
+ | 'payment'
659
+ | 'checkoutForm'
660
+ | 'contactDetails'
661
+ | 'shippingAddress'
662
+ | 'billingAddress'
663
+ | 'taxId'
664
+ | 'terms'
665
+ | 'linkAuthentication';
666
+ };
667
+ type ValidateElementsError = {
668
+ code: 'validation_error' | 'no_elements' | null;
669
+ message: string;
670
+ validation_errors: ValidateElementsValidationError[];
671
+ };
672
+ export type StripeCheckoutValidateElementsResult =
673
+ | {type: 'success'; session: StripeCheckoutSession}
674
+ | {type: 'error'; error: ValidateElementsError};
675
+
641
676
  type LoadActionsError = {message: string; code: null};
642
677
  export type StripeCheckoutLoadActionsSuccess = {
643
678
  applyPromotionCode: (
@@ -683,6 +718,7 @@ export type StripeCheckoutLoadActionsSuccess = {
683
718
  runServerUpdate: (
684
719
  userFunction: RunServerUpdateFunction
685
720
  ) => Promise<StripeCheckoutRunServerUpdateResult>;
721
+ validateElements: () => Promise<StripeCheckoutValidateElementsResult>;
686
722
  };
687
723
  export type StripeCheckoutLoadActionsResult =
688
724
  | {type: 'success'; actions: StripeCheckoutLoadActionsSuccess}
@@ -719,6 +755,8 @@ export interface StripeCheckoutElementsSdk {
719
755
  getCurrencySelectorElement(): StripeCurrencySelectorElement | null;
720
756
  /* Requires beta header when initializing Stripe: @docs https://docs.stripe.com/tax/advanced/tax-ids?payment-ui=embedded-components#render-tax-id-element */
721
757
  getTaxIdElement(): StripeTaxIdElement | null;
758
+ /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
759
+ getTermsElement(): StripeTermsElement | null;
722
760
 
723
761
  createPaymentElement(
724
762
  options?: StripeCheckoutPaymentElementOptions
@@ -738,6 +776,10 @@ export interface StripeCheckoutElementsSdk {
738
776
  createContactDetailsElement(
739
777
  options?: StripeCheckoutContactDetailsElementOptions
740
778
  ): StripeContactDetailsElement;
779
+ /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
780
+ createTermsElement(
781
+ options?: StripeCheckoutTermsElementOptions
782
+ ): StripeTermsElement;
741
783
  }
742
784
 
743
785
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
@@ -22,6 +22,7 @@ import {
22
22
  StripeCheckoutFormConfirmEvent,
23
23
  ExpressCheckoutPaymentMethodsOption,
24
24
  StripeContactDetailsElement,
25
+ StripeTermsElement,
25
26
  } from './elements';
26
27
 
27
28
  type SavedPaymentMethodOption = {
@@ -391,10 +392,23 @@ export type StripeCheckoutAddressElementOptions = {
391
392
  display?: {
392
393
  name?: 'full' | 'split' | 'organization';
393
394
  };
395
+ /**
396
+ * Control which additional fields to display in the AddressElement.
397
+ */
398
+ fields?: {
399
+ phone?: 'always' | 'never' | 'auto';
400
+ /**
401
+ * Requires beta access:
402
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
403
+ */
404
+ name?: 'never' | 'auto';
405
+ };
394
406
  };
395
407
 
396
408
  export type StripeCheckoutContactDetailsElementOptions = Record<string, never>;
397
409
 
410
+ export type StripeCheckoutTermsElementOptions = Record<string, never>;
411
+
398
412
  /**
399
413
  * Wallet button theme options for CheckoutForm.
400
414
  */
@@ -638,6 +652,27 @@ export type StripeCheckoutRunServerUpdateResult =
638
652
  | {type: 'success'; session: StripeCheckoutSession}
639
653
  | {type: 'error'; error: AnyBuyerError};
640
654
 
655
+ type ValidateElementsValidationError = {
656
+ message: string;
657
+ element:
658
+ | 'payment'
659
+ | 'checkoutForm'
660
+ | 'contactDetails'
661
+ | 'shippingAddress'
662
+ | 'billingAddress'
663
+ | 'taxId'
664
+ | 'terms'
665
+ | 'linkAuthentication';
666
+ };
667
+ type ValidateElementsError = {
668
+ code: 'validation_error' | 'no_elements' | null;
669
+ message: string;
670
+ validation_errors: ValidateElementsValidationError[];
671
+ };
672
+ export type StripeCheckoutValidateElementsResult =
673
+ | {type: 'success'; session: StripeCheckoutSession}
674
+ | {type: 'error'; error: ValidateElementsError};
675
+
641
676
  type LoadActionsError = {message: string; code: null};
642
677
  export type StripeCheckoutLoadActionsSuccess = {
643
678
  applyPromotionCode: (
@@ -683,6 +718,7 @@ export type StripeCheckoutLoadActionsSuccess = {
683
718
  runServerUpdate: (
684
719
  userFunction: RunServerUpdateFunction
685
720
  ) => Promise<StripeCheckoutRunServerUpdateResult>;
721
+ validateElements: () => Promise<StripeCheckoutValidateElementsResult>;
686
722
  };
687
723
  export type StripeCheckoutLoadActionsResult =
688
724
  | {type: 'success'; actions: StripeCheckoutLoadActionsSuccess}
@@ -719,6 +755,8 @@ export interface StripeCheckoutElementsSdk {
719
755
  getCurrencySelectorElement(): StripeCurrencySelectorElement | null;
720
756
  /* Requires beta header when initializing Stripe: @docs https://docs.stripe.com/tax/advanced/tax-ids?payment-ui=embedded-components#render-tax-id-element */
721
757
  getTaxIdElement(): StripeTaxIdElement | null;
758
+ /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
759
+ getTermsElement(): StripeTermsElement | null;
722
760
 
723
761
  createPaymentElement(
724
762
  options?: StripeCheckoutPaymentElementOptions
@@ -738,6 +776,10 @@ export interface StripeCheckoutElementsSdk {
738
776
  createContactDetailsElement(
739
777
  options?: StripeCheckoutContactDetailsElementOptions
740
778
  ): StripeContactDetailsElement;
779
+ /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
780
+ createTermsElement(
781
+ options?: StripeCheckoutTermsElementOptions
782
+ ): StripeTermsElement;
741
783
  }
742
784
 
743
785
  /* Requires beta access: Contact [Stripe support](https://support.stripe.com/) for more information. */
@@ -198,6 +198,11 @@ export interface StripeAddressElementOptions {
198
198
  */
199
199
  fields?: {
200
200
  phone?: 'always' | 'never' | 'auto';
201
+ /**
202
+ * Requires beta access:
203
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
204
+ */
205
+ name?: 'never' | 'auto';
201
206
  };
202
207
 
203
208
  /**
@@ -198,6 +198,11 @@ export interface StripeAddressElementOptions {
198
198
  */
199
199
  fields?: {
200
200
  phone?: 'always' | 'never' | 'auto';
201
+ /**
202
+ * Requires beta access:
203
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
204
+ */
205
+ name?: 'never' | 'auto';
201
206
  };
202
207
 
203
208
  /**
@@ -17,3 +17,4 @@ export * from './payment';
17
17
  export * from './shipping-address';
18
18
  export * from './issuing';
19
19
  export * from './tax-id';
20
+ export * from './terms';
@@ -17,3 +17,4 @@ export * from './payment';
17
17
  export * from './shipping-address';
18
18
  export * from './issuing';
19
19
  export * from './tax-id';
20
+ export * from './terms';
@@ -16,6 +16,88 @@ export type CheckoutFormAddress = {
16
16
  country?: string | null;
17
17
  };
18
18
 
19
+ /**
20
+ * The `value` payload returned in the change event and getValue() method.
21
+ */
22
+ export type CheckoutFormValues = {
23
+ customerDetails: {
24
+ email: string;
25
+ name?: string;
26
+ businessName?: string;
27
+ phone?: string;
28
+ };
29
+ shippingOption?: {
30
+ id: string;
31
+ displayName: string;
32
+ amount: string;
33
+ };
34
+ shippingAddress?: {
35
+ name: string;
36
+ address: CheckoutFormAddress;
37
+ };
38
+ billingAddress?: {
39
+ name: string;
40
+ address: CheckoutFormAddress;
41
+ };
42
+ tax?: {
43
+ businessName?: string;
44
+ taxId: string;
45
+ taxIdType: TaxIdType;
46
+ externalTaxIdType: ExternalTaxIdType;
47
+ };
48
+ payment?: {
49
+ collapsed: boolean;
50
+ type: string;
51
+ country?: string | null;
52
+ billingDetails?: {
53
+ address?: {
54
+ country?: string;
55
+ postal_code?: string;
56
+ };
57
+ } | null;
58
+ payment_method?: {
59
+ id: string;
60
+ type: string;
61
+ billing_details: {
62
+ address: CheckoutFormAddress;
63
+ name: string | null;
64
+ email: string | null;
65
+ phone: string | null;
66
+ };
67
+ } | null;
68
+ savePaymentMethod?: boolean;
69
+ };
70
+ adaptivePricing?: {
71
+ /**
72
+ * The currently selected local currency code (e.g. 'eur', 'gbp').
73
+ */
74
+ currency: string;
75
+ };
76
+ customFields?: Record<string, string | number>;
77
+ customComponents?: Record<string, string | number>;
78
+ };
79
+
80
+ /**
81
+ * The items in the `value` object that have a corresponding status object.
82
+ */
83
+ type CheckoutFormValueSectionsWithStatuses = Omit<
84
+ CheckoutFormValues,
85
+ 'adaptivePricing' | 'shippingOption'
86
+ >;
87
+
88
+ type SectionStatus = {complete: boolean; empty: boolean};
89
+
90
+ /**
91
+ * The `status` payload returned in the change event and getValue() method.
92
+ * - each section in the values object has a corresponding status object: {complete: boolean, empty: boolean}.
93
+ * - customComponents includes the status of each component: {"id of custom component": {complete: boolean, empty: boolean}} .
94
+ */
95
+ export type CheckoutFormStatus = {
96
+ [K in keyof CheckoutFormValueSectionsWithStatuses]: K extends 'customComponents'
97
+ ? Record<string, SectionStatus>
98
+ : SectionStatus;
99
+ };
100
+
19
101
  /**
20
102
  * The change event payload for the CheckoutForm.
21
103
  */
@@ -38,62 +120,18 @@ export interface StripeCheckoutFormChangeEvent {
38
120
  /**
39
121
  * An object containing the current form values.
40
122
  */
41
- value: {
42
- customerDetails: {
43
- email: string;
44
- name?: string;
45
- businessName?: string;
46
- phone?: string;
47
- };
48
- shippingOption?: {
49
- id: string;
50
- displayName: string;
51
- amount: string;
52
- };
53
- shippingAddress?: {
54
- name: string;
55
- address: CheckoutFormAddress;
56
- };
57
- billingAddress?: {
58
- name: string;
59
- address: CheckoutFormAddress;
60
- };
61
- tax?: {
62
- businessName?: string;
63
- taxId: string;
64
- taxIdType: TaxIdType;
65
- externalTaxIdType: ExternalTaxIdType;
66
- };
67
- customFields?: Record<string, string | number>;
68
- payment?: {
69
- collapsed: boolean;
70
- type: string;
71
- country?: string | null;
72
- billingDetails?: {
73
- address?: {
74
- country?: string;
75
- postal_code?: string;
76
- };
77
- } | null;
78
- payment_method?: {
79
- id: string;
80
- type: string;
81
- billing_details: {
82
- address: CheckoutFormAddress;
83
- name: string | null;
84
- email: string | null;
85
- phone: string | null;
86
- };
87
- } | null;
88
- savePaymentMethod?: boolean;
89
- };
90
- adaptivePricing?: {
91
- /**
92
- * The currently selected local currency code (e.g. 'eur', 'gbp').
93
- */
94
- currency: string;
95
- };
96
- };
123
+ value: CheckoutFormValues;
124
+
125
+ /**
126
+ * An object containing the current status (complete/empty) of each section in the values object.
127
+ *
128
+ * Ex.
129
+ * - when all values in the `values.customerDetails` object are empty,
130
+ * `status.customerDetails.empty` will be true.
131
+ * - when all values in the `values.customerDetails` object are complete,
132
+ * `status.customerDetails.complete` will be true.
133
+ */
134
+ status: CheckoutFormStatus;
97
135
 
98
136
  /**
99
137
  * Array of views in compact layout. Only defined for compact layout.
@@ -16,6 +16,88 @@ export type CheckoutFormAddress = {
16
16
  country?: string | null;
17
17
  };
18
18
 
19
+ /**
20
+ * The `value` payload returned in the change event and getValue() method.
21
+ */
22
+ export type CheckoutFormValues = {
23
+ customerDetails: {
24
+ email: string;
25
+ name?: string;
26
+ businessName?: string;
27
+ phone?: string;
28
+ };
29
+ shippingOption?: {
30
+ id: string;
31
+ displayName: string;
32
+ amount: string;
33
+ };
34
+ shippingAddress?: {
35
+ name: string;
36
+ address: CheckoutFormAddress;
37
+ };
38
+ billingAddress?: {
39
+ name: string;
40
+ address: CheckoutFormAddress;
41
+ };
42
+ tax?: {
43
+ businessName?: string;
44
+ taxId: string;
45
+ taxIdType: TaxIdType;
46
+ externalTaxIdType: ExternalTaxIdType;
47
+ };
48
+ payment?: {
49
+ collapsed: boolean;
50
+ type: string;
51
+ country?: string | null;
52
+ billingDetails?: {
53
+ address?: {
54
+ country?: string;
55
+ postal_code?: string;
56
+ };
57
+ } | null;
58
+ payment_method?: {
59
+ id: string;
60
+ type: string;
61
+ billing_details: {
62
+ address: CheckoutFormAddress;
63
+ name: string | null;
64
+ email: string | null;
65
+ phone: string | null;
66
+ };
67
+ } | null;
68
+ savePaymentMethod?: boolean;
69
+ };
70
+ adaptivePricing?: {
71
+ /**
72
+ * The currently selected local currency code (e.g. 'eur', 'gbp').
73
+ */
74
+ currency: string;
75
+ };
76
+ customFields?: Record<string, string | number>;
77
+ customComponents?: Record<string, string | number>;
78
+ };
79
+
80
+ /**
81
+ * The items in the `value` object that have a corresponding status object.
82
+ */
83
+ type CheckoutFormValueSectionsWithStatuses = Omit<
84
+ CheckoutFormValues,
85
+ 'adaptivePricing' | 'shippingOption'
86
+ >;
87
+
88
+ type SectionStatus = {complete: boolean; empty: boolean};
89
+
90
+ /**
91
+ * The `status` payload returned in the change event and getValue() method.
92
+ * - each section in the values object has a corresponding status object: {complete: boolean, empty: boolean}.
93
+ * - customComponents includes the status of each component: {"id of custom component": {complete: boolean, empty: boolean}} .
94
+ */
95
+ export type CheckoutFormStatus = {
96
+ [K in keyof CheckoutFormValueSectionsWithStatuses]: K extends 'customComponents'
97
+ ? Record<string, SectionStatus>
98
+ : SectionStatus;
99
+ };
100
+
19
101
  /**
20
102
  * The change event payload for the CheckoutForm.
21
103
  */
@@ -38,62 +120,18 @@ export interface StripeCheckoutFormChangeEvent {
38
120
  /**
39
121
  * An object containing the current form values.
40
122
  */
41
- value: {
42
- customerDetails: {
43
- email: string;
44
- name?: string;
45
- businessName?: string;
46
- phone?: string;
47
- };
48
- shippingOption?: {
49
- id: string;
50
- displayName: string;
51
- amount: string;
52
- };
53
- shippingAddress?: {
54
- name: string;
55
- address: CheckoutFormAddress;
56
- };
57
- billingAddress?: {
58
- name: string;
59
- address: CheckoutFormAddress;
60
- };
61
- tax?: {
62
- businessName?: string;
63
- taxId: string;
64
- taxIdType: TaxIdType;
65
- externalTaxIdType: ExternalTaxIdType;
66
- };
67
- customFields?: Record<string, string | number>;
68
- payment?: {
69
- collapsed: boolean;
70
- type: string;
71
- country?: string | null;
72
- billingDetails?: {
73
- address?: {
74
- country?: string;
75
- postal_code?: string;
76
- };
77
- } | null;
78
- payment_method?: {
79
- id: string;
80
- type: string;
81
- billing_details: {
82
- address: CheckoutFormAddress;
83
- name: string | null;
84
- email: string | null;
85
- phone: string | null;
86
- };
87
- } | null;
88
- savePaymentMethod?: boolean;
89
- };
90
- adaptivePricing?: {
91
- /**
92
- * The currently selected local currency code (e.g. 'eur', 'gbp').
93
- */
94
- currency: string;
95
- };
96
- };
123
+ value: CheckoutFormValues;
124
+
125
+ /**
126
+ * An object containing the current status (complete/empty) of each section in the values object.
127
+ *
128
+ * Ex.
129
+ * - when all values in the `values.customerDetails` object are empty,
130
+ * `status.customerDetails.empty` will be true.
131
+ * - when all values in the `values.customerDetails` object are complete,
132
+ * `status.customerDetails.complete` will be true.
133
+ */
134
+ status: CheckoutFormStatus;
97
135
 
98
136
  /**
99
137
  * Array of views in compact layout. Only defined for compact layout.
@@ -0,0 +1,102 @@
1
+ import {StripeElementBase} from './base';
2
+ import {StripeError} from '../stripe';
3
+
4
+ export type StripeTermsElement = StripeElementBase & {
5
+ /**
6
+ * Triggered when the element is fully rendered and can accept `element.focus` calls.
7
+ */
8
+ on(
9
+ eventType: 'ready',
10
+ handler: (event: {elementType: 'terms'}) => any
11
+ ): StripeTermsElement;
12
+ once(
13
+ eventType: 'ready',
14
+ handler: (event: {elementType: 'terms'}) => any
15
+ ): StripeTermsElement;
16
+ off(
17
+ eventType: 'ready',
18
+ handler?: (event: {elementType: 'terms'}) => any
19
+ ): StripeTermsElement;
20
+
21
+ /**
22
+ * Triggered when the element gains focus.
23
+ */
24
+ on(
25
+ eventType: 'focus',
26
+ handler: (event: {elementType: 'terms'}) => any
27
+ ): StripeTermsElement;
28
+ once(
29
+ eventType: 'focus',
30
+ handler: (event: {elementType: 'terms'}) => any
31
+ ): StripeTermsElement;
32
+ off(
33
+ eventType: 'focus',
34
+ handler?: (event: {elementType: 'terms'}) => any
35
+ ): StripeTermsElement;
36
+
37
+ /**
38
+ * Triggered when the element loses focus.
39
+ */
40
+ on(
41
+ eventType: 'blur',
42
+ handler: (event: {elementType: 'terms'}) => any
43
+ ): StripeTermsElement;
44
+ once(
45
+ eventType: 'blur',
46
+ handler: (event: {elementType: 'terms'}) => any
47
+ ): StripeTermsElement;
48
+ off(
49
+ eventType: 'blur',
50
+ handler?: (event: {elementType: 'terms'}) => any
51
+ ): StripeTermsElement;
52
+
53
+ /**
54
+ * Triggered when the escape key is pressed within the element.
55
+ */
56
+ on(
57
+ eventType: 'escape',
58
+ handler: (event: {elementType: 'terms'}) => any
59
+ ): StripeTermsElement;
60
+ once(
61
+ eventType: 'escape',
62
+ handler: (event: {elementType: 'terms'}) => any
63
+ ): StripeTermsElement;
64
+ off(
65
+ eventType: 'escape',
66
+ handler?: (event: {elementType: 'terms'}) => any
67
+ ): StripeTermsElement;
68
+
69
+ /**
70
+ * Triggered when the element fails to load.
71
+ */
72
+ on(
73
+ eventType: 'loaderror',
74
+ handler: (event: {elementType: 'terms'; error: StripeError}) => any
75
+ ): StripeTermsElement;
76
+ once(
77
+ eventType: 'loaderror',
78
+ handler: (event: {elementType: 'terms'; error: StripeError}) => any
79
+ ): StripeTermsElement;
80
+ off(
81
+ eventType: 'loaderror',
82
+ handler?: (event: {elementType: 'terms'; error: StripeError}) => any
83
+ ): StripeTermsElement;
84
+
85
+ /**
86
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
87
+ */
88
+ on(
89
+ eventType: 'loaderstart',
90
+ handler: (event: {elementType: 'terms'}) => any
91
+ ): StripeTermsElement;
92
+ once(
93
+ eventType: 'loaderstart',
94
+ handler: (event: {elementType: 'terms'}) => any
95
+ ): StripeTermsElement;
96
+ off(
97
+ eventType: 'loaderstart',
98
+ handler?: (event: {elementType: 'terms'}) => any
99
+ ): StripeTermsElement;
100
+ };
101
+
102
+ export interface StripeTermsElementOptions {}
@@ -0,0 +1,102 @@
1
+ import {StripeElementBase} from './base';
2
+ import {StripeError} from '../stripe';
3
+
4
+ export type StripeTermsElement = StripeElementBase & {
5
+ /**
6
+ * Triggered when the element is fully rendered and can accept `element.focus` calls.
7
+ */
8
+ on(
9
+ eventType: 'ready',
10
+ handler: (event: {elementType: 'terms'}) => any
11
+ ): StripeTermsElement;
12
+ once(
13
+ eventType: 'ready',
14
+ handler: (event: {elementType: 'terms'}) => any
15
+ ): StripeTermsElement;
16
+ off(
17
+ eventType: 'ready',
18
+ handler?: (event: {elementType: 'terms'}) => any
19
+ ): StripeTermsElement;
20
+
21
+ /**
22
+ * Triggered when the element gains focus.
23
+ */
24
+ on(
25
+ eventType: 'focus',
26
+ handler: (event: {elementType: 'terms'}) => any
27
+ ): StripeTermsElement;
28
+ once(
29
+ eventType: 'focus',
30
+ handler: (event: {elementType: 'terms'}) => any
31
+ ): StripeTermsElement;
32
+ off(
33
+ eventType: 'focus',
34
+ handler?: (event: {elementType: 'terms'}) => any
35
+ ): StripeTermsElement;
36
+
37
+ /**
38
+ * Triggered when the element loses focus.
39
+ */
40
+ on(
41
+ eventType: 'blur',
42
+ handler: (event: {elementType: 'terms'}) => any
43
+ ): StripeTermsElement;
44
+ once(
45
+ eventType: 'blur',
46
+ handler: (event: {elementType: 'terms'}) => any
47
+ ): StripeTermsElement;
48
+ off(
49
+ eventType: 'blur',
50
+ handler?: (event: {elementType: 'terms'}) => any
51
+ ): StripeTermsElement;
52
+
53
+ /**
54
+ * Triggered when the escape key is pressed within the element.
55
+ */
56
+ on(
57
+ eventType: 'escape',
58
+ handler: (event: {elementType: 'terms'}) => any
59
+ ): StripeTermsElement;
60
+ once(
61
+ eventType: 'escape',
62
+ handler: (event: {elementType: 'terms'}) => any
63
+ ): StripeTermsElement;
64
+ off(
65
+ eventType: 'escape',
66
+ handler?: (event: {elementType: 'terms'}) => any
67
+ ): StripeTermsElement;
68
+
69
+ /**
70
+ * Triggered when the element fails to load.
71
+ */
72
+ on(
73
+ eventType: 'loaderror',
74
+ handler: (event: {elementType: 'terms'; error: StripeError}) => any
75
+ ): StripeTermsElement;
76
+ once(
77
+ eventType: 'loaderror',
78
+ handler: (event: {elementType: 'terms'; error: StripeError}) => any
79
+ ): StripeTermsElement;
80
+ off(
81
+ eventType: 'loaderror',
82
+ handler?: (event: {elementType: 'terms'; error: StripeError}) => any
83
+ ): StripeTermsElement;
84
+
85
+ /**
86
+ * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
87
+ */
88
+ on(
89
+ eventType: 'loaderstart',
90
+ handler: (event: {elementType: 'terms'}) => any
91
+ ): StripeTermsElement;
92
+ once(
93
+ eventType: 'loaderstart',
94
+ handler: (event: {elementType: 'terms'}) => any
95
+ ): StripeTermsElement;
96
+ off(
97
+ eventType: 'loaderstart',
98
+ handler?: (event: {elementType: 'terms'}) => any
99
+ ): StripeTermsElement;
100
+ };
101
+
102
+ export interface StripeTermsElementOptions {}
@@ -43,6 +43,8 @@ import {
43
43
  StripeAddressElementGetElementOptions,
44
44
  StripeTaxIdElement,
45
45
  StripeTaxIdElementOptions,
46
+ StripeTermsElement,
47
+ StripeTermsElementOptions,
46
48
  } from './elements';
47
49
  import {StripeError} from './stripe';
48
50
 
@@ -445,6 +447,29 @@ export interface StripeElements {
445
447
  getElement(
446
448
  elementType: 'currencySelector'
447
449
  ): StripeCurrencySelectorElement | null;
450
+
451
+ /////////////////////////////
452
+ /// terms
453
+ /////////////////////////////
454
+
455
+ /**
456
+ * Requires beta access:
457
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
458
+ *
459
+ * Creates a `TermsElement`.
460
+ */
461
+ create(
462
+ elementType: 'terms',
463
+ options?: StripeTermsElementOptions
464
+ ): StripeTermsElement;
465
+
466
+ /**
467
+ * Requires beta access:
468
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
469
+ *
470
+ * Looks up a previously created `Element` by its type.
471
+ */
472
+ getElement(elementType: 'terms'): StripeTermsElement | null;
448
473
  }
449
474
 
450
475
  export type StripeElementType =
@@ -470,6 +495,7 @@ export type StripeElementType =
470
495
  | 'issuingCardPinDisplay'
471
496
  | 'issuingCardCopyButton'
472
497
  | 'taxId'
498
+ | 'terms'
473
499
  | 'issuingAddToWalletButton';
474
500
 
475
501
  export type StripeElement =
@@ -493,7 +519,8 @@ export type StripeElement =
493
519
  | StripeIssuingCardPinDisplayElement
494
520
  | StripeIssuingCardCopyButtonElement
495
521
  | StripeShippingAddressElement
496
- | StripeTaxIdElement;
522
+ | StripeTaxIdElement
523
+ | StripeTermsElement;
497
524
 
498
525
  export type StripeElementLocale =
499
526
  | 'auto'
@@ -43,6 +43,8 @@ import {
43
43
  StripeAddressElementGetElementOptions,
44
44
  StripeTaxIdElement,
45
45
  StripeTaxIdElementOptions,
46
+ StripeTermsElement,
47
+ StripeTermsElementOptions,
46
48
  } from './elements';
47
49
  import {StripeError} from './stripe';
48
50
 
@@ -445,6 +447,29 @@ export interface StripeElements {
445
447
  getElement(
446
448
  elementType: 'currencySelector'
447
449
  ): StripeCurrencySelectorElement | null;
450
+
451
+ /////////////////////////////
452
+ /// terms
453
+ /////////////////////////////
454
+
455
+ /**
456
+ * Requires beta access:
457
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
458
+ *
459
+ * Creates a `TermsElement`.
460
+ */
461
+ create(
462
+ elementType: 'terms',
463
+ options?: StripeTermsElementOptions
464
+ ): StripeTermsElement;
465
+
466
+ /**
467
+ * Requires beta access:
468
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
469
+ *
470
+ * Looks up a previously created `Element` by its type.
471
+ */
472
+ getElement(elementType: 'terms'): StripeTermsElement | null;
448
473
  }
449
474
 
450
475
  export type StripeElementType =
@@ -470,6 +495,7 @@ export type StripeElementType =
470
495
  | 'issuingCardPinDisplay'
471
496
  | 'issuingCardCopyButton'
472
497
  | 'taxId'
498
+ | 'terms'
473
499
  | 'issuingAddToWalletButton';
474
500
 
475
501
  export type StripeElement =
@@ -493,7 +519,8 @@ export type StripeElement =
493
519
  | StripeIssuingCardPinDisplayElement
494
520
  | StripeIssuingCardCopyButtonElement
495
521
  | StripeShippingAddressElement
496
- | StripeTaxIdElement;
522
+ | StripeTaxIdElement
523
+ | StripeTermsElement;
497
524
 
498
525
  export type StripeElementLocale =
499
526
  | 'auto'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "9.9.0",
3
+ "version": "9.10.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",