@stripe/connect-js 3.3.9-beta-1 → 3.3.10-beta-1

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.
@@ -122,7 +122,20 @@ const hasCustomMethod = tagName => {
122
122
  return tagName in ConnectElementCustomMethodConfig;
123
123
  };
124
124
  const initStripeConnect = (stripePromise, initParams) => {
125
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
125
+ var _a;
126
+ const eagerClientSecretPromise = (() => {
127
+ try {
128
+ return initParams.fetchClientSecret();
129
+ } catch (error) {
130
+ return Promise.reject(error);
131
+ }
132
+ })();
133
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
134
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
135
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
136
+ eagerClientSecretPromise
137
+ })
138
+ })));
126
139
  return {
127
140
  create: tagName => {
128
141
  let htmlName = componentNameMapping[tagName];
@@ -188,7 +201,7 @@ const createWrapper = stripeConnect => {
188
201
  sdk: true,
189
202
  sdkOptions: {
190
203
  // This will be replaced by the npm package version when bundling
191
- sdkVersion: "3.3.7-beta-1"
204
+ sdkVersion: "3.3.10-beta-1"
192
205
  }
193
206
  })
194
207
  }));
package/dist/connect.js CHANGED
@@ -126,7 +126,20 @@ const hasCustomMethod = tagName => {
126
126
  return tagName in ConnectElementCustomMethodConfig;
127
127
  };
128
128
  const initStripeConnect = (stripePromise, initParams) => {
129
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
129
+ var _a;
130
+ const eagerClientSecretPromise = (() => {
131
+ try {
132
+ return initParams.fetchClientSecret();
133
+ } catch (error) {
134
+ return Promise.reject(error);
135
+ }
136
+ })();
137
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
138
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
139
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
140
+ eagerClientSecretPromise
141
+ })
142
+ })));
130
143
  return {
131
144
  create: tagName => {
132
145
  let htmlName = componentNameMapping[tagName];
@@ -192,7 +205,7 @@ const createWrapper = stripeConnect => {
192
205
  sdk: true,
193
206
  sdkOptions: {
194
207
  // This will be replaced by the npm package version when bundling
195
- sdkVersion: "3.3.7-beta-1"
208
+ sdkVersion: "3.3.10-beta-1"
196
209
  }
197
210
  })
198
211
  }));
package/dist/pure.esm.js CHANGED
@@ -122,7 +122,20 @@ const hasCustomMethod = tagName => {
122
122
  return tagName in ConnectElementCustomMethodConfig;
123
123
  };
124
124
  const initStripeConnect = (stripePromise, initParams) => {
125
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
125
+ var _a;
126
+ const eagerClientSecretPromise = (() => {
127
+ try {
128
+ return initParams.fetchClientSecret();
129
+ } catch (error) {
130
+ return Promise.reject(error);
131
+ }
132
+ })();
133
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
134
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
135
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
136
+ eagerClientSecretPromise
137
+ })
138
+ })));
126
139
  return {
127
140
  create: tagName => {
128
141
  let htmlName = componentNameMapping[tagName];
@@ -188,7 +201,7 @@ const createWrapper = stripeConnect => {
188
201
  sdk: true,
189
202
  sdkOptions: {
190
203
  // This will be replaced by the npm package version when bundling
191
- sdkVersion: "3.3.7-beta-1"
204
+ sdkVersion: "3.3.10-beta-1"
192
205
  }
193
206
  })
194
207
  }));
@@ -200,6 +213,9 @@ const createWrapper = stripeConnect => {
200
213
 
201
214
  const loadConnectAndInitialize = initParams => {
202
215
  const maybeConnect = loadScript();
216
+ if (initParams == null) {
217
+ throw new Error("You must provide required parameters to initialize Connect");
218
+ }
203
219
  return initStripeConnect(maybeConnect, initParams);
204
220
  };
205
221
 
package/dist/pure.js CHANGED
@@ -126,7 +126,20 @@ const hasCustomMethod = tagName => {
126
126
  return tagName in ConnectElementCustomMethodConfig;
127
127
  };
128
128
  const initStripeConnect = (stripePromise, initParams) => {
129
- const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(initParams));
129
+ var _a;
130
+ const eagerClientSecretPromise = (() => {
131
+ try {
132
+ return initParams.fetchClientSecret();
133
+ } catch (error) {
134
+ return Promise.reject(error);
135
+ }
136
+ })();
137
+ const metaOptions = (_a = initParams.metaOptions) !== null && _a !== void 0 ? _a : {};
138
+ const stripeConnectInstance = stripePromise.then(wrapper => wrapper.initialize(Object.assign(Object.assign({}, initParams), {
139
+ metaOptions: Object.assign(Object.assign({}, metaOptions), {
140
+ eagerClientSecretPromise
141
+ })
142
+ })));
130
143
  return {
131
144
  create: tagName => {
132
145
  let htmlName = componentNameMapping[tagName];
@@ -192,7 +205,7 @@ const createWrapper = stripeConnect => {
192
205
  sdk: true,
193
206
  sdkOptions: {
194
207
  // This will be replaced by the npm package version when bundling
195
- sdkVersion: "3.3.7-beta-1"
208
+ sdkVersion: "3.3.10-beta-1"
196
209
  }
197
210
  })
198
211
  }));
@@ -204,6 +217,9 @@ const createWrapper = stripeConnect => {
204
217
 
205
218
  const loadConnectAndInitialize = initParams => {
206
219
  const maybeConnect = loadScript();
220
+ if (initParams == null) {
221
+ throw new Error("You must provide required parameters to initialize Connect");
222
+ }
207
223
  return initStripeConnect(maybeConnect, initParams);
208
224
  };
209
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.9-beta-1",
3
+ "version": "3.3.10-beta-1",
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
@@ -161,8 +161,19 @@ export const initStripeConnect = (
161
161
  stripePromise: Promise<StripeConnectWrapper>,
162
162
  initParams: IStripeConnectInitParams
163
163
  ): StripeConnectInstanceExtended => {
164
+ const eagerClientSecretPromise = (() => {
165
+ try {
166
+ return initParams.fetchClientSecret();
167
+ } catch (error) {
168
+ return Promise.reject(error);
169
+ }
170
+ })();
171
+ const metaOptions = (initParams as any).metaOptions ?? {};
164
172
  const stripeConnectInstance = stripePromise.then(wrapper =>
165
- wrapper.initialize(initParams)
173
+ wrapper.initialize({
174
+ ...initParams,
175
+ metaOptions: { ...metaOptions, eagerClientSecretPromise }
176
+ } as any)
166
177
  );
167
178
 
168
179
  return {