@salesgenterp/ui-components 0.4.415 → 0.4.417

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.js CHANGED
@@ -623,6 +623,142 @@ var jsonParse = function jsonParse(value) {
623
623
  }
624
624
  return value;
625
625
  };
626
+ var convertToBoolean = function convertToBoolean(value) {
627
+ return lodash.toNumber(value) === 1;
628
+ };
629
+
630
+ function useSystemFeatureList(_ref) {
631
+ var apiEndPoint = _ref.apiEndPoint,
632
+ token = _ref.token,
633
+ moduleName = _ref.moduleName,
634
+ listUpdate = _ref.listUpdate;
635
+ var _useState = React.useState(),
636
+ data = _useState[0],
637
+ setData = _useState[1];
638
+ var _useState2 = React.useState(false),
639
+ loading = _useState2[0],
640
+ setLoading = _useState2[1];
641
+ var _useState3 = React.useState(false),
642
+ error = _useState3[0],
643
+ setError = _useState3[1];
644
+ var _useState4 = React.useState(false),
645
+ status = _useState4[0],
646
+ setStatus = _useState4[1];
647
+ React.useEffect(function () {
648
+ (function () {
649
+ try {
650
+ var _temp2 = function () {
651
+ if (apiEndPoint && token) {
652
+ setError(false);
653
+ setStatus(null);
654
+ setLoading(true);
655
+ var _temp = _catch(function () {
656
+ return Promise.resolve(getSystemFeatureList({
657
+ apiEndPoint: apiEndPoint,
658
+ token: token,
659
+ moduleName: moduleName
660
+ })).then(function (modifyData) {
661
+ setData(modifyData);
662
+ setLoading(false);
663
+ });
664
+ }, function () {
665
+ setLoading(false);
666
+ setError(true);
667
+ setStatus(403);
668
+ });
669
+ if (_temp && _temp.then) return _temp.then(function () {});
670
+ }
671
+ }();
672
+ return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
673
+ } catch (e) {
674
+ Promise.reject(e);
675
+ }
676
+ })();
677
+ }, [moduleName, listUpdate]);
678
+ return {
679
+ systemFeatureList: data,
680
+ systemFeatureListLoading: loading,
681
+ error: error,
682
+ status: status
683
+ };
684
+ }
685
+ function useAllSystemFeatureValues(_ref4) {
686
+ var apiEndPoint = _ref4.apiEndPoint,
687
+ token = _ref4.token,
688
+ listUpdate = _ref4.listUpdate;
689
+ var _useState13 = React.useState(),
690
+ data = _useState13[0],
691
+ setData = _useState13[1];
692
+ var _useState14 = React.useState(false),
693
+ setLoading = _useState14[1];
694
+ var _useState15 = React.useState(false),
695
+ setError = _useState15[1];
696
+ var _useState16 = React.useState(false),
697
+ setStatus = _useState16[1];
698
+ var _useSystemFeatureList3 = useSystemFeatureList({
699
+ apiEndPoint: apiEndPoint,
700
+ token: token,
701
+ listUpdate: listUpdate
702
+ }),
703
+ systemFeatureListData = _useSystemFeatureList3.systemFeatureList;
704
+ React.useEffect(function () {
705
+ try {
706
+ if (apiEndPoint && token && systemFeatureListData) {
707
+ setError(false);
708
+ setStatus(null);
709
+ setLoading(true);
710
+ try {
711
+ var flattenData = function flattenData(data) {
712
+ return lodash.reduce(data, function (acc, item) {
713
+ acc = lodash.concat(acc, lodash.omit(item, 'systemFeatureList'));
714
+ if (item !== null && item !== void 0 && item.systemFeatureList) {
715
+ acc = lodash.concat(acc, flattenData(item === null || item === void 0 ? void 0 : item.systemFeatureList));
716
+ }
717
+ return acc;
718
+ }, []);
719
+ };
720
+ var flatArray = flattenData(systemFeatureListData);
721
+ var result = lodash.reduce(flatArray, function (acc, item) {
722
+ if (item !== null && item !== void 0 && item.featureName) {
723
+ acc[item === null || item === void 0 ? void 0 : item.featureName] = isNaN(item === null || item === void 0 ? void 0 : item.featureValue) ? item === null || item === void 0 ? void 0 : item.featureValue : Number(item === null || item === void 0 ? void 0 : item.featureValue) === 0 || Number(item === null || item === void 0 ? void 0 : item.featureValue) === 1 ? convertToBoolean(Number(item === null || item === void 0 ? void 0 : item.featureValue)) : Number(item === null || item === void 0 ? void 0 : item.featureValue);
724
+ }
725
+ return acc;
726
+ }, {});
727
+ setData(result);
728
+ setLoading(false);
729
+ } catch (e) {
730
+ setLoading(false);
731
+ setError(true);
732
+ setStatus(403);
733
+ }
734
+ }
735
+ } catch (e) {
736
+ Promise.reject(e);
737
+ }
738
+ }, [listUpdate, systemFeatureListData]);
739
+ return _extends({}, data);
740
+ }
741
+ var getSystemFeatureList = function getSystemFeatureList(_ref6) {
742
+ var apiEndPoint = _ref6.apiEndPoint,
743
+ token = _ref6.token,
744
+ moduleId = _ref6.moduleId,
745
+ moduleName = _ref6.moduleName;
746
+ try {
747
+ return Promise.resolve(API({
748
+ apiEndPoint: apiEndPoint,
749
+ token: token,
750
+ url: "/ecommerce/system/feature",
751
+ queryParams: {
752
+ moduleId: moduleId,
753
+ moduleName: moduleName
754
+ },
755
+ errorMessage: 'Error in getting System Feature.',
756
+ hideErrorMessage: true
757
+ }));
758
+ } catch (e) {
759
+ return Promise.reject(e);
760
+ }
761
+ };
626
762
 
627
763
  var convertCamCaseToSnake = function convertCamCaseToSnake(child) {
628
764
  var _Object$keys;
@@ -4107,7 +4243,6 @@ var StoreTabs = function StoreTabs(_ref) {
4107
4243
  var _useState2 = React.useState(),
4108
4244
  storeData = _useState2[0],
4109
4245
  setStoreData = _useState2[1];
4110
- console.log(storeData, token, apiEndPoint, 'level 2 rendered');
4111
4246
  var handleChange = function handleChange(event, newValue) {
4112
4247
  setValue(newValue);
4113
4248
  };
@@ -4135,12 +4270,9 @@ var StoreTabs = function StoreTabs(_ref) {
4135
4270
  url: "/ecommerce/customer/" + (customer === null || customer === void 0 ? void 0 : (_customer$customerDto2 = customer.customerDto) === null || _customer$customerDto2 === void 0 ? void 0 : _customer$customerDto2.id) + "/address",
4136
4271
  errorMessage: 'Error in getting store data.'
4137
4272
  })).then(function (data) {
4138
- console.log(data, 'check inside try 1 function');
4139
4273
  setStoreData(data);
4140
4274
  });
4141
- }, function (error) {
4142
- console.log(error, 'check api function error');
4143
- });
4275
+ }, function () {});
4144
4276
  return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
4145
4277
  } catch (e) {
4146
4278
  return Promise.reject(e);
@@ -4197,30 +4329,23 @@ var StoreList = function StoreList(_ref) {
4197
4329
  var _useState = React.useState(),
4198
4330
  customer = _useState[0],
4199
4331
  setCustomer = _useState[1];
4200
- console.log(customer, token, apiEndPoint, 'check level 1 rendered');
4201
4332
  React.useEffect(function () {
4202
4333
  (function () {
4203
- try {
4204
- return _catch(function () {
4205
- var _temp = function () {
4206
- if (apiEndPoint && token) {
4207
- return Promise.resolve(API({
4208
- apiEndPoint: apiEndPoint,
4209
- token: token,
4210
- url: "/ecommerce/customer",
4211
- errorMessage: 'Error in getting user profile data.'
4212
- })).then(function (data) {
4213
- setCustomer(data);
4214
- });
4215
- }
4216
- }();
4217
- if (_temp && _temp.then) return _temp.then(function () {});
4218
- }, function (error) {
4219
- console.log(error, 'check catch error main file');
4220
- });
4221
- } catch (e) {
4222
- Promise.reject(e);
4223
- }
4334
+ return _catch(function () {
4335
+ var _temp = function () {
4336
+ if (apiEndPoint && token) {
4337
+ return Promise.resolve(API({
4338
+ apiEndPoint: apiEndPoint,
4339
+ token: token,
4340
+ url: "/ecommerce/customer",
4341
+ errorMessage: 'Error in getting user profile data.'
4342
+ })).then(function (data) {
4343
+ setCustomer(data);
4344
+ });
4345
+ }
4346
+ }();
4347
+ if (_temp && _temp.then) return _temp.then(function () {});
4348
+ }, function () {});
4224
4349
  })();
4225
4350
  }, [token, apiEndPoint]);
4226
4351
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StoreHeader, null, /*#__PURE__*/React__default.createElement("span", {
@@ -4267,17 +4392,21 @@ var AccountDetails = function AccountDetails(_ref) {
4267
4392
  sectionLeftImageSection = _ref.sectionLeftImageSection,
4268
4393
  exploreCategoryImage = _ref.exploreCategoryImage,
4269
4394
  sectionRightImageSection = _ref.sectionRightImageSection,
4270
- discountImageSection = _ref.discountImageSection,
4271
- _ref$hideDiscountImag = _ref.hideDiscountImage,
4272
- hideDiscountImage = _ref$hideDiscountImag === void 0 ? false : _ref$hideDiscountImag,
4273
- _ref$hideBannerSectio = _ref.hideBannerSection,
4274
- hideBannerSection = _ref$hideBannerSectio === void 0 ? false : _ref$hideBannerSectio,
4275
- _ref$imgNotFoundUrl = _ref.imgNotFoundUrl,
4276
- imgNotFoundUrl = _ref$imgNotFoundUrl === void 0 ? noImgAvailable$1 : _ref$imgNotFoundUrl,
4277
- _ref$hideInvoiceActio = _ref.hideInvoiceAction,
4278
- hideInvoiceAction = _ref$hideInvoiceActio === void 0 ? false : _ref$hideInvoiceActio,
4279
- _ref$removeSocialLink = _ref.removeSocialLinks,
4280
- removeSocialLinks = _ref$removeSocialLink === void 0 ? false : _ref$removeSocialLink;
4395
+ discountImageSection = _ref.discountImageSection;
4396
+ var _useAllSystemFeatureV = useAllSystemFeatureValues({
4397
+ apiEndPoint: apiEndPoint,
4398
+ token: token
4399
+ }),
4400
+ _useAllSystemFeatureV2 = _useAllSystemFeatureV.hideDiscountImageOnAccount,
4401
+ hideDiscountImage = _useAllSystemFeatureV2 === void 0 ? false : _useAllSystemFeatureV2,
4402
+ _useAllSystemFeatureV3 = _useAllSystemFeatureV.hideBannerSectionOnAccount,
4403
+ hideBannerSection = _useAllSystemFeatureV3 === void 0 ? false : _useAllSystemFeatureV3,
4404
+ _useAllSystemFeatureV4 = _useAllSystemFeatureV.imgNotFoundUrlOnAccount,
4405
+ imgNotFoundUrl = _useAllSystemFeatureV4 === void 0 ? noImgAvailable$1 : _useAllSystemFeatureV4,
4406
+ _useAllSystemFeatureV5 = _useAllSystemFeatureV.hideInvoiceActionOnAccount,
4407
+ hideInvoiceAction = _useAllSystemFeatureV5 === void 0 ? false : _useAllSystemFeatureV5,
4408
+ _useAllSystemFeatureV6 = _useAllSystemFeatureV.removeSocialLinksOnAccount,
4409
+ removeSocialLinks = _useAllSystemFeatureV6 === void 0 ? false : _useAllSystemFeatureV6;
4281
4410
  serviceApiEndPoint = serviceApiEndPoint || (apiEndPoint === null || apiEndPoint === void 0 ? void 0 : apiEndPoint.replace('/api', '/services/pdf'));
4282
4411
  var queryParams = searchQueryParams(window.location.search);
4283
4412
  var isMobile = useMediaQuery('(max-width:768px)');
@@ -7119,8 +7248,13 @@ var CartPageComponent = function CartPageComponent(_ref) {
7119
7248
  loading = _ref.loading,
7120
7249
  imgnotfoundUrl = _ref.imgnotfoundUrl,
7121
7250
  styles = _ref.styles,
7122
- onChangeDiscountCoupon = _ref.onChangeDiscountCoupon,
7123
- disabledSelectAllProductCheckbox = _ref.disabledSelectAllProductCheckbox;
7251
+ onChangeDiscountCoupon = _ref.onChangeDiscountCoupon;
7252
+ var _useAllSystemFeatureV = useAllSystemFeatureValues({
7253
+ apiEndPoint: apiEndPoint,
7254
+ token: token
7255
+ }),
7256
+ _useAllSystemFeatureV2 = _useAllSystemFeatureV.disabledSelectAllProductOnCartPage,
7257
+ disabledSelectAllProductCheckbox = _useAllSystemFeatureV2 === void 0 ? false : _useAllSystemFeatureV2;
7124
7258
  var _useState = React.useState([]),
7125
7259
  storeData = _useState[0],
7126
7260
  setStoreData = _useState[1];
@@ -12028,13 +12162,19 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
12028
12162
  handleLogin = _ref.handleLogin,
12029
12163
  placeOrder = _ref.placeOrder,
12030
12164
  clickRedirect = _ref.clickRedirect,
12031
- shippingText = _ref.shippingText,
12032
- _ref$taxExempt = _ref.taxExempt,
12033
- taxExempt = _ref$taxExempt === void 0 ? false : _ref$taxExempt,
12034
- _ref$paymentWithPaypa = _ref.paymentWithPaypal,
12035
- paymentWithPaypal = _ref$paymentWithPaypa === void 0 ? false : _ref$paymentWithPaypa,
12036
- showShippingPriceRangeLimit = _ref.showShippingPriceRangeLimit,
12037
- disabledPaymentOnMoreThanAmount = _ref.disabledPaymentOnMoreThanAmount;
12165
+ shippingText = _ref.shippingText;
12166
+ var _useAllSystemFeatureV = useAllSystemFeatureValues({
12167
+ apiEndPoint: apiEndPoint,
12168
+ token: token
12169
+ }),
12170
+ _useAllSystemFeatureV2 = _useAllSystemFeatureV.showShippingPriceRangeLimitOnCheckoutPage,
12171
+ showShippingPriceRangeLimit = _useAllSystemFeatureV2 === void 0 ? false : _useAllSystemFeatureV2,
12172
+ _useAllSystemFeatureV3 = _useAllSystemFeatureV.disabledPaymentOnMoreThanAmountOnCheckoutPage,
12173
+ disabledPaymentOnMoreThanAmount = _useAllSystemFeatureV3 === void 0 ? false : _useAllSystemFeatureV3,
12174
+ _useAllSystemFeatureV4 = _useAllSystemFeatureV.taxExemptOnCheckoutPage,
12175
+ taxExempt = _useAllSystemFeatureV4 === void 0 ? false : _useAllSystemFeatureV4,
12176
+ _useAllSystemFeatureV5 = _useAllSystemFeatureV.paymentWithPaypalOnCheckoutPage,
12177
+ paymentWithPaypal = _useAllSystemFeatureV5 === void 0 ? false : _useAllSystemFeatureV5;
12038
12178
  var _useState = React.useState(false),
12039
12179
  loginLoading = _useState[0],
12040
12180
  setLoginLoading = _useState[1];