@stripe/stripe-js 3.2.0 → 3.3.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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pure.js +1 -1
- package/dist/pure.mjs +1 -1
- package/dist/stripe-js/elements/apple-pay.d.mts +1 -0
- package/dist/stripe-js/elements/apple-pay.d.ts +1 -0
- package/dist/stripe-js/elements/card-number.d.mts +17 -0
- package/dist/stripe-js/elements/card-number.d.ts +17 -0
- package/dist/stripe-js/elements/card.d.mts +17 -0
- package/dist/stripe-js/elements/card.d.ts +17 -0
- package/dist/stripe-js/elements/index.d.mts +0 -1
- package/dist/stripe-js/elements/index.d.ts +0 -1
- package/dist/stripe-js/elements-group.d.mts +0 -27
- package/dist/stripe-js/elements-group.d.ts +0 -27
- package/dist/stripe-js/payment-request.d.mts +5 -0
- package/dist/stripe-js/payment-request.d.ts +5 -0
- package/package.json +1 -1
- package/dist/stripe-js/elements/cart.d.mts +0 -224
- package/dist/stripe-js/elements/cart.d.ts +0 -224
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/dist/pure.js
CHANGED
package/dist/pure.mjs
CHANGED
|
@@ -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.
|
|
@@ -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
|
|
@@ -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.
|
package/package.json
CHANGED
|
@@ -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
|
-
}
|