@stripe/stripe-js 3.2.0 → 3.4.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
@@ -42,7 +42,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
42
42
 
43
43
  stripe._registerWrapper({
44
44
  name: 'stripe-js',
45
- version: "3.2.0",
45
+ version: "3.3.0",
46
46
  startTime: startTime
47
47
  });
48
48
  };
package/dist/index.mjs CHANGED
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "3.2.0",
41
+ version: "3.3.0",
42
42
  startTime: startTime
43
43
  });
44
44
  };
package/dist/pure.js CHANGED
@@ -58,7 +58,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
58
58
 
59
59
  stripe._registerWrapper({
60
60
  name: 'stripe-js',
61
- version: "3.2.0",
61
+ version: "3.3.0",
62
62
  startTime: startTime
63
63
  });
64
64
  };
package/dist/pure.mjs CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "3.2.0",
57
+ version: "3.3.0",
58
58
  startTime: startTime
59
59
  });
60
60
  };
@@ -50,6 +50,7 @@ export interface ApplePayRecurringPaymentRequest {
50
50
  */
51
51
  managementURL: string;
52
52
  regularBilling: ApplePayRegularBilling;
53
+ trialBilling?: ApplePayRegularBilling;
53
54
 
54
55
  /**
55
56
  * The billing agreement label that is displayed to the customer in the Apple Pay payment interface.
@@ -50,6 +50,7 @@ export interface ApplePayRecurringPaymentRequest {
50
50
  */
51
51
  managementURL: string;
52
52
  regularBilling: ApplePayRegularBilling;
53
+ trialBilling?: ApplePayRegularBilling;
53
54
 
54
55
  /**
55
56
  * The billing agreement label that is displayed to the customer in the Apple Pay payment interface.
@@ -4,6 +4,7 @@ import {
4
4
  StripeElementClasses,
5
5
  StripeElementChangeEvent,
6
6
  } from './base';
7
+ import {StripeError} from '../stripe';
7
8
  import {CardNetworkBrand} from '../elements-group';
8
9
 
9
10
  export type StripeCardNumberElement = StripeElementBase & {
@@ -103,6 +104,22 @@ export type StripeCardNumberElement = StripeElementBase & {
103
104
  handler?: (event: {elementType: 'cardNumber'}) => any
104
105
  ): StripeCardNumberElement;
105
106
 
107
+ /**
108
+ * Triggered when the element fails to load.
109
+ */
110
+ on(
111
+ eventType: 'loaderror',
112
+ handler: (event: {elementType: 'cardNumber'; error: StripeError}) => any
113
+ ): StripeCardNumberElement;
114
+ once(
115
+ eventType: 'loaderror',
116
+ handler: (event: {elementType: 'cardNumber'; error: StripeError}) => any
117
+ ): StripeCardNumberElement;
118
+ off(
119
+ eventType: 'loaderror',
120
+ handler?: (event: {elementType: 'cardNumber'; error: StripeError}) => any
121
+ ): StripeCardNumberElement;
122
+
106
123
  /**
107
124
  * Updates the options the `CardNumberElement` was initialized with.
108
125
  * Updates are merged into the existing configuration.
@@ -4,6 +4,7 @@ import {
4
4
  StripeElementClasses,
5
5
  StripeElementChangeEvent,
6
6
  } from './base';
7
+ import {StripeError} from '../stripe';
7
8
  import {CardNetworkBrand} from '../elements-group';
8
9
 
9
10
  export type StripeCardNumberElement = StripeElementBase & {
@@ -103,6 +104,22 @@ export type StripeCardNumberElement = StripeElementBase & {
103
104
  handler?: (event: {elementType: 'cardNumber'}) => any
104
105
  ): StripeCardNumberElement;
105
106
 
107
+ /**
108
+ * Triggered when the element fails to load.
109
+ */
110
+ on(
111
+ eventType: 'loaderror',
112
+ handler: (event: {elementType: 'cardNumber'; error: StripeError}) => any
113
+ ): StripeCardNumberElement;
114
+ once(
115
+ eventType: 'loaderror',
116
+ handler: (event: {elementType: 'cardNumber'; error: StripeError}) => any
117
+ ): StripeCardNumberElement;
118
+ off(
119
+ eventType: 'loaderror',
120
+ handler?: (event: {elementType: 'cardNumber'; error: StripeError}) => any
121
+ ): StripeCardNumberElement;
122
+
106
123
  /**
107
124
  * Updates the options the `CardNumberElement` was initialized with.
108
125
  * Updates are merged into the existing configuration.
@@ -4,6 +4,7 @@ import {
4
4
  StripeElementClasses,
5
5
  StripeElementChangeEvent,
6
6
  } from './base';
7
+ import {StripeError} from '../stripe';
7
8
  import {CardNetworkBrand} from '../elements-group';
8
9
 
9
10
  export type StripeCardElement = StripeElementBase & {
@@ -103,6 +104,22 @@ export type StripeCardElement = StripeElementBase & {
103
104
  handler?: (event: {elementType: 'card'}) => any
104
105
  ): StripeCardElement;
105
106
 
107
+ /**
108
+ * Triggered when the element fails to load.
109
+ */
110
+ on(
111
+ eventType: 'loaderror',
112
+ handler: (event: {elementType: 'card'; error: StripeError}) => any
113
+ ): StripeCardElement;
114
+ once(
115
+ eventType: 'loaderror',
116
+ handler: (event: {elementType: 'card'; error: StripeError}) => any
117
+ ): StripeCardElement;
118
+ off(
119
+ eventType: 'loaderror',
120
+ handler?: (event: {elementType: 'card'; error: StripeError}) => any
121
+ ): StripeCardElement;
122
+
106
123
  /**
107
124
  * Updates the options the `CardElement` was initialized with.
108
125
  * Updates are merged into the existing configuration.
@@ -4,6 +4,7 @@ import {
4
4
  StripeElementClasses,
5
5
  StripeElementChangeEvent,
6
6
  } from './base';
7
+ import {StripeError} from '../stripe';
7
8
  import {CardNetworkBrand} from '../elements-group';
8
9
 
9
10
  export type StripeCardElement = StripeElementBase & {
@@ -103,6 +104,22 @@ export type StripeCardElement = StripeElementBase & {
103
104
  handler?: (event: {elementType: 'card'}) => any
104
105
  ): StripeCardElement;
105
106
 
107
+ /**
108
+ * Triggered when the element fails to load.
109
+ */
110
+ on(
111
+ eventType: 'loaderror',
112
+ handler: (event: {elementType: 'card'; error: StripeError}) => any
113
+ ): StripeCardElement;
114
+ once(
115
+ eventType: 'loaderror',
116
+ handler: (event: {elementType: 'card'; error: StripeError}) => any
117
+ ): StripeCardElement;
118
+ off(
119
+ eventType: 'loaderror',
120
+ handler?: (event: {elementType: 'card'; error: StripeError}) => any
121
+ ): StripeCardElement;
122
+
106
123
  /**
107
124
  * Updates the options the `CardElement` was initialized with.
108
125
  * Updates are merged into the existing configuration.
@@ -8,7 +8,6 @@ export * from './card-cvc';
8
8
  export * from './card-expiry';
9
9
  export * from './card-number';
10
10
  export * from './card';
11
- export * from './cart';
12
11
  export * from './eps-bank';
13
12
  export * from './express-checkout';
14
13
  export * from './fpx-bank';
@@ -8,7 +8,6 @@ export * from './card-cvc';
8
8
  export * from './card-expiry';
9
9
  export * from './card-number';
10
10
  export * from './card';
11
- export * from './cart';
12
11
  export * from './eps-bank';
13
12
  export * from './express-checkout';
14
13
  export * from './fpx-bank';
@@ -27,8 +27,6 @@ import {
27
27
  StripeCardNumberElementOptions,
28
28
  StripeCardElement,
29
29
  StripeCardElementOptions,
30
- StripeCartElement,
31
- StripeCartElementOptions,
32
30
  StripeAuBankAccountElement,
33
31
  StripeAfterpayClearpayMessageElementOptions,
34
32
  StripeAffirmMessageElement,
@@ -234,29 +232,6 @@ export interface StripeElements {
234
232
  */
235
233
  getElement(elementType: 'cardCvc'): StripeCardCvcElement | null;
236
234
 
237
- /////////////////////////////
238
- /// cart
239
- /////////////////////////////
240
-
241
- /**
242
- * Requires beta access:
243
- * Contact [Stripe support](https://support.stripe.com/) for more information.
244
- *
245
- * Creates a `CartElement`.
246
- */
247
- create(
248
- elementType: 'cart',
249
- options: StripeCartElementOptions
250
- ): StripeCartElement;
251
-
252
- /**
253
- * Requires beta access:
254
- * Contact [Stripe support](https://support.stripe.com/) for more information.
255
- *
256
- * Looks up a previously created `Element` by its type.
257
- */
258
- getElement(elementType: 'cart'): StripeCartElement | null;
259
-
260
235
  /////////////////////////////
261
236
  /// fpxBank
262
237
  /////////////////////////////
@@ -521,7 +496,6 @@ export type StripeElementType =
521
496
  | 'cardNumber'
522
497
  | 'cardExpiry'
523
498
  | 'cardCvc'
524
- | 'cart'
525
499
  | 'epsBank'
526
500
  | 'expressCheckout'
527
501
  | 'fpxBank'
@@ -548,7 +522,6 @@ export type StripeElement =
548
522
  | StripeCardNumberElement
549
523
  | StripeCardExpiryElement
550
524
  | StripeCardCvcElement
551
- | StripeCartElement
552
525
  | StripeEpsBankElement
553
526
  | StripeFpxBankElement
554
527
  | StripeIbanElement
@@ -27,8 +27,6 @@ import {
27
27
  StripeCardNumberElementOptions,
28
28
  StripeCardElement,
29
29
  StripeCardElementOptions,
30
- StripeCartElement,
31
- StripeCartElementOptions,
32
30
  StripeAuBankAccountElement,
33
31
  StripeAfterpayClearpayMessageElementOptions,
34
32
  StripeAffirmMessageElement,
@@ -234,29 +232,6 @@ export interface StripeElements {
234
232
  */
235
233
  getElement(elementType: 'cardCvc'): StripeCardCvcElement | null;
236
234
 
237
- /////////////////////////////
238
- /// cart
239
- /////////////////////////////
240
-
241
- /**
242
- * Requires beta access:
243
- * Contact [Stripe support](https://support.stripe.com/) for more information.
244
- *
245
- * Creates a `CartElement`.
246
- */
247
- create(
248
- elementType: 'cart',
249
- options: StripeCartElementOptions
250
- ): StripeCartElement;
251
-
252
- /**
253
- * Requires beta access:
254
- * Contact [Stripe support](https://support.stripe.com/) for more information.
255
- *
256
- * Looks up a previously created `Element` by its type.
257
- */
258
- getElement(elementType: 'cart'): StripeCartElement | null;
259
-
260
235
  /////////////////////////////
261
236
  /// fpxBank
262
237
  /////////////////////////////
@@ -521,7 +496,6 @@ export type StripeElementType =
521
496
  | 'cardNumber'
522
497
  | 'cardExpiry'
523
498
  | 'cardCvc'
524
- | 'cart'
525
499
  | 'epsBank'
526
500
  | 'expressCheckout'
527
501
  | 'fpxBank'
@@ -548,7 +522,6 @@ export type StripeElement =
548
522
  | StripeCardNumberElement
549
523
  | StripeCardExpiryElement
550
524
  | StripeCardCvcElement
551
- | StripeCartElement
552
525
  | StripeEpsBankElement
553
526
  | StripeFpxBankElement
554
527
  | StripeIbanElement
@@ -1432,6 +1432,13 @@ export interface ConfirmPaymentData extends PaymentIntentConfirmParams {
1432
1432
  allow_redisplay?: 'always' | 'limited' | 'unspecified';
1433
1433
  };
1434
1434
 
1435
+ /**
1436
+ * Optional `id` of an existing [ConfirmationToken](https://stripe.com/docs/api/confirmation_tokens).
1437
+ *
1438
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-confirmation_token
1439
+ */
1440
+ confirmation_token?: string;
1441
+
1435
1442
  /**
1436
1443
  * Optional `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
1437
1444
  *
@@ -1432,6 +1432,13 @@ export interface ConfirmPaymentData extends PaymentIntentConfirmParams {
1432
1432
  allow_redisplay?: 'always' | 'limited' | 'unspecified';
1433
1433
  };
1434
1434
 
1435
+ /**
1436
+ * Optional `id` of an existing [ConfirmationToken](https://stripe.com/docs/api/confirmation_tokens).
1437
+ *
1438
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-confirmation_token
1439
+ */
1440
+ confirmation_token?: string;
1441
+
1435
1442
  /**
1436
1443
  * Optional `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
1437
1444
  *
@@ -237,6 +237,11 @@ export interface PaymentRequestOptions {
237
237
  */
238
238
  applePay?: ApplePayOption;
239
239
 
240
+ /**
241
+ * The Stripe account ID which is the business of record.
242
+ */
243
+ onBehalfOf?: string;
244
+
240
245
  /**
241
246
  * @deprecated
242
247
  * Use disableWallets instead.
@@ -237,6 +237,11 @@ export interface PaymentRequestOptions {
237
237
  */
238
238
  applePay?: ApplePayOption;
239
239
 
240
+ /**
241
+ * The Stripe account ID which is the business of record.
242
+ */
243
+ onBehalfOf?: string;
244
+
240
245
  /**
241
246
  * @deprecated
242
247
  * Use disableWallets instead.
@@ -1,4 +1,4 @@
1
- import {SetupIntentConfirmParams} from '../api';
1
+ import {PaymentMethodCreateParams, SetupIntentConfirmParams} from '../api';
2
2
 
3
3
  import {
4
4
  CreatePaymentMethodAcssDebitData,
@@ -17,6 +17,59 @@ import {
17
17
 
18
18
  import {Omit} from '../utils';
19
19
 
20
+ /**
21
+ * Data to be sent with a `stripe.confirmSetup` request.
22
+ * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
23
+ */
24
+ export interface ConfirmSetupData extends SetupIntentConfirmParams {
25
+ /**
26
+ * The url your customer will be directed to after they complete payment.
27
+ */
28
+ return_url: string;
29
+
30
+ /**
31
+ * An object to attach additional billing_details to the PaymentMethod created via Elements.
32
+ *
33
+ * @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_data
34
+ */
35
+ payment_method_data?: {
36
+ /**
37
+ * The customer's billing details. Details collected by Elements will override values passed here.
38
+ * Billing fields that are omitted in the Payment Element via the `fields` option required.
39
+ *
40
+ * @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_data-billing_details
41
+ */
42
+ billing_details?: PaymentMethodCreateParams.BillingDetails;
43
+
44
+ /**
45
+ * Requires beta access:
46
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
47
+ *
48
+ * Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature
49
+ */
50
+ allow_redisplay?: 'always' | 'limited' | 'unspecified';
51
+ };
52
+
53
+ /**
54
+ * Optional `id` of an existing [ConfirmationToken](https://stripe.com/docs/api/confirmation_tokens).
55
+ *
56
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-confirmation_token
57
+ */
58
+ confirmation_token?: string;
59
+
60
+ /**
61
+ * Optional `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
62
+ *
63
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method
64
+ */
65
+ payment_method?: string;
66
+
67
+ /**
68
+ * Specifies which fields in the response should be expanded.
69
+ */
70
+ expand?: Array<string>;
71
+ }
72
+
20
73
  /**
21
74
  * Data to be sent with a `stripe.confirmCardSetup` request.
22
75
  * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
@@ -1,4 +1,4 @@
1
- import {SetupIntentConfirmParams} from '../api';
1
+ import {PaymentMethodCreateParams, SetupIntentConfirmParams} from '../api';
2
2
 
3
3
  import {
4
4
  CreatePaymentMethodAcssDebitData,
@@ -17,6 +17,59 @@ import {
17
17
 
18
18
  import {Omit} from '../utils';
19
19
 
20
+ /**
21
+ * Data to be sent with a `stripe.confirmSetup` request.
22
+ * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
23
+ */
24
+ export interface ConfirmSetupData extends SetupIntentConfirmParams {
25
+ /**
26
+ * The url your customer will be directed to after they complete payment.
27
+ */
28
+ return_url: string;
29
+
30
+ /**
31
+ * An object to attach additional billing_details to the PaymentMethod created via Elements.
32
+ *
33
+ * @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_data
34
+ */
35
+ payment_method_data?: {
36
+ /**
37
+ * The customer's billing details. Details collected by Elements will override values passed here.
38
+ * Billing fields that are omitted in the Payment Element via the `fields` option required.
39
+ *
40
+ * @docs https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_data-billing_details
41
+ */
42
+ billing_details?: PaymentMethodCreateParams.BillingDetails;
43
+
44
+ /**
45
+ * Requires beta access:
46
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
47
+ *
48
+ * Specifies if the PaymentMethod should be redisplayed when using the Saved Payment Method feature
49
+ */
50
+ allow_redisplay?: 'always' | 'limited' | 'unspecified';
51
+ };
52
+
53
+ /**
54
+ * Optional `id` of an existing [ConfirmationToken](https://stripe.com/docs/api/confirmation_tokens).
55
+ *
56
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-confirmation_token
57
+ */
58
+ confirmation_token?: string;
59
+
60
+ /**
61
+ * Optional `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods).
62
+ *
63
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-confirmParams-payment_method
64
+ */
65
+ payment_method?: string;
66
+
67
+ /**
68
+ * Specifies which fields in the response should be expanded.
69
+ */
70
+ expand?: Array<string>;
71
+ }
72
+
20
73
  /**
21
74
  * Data to be sent with a `stripe.confirmCardSetup` request.
22
75
  * Refer to the [Setup Intents API](https://stripe.com/docs/api/setup_intents/confirm) for a full list of parameters.
@@ -707,7 +707,7 @@ export interface Stripe {
707
707
  */
708
708
  confirmSetup(options: {
709
709
  elements: StripeElements;
710
- confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
710
+ confirmParams?: Partial<setupIntents.ConfirmSetupData>;
711
711
  redirect: 'if_required';
712
712
  }): Promise<SetupIntentResult>;
713
713
 
@@ -725,7 +725,7 @@ export interface Stripe {
725
725
  confirmSetup(options: {
726
726
  elements?: StripeElements;
727
727
  clientSecret: string;
728
- confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
728
+ confirmParams?: Partial<setupIntents.ConfirmSetupData>;
729
729
  redirect: 'if_required';
730
730
  }): Promise<SetupIntentResult>;
731
731
 
@@ -738,7 +738,7 @@ export interface Stripe {
738
738
  */
739
739
  confirmSetup(options: {
740
740
  elements: StripeElements;
741
- confirmParams: paymentIntents.ConfirmPaymentData;
741
+ confirmParams: setupIntents.ConfirmSetupData;
742
742
  redirect?: 'always';
743
743
  }): Promise<never | {error: StripeError}>;
744
744
 
@@ -752,7 +752,7 @@ export interface Stripe {
752
752
  confirmSetup(options: {
753
753
  elements?: StripeElements;
754
754
  clientSecret: string;
755
- confirmParams: paymentIntents.ConfirmPaymentData;
755
+ confirmParams: setupIntents.ConfirmSetupData;
756
756
  redirect?: 'always';
757
757
  }): Promise<never | {error: StripeError}>;
758
758
 
@@ -1299,8 +1299,8 @@ export type EphemeralKeyNonceResult =
1299
1299
  | {nonce: string; error?: undefined}
1300
1300
  | {nonce?: undefined; error: StripeError};
1301
1301
 
1302
- /* A Radar Session is a snapshot of the browser metadata and device details that helps Radar make more accurate predictions on your payments.
1303
- This metadata includes information like IP address, browser, screen or device information, and other device characteristics.
1302
+ /* A Radar Session is a snapshot of the browser metadata and device details that helps Radar make more accurate predictions on your payments.
1303
+ This metadata includes information like IP address, browser, screen or device information, and other device characteristics.
1304
1304
  You can find more details about how Radar uses this data by reading about how Radar performs [advanced fraud detection](https://stripe.com/docs/disputes/prevention/advanced-fraud-detection).
1305
1305
  */
1306
1306
  export type RadarSessionPayload =
@@ -707,7 +707,7 @@ export interface Stripe {
707
707
  */
708
708
  confirmSetup(options: {
709
709
  elements: StripeElements;
710
- confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
710
+ confirmParams?: Partial<setupIntents.ConfirmSetupData>;
711
711
  redirect: 'if_required';
712
712
  }): Promise<SetupIntentResult>;
713
713
 
@@ -725,7 +725,7 @@ export interface Stripe {
725
725
  confirmSetup(options: {
726
726
  elements?: StripeElements;
727
727
  clientSecret: string;
728
- confirmParams?: Partial<paymentIntents.ConfirmPaymentData>;
728
+ confirmParams?: Partial<setupIntents.ConfirmSetupData>;
729
729
  redirect: 'if_required';
730
730
  }): Promise<SetupIntentResult>;
731
731
 
@@ -738,7 +738,7 @@ export interface Stripe {
738
738
  */
739
739
  confirmSetup(options: {
740
740
  elements: StripeElements;
741
- confirmParams: paymentIntents.ConfirmPaymentData;
741
+ confirmParams: setupIntents.ConfirmSetupData;
742
742
  redirect?: 'always';
743
743
  }): Promise<never | {error: StripeError}>;
744
744
 
@@ -752,7 +752,7 @@ export interface Stripe {
752
752
  confirmSetup(options: {
753
753
  elements?: StripeElements;
754
754
  clientSecret: string;
755
- confirmParams: paymentIntents.ConfirmPaymentData;
755
+ confirmParams: setupIntents.ConfirmSetupData;
756
756
  redirect?: 'always';
757
757
  }): Promise<never | {error: StripeError}>;
758
758
 
@@ -1299,8 +1299,8 @@ export type EphemeralKeyNonceResult =
1299
1299
  | {nonce: string; error?: undefined}
1300
1300
  | {nonce?: undefined; error: StripeError};
1301
1301
 
1302
- /* A Radar Session is a snapshot of the browser metadata and device details that helps Radar make more accurate predictions on your payments.
1303
- This metadata includes information like IP address, browser, screen or device information, and other device characteristics.
1302
+ /* A Radar Session is a snapshot of the browser metadata and device details that helps Radar make more accurate predictions on your payments.
1303
+ This metadata includes information like IP address, browser, screen or device information, and other device characteristics.
1304
1304
  You can find more details about how Radar uses this data by reading about how Radar performs [advanced fraud detection](https://stripe.com/docs/disputes/prevention/advanced-fraud-detection).
1305
1305
  */
1306
1306
  export type RadarSessionPayload =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",
@@ -9,8 +9,9 @@
9
9
  "types": "lib/index.d.ts",
10
10
  "typings": "lib/index.d.ts",
11
11
  "scripts": {
12
- "test": "yarn lint && yarn test:unit && yarn test:types && yarn typecheck",
12
+ "test": "yarn lint && yarn test:unit && yarn test:package-types && yarn test:types && yarn typecheck",
13
13
  "test:unit": "jest",
14
+ "test:package-types": "attw --pack . --entrypoints ./lib ./pure",
14
15
  "test:types": "zx ./tests/types/scripts/test.mjs",
15
16
  "lint": "eslint '{src,types}/**/*.{ts,js}' && yarn prettier-check",
16
17
  "typecheck": "tsc",
@@ -39,6 +40,7 @@
39
40
  "node": ">=12.16"
40
41
  },
41
42
  "devDependencies": {
43
+ "@arethetypeswrong/cli": "^0.15.3",
42
44
  "@babel/core": "^7.7.2",
43
45
  "@babel/preset-env": "^7.7.1",
44
46
  "@rollup/plugin-replace": "^2.3.1",
@@ -1,224 +0,0 @@
1
- import {StripeElementBase} from './base';
2
- import {StripeError} from '../stripe';
3
-
4
- export type StripeCartElement = StripeElementBase & {
5
- /**
6
- * The change event is triggered when the `Element`'s value changes.
7
- */
8
- on(
9
- eventType: 'change',
10
- handler: (event: StripeCartElementPayloadEvent) => any
11
- ): StripeCartElement;
12
- once(
13
- eventType: 'change',
14
- handler: (event: StripeCartElementPayloadEvent) => any
15
- ): StripeCartElement;
16
- off(
17
- eventType: 'change',
18
- handler?: (event: StripeCartElementPayloadEvent) => any
19
- ): StripeCartElement;
20
-
21
- /**
22
- * Triggered when the element is fully rendered and can accept `element.focus` calls.
23
- */
24
- on(
25
- eventType: 'ready',
26
- handler: (event: StripeCartElementPayloadEvent) => any
27
- ): StripeCartElement;
28
- once(
29
- eventType: 'ready',
30
- handler: (event: StripeCartElementPayloadEvent) => any
31
- ): StripeCartElement;
32
- off(
33
- eventType: 'ready',
34
- handler?: (event: StripeCartElementPayloadEvent) => any
35
- ): StripeCartElement;
36
-
37
- /**
38
- * Triggered when the element fails to load.
39
- */
40
- on(
41
- eventType: 'loaderror',
42
- handler: (event: {elementType: 'cart'; error: StripeError}) => any
43
- ): StripeCartElement;
44
- once(
45
- eventType: 'loaderror',
46
- handler: (event: {elementType: 'cart'; error: StripeError}) => any
47
- ): StripeCartElement;
48
- off(
49
- eventType: 'loaderror',
50
- handler?: (event: {elementType: 'cart'; error: StripeError}) => any
51
- ): StripeCartElement;
52
-
53
- /**
54
- * Triggered when the 'checkout' button in the element is clicked
55
- */
56
- on(
57
- eventType: 'checkout',
58
- handler: (event: StripeCartElementPayloadEvent) => any
59
- ): StripeCartElement;
60
- once(
61
- eventType: 'checkout',
62
- handler: (event: StripeCartElementPayloadEvent) => any
63
- ): StripeCartElement;
64
- off(
65
- eventType: 'checkout',
66
- handler?: (event: StripeCartElementPayloadEvent) => any
67
- ): StripeCartElement;
68
-
69
- /**
70
- * Triggered when a line item in the element is clicked
71
- */
72
- on(
73
- eventType: 'lineitemclick',
74
- handler: (event: StripeCartElementLineItemClickEvent) => any
75
- ): StripeCartElement;
76
- once(
77
- eventType: 'lineitemclick',
78
- handler: (event: StripeCartElementLineItemClickEvent) => any
79
- ): StripeCartElement;
80
- off(
81
- eventType: 'lineitemclick',
82
- handler?: (event: StripeCartElementLineItemClickEvent) => any
83
- ): StripeCartElement;
84
-
85
- /**
86
- * Updates the options the `CartElement` was initialized with.
87
- * Updates are merged into the existing configuration.
88
- */
89
- update(options: StripeCartElementUpdateOptions): StripeCartElement;
90
-
91
- /**
92
- * Makes the Cart Element visible
93
- */
94
- show(): StripeCartElement;
95
-
96
- /**
97
- * Makes the Cart Element not visible
98
- */
99
- hide(): StripeCartElement;
100
-
101
- /**
102
- * Cancels the "Check Out" button loader and displays an error message regarding why going to checkout failed
103
- */
104
- cancelCheckout(errorMessage?: string | null): StripeCartElement;
105
-
106
- /**
107
- * Adds a line item to the CartSession
108
- */
109
- addLineItem(
110
- lineItemData:
111
- | {
112
- product: string;
113
- price?: null;
114
- item_details?: null;
115
- quantity?: number | null;
116
- }
117
- | {
118
- product?: null;
119
- price: string;
120
- item_details?: null;
121
- quantity?: number | null;
122
- }
123
- | {
124
- price?: null;
125
- product?: null;
126
- item_details: CartItemDetails;
127
- quantity?: number | null;
128
- }
129
- ): Promise<{error?: StripeError}>;
130
- };
131
-
132
- export type CartItemDetails = {
133
- external_id: string;
134
- name: string;
135
- description?: string;
136
- image?: string;
137
- unit_amount: number;
138
- };
139
-
140
- export type CartDescriptor = 'cart' | 'bag' | 'basket';
141
-
142
- export type CartShowOnAdd = 'never' | 'auto';
143
-
144
- export interface StripeCartElementOptions {
145
- /**
146
- * Identifies the CartSession the Element will display and modify.
147
- */
148
- clientSecret: string;
149
-
150
- /**
151
- * Override the verbiage used within the Element to refer to itself.
152
- * By default the Cart Element will use the term 'cart'.
153
- */
154
- descriptor?: CartDescriptor | null;
155
-
156
- /**
157
- * Override the text used in the title of the Element.
158
- * By default the Cart Element will use the title 'Your [descriptor]'.
159
- */
160
- header?: {
161
- text?: string | null;
162
- };
163
-
164
- /**
165
- * Control whether the Element automatically appears when items are added to the cart.
166
- * By default, the Cart Element will use 'auto'.
167
- */
168
- showOnAdd?: CartShowOnAdd | null;
169
- }
170
-
171
- /*
172
- * Updatable options for an `Elements` instance
173
- */
174
- export interface StripeCartElementUpdateOptions {
175
- /**
176
- * Override the text used in the title of the Element.
177
- * By default the Cart Element will use the title 'Your [descriptor]'.
178
- */
179
- header?: {
180
- text?: string | null;
181
- };
182
-
183
- /**
184
- * Control whether the Element automatically appears when items are added to the cart.
185
- * By default, the Cart Element will use 'auto'.
186
- */
187
- showOnAdd?: CartShowOnAdd | null;
188
- }
189
-
190
- export interface StripeCartElementPayloadEvent {
191
- /**
192
- * The type of element that emitted this event.
193
- */
194
- elementType: 'cart';
195
-
196
- /**
197
- * The ID of the CartSession associated with the Element.
198
- */
199
- id: string;
200
-
201
- /**
202
- * The number of line items currently in the cart.
203
- */
204
- lineItems: {
205
- count: number;
206
- };
207
- }
208
-
209
- export interface StripeCartElementLineItemClickEvent {
210
- /**
211
- * The type of element that emitted this event.
212
- */
213
- elementType: 'cart';
214
-
215
- /**
216
- * The ID of the CartSession associated with the Element.
217
- */
218
- preventDefault: () => void;
219
-
220
- /**
221
- * The type of element that emitted this event.
222
- */
223
- url: string;
224
- }
@@ -1,224 +0,0 @@
1
- import {StripeElementBase} from './base';
2
- import {StripeError} from '../stripe';
3
-
4
- export type StripeCartElement = StripeElementBase & {
5
- /**
6
- * The change event is triggered when the `Element`'s value changes.
7
- */
8
- on(
9
- eventType: 'change',
10
- handler: (event: StripeCartElementPayloadEvent) => any
11
- ): StripeCartElement;
12
- once(
13
- eventType: 'change',
14
- handler: (event: StripeCartElementPayloadEvent) => any
15
- ): StripeCartElement;
16
- off(
17
- eventType: 'change',
18
- handler?: (event: StripeCartElementPayloadEvent) => any
19
- ): StripeCartElement;
20
-
21
- /**
22
- * Triggered when the element is fully rendered and can accept `element.focus` calls.
23
- */
24
- on(
25
- eventType: 'ready',
26
- handler: (event: StripeCartElementPayloadEvent) => any
27
- ): StripeCartElement;
28
- once(
29
- eventType: 'ready',
30
- handler: (event: StripeCartElementPayloadEvent) => any
31
- ): StripeCartElement;
32
- off(
33
- eventType: 'ready',
34
- handler?: (event: StripeCartElementPayloadEvent) => any
35
- ): StripeCartElement;
36
-
37
- /**
38
- * Triggered when the element fails to load.
39
- */
40
- on(
41
- eventType: 'loaderror',
42
- handler: (event: {elementType: 'cart'; error: StripeError}) => any
43
- ): StripeCartElement;
44
- once(
45
- eventType: 'loaderror',
46
- handler: (event: {elementType: 'cart'; error: StripeError}) => any
47
- ): StripeCartElement;
48
- off(
49
- eventType: 'loaderror',
50
- handler?: (event: {elementType: 'cart'; error: StripeError}) => any
51
- ): StripeCartElement;
52
-
53
- /**
54
- * Triggered when the 'checkout' button in the element is clicked
55
- */
56
- on(
57
- eventType: 'checkout',
58
- handler: (event: StripeCartElementPayloadEvent) => any
59
- ): StripeCartElement;
60
- once(
61
- eventType: 'checkout',
62
- handler: (event: StripeCartElementPayloadEvent) => any
63
- ): StripeCartElement;
64
- off(
65
- eventType: 'checkout',
66
- handler?: (event: StripeCartElementPayloadEvent) => any
67
- ): StripeCartElement;
68
-
69
- /**
70
- * Triggered when a line item in the element is clicked
71
- */
72
- on(
73
- eventType: 'lineitemclick',
74
- handler: (event: StripeCartElementLineItemClickEvent) => any
75
- ): StripeCartElement;
76
- once(
77
- eventType: 'lineitemclick',
78
- handler: (event: StripeCartElementLineItemClickEvent) => any
79
- ): StripeCartElement;
80
- off(
81
- eventType: 'lineitemclick',
82
- handler?: (event: StripeCartElementLineItemClickEvent) => any
83
- ): StripeCartElement;
84
-
85
- /**
86
- * Updates the options the `CartElement` was initialized with.
87
- * Updates are merged into the existing configuration.
88
- */
89
- update(options: StripeCartElementUpdateOptions): StripeCartElement;
90
-
91
- /**
92
- * Makes the Cart Element visible
93
- */
94
- show(): StripeCartElement;
95
-
96
- /**
97
- * Makes the Cart Element not visible
98
- */
99
- hide(): StripeCartElement;
100
-
101
- /**
102
- * Cancels the "Check Out" button loader and displays an error message regarding why going to checkout failed
103
- */
104
- cancelCheckout(errorMessage?: string | null): StripeCartElement;
105
-
106
- /**
107
- * Adds a line item to the CartSession
108
- */
109
- addLineItem(
110
- lineItemData:
111
- | {
112
- product: string;
113
- price?: null;
114
- item_details?: null;
115
- quantity?: number | null;
116
- }
117
- | {
118
- product?: null;
119
- price: string;
120
- item_details?: null;
121
- quantity?: number | null;
122
- }
123
- | {
124
- price?: null;
125
- product?: null;
126
- item_details: CartItemDetails;
127
- quantity?: number | null;
128
- }
129
- ): Promise<{error?: StripeError}>;
130
- };
131
-
132
- export type CartItemDetails = {
133
- external_id: string;
134
- name: string;
135
- description?: string;
136
- image?: string;
137
- unit_amount: number;
138
- };
139
-
140
- export type CartDescriptor = 'cart' | 'bag' | 'basket';
141
-
142
- export type CartShowOnAdd = 'never' | 'auto';
143
-
144
- export interface StripeCartElementOptions {
145
- /**
146
- * Identifies the CartSession the Element will display and modify.
147
- */
148
- clientSecret: string;
149
-
150
- /**
151
- * Override the verbiage used within the Element to refer to itself.
152
- * By default the Cart Element will use the term 'cart'.
153
- */
154
- descriptor?: CartDescriptor | null;
155
-
156
- /**
157
- * Override the text used in the title of the Element.
158
- * By default the Cart Element will use the title 'Your [descriptor]'.
159
- */
160
- header?: {
161
- text?: string | null;
162
- };
163
-
164
- /**
165
- * Control whether the Element automatically appears when items are added to the cart.
166
- * By default, the Cart Element will use 'auto'.
167
- */
168
- showOnAdd?: CartShowOnAdd | null;
169
- }
170
-
171
- /*
172
- * Updatable options for an `Elements` instance
173
- */
174
- export interface StripeCartElementUpdateOptions {
175
- /**
176
- * Override the text used in the title of the Element.
177
- * By default the Cart Element will use the title 'Your [descriptor]'.
178
- */
179
- header?: {
180
- text?: string | null;
181
- };
182
-
183
- /**
184
- * Control whether the Element automatically appears when items are added to the cart.
185
- * By default, the Cart Element will use 'auto'.
186
- */
187
- showOnAdd?: CartShowOnAdd | null;
188
- }
189
-
190
- export interface StripeCartElementPayloadEvent {
191
- /**
192
- * The type of element that emitted this event.
193
- */
194
- elementType: 'cart';
195
-
196
- /**
197
- * The ID of the CartSession associated with the Element.
198
- */
199
- id: string;
200
-
201
- /**
202
- * The number of line items currently in the cart.
203
- */
204
- lineItems: {
205
- count: number;
206
- };
207
- }
208
-
209
- export interface StripeCartElementLineItemClickEvent {
210
- /**
211
- * The type of element that emitted this event.
212
- */
213
- elementType: 'cart';
214
-
215
- /**
216
- * The ID of the CartSession associated with the Element.
217
- */
218
- preventDefault: () => void;
219
-
220
- /**
221
- * The type of element that emitted this event.
222
- */
223
- url: string;
224
- }