@stripe/stripe-js 2.1.0 → 2.1.2

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/pure.esm.js CHANGED
@@ -54,7 +54,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
54
54
 
55
55
  stripe._registerWrapper({
56
56
  name: 'stripe-js',
57
- version: "2.1.0",
57
+ version: "2.1.2",
58
58
  startTime: startTime
59
59
  });
60
60
  };
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: "2.1.0",
61
+ version: "2.1.2",
62
62
  startTime: startTime
63
63
  });
64
64
  };
@@ -38,7 +38,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
38
38
 
39
39
  stripe._registerWrapper({
40
40
  name: 'stripe-js',
41
- version: "2.1.0",
41
+ version: "2.1.2",
42
42
  startTime: startTime
43
43
  });
44
44
  };
package/dist/stripe.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: "2.1.0",
45
+ version: "2.1.2",
46
46
  startTime: startTime
47
47
  });
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Stripe.js loading utility",
5
5
  "main": "dist/stripe.js",
6
6
  "module": "dist/stripe.esm.js",
@@ -0,0 +1,216 @@
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
+
14
+ /**
15
+ * Requires beta access:
16
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
17
+ */
18
+
19
+ /**
20
+ * StripeCustomCheckoutInitOptions
21
+ */
22
+ export interface StripeCustomCheckoutElementsOptions {
23
+ appearance?: Appearance;
24
+ loader?: 'auto' | 'always' | 'never';
25
+ fonts?: Array<CssFontSource | CustomFontSource>;
26
+ }
27
+
28
+ export interface StripeCustomCheckoutOptions {
29
+ clientSecret: string;
30
+ elementsOptions?: StripeCustomCheckoutElementsOptions;
31
+ }
32
+
33
+ /**
34
+ * StripeCustomCheckoutActions
35
+ */
36
+
37
+ export type StripeCustomCheckoutAddress = {
38
+ country: string | null;
39
+ line1: string | null;
40
+ line2?: string | null;
41
+ city: string | null;
42
+ postal_code: string | null;
43
+ state: string | null;
44
+ };
45
+
46
+ export type StripeCustomCheckoutShippingAddress = {
47
+ name?: string | null;
48
+ address: StripeCustomCheckoutAddress;
49
+ };
50
+
51
+ export type StripeCustomCheckoutBillingAddress = StripeCustomCheckoutShippingAddress;
52
+
53
+ export interface StripeCustomCheckoutActions {
54
+ applyPromotionCode: (promotionCode: string) => Promise<void>;
55
+ removePromotionCode: () => Promise<void>;
56
+ updateShippingAddress: (
57
+ shippingAddress: StripeCustomCheckoutShippingAddress
58
+ ) => Promise<void>;
59
+ updateBillingAddress: (
60
+ billingAddress: StripeCustomCheckoutBillingAddress
61
+ ) => Promise<void>;
62
+ updatePhoneNumber: (phoneNumber: string) => void;
63
+ updateEmail: (email: string) => void;
64
+ updateLineItemQuantity: (args: {
65
+ lineItem: string;
66
+ quantity: number;
67
+ }) => Promise<void>;
68
+ updateShippingOption: (shippingOption: string) => Promise<void>;
69
+ confirm: (args?: {return_url?: string}) => Promise<void>;
70
+ }
71
+
72
+ /**
73
+ * StripeCustomCheckoutSession
74
+ */
75
+
76
+ export type StripeCustomCheckoutTaxAmount = {
77
+ amount: number;
78
+ inclusive: boolean;
79
+ displayName: string;
80
+ };
81
+
82
+ export type StripeCustomCheckoutDiscountAmount = {
83
+ amount: number;
84
+ displayName: string;
85
+ promotionCode?: string | null;
86
+ };
87
+
88
+ export type StripeCustomCheckoutShipping = {
89
+ shippingOption: StripeCustomCheckoutShippingOption;
90
+ taxAmounts?: Array<StripeCustomCheckoutTaxAmount> | null;
91
+ };
92
+
93
+ export type StripeCustomCheckoutShippingOption = {
94
+ id: string;
95
+ amount: number;
96
+ currency: string;
97
+ displayName?: string | null;
98
+ deliveryEstimate?: StripeCustomCheckoutDeliveryEstimate | null;
99
+ };
100
+
101
+ export type StripeCustomCheckoutDeliveryEstimate = {
102
+ maximum?: StripeCustomCheckoutEstimate | null;
103
+ minimum?: StripeCustomCheckoutEstimate | null;
104
+ };
105
+
106
+ export type StripeCustomCheckoutEstimate = {
107
+ unit: 'business_day' | 'day' | 'hour' | 'week' | 'month';
108
+ value: number;
109
+ };
110
+
111
+ export type StripeCustomCheckoutLineItemDiscountAmount = {
112
+ amount: number;
113
+ promotionCode?: string | null;
114
+ };
115
+
116
+ export type StripeCustomCheckoutBillingInterval =
117
+ | 'day'
118
+ | 'month'
119
+ | 'week'
120
+ | 'year';
121
+
122
+ export type StripeCustomCheckoutLineItem = {
123
+ id: string;
124
+ name: string;
125
+ amount: number;
126
+ unitAmount: number;
127
+ description?: string | null;
128
+ quantity: number;
129
+ discountAmounts?: Array<StripeCustomCheckoutLineItemDiscountAmount> | null;
130
+ recurring?: {
131
+ interval: StripeCustomCheckoutBillingInterval;
132
+ interval_count: number;
133
+ };
134
+ };
135
+
136
+ export type StripeCustomCheckoutTotalSummary = {
137
+ subtotal: number;
138
+ taxExclusive: number;
139
+ taxInclusive: number;
140
+ shippingRate: number;
141
+ discount: number;
142
+ total: number;
143
+ };
144
+
145
+ export type StripeCustomCheckoutConfirmationRequirement =
146
+ | 'phoneNumber'
147
+ | 'shippingAddress'
148
+ | 'billingAddress'
149
+ | 'paymentDetails'
150
+ | 'email';
151
+
152
+ export interface StripeCustomCheckoutSession {
153
+ lineItems: Array<StripeCustomCheckoutLineItem>;
154
+ taxAmounts?: Array<StripeCustomCheckoutTaxAmount> | null;
155
+ discountAmounts?: Array<StripeCustomCheckoutDiscountAmount> | null;
156
+ currency: string;
157
+ shipping?: StripeCustomCheckoutShipping | null;
158
+ shippingOptions: Array<StripeCustomCheckoutShippingOption>;
159
+ shippingAddress?: StripeCustomCheckoutShippingAddress | null;
160
+ billingAddress?: StripeCustomCheckoutBillingAddress | null;
161
+ phoneNumber?: string | null;
162
+ email?: string | null;
163
+ total: StripeCustomCheckoutTotalSummary;
164
+ confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[];
165
+ canConfirm: boolean;
166
+ }
167
+
168
+ /**
169
+ * StripeCustomCheckoutElements
170
+ */
171
+ export type StripeCustomCheckoutPaymentElementOptions = {
172
+ layout?: Layout | LayoutObject;
173
+ paymentMethodOrder?: Array<string>;
174
+ readonly?: boolean;
175
+ terms?: TermsOption;
176
+ };
177
+
178
+ export type StripeCustomCheckoutAddressElementOptions = {
179
+ mode: AddressMode;
180
+ contacts?: ContactOption[];
181
+ display?: {
182
+ name?: 'full' | 'split' | 'organization';
183
+ };
184
+ };
185
+
186
+ export interface StripeCustomCheckoutElementsActions {
187
+ changeAppearance: (appearance: Appearance) => void;
188
+ getElement(elementType: 'payment'): StripePaymentElement | null;
189
+ getElement(
190
+ elementType: 'address',
191
+ mode: AddressMode
192
+ ): StripeAddressElement | null;
193
+ createElement(
194
+ elementType: 'payment',
195
+ options?: StripeCustomCheckoutPaymentElementOptions
196
+ ): StripePaymentElement;
197
+ createElement(
198
+ elementType: 'address',
199
+ options: StripeCustomCheckoutAddressElementOptions
200
+ ): StripeAddressElement;
201
+ }
202
+
203
+ /**
204
+ * StripeCustomCheckout
205
+ */
206
+ export type StripeCustomCheckoutUpdateHandler = (
207
+ session: StripeCustomCheckoutSession
208
+ ) => void;
209
+
210
+ export interface StripeCustomCheckout
211
+ extends StripeCustomCheckoutActions,
212
+ StripeCustomCheckoutSession,
213
+ StripeCustomCheckoutElementsActions {
214
+ session: () => StripeCustomCheckoutSession;
215
+ on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;
216
+ }
@@ -378,10 +378,7 @@ export interface StripeElements {
378
378
  /////////////////////////////
379
379
 
380
380
  /**
381
- * Requires beta access:
382
- * Contact [Stripe support](https://support.stripe.com/) for more information.
383
- *
384
- * Creates a `ExpressCheckoutElement`.
381
+ * Creates an `ExpressCheckoutElement`.
385
382
  */
386
383
  create(
387
384
  elementType: 'expressCheckout',
@@ -389,9 +386,6 @@ export interface StripeElements {
389
386
  ): StripeExpressCheckoutElement;
390
387
 
391
388
  /**
392
- * Requires beta access:
393
- * Contact [Stripe support](https://support.stripe.com/) for more information.
394
- *
395
389
  * Looks up a previously created `Element` by its type.
396
390
  */
397
391
  getElement(
@@ -0,0 +1,30 @@
1
+ export interface StripeEmbeddedCheckoutOptions {
2
+ /**
3
+ * The client secret of the [Checkout Session](https://stripe.com/docs/api/checkout/sessions).
4
+ */
5
+ clientSecret: string;
6
+ /**
7
+ * onComplete is called when the Checkout Session completes successfully.
8
+ * You can use it to unmount Embedded Checkout and render a custom success UI.
9
+ */
10
+ onComplete?: () => void;
11
+ }
12
+
13
+ export interface StripeEmbeddedCheckout {
14
+ /**
15
+ * The `embeddedCheckout.mount` method attaches your Embedded Checkout to the DOM.
16
+ * `mount` accepts either a CSS Selector (e.g., `'#checkout'`) or a DOM element.
17
+ */
18
+ mount(location: string | HTMLElement): void;
19
+ /**
20
+ * Unmounts Embedded Checkout from the DOM.
21
+ * Call `embeddedCheckout.mount` to re-attach it to the DOM.
22
+ */
23
+ unmount(): void;
24
+ /**
25
+ * Removes Embedded Checkout from the DOM and destroys it.
26
+ * Once destroyed it not be re-mounted to the DOM.
27
+ * Use this if you want to create a new Embedded Checkout instance.
28
+ */
29
+ destroy(): void;
30
+ }
@@ -1,4 +1,6 @@
1
1
  export * from './checkout';
2
+ export * from './custom-checkout';
3
+ export * from './embedded-checkout';
2
4
  export * from './elements';
3
5
  export * from './elements-group';
4
6
  export * from './ephemeral-keys';
@@ -15,6 +15,14 @@ import {
15
15
  import {CheckoutLocale, RedirectToCheckoutOptions} from './checkout';
16
16
  import {PaymentRequestOptions, PaymentRequest} from './payment-request';
17
17
  import {StripeElement, StripeElementLocale} from './elements-group';
18
+ import {
19
+ StripeCustomCheckoutOptions,
20
+ StripeCustomCheckout,
21
+ } from './custom-checkout';
22
+ import {
23
+ StripeEmbeddedCheckoutOptions,
24
+ StripeEmbeddedCheckout,
25
+ } from './embedded-checkout';
18
26
 
19
27
  export interface Stripe {
20
28
  /////////////////////////////
@@ -1193,6 +1201,22 @@ export interface Stripe {
1193
1201
  createEphemeralKeyNonce(
1194
1202
  options: ephemeralKeys.EphemeralKeyNonceOptions
1195
1203
  ): Promise<EphemeralKeyNonceResult>;
1204
+
1205
+ /**
1206
+ * Requires beta access:
1207
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
1208
+ */
1209
+ initCustomCheckout(
1210
+ options: StripeCustomCheckoutOptions
1211
+ ): Promise<StripeCustomCheckout>;
1212
+
1213
+ /**
1214
+ * Requires beta access:
1215
+ * Contact [Stripe support](https://support.stripe.com/) for more information.
1216
+ */
1217
+ initEmbeddedCheckout(
1218
+ options: StripeEmbeddedCheckoutOptions
1219
+ ): Promise<StripeEmbeddedCheckout>;
1196
1220
  }
1197
1221
 
1198
1222
  export type PaymentIntentResult =