@stripe/stripe-js 3.0.9 → 3.0.10

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.
Files changed (129) hide show
  1. package/dist/index.d.mts +12792 -4
  2. package/dist/index.d.ts +12792 -4
  3. package/dist/{index.js → stripe.js} +1 -1
  4. package/dist/{index.mjs → stripe.mjs} +1 -1
  5. package/package.json +10 -11
  6. package/pure/index.d.mts +12771 -1
  7. package/pure/index.d.ts +12771 -1
  8. package/pure/index.js +204 -1
  9. package/pure/index.mjs +200 -1
  10. package/dist/api/bank-accounts.d.mts +0 -61
  11. package/dist/api/bank-accounts.d.ts +0 -61
  12. package/dist/api/cards.d.mts +0 -130
  13. package/dist/api/cards.d.ts +0 -130
  14. package/dist/api/financial-connections.d.mts +0 -232
  15. package/dist/api/financial-connections.d.ts +0 -232
  16. package/dist/api/index.d.mts +0 -11
  17. package/dist/api/index.d.ts +0 -11
  18. package/dist/api/orders.d.mts +0 -122
  19. package/dist/api/orders.d.ts +0 -122
  20. package/dist/api/payment-intents.d.mts +0 -330
  21. package/dist/api/payment-intents.d.ts +0 -330
  22. package/dist/api/payment-methods.d.mts +0 -452
  23. package/dist/api/payment-methods.d.ts +0 -452
  24. package/dist/api/setup-intents.d.mts +0 -184
  25. package/dist/api/setup-intents.d.ts +0 -184
  26. package/dist/api/shared.d.mts +0 -125
  27. package/dist/api/shared.d.ts +0 -125
  28. package/dist/api/sources.d.mts +0 -1045
  29. package/dist/api/sources.d.ts +0 -1045
  30. package/dist/api/tokens.d.mts +0 -639
  31. package/dist/api/tokens.d.ts +0 -639
  32. package/dist/api/verification-sessions.d.mts +0 -9
  33. package/dist/api/verification-sessions.d.ts +0 -9
  34. package/dist/pure.d.mts +0 -5
  35. package/dist/pure.d.ts +0 -5
  36. package/dist/pure.js +0 -204
  37. package/dist/pure.mjs +0 -200
  38. package/dist/shared.d.mts +0 -6
  39. package/dist/shared.d.ts +0 -6
  40. package/dist/stripe-js/checkout.d.mts +0 -153
  41. package/dist/stripe-js/checkout.d.ts +0 -153
  42. package/dist/stripe-js/custom-checkout.d.mts +0 -402
  43. package/dist/stripe-js/custom-checkout.d.ts +0 -402
  44. package/dist/stripe-js/elements/address.d.mts +0 -261
  45. package/dist/stripe-js/elements/address.d.ts +0 -261
  46. package/dist/stripe-js/elements/affirm-message.d.mts +0 -65
  47. package/dist/stripe-js/elements/affirm-message.d.ts +0 -65
  48. package/dist/stripe-js/elements/afterpay-clearpay-message.d.mts +0 -119
  49. package/dist/stripe-js/elements/afterpay-clearpay-message.d.ts +0 -119
  50. package/dist/stripe-js/elements/apple-pay.d.mts +0 -156
  51. package/dist/stripe-js/elements/apple-pay.d.ts +0 -156
  52. package/dist/stripe-js/elements/au-bank-account.d.mts +0 -138
  53. package/dist/stripe-js/elements/au-bank-account.d.ts +0 -138
  54. package/dist/stripe-js/elements/base.d.mts +0 -264
  55. package/dist/stripe-js/elements/base.d.ts +0 -264
  56. package/dist/stripe-js/elements/card-cvc.d.mts +0 -119
  57. package/dist/stripe-js/elements/card-cvc.d.ts +0 -119
  58. package/dist/stripe-js/elements/card-expiry.d.mts +0 -119
  59. package/dist/stripe-js/elements/card-expiry.d.ts +0 -119
  60. package/dist/stripe-js/elements/card-number.d.mts +0 -200
  61. package/dist/stripe-js/elements/card-number.d.ts +0 -200
  62. package/dist/stripe-js/elements/card.d.mts +0 -226
  63. package/dist/stripe-js/elements/card.d.ts +0 -226
  64. package/dist/stripe-js/elements/cart.d.mts +0 -224
  65. package/dist/stripe-js/elements/cart.d.ts +0 -224
  66. package/dist/stripe-js/elements/eps-bank.d.mts +0 -140
  67. package/dist/stripe-js/elements/eps-bank.d.ts +0 -140
  68. package/dist/stripe-js/elements/express-checkout.d.mts +0 -446
  69. package/dist/stripe-js/elements/express-checkout.d.ts +0 -446
  70. package/dist/stripe-js/elements/fpx-bank.d.mts +0 -134
  71. package/dist/stripe-js/elements/fpx-bank.d.ts +0 -134
  72. package/dist/stripe-js/elements/iban.d.mts +0 -135
  73. package/dist/stripe-js/elements/iban.d.ts +0 -135
  74. package/dist/stripe-js/elements/ideal-bank.d.mts +0 -140
  75. package/dist/stripe-js/elements/ideal-bank.d.ts +0 -140
  76. package/dist/stripe-js/elements/index.d.mts +0 -22
  77. package/dist/stripe-js/elements/index.d.ts +0 -22
  78. package/dist/stripe-js/elements/issuing/index.d.mts +0 -5
  79. package/dist/stripe-js/elements/issuing/index.d.ts +0 -5
  80. package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.mts +0 -37
  81. package/dist/stripe-js/elements/issuing/issuing-card-copy-button.d.ts +0 -37
  82. package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.mts +0 -32
  83. package/dist/stripe-js/elements/issuing/issuing-card-cvc-display.d.ts +0 -32
  84. package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.mts +0 -32
  85. package/dist/stripe-js/elements/issuing/issuing-card-expiry-display.d.ts +0 -32
  86. package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.mts +0 -40
  87. package/dist/stripe-js/elements/issuing/issuing-card-number-display.d.ts +0 -40
  88. package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.mts +0 -32
  89. package/dist/stripe-js/elements/issuing/issuing-card-pin-display.d.ts +0 -32
  90. package/dist/stripe-js/elements/link-authentication.d.mts +0 -158
  91. package/dist/stripe-js/elements/link-authentication.d.ts +0 -158
  92. package/dist/stripe-js/elements/p24-bank.d.mts +0 -140
  93. package/dist/stripe-js/elements/p24-bank.d.ts +0 -140
  94. package/dist/stripe-js/elements/payment-method-messaging.d.mts +0 -98
  95. package/dist/stripe-js/elements/payment-method-messaging.d.ts +0 -98
  96. package/dist/stripe-js/elements/payment-request-button.d.mts +0 -151
  97. package/dist/stripe-js/elements/payment-request-button.d.ts +0 -151
  98. package/dist/stripe-js/elements/payment.d.mts +0 -275
  99. package/dist/stripe-js/elements/payment.d.ts +0 -275
  100. package/dist/stripe-js/elements/shipping-address.d.mts +0 -215
  101. package/dist/stripe-js/elements/shipping-address.d.ts +0 -215
  102. package/dist/stripe-js/elements-group.d.mts +0 -1129
  103. package/dist/stripe-js/elements-group.d.ts +0 -1129
  104. package/dist/stripe-js/embedded-checkout.d.mts +0 -35
  105. package/dist/stripe-js/embedded-checkout.d.ts +0 -35
  106. package/dist/stripe-js/ephemeral-keys.d.mts +0 -3
  107. package/dist/stripe-js/ephemeral-keys.d.ts +0 -3
  108. package/dist/stripe-js/financial-connections.d.mts +0 -19
  109. package/dist/stripe-js/financial-connections.d.ts +0 -19
  110. package/dist/stripe-js/index.d.mts +0 -13
  111. package/dist/stripe-js/index.d.ts +0 -13
  112. package/dist/stripe-js/orders.d.mts +0 -9
  113. package/dist/stripe-js/orders.d.ts +0 -9
  114. package/dist/stripe-js/payment-intents.d.mts +0 -1470
  115. package/dist/stripe-js/payment-intents.d.ts +0 -1470
  116. package/dist/stripe-js/payment-request.d.mts +0 -529
  117. package/dist/stripe-js/payment-request.d.ts +0 -529
  118. package/dist/stripe-js/setup-intents.d.mts +0 -250
  119. package/dist/stripe-js/setup-intents.d.ts +0 -250
  120. package/dist/stripe-js/stripe.d.mts +0 -1472
  121. package/dist/stripe-js/stripe.d.ts +0 -1472
  122. package/dist/stripe-js/token-and-sources.d.mts +0 -110
  123. package/dist/stripe-js/token-and-sources.d.ts +0 -110
  124. package/dist/utils.d.mts +0 -2
  125. package/dist/utils.d.ts +0 -2
  126. package/lib/index.d.mts +0 -1
  127. package/lib/index.d.ts +0 -1
  128. package/lib/index.js +0 -2
  129. package/lib/index.mjs +0 -1
@@ -1,402 +0,0 @@
1
- import {
2
- LayoutObject,
3
- Layout,
4
- TermsOption,
5
- StripePaymentElement,
6
- } from './elements/payment';
7
- import {
8
- AddressMode,
9
- ContactOption,
10
- StripeAddressElement,
11
- } from './elements/address';
12
- import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
13
- import {StripeError} from './stripe';
14
- import {
15
- StripeElementBase,
16
- StripeExpressCheckoutElement,
17
- StripeExpressCheckoutElementConfirmEvent,
18
- StripeExpressCheckoutElementOptions,
19
- StripeExpressCheckoutElementReadyEvent,
20
- } from './elements';
21
-
22
- /**
23
- * Requires beta access:
24
- * Contact [Stripe support](https://support.stripe.com/) for more information.
25
- */
26
-
27
- export interface StripeCustomCheckoutElementsOptions {
28
- appearance?: Appearance;
29
- loader?: 'auto' | 'always' | 'never';
30
- fonts?: Array<CssFontSource | CustomFontSource>;
31
- }
32
-
33
- export interface StripeCustomCheckoutOptions {
34
- clientSecret: string;
35
- elementsOptions?: StripeCustomCheckoutElementsOptions;
36
- }
37
-
38
- /* Custom Checkout types */
39
- export type StripeCustomCheckoutAddress = {
40
- country: string;
41
- line1?: string | null;
42
- line2?: string | null;
43
- city?: string | null;
44
- postal_code?: string | null;
45
- state?: string | null;
46
- };
47
-
48
- export type StripeCustomCheckoutAdjustableQuantity = {
49
- maximum: number;
50
- minimum: number;
51
- };
52
-
53
- export type StripeCustomCheckoutBillingInterval =
54
- | 'day'
55
- | 'month'
56
- | 'week'
57
- | 'year';
58
-
59
- export type StripeCustomCheckoutConfirmationRequirement =
60
- | 'phoneNumber'
61
- | 'shippingAddress'
62
- | 'billingAddress'
63
- | 'paymentDetails'
64
- | 'email';
65
-
66
- export type StripeCustomCheckoutContact = {
67
- name?: string | null;
68
- address: StripeCustomCheckoutAddress;
69
- };
70
-
71
- export type StripeCustomCheckoutDeliveryEstimate = {
72
- maximum: StripeCustomCheckoutEstimate | null;
73
- minimum: StripeCustomCheckoutEstimate | null;
74
- };
75
-
76
- export type StripeCustomCheckoutDiscountAmount = {
77
- amount: number;
78
- displayName: string;
79
- promotionCode: string | null;
80
- recurring:
81
- | {type: 'forever'}
82
- | {type: 'repeating'; durationInMonths: number}
83
- | null;
84
- };
85
-
86
- export type StripeCustomCheckoutDueNext = {
87
- amountSubtotal: number;
88
- amountDiscount: number;
89
- amountTaxInclusive: number;
90
- amountTaxExclusive: number;
91
- billingCycleAnchor: number | null;
92
- };
93
-
94
- export type StripeCustomCheckoutEstimate = {
95
- unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
96
- value: number;
97
- };
98
-
99
- export type StripeCustomCheckoutLastPaymentError = {
100
- message: string;
101
- };
102
-
103
- export type StripeCustomCheckoutTaxAmount = {
104
- amount: number;
105
- inclusive: boolean;
106
- displayName: string;
107
- };
108
-
109
- export type StripeCustomCheckoutLineItem = {
110
- id: string;
111
- name: string;
112
- amountDiscount: number;
113
- amountSubtotal: number;
114
- amountTaxExclusive: number;
115
- amountTaxInclusive: number;
116
- unitAmount: number;
117
- description: string | null;
118
- quantity: number;
119
- discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
120
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
121
- recurring: {
122
- interval: StripeCustomCheckoutBillingInterval;
123
- intervalCount: number;
124
- isProrated: boolean;
125
- usageType: 'metered' | 'licensed';
126
- } | null;
127
- adjustableQuantity: StripeCustomCheckoutAdjustableQuantity | null;
128
- };
129
-
130
- export type StripeCustomCheckoutRecurring = {
131
- interval: StripeCustomCheckoutBillingInterval;
132
- intervalCount: number;
133
- dueNext: StripeCustomCheckoutDueNext;
134
- trial: StripeCustomCheckoutTrial | null;
135
- };
136
-
137
- export type StripeCustomCheckoutShipping = {
138
- shippingOption: StripeCustomCheckoutShippingOption;
139
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
140
- };
141
-
142
- export type StripeCustomCheckoutShippingOption = {
143
- id: string;
144
- amount: number;
145
- currency: string;
146
- displayName: string | null;
147
- deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null;
148
- };
149
-
150
- export type StripeCustomCheckoutStatus =
151
- | {type: 'open'}
152
- | {type: 'expired'}
153
- | {
154
- type: 'complete';
155
- paymentStatus: 'paid' | 'unpaid' | 'no_payment_required';
156
- };
157
-
158
- export type StripeCustomCheckoutTaxStatus =
159
- | {status: 'ready'}
160
- | {status: 'requires_shipping_address'}
161
- | {status: 'requires_billing_address'};
162
-
163
- export type StripeCustomCheckoutTotalSummary = {
164
- appliedBalance: number;
165
- balanceAppliedToNextInvoice: boolean;
166
- discount: number;
167
- shippingRate: number;
168
- subtotal: number;
169
- taxExclusive: number;
170
- taxInclusive: number;
171
- total: number;
172
- };
173
-
174
- export type StripeCustomCheckoutTrial = {
175
- trialEnd: number;
176
- trialPeriodDays: number;
177
- };
178
-
179
- /* Custom Checkout session */
180
- export interface StripeCustomCheckoutSession {
181
- billingAddress: StripeCustomCheckoutContact | null;
182
- canConfirm: boolean;
183
- confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
184
- currency: string;
185
- discountAmounts: Array<StripeCustomCheckoutDiscountAmount> | null;
186
- email: string | null;
187
- lastPaymentError: StripeCustomCheckoutLastPaymentError | null;
188
- lineItems: Array<StripeCustomCheckoutLineItem>;
189
- phoneNumber: string | null;
190
- recurring: StripeCustomCheckoutRecurring | null;
191
- shipping: StripeCustomCheckoutShipping | null;
192
- shippingAddress: StripeCustomCheckoutContact | null;
193
- shippingOptions: Array<StripeCustomCheckoutShippingOption>;
194
- status: StripeCustomCheckoutStatus;
195
- tax: StripeCustomCheckoutTaxStatus;
196
- taxAmounts: Array<StripeCustomCheckoutTaxAmount> | null;
197
- total: StripeCustomCheckoutTotalSummary;
198
- }
199
-
200
- export type StripeCustomCheckoutResult =
201
- | {session: StripeCustomCheckoutSession; error?: undefined}
202
- | {session?: undefined; error: StripeError};
203
-
204
- export type StripeCustomCheckoutPaymentElementOptions = {
205
- layout?: Layout | LayoutObject;
206
- paymentMethodOrder?: Array<string>;
207
- readonly?: boolean;
208
- terms?: TermsOption;
209
- };
210
-
211
- export type StripeCustomCheckoutAddressElementOptions = {
212
- mode: AddressMode;
213
- contacts?: ContactOption[];
214
- display?: {
215
- name?: 'full' | 'split' | 'organization';
216
- };
217
- };
218
-
219
- export type StripeCustomCheckoutExpressCheckoutElementOptions = {
220
- buttonHeight: StripeExpressCheckoutElementOptions['buttonHeight'];
221
- buttonTheme: StripeExpressCheckoutElementOptions['buttonTheme'];
222
- buttonType: StripeExpressCheckoutElementOptions['buttonType'];
223
- layout: StripeExpressCheckoutElementOptions['layout'];
224
- };
225
-
226
- export type StripeCustomCheckoutUpdateHandler = (
227
- session: StripeCustomCheckoutSession
228
- ) => void;
229
-
230
- export type StripeCustomCheckoutExpressCheckoutElementConfirmEvent = StripeExpressCheckoutElementConfirmEvent & {
231
- confirm: () => Promise<StripeCustomCheckoutResult>;
232
- };
233
-
234
- export type StripeCustomCheckoutExpressCheckoutElement = StripeElementBase & {
235
- /**
236
- * Triggered when the element is fully rendered.
237
- */
238
- on(
239
- eventType: 'ready',
240
- handler: (event: StripeExpressCheckoutElementReadyEvent) => any
241
- ): StripeCustomCheckoutExpressCheckoutElement;
242
- once(
243
- eventType: 'ready',
244
- handler: (event: StripeExpressCheckoutElementReadyEvent) => any
245
- ): StripeCustomCheckoutExpressCheckoutElement;
246
- off(
247
- eventType: 'ready',
248
- handler?: (event: StripeExpressCheckoutElementReadyEvent) => any
249
- ): StripeCustomCheckoutExpressCheckoutElement;
250
-
251
- /**
252
- * Triggered when the element gains focus.
253
- */
254
- on(
255
- eventType: 'focus',
256
- handler: (event: {elementType: 'expressCheckout'}) => any
257
- ): StripeCustomCheckoutExpressCheckoutElement;
258
- once(
259
- eventType: 'focus',
260
- handler: (event: {elementType: 'expressCheckout'}) => any
261
- ): StripeCustomCheckoutExpressCheckoutElement;
262
- off(
263
- eventType: 'focus',
264
- handler?: (event: {elementType: 'expressCheckout'}) => any
265
- ): StripeCustomCheckoutExpressCheckoutElement;
266
-
267
- /**
268
- * Triggered when the element loses focus.
269
- */
270
- on(
271
- eventType: 'blur',
272
- handler: (event: {elementType: 'expressCheckout'}) => any
273
- ): StripeCustomCheckoutExpressCheckoutElement;
274
- once(
275
- eventType: 'blur',
276
- handler: (event: {elementType: 'expressCheckout'}) => any
277
- ): StripeCustomCheckoutExpressCheckoutElement;
278
- off(
279
- eventType: 'blur',
280
- handler?: (event: {elementType: 'expressCheckout'}) => any
281
- ): StripeCustomCheckoutExpressCheckoutElement;
282
-
283
- /**
284
- * Triggered when the escape key is pressed within the element.
285
- */
286
- on(
287
- eventType: 'escape',
288
- handler: (event: {elementType: 'expressCheckout'}) => any
289
- ): StripeCustomCheckoutExpressCheckoutElement;
290
- once(
291
- eventType: 'escape',
292
- handler: (event: {elementType: 'expressCheckout'}) => any
293
- ): StripeCustomCheckoutExpressCheckoutElement;
294
- off(
295
- eventType: 'escape',
296
- handler?: (event: {elementType: 'expressCheckout'}) => any
297
- ): StripeCustomCheckoutExpressCheckoutElement;
298
-
299
- /**
300
- * Triggered when the element fails to load.
301
- */
302
- on(
303
- eventType: 'loaderror',
304
- handler: (event: {
305
- elementType: 'expressCheckout';
306
- error: StripeError;
307
- }) => any
308
- ): StripeCustomCheckoutExpressCheckoutElement;
309
- once(
310
- eventType: 'loaderror',
311
- handler: (event: {
312
- elementType: 'expressCheckout';
313
- error: StripeError;
314
- }) => any
315
- ): StripeCustomCheckoutExpressCheckoutElement;
316
- off(
317
- eventType: 'loaderror',
318
- handler?: (event: {
319
- elementType: 'expressCheckout';
320
- error: StripeError;
321
- }) => any
322
- ): StripeCustomCheckoutExpressCheckoutElement;
323
-
324
- /**
325
- * Triggered when a buyer authorizes a payment within a supported payment method.
326
- */
327
- on(
328
- eventType: 'confirm',
329
- handler: (
330
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
331
- ) => any
332
- ): StripeCustomCheckoutExpressCheckoutElement;
333
- once(
334
- eventType: 'confirm',
335
- handler: (
336
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
337
- ) => any
338
- ): StripeCustomCheckoutExpressCheckoutElement;
339
- off(
340
- eventType: 'confirm',
341
- handler?: (
342
- event: StripeCustomCheckoutExpressCheckoutElementConfirmEvent
343
- ) => any
344
- ): StripeCustomCheckoutExpressCheckoutElement;
345
-
346
- /**
347
- * Updates the options the `ExpressCheckoutElement` was initialized with.
348
- * Updates are merged into the existing configuration.
349
- */
350
- update: StripeExpressCheckoutElement['update'];
351
- };
352
-
353
- export interface StripeCustomCheckout {
354
- /* Custom Checkout methods */
355
- applyPromotionCode: (
356
- promotionCode: string
357
- ) => Promise<StripeCustomCheckoutResult>;
358
- removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
359
- updateShippingAddress: (
360
- shippingAddress: StripeCustomCheckoutContact | null
361
- ) => Promise<StripeCustomCheckoutResult>;
362
- updateBillingAddress: (
363
- billingAddress: StripeCustomCheckoutContact | null
364
- ) => Promise<StripeCustomCheckoutResult>;
365
- updatePhoneNumber: (phoneNumber: string) => void;
366
- updateEmail: (email: string) => void;
367
- updateLineItemQuantity: (args: {
368
- lineItem: string;
369
- quantity: number;
370
- }) => Promise<StripeCustomCheckoutResult>;
371
- updateShippingOption: (
372
- shippingOption: string
373
- ) => Promise<StripeCustomCheckoutResult>;
374
- confirm: (args?: {
375
- return_url?: string;
376
- }) => Promise<StripeCustomCheckoutResult>;
377
- session: () => StripeCustomCheckoutSession;
378
- on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
379
-
380
- /* Elements methods */
381
- changeAppearance: (appearance: Appearance) => void;
382
- getElement(elementType: 'payment'): StripePaymentElement | null;
383
- getElement(
384
- elementType: 'address',
385
- mode: AddressMode
386
- ): StripeAddressElement | null;
387
- getElement(
388
- elementType: 'expressCheckout'
389
- ): StripeCustomCheckoutExpressCheckoutElement | null;
390
- createElement(
391
- elementType: 'payment',
392
- options?: StripeCustomCheckoutPaymentElementOptions
393
- ): StripePaymentElement;
394
- createElement(
395
- elementType: 'address',
396
- options: StripeCustomCheckoutAddressElementOptions
397
- ): StripeAddressElement;
398
- createElement(
399
- elementType: 'expressCheckout',
400
- options: StripeCustomCheckoutExpressCheckoutElementOptions
401
- ): StripeCustomCheckoutExpressCheckoutElement;
402
- }
@@ -1,261 +0,0 @@
1
- import {StripeElementBase} from './base';
2
- import {StripeError} from '../stripe';
3
-
4
- export type StripeAddressElement = StripeElementBase & {
5
- /**
6
- * The change event is triggered when the `Element`'s value changes.
7
- */
8
- on(
9
- eventType: 'change',
10
- handler: (event: StripeAddressElementChangeEvent) => any
11
- ): StripeAddressElement;
12
- once(
13
- eventType: 'change',
14
- handler: (event: StripeAddressElementChangeEvent) => any
15
- ): StripeAddressElement;
16
- off(
17
- eventType: 'change',
18
- handler?: (event: StripeAddressElementChangeEvent) => any
19
- ): StripeAddressElement;
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: {elementType: 'address'}) => any
27
- ): StripeAddressElement;
28
- once(
29
- eventType: 'ready',
30
- handler: (event: {elementType: 'address'}) => any
31
- ): StripeAddressElement;
32
- off(
33
- eventType: 'ready',
34
- handler?: (event: {elementType: 'address'}) => any
35
- ): StripeAddressElement;
36
-
37
- /**
38
- * Triggered when the element gains focus.
39
- */
40
- on(
41
- eventType: 'focus',
42
- handler: (event: {elementType: 'address'}) => any
43
- ): StripeAddressElement;
44
- once(
45
- eventType: 'focus',
46
- handler: (event: {elementType: 'address'}) => any
47
- ): StripeAddressElement;
48
- off(
49
- eventType: 'focus',
50
- handler?: (event: {elementType: 'address'}) => any
51
- ): StripeAddressElement;
52
-
53
- /**
54
- * Triggered when the element loses focus.
55
- */
56
- on(
57
- eventType: 'blur',
58
- handler: (event: {elementType: 'address'}) => any
59
- ): StripeAddressElement;
60
- once(
61
- eventType: 'blur',
62
- handler: (event: {elementType: 'address'}) => any
63
- ): StripeAddressElement;
64
- off(
65
- eventType: 'blur',
66
- handler?: (event: {elementType: 'address'}) => any
67
- ): StripeAddressElement;
68
-
69
- /**
70
- * Triggered when the escape key is pressed within the element.
71
- */
72
- on(
73
- eventType: 'escape',
74
- handler: (event: {elementType: 'address'}) => any
75
- ): StripeAddressElement;
76
- once(
77
- eventType: 'escape',
78
- handler: (event: {elementType: 'address'}) => any
79
- ): StripeAddressElement;
80
- off(
81
- eventType: 'escape',
82
- handler?: (event: {elementType: 'address'}) => any
83
- ): StripeAddressElement;
84
-
85
- /**
86
- * Triggered when the element fails to load.
87
- */
88
- on(
89
- eventType: 'loaderror',
90
- handler: (event: {elementType: 'address'; error: StripeError}) => any
91
- ): StripeAddressElement;
92
- once(
93
- eventType: 'loaderror',
94
- handler: (event: {elementType: 'address'; error: StripeError}) => any
95
- ): StripeAddressElement;
96
- off(
97
- eventType: 'loaderror',
98
- handler?: (event: {elementType: 'address'; error: StripeError}) => any
99
- ): StripeAddressElement;
100
-
101
- /**
102
- * Triggered when the loader UI is mounted to the DOM and ready to be displayed.
103
- */
104
- on(
105
- eventType: 'loaderstart',
106
- handler: (event: {elementType: 'address'}) => any
107
- ): StripeAddressElement;
108
- once(
109
- eventType: 'loaderstart',
110
- handler: (event: {elementType: 'address'}) => any
111
- ): StripeAddressElement;
112
- off(
113
- eventType: 'loaderstart',
114
- handler?: (event: {elementType: 'address'}) => any
115
- ): StripeAddressElement;
116
-
117
- /**
118
- * Updates the options the `AddressElement` was initialized with.
119
- * Updates are merged into the existing configuration.
120
- */
121
- update(options: Partial<StripeAddressElementOptions>): StripeAddressElement;
122
-
123
- /**
124
- * Validates and retrieves form values from the `AddressElement`.
125
- */
126
- getValue(): Promise<
127
- Pick<StripeAddressElementChangeEvent, 'complete' | 'isNewAddress' | 'value'>
128
- >;
129
- };
130
-
131
- export interface ContactOption {
132
- name: string;
133
- phone?: string;
134
- address: {
135
- line1: string;
136
- line2?: string;
137
- city: string;
138
- state: string;
139
- postal_code: string;
140
- country: string;
141
- };
142
- }
143
-
144
- export type AddressMode = 'shipping' | 'billing';
145
-
146
- export interface StripeAddressElementOptions {
147
- /**
148
- * Control which mode the AddressElement will be used for.
149
- */
150
- mode: AddressMode;
151
-
152
- /**
153
- * An array of two-letter ISO country codes representing which countries
154
- * are displayed in the AddressElement.
155
- */
156
- allowedCountries?: string[] | null;
157
-
158
- /**
159
- * Control autocomplete settings in the AddressElement.
160
- */
161
- autocomplete?:
162
- | {mode: 'automatic'}
163
- | {mode: 'disabled'}
164
- | {mode: 'google_maps_api'; apiKey: string};
165
-
166
- /**
167
- * Whether or not AddressElement accepts PO boxes
168
- */
169
- blockPoBox?: boolean;
170
-
171
- /**
172
- * An array of saved addresses.
173
- */
174
- contacts?: ContactOption[];
175
-
176
- /**
177
- * Default value for AddressElement fields
178
- */
179
- defaultValues?: {
180
- name?: string | null;
181
- firstName?: string | null;
182
- lastName?: string | null;
183
- address?: {
184
- line1?: string | null;
185
- line2?: string | null;
186
- city?: string | null;
187
- state?: string | null;
188
- postal_code?: string | null;
189
- country: string;
190
- };
191
- phone?: string | null;
192
- };
193
-
194
- /**
195
- * Control which additional fields to display in the AddressElement.
196
- */
197
- fields?: {
198
- phone?: 'always' | 'never' | 'auto';
199
- };
200
-
201
- /**
202
- * Specify validation rules for the above additional fields.
203
- */
204
- validation?: {
205
- phone?: {
206
- required: 'always' | 'never' | 'auto';
207
- };
208
- };
209
-
210
- /**
211
- * Specify display options in the AddressElement
212
- */
213
- display?: {
214
- name?: 'full' | 'split' | 'organization';
215
- };
216
- }
217
-
218
- export interface StripeAddressElementChangeEvent {
219
- /**
220
- * The type of element that emitted this event.
221
- */
222
- elementType: 'address';
223
-
224
- /**
225
- * The mode of the AddressElement that emitted this event.
226
- */
227
- elementMode: AddressMode;
228
-
229
- /**
230
- * Whether or not the AddressElement is currently empty.
231
- */
232
- empty: boolean;
233
-
234
- /**
235
- * Whether or not the AddressElement is complete.
236
- */
237
- complete: boolean;
238
-
239
- /**
240
- * Whether or not the address is new.
241
- */
242
- isNewAddress: boolean;
243
-
244
- /**
245
- * An object containing the current address.
246
- */
247
- value: {
248
- name: string;
249
- firstName?: string;
250
- lastName?: string;
251
- address: {
252
- line1: string;
253
- line2: string | null;
254
- city: string;
255
- state: string;
256
- postal_code: string;
257
- country: string;
258
- };
259
- phone?: string;
260
- };
261
- }