@salesgenterp/ui-components 0.4.532 → 0.4.539

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- In the project directory, you can run:
2
+ In the project directory, you can runn:
3
3
 
4
4
  ### `yarn install`
5
5
 
package/dist/index.js CHANGED
@@ -62,6 +62,9 @@ var paramCase = require('param-case');
62
62
  var cg = require('react-icons/cg');
63
63
  var fi = require('react-icons/fi');
64
64
  var fa6 = require('react-icons/fa6');
65
+ var Image$3 = _interopDefault(require('next/image'));
66
+ var debounce$1 = _interopDefault(require('lodash/debounce'));
67
+ var omit = _interopDefault(require('lodash/omit'));
65
68
 
66
69
  function _extends() {
67
70
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -5016,7 +5019,7 @@ var AccountDetails = function AccountDetails(_ref) {
5016
5019
  return Promise.resolve(API({
5017
5020
  apiEndPoint: apiEndPoint,
5018
5021
  token: token,
5019
- url: "store/store-ids"
5022
+ url: "store"
5020
5023
  })).then(function (data) {
5021
5024
  var _data$find;
5022
5025
  var storeIds = Array.isArray(data) && (data === null || data === void 0 ? void 0 : data.length) > 0 ? data === null || data === void 0 ? void 0 : data.join(',') : '1';
@@ -10642,7 +10645,8 @@ var StaticPageList = function StaticPageList(_ref) {
10642
10645
  var _sortBy;
10643
10646
  var apiEndPoint = _ref.apiEndPoint,
10644
10647
  queryParams = _ref.queryParams,
10645
- itemLink = _ref.itemLink;
10648
+ itemLink = _ref.itemLink,
10649
+ pageData = _ref.pageData;
10646
10650
  var _useState = React.useState(false),
10647
10651
  loading = _useState[0],
10648
10652
  setLoading = _useState[1];
@@ -10652,30 +10656,37 @@ var StaticPageList = function StaticPageList(_ref) {
10652
10656
  React.useEffect(function () {
10653
10657
  (function () {
10654
10658
  try {
10655
- var _temp3 = function () {
10656
- if (apiEndPoint) {
10657
- var _temp2 = function _temp2() {
10658
- setLoading(false);
10659
- };
10660
- setLoading(true);
10661
- var _temp = _catch(function () {
10662
- return Promise.resolve(API({
10663
- apiEndPoint: apiEndPoint,
10664
- url: "/ecommerce/staticPage/list?page=0&size=9999",
10665
- queryParams: queryParams
10666
- })).then(function (response) {
10667
- setStaticPageData(response === null || response === void 0 ? void 0 : response.content);
10668
- });
10669
- }, function () {});
10670
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
10659
+ var _temp4 = function () {
10660
+ if (pageData) {
10661
+ setStaticPageData(pageData);
10662
+ } else {
10663
+ var _temp3 = function () {
10664
+ if (apiEndPoint) {
10665
+ var _temp2 = function _temp2() {
10666
+ setLoading(false);
10667
+ };
10668
+ setLoading(true);
10669
+ var _temp = _catch(function () {
10670
+ return Promise.resolve(API({
10671
+ apiEndPoint: apiEndPoint,
10672
+ url: "/ecommerce/staticPage/list?page=0&size=999",
10673
+ queryParams: queryParams
10674
+ })).then(function (response) {
10675
+ setStaticPageData(response === null || response === void 0 ? void 0 : response.content);
10676
+ });
10677
+ }, function () {});
10678
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
10679
+ }
10680
+ }();
10681
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
10671
10682
  }
10672
10683
  }();
10673
- return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
10684
+ return _temp4 && _temp4.then ? _temp4.then(function () {}) : void 0;
10674
10685
  } catch (e) {
10675
10686
  Promise.reject(e);
10676
10687
  }
10677
10688
  })();
10678
- }, []);
10689
+ }, [pageData]);
10679
10690
  return /*#__PURE__*/React__default.createElement("div", {
10680
10691
  style: {
10681
10692
  padding: '1rem'
@@ -13557,6 +13568,12 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
13557
13568
  setTotalTaxAmount = _useState21[1];
13558
13569
  var previousSubTotalRef = React.useRef(null);
13559
13570
  var previousShippingAddressIdRef = React.useRef(null);
13571
+ React.useEffect(function () {
13572
+ var _cartData$cartLineIte;
13573
+ if (cartData && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.length) > 0 && currStep !== 1) {
13574
+ setCurrStep(1);
13575
+ }
13576
+ }, [cartData]);
13560
13577
  React.useEffect(function () {
13561
13578
  if (apiEndPoint && token) {
13562
13579
  (function () {
@@ -13681,8 +13698,8 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
13681
13698
  React.useEffect(function () {
13682
13699
  (function () {
13683
13700
  try {
13684
- var _cartData$cartLineIte;
13685
- var isQuantityZero = cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.some(function (data) {
13701
+ var _cartData$cartLineIte2;
13702
+ var isQuantityZero = cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte2 = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte2 === void 0 ? void 0 : _cartData$cartLineIte2.some(function (data) {
13686
13703
  return (data === null || data === void 0 ? void 0 : data.quantity) <= 0;
13687
13704
  });
13688
13705
  if (isQuantityZero) {
@@ -13721,8 +13738,8 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
13721
13738
  var taxFunction = function taxFunction() {
13722
13739
  try {
13723
13740
  var taxAmount = totalTaxAmount || 0;
13724
- var _temp10 = function (_cartData$cartLineIte2) {
13725
- if (shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte2 = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte2 === void 0 ? void 0 : _cartData$cartLineIte2.length) > 0 && shippingAddressId && (shippingAddressId !== previousShippingAddressIdRef.current || (cartData === null || cartData === void 0 ? void 0 : cartData.cartSubTotal) !== previousSubTotalRef.current)) {
13741
+ var _temp10 = function (_cartData$cartLineIte3) {
13742
+ if (shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte3 = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte3 === void 0 ? void 0 : _cartData$cartLineIte3.length) > 0 && shippingAddressId && (shippingAddressId !== previousShippingAddressIdRef.current || (cartData === null || cartData === void 0 ? void 0 : cartData.cartSubTotal) !== previousSubTotalRef.current)) {
13726
13743
  previousShippingAddressIdRef.current = shippingAddressId;
13727
13744
  var _temp9 = _catch(function () {
13728
13745
  return Promise.resolve(getTaxData({
@@ -15827,6 +15844,343 @@ function CustomTabPanel(props) {
15827
15844
  }, children));
15828
15845
  }
15829
15846
 
15847
+ var cardStyle = {
15848
+ border: '1px solid #d3d3d3',
15849
+ borderRadius: '10px',
15850
+ display: 'flex',
15851
+ flexDirection: 'column',
15852
+ justifyContent: 'center',
15853
+ alignItems: 'center',
15854
+ padding: '10px',
15855
+ gap: '10px',
15856
+ backgroundColor: '#ffffff'
15857
+ };
15858
+ var WishlistProductCardSkeleton = function WishlistProductCardSkeleton(_ref) {
15859
+ var span = _ref.span,
15860
+ _ref$count = _ref.count,
15861
+ count = _ref$count === void 0 ? 18 : _ref$count;
15862
+ return /*#__PURE__*/React__default.createElement(material.Grid, {
15863
+ container: true,
15864
+ spacing: 2
15865
+ }, Array.from({
15866
+ length: count
15867
+ }).map(function (_, i) {
15868
+ var _span$xs, _span$sm, _span$md, _span$lg;
15869
+ return /*#__PURE__*/React__default.createElement(material.Grid, {
15870
+ item: true,
15871
+ xs: (_span$xs = span === null || span === void 0 ? void 0 : span.xs) != null ? _span$xs : 12,
15872
+ sm: (_span$sm = span === null || span === void 0 ? void 0 : span.sm) != null ? _span$sm : 6,
15873
+ md: (_span$md = span === null || span === void 0 ? void 0 : span.md) != null ? _span$md : 4,
15874
+ lg: (_span$lg = span === null || span === void 0 ? void 0 : span.lg) != null ? _span$lg : 2,
15875
+ key: i
15876
+ }, /*#__PURE__*/React__default.createElement("div", {
15877
+ style: cardStyle
15878
+ }, /*#__PURE__*/React__default.createElement(material.Skeleton, {
15879
+ variant: "rectangular",
15880
+ width: 160,
15881
+ height: 160,
15882
+ animation: "wave"
15883
+ }), /*#__PURE__*/React__default.createElement(material.Skeleton, {
15884
+ variant: "text",
15885
+ width: 80,
15886
+ height: 24,
15887
+ animation: "wave"
15888
+ }), /*#__PURE__*/React__default.createElement(material.Skeleton, {
15889
+ variant: "text",
15890
+ width: "90%",
15891
+ height: 43,
15892
+ animation: "wave"
15893
+ }), /*#__PURE__*/React__default.createElement(material.Skeleton, {
15894
+ variant: "rectangular",
15895
+ width: 120,
15896
+ height: 36,
15897
+ animation: "wave",
15898
+ sx: {
15899
+ borderRadius: '10px'
15900
+ }
15901
+ })));
15902
+ }));
15903
+ };
15904
+
15905
+ var _templateObject$S, _templateObject2$C, _templateObject3$s, _templateObject4$m, _templateObject5$h, _templateObject6$f, _templateObject7$b, _templateObject8$9, _templateObject9$6, _templateObject10$4, _templateObject11$3;
15906
+ var getProductImage = function getProductImage(imageUrl, imgNotFoundUrl) {
15907
+ return imageUrl && imageUrl !== 'null' ? imageUrl : imgNotFoundUrl != null ? imgNotFoundUrl : '/images/products/imgnotfound.png';
15908
+ };
15909
+ var DEFAULT_GRID_SPAN = {
15910
+ lg: 3,
15911
+ md: 4,
15912
+ sm: 6,
15913
+ xs: 6
15914
+ };
15915
+ var WISHLIST_ITEM_OMIT_KEYS = ['id', 'createdBy', 'insertedTimestamp', 'updatedBy', 'updatedTimestamp'];
15916
+ var getStyleOverride = function getStyleOverride(styleOverrides) {
15917
+ for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
15918
+ keys[_key - 1] = arguments[_key];
15919
+ }
15920
+ for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
15921
+ var key = _keys[_i];
15922
+ if (styleOverrides !== null && styleOverrides !== void 0 && styleOverrides[key]) return styleOverrides[key];
15923
+ }
15924
+ return undefined;
15925
+ };
15926
+ var WishlistComponent = function WishlistComponent(_ref) {
15927
+ var style = _ref.style,
15928
+ imgNotFoundUrl = _ref.imgNotFoundUrl,
15929
+ token = _ref.token,
15930
+ _ref$isLoading = _ref.isLoading,
15931
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
15932
+ _ref$wishlistData = _ref.wishlistData,
15933
+ wishlistData = _ref$wishlistData === void 0 ? [] : _ref$wishlistData,
15934
+ onRemoveFromWishlist = _ref.onRemoveFromWishlist,
15935
+ onSearch = _ref.onSearch,
15936
+ _ref$span = _ref.span,
15937
+ span = _ref$span === void 0 ? DEFAULT_GRID_SPAN : _ref$span,
15938
+ primaryColor = _ref.primaryColor,
15939
+ apiEndPoint = _ref.apiEndPoint,
15940
+ onAddToCart = _ref.onAddToCart,
15941
+ _ref$doNotShowPrice = _ref.doNotShowPrice,
15942
+ doNotShowPrice = _ref$doNotShowPrice === void 0 ? false : _ref$doNotShowPrice;
15943
+ var _useAllSystemFeatureV = useAllSystemFeatureValues({
15944
+ apiEndPoint: apiEndPoint,
15945
+ token: token
15946
+ }),
15947
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _useAllSystemFeatureV.allowToProcessInvoiceForOutOfStockProductsEcommerce;
15948
+ var styleOverrides = React.useMemo(function () {
15949
+ return _extends({}, style || {});
15950
+ }, [style]);
15951
+ var _useState = React.useState(''),
15952
+ searchInput = _useState[0],
15953
+ setSearchInput = _useState[1];
15954
+ var items = React.useMemo(function () {
15955
+ var _wishlistData$content;
15956
+ if (Array.isArray(wishlistData)) return wishlistData;
15957
+ return (_wishlistData$content = wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.content) != null ? _wishlistData$content : [];
15958
+ }, [wishlistData]);
15959
+ var gridSpan = React.useMemo(function () {
15960
+ return _extends({}, DEFAULT_GRID_SPAN, span || {});
15961
+ }, [span]);
15962
+ var totalItems = React.useMemo(function () {
15963
+ if (typeof (wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.totalElements) === 'number') {
15964
+ return wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.totalElements;
15965
+ }
15966
+ return items === null || items === void 0 ? void 0 : items.length;
15967
+ }, [wishlistData, items === null || items === void 0 ? void 0 : items.length]);
15968
+ var debouncedSearch = React.useMemo(function () {
15969
+ return debounce$1(function (value) {
15970
+ return onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
15971
+ }, 500);
15972
+ }, [onSearch]);
15973
+ React.useEffect(function () {
15974
+ return function () {
15975
+ debouncedSearch.cancel();
15976
+ };
15977
+ }, [debouncedSearch]);
15978
+ if (!token) {
15979
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h1", null, "Wishlist"), /*#__PURE__*/React__default.createElement("p", null, "Please log in to view your wishlist."));
15980
+ }
15981
+ if (!isLoading && items.length === 0) {
15982
+ return /*#__PURE__*/React__default.createElement(EmptyStateText, {
15983
+ style: getStyleOverride(styleOverrides, 'emptyStateText', 'EmptyStateText')
15984
+ }, "no products added to wishlist");
15985
+ }
15986
+ return /*#__PURE__*/React__default.createElement("div", {
15987
+ style: {
15988
+ marginTop: '1rem',
15989
+ height: '100%',
15990
+ width: '100%'
15991
+ }
15992
+ }, /*#__PURE__*/React__default.createElement(TopBar, {
15993
+ style: getStyleOverride(styleOverrides, 'topBar', 'TopBar')
15994
+ }, /*#__PURE__*/React__default.createElement(SearchWrapper, {
15995
+ style: getStyleOverride(styleOverrides, 'searchWrapper', 'SearchWrapper')
15996
+ }, /*#__PURE__*/React__default.createElement(material.TextField, {
15997
+ placeholder: "Type minimum 3 characters to search...",
15998
+ value: searchInput,
15999
+ onChange: function onChange(e) {
16000
+ var value = e.target.value;
16001
+ setSearchInput(value);
16002
+ if (!token || typeof onSearch !== 'function') return;
16003
+ debouncedSearch(value);
16004
+ },
16005
+ size: "small",
16006
+ fullWidth: true,
16007
+ sx: {
16008
+ '& .MuiOutlinedInput-root': {
16009
+ borderRadius: '8px'
16010
+ }
16011
+ }
16012
+ })), /*#__PURE__*/React__default.createElement(TotalItemsText, {
16013
+ style: getStyleOverride(styleOverrides, 'totalItemsText', 'TotalItemsText')
16014
+ }, "Total " + totalItems + " item" + (totalItems === 1 ? '' : 's'))), isLoading ? /*#__PURE__*/React__default.createElement(WishlistProductCardSkeleton, {
16015
+ span: span
16016
+ }) : /*#__PURE__*/React__default.createElement(material.Grid, {
16017
+ container: true,
16018
+ spacing: 2
16019
+ }, items === null || items === void 0 ? void 0 : items.map(function (product) {
16020
+ return /*#__PURE__*/React__default.createElement(material.Grid, {
16021
+ item: true,
16022
+ xs: gridSpan.xs,
16023
+ sm: gridSpan.sm,
16024
+ md: gridSpan.md,
16025
+ lg: gridSpan.lg,
16026
+ key: product === null || product === void 0 ? void 0 : product.id
16027
+ }, /*#__PURE__*/React__default.createElement(ProductCard, {
16028
+ product: product,
16029
+ styleOverrides: styleOverrides,
16030
+ onRemoveFromWishlist: onRemoveFromWishlist,
16031
+ primaryColor: primaryColor,
16032
+ imgNotFoundUrl: imgNotFoundUrl,
16033
+ onAddToCart: onAddToCart,
16034
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce,
16035
+ doNotShowPrice: doNotShowPrice
16036
+ }));
16037
+ })));
16038
+ };
16039
+ var ProductCardWrapper = styled__default.div(_templateObject$S || (_templateObject$S = _taggedTemplateLiteralLoose(["\n position: relative;\n background-color: #ffffff;\n border: 1px solid #d3d3d3;\n border-radius: 10px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding: 10px;\n gap: 10px;\n cursor: pointer;\n"])));
16040
+ var TopBar = styled__default.div(_templateObject2$C || (_templateObject2$C = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n"])));
16041
+ var SearchWrapper = styled__default(material.Box)(_templateObject3$s || (_templateObject3$s = _taggedTemplateLiteralLoose(["\n && {\n margin-bottom: 24px;\n max-width: 400px;\n width: 100%;\n }\n"])));
16042
+ var TotalItemsText = styled__default.div(_templateObject4$m || (_templateObject4$m = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 500;\n color: #4b4b4b;\n margin-bottom: 24px;\n white-space: nowrap;\n"])));
16043
+ var EmptyStateText = styled__default.p(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n color: #4b4b4b;\n margin: 16px 0;\n"])));
16044
+ var DeleteButton = styled__default.button(_templateObject6$f || (_templateObject6$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 8px;\n right: 8px;\n opacity: 1;\n pointer-events: auto;\n z-index: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background-color: #ffffff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);\n cursor: pointer;\n color: #ff0000;\n"])));
16045
+ var PriceContainer = styled__default.div(_templateObject7$b || (_templateObject7$b = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
16046
+ var DiscountPriceRow = styled__default.div(_templateObject8$9 || (_templateObject8$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n"])));
16047
+ var ProductName$2 = styled__default.div(_templateObject9$6 || (_templateObject9$6 = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n font-weight: 500;\n color: #000000;\n text-align: center;\n height: 40px;\n overflow: hidden;\n width: 100%;\n text-overflow: ellipsis;\n white-space: pre-wrap;\n"])));
16048
+ var ProductActionButton = styled__default(material.Button)(_templateObject10$4 || (_templateObject10$4 = _taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])), function (_ref2) {
16049
+ var primaryColor = _ref2.primaryColor;
16050
+ return primaryColor != null ? primaryColor : '#000000';
16051
+ });
16052
+ var OutOfStockButton = styled__default(material.Button)(_templateObject11$3 || (_templateObject11$3 = _taggedTemplateLiteralLoose(["\n && {\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])));
16053
+ var ProductCard = function ProductCard(_ref3) {
16054
+ var _product$standardPric, _product$retailPrice, _product$standardPric2;
16055
+ var product = _ref3.product,
16056
+ styleOverrides = _ref3.styleOverrides,
16057
+ onRemoveFromWishlist = _ref3.onRemoveFromWishlist,
16058
+ primaryColor = _ref3.primaryColor,
16059
+ imgNotFoundUrl = _ref3.imgNotFoundUrl,
16060
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref3.allowToProcessInvoiceForOutOfStockProductsEcommerce,
16061
+ onAddToCart = _ref3.onAddToCart,
16062
+ doNotShowPrice = _ref3.doNotShowPrice;
16063
+ var router$1 = router.useRouter();
16064
+ var _useState2 = React.useState(false),
16065
+ deleteLoading = _useState2[0],
16066
+ setDeleteLoading = _useState2[1];
16067
+ var _useState3 = React.useState(false),
16068
+ addToCartLoading = _useState3[0],
16069
+ setAddToCartLoading = _useState3[1];
16070
+ var removeFromWishlist = function removeFromWishlist(productId) {
16071
+ try {
16072
+ if (typeof onRemoveFromWishlist !== 'function') return Promise.resolve();
16073
+ setDeleteLoading(true);
16074
+ var _temp = _finallyRethrows(function () {
16075
+ return _catch(function () {
16076
+ return Promise.resolve(onRemoveFromWishlist(productId)).then(function () {});
16077
+ }, function (error) {
16078
+ console.log('error', error);
16079
+ });
16080
+ }, function (_wasThrown, _result) {
16081
+ setDeleteLoading(false);
16082
+ if (_wasThrown) throw _result;
16083
+ return _result;
16084
+ });
16085
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
16086
+ } catch (e) {
16087
+ return Promise.reject(e);
16088
+ }
16089
+ };
16090
+ var onChangeQuantity = function onChangeQuantity(product) {
16091
+ try {
16092
+ if (!onAddToCart || typeof onAddToCart !== 'function') return Promise.resolve();
16093
+ var _temp2 = _finallyRethrows(function () {
16094
+ return _catch(function () {
16095
+ setAddToCartLoading(true);
16096
+ return Promise.resolve(onAddToCart(omit(product, WISHLIST_ITEM_OMIT_KEYS))).then(function () {});
16097
+ }, function () {});
16098
+ }, function (_wasThrown2, _result2) {
16099
+ setAddToCartLoading(false);
16100
+ if (_wasThrown2) throw _result2;
16101
+ return _result2;
16102
+ });
16103
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
16104
+ } catch (e) {
16105
+ return Promise.reject(e);
16106
+ }
16107
+ };
16108
+ return /*#__PURE__*/React__default.createElement(ProductCardWrapper, {
16109
+ style: getStyleOverride(styleOverrides, 'productCardWrapper', 'ProductCardWrapper'),
16110
+ onClick: function onClick() {
16111
+ var _ref4, _product$urlAlias;
16112
+ router$1.push("/product-details/" + paramCase.paramCase((_ref4 = (_product$urlAlias = product.urlAlias) != null ? _product$urlAlias : product.alias) != null ? _ref4 : product.productName) + "?id=" + (product === null || product === void 0 ? void 0 : product.productId));
16113
+ }
16114
+ }, /*#__PURE__*/React__default.createElement(DeleteButton, {
16115
+ type: "button",
16116
+ className: "wishlist-delete-btn",
16117
+ "aria-label": "Remove from wishlist",
16118
+ style: getStyleOverride(styleOverrides, 'deleteButton', 'DeleteButton'),
16119
+ onClick: function onClick(e) {
16120
+ try {
16121
+ var _temp3 = _catch(function () {
16122
+ e.stopPropagation();
16123
+ return Promise.resolve(removeFromWishlist(product === null || product === void 0 ? void 0 : product.productId)).then(function () {});
16124
+ }, function (error) {
16125
+ console.log('error', error);
16126
+ });
16127
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
16128
+ } catch (e) {
16129
+ return Promise.reject(e);
16130
+ }
16131
+ }
16132
+ }, deleteLoading ? /*#__PURE__*/React__default.createElement(material.CircularProgress, {
16133
+ size: 20
16134
+ }) : /*#__PURE__*/React__default.createElement(ai.AiOutlineDelete, {
16135
+ style: {
16136
+ fontSize: 18
16137
+ }
16138
+ })), /*#__PURE__*/React__default.createElement(Image$3, {
16139
+ src: getProductImage(product === null || product === void 0 ? void 0 : product.imageUrl, imgNotFoundUrl),
16140
+ alt: (product === null || product === void 0 ? void 0 : product.productName) || 'Product',
16141
+ width: 160,
16142
+ height: 160,
16143
+ objectFit: "contain"
16144
+ }), !doNotShowPrice ? /*#__PURE__*/React__default.createElement(PriceContainer, {
16145
+ style: getStyleOverride(styleOverrides, 'priceContainer', 'PriceContainer')
16146
+ }, (product === null || product === void 0 ? void 0 : product.standardPrice) > (product === null || product === void 0 ? void 0 : product.retailPrice) ? /*#__PURE__*/React__default.createElement(DiscountPriceRow, {
16147
+ style: getStyleOverride(styleOverrides, 'discountPriceRow', 'DiscountPriceRow')
16148
+ }, /*#__PURE__*/React__default.createElement("del", null, "$" + (product === null || product === void 0 ? void 0 : (_product$standardPric = product.standardPrice) === null || _product$standardPric === void 0 ? void 0 : _product$standardPric.toFixed(2))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", null, "$" + (product === null || product === void 0 ? void 0 : (_product$retailPrice = product.retailPrice) === null || _product$retailPrice === void 0 ? void 0 : _product$retailPrice.toFixed(2))))) : /*#__PURE__*/React__default.createElement("div", null, "$" + (product === null || product === void 0 ? void 0 : (_product$standardPric2 = product.standardPrice) === null || _product$standardPric2 === void 0 ? void 0 : _product$standardPric2.toFixed(2)))) : /*#__PURE__*/React__default.createElement("div", null), /*#__PURE__*/React__default.createElement(ProductName$2, {
16149
+ style: getStyleOverride(styleOverrides, 'productName', 'ProductName')
16150
+ }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement("div", null, (product === null || product === void 0 ? void 0 : product.productStock) > 0 || product !== null && product !== void 0 && product.hasChildProduct ? /*#__PURE__*/React__default.createElement(ProductActionButton, {
16151
+ variant: "contained",
16152
+ color: "primary",
16153
+ primaryColor: primaryColor,
16154
+ style: getStyleOverride(styleOverrides, 'productActionButton', 'ProductActionButton'),
16155
+ onClick: function onClick(e) {
16156
+ e.stopPropagation();
16157
+ e.preventDefault();
16158
+ if (product !== null && product !== void 0 && product.hasChildProducts) {
16159
+ router$1.push("/products/" + (product === null || product === void 0 ? void 0 : product.productId));
16160
+ } else {
16161
+ if (onAddToCart) {
16162
+ var _product$quantity;
16163
+ onChangeQuantity(_extends({}, product, {
16164
+ quantity: checkMinMaxQty({
16165
+ quantity: (_product$quantity = product === null || product === void 0 ? void 0 : product.quantity) != null ? _product$quantity : 1,
16166
+ product: product,
16167
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
16168
+ })
16169
+ }));
16170
+ }
16171
+ }
16172
+ }
16173
+ }, product !== null && product !== void 0 && product.hasChildProduct ? 'Select Options' : addToCartLoading ? 'Adding...' : 'Add to Cart') : /*#__PURE__*/React__default.createElement(OutOfStockButton, {
16174
+ variant: "contained",
16175
+ color: "primary",
16176
+ disabled: true,
16177
+ style: getStyleOverride(styleOverrides, 'outOfStockButton', 'OutOfStockButton'),
16178
+ onClick: function onClick(e) {
16179
+ return e.stopPropagation();
16180
+ }
16181
+ }, "Out Of stock")));
16182
+ };
16183
+
15830
16184
  exports.APIStaticPage = APIStaticPage;
15831
16185
  exports.AccountDetails = AccountDetails;
15832
16186
  exports.BrandList = BrandList;
@@ -15851,6 +16205,7 @@ exports.SwitchUser = SwitchUser;
15851
16205
  exports.ThankYou = ThankYou;
15852
16206
  exports.Variant = Variant;
15853
16207
  exports.VendorAccount = VendorAccountDetails;
16208
+ exports.Wishlist = WishlistComponent;
15854
16209
  exports.useGridSize = useGridSize;
15855
16210
  exports.useWindowSize = useWindowSize;
15856
16211
  //# sourceMappingURL=index.js.map