@salesgenterp/ui-components 0.4.533 → 0.4.540
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 +359 -10
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +359 -11
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
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) {
|
|
@@ -4952,9 +4955,9 @@ var AccountDetails = function AccountDetails(_ref) {
|
|
|
4952
4955
|
var _useState4 = React.useState([]),
|
|
4953
4956
|
storeData = _useState4[0],
|
|
4954
4957
|
setStoreData = _useState4[1];
|
|
4955
|
-
var _useState5 = React.useState((storeData === null || storeData === void 0 ? void 0 : (_storeData$map = storeData.map(function (
|
|
4956
|
-
return
|
|
4957
|
-
})) === null || _storeData$map === void 0 ? void 0 : _storeData$map.join(',')
|
|
4958
|
+
var _useState5 = React.useState(Array.isArray(storeData) && (storeData === null || storeData === void 0 ? void 0 : storeData.length) > 0 ? storeData === null || storeData === void 0 ? void 0 : (_storeData$map = storeData.map(function (store) {
|
|
4959
|
+
return store === null || store === void 0 ? void 0 : store.id;
|
|
4960
|
+
})) === null || _storeData$map === void 0 ? void 0 : _storeData$map.join(',') : '1'),
|
|
4958
4961
|
storeIdList = _useState5[0],
|
|
4959
4962
|
setSoreIdList = _useState5[1];
|
|
4960
4963
|
var _useState6 = React.useState((storeData === null || storeData === void 0 ? void 0 : (_storeData$find = storeData.find(function (data) {
|
|
@@ -5016,10 +5019,12 @@ var AccountDetails = function AccountDetails(_ref) {
|
|
|
5016
5019
|
return Promise.resolve(API({
|
|
5017
5020
|
apiEndPoint: apiEndPoint,
|
|
5018
5021
|
token: token,
|
|
5019
|
-
url: "store
|
|
5022
|
+
url: "store"
|
|
5020
5023
|
})).then(function (data) {
|
|
5021
|
-
var _data$find;
|
|
5022
|
-
var storeIds = Array.isArray(data) && (data === null || data === void 0 ? void 0 : data.length) > 0 ? data === null || data === void 0 ? void 0 : data.
|
|
5024
|
+
var _data$map, _data$find;
|
|
5025
|
+
var storeIds = Array.isArray(data) && (data === null || data === void 0 ? void 0 : data.length) > 0 ? data === null || data === void 0 ? void 0 : (_data$map = data.map(function (store) {
|
|
5026
|
+
return store === null || store === void 0 ? void 0 : store.id;
|
|
5027
|
+
})) === null || _data$map === void 0 ? void 0 : _data$map.join(',') : '1';
|
|
5023
5028
|
setStoreData(data);
|
|
5024
5029
|
setSoreIdList(storeIds);
|
|
5025
5030
|
setDefaultStoreId((data === null || data === void 0 ? void 0 : (_data$find = data.find(function (data) {
|
|
@@ -13565,6 +13570,12 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
|
|
|
13565
13570
|
setTotalTaxAmount = _useState21[1];
|
|
13566
13571
|
var previousSubTotalRef = React.useRef(null);
|
|
13567
13572
|
var previousShippingAddressIdRef = React.useRef(null);
|
|
13573
|
+
React.useEffect(function () {
|
|
13574
|
+
var _cartData$cartLineIte;
|
|
13575
|
+
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) {
|
|
13576
|
+
setCurrStep(1);
|
|
13577
|
+
}
|
|
13578
|
+
}, [cartData]);
|
|
13568
13579
|
React.useEffect(function () {
|
|
13569
13580
|
if (apiEndPoint && token) {
|
|
13570
13581
|
(function () {
|
|
@@ -13689,8 +13700,8 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
|
|
|
13689
13700
|
React.useEffect(function () {
|
|
13690
13701
|
(function () {
|
|
13691
13702
|
try {
|
|
13692
|
-
var _cartData$
|
|
13693
|
-
var isQuantityZero = cartData === null || cartData === void 0 ? void 0 : (_cartData$
|
|
13703
|
+
var _cartData$cartLineIte2;
|
|
13704
|
+
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) {
|
|
13694
13705
|
return (data === null || data === void 0 ? void 0 : data.quantity) <= 0;
|
|
13695
13706
|
});
|
|
13696
13707
|
if (isQuantityZero) {
|
|
@@ -13729,8 +13740,8 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
|
|
|
13729
13740
|
var taxFunction = function taxFunction() {
|
|
13730
13741
|
try {
|
|
13731
13742
|
var taxAmount = totalTaxAmount || 0;
|
|
13732
|
-
var _temp10 = function (_cartData$
|
|
13733
|
-
if (shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$
|
|
13743
|
+
var _temp10 = function (_cartData$cartLineIte3) {
|
|
13744
|
+
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)) {
|
|
13734
13745
|
previousShippingAddressIdRef.current = shippingAddressId;
|
|
13735
13746
|
var _temp9 = _catch(function () {
|
|
13736
13747
|
return Promise.resolve(getTaxData({
|
|
@@ -15835,6 +15846,343 @@ function CustomTabPanel(props) {
|
|
|
15835
15846
|
}, children));
|
|
15836
15847
|
}
|
|
15837
15848
|
|
|
15849
|
+
var cardStyle = {
|
|
15850
|
+
border: '1px solid #d3d3d3',
|
|
15851
|
+
borderRadius: '10px',
|
|
15852
|
+
display: 'flex',
|
|
15853
|
+
flexDirection: 'column',
|
|
15854
|
+
justifyContent: 'center',
|
|
15855
|
+
alignItems: 'center',
|
|
15856
|
+
padding: '10px',
|
|
15857
|
+
gap: '10px',
|
|
15858
|
+
backgroundColor: '#ffffff'
|
|
15859
|
+
};
|
|
15860
|
+
var WishlistProductCardSkeleton = function WishlistProductCardSkeleton(_ref) {
|
|
15861
|
+
var span = _ref.span,
|
|
15862
|
+
_ref$count = _ref.count,
|
|
15863
|
+
count = _ref$count === void 0 ? 18 : _ref$count;
|
|
15864
|
+
return /*#__PURE__*/React__default.createElement(material.Grid, {
|
|
15865
|
+
container: true,
|
|
15866
|
+
spacing: 2
|
|
15867
|
+
}, Array.from({
|
|
15868
|
+
length: count
|
|
15869
|
+
}).map(function (_, i) {
|
|
15870
|
+
var _span$xs, _span$sm, _span$md, _span$lg;
|
|
15871
|
+
return /*#__PURE__*/React__default.createElement(material.Grid, {
|
|
15872
|
+
item: true,
|
|
15873
|
+
xs: (_span$xs = span === null || span === void 0 ? void 0 : span.xs) != null ? _span$xs : 12,
|
|
15874
|
+
sm: (_span$sm = span === null || span === void 0 ? void 0 : span.sm) != null ? _span$sm : 6,
|
|
15875
|
+
md: (_span$md = span === null || span === void 0 ? void 0 : span.md) != null ? _span$md : 4,
|
|
15876
|
+
lg: (_span$lg = span === null || span === void 0 ? void 0 : span.lg) != null ? _span$lg : 2,
|
|
15877
|
+
key: i
|
|
15878
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
15879
|
+
style: cardStyle
|
|
15880
|
+
}, /*#__PURE__*/React__default.createElement(material.Skeleton, {
|
|
15881
|
+
variant: "rectangular",
|
|
15882
|
+
width: 160,
|
|
15883
|
+
height: 160,
|
|
15884
|
+
animation: "wave"
|
|
15885
|
+
}), /*#__PURE__*/React__default.createElement(material.Skeleton, {
|
|
15886
|
+
variant: "text",
|
|
15887
|
+
width: 80,
|
|
15888
|
+
height: 24,
|
|
15889
|
+
animation: "wave"
|
|
15890
|
+
}), /*#__PURE__*/React__default.createElement(material.Skeleton, {
|
|
15891
|
+
variant: "text",
|
|
15892
|
+
width: "90%",
|
|
15893
|
+
height: 43,
|
|
15894
|
+
animation: "wave"
|
|
15895
|
+
}), /*#__PURE__*/React__default.createElement(material.Skeleton, {
|
|
15896
|
+
variant: "rectangular",
|
|
15897
|
+
width: 120,
|
|
15898
|
+
height: 36,
|
|
15899
|
+
animation: "wave",
|
|
15900
|
+
sx: {
|
|
15901
|
+
borderRadius: '10px'
|
|
15902
|
+
}
|
|
15903
|
+
})));
|
|
15904
|
+
}));
|
|
15905
|
+
};
|
|
15906
|
+
|
|
15907
|
+
var _templateObject$S, _templateObject2$C, _templateObject3$s, _templateObject4$m, _templateObject5$h, _templateObject6$f, _templateObject7$b, _templateObject8$9, _templateObject9$6, _templateObject10$4, _templateObject11$3;
|
|
15908
|
+
var getProductImage = function getProductImage(imageUrl, imgNotFoundUrl) {
|
|
15909
|
+
return imageUrl && imageUrl !== 'null' ? imageUrl : imgNotFoundUrl != null ? imgNotFoundUrl : '/images/products/imgnotfound.png';
|
|
15910
|
+
};
|
|
15911
|
+
var DEFAULT_GRID_SPAN = {
|
|
15912
|
+
lg: 3,
|
|
15913
|
+
md: 4,
|
|
15914
|
+
sm: 6,
|
|
15915
|
+
xs: 6
|
|
15916
|
+
};
|
|
15917
|
+
var WISHLIST_ITEM_OMIT_KEYS = ['id', 'createdBy', 'insertedTimestamp', 'updatedBy', 'updatedTimestamp'];
|
|
15918
|
+
var getStyleOverride = function getStyleOverride(styleOverrides) {
|
|
15919
|
+
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
15920
|
+
keys[_key - 1] = arguments[_key];
|
|
15921
|
+
}
|
|
15922
|
+
for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
|
|
15923
|
+
var key = _keys[_i];
|
|
15924
|
+
if (styleOverrides !== null && styleOverrides !== void 0 && styleOverrides[key]) return styleOverrides[key];
|
|
15925
|
+
}
|
|
15926
|
+
return undefined;
|
|
15927
|
+
};
|
|
15928
|
+
var WishlistComponent = function WishlistComponent(_ref) {
|
|
15929
|
+
var style = _ref.style,
|
|
15930
|
+
imgNotFoundUrl = _ref.imgNotFoundUrl,
|
|
15931
|
+
token = _ref.token,
|
|
15932
|
+
_ref$isLoading = _ref.isLoading,
|
|
15933
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
15934
|
+
_ref$wishlistData = _ref.wishlistData,
|
|
15935
|
+
wishlistData = _ref$wishlistData === void 0 ? [] : _ref$wishlistData,
|
|
15936
|
+
onRemoveFromWishlist = _ref.onRemoveFromWishlist,
|
|
15937
|
+
onSearch = _ref.onSearch,
|
|
15938
|
+
_ref$span = _ref.span,
|
|
15939
|
+
span = _ref$span === void 0 ? DEFAULT_GRID_SPAN : _ref$span,
|
|
15940
|
+
primaryColor = _ref.primaryColor,
|
|
15941
|
+
apiEndPoint = _ref.apiEndPoint,
|
|
15942
|
+
onAddToCart = _ref.onAddToCart,
|
|
15943
|
+
_ref$doNotShowPrice = _ref.doNotShowPrice,
|
|
15944
|
+
doNotShowPrice = _ref$doNotShowPrice === void 0 ? false : _ref$doNotShowPrice;
|
|
15945
|
+
var _useAllSystemFeatureV = useAllSystemFeatureValues({
|
|
15946
|
+
apiEndPoint: apiEndPoint,
|
|
15947
|
+
token: token
|
|
15948
|
+
}),
|
|
15949
|
+
allowToProcessInvoiceForOutOfStockProductsEcommerce = _useAllSystemFeatureV.allowToProcessInvoiceForOutOfStockProductsEcommerce;
|
|
15950
|
+
var styleOverrides = React.useMemo(function () {
|
|
15951
|
+
return _extends({}, style || {});
|
|
15952
|
+
}, [style]);
|
|
15953
|
+
var _useState = React.useState(''),
|
|
15954
|
+
searchInput = _useState[0],
|
|
15955
|
+
setSearchInput = _useState[1];
|
|
15956
|
+
var items = React.useMemo(function () {
|
|
15957
|
+
var _wishlistData$content;
|
|
15958
|
+
if (Array.isArray(wishlistData)) return wishlistData;
|
|
15959
|
+
return (_wishlistData$content = wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.content) != null ? _wishlistData$content : [];
|
|
15960
|
+
}, [wishlistData]);
|
|
15961
|
+
var gridSpan = React.useMemo(function () {
|
|
15962
|
+
return _extends({}, DEFAULT_GRID_SPAN, span || {});
|
|
15963
|
+
}, [span]);
|
|
15964
|
+
var totalItems = React.useMemo(function () {
|
|
15965
|
+
if (typeof (wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.totalElements) === 'number') {
|
|
15966
|
+
return wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.totalElements;
|
|
15967
|
+
}
|
|
15968
|
+
return items === null || items === void 0 ? void 0 : items.length;
|
|
15969
|
+
}, [wishlistData, items === null || items === void 0 ? void 0 : items.length]);
|
|
15970
|
+
var debouncedSearch = React.useMemo(function () {
|
|
15971
|
+
return debounce$1(function (value) {
|
|
15972
|
+
return onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
|
|
15973
|
+
}, 500);
|
|
15974
|
+
}, [onSearch]);
|
|
15975
|
+
React.useEffect(function () {
|
|
15976
|
+
return function () {
|
|
15977
|
+
debouncedSearch.cancel();
|
|
15978
|
+
};
|
|
15979
|
+
}, [debouncedSearch]);
|
|
15980
|
+
if (!token) {
|
|
15981
|
+
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."));
|
|
15982
|
+
}
|
|
15983
|
+
if (!isLoading && items.length === 0) {
|
|
15984
|
+
return /*#__PURE__*/React__default.createElement(EmptyStateText, {
|
|
15985
|
+
style: getStyleOverride(styleOverrides, 'emptyStateText', 'EmptyStateText')
|
|
15986
|
+
}, "no products added to wishlist");
|
|
15987
|
+
}
|
|
15988
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
15989
|
+
style: {
|
|
15990
|
+
marginTop: '1rem',
|
|
15991
|
+
height: '100%',
|
|
15992
|
+
width: '100%'
|
|
15993
|
+
}
|
|
15994
|
+
}, /*#__PURE__*/React__default.createElement(TopBar, {
|
|
15995
|
+
style: getStyleOverride(styleOverrides, 'topBar', 'TopBar')
|
|
15996
|
+
}, /*#__PURE__*/React__default.createElement(SearchWrapper, {
|
|
15997
|
+
style: getStyleOverride(styleOverrides, 'searchWrapper', 'SearchWrapper')
|
|
15998
|
+
}, /*#__PURE__*/React__default.createElement(material.TextField, {
|
|
15999
|
+
placeholder: "Type minimum 3 characters to search...",
|
|
16000
|
+
value: searchInput,
|
|
16001
|
+
onChange: function onChange(e) {
|
|
16002
|
+
var value = e.target.value;
|
|
16003
|
+
setSearchInput(value);
|
|
16004
|
+
if (!token || typeof onSearch !== 'function') return;
|
|
16005
|
+
debouncedSearch(value);
|
|
16006
|
+
},
|
|
16007
|
+
size: "small",
|
|
16008
|
+
fullWidth: true,
|
|
16009
|
+
sx: {
|
|
16010
|
+
'& .MuiOutlinedInput-root': {
|
|
16011
|
+
borderRadius: '8px'
|
|
16012
|
+
}
|
|
16013
|
+
}
|
|
16014
|
+
})), /*#__PURE__*/React__default.createElement(TotalItemsText, {
|
|
16015
|
+
style: getStyleOverride(styleOverrides, 'totalItemsText', 'TotalItemsText')
|
|
16016
|
+
}, "Total " + totalItems + " item" + (totalItems === 1 ? '' : 's'))), isLoading ? /*#__PURE__*/React__default.createElement(WishlistProductCardSkeleton, {
|
|
16017
|
+
span: span
|
|
16018
|
+
}) : /*#__PURE__*/React__default.createElement(material.Grid, {
|
|
16019
|
+
container: true,
|
|
16020
|
+
spacing: 2
|
|
16021
|
+
}, items === null || items === void 0 ? void 0 : items.map(function (product) {
|
|
16022
|
+
return /*#__PURE__*/React__default.createElement(material.Grid, {
|
|
16023
|
+
item: true,
|
|
16024
|
+
xs: gridSpan.xs,
|
|
16025
|
+
sm: gridSpan.sm,
|
|
16026
|
+
md: gridSpan.md,
|
|
16027
|
+
lg: gridSpan.lg,
|
|
16028
|
+
key: product === null || product === void 0 ? void 0 : product.id
|
|
16029
|
+
}, /*#__PURE__*/React__default.createElement(ProductCard, {
|
|
16030
|
+
product: product,
|
|
16031
|
+
styleOverrides: styleOverrides,
|
|
16032
|
+
onRemoveFromWishlist: onRemoveFromWishlist,
|
|
16033
|
+
primaryColor: primaryColor,
|
|
16034
|
+
imgNotFoundUrl: imgNotFoundUrl,
|
|
16035
|
+
onAddToCart: onAddToCart,
|
|
16036
|
+
allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce,
|
|
16037
|
+
doNotShowPrice: doNotShowPrice
|
|
16038
|
+
}));
|
|
16039
|
+
})));
|
|
16040
|
+
};
|
|
16041
|
+
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"])));
|
|
16042
|
+
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"])));
|
|
16043
|
+
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"])));
|
|
16044
|
+
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"])));
|
|
16045
|
+
var EmptyStateText = styled__default.p(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n color: #4b4b4b;\n margin: 16px 0;\n"])));
|
|
16046
|
+
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"])));
|
|
16047
|
+
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"])));
|
|
16048
|
+
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"])));
|
|
16049
|
+
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"])));
|
|
16050
|
+
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) {
|
|
16051
|
+
var primaryColor = _ref2.primaryColor;
|
|
16052
|
+
return primaryColor != null ? primaryColor : '#000000';
|
|
16053
|
+
});
|
|
16054
|
+
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"])));
|
|
16055
|
+
var ProductCard = function ProductCard(_ref3) {
|
|
16056
|
+
var _product$standardPric, _product$retailPrice, _product$standardPric2;
|
|
16057
|
+
var product = _ref3.product,
|
|
16058
|
+
styleOverrides = _ref3.styleOverrides,
|
|
16059
|
+
onRemoveFromWishlist = _ref3.onRemoveFromWishlist,
|
|
16060
|
+
primaryColor = _ref3.primaryColor,
|
|
16061
|
+
imgNotFoundUrl = _ref3.imgNotFoundUrl,
|
|
16062
|
+
allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref3.allowToProcessInvoiceForOutOfStockProductsEcommerce,
|
|
16063
|
+
onAddToCart = _ref3.onAddToCart,
|
|
16064
|
+
doNotShowPrice = _ref3.doNotShowPrice;
|
|
16065
|
+
var router$1 = router.useRouter();
|
|
16066
|
+
var _useState2 = React.useState(false),
|
|
16067
|
+
deleteLoading = _useState2[0],
|
|
16068
|
+
setDeleteLoading = _useState2[1];
|
|
16069
|
+
var _useState3 = React.useState(false),
|
|
16070
|
+
addToCartLoading = _useState3[0],
|
|
16071
|
+
setAddToCartLoading = _useState3[1];
|
|
16072
|
+
var removeFromWishlist = function removeFromWishlist(productId) {
|
|
16073
|
+
try {
|
|
16074
|
+
if (typeof onRemoveFromWishlist !== 'function') return Promise.resolve();
|
|
16075
|
+
setDeleteLoading(true);
|
|
16076
|
+
var _temp = _finallyRethrows(function () {
|
|
16077
|
+
return _catch(function () {
|
|
16078
|
+
return Promise.resolve(onRemoveFromWishlist(productId)).then(function () {});
|
|
16079
|
+
}, function (error) {
|
|
16080
|
+
console.log('error', error);
|
|
16081
|
+
});
|
|
16082
|
+
}, function (_wasThrown, _result) {
|
|
16083
|
+
setDeleteLoading(false);
|
|
16084
|
+
if (_wasThrown) throw _result;
|
|
16085
|
+
return _result;
|
|
16086
|
+
});
|
|
16087
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
16088
|
+
} catch (e) {
|
|
16089
|
+
return Promise.reject(e);
|
|
16090
|
+
}
|
|
16091
|
+
};
|
|
16092
|
+
var onChangeQuantity = function onChangeQuantity(product) {
|
|
16093
|
+
try {
|
|
16094
|
+
if (!onAddToCart || typeof onAddToCart !== 'function') return Promise.resolve();
|
|
16095
|
+
var _temp2 = _finallyRethrows(function () {
|
|
16096
|
+
return _catch(function () {
|
|
16097
|
+
setAddToCartLoading(true);
|
|
16098
|
+
return Promise.resolve(onAddToCart(omit(product, WISHLIST_ITEM_OMIT_KEYS))).then(function () {});
|
|
16099
|
+
}, function () {});
|
|
16100
|
+
}, function (_wasThrown2, _result2) {
|
|
16101
|
+
setAddToCartLoading(false);
|
|
16102
|
+
if (_wasThrown2) throw _result2;
|
|
16103
|
+
return _result2;
|
|
16104
|
+
});
|
|
16105
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
16106
|
+
} catch (e) {
|
|
16107
|
+
return Promise.reject(e);
|
|
16108
|
+
}
|
|
16109
|
+
};
|
|
16110
|
+
return /*#__PURE__*/React__default.createElement(ProductCardWrapper, {
|
|
16111
|
+
style: getStyleOverride(styleOverrides, 'productCardWrapper', 'ProductCardWrapper'),
|
|
16112
|
+
onClick: function onClick() {
|
|
16113
|
+
var _ref4, _product$urlAlias;
|
|
16114
|
+
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));
|
|
16115
|
+
}
|
|
16116
|
+
}, /*#__PURE__*/React__default.createElement(DeleteButton, {
|
|
16117
|
+
type: "button",
|
|
16118
|
+
className: "wishlist-delete-btn",
|
|
16119
|
+
"aria-label": "Remove from wishlist",
|
|
16120
|
+
style: getStyleOverride(styleOverrides, 'deleteButton', 'DeleteButton'),
|
|
16121
|
+
onClick: function onClick(e) {
|
|
16122
|
+
try {
|
|
16123
|
+
var _temp3 = _catch(function () {
|
|
16124
|
+
e.stopPropagation();
|
|
16125
|
+
return Promise.resolve(removeFromWishlist(product === null || product === void 0 ? void 0 : product.productId)).then(function () {});
|
|
16126
|
+
}, function (error) {
|
|
16127
|
+
console.log('error', error);
|
|
16128
|
+
});
|
|
16129
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
|
|
16130
|
+
} catch (e) {
|
|
16131
|
+
return Promise.reject(e);
|
|
16132
|
+
}
|
|
16133
|
+
}
|
|
16134
|
+
}, deleteLoading ? /*#__PURE__*/React__default.createElement(material.CircularProgress, {
|
|
16135
|
+
size: 20
|
|
16136
|
+
}) : /*#__PURE__*/React__default.createElement(ai.AiOutlineDelete, {
|
|
16137
|
+
style: {
|
|
16138
|
+
fontSize: 18
|
|
16139
|
+
}
|
|
16140
|
+
})), /*#__PURE__*/React__default.createElement(Image$3, {
|
|
16141
|
+
src: getProductImage(product === null || product === void 0 ? void 0 : product.imageUrl, imgNotFoundUrl),
|
|
16142
|
+
alt: (product === null || product === void 0 ? void 0 : product.productName) || 'Product',
|
|
16143
|
+
width: 160,
|
|
16144
|
+
height: 160,
|
|
16145
|
+
objectFit: "contain"
|
|
16146
|
+
}), !doNotShowPrice ? /*#__PURE__*/React__default.createElement(PriceContainer, {
|
|
16147
|
+
style: getStyleOverride(styleOverrides, 'priceContainer', 'PriceContainer')
|
|
16148
|
+
}, (product === null || product === void 0 ? void 0 : product.standardPrice) > (product === null || product === void 0 ? void 0 : product.retailPrice) ? /*#__PURE__*/React__default.createElement(DiscountPriceRow, {
|
|
16149
|
+
style: getStyleOverride(styleOverrides, 'discountPriceRow', 'DiscountPriceRow')
|
|
16150
|
+
}, /*#__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, {
|
|
16151
|
+
style: getStyleOverride(styleOverrides, 'productName', 'ProductName')
|
|
16152
|
+
}, 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, {
|
|
16153
|
+
variant: "contained",
|
|
16154
|
+
color: "primary",
|
|
16155
|
+
primaryColor: primaryColor,
|
|
16156
|
+
style: getStyleOverride(styleOverrides, 'productActionButton', 'ProductActionButton'),
|
|
16157
|
+
onClick: function onClick(e) {
|
|
16158
|
+
e.stopPropagation();
|
|
16159
|
+
e.preventDefault();
|
|
16160
|
+
if (product !== null && product !== void 0 && product.hasChildProducts) {
|
|
16161
|
+
router$1.push("/products/" + (product === null || product === void 0 ? void 0 : product.productId));
|
|
16162
|
+
} else {
|
|
16163
|
+
if (onAddToCart) {
|
|
16164
|
+
var _product$quantity;
|
|
16165
|
+
onChangeQuantity(_extends({}, product, {
|
|
16166
|
+
quantity: checkMinMaxQty({
|
|
16167
|
+
quantity: (_product$quantity = product === null || product === void 0 ? void 0 : product.quantity) != null ? _product$quantity : 1,
|
|
16168
|
+
product: product,
|
|
16169
|
+
allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
|
|
16170
|
+
})
|
|
16171
|
+
}));
|
|
16172
|
+
}
|
|
16173
|
+
}
|
|
16174
|
+
}
|
|
16175
|
+
}, product !== null && product !== void 0 && product.hasChildProduct ? 'Select Options' : addToCartLoading ? 'Adding...' : 'Add to Cart') : /*#__PURE__*/React__default.createElement(OutOfStockButton, {
|
|
16176
|
+
variant: "contained",
|
|
16177
|
+
color: "primary",
|
|
16178
|
+
disabled: true,
|
|
16179
|
+
style: getStyleOverride(styleOverrides, 'outOfStockButton', 'OutOfStockButton'),
|
|
16180
|
+
onClick: function onClick(e) {
|
|
16181
|
+
return e.stopPropagation();
|
|
16182
|
+
}
|
|
16183
|
+
}, "Out Of stock")));
|
|
16184
|
+
};
|
|
16185
|
+
|
|
15838
16186
|
exports.APIStaticPage = APIStaticPage;
|
|
15839
16187
|
exports.AccountDetails = AccountDetails;
|
|
15840
16188
|
exports.BrandList = BrandList;
|
|
@@ -15859,6 +16207,7 @@ exports.SwitchUser = SwitchUser;
|
|
|
15859
16207
|
exports.ThankYou = ThankYou;
|
|
15860
16208
|
exports.Variant = Variant;
|
|
15861
16209
|
exports.VendorAccount = VendorAccountDetails;
|
|
16210
|
+
exports.Wishlist = WishlistComponent;
|
|
15862
16211
|
exports.useGridSize = useGridSize;
|
|
15863
16212
|
exports.useWindowSize = useWindowSize;
|
|
15864
16213
|
//# sourceMappingURL=index.js.map
|