@stripe/connect-js 2.0.1-beta.4 → 2.0.1-beta.5
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 +45 -4
- package/dist/connect.js +45 -3
- package/dist/pure.esm.js +4 -3
- package/dist/pure.js +4 -3
- package/dist/src/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/shared.ts +4 -2
- package/types/shared.d.ts +2 -1
- /package/dist/{pure.d.ts → src/pure.d.ts} +0 -0
- /package/dist/{shared.d.ts → src/shared.d.ts} +0 -0
- /package/dist/{utils → src/utils}/jestHelpers.d.ts +0 -0
- /package/dist/{utils → src/utils}/jestSetup.d.ts +0 -0
package/dist/connect.esm.js
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
import { useQuery } from 'react-query';
|
|
2
|
+
|
|
3
|
+
/*! *****************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
6
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
7
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
10
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
11
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
12
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
13
|
+
|
|
14
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
15
|
+
and limitations under the License.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
|
|
18
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var version = "2.0.1-beta.1";
|
|
28
|
+
|
|
1
29
|
const componentNameMapping = {
|
|
2
30
|
payments: "stripe-connect-payments",
|
|
3
31
|
payouts: "stripe-connect-payouts",
|
|
@@ -11,7 +39,7 @@ const findScript = () => {
|
|
|
11
39
|
};
|
|
12
40
|
const injectScript = () => {
|
|
13
41
|
const script = document.createElement("script");
|
|
14
|
-
script.src = "
|
|
42
|
+
script.src = "http://localhost:3001/v0.1/connect.js";
|
|
15
43
|
const head = document.head;
|
|
16
44
|
if (!head) {
|
|
17
45
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -77,8 +105,7 @@ const createWrapper = stripeConnect => {
|
|
|
77
105
|
metaOptions: Object.assign(Object.assign({}, metaOptions), {
|
|
78
106
|
sdk: true,
|
|
79
107
|
sdkOptions: {
|
|
80
|
-
|
|
81
|
-
sdkVersion: "2.0.1-beta.4"
|
|
108
|
+
sdkVersion: version
|
|
82
109
|
}
|
|
83
110
|
})
|
|
84
111
|
}));
|
|
@@ -110,5 +137,19 @@ const loadConnect = () => {
|
|
|
110
137
|
loadCalled = true;
|
|
111
138
|
return stripePromise$1.then(maybeConnect => initStripeConnect(maybeConnect));
|
|
112
139
|
};
|
|
140
|
+
const loadConnectAndInitialize = initParams => {
|
|
141
|
+
loadCalled = true;
|
|
142
|
+
console.log("loading connect and initializing");
|
|
143
|
+
const {
|
|
144
|
+
data
|
|
145
|
+
} = useQuery([initParams], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
146
|
+
const stripeConnectWrapper = yield stripePromise$1.then(maybeConnect => initStripeConnect(maybeConnect));
|
|
147
|
+
if (stripeConnectWrapper === null) {
|
|
148
|
+
throw new Error("Stripe Connect has not loaded correctly");
|
|
149
|
+
}
|
|
150
|
+
return stripeConnectWrapper.initialize(initParams);
|
|
151
|
+
}));
|
|
152
|
+
return data;
|
|
153
|
+
};
|
|
113
154
|
|
|
114
|
-
export { loadConnect };
|
|
155
|
+
export { loadConnect, loadConnectAndInitialize };
|
package/dist/connect.js
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var reactQuery = require('react-query');
|
|
6
|
+
|
|
7
|
+
/*! *****************************************************************************
|
|
8
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
10
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
11
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
15
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
16
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
17
|
+
|
|
18
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
19
|
+
and limitations under the License.
|
|
20
|
+
***************************************************************************** */
|
|
21
|
+
|
|
22
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var version = "2.0.1-beta.1";
|
|
32
|
+
|
|
5
33
|
const componentNameMapping = {
|
|
6
34
|
payments: "stripe-connect-payments",
|
|
7
35
|
payouts: "stripe-connect-payouts",
|
|
@@ -15,7 +43,7 @@ const findScript = () => {
|
|
|
15
43
|
};
|
|
16
44
|
const injectScript = () => {
|
|
17
45
|
const script = document.createElement("script");
|
|
18
|
-
script.src = "
|
|
46
|
+
script.src = "http://localhost:3001/v0.1/connect.js";
|
|
19
47
|
const head = document.head;
|
|
20
48
|
if (!head) {
|
|
21
49
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -81,8 +109,7 @@ const createWrapper = stripeConnect => {
|
|
|
81
109
|
metaOptions: Object.assign(Object.assign({}, metaOptions), {
|
|
82
110
|
sdk: true,
|
|
83
111
|
sdkOptions: {
|
|
84
|
-
|
|
85
|
-
sdkVersion: "2.0.1-beta.4"
|
|
112
|
+
sdkVersion: version
|
|
86
113
|
}
|
|
87
114
|
})
|
|
88
115
|
}));
|
|
@@ -114,5 +141,20 @@ const loadConnect = () => {
|
|
|
114
141
|
loadCalled = true;
|
|
115
142
|
return stripePromise$1.then(maybeConnect => initStripeConnect(maybeConnect));
|
|
116
143
|
};
|
|
144
|
+
const loadConnectAndInitialize = initParams => {
|
|
145
|
+
loadCalled = true;
|
|
146
|
+
console.log("loading connect and initializing");
|
|
147
|
+
const {
|
|
148
|
+
data
|
|
149
|
+
} = reactQuery.useQuery([initParams], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
150
|
+
const stripeConnectWrapper = yield stripePromise$1.then(maybeConnect => initStripeConnect(maybeConnect));
|
|
151
|
+
if (stripeConnectWrapper === null) {
|
|
152
|
+
throw new Error("Stripe Connect has not loaded correctly");
|
|
153
|
+
}
|
|
154
|
+
return stripeConnectWrapper.initialize(initParams);
|
|
155
|
+
}));
|
|
156
|
+
return data;
|
|
157
|
+
};
|
|
117
158
|
|
|
118
159
|
exports.loadConnect = loadConnect;
|
|
160
|
+
exports.loadConnectAndInitialize = loadConnectAndInitialize;
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var version = "2.0.1-beta.1";
|
|
2
|
+
|
|
1
3
|
const componentNameMapping = {
|
|
2
4
|
payments: "stripe-connect-payments",
|
|
3
5
|
payouts: "stripe-connect-payouts",
|
|
@@ -11,7 +13,7 @@ const findScript = () => {
|
|
|
11
13
|
};
|
|
12
14
|
const injectScript = () => {
|
|
13
15
|
const script = document.createElement("script");
|
|
14
|
-
script.src = "
|
|
16
|
+
script.src = "http://localhost:3001/v0.1/connect.js";
|
|
15
17
|
const head = document.head;
|
|
16
18
|
if (!head) {
|
|
17
19
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -77,8 +79,7 @@ const createWrapper = stripeConnect => {
|
|
|
77
79
|
metaOptions: Object.assign(Object.assign({}, metaOptions), {
|
|
78
80
|
sdk: true,
|
|
79
81
|
sdkOptions: {
|
|
80
|
-
|
|
81
|
-
sdkVersion: "2.0.1-beta.4"
|
|
82
|
+
sdkVersion: version
|
|
82
83
|
}
|
|
83
84
|
})
|
|
84
85
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var version = "2.0.1-beta.1";
|
|
6
|
+
|
|
5
7
|
const componentNameMapping = {
|
|
6
8
|
payments: "stripe-connect-payments",
|
|
7
9
|
payouts: "stripe-connect-payouts",
|
|
@@ -15,7 +17,7 @@ const findScript = () => {
|
|
|
15
17
|
};
|
|
16
18
|
const injectScript = () => {
|
|
17
19
|
const script = document.createElement("script");
|
|
18
|
-
script.src = "
|
|
20
|
+
script.src = "http://localhost:3001/v0.1/connect.js";
|
|
19
21
|
const head = document.head;
|
|
20
22
|
if (!head) {
|
|
21
23
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -81,8 +83,7 @@ const createWrapper = stripeConnect => {
|
|
|
81
83
|
metaOptions: Object.assign(Object.assign({}, metaOptions), {
|
|
82
84
|
sdk: true,
|
|
83
85
|
sdkOptions: {
|
|
84
|
-
|
|
85
|
-
sdkVersion: "2.0.1-beta.4"
|
|
86
|
+
sdkVersion: version
|
|
86
87
|
}
|
|
87
88
|
})
|
|
88
89
|
}));
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IStripeConnectInitParams, StripeConnectInstance } from "../types";
|
|
1
2
|
import { LoadConnect } from "./shared";
|
|
2
3
|
export declare const loadConnect: LoadConnect;
|
|
4
|
+
export declare const loadConnectAndInitialize: (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
5
|
export {};
|
package/package.json
CHANGED
package/src/shared.ts
CHANGED
|
@@ -10,7 +10,8 @@ type ConnectElementHTMLName =
|
|
|
10
10
|
| "stripe-connect-payments"
|
|
11
11
|
| "stripe-connect-payouts"
|
|
12
12
|
| "stripe-connect-payment-details"
|
|
13
|
-
| "stripe-connect-account-onboarding"
|
|
13
|
+
| "stripe-connect-account-onboarding"
|
|
14
|
+
| "stripe-connect-payment-method-settings";
|
|
14
15
|
|
|
15
16
|
const componentNameMapping: Record<
|
|
16
17
|
ConnectElementTagName,
|
|
@@ -19,7 +20,8 @@ const componentNameMapping: Record<
|
|
|
19
20
|
payments: "stripe-connect-payments",
|
|
20
21
|
payouts: "stripe-connect-payouts",
|
|
21
22
|
"payment-details": "stripe-connect-payment-details",
|
|
22
|
-
"account-onboarding": "stripe-connect-account-onboarding"
|
|
23
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
24
|
+
"payment-method-settings": "stripe-connect-payment-method-settings"
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
const EXISTING_SCRIPT_MESSAGE =
|
package/types/shared.d.ts
CHANGED
|
@@ -185,7 +185,8 @@ export type ConnectElementTagName =
|
|
|
185
185
|
| "payments"
|
|
186
186
|
| "payouts"
|
|
187
187
|
| "payment-details"
|
|
188
|
-
| "account-onboarding"
|
|
188
|
+
| "account-onboarding"
|
|
189
|
+
| "payment-method-settings";
|
|
189
190
|
|
|
190
191
|
export declare const findScript: () => HTMLScriptElement | null;
|
|
191
192
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|