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