@stripe/connect-js 3.3.2-beta-1 → 3.3.3
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 +21 -32
- package/dist/connect.js +21 -32
- package/dist/pure.esm.js +21 -32
- package/dist/pure.js +21 -32
- package/dist/src/shared.d.ts +1 -1
- package/dist/src/utils/jestHelpers.d.ts +1 -1
- package/dist/types/config.d.ts +3 -27
- package/package.json +1 -1
- package/src/shared.ts +23 -24
- package/src/utils/jestHelpers.ts +1 -1
- package/types/config.ts +3 -32
- package/types/shared.d.ts +2 -10
package/dist/connect.esm.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: _payment => {},
|
|
6
|
-
setOnClose: _listener => {}
|
|
7
|
-
},
|
|
8
4
|
"account-onboarding": {
|
|
9
5
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
6
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -13,47 +9,27 @@ const ConnectElementCustomMethodConfig = {
|
|
|
13
9
|
setCollectionOptions: _collectionOptions => {},
|
|
14
10
|
setOnExit: _listener => {}
|
|
15
11
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
setCardSwitching: _cardSwitching => {},
|
|
20
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
21
|
-
},
|
|
22
|
-
"issuing-cards-list": {
|
|
23
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
24
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
25
|
-
},
|
|
26
|
-
"financial-account": {
|
|
27
|
-
setFinancialAccount: _financialAccount => {}
|
|
28
|
-
},
|
|
29
|
-
"financial-account-transactions": {
|
|
30
|
-
setFinancialAccount: _financialAccount => {}
|
|
12
|
+
"payment-details": {
|
|
13
|
+
setPayment: _payment => {},
|
|
14
|
+
setOnClose: _listener => {}
|
|
31
15
|
}
|
|
32
16
|
};
|
|
33
17
|
|
|
34
18
|
const componentNameMapping = {
|
|
19
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
35
20
|
payments: "stripe-connect-payments",
|
|
36
|
-
payouts: "stripe-connect-payouts",
|
|
37
21
|
"payment-details": "stripe-connect-payment-details",
|
|
38
|
-
|
|
39
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
40
|
-
"account-management": "stripe-connect-account-management",
|
|
41
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
42
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
43
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
44
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
45
|
-
"financial-account": "stripe-connect-financial-account",
|
|
46
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
22
|
+
payouts: "stripe-connect-payouts",
|
|
47
23
|
documents: "stripe-connect-documents"
|
|
48
24
|
};
|
|
49
25
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
50
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
26
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
51
27
|
const findScript = () => {
|
|
52
28
|
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
53
29
|
};
|
|
54
30
|
const injectScript = () => {
|
|
55
31
|
const script = document.createElement("script");
|
|
56
|
-
script.src = "https://connect-js.stripe.com/
|
|
32
|
+
script.src = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
57
33
|
const head = document.head;
|
|
58
34
|
if (!head) {
|
|
59
35
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -127,6 +103,19 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
127
103
|
}
|
|
128
104
|
}
|
|
129
105
|
stripeConnectInstance.then(instance => {
|
|
106
|
+
if (!element.isConnected && !element.setConnector) {
|
|
107
|
+
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
108
|
+
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
109
|
+
// not been transformed into a custom element yet
|
|
110
|
+
// To load the custom element code on it, we need to connect and disconnect it to the DOM
|
|
111
|
+
// This isn't a problem, as the element will be invisible, and we know the element is already
|
|
112
|
+
// not currently connected to the DOM
|
|
113
|
+
const oldDisplay = element.style.display;
|
|
114
|
+
element.style.display = "none";
|
|
115
|
+
document.body.appendChild(element);
|
|
116
|
+
document.body.removeChild(element);
|
|
117
|
+
element.style.display = oldDisplay;
|
|
118
|
+
}
|
|
130
119
|
element.setConnector(instance.connect);
|
|
131
120
|
});
|
|
132
121
|
return element;
|
|
@@ -158,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
158
147
|
sdk: true,
|
|
159
148
|
sdkOptions: {
|
|
160
149
|
// This will be replaced by the npm package version when bundling
|
|
161
|
-
sdkVersion: "3.3.
|
|
150
|
+
sdkVersion: "3.3.3"
|
|
162
151
|
}
|
|
163
152
|
})
|
|
164
153
|
}));
|
package/dist/connect.js
CHANGED
|
@@ -5,10 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: _payment => {},
|
|
10
|
-
setOnClose: _listener => {}
|
|
11
|
-
},
|
|
12
8
|
"account-onboarding": {
|
|
13
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -17,47 +13,27 @@ const ConnectElementCustomMethodConfig = {
|
|
|
17
13
|
setCollectionOptions: _collectionOptions => {},
|
|
18
14
|
setOnExit: _listener => {}
|
|
19
15
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setCardSwitching: _cardSwitching => {},
|
|
24
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
25
|
-
},
|
|
26
|
-
"issuing-cards-list": {
|
|
27
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
28
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
29
|
-
},
|
|
30
|
-
"financial-account": {
|
|
31
|
-
setFinancialAccount: _financialAccount => {}
|
|
32
|
-
},
|
|
33
|
-
"financial-account-transactions": {
|
|
34
|
-
setFinancialAccount: _financialAccount => {}
|
|
16
|
+
"payment-details": {
|
|
17
|
+
setPayment: _payment => {},
|
|
18
|
+
setOnClose: _listener => {}
|
|
35
19
|
}
|
|
36
20
|
};
|
|
37
21
|
|
|
38
22
|
const componentNameMapping = {
|
|
23
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
39
24
|
payments: "stripe-connect-payments",
|
|
40
|
-
payouts: "stripe-connect-payouts",
|
|
41
25
|
"payment-details": "stripe-connect-payment-details",
|
|
42
|
-
|
|
43
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
44
|
-
"account-management": "stripe-connect-account-management",
|
|
45
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
46
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
47
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
48
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
49
|
-
"financial-account": "stripe-connect-financial-account",
|
|
50
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
26
|
+
payouts: "stripe-connect-payouts",
|
|
51
27
|
documents: "stripe-connect-documents"
|
|
52
28
|
};
|
|
53
29
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
54
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
30
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
55
31
|
const findScript = () => {
|
|
56
32
|
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
57
33
|
};
|
|
58
34
|
const injectScript = () => {
|
|
59
35
|
const script = document.createElement("script");
|
|
60
|
-
script.src = "https://connect-js.stripe.com/
|
|
36
|
+
script.src = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
61
37
|
const head = document.head;
|
|
62
38
|
if (!head) {
|
|
63
39
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -131,6 +107,19 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
131
107
|
}
|
|
132
108
|
}
|
|
133
109
|
stripeConnectInstance.then(instance => {
|
|
110
|
+
if (!element.isConnected && !element.setConnector) {
|
|
111
|
+
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
112
|
+
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
113
|
+
// not been transformed into a custom element yet
|
|
114
|
+
// To load the custom element code on it, we need to connect and disconnect it to the DOM
|
|
115
|
+
// This isn't a problem, as the element will be invisible, and we know the element is already
|
|
116
|
+
// not currently connected to the DOM
|
|
117
|
+
const oldDisplay = element.style.display;
|
|
118
|
+
element.style.display = "none";
|
|
119
|
+
document.body.appendChild(element);
|
|
120
|
+
document.body.removeChild(element);
|
|
121
|
+
element.style.display = oldDisplay;
|
|
122
|
+
}
|
|
134
123
|
element.setConnector(instance.connect);
|
|
135
124
|
});
|
|
136
125
|
return element;
|
|
@@ -162,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
162
151
|
sdk: true,
|
|
163
152
|
sdkOptions: {
|
|
164
153
|
// This will be replaced by the npm package version when bundling
|
|
165
|
-
sdkVersion: "3.3.
|
|
154
|
+
sdkVersion: "3.3.3"
|
|
166
155
|
}
|
|
167
156
|
})
|
|
168
157
|
}));
|
package/dist/pure.esm.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
const ConnectElementCustomMethodConfig = {
|
|
4
|
-
"payment-details": {
|
|
5
|
-
setPayment: _payment => {},
|
|
6
|
-
setOnClose: _listener => {}
|
|
7
|
-
},
|
|
8
4
|
"account-onboarding": {
|
|
9
5
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
10
6
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -13,47 +9,27 @@ const ConnectElementCustomMethodConfig = {
|
|
|
13
9
|
setCollectionOptions: _collectionOptions => {},
|
|
14
10
|
setOnExit: _listener => {}
|
|
15
11
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
setCardSwitching: _cardSwitching => {},
|
|
20
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
21
|
-
},
|
|
22
|
-
"issuing-cards-list": {
|
|
23
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
24
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
25
|
-
},
|
|
26
|
-
"financial-account": {
|
|
27
|
-
setFinancialAccount: _financialAccount => {}
|
|
28
|
-
},
|
|
29
|
-
"financial-account-transactions": {
|
|
30
|
-
setFinancialAccount: _financialAccount => {}
|
|
12
|
+
"payment-details": {
|
|
13
|
+
setPayment: _payment => {},
|
|
14
|
+
setOnClose: _listener => {}
|
|
31
15
|
}
|
|
32
16
|
};
|
|
33
17
|
|
|
34
18
|
const componentNameMapping = {
|
|
19
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
35
20
|
payments: "stripe-connect-payments",
|
|
36
|
-
payouts: "stripe-connect-payouts",
|
|
37
21
|
"payment-details": "stripe-connect-payment-details",
|
|
38
|
-
|
|
39
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
40
|
-
"account-management": "stripe-connect-account-management",
|
|
41
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
42
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
43
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
44
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
45
|
-
"financial-account": "stripe-connect-financial-account",
|
|
46
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
22
|
+
payouts: "stripe-connect-payouts",
|
|
47
23
|
documents: "stripe-connect-documents"
|
|
48
24
|
};
|
|
49
25
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
50
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
26
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
51
27
|
const findScript = () => {
|
|
52
28
|
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
53
29
|
};
|
|
54
30
|
const injectScript = () => {
|
|
55
31
|
const script = document.createElement("script");
|
|
56
|
-
script.src = "https://connect-js.stripe.com/
|
|
32
|
+
script.src = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
57
33
|
const head = document.head;
|
|
58
34
|
if (!head) {
|
|
59
35
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -127,6 +103,19 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
127
103
|
}
|
|
128
104
|
}
|
|
129
105
|
stripeConnectInstance.then(instance => {
|
|
106
|
+
if (!element.isConnected && !element.setConnector) {
|
|
107
|
+
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
108
|
+
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
109
|
+
// not been transformed into a custom element yet
|
|
110
|
+
// To load the custom element code on it, we need to connect and disconnect it to the DOM
|
|
111
|
+
// This isn't a problem, as the element will be invisible, and we know the element is already
|
|
112
|
+
// not currently connected to the DOM
|
|
113
|
+
const oldDisplay = element.style.display;
|
|
114
|
+
element.style.display = "none";
|
|
115
|
+
document.body.appendChild(element);
|
|
116
|
+
document.body.removeChild(element);
|
|
117
|
+
element.style.display = oldDisplay;
|
|
118
|
+
}
|
|
130
119
|
element.setConnector(instance.connect);
|
|
131
120
|
});
|
|
132
121
|
return element;
|
|
@@ -158,7 +147,7 @@ const createWrapper = stripeConnect => {
|
|
|
158
147
|
sdk: true,
|
|
159
148
|
sdkOptions: {
|
|
160
149
|
// This will be replaced by the npm package version when bundling
|
|
161
|
-
sdkVersion: "3.3.
|
|
150
|
+
sdkVersion: "3.3.3"
|
|
162
151
|
}
|
|
163
152
|
})
|
|
164
153
|
}));
|
package/dist/pure.js
CHANGED
|
@@ -5,10 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6
6
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
7
|
const ConnectElementCustomMethodConfig = {
|
|
8
|
-
"payment-details": {
|
|
9
|
-
setPayment: _payment => {},
|
|
10
|
-
setOnClose: _listener => {}
|
|
11
|
-
},
|
|
12
8
|
"account-onboarding": {
|
|
13
9
|
setFullTermsOfServiceUrl: _termOfServiceUrl => {},
|
|
14
10
|
setRecipientTermsOfServiceUrl: _recipientTermsOfServiceUrl => {},
|
|
@@ -17,47 +13,27 @@ const ConnectElementCustomMethodConfig = {
|
|
|
17
13
|
setCollectionOptions: _collectionOptions => {},
|
|
18
14
|
setOnExit: _listener => {}
|
|
19
15
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setCardSwitching: _cardSwitching => {},
|
|
24
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
25
|
-
},
|
|
26
|
-
"issuing-cards-list": {
|
|
27
|
-
setCardArtFileLink: _cardArtFileLink => {},
|
|
28
|
-
setFetchEphemeralKey: _fetchEphemeralKey => {}
|
|
29
|
-
},
|
|
30
|
-
"financial-account": {
|
|
31
|
-
setFinancialAccount: _financialAccount => {}
|
|
32
|
-
},
|
|
33
|
-
"financial-account-transactions": {
|
|
34
|
-
setFinancialAccount: _financialAccount => {}
|
|
16
|
+
"payment-details": {
|
|
17
|
+
setPayment: _payment => {},
|
|
18
|
+
setOnClose: _listener => {}
|
|
35
19
|
}
|
|
36
20
|
};
|
|
37
21
|
|
|
38
22
|
const componentNameMapping = {
|
|
23
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
39
24
|
payments: "stripe-connect-payments",
|
|
40
|
-
payouts: "stripe-connect-payouts",
|
|
41
25
|
"payment-details": "stripe-connect-payment-details",
|
|
42
|
-
|
|
43
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
44
|
-
"account-management": "stripe-connect-account-management",
|
|
45
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
46
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
47
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
48
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
49
|
-
"financial-account": "stripe-connect-financial-account",
|
|
50
|
-
"financial-account-transactions": "stripe-connect-financial-account-transactions",
|
|
26
|
+
payouts: "stripe-connect-payouts",
|
|
51
27
|
documents: "stripe-connect-documents"
|
|
52
28
|
};
|
|
53
29
|
const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
54
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
30
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
55
31
|
const findScript = () => {
|
|
56
32
|
return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
|
|
57
33
|
};
|
|
58
34
|
const injectScript = () => {
|
|
59
35
|
const script = document.createElement("script");
|
|
60
|
-
script.src = "https://connect-js.stripe.com/
|
|
36
|
+
script.src = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
61
37
|
const head = document.head;
|
|
62
38
|
if (!head) {
|
|
63
39
|
throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
|
|
@@ -131,6 +107,19 @@ const initStripeConnect = (stripePromise, initParams) => {
|
|
|
131
107
|
}
|
|
132
108
|
}
|
|
133
109
|
stripeConnectInstance.then(instance => {
|
|
110
|
+
if (!element.isConnected && !element.setConnector) {
|
|
111
|
+
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
112
|
+
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
113
|
+
// not been transformed into a custom element yet
|
|
114
|
+
// To load the custom element code on it, we need to connect and disconnect it to the DOM
|
|
115
|
+
// This isn't a problem, as the element will be invisible, and we know the element is already
|
|
116
|
+
// not currently connected to the DOM
|
|
117
|
+
const oldDisplay = element.style.display;
|
|
118
|
+
element.style.display = "none";
|
|
119
|
+
document.body.appendChild(element);
|
|
120
|
+
document.body.removeChild(element);
|
|
121
|
+
element.style.display = oldDisplay;
|
|
122
|
+
}
|
|
134
123
|
element.setConnector(instance.connect);
|
|
135
124
|
});
|
|
136
125
|
return element;
|
|
@@ -162,7 +151,7 @@ const createWrapper = stripeConnect => {
|
|
|
162
151
|
sdk: true,
|
|
163
152
|
sdkOptions: {
|
|
164
153
|
// This will be replaced by the npm package version when bundling
|
|
165
|
-
sdkVersion: "3.3.
|
|
154
|
+
sdkVersion: "3.3.3"
|
|
166
155
|
}
|
|
167
156
|
})
|
|
168
157
|
}));
|
package/dist/src/shared.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
|
|
2
2
|
export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
|
|
3
|
-
|
|
3
|
+
type ConnectElementHTMLName = "stripe-connect-account-onboarding" | "stripe-connect-payments" | "stripe-connect-payment-details" | "stripe-connect-payouts" | "stripe-connect-documents";
|
|
4
4
|
export declare const componentNameMapping: Record<ConnectElementTagName, ConnectElementHTMLName>;
|
|
5
5
|
type StripeConnectInstanceExtended = StripeConnectInstance & {
|
|
6
6
|
debugInstance: () => Promise<StripeConnectInstance>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SCRIPT_SELECTOR = "script[src^=\"https://connect-js.stripe.com/
|
|
1
|
+
export declare const SCRIPT_SELECTOR = "script[src^=\"https://connect-js.stripe.com/v1.0/connect.js\"]";
|
|
2
2
|
export {};
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
2
|
-
issuingCard: string;
|
|
3
|
-
nonce: string;
|
|
4
|
-
}) => Promise<{
|
|
5
|
-
issuingCard: string;
|
|
6
|
-
nonce: string;
|
|
7
|
-
ephemeralKeySecret: string;
|
|
8
|
-
}>;
|
|
9
1
|
export type CollectionOptions = {
|
|
10
2
|
fields: "currently_due" | "eventually_due";
|
|
11
3
|
futureRequirements?: "omit" | "include";
|
|
12
4
|
};
|
|
13
5
|
export declare const ConnectElementCustomMethodConfig: {
|
|
14
|
-
"payment-details": {
|
|
15
|
-
setPayment: (_payment: string | undefined) => void;
|
|
16
|
-
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
17
|
-
};
|
|
18
6
|
"account-onboarding": {
|
|
19
7
|
setFullTermsOfServiceUrl: (_termOfServiceUrl: string | undefined) => void;
|
|
20
8
|
setRecipientTermsOfServiceUrl: (_recipientTermsOfServiceUrl: string | undefined) => void;
|
|
@@ -23,20 +11,8 @@ export declare const ConnectElementCustomMethodConfig: {
|
|
|
23
11
|
setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
|
|
24
12
|
setOnExit: (_listener: (() => void) | undefined) => void;
|
|
25
13
|
};
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
setCardSwitching: (_cardSwitching: boolean | undefined) => void;
|
|
30
|
-
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
31
|
-
};
|
|
32
|
-
"issuing-cards-list": {
|
|
33
|
-
setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
|
|
34
|
-
setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
|
|
35
|
-
};
|
|
36
|
-
"financial-account": {
|
|
37
|
-
setFinancialAccount: (_financialAccount: string) => void;
|
|
38
|
-
};
|
|
39
|
-
"financial-account-transactions": {
|
|
40
|
-
setFinancialAccount: (_financialAccount: string) => void;
|
|
14
|
+
"payment-details": {
|
|
15
|
+
setPayment: (_payment: string | undefined) => void;
|
|
16
|
+
setOnClose: (_listener: (() => void) | undefined) => void;
|
|
41
17
|
};
|
|
42
18
|
};
|
package/package.json
CHANGED
package/src/shared.ts
CHANGED
|
@@ -10,38 +10,21 @@ export type LoadConnectAndInitialize = (
|
|
|
10
10
|
initParams: IStripeConnectInitParams
|
|
11
11
|
) => StripeConnectInstance;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type ConnectElementHTMLName =
|
|
14
|
+
| "stripe-connect-account-onboarding"
|
|
14
15
|
| "stripe-connect-payments"
|
|
15
|
-
| "stripe-connect-payouts"
|
|
16
16
|
| "stripe-connect-payment-details"
|
|
17
|
-
| "stripe-connect-
|
|
18
|
-
| "stripe-connect-payment-method-settings"
|
|
19
|
-
| "stripe-connect-account-management"
|
|
20
|
-
| "stripe-connect-notification-banner"
|
|
21
|
-
| "stripe-connect-instant-payouts"
|
|
22
|
-
| "stripe-connect-issuing-card"
|
|
23
|
-
| "stripe-connect-issuing-cards-list"
|
|
24
|
-
| "stripe-connect-financial-account"
|
|
25
|
-
| "stripe-connect-financial-account-transactions"
|
|
17
|
+
| "stripe-connect-payouts"
|
|
26
18
|
| "stripe-connect-documents";
|
|
27
19
|
|
|
28
20
|
export const componentNameMapping: Record<
|
|
29
21
|
ConnectElementTagName,
|
|
30
22
|
ConnectElementHTMLName
|
|
31
23
|
> = {
|
|
24
|
+
"account-onboarding": "stripe-connect-account-onboarding",
|
|
32
25
|
payments: "stripe-connect-payments",
|
|
33
|
-
payouts: "stripe-connect-payouts",
|
|
34
26
|
"payment-details": "stripe-connect-payment-details",
|
|
35
|
-
|
|
36
|
-
"payment-method-settings": "stripe-connect-payment-method-settings",
|
|
37
|
-
"account-management": "stripe-connect-account-management",
|
|
38
|
-
"notification-banner": "stripe-connect-notification-banner",
|
|
39
|
-
"instant-payouts": "stripe-connect-instant-payouts",
|
|
40
|
-
"issuing-card": "stripe-connect-issuing-card",
|
|
41
|
-
"issuing-cards-list": "stripe-connect-issuing-cards-list",
|
|
42
|
-
"financial-account": "stripe-connect-financial-account",
|
|
43
|
-
"financial-account-transactions":
|
|
44
|
-
"stripe-connect-financial-account-transactions",
|
|
27
|
+
payouts: "stripe-connect-payouts",
|
|
45
28
|
documents: "stripe-connect-documents"
|
|
46
29
|
};
|
|
47
30
|
|
|
@@ -55,7 +38,7 @@ interface StripeConnectWrapper {
|
|
|
55
38
|
|
|
56
39
|
const EXISTING_SCRIPT_MESSAGE =
|
|
57
40
|
"loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
|
|
58
|
-
const V0_URL = "https://connect-js.stripe.com/
|
|
41
|
+
const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
59
42
|
|
|
60
43
|
export const findScript = (): HTMLScriptElement | null => {
|
|
61
44
|
return (
|
|
@@ -67,7 +50,7 @@ export const findScript = (): HTMLScriptElement | null => {
|
|
|
67
50
|
|
|
68
51
|
const injectScript = (): HTMLScriptElement => {
|
|
69
52
|
const script = document.createElement("script");
|
|
70
|
-
script.src = "https://connect-js.stripe.com/
|
|
53
|
+
script.src = "https://connect-js.stripe.com/v1.0/connect.js";
|
|
71
54
|
|
|
72
55
|
const head = document.head;
|
|
73
56
|
|
|
@@ -171,6 +154,22 @@ export const initStripeConnect = (
|
|
|
171
154
|
}
|
|
172
155
|
|
|
173
156
|
stripeConnectInstance.then(instance => {
|
|
157
|
+
if (!element.isConnected && !(element as any).setConnector) {
|
|
158
|
+
// If the element is not connected to the DOM and the `setConnector` method is not
|
|
159
|
+
// defined, this indicates the element was created before connect.js was loaded, and has
|
|
160
|
+
// not been transformed into a custom element yet
|
|
161
|
+
|
|
162
|
+
// To load the custom element code on it, we need to connect and disconnect it to the DOM
|
|
163
|
+
// This isn't a problem, as the element will be invisible, and we know the element is already
|
|
164
|
+
// not currently connected to the DOM
|
|
165
|
+
|
|
166
|
+
const oldDisplay = element.style.display;
|
|
167
|
+
element.style.display = "none";
|
|
168
|
+
document.body.appendChild(element);
|
|
169
|
+
document.body.removeChild(element);
|
|
170
|
+
element.style.display = oldDisplay;
|
|
171
|
+
}
|
|
172
|
+
|
|
174
173
|
(element as any).setConnector((instance as any).connect);
|
|
175
174
|
});
|
|
176
175
|
|
package/src/utils/jestHelpers.ts
CHANGED
package/types/config.ts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
3
|
|
|
4
|
-
export type FetchEphemeralKeyFunction = (fetchParams: {
|
|
5
|
-
issuingCard: string;
|
|
6
|
-
nonce: string;
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
issuingCard: string;
|
|
9
|
-
nonce: string;
|
|
10
|
-
ephemeralKeySecret: string;
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
4
|
export type CollectionOptions = {
|
|
14
5
|
fields: "currently_due" | "eventually_due";
|
|
15
6
|
futureRequirements?: "omit" | "include";
|
|
16
7
|
};
|
|
17
8
|
|
|
18
9
|
export const ConnectElementCustomMethodConfig = {
|
|
19
|
-
"payment-details": {
|
|
20
|
-
setPayment: (_payment: string | undefined): void => {},
|
|
21
|
-
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
22
|
-
},
|
|
23
10
|
"account-onboarding": {
|
|
24
11
|
setFullTermsOfServiceUrl: (
|
|
25
12
|
_termOfServiceUrl: string | undefined
|
|
@@ -36,24 +23,8 @@ export const ConnectElementCustomMethodConfig = {
|
|
|
36
23
|
): void => {},
|
|
37
24
|
setOnExit: (_listener: (() => void) | undefined): void => {}
|
|
38
25
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
setCardSwitching: (_cardSwitching: boolean | undefined): void => {},
|
|
43
|
-
setFetchEphemeralKey: (
|
|
44
|
-
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
45
|
-
): void => {}
|
|
46
|
-
},
|
|
47
|
-
"issuing-cards-list": {
|
|
48
|
-
setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
|
|
49
|
-
setFetchEphemeralKey: (
|
|
50
|
-
_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
|
|
51
|
-
): void => {}
|
|
52
|
-
},
|
|
53
|
-
"financial-account": {
|
|
54
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
55
|
-
},
|
|
56
|
-
"financial-account-transactions": {
|
|
57
|
-
setFinancialAccount: (_financialAccount: string): void => {}
|
|
26
|
+
"payment-details": {
|
|
27
|
+
setPayment: (_payment: string | undefined): void => {},
|
|
28
|
+
setOnClose: (_listener: (() => void) | undefined): void => {}
|
|
58
29
|
}
|
|
59
30
|
};
|
package/types/shared.d.ts
CHANGED
|
@@ -447,16 +447,8 @@ export interface StripeConnectInstance {
|
|
|
447
447
|
* Tagnames to be used with the `create` method of the Connect instance.
|
|
448
448
|
*/
|
|
449
449
|
export type ConnectElementTagName =
|
|
450
|
+
| "account-onboarding"
|
|
450
451
|
| "payments"
|
|
451
|
-
| "payouts"
|
|
452
452
|
| "payment-details"
|
|
453
|
-
| "
|
|
454
|
-
| "payment-method-settings"
|
|
455
|
-
| "account-management"
|
|
456
|
-
| "notification-banner"
|
|
457
|
-
| "instant-payouts"
|
|
458
|
-
| "issuing-card"
|
|
459
|
-
| "issuing-cards-list"
|
|
460
|
-
| "financial-account"
|
|
461
|
-
| "financial-account-transactions"
|
|
453
|
+
| "payouts"
|
|
462
454
|
| "documents";
|