@stripe/connect-js 1.0.8 → 1.0.9
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 +19 -30
- package/dist/connect.js +19 -30
- package/dist/pure.esm.js +19 -30
- package/dist/pure.js +19 -30
- package/package.json +1 -1
- package/src/shared.ts +35 -5
- package/types/shared.d.ts +11 -12
package/dist/connect.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.9";
|
|
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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
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.9";
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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.9";
|
|
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
|
-
|
|
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
|
-
|
|
102
|
-
|
|
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.9";
|
|
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
|
-
|
|
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
|
-
|
|
106
|
-
|
|
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
package/src/shared.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { version } from ".././package.json";
|
|
2
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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
|
@@ -122,12 +122,6 @@ export interface StripeConnectWrapper {
|
|
|
122
122
|
* @returns A Connect JS instance.
|
|
123
123
|
*/
|
|
124
124
|
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
125
|
}
|
|
132
126
|
|
|
133
127
|
export interface StripeConnectInstance {
|
|
@@ -143,14 +137,19 @@ export interface StripeConnectInstance {
|
|
|
143
137
|
* @options New parameters to update the Connect instance with.
|
|
144
138
|
*/
|
|
145
139
|
update: (options: IStripeConnectUpdateParams) => void;
|
|
146
|
-
}
|
|
147
140
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Logs the user out of Connect JS sessions
|
|
143
|
+
* @returns A promise that resolves when the user is logged out.
|
|
144
|
+
*/
|
|
145
|
+
logout: () => Promise<void>;
|
|
146
|
+
}
|
|
152
147
|
|
|
153
|
-
export type ConnectElementTagName =
|
|
148
|
+
export type ConnectElementTagName =
|
|
149
|
+
| "payments"
|
|
150
|
+
| "payouts"
|
|
151
|
+
| "payment-details"
|
|
152
|
+
| "account-onboarding";
|
|
154
153
|
|
|
155
154
|
export declare const findScript: () => HTMLScriptElement | null;
|
|
156
155
|
|