@pelcro/react-pelcro-js 3.23.0-beta.1 → 3.23.0-beta.3

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
@@ -17427,19 +17427,26 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17427
17427
 
17428
17428
  /*====== Start Cybersource integration ========*/
17429
17429
  const cybersourceErrorHandle = err => {
17430
- var _err$details, _err$details$response;
17431
- const errorMessages = [];
17432
-
17433
- // enumerable error (ex: validation errors)
17434
- Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
17435
- let {
17436
- message
17437
- } = _ref2;
17438
- errorMessages.push(message);
17439
- });
17430
+ console.log("Starting handling the error");
17431
+ if (err.details.length > 0) {
17432
+ var _err$details, _err$details$response;
17433
+ console.log("error.details has items");
17434
+ const errorMessages = [];
17435
+
17436
+ // enumerable error (ex: validation errors)
17437
+ Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
17438
+ let {
17439
+ message
17440
+ } = _ref2;
17441
+ errorMessages.push(message);
17442
+ });
17440
17443
 
17441
- // convert to multiline string
17442
- return errorMessages.join("\n");
17444
+ // convert to multiline string
17445
+ return errorMessages.join("\n");
17446
+ } else {
17447
+ console.log("Handling the error the normal way");
17448
+ return getErrorMessages(err);
17449
+ }
17443
17450
  };
17444
17451
  const submitUsingCybersource = (state, dispatch) => {
17445
17452
  var _cybersourceInstanceR;
@@ -19621,12 +19628,12 @@ const CheckoutForm = () => {
19621
19628
  className: "plc-w-6/12 plc-pr-4"
19622
19629
  }, /*#__PURE__*/React__default['default'].createElement(MonthSelect, {
19623
19630
  store: store$k,
19624
- placeholder: "Exp Month"
19631
+ placeholder: "Exp Month *"
19625
19632
  })), /*#__PURE__*/React__default['default'].createElement("div", {
19626
19633
  className: "plc-w-6/12"
19627
19634
  }, /*#__PURE__*/React__default['default'].createElement(YearSelect, {
19628
19635
  store: store$k,
19629
- placeholder: "Exp Year"
19636
+ placeholder: "Exp Year *"
19630
19637
  }))));
19631
19638
  }
19632
19639
  if (cardProcessor === "stripe") {
@@ -19689,7 +19696,7 @@ const DiscountedPrice = props => {
19689
19696
  };
19690
19697
 
19691
19698
  const SubmitPaymentMethod = _ref => {
19692
- var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r;
19699
+ var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r, _window$Pelcro$site$r2;
19693
19700
  let {
19694
19701
  onClick,
19695
19702
  ...otherProps
@@ -19715,13 +19722,16 @@ const SubmitPaymentMethod = _ref => {
19715
19722
  phone,
19716
19723
  disableSubmit,
19717
19724
  isLoading,
19718
- updatedPrice
19725
+ updatedPrice,
19726
+ month,
19727
+ year
19719
19728
  }
19720
19729
  } = React.useContext(store$k);
19721
19730
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19722
19731
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
19723
19732
  const priceFormatted = (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19724
19733
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19734
+ const supportsCybersource = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.cybersource_gateway_settings);
19725
19735
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
19726
19736
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
19727
19737
  const isUserPhone = Boolean(window.Pelcro.user.read().phone);
@@ -19730,9 +19740,9 @@ const SubmitPaymentMethod = _ref => {
19730
19740
  if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
19731
19741
  setDisabled(disableSubmit);
19732
19742
  } else {
19733
- setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError);
19743
+ setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError || supportsCybersource && !(month !== null && month !== void 0 && month.length) || supportsCybersource && !(year !== null && year !== void 0 && year.length));
19734
19744
  }
19735
- }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
19745
+ }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError, month, year]);
19736
19746
  return /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
19737
19747
  role: "submit",
19738
19748
  className: "plc-w-full plc-py-3",
package/dist/index.esm.js CHANGED
@@ -17397,19 +17397,26 @@ const PaymentMethodContainerWithoutStripe = _ref => {
17397
17397
 
17398
17398
  /*====== Start Cybersource integration ========*/
17399
17399
  const cybersourceErrorHandle = err => {
17400
- var _err$details, _err$details$response;
17401
- const errorMessages = [];
17402
-
17403
- // enumerable error (ex: validation errors)
17404
- Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
17405
- let {
17406
- message
17407
- } = _ref2;
17408
- errorMessages.push(message);
17409
- });
17400
+ console.log("Starting handling the error");
17401
+ if (err.details.length > 0) {
17402
+ var _err$details, _err$details$response;
17403
+ console.log("error.details has items");
17404
+ const errorMessages = [];
17405
+
17406
+ // enumerable error (ex: validation errors)
17407
+ Object.values(err === null || err === void 0 ? void 0 : (_err$details = err.details) === null || _err$details === void 0 ? void 0 : (_err$details$response = _err$details.responseStatus) === null || _err$details$response === void 0 ? void 0 : _err$details$response.details).forEach(_ref2 => {
17408
+ let {
17409
+ message
17410
+ } = _ref2;
17411
+ errorMessages.push(message);
17412
+ });
17410
17413
 
17411
- // convert to multiline string
17412
- return errorMessages.join("\n");
17414
+ // convert to multiline string
17415
+ return errorMessages.join("\n");
17416
+ } else {
17417
+ console.log("Handling the error the normal way");
17418
+ return getErrorMessages(err);
17419
+ }
17413
17420
  };
17414
17421
  const submitUsingCybersource = (state, dispatch) => {
17415
17422
  var _cybersourceInstanceR;
@@ -19591,12 +19598,12 @@ const CheckoutForm = () => {
19591
19598
  className: "plc-w-6/12 plc-pr-4"
19592
19599
  }, /*#__PURE__*/React__default.createElement(MonthSelect, {
19593
19600
  store: store$k,
19594
- placeholder: "Exp Month"
19601
+ placeholder: "Exp Month *"
19595
19602
  })), /*#__PURE__*/React__default.createElement("div", {
19596
19603
  className: "plc-w-6/12"
19597
19604
  }, /*#__PURE__*/React__default.createElement(YearSelect, {
19598
19605
  store: store$k,
19599
- placeholder: "Exp Year"
19606
+ placeholder: "Exp Year *"
19600
19607
  }))));
19601
19608
  }
19602
19609
  if (cardProcessor === "stripe") {
@@ -19659,7 +19666,7 @@ const DiscountedPrice = props => {
19659
19666
  };
19660
19667
 
19661
19668
  const SubmitPaymentMethod = _ref => {
19662
- var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r;
19669
+ var _plan$quantity, _plan$quantity2, _plan$quantity3, _window$Pelcro$site$r, _window$Pelcro$site$r2;
19663
19670
  let {
19664
19671
  onClick,
19665
19672
  ...otherProps
@@ -19685,13 +19692,16 @@ const SubmitPaymentMethod = _ref => {
19685
19692
  phone,
19686
19693
  disableSubmit,
19687
19694
  isLoading,
19688
- updatedPrice
19695
+ updatedPrice,
19696
+ month,
19697
+ year
19689
19698
  }
19690
19699
  } = useContext(store$k);
19691
19700
  const planQuantity = (_plan$quantity = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity !== void 0 ? _plan$quantity : 1;
19692
19701
  const price = updatedPrice !== null && updatedPrice !== void 0 ? updatedPrice : plan === null || plan === void 0 ? void 0 : plan.amount;
19693
19702
  const priceFormatted = (plan === null || plan === void 0 ? void 0 : plan.type) === "donation" && (selectedDonationAmount || customDonationAmount) ? getFormattedPriceByLocal(selectedDonationAmount ? selectedDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity2 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity2 !== void 0 ? _plan$quantity2 : 1) : customDonationAmount * (plan === null || plan === void 0 ? void 0 : plan.amount) * ((_plan$quantity3 = plan === null || plan === void 0 ? void 0 : plan.quantity) !== null && _plan$quantity3 !== void 0 ? _plan$quantity3 : 1), plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage()) : getFormattedPriceByLocal(price * planQuantity, plan === null || plan === void 0 ? void 0 : plan.currency, getPageOrDefaultLanguage());
19694
19703
  const supportsTap = Boolean((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings);
19704
+ const supportsCybersource = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.cybersource_gateway_settings);
19695
19705
  const isUserFirstName = Boolean(window.Pelcro.user.read().first_name);
19696
19706
  const isUserLastName = Boolean(window.Pelcro.user.read().last_name);
19697
19707
  const isUserPhone = Boolean(window.Pelcro.user.read().phone);
@@ -19700,9 +19710,9 @@ const SubmitPaymentMethod = _ref => {
19700
19710
  if (supportsTap && isUserFirstName && isUserLastName && isUserPhone) {
19701
19711
  setDisabled(disableSubmit);
19702
19712
  } else {
19703
- setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError);
19713
+ setDisabled(disableSubmit || supportsTap && firstNameError || supportsTap && lastNameError || supportsTap && phoneError || supportsTap && !(firstName !== null && firstName !== void 0 && firstName.length) || supportsTap && !(lastName !== null && lastName !== void 0 && lastName.length) || supportsTap && !(phone !== null && phone !== void 0 && phone.length) || emailError || passwordError || supportsCybersource && !(month !== null && month !== void 0 && month.length) || supportsCybersource && !(year !== null && year !== void 0 && year.length));
19704
19714
  }
19705
- }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError]);
19715
+ }, [disableSubmit, firstNameError, lastNameError, phoneError, firstName, lastName, phone, emailError, passwordError, month, year]);
19706
19716
  return /*#__PURE__*/React__default.createElement(Button, Object.assign({
19707
19717
  role: "submit",
19708
19718
  className: "plc-w-full plc-py-3",
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.23.0-beta.1",
4
+ "version": "3.23.0-beta.3",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",