@stripe/connect-js 3.3.2-beta-1 → 3.3.3-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.
@@ -127,6 +127,19 @@ const initStripeConnect = (stripePromise, initParams) => {
127
127
  }
128
128
  }
129
129
  stripeConnectInstance.then(instance => {
130
+ if (!element.isConnected && !element.setConnector) {
131
+ // If the element is not connected to the DOM and the `setConnector` method is not
132
+ // defined, this indicates the element was created before connect.js was loaded, and has
133
+ // not been transformed into a custom element yet
134
+ // To load the custom element code on it, we need to connect and disconnect it to the DOM
135
+ // This isn't a problem, as the element will be invisible, and we know the element is already
136
+ // not currently connected to the DOM
137
+ const oldDisplay = element.style.display;
138
+ element.style.display = "none";
139
+ document.body.appendChild(element);
140
+ document.body.removeChild(element);
141
+ element.style.display = oldDisplay;
142
+ }
130
143
  element.setConnector(instance.connect);
131
144
  });
132
145
  return element;
@@ -158,7 +171,7 @@ const createWrapper = stripeConnect => {
158
171
  sdk: true,
159
172
  sdkOptions: {
160
173
  // This will be replaced by the npm package version when bundling
161
- sdkVersion: "3.3.2-beta-1"
174
+ sdkVersion: "3.3.3-beta-1"
162
175
  }
163
176
  })
164
177
  }));
package/dist/connect.js CHANGED
@@ -131,6 +131,19 @@ const initStripeConnect = (stripePromise, initParams) => {
131
131
  }
132
132
  }
133
133
  stripeConnectInstance.then(instance => {
134
+ if (!element.isConnected && !element.setConnector) {
135
+ // If the element is not connected to the DOM and the `setConnector` method is not
136
+ // defined, this indicates the element was created before connect.js was loaded, and has
137
+ // not been transformed into a custom element yet
138
+ // To load the custom element code on it, we need to connect and disconnect it to the DOM
139
+ // This isn't a problem, as the element will be invisible, and we know the element is already
140
+ // not currently connected to the DOM
141
+ const oldDisplay = element.style.display;
142
+ element.style.display = "none";
143
+ document.body.appendChild(element);
144
+ document.body.removeChild(element);
145
+ element.style.display = oldDisplay;
146
+ }
134
147
  element.setConnector(instance.connect);
135
148
  });
136
149
  return element;
@@ -162,7 +175,7 @@ const createWrapper = stripeConnect => {
162
175
  sdk: true,
163
176
  sdkOptions: {
164
177
  // This will be replaced by the npm package version when bundling
165
- sdkVersion: "3.3.2-beta-1"
178
+ sdkVersion: "3.3.3-beta-1"
166
179
  }
167
180
  })
168
181
  }));
package/dist/pure.esm.js CHANGED
@@ -127,6 +127,19 @@ const initStripeConnect = (stripePromise, initParams) => {
127
127
  }
128
128
  }
129
129
  stripeConnectInstance.then(instance => {
130
+ if (!element.isConnected && !element.setConnector) {
131
+ // If the element is not connected to the DOM and the `setConnector` method is not
132
+ // defined, this indicates the element was created before connect.js was loaded, and has
133
+ // not been transformed into a custom element yet
134
+ // To load the custom element code on it, we need to connect and disconnect it to the DOM
135
+ // This isn't a problem, as the element will be invisible, and we know the element is already
136
+ // not currently connected to the DOM
137
+ const oldDisplay = element.style.display;
138
+ element.style.display = "none";
139
+ document.body.appendChild(element);
140
+ document.body.removeChild(element);
141
+ element.style.display = oldDisplay;
142
+ }
130
143
  element.setConnector(instance.connect);
131
144
  });
132
145
  return element;
@@ -158,7 +171,7 @@ const createWrapper = stripeConnect => {
158
171
  sdk: true,
159
172
  sdkOptions: {
160
173
  // This will be replaced by the npm package version when bundling
161
- sdkVersion: "3.3.2-beta-1"
174
+ sdkVersion: "3.3.3-beta-1"
162
175
  }
163
176
  })
164
177
  }));
package/dist/pure.js CHANGED
@@ -131,6 +131,19 @@ const initStripeConnect = (stripePromise, initParams) => {
131
131
  }
132
132
  }
133
133
  stripeConnectInstance.then(instance => {
134
+ if (!element.isConnected && !element.setConnector) {
135
+ // If the element is not connected to the DOM and the `setConnector` method is not
136
+ // defined, this indicates the element was created before connect.js was loaded, and has
137
+ // not been transformed into a custom element yet
138
+ // To load the custom element code on it, we need to connect and disconnect it to the DOM
139
+ // This isn't a problem, as the element will be invisible, and we know the element is already
140
+ // not currently connected to the DOM
141
+ const oldDisplay = element.style.display;
142
+ element.style.display = "none";
143
+ document.body.appendChild(element);
144
+ document.body.removeChild(element);
145
+ element.style.display = oldDisplay;
146
+ }
134
147
  element.setConnector(instance.connect);
135
148
  });
136
149
  return element;
@@ -162,7 +175,7 @@ const createWrapper = stripeConnect => {
162
175
  sdk: true,
163
176
  sdkOptions: {
164
177
  // This will be replaced by the npm package version when bundling
165
- sdkVersion: "3.3.2-beta-1"
178
+ sdkVersion: "3.3.3-beta-1"
166
179
  }
167
180
  })
168
181
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/connect-js",
3
- "version": "3.3.2-beta-1",
3
+ "version": "3.3.3-beta-1",
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
@@ -171,6 +171,22 @@ export const initStripeConnect = (
171
171
  }
172
172
 
173
173
  stripeConnectInstance.then(instance => {
174
+ if (!element.isConnected && !(element as any).setConnector) {
175
+ // If the element is not connected to the DOM and the `setConnector` method is not
176
+ // defined, this indicates the element was created before connect.js was loaded, and has
177
+ // not been transformed into a custom element yet
178
+
179
+ // To load the custom element code on it, we need to connect and disconnect it to the DOM
180
+ // This isn't a problem, as the element will be invisible, and we know the element is already
181
+ // not currently connected to the DOM
182
+
183
+ const oldDisplay = element.style.display;
184
+ element.style.display = "none";
185
+ document.body.appendChild(element);
186
+ document.body.removeChild(element);
187
+ element.style.display = oldDisplay;
188
+ }
189
+
174
190
  (element as any).setConnector((instance as any).connect);
175
191
  });
176
192