@pelcro/react-pelcro-js 3.22.0-beta.3 → 3.22.0-beta.5

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
@@ -14079,7 +14079,6 @@ class SelectModal extends React.Component {
14079
14079
  });
14080
14080
  });
14081
14081
  });
14082
- console.log("bugsnag Triggered");
14083
14082
  }
14084
14083
  });
14085
14084
  _defineProperty$3(this, "componentWillUnmount", () => {
@@ -16397,7 +16396,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16397
16396
  }, []);
16398
16397
 
16399
16398
  /*====== Start Tap integration ========*/
16400
- const submitUsingTap = () => {
16399
+ const submitUsingTap = state => {
16401
16400
  var _ref2, _ref3, _ref4, _state$updatedPrice;
16402
16401
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16403
16402
  if (isUsingExistingPaymentMethod) {
@@ -16492,7 +16491,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16492
16491
  content: null
16493
16492
  }
16494
16493
  });
16495
- handleTapPayment(tapID);
16494
+ handleTapPayment(tapID, state);
16496
16495
  }
16497
16496
  };
16498
16497
 
@@ -16505,7 +16504,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16505
16504
  }
16506
16505
  });
16507
16506
  };
16508
- function handleTapPayment(paymentRequest) {
16507
+ function handleTapPayment(paymentRequest, state) {
16509
16508
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16510
16509
  if (type === "createPayment") {
16511
16510
  handleTapSubscription();
@@ -16683,7 +16682,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16683
16682
  };
16684
16683
  /*====== End Tap integration ========*/
16685
16684
 
16686
- const submitUsingVantiv = () => {
16685
+ const submitUsingVantiv = state => {
16687
16686
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16688
16687
  if (isUsingExistingPaymentMethod) {
16689
16688
  // no need to create a new source using vantiv
@@ -16696,12 +16695,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16696
16695
  /*
16697
16696
  calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
16698
16697
  */
16699
- vantivInstanceRef.current.getPaypageRegistrationId({
16698
+ handleVantivPayment(vantivInstanceRef.current.getPaypageRegistrationId({
16700
16699
  id: orderId,
16701
16700
  orderId: orderId
16702
- });
16701
+ }), state);
16703
16702
  };
16704
- function handleVantivPayment(paymentRequest) {
16703
+ function handleVantivPayment(paymentRequest, state) {
16705
16704
  if (paymentRequest) {
16706
16705
  const SUCCESS_STATUS = "870";
16707
16706
  if (paymentRequest.response !== SUCCESS_STATUS) {
@@ -16767,7 +16766,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16767
16766
  const renewSubscription = !isGift && subscriptionIdToRenew;
16768
16767
  const giftSubscriprition = isGift && !subscriptionIdToRenew;
16769
16768
  const renewGift = isRenewingGift;
16770
- const couponCode = state.couponCode || window.Pelcro.coupon.getFromUrl() || "";
16769
+ const {
16770
+ couponCode
16771
+ } = state;
16771
16772
  if (renewGift) {
16772
16773
  return payment.execute({
16773
16774
  type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
@@ -17804,11 +17805,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17804
17805
  disableSubmit: true,
17805
17806
  isLoading: true
17806
17807
  }, (state, dispatch) => {
17808
+ if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
17809
+ return submitPayment(state);
17810
+ }
17807
17811
  if (getSiteCardProcessor() === "vantiv") {
17808
- return submitUsingVantiv();
17812
+ return submitUsingVantiv(state);
17809
17813
  }
17810
17814
  if (getSiteCardProcessor() === "tap") {
17811
- return submitUsingTap();
17815
+ return submitUsingTap(state);
17812
17816
  }
17813
17817
  if (selectedPaymentMethodId) {
17814
17818
  // pay with selected method (source) if exists already
package/dist/index.esm.js CHANGED
@@ -14049,7 +14049,6 @@ class SelectModal extends Component {
14049
14049
  });
14050
14050
  });
14051
14051
  });
14052
- console.log("bugsnag Triggered");
14053
14052
  }
14054
14053
  });
14055
14054
  _defineProperty$3(this, "componentWillUnmount", () => {
@@ -16367,7 +16366,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16367
16366
  }, []);
16368
16367
 
16369
16368
  /*====== Start Tap integration ========*/
16370
- const submitUsingTap = () => {
16369
+ const submitUsingTap = state => {
16371
16370
  var _ref2, _ref3, _ref4, _state$updatedPrice;
16372
16371
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16373
16372
  if (isUsingExistingPaymentMethod) {
@@ -16462,7 +16461,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16462
16461
  content: null
16463
16462
  }
16464
16463
  });
16465
- handleTapPayment(tapID);
16464
+ handleTapPayment(tapID, state);
16466
16465
  }
16467
16466
  };
16468
16467
 
@@ -16475,7 +16474,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16475
16474
  }
16476
16475
  });
16477
16476
  };
16478
- function handleTapPayment(paymentRequest) {
16477
+ function handleTapPayment(paymentRequest, state) {
16479
16478
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16480
16479
  if (type === "createPayment") {
16481
16480
  handleTapSubscription();
@@ -16653,7 +16652,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16653
16652
  };
16654
16653
  /*====== End Tap integration ========*/
16655
16654
 
16656
- const submitUsingVantiv = () => {
16655
+ const submitUsingVantiv = state => {
16657
16656
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
16658
16657
  if (isUsingExistingPaymentMethod) {
16659
16658
  // no need to create a new source using vantiv
@@ -16666,12 +16665,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16666
16665
  /*
16667
16666
  calls handleVantivPayment to either handle a payment or update a source by simply creating a new source
16668
16667
  */
16669
- vantivInstanceRef.current.getPaypageRegistrationId({
16668
+ handleVantivPayment(vantivInstanceRef.current.getPaypageRegistrationId({
16670
16669
  id: orderId,
16671
16670
  orderId: orderId
16672
- });
16671
+ }), state);
16673
16672
  };
16674
- function handleVantivPayment(paymentRequest) {
16673
+ function handleVantivPayment(paymentRequest, state) {
16675
16674
  if (paymentRequest) {
16676
16675
  const SUCCESS_STATUS = "870";
16677
16676
  if (paymentRequest.response !== SUCCESS_STATUS) {
@@ -16737,7 +16736,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
16737
16736
  const renewSubscription = !isGift && subscriptionIdToRenew;
16738
16737
  const giftSubscriprition = isGift && !subscriptionIdToRenew;
16739
16738
  const renewGift = isRenewingGift;
16740
- const couponCode = state.couponCode || window.Pelcro.coupon.getFromUrl() || "";
16739
+ const {
16740
+ couponCode
16741
+ } = state;
16741
16742
  if (renewGift) {
16742
16743
  return payment.execute({
16743
16744
  type: PAYMENT_TYPES.RENEW_GIFTED_SUBSCRIPTION,
@@ -17774,11 +17775,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17774
17775
  disableSubmit: true,
17775
17776
  isLoading: true
17776
17777
  }, (state, dispatch) => {
17778
+ if (skipPayment && (order === null || order === void 0 ? void 0 : order.price) === 0) {
17779
+ return submitPayment(state);
17780
+ }
17777
17781
  if (getSiteCardProcessor() === "vantiv") {
17778
- return submitUsingVantiv();
17782
+ return submitUsingVantiv(state);
17779
17783
  }
17780
17784
  if (getSiteCardProcessor() === "tap") {
17781
- return submitUsingTap();
17785
+ return submitUsingTap(state);
17782
17786
  }
17783
17787
  if (selectedPaymentMethodId) {
17784
17788
  // pay with selected method (source) if exists already
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.22.0-beta.3",
4
+ "version": "3.22.0-beta.5",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",