@stripe/connect-js 1.0.8 → 1.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.
@@ -1,29 +1,11 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */
15
-
16
- function __awaiter(thisArg, _arguments, P, generator) {
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- }
24
-
25
- var version = "1.0.8";
1
+ var version = "1.0.10";
26
2
 
3
+ const componentNameMapping = {
4
+ payments: "stripe-connect-payments",
5
+ payouts: "stripe-connect-payouts",
6
+ "payment-details": "stripe-connect-payment-details",
7
+ "account-onboarding": "stripe-connect-account-onboarding"
8
+ };
27
9
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
28
10
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
29
11
  const findScript = () => {
@@ -89,7 +71,7 @@ const createWrapper = stripeConnect => {
89
71
  initialize: params => {
90
72
  var _a;
91
73
  const metaOptions = (_a = params.metaOptions) !== null && _a !== void 0 ? _a : {};
92
- return stripeConnect.init(Object.assign(Object.assign({}, params), {
74
+ const stripeConnectInstance = stripeConnect.init(Object.assign(Object.assign({}, params), {
93
75
  metaOptions: Object.assign(Object.assign({}, metaOptions), {
94
76
  sdk: true,
95
77
  sdkOptions: {
@@ -97,10 +79,17 @@ const createWrapper = stripeConnect => {
97
79
  }
98
80
  })
99
81
  }));
100
- },
101
- logout: () => __awaiter(void 0, void 0, void 0, function* () {
102
- yield stripeConnect.logout();
103
- })
82
+ // We wrap create so we can map its different strings to supported components
83
+ const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
84
+ stripeConnectInstance.create = tagName => {
85
+ let htmlName = componentNameMapping[tagName];
86
+ if (!htmlName) {
87
+ htmlName = tagName;
88
+ }
89
+ return oldCreate(htmlName);
90
+ };
91
+ return stripeConnectInstance;
92
+ }
104
93
  };
105
94
  return wrapper;
106
95
  };
package/dist/connect.js CHANGED
@@ -2,32 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /*! *****************************************************************************
6
- Copyright (c) Microsoft Corporation. All rights reserved.
7
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
8
- this file except in compliance with the License. You may obtain a copy of the
9
- License at http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
13
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
14
- MERCHANTABLITY OR NON-INFRINGEMENT.
15
-
16
- See the Apache Version 2.0 License for specific language governing permissions
17
- and limitations under the License.
18
- ***************************************************************************** */
19
-
20
- function __awaiter(thisArg, _arguments, P, generator) {
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- }
28
-
29
- var version = "1.0.8";
5
+ var version = "1.0.10";
30
6
 
7
+ const componentNameMapping = {
8
+ payments: "stripe-connect-payments",
9
+ payouts: "stripe-connect-payouts",
10
+ "payment-details": "stripe-connect-payment-details",
11
+ "account-onboarding": "stripe-connect-account-onboarding"
12
+ };
31
13
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
32
14
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
33
15
  const findScript = () => {
@@ -93,7 +75,7 @@ const createWrapper = stripeConnect => {
93
75
  initialize: params => {
94
76
  var _a;
95
77
  const metaOptions = (_a = params.metaOptions) !== null && _a !== void 0 ? _a : {};
96
- return stripeConnect.init(Object.assign(Object.assign({}, params), {
78
+ const stripeConnectInstance = stripeConnect.init(Object.assign(Object.assign({}, params), {
97
79
  metaOptions: Object.assign(Object.assign({}, metaOptions), {
98
80
  sdk: true,
99
81
  sdkOptions: {
@@ -101,10 +83,17 @@ const createWrapper = stripeConnect => {
101
83
  }
102
84
  })
103
85
  }));
104
- },
105
- logout: () => __awaiter(void 0, void 0, void 0, function* () {
106
- yield stripeConnect.logout();
107
- })
86
+ // We wrap create so we can map its different strings to supported components
87
+ const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
88
+ stripeConnectInstance.create = tagName => {
89
+ let htmlName = componentNameMapping[tagName];
90
+ if (!htmlName) {
91
+ htmlName = tagName;
92
+ }
93
+ return oldCreate(htmlName);
94
+ };
95
+ return stripeConnectInstance;
96
+ }
108
97
  };
109
98
  return wrapper;
110
99
  };
package/dist/pure.esm.js CHANGED
@@ -1,29 +1,11 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */
15
-
16
- function __awaiter(thisArg, _arguments, P, generator) {
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- }
24
-
25
- var version = "1.0.8";
1
+ var version = "1.0.10";
26
2
 
3
+ const componentNameMapping = {
4
+ payments: "stripe-connect-payments",
5
+ payouts: "stripe-connect-payouts",
6
+ "payment-details": "stripe-connect-payment-details",
7
+ "account-onboarding": "stripe-connect-account-onboarding"
8
+ };
27
9
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
28
10
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
29
11
  const findScript = () => {
@@ -89,7 +71,7 @@ const createWrapper = stripeConnect => {
89
71
  initialize: params => {
90
72
  var _a;
91
73
  const metaOptions = (_a = params.metaOptions) !== null && _a !== void 0 ? _a : {};
92
- return stripeConnect.init(Object.assign(Object.assign({}, params), {
74
+ const stripeConnectInstance = stripeConnect.init(Object.assign(Object.assign({}, params), {
93
75
  metaOptions: Object.assign(Object.assign({}, metaOptions), {
94
76
  sdk: true,
95
77
  sdkOptions: {
@@ -97,10 +79,17 @@ const createWrapper = stripeConnect => {
97
79
  }
98
80
  })
99
81
  }));
100
- },
101
- logout: () => __awaiter(void 0, void 0, void 0, function* () {
102
- yield stripeConnect.logout();
103
- })
82
+ // We wrap create so we can map its different strings to supported components
83
+ const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
84
+ stripeConnectInstance.create = tagName => {
85
+ let htmlName = componentNameMapping[tagName];
86
+ if (!htmlName) {
87
+ htmlName = tagName;
88
+ }
89
+ return oldCreate(htmlName);
90
+ };
91
+ return stripeConnectInstance;
92
+ }
104
93
  };
105
94
  return wrapper;
106
95
  };
package/dist/pure.js CHANGED
@@ -2,32 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /*! *****************************************************************************
6
- Copyright (c) Microsoft Corporation. All rights reserved.
7
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
8
- this file except in compliance with the License. You may obtain a copy of the
9
- License at http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
13
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
14
- MERCHANTABLITY OR NON-INFRINGEMENT.
15
-
16
- See the Apache Version 2.0 License for specific language governing permissions
17
- and limitations under the License.
18
- ***************************************************************************** */
19
-
20
- function __awaiter(thisArg, _arguments, P, generator) {
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- }
28
-
29
- var version = "1.0.8";
5
+ var version = "1.0.10";
30
6
 
7
+ const componentNameMapping = {
8
+ payments: "stripe-connect-payments",
9
+ payouts: "stripe-connect-payouts",
10
+ "payment-details": "stripe-connect-payment-details",
11
+ "account-onboarding": "stripe-connect-account-onboarding"
12
+ };
31
13
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
32
14
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
33
15
  const findScript = () => {
@@ -93,7 +75,7 @@ const createWrapper = stripeConnect => {
93
75
  initialize: params => {
94
76
  var _a;
95
77
  const metaOptions = (_a = params.metaOptions) !== null && _a !== void 0 ? _a : {};
96
- return stripeConnect.init(Object.assign(Object.assign({}, params), {
78
+ const stripeConnectInstance = stripeConnect.init(Object.assign(Object.assign({}, params), {
97
79
  metaOptions: Object.assign(Object.assign({}, metaOptions), {
98
80
  sdk: true,
99
81
  sdkOptions: {
@@ -101,10 +83,17 @@ const createWrapper = stripeConnect => {
101
83
  }
102
84
  })
103
85
  }));
104
- },
105
- logout: () => __awaiter(void 0, void 0, void 0, function* () {
106
- yield stripeConnect.logout();
107
- })
86
+ // We wrap create so we can map its different strings to supported components
87
+ const oldCreate = stripeConnectInstance.create.bind(stripeConnectInstance);
88
+ stripeConnectInstance.create = tagName => {
89
+ let htmlName = componentNameMapping[tagName];
90
+ if (!htmlName) {
91
+ htmlName = tagName;
92
+ }
93
+ return oldCreate(htmlName);
94
+ };
95
+ return stripeConnectInstance;
96
+ }
108
97
  };
109
98
  return wrapper;
110
99
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Connect.js loading utility package",
5
5
  "main": "dist/connect.js",
6
6
  "module": "dist/connect.esm.js",
package/src/shared.ts CHANGED
@@ -1,8 +1,28 @@
1
1
  import { version } from ".././package.json";
2
- import { StripeConnectWrapper, IStripeConnectInitParams } from "../types";
2
+ import {
3
+ StripeConnectWrapper,
4
+ IStripeConnectInitParams,
5
+ ConnectElementTagName
6
+ } from "../types";
3
7
 
4
8
  export type LoadConnect = () => Promise<StripeConnectWrapper>;
5
9
 
10
+ type ConnectElementHTMLName =
11
+ | "stripe-connect-payments"
12
+ | "stripe-connect-payouts"
13
+ | "stripe-connect-payment-details"
14
+ | "stripe-connect-account-onboarding";
15
+
16
+ const componentNameMapping: Record<
17
+ ConnectElementTagName,
18
+ ConnectElementHTMLName
19
+ > = {
20
+ payments: "stripe-connect-payments",
21
+ payouts: "stripe-connect-payouts",
22
+ "payment-details": "stripe-connect-payment-details",
23
+ "account-onboarding": "stripe-connect-account-onboarding"
24
+ };
25
+
6
26
  const EXISTING_SCRIPT_MESSAGE =
7
27
  "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
8
28
  const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
@@ -92,7 +112,7 @@ const createWrapper = (stripeConnect: any) => {
92
112
  const wrapper: StripeConnectWrapper = {
93
113
  initialize: (params: IStripeConnectInitParams) => {
94
114
  const metaOptions = (params as any).metaOptions ?? {};
95
- return stripeConnect.init({
115
+ const stripeConnectInstance = stripeConnect.init({
96
116
  ...params,
97
117
  metaOptions: {
98
118
  ...metaOptions,
@@ -102,9 +122,19 @@ const createWrapper = (stripeConnect: any) => {
102
122
  }
103
123
  }
104
124
  });
105
- },
106
- logout: async () => {
107
- await stripeConnect.logout();
125
+
126
+ // We wrap create so we can map its different strings to supported components
127
+ const oldCreate = stripeConnectInstance.create.bind(
128
+ stripeConnectInstance
129
+ );
130
+ stripeConnectInstance.create = (tagName: ConnectElementTagName) => {
131
+ let htmlName = componentNameMapping[tagName];
132
+ if (!htmlName) {
133
+ htmlName = tagName as ConnectElementHTMLName;
134
+ }
135
+ return oldCreate(htmlName);
136
+ };
137
+ return stripeConnectInstance;
108
138
  }
109
139
  };
110
140
  return wrapper;
package/types/shared.d.ts CHANGED
@@ -10,28 +10,28 @@ export declare type UIConfigOptions = {
10
10
  export declare type AppearanceOptions = {
11
11
  colorPrimary?: string;
12
12
  // Primary Button
13
- colorPrimaryButtonBorder?: string;
14
- colorPrimaryButtonBackground?: string;
15
- colorPrimaryButtonText?: string;
13
+ buttonPrimaryColorBorder?: string;
14
+ buttonPrimaryColorBackground?: string;
15
+ buttonPrimaryColorText?: string;
16
16
  // Secondary Button
17
- colorSecondaryButtonBorder?: string;
18
- colorSecondaryButtonBackground?: string;
19
- colorSecondaryButtonText?: string;
17
+ buttonSecondaryColorBorder?: string;
18
+ buttonSecondaryColorBackground?: string;
19
+ buttonSecondaryColorText?: string;
20
20
  // Link
21
- colorPrimaryLinkText?: string;
22
- colorSecondaryLinkText?: string;
21
+ actionPrimaryColorText?: string;
22
+ actionSecondaryColorText?: string;
23
23
  // Border
24
24
  colorBorder?: string;
25
25
  // Form
26
- colorFormHighlightBorder?: string;
27
- colorFormAccent?: string;
26
+ formHighlightColorBorder?: string;
27
+ formAccentColor?: string;
28
28
  // Text
29
29
  colorText?: string;
30
30
  colorSecondaryText?: string;
31
31
  // Background
32
32
  colorBackground?: string;
33
- colorOffsetBackground?: string;
34
- colorFormBackground?: string;
33
+ offsetBackgroundColor?: string;
34
+ formBackgroundColor?: string;
35
35
 
36
36
  // Feedback Colors
37
37
  colorDanger?: string;
@@ -58,48 +58,52 @@ export declare type AppearanceOptions = {
58
58
 
59
59
  // Border Sizing
60
60
  borderRadius?: string;
61
- borderRadiusButton?: string;
62
- borderRadiusForm?: string;
63
- borderRadiusBadge?: string;
61
+ buttonBorderRadius?: string;
62
+ formBorderRadius?: string;
63
+ badgeBorderRadius?: string;
64
+ overlayBorderRadius?: string;
65
+
66
+ // Font Sizing
67
+ fontSizeBase?: string;
68
+
69
+ // Spacing
70
+ spacingUnit?: string;
64
71
 
65
72
  // Body Typography
66
- bodyLargeFontSize?: string;
67
- bodyLargeFontWeight?: string;
68
- bodyMediumFontSize?: string;
69
- bodyMediumFontWeight?: string;
70
- bodySmallFontSize?: string;
71
- bodySmallFontWeight?: string;
73
+ bodyLgFontSize?: string;
74
+ bodyLgFontWeight?: string;
75
+ bodyMdFontSize?: string;
76
+ bodyMdFontWeight?: string;
77
+ bodySmFontSize?: string;
78
+ bodySmFontWeight?: string;
72
79
 
73
80
  // Label Typography
74
- labelLargeFontSize?: string;
75
- labelLargeFontWeight?: string;
76
- labelLargeTextTransform?: string;
77
- labelMediumFontSize?: string;
78
- labelMediumFontWeight?: string;
79
- labelMediumTextTransform?: string;
80
- labelSmallFontSize?: string;
81
- labelSmallFontWeight?: string;
82
- labelSmallTextTransform?: string;
81
+ labelLgFontSize?: string;
82
+ labelLgFontWeight?: string;
83
+ labelLgTextTransform?: string;
84
+ labelMdFontSize?: string;
85
+ labelMdFontWeight?: string;
86
+ labelMdTextTransform?: string;
87
+ labelSmFontSize?: string;
88
+ labelSmFontWeight?: string;
89
+ labelSmTextTransform?: string;
83
90
 
84
91
  // Heading Typography
85
- headingXLargeFontSize?: string;
86
- headingXLargeFontWeight?: string;
87
- headingXLargeTextTransform?: string;
88
- headingLargeFontSize?: string;
89
- headingLargeFontWeight?: string;
90
- headingLargeTextTransform?: string;
91
- headingMediumFontSize?: string;
92
- headingMediumFontWeight?: string;
93
- headingMediumTextTransform?: string;
94
- headingSmallFontSize?: string;
95
- headingSmallFontWeight?: string;
96
- headingSmallTextTransform?: string;
97
- headingXSmallFontSize?: string;
98
- headingXSmallFontWeight?: string;
99
- headingXSmallTextTransform?: string;
100
-
101
- // Spacing
102
- spacingScale?: string;
92
+ headingXlFontSize?: string;
93
+ headingXlFontWeight?: string;
94
+ headingXlTextTransform?: string;
95
+ headingLgFontSize?: string;
96
+ headingLgFontWeight?: string;
97
+ headingLgTextTransform?: string;
98
+ headingMdFontSize?: string;
99
+ headingMdFontWeight?: string;
100
+ headingMdTextTransform?: string;
101
+ headingSmFontSize?: string;
102
+ headingSmFontWeight?: string;
103
+ headingSmTextTransform?: string;
104
+ headingXsFontSize?: string;
105
+ headingXsFontWeight?: string;
106
+ headingXsTextTransform?: string;
103
107
  };
104
108
 
105
109
  export type IStripeConnectUpdateParams = {
@@ -122,12 +126,6 @@ export interface StripeConnectWrapper {
122
126
  * @returns A Connect JS instance.
123
127
  */
124
128
  initialize: (params: IStripeConnectInitParams) => StripeConnectInstance;
125
-
126
- /**
127
- * Logs the user out of Connect JS sessions
128
- * @returns A promise that resolves when the user is logged out.
129
- */
130
- logout: () => Promise<void>;
131
129
  }
132
130
 
133
131
  export interface StripeConnectInstance {
@@ -143,14 +141,19 @@ export interface StripeConnectInstance {
143
141
  * @options New parameters to update the Connect instance with.
144
142
  */
145
143
  update: (options: IStripeConnectUpdateParams) => void;
146
- }
147
144
 
148
- export type ConnectElementHTMLName =
149
- | "stripe-connect-payments"
150
- | "stripe-connect-payouts"
151
- | "stripe-connect-payment-details";
145
+ /**
146
+ * Logs the user out of Connect JS sessions
147
+ * @returns A promise that resolves when the user is logged out.
148
+ */
149
+ logout: () => Promise<void>;
150
+ }
152
151
 
153
- export type ConnectElementTagName = "payments" | "payouts" | "payment-details";
152
+ export type ConnectElementTagName =
153
+ | "payments"
154
+ | "payouts"
155
+ | "payment-details"
156
+ | "account-onboarding";
154
157
 
155
158
  export declare const findScript: () => HTMLScriptElement | null;
156
159