create-brainerce-store 1.12.1 → 1.12.2

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/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "create-brainerce-store",
34
- version: "1.12.1",
34
+ version: "1.12.2",
35
35
  description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
36
36
  bin: {
37
37
  "create-brainerce-store": "dist/index.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -191,6 +191,18 @@ export function PaymentStep({ checkoutId, className }: PaymentStepProps) {
191
191
  return;
192
192
  }
193
193
 
194
+ // Already loading (from a previous call)? Wait for it instead of duplicating
195
+ if (document.querySelector(`script[src="${sdk.scriptUrl}"]`)) {
196
+ const waitId = setInterval(() => {
197
+ if ((window as any)[sdk.globalName!]) {
198
+ clearInterval(waitId);
199
+ initSdk(sdk);
200
+ }
201
+ }, 100);
202
+ cleanups.push(() => clearInterval(waitId));
203
+ return;
204
+ }
205
+
194
206
  // Load main SDK — insertBefore first <script> as Grow docs show
195
207
  const s = document.createElement('script');
196
208
  s.type = 'text/javascript';