@stripe/connect-js 3.3.13-beta-1 → 3.3.14-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.
- package/dist/connect.esm.js +13 -10
- package/dist/connect.js +13 -10
- package/dist/pure.esm.js +13 -10
- package/dist/pure.js +13 -10
- package/dist/types/config.d.ts +40 -0
- package/package.json +1 -1
- package/src/shared.ts +14 -10
- package/types/config.ts +49 -0
- package/types/shared.d.ts +8 -4
package/dist/connect.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
const ConnectElementCommonMethodConfig = {
|
|
4
|
+
setOnLoadError: _listener => {},
|
|
5
|
+
setOnLoaderStart: _listener => {}
|
|
6
|
+
};
|
|
3
7
|
const ConnectElementCustomMethodConfig = {
|
|
4
8
|
"payment-details": {
|
|
5
9
|
setPayment: _payment => {},
|
|
@@ -153,15 +157,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
153
157
|
htmlName = tagName;
|
|
154
158
|
}
|
|
155
159
|
const element = document.createElement(htmlName);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
160
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
161
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
162
|
+
for (const method in methods) {
|
|
163
|
+
element[method] = function (value) {
|
|
164
|
+
stripeConnectInstance.then(() => {
|
|
165
|
+
this[`${method}InternalOnly`](value);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
165
168
|
}
|
|
166
169
|
stripeConnectInstance.then(instance => {
|
|
167
170
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -211,7 +214,7 @@ const createWrapper = stripeConnect => {
|
|
|
211
214
|
sdk: true,
|
|
212
215
|
sdkOptions: {
|
|
213
216
|
// This will be replaced by the npm package version when bundling
|
|
214
|
-
sdkVersion: "3.3.
|
|
217
|
+
sdkVersion: "3.3.14-beta-1"
|
|
215
218
|
}
|
|
216
219
|
})
|
|
217
220
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
|
+
const ConnectElementCommonMethodConfig = {
|
|
8
|
+
setOnLoadError: _listener => {},
|
|
9
|
+
setOnLoaderStart: _listener => {}
|
|
10
|
+
};
|
|
7
11
|
const ConnectElementCustomMethodConfig = {
|
|
8
12
|
"payment-details": {
|
|
9
13
|
setPayment: _payment => {},
|
|
@@ -157,15 +161,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
157
161
|
htmlName = tagName;
|
|
158
162
|
}
|
|
159
163
|
const element = document.createElement(htmlName);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
164
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
165
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
166
|
+
for (const method in methods) {
|
|
167
|
+
element[method] = function (value) {
|
|
168
|
+
stripeConnectInstance.then(() => {
|
|
169
|
+
this[`${method}InternalOnly`](value);
|
|
170
|
+
});
|
|
171
|
+
};
|
|
169
172
|
}
|
|
170
173
|
stripeConnectInstance.then(instance => {
|
|
171
174
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -215,7 +218,7 @@ const createWrapper = stripeConnect => {
|
|
|
215
218
|
sdk: true,
|
|
216
219
|
sdkOptions: {
|
|
217
220
|
// This will be replaced by the npm package version when bundling
|
|
218
|
-
sdkVersion: "3.3.
|
|
221
|
+
sdkVersion: "3.3.14-beta-1"
|
|
219
222
|
}
|
|
220
223
|
})
|
|
221
224
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
const ConnectElementCommonMethodConfig = {
|
|
4
|
+
setOnLoadError: _listener => {},
|
|
5
|
+
setOnLoaderStart: _listener => {}
|
|
6
|
+
};
|
|
3
7
|
const ConnectElementCustomMethodConfig = {
|
|
4
8
|
"payment-details": {
|
|
5
9
|
setPayment: _payment => {},
|
|
@@ -153,15 +157,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
153
157
|
htmlName = tagName;
|
|
154
158
|
}
|
|
155
159
|
const element = document.createElement(htmlName);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
160
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
161
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
162
|
+
for (const method in methods) {
|
|
163
|
+
element[method] = function (value) {
|
|
164
|
+
stripeConnectInstance.then(() => {
|
|
165
|
+
this[`${method}InternalOnly`](value);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
165
168
|
}
|
|
166
169
|
stripeConnectInstance.then(instance => {
|
|
167
170
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -211,7 +214,7 @@ const createWrapper = stripeConnect => {
|
|
|
211
214
|
sdk: true,
|
|
212
215
|
sdkOptions: {
|
|
213
216
|
// This will be replaced by the npm package version when bundling
|
|
214
|
-
sdkVersion: "3.3.
|
|
217
|
+
sdkVersion: "3.3.14-beta-1"
|
|
215
218
|
}
|
|
216
219
|
})
|
|
217
220
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
|
+
const ConnectElementCommonMethodConfig = {
|
|
8
|
+
setOnLoadError: _listener => {},
|
|
9
|
+
setOnLoaderStart: _listener => {}
|
|
10
|
+
};
|
|
7
11
|
const ConnectElementCustomMethodConfig = {
|
|
8
12
|
"payment-details": {
|
|
9
13
|
setPayment: _payment => {},
|
|
@@ -157,15 +161,14 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
157
161
|
htmlName = tagName;
|
|
158
162
|
}
|
|
159
163
|
const element = document.createElement(htmlName);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
164
|
+
const customMethods = hasCustomMethod(tagName) ? ConnectElementCustomMethodConfig[tagName] : {};
|
|
165
|
+
const methods = Object.assign(Object.assign({}, customMethods), ConnectElementCommonMethodConfig);
|
|
166
|
+
for (const method in methods) {
|
|
167
|
+
element[method] = function (value) {
|
|
168
|
+
stripeConnectInstance.then(() => {
|
|
169
|
+
this[`${method}InternalOnly`](value);
|
|
170
|
+
});
|
|
171
|
+
};
|
|
169
172
|
}
|
|
170
173
|
stripeConnectInstance.then(instance => {
|
|
171
174
|
if (!element.isConnected && !element.setConnector) {
|
|
@@ -215,7 +218,7 @@ const createWrapper = stripeConnect => {
|
|
|
215
218
|
sdk: true,
|
|
216
219
|
sdkOptions: {
|
|
217
220
|
// This will be replaced by the npm package version when bundling
|
|
218
|
-
sdkVersion: "3.3.
|
|
221
|
+
sdkVersion: "3.3.14-beta-1"
|
|
219
222
|
}
|
|
220
223
|
})
|
|
221
224
|
}));
|
package/dist/types/config.d.ts
CHANGED
|
@@ -18,6 +18,46 @@ export type InstallState = {
|
|
|
18
18
|
appId: string;
|
|
19
19
|
state: "INSTALLED" | "UNINSTALLED";
|
|
20
20
|
};
|
|
21
|
+
export type LoaderStart = {
|
|
22
|
+
elementTagName: string;
|
|
23
|
+
};
|
|
24
|
+
export type LoadError = {
|
|
25
|
+
elementTagName: string;
|
|
26
|
+
error: EmbeddedError;
|
|
27
|
+
};
|
|
28
|
+
export type EmbeddedError = {
|
|
29
|
+
type: EmbeddedErrorType;
|
|
30
|
+
message?: string;
|
|
31
|
+
};
|
|
32
|
+
export type EmbeddedErrorType =
|
|
33
|
+
/**
|
|
34
|
+
* Failure to connect to Stripe's API.
|
|
35
|
+
*/
|
|
36
|
+
"api_connection_error"
|
|
37
|
+
/**
|
|
38
|
+
* Failure to perform the authentication flow within Connect Embedded Components
|
|
39
|
+
*/
|
|
40
|
+
| "authentication_error"
|
|
41
|
+
/**
|
|
42
|
+
* Account session create failed
|
|
43
|
+
*/
|
|
44
|
+
| "account_session_create_error"
|
|
45
|
+
/**
|
|
46
|
+
* Request failed with an 4xx status code, typically caused by platform configuration issues
|
|
47
|
+
*/
|
|
48
|
+
| "invalid_request_error"
|
|
49
|
+
/**
|
|
50
|
+
* Too many requests hit the API too quickly.
|
|
51
|
+
*/
|
|
52
|
+
| "rate_limit_error"
|
|
53
|
+
/**
|
|
54
|
+
* API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
|
|
55
|
+
*/
|
|
56
|
+
| "api_error";
|
|
57
|
+
export declare const ConnectElementCommonMethodConfig: {
|
|
58
|
+
setOnLoadError: (_listener: (({ error, elementTagName }: LoadError) => void) | undefined) => void;
|
|
59
|
+
setOnLoaderStart: (_listener: (({ elementTagName }: LoaderStart) => void) | undefined) => void;
|
|
60
|
+
};
|
|
21
61
|
export declare const ConnectElementCustomMethodConfig: {
|
|
22
62
|
"payment-details": {
|
|
23
63
|
setPayment: (_payment: string | undefined) => void;
|
package/package.json
CHANGED
package/src/shared.ts
CHANGED
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
ConnectElementTagName,
|
|
5
5
|
ConnectHTMLElementRecord
|
|
6
6
|
} from "../types";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ConnectElementCommonMethodConfig,
|
|
9
|
+
ConnectElementCustomMethodConfig
|
|
10
|
+
} from "../types/config";
|
|
8
11
|
|
|
9
12
|
export type LoadConnectAndInitialize = (
|
|
10
13
|
initParams: IStripeConnectInitParams
|
|
@@ -189,15 +192,16 @@ export const initStripeConnect = (
|
|
|
189
192
|
}
|
|
190
193
|
const element = document.createElement(htmlName);
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
const customMethods = hasCustomMethod(tagName)
|
|
196
|
+
? ConnectElementCustomMethodConfig[tagName]
|
|
197
|
+
: {};
|
|
198
|
+
const methods = { ...customMethods, ...ConnectElementCommonMethodConfig };
|
|
199
|
+
for (const method in methods) {
|
|
200
|
+
(element as any)[method] = function(value: any) {
|
|
201
|
+
stripeConnectInstance.then(() => {
|
|
202
|
+
this[`${method}InternalOnly`](value);
|
|
203
|
+
});
|
|
204
|
+
};
|
|
201
205
|
}
|
|
202
206
|
|
|
203
207
|
stripeConnectInstance.then(instance => {
|
package/types/config.ts
CHANGED
|
@@ -25,6 +25,55 @@ export type InstallState = {
|
|
|
25
25
|
state: "INSTALLED" | "UNINSTALLED";
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
export type LoaderStart = {
|
|
29
|
+
elementTagName: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type LoadError = {
|
|
33
|
+
elementTagName: string;
|
|
34
|
+
error: EmbeddedError;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type EmbeddedError = {
|
|
38
|
+
type: EmbeddedErrorType;
|
|
39
|
+
message?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type EmbeddedErrorType =
|
|
43
|
+
/**
|
|
44
|
+
* Failure to connect to Stripe's API.
|
|
45
|
+
*/
|
|
46
|
+
| "api_connection_error"
|
|
47
|
+
/**
|
|
48
|
+
* Failure to perform the authentication flow within Connect Embedded Components
|
|
49
|
+
*/
|
|
50
|
+
| "authentication_error"
|
|
51
|
+
/**
|
|
52
|
+
* Account session create failed
|
|
53
|
+
*/
|
|
54
|
+
| "account_session_create_error"
|
|
55
|
+
/**
|
|
56
|
+
* Request failed with an 4xx status code, typically caused by platform configuration issues
|
|
57
|
+
*/
|
|
58
|
+
| "invalid_request_error"
|
|
59
|
+
/**
|
|
60
|
+
* Too many requests hit the API too quickly.
|
|
61
|
+
*/
|
|
62
|
+
| "rate_limit_error"
|
|
63
|
+
/**
|
|
64
|
+
* API errors covering any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.
|
|
65
|
+
*/
|
|
66
|
+
| "api_error";
|
|
67
|
+
|
|
68
|
+
export const ConnectElementCommonMethodConfig = {
|
|
69
|
+
setOnLoadError: (
|
|
70
|
+
_listener: (({ error, elementTagName }: LoadError) => void) | undefined
|
|
71
|
+
): void => {},
|
|
72
|
+
setOnLoaderStart: (
|
|
73
|
+
_listener: (({ elementTagName }: LoaderStart) => void) | undefined
|
|
74
|
+
): void => {}
|
|
75
|
+
};
|
|
76
|
+
|
|
28
77
|
export const ConnectElementCustomMethodConfig = {
|
|
29
78
|
"payment-details": {
|
|
30
79
|
setPayment: (_payment: string | undefined): void => {},
|
package/types/shared.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
ConnectElementCustomMethodConfig,
|
|
3
|
+
ConnectElementCommonMethodConfig
|
|
4
|
+
} from "./config";
|
|
3
5
|
export declare type LoadConnectAndInitialize = (
|
|
4
6
|
initParams: IStripeConnectInitParams
|
|
5
7
|
) => StripeConnectInstance;
|
|
@@ -412,12 +414,14 @@ export interface IStripeConnectInitParams {
|
|
|
412
414
|
}
|
|
413
415
|
|
|
414
416
|
type ConnectElementCustomMethods = typeof ConnectElementCustomMethodConfig;
|
|
417
|
+
type ConnectElementCommonMethods = typeof ConnectElementCommonMethodConfig;
|
|
415
418
|
|
|
416
419
|
export type ConnectHTMLElementRecord = {
|
|
417
420
|
[K in keyof ConnectElementCustomMethods]: HTMLElement &
|
|
418
|
-
ConnectElementCustomMethods[K]
|
|
421
|
+
ConnectElementCustomMethods[K] &
|
|
422
|
+
ConnectElementCommonMethods;
|
|
419
423
|
} & {
|
|
420
|
-
[key: string]: HTMLElement;
|
|
424
|
+
[key: string]: HTMLElement & ConnectElementCommonMethods;
|
|
421
425
|
};
|
|
422
426
|
|
|
423
427
|
export interface StripeConnectInstance {
|