@stripe/stripe-js 4.7.0 → 4.8.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: "4.6.0",
45
+ version: "4.7.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: "4.6.0",
41
+ version: "4.7.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: "4.6.0",
61
+ version: "4.7.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: "4.6.0",
57
+ version: "4.7.0",
58
58
  startTime: startTime
59
59
  });
60
60
  };
@@ -116,6 +116,31 @@ export type StripePaymentElement = StripeElementBase & {
116
116
  handler?: (event: {elementType: 'payment'}) => any
117
117
  ): StripePaymentElement;
118
118
 
119
+ /**
120
+ * The change event is triggered when the `Element`'s value changes.
121
+ * Represents the details of a selected Card payment method.
122
+ */
123
+ on(
124
+ eventType: 'carddetailschange',
125
+ handler: (event: StripePaymentElementCardDetailsChangeEvent) => any
126
+ ): StripePaymentElement;
127
+
128
+ /**
129
+ * Triggered when a Saved Payment Method is updated.
130
+ */
131
+ on(
132
+ eventType: 'savedpaymentmethodupdate',
133
+ handler: (event: StripePaymentElementSavedPaymentMethodUpdateEvent) => any
134
+ ): StripePaymentElement;
135
+
136
+ /**
137
+ * Triggered when a Saved Payment Method is removed.
138
+ */
139
+ on(
140
+ eventType: 'savedpaymentmethodremove',
141
+ handler: (event: StripePaymentElementSavedPaymentMethodRemoveEvent) => any
142
+ ): StripePaymentElement;
143
+
119
144
  /**
120
145
  * Updates the options the `PaymentElement` was initialized with.
121
146
  * Updates are merged into the existing configuration.
@@ -158,6 +183,7 @@ export interface FieldsOption {
158
183
  phone?: FieldOption;
159
184
  address?:
160
185
  | FieldOption
186
+ | 'if_required'
161
187
  | {
162
188
  country?: FieldOption;
163
189
  postalCode?: FieldOption;
@@ -297,3 +323,112 @@ export interface StripePaymentElementChangeEvent {
297
323
  };
298
324
  };
299
325
  }
326
+
327
+ type CardBrand =
328
+ | 'amex'
329
+ | 'diners'
330
+ | 'discover'
331
+ | 'eftpos_au'
332
+ | 'jcb'
333
+ | 'mastercard'
334
+ | 'unionpay'
335
+ | 'visa'
336
+ | 'unknown';
337
+ type CardFunding = 'credit' | 'debit' | 'prepaid' | 'unknown';
338
+
339
+ export interface StripePaymentElementCardDetailsChangeEvent {
340
+ /**
341
+ * The type of element that emitted this event.
342
+ */
343
+ elementType: 'payment';
344
+
345
+ /**
346
+ * `true` when the card details are loading.
347
+ */
348
+ loading: boolean;
349
+
350
+ /**
351
+ * The card details for the selected payment method.
352
+ * Undefined while loading and for non card payment methods.
353
+ */
354
+ details?: {
355
+ brands: CardBrand[] | null;
356
+ funding: CardFunding | null;
357
+ };
358
+ }
359
+
360
+ export interface StripePaymentElementSavedPaymentMethodUpdateEvent {
361
+ /**
362
+ * The type of element that emitted this event.
363
+ */
364
+ elementType: 'payment';
365
+
366
+ /**
367
+ * `true` when the saved payment method is successfully updated.
368
+ */
369
+ success: boolean;
370
+
371
+ /**
372
+ * Error message if the saved payment method update fails.
373
+ */
374
+ error?: string;
375
+
376
+ /**
377
+ * The updated saved payment method.
378
+ */
379
+ payment_method: {
380
+ id: string;
381
+ type: string;
382
+ billing_details: {
383
+ address: {
384
+ city: null | string;
385
+ country: null | string;
386
+ line1: null | string;
387
+ line2: null | string;
388
+ postal_code: null | string;
389
+ state: null | string;
390
+ };
391
+ name: null | string;
392
+ email: null | string;
393
+ phone: null | string;
394
+ };
395
+ };
396
+ }
397
+
398
+ export interface StripePaymentElementSavedPaymentMethodRemoveEvent {
399
+ /**
400
+ * The type of element that emitted this event.
401
+ */
402
+ elementType: 'payment';
403
+
404
+ /**
405
+ * `true` when the saved payment method is successfully removed.
406
+ */
407
+ success: boolean;
408
+
409
+ /**
410
+ * Error message if the saved payment method removal fails.
411
+ */
412
+ error?: string;
413
+
414
+ /**
415
+ * The removed saved payment method.
416
+ */
417
+ payment_method: {
418
+ id: string;
419
+ type: string;
420
+ billing_details: {
421
+ address: {
422
+ city: null | string;
423
+ country: null | string;
424
+ line1: null | string;
425
+ line2: null | string;
426
+ postal_code: null | string;
427
+ state: null | string;
428
+ };
429
+ name: null | string;
430
+ email: null | string;
431
+ phone: null | string;
432
+ };
433
+ };
434
+ }
@@ -116,6 +116,31 @@ export type StripePaymentElement = StripeElementBase & {
116
116
  handler?: (event: {elementType: 'payment'}) => any
117
117
  ): StripePaymentElement;
118
118
 
119
+ /**
120
+ * The change event is triggered when the `Element`'s value changes.
121
+ * Represents the details of a selected Card payment method.
122
+ */
123
+ on(
124
+ eventType: 'carddetailschange',
125
+ handler: (event: StripePaymentElementCardDetailsChangeEvent) => any
126
+ ): StripePaymentElement;
127
+
128
+ /**
129
+ * Triggered when a Saved Payment Method is updated.
130
+ */
131
+ on(
132
+ eventType: 'savedpaymentmethodupdate',
133
+ handler: (event: StripePaymentElementSavedPaymentMethodUpdateEvent) => any
134
+ ): StripePaymentElement;
135
+
136
+ /**
137
+ * Triggered when a Saved Payment Method is removed.
138
+ */
139
+ on(
140
+ eventType: 'savedpaymentmethodremove',
141
+ handler: (event: StripePaymentElementSavedPaymentMethodRemoveEvent) => any
142
+ ): StripePaymentElement;
143
+
119
144
  /**
120
145
  * Updates the options the `PaymentElement` was initialized with.
121
146
  * Updates are merged into the existing configuration.
@@ -158,6 +183,7 @@ export interface FieldsOption {
158
183
  phone?: FieldOption;
159
184
  address?:
160
185
  | FieldOption
186
+ | 'if_required'
161
187
  | {
162
188
  country?: FieldOption;
163
189
  postalCode?: FieldOption;
@@ -297,3 +323,112 @@ export interface StripePaymentElementChangeEvent {
297
323
  };
298
324
  };
299
325
  }
326
+
327
+ type CardBrand =
328
+ | 'amex'
329
+ | 'diners'
330
+ | 'discover'
331
+ | 'eftpos_au'
332
+ | 'jcb'
333
+ | 'mastercard'
334
+ | 'unionpay'
335
+ | 'visa'
336
+ | 'unknown';
337
+ type CardFunding = 'credit' | 'debit' | 'prepaid' | 'unknown';
338
+
339
+ export interface StripePaymentElementCardDetailsChangeEvent {
340
+ /**
341
+ * The type of element that emitted this event.
342
+ */
343
+ elementType: 'payment';
344
+
345
+ /**
346
+ * `true` when the card details are loading.
347
+ */
348
+ loading: boolean;
349
+
350
+ /**
351
+ * The card details for the selected payment method.
352
+ * Undefined while loading and for non card payment methods.
353
+ */
354
+ details?: {
355
+ brands: CardBrand[] | null;
356
+ funding: CardFunding | null;
357
+ };
358
+ }
359
+
360
+ export interface StripePaymentElementSavedPaymentMethodUpdateEvent {
361
+ /**
362
+ * The type of element that emitted this event.
363
+ */
364
+ elementType: 'payment';
365
+
366
+ /**
367
+ * `true` when the saved payment method is successfully updated.
368
+ */
369
+ success: boolean;
370
+
371
+ /**
372
+ * Error message if the saved payment method update fails.
373
+ */
374
+ error?: string;
375
+
376
+ /**
377
+ * The updated saved payment method.
378
+ */
379
+ payment_method: {
380
+ id: string;
381
+ type: string;
382
+ billing_details: {
383
+ address: {
384
+ city: null | string;
385
+ country: null | string;
386
+ line1: null | string;
387
+ line2: null | string;
388
+ postal_code: null | string;
389
+ state: null | string;
390
+ };
391
+ name: null | string;
392
+ email: null | string;
393
+ phone: null | string;
394
+ };
395
+ };
396
+ }
397
+
398
+ export interface StripePaymentElementSavedPaymentMethodRemoveEvent {
399
+ /**
400
+ * The type of element that emitted this event.
401
+ */
402
+ elementType: 'payment';
403
+
404
+ /**
405
+ * `true` when the saved payment method is successfully removed.
406
+ */
407
+ success: boolean;
408
+
409
+ /**
410
+ * Error message if the saved payment method removal fails.
411
+ */
412
+ error?: string;
413
+
414
+ /**
415
+ * The removed saved payment method.
416
+ */
417
+ payment_method: {
418
+ id: string;
419
+ type: string;
420
+ billing_details: {
421
+ address: {
422
+ city: null | string;
423
+ country: null | string;
424
+ line1: null | string;
425
+ line2: null | string;
426
+ postal_code: null | string;
427
+ state: null | string;
428
+ };
429
+ name: null | string;
430
+ email: null | string;
431
+ phone: null | string;
432
+ };
433
+ };
434
+ }
@@ -17,6 +17,29 @@ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
17
17
  shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
18
  };
19
19
 
20
+ export type StripeEmbeddedCheckoutLineItem = {
21
+ id?: string;
22
+ quantity?: number;
23
+ price?: string;
24
+ display?: {
25
+ name?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ pricingSpec?: {
30
+ unitAmount?: number;
31
+ unitAmountDecimal?: string;
32
+ currency?: string;
33
+ taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified';
34
+ taxCode?: string;
35
+ };
36
+ };
37
+
38
+ export type StripeEmbeddedCheckoutLineItemsChangeEvent = {
39
+ checkoutSessionId: string;
40
+ lineItems: StripeEmbeddedCheckoutLineItem[];
41
+ };
42
+
20
43
  export type ResultAction =
21
44
  | {type: 'accept'}
22
45
  | {type: 'reject'; errorMessage?: string};
@@ -45,6 +68,13 @@ export interface StripeEmbeddedCheckoutOptions {
45
68
  onShippingDetailsChange?: (
46
69
  event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
70
  ) => Promise<ResultAction>;
71
+ /**
72
+ * onLineItemsChange is called when the customer adds, removes, or modifies a line item.
73
+ * The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`.
74
+ */
75
+ onLineItemsChange?: (
76
+ event: StripeEmbeddedCheckoutLineItemsChangeEvent
77
+ ) => Promise<ResultAction>;
48
78
  }
49
79
 
50
80
  export interface StripeEmbeddedCheckout {
@@ -17,6 +17,29 @@ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
17
17
  shippingDetails: StripeEmbeddedCheckoutShippingDetails;
18
18
  };
19
19
 
20
+ export type StripeEmbeddedCheckoutLineItem = {
21
+ id?: string;
22
+ quantity?: number;
23
+ price?: string;
24
+ display?: {
25
+ name?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ pricingSpec?: {
30
+ unitAmount?: number;
31
+ unitAmountDecimal?: string;
32
+ currency?: string;
33
+ taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified';
34
+ taxCode?: string;
35
+ };
36
+ };
37
+
38
+ export type StripeEmbeddedCheckoutLineItemsChangeEvent = {
39
+ checkoutSessionId: string;
40
+ lineItems: StripeEmbeddedCheckoutLineItem[];
41
+ };
42
+
20
43
  export type ResultAction =
21
44
  | {type: 'accept'}
22
45
  | {type: 'reject'; errorMessage?: string};
@@ -45,6 +68,13 @@ export interface StripeEmbeddedCheckoutOptions {
45
68
  onShippingDetailsChange?: (
46
69
  event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
47
70
  ) => Promise<ResultAction>;
71
+ /**
72
+ * onLineItemsChange is called when the customer adds, removes, or modifies a line item.
73
+ * The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`.
74
+ */
75
+ onLineItemsChange?: (
76
+ event: StripeEmbeddedCheckoutLineItemsChangeEvent
77
+ ) => Promise<ResultAction>;
48
78
  }
49
79
 
50
80
  export interface StripeEmbeddedCheckout {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",