@stripe/connect-js 3.3.7-beta-1 → 3.3.7

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.
@@ -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 => {},
@@ -17,52 +13,34 @@ const ConnectElementCustomMethodConfig = {
17
13
  setCollectionOptions: _collectionOptions => {}
18
14
  },
19
15
  "notification-banner": {
20
- setCollectionOptions: _collectionOptions => {}
21
- },
22
- "issuing-card": {
23
- setDefaultCard: _defaultCard => {},
24
- setCardArtFileLink: _cardArtFileLink => {},
25
- setCardSwitching: _cardSwitching => {},
26
- setFetchEphemeralKey: _fetchEphemeralKey => {}
27
- },
28
- "issuing-cards-list": {
29
- setCardArtFileLink: _cardArtFileLink => {},
30
- setFetchEphemeralKey: _fetchEphemeralKey => {}
31
- },
32
- "financial-account": {
33
- setFinancialAccount: _financialAccount => {}
16
+ setCollectionOptions: _collectionOptions => {},
17
+ setOnNotificationsChange: _listener => {}
34
18
  },
35
- "financial-account-transactions": {
36
- setFinancialAccount: _financialAccount => {}
19
+ "payment-details": {
20
+ setPayment: _payment => {},
21
+ setOnClose: _listener => {}
37
22
  }
38
23
  };
39
24
 
40
25
  const componentNameMapping = {
26
+ "account-onboarding": "stripe-connect-account-onboarding",
41
27
  payments: "stripe-connect-payments",
42
- payouts: "stripe-connect-payouts",
43
28
  "payment-details": "stripe-connect-payment-details",
44
- "account-onboarding": "stripe-connect-account-onboarding",
45
- "payment-method-settings": "stripe-connect-payment-method-settings",
29
+ payouts: "stripe-connect-payouts",
30
+ "payouts-list": "stripe-connect-payouts-list",
31
+ balances: "stripe-connect-balances",
46
32
  "account-management": "stripe-connect-account-management",
47
33
  "notification-banner": "stripe-connect-notification-banner",
48
- "instant-payouts": "stripe-connect-instant-payouts",
49
- "issuing-card": "stripe-connect-issuing-card",
50
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
51
- "financial-account": "stripe-connect-financial-account",
52
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
53
- "capital-overview": "stripe-connect-capital-overview",
54
- documents: "stripe-connect-documents",
55
- "tax-registrations": "stripe-connect-tax-registrations",
56
- "tax-settings": "stripe-connect-tax-settings"
34
+ documents: "stripe-connect-documents"
57
35
  };
58
36
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
59
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
37
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
60
38
  const findScript = () => {
61
39
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
62
40
  };
63
41
  const injectScript = () => {
64
42
  const script = document.createElement("script");
65
- script.src = "https://connect-js.stripe.com/v0.1/connect.js";
43
+ script.src = "https://connect-js.stripe.com/v1.0/connect.js";
66
44
  const head = document.head;
67
45
  if (!head) {
68
46
  throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
@@ -149,6 +127,9 @@ const initStripeConnect = (stripePromise, initParams) => {
149
127
  document.body.removeChild(element);
150
128
  element.style.display = oldDisplay;
151
129
  }
130
+ if (!element || !element.setConnector) {
131
+ throw new Error(`Element ${tagName} was not transformed into a custom element. Are you using a documented component? See https://docs.stripe.com/connect/supported-embedded-components for a list of supported components`);
132
+ }
152
133
  element.setConnector(instance.connect);
153
134
  });
154
135
  return element;
@@ -180,7 +161,7 @@ const createWrapper = stripeConnect => {
180
161
  sdk: true,
181
162
  sdkOptions: {
182
163
  // This will be replaced by the npm package version when bundling
183
- sdkVersion: "3.3.7-beta-1"
164
+ sdkVersion: "3.3.7"
184
165
  }
185
166
  })
186
167
  }));
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 => {},
@@ -21,52 +17,34 @@ const ConnectElementCustomMethodConfig = {
21
17
  setCollectionOptions: _collectionOptions => {}
22
18
  },
23
19
  "notification-banner": {
24
- setCollectionOptions: _collectionOptions => {}
25
- },
26
- "issuing-card": {
27
- setDefaultCard: _defaultCard => {},
28
- setCardArtFileLink: _cardArtFileLink => {},
29
- setCardSwitching: _cardSwitching => {},
30
- setFetchEphemeralKey: _fetchEphemeralKey => {}
31
- },
32
- "issuing-cards-list": {
33
- setCardArtFileLink: _cardArtFileLink => {},
34
- setFetchEphemeralKey: _fetchEphemeralKey => {}
35
- },
36
- "financial-account": {
37
- setFinancialAccount: _financialAccount => {}
20
+ setCollectionOptions: _collectionOptions => {},
21
+ setOnNotificationsChange: _listener => {}
38
22
  },
39
- "financial-account-transactions": {
40
- setFinancialAccount: _financialAccount => {}
23
+ "payment-details": {
24
+ setPayment: _payment => {},
25
+ setOnClose: _listener => {}
41
26
  }
42
27
  };
43
28
 
44
29
  const componentNameMapping = {
30
+ "account-onboarding": "stripe-connect-account-onboarding",
45
31
  payments: "stripe-connect-payments",
46
- payouts: "stripe-connect-payouts",
47
32
  "payment-details": "stripe-connect-payment-details",
48
- "account-onboarding": "stripe-connect-account-onboarding",
49
- "payment-method-settings": "stripe-connect-payment-method-settings",
33
+ payouts: "stripe-connect-payouts",
34
+ "payouts-list": "stripe-connect-payouts-list",
35
+ balances: "stripe-connect-balances",
50
36
  "account-management": "stripe-connect-account-management",
51
37
  "notification-banner": "stripe-connect-notification-banner",
52
- "instant-payouts": "stripe-connect-instant-payouts",
53
- "issuing-card": "stripe-connect-issuing-card",
54
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
55
- "financial-account": "stripe-connect-financial-account",
56
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
57
- "capital-overview": "stripe-connect-capital-overview",
58
- documents: "stripe-connect-documents",
59
- "tax-registrations": "stripe-connect-tax-registrations",
60
- "tax-settings": "stripe-connect-tax-settings"
38
+ documents: "stripe-connect-documents"
61
39
  };
62
40
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
63
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
41
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
64
42
  const findScript = () => {
65
43
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
66
44
  };
67
45
  const injectScript = () => {
68
46
  const script = document.createElement("script");
69
- script.src = "https://connect-js.stripe.com/v0.1/connect.js";
47
+ script.src = "https://connect-js.stripe.com/v1.0/connect.js";
70
48
  const head = document.head;
71
49
  if (!head) {
72
50
  throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
@@ -153,6 +131,9 @@ const initStripeConnect = (stripePromise, initParams) => {
153
131
  document.body.removeChild(element);
154
132
  element.style.display = oldDisplay;
155
133
  }
134
+ if (!element || !element.setConnector) {
135
+ throw new Error(`Element ${tagName} was not transformed into a custom element. Are you using a documented component? See https://docs.stripe.com/connect/supported-embedded-components for a list of supported components`);
136
+ }
156
137
  element.setConnector(instance.connect);
157
138
  });
158
139
  return element;
@@ -184,7 +165,7 @@ const createWrapper = stripeConnect => {
184
165
  sdk: true,
185
166
  sdkOptions: {
186
167
  // This will be replaced by the npm package version when bundling
187
- sdkVersion: "3.3.7-beta-1"
168
+ sdkVersion: "3.3.7"
188
169
  }
189
170
  })
190
171
  }));
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 => {},
@@ -17,52 +13,34 @@ const ConnectElementCustomMethodConfig = {
17
13
  setCollectionOptions: _collectionOptions => {}
18
14
  },
19
15
  "notification-banner": {
20
- setCollectionOptions: _collectionOptions => {}
21
- },
22
- "issuing-card": {
23
- setDefaultCard: _defaultCard => {},
24
- setCardArtFileLink: _cardArtFileLink => {},
25
- setCardSwitching: _cardSwitching => {},
26
- setFetchEphemeralKey: _fetchEphemeralKey => {}
27
- },
28
- "issuing-cards-list": {
29
- setCardArtFileLink: _cardArtFileLink => {},
30
- setFetchEphemeralKey: _fetchEphemeralKey => {}
31
- },
32
- "financial-account": {
33
- setFinancialAccount: _financialAccount => {}
16
+ setCollectionOptions: _collectionOptions => {},
17
+ setOnNotificationsChange: _listener => {}
34
18
  },
35
- "financial-account-transactions": {
36
- setFinancialAccount: _financialAccount => {}
19
+ "payment-details": {
20
+ setPayment: _payment => {},
21
+ setOnClose: _listener => {}
37
22
  }
38
23
  };
39
24
 
40
25
  const componentNameMapping = {
26
+ "account-onboarding": "stripe-connect-account-onboarding",
41
27
  payments: "stripe-connect-payments",
42
- payouts: "stripe-connect-payouts",
43
28
  "payment-details": "stripe-connect-payment-details",
44
- "account-onboarding": "stripe-connect-account-onboarding",
45
- "payment-method-settings": "stripe-connect-payment-method-settings",
29
+ payouts: "stripe-connect-payouts",
30
+ "payouts-list": "stripe-connect-payouts-list",
31
+ balances: "stripe-connect-balances",
46
32
  "account-management": "stripe-connect-account-management",
47
33
  "notification-banner": "stripe-connect-notification-banner",
48
- "instant-payouts": "stripe-connect-instant-payouts",
49
- "issuing-card": "stripe-connect-issuing-card",
50
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
51
- "financial-account": "stripe-connect-financial-account",
52
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
53
- "capital-overview": "stripe-connect-capital-overview",
54
- documents: "stripe-connect-documents",
55
- "tax-registrations": "stripe-connect-tax-registrations",
56
- "tax-settings": "stripe-connect-tax-settings"
34
+ documents: "stripe-connect-documents"
57
35
  };
58
36
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
59
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
37
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
60
38
  const findScript = () => {
61
39
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
62
40
  };
63
41
  const injectScript = () => {
64
42
  const script = document.createElement("script");
65
- script.src = "https://connect-js.stripe.com/v0.1/connect.js";
43
+ script.src = "https://connect-js.stripe.com/v1.0/connect.js";
66
44
  const head = document.head;
67
45
  if (!head) {
68
46
  throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
@@ -149,6 +127,9 @@ const initStripeConnect = (stripePromise, initParams) => {
149
127
  document.body.removeChild(element);
150
128
  element.style.display = oldDisplay;
151
129
  }
130
+ if (!element || !element.setConnector) {
131
+ throw new Error(`Element ${tagName} was not transformed into a custom element. Are you using a documented component? See https://docs.stripe.com/connect/supported-embedded-components for a list of supported components`);
132
+ }
152
133
  element.setConnector(instance.connect);
153
134
  });
154
135
  return element;
@@ -180,7 +161,7 @@ const createWrapper = stripeConnect => {
180
161
  sdk: true,
181
162
  sdkOptions: {
182
163
  // This will be replaced by the npm package version when bundling
183
- sdkVersion: "3.3.7-beta-1"
164
+ sdkVersion: "3.3.7"
184
165
  }
185
166
  })
186
167
  }));
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 => {},
@@ -21,52 +17,34 @@ const ConnectElementCustomMethodConfig = {
21
17
  setCollectionOptions: _collectionOptions => {}
22
18
  },
23
19
  "notification-banner": {
24
- setCollectionOptions: _collectionOptions => {}
25
- },
26
- "issuing-card": {
27
- setDefaultCard: _defaultCard => {},
28
- setCardArtFileLink: _cardArtFileLink => {},
29
- setCardSwitching: _cardSwitching => {},
30
- setFetchEphemeralKey: _fetchEphemeralKey => {}
31
- },
32
- "issuing-cards-list": {
33
- setCardArtFileLink: _cardArtFileLink => {},
34
- setFetchEphemeralKey: _fetchEphemeralKey => {}
35
- },
36
- "financial-account": {
37
- setFinancialAccount: _financialAccount => {}
20
+ setCollectionOptions: _collectionOptions => {},
21
+ setOnNotificationsChange: _listener => {}
38
22
  },
39
- "financial-account-transactions": {
40
- setFinancialAccount: _financialAccount => {}
23
+ "payment-details": {
24
+ setPayment: _payment => {},
25
+ setOnClose: _listener => {}
41
26
  }
42
27
  };
43
28
 
44
29
  const componentNameMapping = {
30
+ "account-onboarding": "stripe-connect-account-onboarding",
45
31
  payments: "stripe-connect-payments",
46
- payouts: "stripe-connect-payouts",
47
32
  "payment-details": "stripe-connect-payment-details",
48
- "account-onboarding": "stripe-connect-account-onboarding",
49
- "payment-method-settings": "stripe-connect-payment-method-settings",
33
+ payouts: "stripe-connect-payouts",
34
+ "payouts-list": "stripe-connect-payouts-list",
35
+ balances: "stripe-connect-balances",
50
36
  "account-management": "stripe-connect-account-management",
51
37
  "notification-banner": "stripe-connect-notification-banner",
52
- "instant-payouts": "stripe-connect-instant-payouts",
53
- "issuing-card": "stripe-connect-issuing-card",
54
- "issuing-cards-list": "stripe-connect-issuing-cards-list",
55
- "financial-account": "stripe-connect-financial-account",
56
- "financial-account-transactions": "stripe-connect-financial-account-transactions",
57
- "capital-overview": "stripe-connect-capital-overview",
58
- documents: "stripe-connect-documents",
59
- "tax-registrations": "stripe-connect-tax-registrations",
60
- "tax-settings": "stripe-connect-tax-settings"
38
+ documents: "stripe-connect-documents"
61
39
  };
62
40
  const EXISTING_SCRIPT_MESSAGE = "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
63
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
41
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
64
42
  const findScript = () => {
65
43
  return document.querySelectorAll(`script[src="${V0_URL}"]`)[0] || null;
66
44
  };
67
45
  const injectScript = () => {
68
46
  const script = document.createElement("script");
69
- script.src = "https://connect-js.stripe.com/v0.1/connect.js";
47
+ script.src = "https://connect-js.stripe.com/v1.0/connect.js";
70
48
  const head = document.head;
71
49
  if (!head) {
72
50
  throw new Error("Expected document.head not to be null. Connect.js requires a <head> element.");
@@ -153,6 +131,9 @@ const initStripeConnect = (stripePromise, initParams) => {
153
131
  document.body.removeChild(element);
154
132
  element.style.display = oldDisplay;
155
133
  }
134
+ if (!element || !element.setConnector) {
135
+ throw new Error(`Element ${tagName} was not transformed into a custom element. Are you using a documented component? See https://docs.stripe.com/connect/supported-embedded-components for a list of supported components`);
136
+ }
156
137
  element.setConnector(instance.connect);
157
138
  });
158
139
  return element;
@@ -184,7 +165,7 @@ const createWrapper = stripeConnect => {
184
165
  sdk: true,
185
166
  sdkOptions: {
186
167
  // This will be replaced by the npm package version when bundling
187
- sdkVersion: "3.3.7-beta-1"
168
+ sdkVersion: "3.3.7"
188
169
  }
189
170
  })
190
171
  }));
@@ -1,6 +1,6 @@
1
1
  import { IStripeConnectInitParams, StripeConnectInstance, ConnectElementTagName } from "../types";
2
2
  export type LoadConnectAndInitialize = (initParams: IStripeConnectInitParams) => StripeConnectInstance;
3
- export type ConnectElementHTMLName = "stripe-connect-payments" | "stripe-connect-payouts" | "stripe-connect-payment-details" | "stripe-connect-account-onboarding" | "stripe-connect-payment-method-settings" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-instant-payouts" | "stripe-connect-issuing-card" | "stripe-connect-issuing-cards-list" | "stripe-connect-financial-account" | "stripe-connect-financial-account-transactions" | "stripe-connect-capital-overview" | "stripe-connect-documents" | "stripe-connect-tax-registrations" | "stripe-connect-tax-settings";
3
+ type ConnectElementHTMLName = "stripe-connect-account-onboarding" | "stripe-connect-payments" | "stripe-connect-payment-details" | "stripe-connect-account-management" | "stripe-connect-notification-banner" | "stripe-connect-payouts" | "stripe-connect-payouts-list" | "stripe-connect-balances" | "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/v0.1/connect.js\"]";
1
+ export declare const SCRIPT_SELECTOR = "script[src^=\"https://connect-js.stripe.com/v1.0/connect.js\"]";
2
2
  export {};
@@ -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;
@@ -28,21 +16,10 @@ export declare const ConnectElementCustomMethodConfig: {
28
16
  };
29
17
  "notification-banner": {
30
18
  setCollectionOptions: (_collectionOptions: CollectionOptions | undefined) => void;
19
+ setOnNotificationsChange: (_listener: (() => void) | undefined) => void;
31
20
  };
32
- "issuing-card": {
33
- setDefaultCard: (_defaultCard: string | undefined) => void;
34
- setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
35
- setCardSwitching: (_cardSwitching: boolean | undefined) => void;
36
- setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
37
- };
38
- "issuing-cards-list": {
39
- setCardArtFileLink: (_cardArtFileLink: string | undefined) => void;
40
- setFetchEphemeralKey: (_fetchEphemeralKey: FetchEphemeralKeyFunction | undefined) => void;
41
- };
42
- "financial-account": {
43
- setFinancialAccount: (_financialAccount: string) => void;
44
- };
45
- "financial-account-transactions": {
46
- setFinancialAccount: (_financialAccount: string) => void;
21
+ "payment-details": {
22
+ setPayment: (_payment: string | undefined) => void;
23
+ setOnClose: (_listener: (() => void) | undefined) => void;
47
24
  };
48
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.7-beta-1",
3
+ "version": "3.3.7",
4
4
  "description": "Connect.js loading utility package",
5
5
  "main": "dist/connect.js",
6
6
  "module": "dist/connect.esm.js",
package/src/shared.ts CHANGED
@@ -10,45 +10,30 @@ export type LoadConnectAndInitialize = (
10
10
  initParams: IStripeConnectInitParams
11
11
  ) => StripeConnectInstance;
12
12
 
13
- export type ConnectElementHTMLName =
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-account-onboarding"
18
- | "stripe-connect-payment-method-settings"
19
17
  | "stripe-connect-account-management"
20
18
  | "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"
26
- | "stripe-connect-capital-overview"
27
- | "stripe-connect-documents"
28
- | "stripe-connect-tax-registrations"
29
- | "stripe-connect-tax-settings";
19
+ | "stripe-connect-payouts"
20
+ | "stripe-connect-payouts-list"
21
+ | "stripe-connect-balances"
22
+ | "stripe-connect-documents";
30
23
 
31
24
  export const componentNameMapping: Record<
32
25
  ConnectElementTagName,
33
26
  ConnectElementHTMLName
34
27
  > = {
28
+ "account-onboarding": "stripe-connect-account-onboarding",
35
29
  payments: "stripe-connect-payments",
36
- payouts: "stripe-connect-payouts",
37
30
  "payment-details": "stripe-connect-payment-details",
38
- "account-onboarding": "stripe-connect-account-onboarding",
39
- "payment-method-settings": "stripe-connect-payment-method-settings",
31
+ payouts: "stripe-connect-payouts",
32
+ "payouts-list": "stripe-connect-payouts-list",
33
+ balances: "stripe-connect-balances",
40
34
  "account-management": "stripe-connect-account-management",
41
35
  "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":
47
- "stripe-connect-financial-account-transactions",
48
- "capital-overview": "stripe-connect-capital-overview",
49
- documents: "stripe-connect-documents",
50
- "tax-registrations": "stripe-connect-tax-registrations",
51
- "tax-settings": "stripe-connect-tax-settings"
36
+ documents: "stripe-connect-documents"
52
37
  };
53
38
 
54
39
  type StripeConnectInstanceExtended = StripeConnectInstance & {
@@ -61,7 +46,7 @@ interface StripeConnectWrapper {
61
46
 
62
47
  const EXISTING_SCRIPT_MESSAGE =
63
48
  "loadConnect was called but an existing Connect.js script already exists in the document; existing script parameters will be used";
64
- const V0_URL = "https://connect-js.stripe.com/v0.1/connect.js";
49
+ const V0_URL = "https://connect-js.stripe.com/v1.0/connect.js";
65
50
 
66
51
  export const findScript = (): HTMLScriptElement | null => {
67
52
  return (
@@ -73,7 +58,7 @@ export const findScript = (): HTMLScriptElement | null => {
73
58
 
74
59
  const injectScript = (): HTMLScriptElement => {
75
60
  const script = document.createElement("script");
76
- script.src = "https://connect-js.stripe.com/v0.1/connect.js";
61
+ script.src = "https://connect-js.stripe.com/v1.0/connect.js";
77
62
 
78
63
  const head = document.head;
79
64
 
@@ -193,6 +178,12 @@ export const initStripeConnect = (
193
178
  element.style.display = oldDisplay;
194
179
  }
195
180
 
181
+ if (!element || !(element as any).setConnector) {
182
+ throw new Error(
183
+ `Element ${tagName} was not transformed into a custom element. Are you using a documented component? See https://docs.stripe.com/connect/supported-embedded-components for a list of supported components`
184
+ );
185
+ }
186
+
196
187
  (element as any).setConnector((instance as any).connect);
197
188
  });
198
189
 
@@ -1,4 +1,4 @@
1
1
  export const SCRIPT_SELECTOR =
2
- 'script[src^="https://connect-js.stripe.com/v0.1/connect.js"]';
2
+ 'script[src^="https://connect-js.stripe.com/v1.0/connect.js"]';
3
3
 
4
4
  export {};
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
@@ -44,26 +31,11 @@ export const ConnectElementCustomMethodConfig = {
44
31
  "notification-banner": {
45
32
  setCollectionOptions: (
46
33
  _collectionOptions: CollectionOptions | undefined
47
- ): void => {}
48
- },
49
- "issuing-card": {
50
- setDefaultCard: (_defaultCard: string | undefined): void => {},
51
- setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
52
- setCardSwitching: (_cardSwitching: boolean | undefined): void => {},
53
- setFetchEphemeralKey: (
54
- _fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
55
- ): void => {}
56
- },
57
- "issuing-cards-list": {
58
- setCardArtFileLink: (_cardArtFileLink: string | undefined): void => {},
59
- setFetchEphemeralKey: (
60
- _fetchEphemeralKey: FetchEphemeralKeyFunction | undefined
61
- ): void => {}
62
- },
63
- "financial-account": {
64
- setFinancialAccount: (_financialAccount: string): void => {}
34
+ ): void => {},
35
+ setOnNotificationsChange: (_listener: (() => void) | undefined): void => {}
65
36
  },
66
- "financial-account-transactions": {
67
- setFinancialAccount: (_financialAccount: string): void => {}
37
+ "payment-details": {
38
+ setPayment: (_payment: string | undefined): void => {},
39
+ setOnClose: (_listener: (() => void) | undefined): void => {}
68
40
  }
69
41
  };
package/types/shared.d.ts CHANGED
@@ -447,19 +447,12 @@ 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
- | "account-onboarding"
454
- | "payment-method-settings"
455
453
  | "account-management"
456
454
  | "notification-banner"
457
- | "instant-payouts"
458
- | "issuing-card"
459
- | "issuing-cards-list"
460
- | "financial-account"
461
- | "financial-account-transactions"
462
- | "capital-overview"
463
- | "documents"
464
- | "tax-registrations"
465
- | "tax-settings";
455
+ | "payouts"
456
+ | "payouts-list"
457
+ | "balances"
458
+ | "documents";