@stripe/connect-js 3.3.7 → 3.3.8

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.
@@ -95,7 +95,20 @@ const hasCustomMethod = tagName => {
95
95
  return tagName in ConnectElementCustomMethodConfig;
96
96
  };
97
97
  const initStripeConnect = (stripePromise, initParams) => {
98
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
98
+ var _a;
99
+ const eagerClientSecretPromise = (() => {
100
+ try {
101
+ return initParams.fetchClientSecret();
102
+ } catch (error) {
103
+ return Promise.reject(error);
104
+ }
105
+ })();
106
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
107
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
108
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
109
+ eagerClientSecretPromise
110
+ })
111
+ })));
99
112
  return {
100
113
  create: tagName => {
101
114
  let htmlName = componentNameMapping[tagName];
@@ -161,7 +174,7 @@ const createWrapper = stripeConnect => {
161
174
  sdk: true,
162
175
  sdkOptions: {
163
176
  // This will be replaced by the npm package version when bundling
164
- sdkVersion: "3.3.7"
177
+ sdkVersion: "3.3.8"
165
178
  }
166
179
  })
167
180
  }));
package/dist/connect.js CHANGED
@@ -99,7 +99,20 @@ const hasCustomMethod = tagName => {
99
99
  return tagName in ConnectElementCustomMethodConfig;
100
100
  };
101
101
  const initStripeConnect = (stripePromise, initParams) => {
102
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
102
+ var _a;
103
+ const eagerClientSecretPromise = (() => {
104
+ try {
105
+ return initParams.fetchClientSecret();
106
+ } catch (error) {
107
+ return Promise.reject(error);
108
+ }
109
+ })();
110
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
111
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
112
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
113
+ eagerClientSecretPromise
114
+ })
115
+ })));
103
116
  return {
104
117
  create: tagName => {
105
118
  let htmlName = componentNameMapping[tagName];
@@ -165,7 +178,7 @@ const createWrapper = stripeConnect => {
165
178
  sdk: true,
166
179
  sdkOptions: {
167
180
  // This will be replaced by the npm package version when bundling
168
- sdkVersion: "3.3.7"
181
+ sdkVersion: "3.3.8"
169
182
  }
170
183
  })
171
184
  }));
package/dist/pure.esm.js CHANGED
@@ -95,7 +95,20 @@ const hasCustomMethod = tagName => {
95
95
  return tagName in ConnectElementCustomMethodConfig;
96
96
  };
97
97
  const initStripeConnect = (stripePromise, initParams) => {
98
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
98
+ var _a;
99
+ const eagerClientSecretPromise = (() => {
100
+ try {
101
+ return initParams.fetchClientSecret();
102
+ } catch (error) {
103
+ return Promise.reject(error);
104
+ }
105
+ })();
106
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
107
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
108
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
109
+ eagerClientSecretPromise
110
+ })
111
+ })));
99
112
  return {
100
113
  create: tagName => {
101
114
  let htmlName = componentNameMapping[tagName];
@@ -161,7 +174,7 @@ const createWrapper = stripeConnect => {
161
174
  sdk: true,
162
175
  sdkOptions: {
163
176
  // This will be replaced by the npm package version when bundling
164
- sdkVersion: "3.3.7"
177
+ sdkVersion: "3.3.8"
165
178
  }
166
179
  })
167
180
  }));
@@ -173,6 +186,9 @@ const createWrapper = stripeConnect => {
173
186
 
174
187
  const loadConnectAndInitialize = initParams => {
175
188
  const maybeConnect = loadScript();
189
+ if (initParams == null) {
190
+ throw new Error("You must provide required parameters to initialize Connect");
191
+ }
176
192
  return initStripeConnect(maybeConnect, initParams);
177
193
  };
178
194
 
package/dist/pure.js CHANGED
@@ -99,7 +99,20 @@ const hasCustomMethod = tagName => {
99
99
  return tagName in ConnectElementCustomMethodConfig;
100
100
  };
101
101
  const initStripeConnect = (stripePromise, initParams) => {
102
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
102
+ var _a;
103
+ const eagerClientSecretPromise = (() => {
104
+ try {
105
+ return initParams.fetchClientSecret();
106
+ } catch (error) {
107
+ return Promise.reject(error);
108
+ }
109
+ })();
110
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
111
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
112
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
113
+ eagerClientSecretPromise
114
+ })
115
+ })));
103
116
  return {
104
117
  create: tagName => {
105
118
  let htmlName = componentNameMapping[tagName];
@@ -165,7 +178,7 @@ const createWrapper = stripeConnect => {
165
178
  sdk: true,
166
179
  sdkOptions: {
167
180
  // This will be replaced by the npm package version when bundling
168
- sdkVersion: "3.3.7"
181
+ sdkVersion: "3.3.8"
169
182
  }
170
183
  })
171
184
  }));
@@ -177,6 +190,9 @@ const createWrapper = stripeConnect => {
177
190
 
178
191
  const loadConnectAndInitialize = initParams => {
179
192
  const maybeConnect = loadScript();
193
+ if (initParams == null) {
194
+ throw new Error("You must provide required parameters to initialize Connect");
195
+ }
180
196
  return initStripeConnect(maybeConnect, initParams);
181
197
  };
182
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.7",
3
+ "version": "3.3.8",
4
4
  "description": "Connect.js loading utility package",
5
5
  "main": "dist/connect.js",
6
6
  "module": "dist/connect.esm.js",
package/src/pure.ts CHANGED
@@ -9,5 +9,10 @@ export const loadConnectAndInitialize: LoadConnectAndInitialize = (
9
9
  initParams: IStripeConnectInitParams
10
10
  ): StripeConnectInstance => {
11
11
  const maybeConnect = loadScript();
12
+ if (initParams == null) {
13
+ throw new Error(
14
+ "You must provide required parameters to initialize Connect"
15
+ );
16
+ }
12
17
  return initStripeConnect(maybeConnect, initParams);
13
18
  };
package/src/shared.ts CHANGED
@@ -138,8 +138,19 @@ export const initStripeConnect = (
138
138
  stripePromise: Promise<StripeConnectWrapper>,
139
139
  initParams: IStripeConnectInitParams
140
140
  ): StripeConnectInstanceExtended => {
141
+ const eagerClientSecretPromise = (() => {
142
+ try {
143
+ return initParams.fetchClientSecret();
144
+ } catch (error) {
145
+ return Promise.reject(error);
146
+ }
147
+ })();
148
+ const metaOptions = (initParams as any).metaOptions ?? {};
141
149
  const stripeConnectInstance = stripePromise.then(wrapper =>
142
- wrapper.initialize(initParams)
150
+ wrapper.initialize({
151
+ ...initParams,
152
+ metaOptions: { ...metaOptions, eagerClientSecretPromise }
153
+ } as any)
143
154
  );
144
155
 
145
156
  return {