@pelcro/react-pelcro-js 3.21.4 → 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
  }
@@ -16364,7 +16404,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16364
16404
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16365
16405
  if (isUsingExistingPaymentMethod) {
16366
16406
  // no need to create a new source using tap
16367
- return handleTapPayment(null);
16407
+ return handleTapPayment(null, state);
16368
16408
  }
16369
16409
  if (!tapInstanceRef.current) {
16370
16410
  return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
@@ -16649,7 +16689,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16649
16689
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16650
16690
  if (isUsingExistingPaymentMethod) {
16651
16691
  // no need to create a new source using vantiv
16652
- return handleVantivPayment(null);
16692
+ return handleVantivPayment(null, state.couponCode);
16653
16693
  }
16654
16694
  if (!vantivInstanceRef.current) {
16655
16695
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
@@ -17759,7 +17799,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17759
17799
  isLoading: true
17760
17800
  }, (state, dispatch) => {
17761
17801
  if (getSiteCardProcessor() === "vantiv") {
17762
- return submitUsingVantiv();
17802
+ return submitUsingVantiv(state);
17763
17803
  }
17764
17804
  if (getSiteCardProcessor() === "tap") {
17765
17805
  return submitUsingTap(state);
@@ -21395,6 +21435,7 @@ const AddressCreateContainer = _ref => {
21395
21435
  first_name: firstName,
21396
21436
  last_name: lastName,
21397
21437
  line1: line1,
21438
+ line2: line2,
21398
21439
  city: city,
21399
21440
  state: state,
21400
21441
  country: country,
@@ -22222,6 +22263,7 @@ const AddressUpdateContainer = _ref => {
22222
22263
  first_name: firstName,
22223
22264
  last_name: lastName,
22224
22265
  line1: line1,
22266
+ line2: line2,
22225
22267
  city: city,
22226
22268
  state: state,
22227
22269
  country: country,
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
  }
@@ -16334,7 +16374,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16334
16374
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16335
16375
  if (isUsingExistingPaymentMethod) {
16336
16376
  // no need to create a new source using tap
16337
- return handleTapPayment(null);
16377
+ return handleTapPayment(null, state);
16338
16378
  }
16339
16379
  if (!tapInstanceRef.current) {
16340
16380
  return console.error("Tap sdk script wasn't loaded, you need to load tap sdk before rendering the tap payment flow");
@@ -16619,7 +16659,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16619
16659
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16620
16660
  if (isUsingExistingPaymentMethod) {
16621
16661
  // no need to create a new source using vantiv
16622
- return handleVantivPayment(null);
16662
+ return handleVantivPayment(null, state.couponCode);
16623
16663
  }
16624
16664
  if (!vantivInstanceRef.current) {
16625
16665
  return console.error("Vantiv sdk script wasn't loaded, you need to load vantiv sdk before rendering the vantiv payment flow");
@@ -17729,7 +17769,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17729
17769
  isLoading: true
17730
17770
  }, (state, dispatch) => {
17731
17771
  if (getSiteCardProcessor() === "vantiv") {
17732
- return submitUsingVantiv();
17772
+ return submitUsingVantiv(state);
17733
17773
  }
17734
17774
  if (getSiteCardProcessor() === "tap") {
17735
17775
  return submitUsingTap(state);
@@ -21365,6 +21405,7 @@ const AddressCreateContainer = _ref => {
21365
21405
  first_name: firstName,
21366
21406
  last_name: lastName,
21367
21407
  line1: line1,
21408
+ line2: line2,
21368
21409
  city: city,
21369
21410
  state: state,
21370
21411
  country: country,
@@ -22192,6 +22233,7 @@ const AddressUpdateContainer = _ref => {
22192
22233
  first_name: firstName,
22193
22234
  last_name: lastName,
22194
22235
  line1: line1,
22236
+ line2: line2,
22195
22237
  city: city,
22196
22238
  state: state,
22197
22239
  country: country,
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.4",
4
+ "version": "3.21.6",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",