@pelcro/react-pelcro-js 4.0.0-alpha.93 → 4.0.0-alpha.94

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
@@ -21772,9 +21772,9 @@ const ImageSelect = ({
21772
21772
  ...props
21773
21773
  }) => {
21774
21774
  const options = optionsArray.map(option => ({
21775
- value: option.id,
21776
- label: option.name,
21777
- image: option.image
21775
+ value: option === null || option === void 0 ? void 0 : option.id,
21776
+ label: option === null || option === void 0 ? void 0 : option.name,
21777
+ image: option === null || option === void 0 ? void 0 : option.image
21778
21778
  }));
21779
21779
  return /*#__PURE__*/React__default['default'].createElement(StateManagedSelect$1, Object.assign({
21780
21780
  className: "plc-px-5",
@@ -26988,13 +26988,16 @@ class SelectModal extends React.Component {
26988
26988
  disableGifting
26989
26989
  } = this.props;
26990
26990
  const items = this.state.planList.map(plan => {
26991
- var _plan$entitlements, _this$state;
26991
+ var _this$state;
26992
26992
 
26993
26993
  // const isChecked = this.state.plan.id === plan.id ? true : false;
26994
26994
  let itemsArray = [];
26995
26995
 
26996
- if (plan.entitlements && ((_plan$entitlements = plan.entitlements) === null || _plan$entitlements === void 0 ? void 0 : _plan$entitlements.length) > 0) {
26997
- itemsArray = plan.entitlements.map(itemSkuId => window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId)));
26996
+ if (plan.entitlements && plan.entitlements.length > 0) {
26997
+ itemsArray = plan.entitlements.map(itemSkuId => {
26998
+ const skuNumber = Number(itemSkuId);
26999
+ return isNaN(skuNumber) ? null : window.Pelcro.ecommerce.products.getBySkuId(skuNumber);
27000
+ }).filter(item => item !== null);
26998
27001
  }
26999
27002
 
27000
27003
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -27013,7 +27016,7 @@ class SelectModal extends React.Component {
27013
27016
  className: "plc-px-8 plc-py-6 plc-text-center plc-w-full"
27014
27017
  }, /*#__PURE__*/React__default['default'].createElement("p", {
27015
27018
  className: "plc-text-xs plc-mt-1 pelcro-select-plan-description plc-text-gray-500"
27016
- }, plan.description)), plan.entitlements && /*#__PURE__*/React__default['default'].createElement(ImageSelect, {
27019
+ }, plan.description)), plan.entitlements && itemsArray && itemsArray.length > 0 && /*#__PURE__*/React__default['default'].createElement(ImageSelect, {
27017
27020
  optionsArray: itemsArray,
27018
27021
  onChange: e => {
27019
27022
  console.log(e.value);
package/dist/index.esm.js CHANGED
@@ -21742,9 +21742,9 @@ const ImageSelect = ({
21742
21742
  ...props
21743
21743
  }) => {
21744
21744
  const options = optionsArray.map(option => ({
21745
- value: option.id,
21746
- label: option.name,
21747
- image: option.image
21745
+ value: option === null || option === void 0 ? void 0 : option.id,
21746
+ label: option === null || option === void 0 ? void 0 : option.name,
21747
+ image: option === null || option === void 0 ? void 0 : option.image
21748
21748
  }));
21749
21749
  return /*#__PURE__*/React__default.createElement(StateManagedSelect$1, Object.assign({
21750
21750
  className: "plc-px-5",
@@ -26958,13 +26958,16 @@ class SelectModal extends Component {
26958
26958
  disableGifting
26959
26959
  } = this.props;
26960
26960
  const items = this.state.planList.map(plan => {
26961
- var _plan$entitlements, _this$state;
26961
+ var _this$state;
26962
26962
 
26963
26963
  // const isChecked = this.state.plan.id === plan.id ? true : false;
26964
26964
  let itemsArray = [];
26965
26965
 
26966
- if (plan.entitlements && ((_plan$entitlements = plan.entitlements) === null || _plan$entitlements === void 0 ? void 0 : _plan$entitlements.length) > 0) {
26967
- itemsArray = plan.entitlements.map(itemSkuId => window.Pelcro.ecommerce.products.getBySkuId(Number(itemSkuId)));
26966
+ if (plan.entitlements && plan.entitlements.length > 0) {
26967
+ itemsArray = plan.entitlements.map(itemSkuId => {
26968
+ const skuNumber = Number(itemSkuId);
26969
+ return isNaN(skuNumber) ? null : window.Pelcro.ecommerce.products.getBySkuId(skuNumber);
26970
+ }).filter(item => item !== null);
26968
26971
  }
26969
26972
 
26970
26973
  return /*#__PURE__*/React__default.createElement("div", {
@@ -26983,7 +26986,7 @@ class SelectModal extends Component {
26983
26986
  className: "plc-px-8 plc-py-6 plc-text-center plc-w-full"
26984
26987
  }, /*#__PURE__*/React__default.createElement("p", {
26985
26988
  className: "plc-text-xs plc-mt-1 pelcro-select-plan-description plc-text-gray-500"
26986
- }, plan.description)), plan.entitlements && /*#__PURE__*/React__default.createElement(ImageSelect, {
26989
+ }, plan.description)), plan.entitlements && itemsArray && itemsArray.length > 0 && /*#__PURE__*/React__default.createElement(ImageSelect, {
26987
26990
  optionsArray: itemsArray,
26988
26991
  onChange: e => {
26989
26992
  console.log(e.value);
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": "4.0.0-alpha.93",
4
+ "version": "4.0.0-alpha.94",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",