@pelcro/react-pelcro-js 3.21.5 → 3.21.6

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.cjs.js CHANGED
@@ -11141,6 +11141,9 @@ const initViewFromURL = () => {
11141
11141
  if (view === "manage-members") {
11142
11142
  return showSubscriptionManageMembersFromUrl();
11143
11143
  }
11144
+ if (view === "payment-method-update") {
11145
+ return showPaymentMethodUpdateFromUrl();
11146
+ }
11144
11147
  switchView(view);
11145
11148
  });
11146
11149
  }
@@ -11349,6 +11352,43 @@ const showPasswordlessRequestFromUrl = () => {
11349
11352
  } = usePelcro.getStore();
11350
11353
  return switchView("passwordless-request");
11351
11354
  };
11355
+ const showPaymentMethodUpdateFromUrl = () => {
11356
+ const {
11357
+ isAuthenticated,
11358
+ whenSiteReady,
11359
+ whenUserReady,
11360
+ switchView
11361
+ } = usePelcro.getStore();
11362
+ whenSiteReady(() => {
11363
+ if (!isAuthenticated()) {
11364
+ return switchView("login");
11365
+ }
11366
+ whenUserReady(() => {
11367
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11368
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11369
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11370
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
11371
+ return switchView("payment-method-update");
11372
+ });
11373
+ return;
11374
+ }
11375
+
11376
+ //vantiv
11377
+ if (supportsVantiv) {
11378
+ document.querySelector("#vantiv-eprotect-sdk").addEventListener("load", () => {
11379
+ return switchView("payment-method-update");
11380
+ });
11381
+ return;
11382
+ }
11383
+
11384
+ //Tap
11385
+ if (supportsTap && document.querySelector("#tap-sdk")) {
11386
+ return switchView("payment-method-update");
11387
+ }
11388
+ return switchView("payment-method-update");
11389
+ });
11390
+ });
11391
+ };
11352
11392
  const showInvoiceDetailsFromUrl = () => {
11353
11393
  const {
11354
11394
  isAuthenticated,
@@ -13261,7 +13301,7 @@ function LoginModal(_ref) {
13261
13301
  }
13262
13302
  resetView();
13263
13303
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13264
- const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13304
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
13265
13305
  if (viewsURLs.includes(viewFromURL)) {
13266
13306
  initViewFromURL();
13267
13307
  }
package/dist/index.esm.js CHANGED
@@ -11111,6 +11111,9 @@ const initViewFromURL = () => {
11111
11111
  if (view === "manage-members") {
11112
11112
  return showSubscriptionManageMembersFromUrl();
11113
11113
  }
11114
+ if (view === "payment-method-update") {
11115
+ return showPaymentMethodUpdateFromUrl();
11116
+ }
11114
11117
  switchView(view);
11115
11118
  });
11116
11119
  }
@@ -11319,6 +11322,43 @@ const showPasswordlessRequestFromUrl = () => {
11319
11322
  } = usePelcro.getStore();
11320
11323
  return switchView("passwordless-request");
11321
11324
  };
11325
+ const showPaymentMethodUpdateFromUrl = () => {
11326
+ const {
11327
+ isAuthenticated,
11328
+ whenSiteReady,
11329
+ whenUserReady,
11330
+ switchView
11331
+ } = usePelcro.getStore();
11332
+ whenSiteReady(() => {
11333
+ if (!isAuthenticated()) {
11334
+ return switchView("login");
11335
+ }
11336
+ whenUserReady(() => {
11337
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
11338
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
11339
+ if (!window.Stripe && !supportsVantiv && !supportsTap) {
11340
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
11341
+ return switchView("payment-method-update");
11342
+ });
11343
+ return;
11344
+ }
11345
+
11346
+ //vantiv
11347
+ if (supportsVantiv) {
11348
+ document.querySelector("#vantiv-eprotect-sdk").addEventListener("load", () => {
11349
+ return switchView("payment-method-update");
11350
+ });
11351
+ return;
11352
+ }
11353
+
11354
+ //Tap
11355
+ if (supportsTap && document.querySelector("#tap-sdk")) {
11356
+ return switchView("payment-method-update");
11357
+ }
11358
+ return switchView("payment-method-update");
11359
+ });
11360
+ });
11361
+ };
11322
11362
  const showInvoiceDetailsFromUrl = () => {
11323
11363
  const {
11324
11364
  isAuthenticated,
@@ -13231,7 +13271,7 @@ function LoginModal(_ref) {
13231
13271
  }
13232
13272
  resetView();
13233
13273
  const viewFromURL = getStableViewID(window.Pelcro.helpers.getURLParameter("view"));
13234
- const viewsURLs = ["invoice-details", "gift-redeem", "plan-select"];
13274
+ const viewsURLs = ["invoice-details", "gift-redeem", "plan-select", "payment-method-update"];
13235
13275
  if (viewsURLs.includes(viewFromURL)) {
13236
13276
  initViewFromURL();
13237
13277
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.21.5",
4
+ "version": "3.21.6",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",