@salesgenterp/ui-components 0.4.563 → 0.4.566

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
@@ -473,6 +473,11 @@ var jsonParse = function jsonParse(value) {
473
473
  var convertToBoolean = function convertToBoolean(value) {
474
474
  return lodash.toNumber(value) === 1;
475
475
  };
476
+ var inDevelopment = function inDevelopment() {
477
+ if (typeof window === 'undefined') return false;
478
+ var list = ['localhost', 'calikulture-git-develop-salesgent-techgrow.vercel.app', 'calikulture-git-staging-salesgent-techgrow.vercel.app', 'aa-cell-sc-git-develop-salesgent-techgrow.vercel.app', 'aa-cell-sc-git-staging-salesgent-techgrow.vercel.app'];
479
+ return lodash.includes(list, window.location.hostname);
480
+ };
476
481
 
477
482
  function useSystemFeatureList(_ref) {
478
483
  var apiEndPoint = _ref.apiEndPoint,
@@ -3262,6 +3267,123 @@ var ExcessPaymentDialog = function ExcessPaymentDialog(_ref2) {
3262
3267
  })));
3263
3268
  };
3264
3269
 
3270
+ var CloneOrderDialog = function CloneOrderDialog(_ref) {
3271
+ var visible = _ref.visible,
3272
+ onClose = _ref.onClose,
3273
+ onSubmit = _ref.onSubmit,
3274
+ loading = _ref.loading,
3275
+ styles = _ref.styles;
3276
+ var _useState = React.useState(null),
3277
+ combineProduct = _useState[0],
3278
+ setCombineProduct = _useState[1];
3279
+ React.useEffect(function () {
3280
+ if (!visible) {
3281
+ setCombineProduct(null);
3282
+ }
3283
+ }, [visible]);
3284
+ var checkboxSx = {
3285
+ '&.Mui-checked': {
3286
+ color: styles === null || styles === void 0 ? void 0 : styles.primaryColor
3287
+ }
3288
+ };
3289
+ return /*#__PURE__*/React__default.createElement(material.Dialog, {
3290
+ open: !!visible,
3291
+ onClose: loading ? undefined : function () {
3292
+ return onClose === null || onClose === void 0 ? void 0 : onClose();
3293
+ },
3294
+ fullWidth: true,
3295
+ maxWidth: "xs"
3296
+ }, /*#__PURE__*/React__default.createElement(material.DialogTitle, null, "Clone Order"), /*#__PURE__*/React__default.createElement(material.DialogContent, null, /*#__PURE__*/React__default.createElement(material.Typography, {
3297
+ sx: {
3298
+ fontWeight: 600,
3299
+ mb: 1
3300
+ }
3301
+ }, "Do you want to combine the products?"), /*#__PURE__*/React__default.createElement(material.Typography, {
3302
+ variant: "body2",
3303
+ sx: {
3304
+ mb: 1
3305
+ }
3306
+ }, "Some products in this order may already be in your cart. Choose how their quantities should be handled:"), /*#__PURE__*/React__default.createElement(material.Typography, {
3307
+ component: "ul",
3308
+ variant: "body2",
3309
+ sx: {
3310
+ pl: 2.5,
3311
+ mb: 1
3312
+ }
3313
+ }, /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("b", null, "Yes"), " - add the order quantity to what is already in your cart."), /*#__PURE__*/React__default.createElement("li", null, /*#__PURE__*/React__default.createElement("b", null, "No"), " - replace the cart quantity with the order quantity.")), /*#__PURE__*/React__default.createElement(material.Typography, {
3314
+ variant: "body2",
3315
+ sx: {
3316
+ mb: 1,
3317
+ p: 1.5,
3318
+ borderRadius: 1,
3319
+ bgcolor: 'action.hover'
3320
+ }
3321
+ }, /*#__PURE__*/React__default.createElement("b", null, "Example:"), " Your cart has 5 of Product X and this order has 10 of Product X.", /*#__PURE__*/React__default.createElement("br", null), "Yes \u2192 your cart will have ", /*#__PURE__*/React__default.createElement("b", null, "15"), " (5 + 10).", /*#__PURE__*/React__default.createElement("br", null), "No \u2192 your cart will have ", /*#__PURE__*/React__default.createElement("b", null, "10"), "."), /*#__PURE__*/React__default.createElement(material.Grid, {
3322
+ container: true,
3323
+ spacing: 2
3324
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3325
+ item: true
3326
+ }, /*#__PURE__*/React__default.createElement(material.FormControlLabel, {
3327
+ label: "Yes",
3328
+ control: /*#__PURE__*/React__default.createElement(material.Checkbox, {
3329
+ checked: combineProduct === true,
3330
+ onChange: function onChange() {
3331
+ return setCombineProduct(true);
3332
+ },
3333
+ disabled: loading,
3334
+ sx: checkboxSx
3335
+ })
3336
+ })), /*#__PURE__*/React__default.createElement(material.Grid, {
3337
+ item: true
3338
+ }, /*#__PURE__*/React__default.createElement(material.FormControlLabel, {
3339
+ label: "No",
3340
+ control: /*#__PURE__*/React__default.createElement(material.Checkbox, {
3341
+ checked: combineProduct === false,
3342
+ onChange: function onChange() {
3343
+ return setCombineProduct(false);
3344
+ },
3345
+ disabled: loading,
3346
+ sx: checkboxSx
3347
+ })
3348
+ }))), /*#__PURE__*/React__default.createElement(material.DialogActions, {
3349
+ sx: {
3350
+ justifyContent: 'center',
3351
+ px: 0,
3352
+ pt: 2
3353
+ }
3354
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3355
+ container: true,
3356
+ spacing: 4,
3357
+ alignItems: "center",
3358
+ justifyContent: "center"
3359
+ }, /*#__PURE__*/React__default.createElement(material.Grid, {
3360
+ item: true
3361
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3362
+ primaryColor: combineProduct !== null && (styles === null || styles === void 0 ? void 0 : styles.primaryColor),
3363
+ sx: {
3364
+ fontSize: '1.3rem'
3365
+ },
3366
+ onClick: function onClick() {
3367
+ return onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(combineProduct);
3368
+ },
3369
+ loading: loading,
3370
+ disabled: combineProduct === null,
3371
+ size: "small"
3372
+ }, "Submit")), /*#__PURE__*/React__default.createElement(material.Grid, {
3373
+ item: true
3374
+ }, /*#__PURE__*/React__default.createElement(MuiButton, {
3375
+ primaryColor: styles === null || styles === void 0 ? void 0 : styles.primaryColor,
3376
+ sx: {
3377
+ fontSize: '1.3rem'
3378
+ },
3379
+ onClick: function onClick() {
3380
+ return onClose === null || onClose === void 0 ? void 0 : onClose();
3381
+ },
3382
+ disabled: loading,
3383
+ size: "small"
3384
+ }, "Cancel"))))));
3385
+ };
3386
+
3265
3387
  var _templateObject$b, _templateObject2$6, _templateObject3$4, _templateObject4$2, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
3266
3388
  var totalIcons = [{
3267
3389
  name: '',
@@ -3341,6 +3463,7 @@ var Dashboard = function Dashboard(_ref) {
3341
3463
  showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
3342
3464
  hidePayActionButton = _ref.hidePayActionButton,
3343
3465
  paymentProvider = _ref.paymentProvider;
3466
+ var showCloneOrderButton = inDevelopment();
3344
3467
  var _useState = React.useState({}),
3345
3468
  customerData = _useState[0],
3346
3469
  setCustomerData = _useState[1];
@@ -3389,6 +3512,14 @@ var Dashboard = function Dashboard(_ref) {
3389
3512
  }),
3390
3513
  invoicePreview = _useState8[0],
3391
3514
  setInvoicePreview = _useState8[1];
3515
+ var _useState9 = React.useState({
3516
+ open: false
3517
+ }),
3518
+ cloneOrderDialog = _useState9[0],
3519
+ setCloneOrderDialog = _useState9[1];
3520
+ var _useState10 = React.useState(false),
3521
+ cloneOrderLoading = _useState10[0],
3522
+ setCloneOrderLoading = _useState10[1];
3392
3523
  var _ref2 = useSystemFeatureByFieldName({
3393
3524
  apiEndPoint: apiEndPoint,
3394
3525
  token: token,
@@ -3416,9 +3547,9 @@ var Dashboard = function Dashboard(_ref) {
3416
3547
  return featureName ? DASHBOARD_ORDER_LIST_BY_NAME === null || DASHBOARD_ORDER_LIST_BY_NAME === void 0 ? void 0 : DASHBOARD_ORDER_LIST_BY_NAME[featureName] : null;
3417
3548
  }).filter(Boolean);
3418
3549
  }, [selectedDashboardOrderIds, featureValueListById]);
3419
- var _useState9 = React.useState(null),
3420
- value = _useState9[0],
3421
- setValue = _useState9[1];
3550
+ var _useState11 = React.useState(null),
3551
+ value = _useState11[0],
3552
+ setValue = _useState11[1];
3422
3553
  React.useEffect(function () {
3423
3554
  if (!(visibleTabs !== null && visibleTabs !== void 0 && visibleTabs.length)) return;
3424
3555
  var isCurrentVisible = value != null && visibleTabs.some(function (tab) {
@@ -3501,6 +3632,74 @@ var Dashboard = function Dashboard(_ref) {
3501
3632
  return Promise.reject(e);
3502
3633
  }
3503
3634
  };
3635
+ var closeCloneOrderDialog = function closeCloneOrderDialog() {
3636
+ if (cloneOrderLoading) return;
3637
+ setCloneOrderDialog({
3638
+ open: false
3639
+ });
3640
+ };
3641
+ var handleCloneOrder = function handleCloneOrder(combineProduct) {
3642
+ try {
3643
+ var documentType = cloneOrderDialog.documentType,
3644
+ documentId = cloneOrderDialog.documentId;
3645
+ if (documentId == null || cloneOrderLoading) return Promise.resolve();
3646
+ setCloneOrderLoading(true);
3647
+ var _temp = _finallyRethrows(function () {
3648
+ return _catch(function () {
3649
+ return Promise.resolve(API({
3650
+ url: "/ecommerce/addToCart",
3651
+ method: 'post',
3652
+ apiEndPoint: apiEndPoint,
3653
+ token: token,
3654
+ body: {
3655
+ documentType: documentType,
3656
+ combineProduct: !!combineProduct,
3657
+ documentId: String(documentId),
3658
+ storeId: defaultStoreId != null ? String(defaultStoreId) : undefined
3659
+ }
3660
+ })).then(function () {
3661
+ setCloneOrderDialog({
3662
+ open: false
3663
+ });
3664
+ alert('Order items added to cart successfully.');
3665
+ window.location.reload();
3666
+ });
3667
+ }, function () {});
3668
+ }, function (_wasThrown, _result) {
3669
+ setCloneOrderLoading(false);
3670
+ if (_wasThrown) throw _result;
3671
+ return _result;
3672
+ });
3673
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
3674
+ } catch (e) {
3675
+ return Promise.reject(e);
3676
+ }
3677
+ };
3678
+ var getCloneOrderColumn = function getCloneOrderColumn(_ref3) {
3679
+ var documentType = _ref3.documentType,
3680
+ idKey = _ref3.idKey;
3681
+ return {
3682
+ id: 'cloneOrder',
3683
+ label: 'Clone Order',
3684
+ align: 'center',
3685
+ format: function format(_value, record) {
3686
+ return /*#__PURE__*/React__default.createElement(MuiButton, {
3687
+ primaryColor: (record === null || record === void 0 ? void 0 : record[idKey]) != null && primaryColor,
3688
+ disabled: (record === null || record === void 0 ? void 0 : record[idKey]) == null,
3689
+ onClick: function onClick() {
3690
+ return setCloneOrderDialog({
3691
+ open: true,
3692
+ documentType: documentType,
3693
+ documentId: record === null || record === void 0 ? void 0 : record[idKey]
3694
+ });
3695
+ },
3696
+ style: {
3697
+ whiteSpace: 'nowrap'
3698
+ }
3699
+ }, "Clone Order");
3700
+ }
3701
+ };
3702
+ };
3504
3703
  var columns = [{
3505
3704
  id: 'orderId',
3506
3705
  label: 'Invoice #'
@@ -3590,7 +3789,10 @@ var Dashboard = function Dashboard(_ref) {
3590
3789
  disabled: (record === null || record === void 0 ? void 0 : record.dueBalance) <= 0
3591
3790
  }, "Pay"));
3592
3791
  }
3593
- }];
3792
+ }].concat(showCloneOrderButton ? [getCloneOrderColumn({
3793
+ documentType: 'ORDER',
3794
+ idKey: 'orderId'
3795
+ })] : []);
3594
3796
  var salesOrderColumns = [{
3595
3797
  id: 'salesOrderId',
3596
3798
  label: 'SO #'
@@ -3644,7 +3846,10 @@ var Dashboard = function Dashboard(_ref) {
3644
3846
  }
3645
3847
  })));
3646
3848
  }
3647
- }];
3849
+ }].concat(showCloneOrderButton ? [getCloneOrderColumn({
3850
+ documentType: 'SALES_ORDER',
3851
+ idKey: 'salesOrderId'
3852
+ })] : []);
3648
3853
  var quotaionColumns = [{
3649
3854
  id: 'quotationId',
3650
3855
  label: 'ID'
@@ -3692,7 +3897,10 @@ var Dashboard = function Dashboard(_ref) {
3692
3897
  }
3693
3898
  })));
3694
3899
  }
3695
- }];
3900
+ }].concat(showCloneOrderButton ? [getCloneOrderColumn({
3901
+ documentType: 'QUOTATION',
3902
+ idKey: 'quotationId'
3903
+ })] : []);
3696
3904
  var returnOrderColumns = [{
3697
3905
  id: 'returnOrderId',
3698
3906
  label: 'ID'
@@ -3743,7 +3951,7 @@ var Dashboard = function Dashboard(_ref) {
3743
3951
  React.useEffect(function () {
3744
3952
  (function () {
3745
3953
  try {
3746
- var _temp = _catch(function () {
3954
+ var _temp2 = _catch(function () {
3747
3955
  return Promise.resolve(API({
3748
3956
  url: "/ecommerce/customer",
3749
3957
  apiEndPoint: apiEndPoint,
@@ -3760,7 +3968,7 @@ var Dashboard = function Dashboard(_ref) {
3760
3968
  });
3761
3969
  });
3762
3970
  }, function () {});
3763
- return _temp && _temp.then ? _temp.then(function () {}) : void 0;
3971
+ return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
3764
3972
  } catch (e) {
3765
3973
  Promise.reject(e);
3766
3974
  }
@@ -3845,6 +4053,12 @@ var Dashboard = function Dashboard(_ref) {
3845
4053
  orderId: isPaymentModal === null || isPaymentModal === void 0 ? void 0 : isPaymentModal.orderId,
3846
4054
  setTriggerTableData: setTriggerTableData,
3847
4055
  styles: styles
4056
+ }), /*#__PURE__*/React__default.createElement(CloneOrderDialog, {
4057
+ visible: !!(cloneOrderDialog !== null && cloneOrderDialog !== void 0 && cloneOrderDialog.open),
4058
+ onClose: closeCloneOrderDialog,
4059
+ onSubmit: handleCloneOrder,
4060
+ loading: cloneOrderLoading,
4061
+ styles: styles
3848
4062
  }), (isExcessPaymentModal === null || isExcessPaymentModal === void 0 ? void 0 : isExcessPaymentModal.open) && /*#__PURE__*/React__default.createElement(ExcessPaymentDialog, {
3849
4063
  excessPaymentToken: (_queryParams$excessPa = queryParams === null || queryParams === void 0 ? void 0 : queryParams.excessPayment) != null ? _queryParams$excessPa : '',
3850
4064
  customerData: customerData,
@@ -11943,36 +12157,69 @@ var AsyncSelect = function AsyncSelect(_ref3) {
11943
12157
  return /*#__PURE__*/React__default.createElement(AsyncSelectField, props);
11944
12158
  };
11945
12159
 
11946
- var _templateObject$F;
12160
+ var _templateObject$F, _templateObject2$u, _templateObject3$o, _templateObject4$j, _templateObject5$f, _templateObject6$d, _templateObject7$a, _templateObject8$8;
12161
+ var DEFAULT_PRIMARY = '#424242';
12162
+ var getPrimary = function getPrimary(props) {
12163
+ var _props$theme;
12164
+ return (props === null || props === void 0 ? void 0 : (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.primaryColor) || DEFAULT_PRIMARY;
12165
+ };
11947
12166
  var Container$2 = styled__default.div(_templateObject$F || (_templateObject$F = _taggedTemplateLiteralLoose([""])));
12167
+ var TopBar = styled__default.div(_templateObject2$u || (_templateObject2$u = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n .search {\n flex: 1;\n min-width: 0;\n }\n @media only screen and (max-width: 600px) {\n flex-wrap: wrap;\n .search {\n flex-basis: 100%;\n }\n }\n"])));
12168
+ var LastOrderedWrapper = styled__default.div(_templateObject3$o || (_templateObject3$o = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 6px;\n margin-left: auto;\n flex-shrink: 0;\n"])));
12169
+ var LastOrderedButton = styled__default.button(_templateObject4$j || (_templateObject4$j = _taggedTemplateLiteralLoose(["\n height: 38px;\n padding: 0 16px;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n white-space: nowrap;\n font-weight: 500;\n color: #fff;\n background: ", ";\n transition: opacity 0.2s;\n &:hover {\n opacity: 0.9;\n }\n"])), function (props) {
12170
+ var _props$theme2;
12171
+ return ((_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.primaryColor) || '#424242';
12172
+ });
12173
+ var InfoIcon = styled__default.span(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n font-size: 1.25em;\n color: #6b6b6b;\n cursor: pointer;\n"])));
12174
+ var DialogFooterButton = styled__default.button(_templateObject6$d || (_templateObject6$d = _taggedTemplateLiteralLoose(["\n height: 38px;\n min-width: 100px;\n padding: 0 18px;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n white-space: nowrap;\n border: 1px solid ", ";\n color: ", ";\n background: ", ";\n transition: opacity 0.2s;\n &:hover:not(:disabled) {\n opacity: 0.9;\n }\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n"])), function (props) {
12175
+ var _props$theme3;
12176
+ return ((_props$theme3 = props.theme) === null || _props$theme3 === void 0 ? void 0 : _props$theme3.primaryColor) || '#424242';
12177
+ }, function (props) {
12178
+ var _props$theme4;
12179
+ return props.variant === 'outlined' ? ((_props$theme4 = props.theme) === null || _props$theme4 === void 0 ? void 0 : _props$theme4.primaryColor) || '#424242' : '#fff';
12180
+ }, function (props) {
12181
+ var _props$theme5;
12182
+ return props.variant === 'outlined' ? '#fff' : ((_props$theme5 = props.theme) === null || _props$theme5 === void 0 ? void 0 : _props$theme5.primaryColor) || '#424242';
12183
+ });
12184
+ var DialogLoadMore = styled__default.div(_templateObject7$a || (_templateObject7$a = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n padding: 16px 0 4px;\n color: #6b6b6b;\n"])));
12185
+ var DialogFooter = styled__default.div(_templateObject8$8 || (_templateObject8$8 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n flex-wrap: wrap;\n .pagination {\n display: flex;\n align-items: center;\n gap: 12px;\n flex-wrap: wrap;\n }\n .count {\n font-size: 0.85em;\n color: #6b6b6b;\n white-space: nowrap;\n }\n .buttons {\n display: flex;\n gap: 8px;\n margin-left: auto;\n }\n"])));
11948
12186
 
11949
- var _templateObject$G, _templateObject2$u, _templateObject3$o, _templateObject4$j, _templateObject5$f, _templateObject6$d;
12187
+ var _templateObject$G, _templateObject2$v, _templateObject3$p, _templateObject4$k, _templateObject5$g, _templateObject6$e;
11950
12188
  var ProductImage$1 = styled__default.img.attrs(function (props) {
11951
12189
  return {
11952
12190
  loading: props.loading || 'lazy',
11953
12191
  decoding: 'async'
11954
12192
  };
11955
- })(_templateObject$G || (_templateObject$G = _taggedTemplateLiteralLoose(["\n min-width: 50px;\n min-height: 50px;\n object-fit: contain;\n @media only screen and (max-width: 600px) {\n margin: 0.5em 0;\n padding-right: 0.5em;\n }\n"])));
11956
- var ProductName$1 = styled__default.h6(_templateObject2$u || (_templateObject2$u = _taggedTemplateLiteralLoose(["\n font-size: ", ";\n padding: 0;\n line-height: 1.3em;\n max-height: ", ";\n height: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n height: fit-content;\n"])), function (props) {
12193
+ })(_templateObject$G || (_templateObject$G = _taggedTemplateLiteralLoose(["\n min-width: 50px;\n min-height: 50px;\n object-fit: contain;\n"])));
12194
+ var ProductName$1 = styled__default.h6(_templateObject2$v || (_templateObject2$v = _taggedTemplateLiteralLoose(["\n font-size: ", ";\n padding: 0;\n line-height: 1.3em;\n max-height: ", ";\n height: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n height: fit-content;\n"])), function (props) {
11957
12195
  return props.size || '1em';
11958
12196
  }, function (props) {
11959
12197
  return props.maxHeight ? props.maxHeight + "em" : '2.75em';
11960
12198
  }, function (props) {
11961
12199
  return props.maxHeight ? props.maxHeight + "em" : '2.80em';
11962
12200
  });
11963
- var CartTableRow$1 = styled__default(material.TableRow)(_templateObject3$o || (_templateObject3$o = _taggedTemplateLiteralLoose(["\n position: relative;\n transition: 0.3s;\n background: white;\n /* &:hover {\n td:first-child,\n td:last-child {\n border-left-style: solid;\n border-top-style: solid;\n border-top-right-radius: 10px;\n }\n } */\n .outOfStock {\n font-size: 0.75em;\n color: red;\n text-transform: uppercase;\n font-weight: 500;\n }\n .price {\n font-size: ", ";\n font-weight: bold;\n color: #323232;\n /* font-size: 1.15em; */\n }\n .borderLeft {\n height: 100%;\n background: ", ";\n transition: 0.2s;\n width: 0px;\n position: absolute;\n left: 0;\n top: 0;\n border-top-left-radius: 10px;\n display: none;\n border-bottom-left-radius: 10px;\n }\n .cartCheckBox {\n &.Mui-checked {\n svg {\n color: ", ";\n }\n }\n }\n &:hover {\n background: white !important;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);\n border-radius: 10px;\n /* opacity: 1;\n box-shadow: 1px 2px 6px 2px rgba(0, 0, 0, 0.2); */\n z-index: 2;\n /* border-radius: 20px; */\n .borderLeft {\n width: 12px;\n display: inline-block;\n }\n }\n @media only screen and (max-width: 600px) {\n .CartnoPaddingSm {\n padding: 0 !important;\n }\n .price {\n font-size: 0.8em;\n }\n margin: 0.5em 0;\n .cartCheckBox {\n .css-i4bv87-MuiSvgIcon-root {\n font-size: 10px !important;\n }\n }\n }\n"])), function (props) {
12201
+ var CartTableRow$1 = styled__default(material.TableRow)(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n position: relative;\n transition: 0.3s;\n background: ", ";\n cursor: pointer;\n /* &:hover {\n td:first-child,\n td:last-child {\n border-left-style: solid;\n border-top-style: solid;\n border-top-right-radius: 10px;\n }\n } */\n .outOfStock {\n font-size: 0.75em;\n color: red;\n text-transform: uppercase;\n font-weight: 500;\n }\n .price {\n font-size: ", ";\n font-weight: bold;\n color: #323232;\n /* font-size: 1.15em; */\n }\n .borderLeft {\n height: 100%;\n background: ", ";\n transition: 0.2s;\n width: ", ";\n position: absolute;\n left: 0;\n top: 0;\n border-top-left-radius: 10px;\n display: ", ";\n border-bottom-left-radius: 10px;\n }\n .cartCheckBox {\n &.Mui-checked {\n svg {\n color: ", ";\n }\n }\n }\n &:hover {\n background: ", " !important;\n box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);\n border-radius: 10px;\n /* opacity: 1;\n box-shadow: 1px 2px 6px 2px rgba(0, 0, 0, 0.2); */\n z-index: 2;\n /* border-radius: 20px; */\n .borderLeft {\n width: 12px;\n display: inline-block;\n }\n }\n .mobileLabel {\n display: none;\n }\n .stock {\n font-size: 0.95em;\n font-weight: 600;\n color: #2e7d32;\n }\n .stock-out {\n color: #d32f2f;\n }\n /* Small screens: each row becomes a card.\n [check] [img] name ............ [delete]\n $price each\n [- qty +] Subtotal $x */\n @media only screen and (max-width: 768px) {\n display: grid;\n grid-template-columns: 32px 56px minmax(0, 1fr) auto;\n grid-template-areas:\n 'check img name delete'\n 'check img price stock'\n 'check qty qty subtotal';\n column-gap: 10px;\n row-gap: 6px;\n align-items: center;\n padding: 12px 10px;\n margin: 0 0 10px;\n border: 1px solid #ececec;\n border-radius: 10px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);\n &:hover {\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);\n .borderLeft {\n display: none;\n }\n }\n > td,\n > th {\n display: block;\n width: auto;\n padding: 0 !important;\n text-align: left;\n }\n .cell-check {\n grid-area: check;\n align-self: start;\n }\n .cell-img {\n grid-area: img;\n align-self: start;\n img {\n width: 56px;\n height: 56px;\n margin: 0;\n padding: 0;\n }\n }\n .cell-name {\n grid-area: name;\n align-self: start;\n h6 {\n font-size: 0.9em;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n p {\n font-size: 0.8em;\n margin-top: 2px;\n }\n }\n .cell-price {\n grid-area: price;\n .price {\n font-size: 0.85em;\n font-weight: 500;\n color: #6b6b6b;\n }\n }\n .cell-stock {\n grid-area: stock;\n text-align: right;\n .stock {\n font-size: 0.8em;\n }\n }\n .cell-qty {\n grid-area: qty;\n justify-self: start;\n }\n .cell-subtotal {\n grid-area: subtotal;\n text-align: right;\n .price {\n font-size: 0.95em;\n }\n }\n .cell-delete {\n grid-area: delete;\n align-self: start;\n }\n .mobileLabel {\n display: inline;\n font-weight: 400;\n color: #6b6b6b;\n font-size: 0.85em;\n }\n .cartCheckBox {\n padding: 0;\n }\n }\n"])), function (props) {
12202
+ return props.$selected ? '#f7f8fa' : 'white';
12203
+ }, function (props) {
11964
12204
  return props.size || '1.19em';
11965
12205
  }, function (prop) {
11966
- return prop.bg;
12206
+ return prop.bg || getPrimary(prop);
12207
+ }, function (props) {
12208
+ return props.$selected ? '4px' : '0px';
12209
+ }, function (props) {
12210
+ return props.$selected ? 'inline-block' : 'none';
11967
12211
  }, function (prop) {
11968
- return prop.bg;
12212
+ return prop.bg || getPrimary(prop);
12213
+ }, function (props) {
12214
+ return props.$selected ? '#f7f8fa' : 'white';
11969
12215
  });
11970
- var CartTableCell$2 = styled__default(material.TableCell)(_templateObject4$j || (_templateObject4$j = _taggedTemplateLiteralLoose(["\n && {\n border: none !important;\n font-size: 1em;\n }\n"])));
11971
- var QuantityBox$1 = styled__default.div(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n height: 1.7em;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n div {\n /* width:30px; */\n min-height: 100%;\n aspect-ratio: 1.15/1;\n display: grid;\n place-items: center;\n font-size: 0.65em;\n color: white;\n background-color: #323232;\n cursor: pointer;\n }\n .price {\n background: transparent;\n cursor: auto;\n background: #ffffff;\n border: 1px solid #ebebeb;\n p {\n color: #5e5c5c;\n font-size: 0.685em;\n font-weight: 500;\n }\n }\n .add {\n background-color: #ebebeb;\n color: #323232;\n }\n"])));
11972
- var DeleteBtn$1 = styled__default.div(_templateObject6$d || (_templateObject6$d = _taggedTemplateLiteralLoose(["\n display: grid;\n place-items: center;\n cursor: pointer;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n background: #eef1f4;\n color: #393f48;\n font-size: 0.75em;\n transition: 0.4s;\n &:hover {\n background: red;\n color: white;\n }\n"])));
12216
+ var CartTableCell$2 = styled__default(material.TableCell)(_templateObject4$k || (_templateObject4$k = _taggedTemplateLiteralLoose(["\n && {\n border: none !important;\n font-size: 1em;\n }\n"])));
12217
+ var QuantityBox$1 = styled__default.div(_templateObject5$g || (_templateObject5$g = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: stretch;\n height: 36px;\n border: 1px solid #dcdfe4;\n border-radius: 8px;\n overflow: hidden;\n background: #fff;\n transition: border-color 0.2s, box-shadow 0.2s;\n &:focus-within {\n border-color: ", ";\n box-shadow: 0 0 0 1px ", ";\n }\n .stepBtn {\n position: relative;\n isolation: isolate;\n width: 34px;\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n background: #fff;\n color: ", ";\n font-size: 14px;\n cursor: pointer;\n transition: color 0.15s;\n /* Light tint: the primary color at low opacity, behind the icon. */\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n z-index: -1;\n background: ", ";\n opacity: 0.1;\n transition: opacity 0.15s;\n }\n &:hover:not(:disabled) {\n color: #fff;\n &::before {\n opacity: 1;\n }\n }\n &:active:not(:disabled) {\n transform: scale(0.94);\n }\n &:disabled {\n cursor: not-allowed;\n color: #b8bcc4;\n background: #f4f5f7;\n &::before {\n display: none;\n }\n }\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n }\n input {\n width: 48px;\n border: none;\n border-left: 1px solid #dcdfe4;\n border-right: 1px solid #dcdfe4;\n outline: none;\n text-align: center;\n font-size: 14px;\n font-weight: 600;\n color: #2b2b2b;\n background: #fff;\n -moz-appearance: textfield;\n &::-webkit-outer-spin-button,\n &::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n &:disabled {\n color: #9aa0a6;\n }\n }\n @media only screen and (max-width: 768px) {\n height: 38px;\n .stepBtn {\n width: 38px;\n }\n }\n"])), getPrimary, getPrimary, getPrimary, getPrimary, getPrimary);
12218
+ var DeleteBtn$1 = styled__default.button(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n display: grid;\n place-items: center;\n cursor: pointer;\n border: none;\n border-radius: 8px;\n width: 32px;\n height: 32px;\n padding: 0;\n background: #f4f5f7;\n color: #6b7280;\n font-size: 16px;\n transition: background 0.2s, color 0.2s;\n &:hover {\n background: #fdecec;\n color: #d32f2f;\n }\n &:focus-visible {\n outline: 2px solid #d32f2f;\n outline-offset: 2px;\n }\n"])));
11973
12219
  var CardRow$1 = function CardRow(_ref) {
11974
- var _styles$price, _styles$Btn, _row$standardPrice, _row$subtotal;
12220
+ var _styles$price, _row$availableQuantit;
11975
12221
  var row = _ref.row,
12222
+ index = _ref.index,
11976
12223
  isItemSelected = _ref.isItemSelected,
11977
12224
  handleClick = _ref.handleClick,
11978
12225
  imgnotfoundUrl = _ref.imgnotfoundUrl,
@@ -11982,9 +12229,60 @@ var CardRow$1 = function CardRow(_ref) {
11982
12229
  imgSize = _ref.imgSize,
11983
12230
  styles = _ref.styles,
11984
12231
  _ref$allowToProcessIn = _ref.allowToProcessInvoiceForOutOfStockProductsEcommerce,
11985
- allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref$allowToProcessIn === void 0 ? false : _ref$allowToProcessIn;
12232
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref$allowToProcessIn === void 0 ? false : _ref$allowToProcessIn,
12233
+ _ref$hideDelete = _ref.hideDelete,
12234
+ hideDelete = _ref$hideDelete === void 0 ? false : _ref$hideDelete,
12235
+ _ref$hideStock = _ref.hideStock,
12236
+ hideStock = _ref$hideStock === void 0 ? false : _ref$hideStock;
11986
12237
  var imgnotfoundUrlcommon = noImgAvailable;
11987
12238
  if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
12239
+ var onChangeQuantity = function onChangeQuantity(product) {
12240
+ if ((product === null || product === void 0 ? void 0 : product.quantity) <= 0 || !allowToProcessInvoiceForOutOfStockProductsEcommerce && (product === null || product === void 0 ? void 0 : product.availableQuantity) <= 0) {
12241
+ return handleRemoveProduct(product, index);
12242
+ }
12243
+ handleIncrementDecrement(product);
12244
+ };
12245
+ var timer = React.useRef();
12246
+ var _useState = React.useState(row === null || row === void 0 ? void 0 : row.quantity),
12247
+ quantity = _useState[0],
12248
+ setQuantity = _useState[1];
12249
+ React.useEffect(function () {
12250
+ setQuantity(row === null || row === void 0 ? void 0 : row.quantity);
12251
+ }, [row === null || row === void 0 ? void 0 : row.quantity]);
12252
+ React.useEffect(function () {
12253
+ return function () {
12254
+ return clearTimeout(timer.current);
12255
+ };
12256
+ }, []);
12257
+ var onChangeInput = function onChangeInput(e) {
12258
+ var value = e.target.value;
12259
+ setQuantity(value);
12260
+ clearTimeout(timer.current);
12261
+ if (value === '') return;
12262
+ timer.current = setTimeout(function () {
12263
+ var typedQty = parseInt(value, 10);
12264
+ if (!(typedQty > 0)) {
12265
+ handleRemoveProduct(row, index);
12266
+ setQuantity(row === null || row === void 0 ? void 0 : row.quantity);
12267
+ return;
12268
+ }
12269
+ var validQty = checkMinMaxQty({
12270
+ quantity: typedQty,
12271
+ product: row,
12272
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
12273
+ });
12274
+ setQuantity(validQty);
12275
+ onChangeQuantity(_extends({}, row, {
12276
+ quantity: validQty
12277
+ }));
12278
+ }, 500);
12279
+ };
12280
+ var onBlurInput = function onBlurInput() {
12281
+ if (quantity === '' || quantity === undefined) {
12282
+ clearTimeout(timer.current);
12283
+ setQuantity(row === null || row === void 0 ? void 0 : row.quantity);
12284
+ }
12285
+ };
11988
12286
  return /*#__PURE__*/React__default.createElement(CartTableRow$1, {
11989
12287
  onClick: function onClick(event) {
11990
12288
  return handleClick(event, row);
@@ -11992,11 +12290,13 @@ var CardRow$1 = function CardRow(_ref) {
11992
12290
  role: "checkbox",
11993
12291
  "aria-checked": isItemSelected,
11994
12292
  tabIndex: -1,
11995
- key: row.ProductId,
12293
+ key: row === null || row === void 0 ? void 0 : row.rowId,
11996
12294
  size: styles === null || styles === void 0 ? void 0 : (_styles$price = styles.price) === null || _styles$price === void 0 ? void 0 : _styles$price.size,
11997
- bg: (styles === null || styles === void 0 ? void 0 : styles.borderLeft) || (styles === null || styles === void 0 ? void 0 : (_styles$Btn = styles.Btn) === null || _styles$Btn === void 0 ? void 0 : _styles$Btn.background)
12295
+ bg: styles === null || styles === void 0 ? void 0 : styles.borderLeft,
12296
+ $selected: isItemSelected
11998
12297
  }, /*#__PURE__*/React__default.createElement(CartTableCell$2, {
11999
12298
  padding: "checkbox",
12299
+ className: "cell-check",
12000
12300
  style: {
12001
12301
  position: 'relative'
12002
12302
  }
@@ -12011,9 +12311,9 @@ var CardRow$1 = function CardRow(_ref) {
12011
12311
  },
12012
12312
  className: "cartCheckBox"
12013
12313
  })), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12014
- className: "CartnoPaddingSm"
12314
+ className: "cell-img"
12015
12315
  }, /*#__PURE__*/React__default.createElement(ProductImage$1, {
12016
- src: row.imageUrl && row.imageUrl !== 'null' ? row.imageUrl : imgnotfoundUrlcommon,
12316
+ src: row !== null && row !== void 0 && row.imageUrl && (row === null || row === void 0 ? void 0 : row.imageUrl) !== 'null' ? row === null || row === void 0 ? void 0 : row.imageUrl : imgnotfoundUrlcommon,
12017
12317
  alt: 'img',
12018
12318
  width: (imgSize === null || imgSize === void 0 ? void 0 : imgSize.width) || 50,
12019
12319
  height: (imgSize === null || imgSize === void 0 ? void 0 : imgSize.height) || 50
@@ -12021,60 +12321,93 @@ var CardRow$1 = function CardRow(_ref) {
12021
12321
  component: "th",
12022
12322
  id: row === null || row === void 0 ? void 0 : row.labelId,
12023
12323
  scope: "row",
12024
- padding: "none"
12025
- }, /*#__PURE__*/React__default.createElement(ProductName$1, null, row.productName), !allowToProcessInvoiceForOutOfStockProductsEcommerce ? (row.quantity > row.availableQuantity || row.availableQuantity <= 0) && /*#__PURE__*/React__default.createElement("p", {
12324
+ padding: "none",
12325
+ className: "cell-name"
12326
+ }, /*#__PURE__*/React__default.createElement(ProductName$1, null, row === null || row === void 0 ? void 0 : row.productName), !allowToProcessInvoiceForOutOfStockProductsEcommerce ? ((row === null || row === void 0 ? void 0 : row.quantity) > (row === null || row === void 0 ? void 0 : row.availableQuantity) || (row === null || row === void 0 ? void 0 : row.availableQuantity) <= 0) && /*#__PURE__*/React__default.createElement("p", {
12026
12327
  style: {
12027
12328
  color: 'red',
12028
12329
  fontWeight: 500
12029
12330
  }
12030
- }, "Maximum available quantity is ", row.availableQuantity) : /*#__PURE__*/React__default.createElement("div", null)), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12331
+ }, "Maximum available quantity is ", row === null || row === void 0 ? void 0 : row.availableQuantity) : /*#__PURE__*/React__default.createElement("div", null)), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12031
12332
  align: "center",
12032
- className: "CartnoBelowSm"
12333
+ className: "cell-price"
12033
12334
  }, /*#__PURE__*/React__default.createElement("p", {
12034
12335
  className: "price"
12035
- }, "$", row === null || row === void 0 ? void 0 : (_row$standardPrice = row.standardPrice) === null || _row$standardPrice === void 0 ? void 0 : _row$standardPrice.toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12036
- align: "center"
12037
- }, /*#__PURE__*/React__default.createElement(QuantityBox$1, null, /*#__PURE__*/React__default.createElement("div", {
12336
+ }, "$", (Number(row === null || row === void 0 ? void 0 : row.standardPrice) || 0).toFixed(2), /*#__PURE__*/React__default.createElement("span", {
12337
+ className: "mobileLabel"
12338
+ }, " each"))), !hideStock && /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12339
+ align: "center",
12340
+ className: "cell-stock"
12341
+ }, /*#__PURE__*/React__default.createElement("p", {
12342
+ className: "stock " + (Number(row === null || row === void 0 ? void 0 : row.availableQuantity) > 0 ? '' : 'stock-out')
12343
+ }, /*#__PURE__*/React__default.createElement("span", {
12344
+ className: "mobileLabel"
12345
+ }, "Stock: "), (_row$availableQuantit = row === null || row === void 0 ? void 0 : row.availableQuantity) != null ? _row$availableQuantit : '-')), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12346
+ align: "center",
12347
+ className: "cell-qty"
12348
+ }, /*#__PURE__*/React__default.createElement(QuantityBox$1, {
12349
+ onClick: function onClick(e) {
12350
+ return e.stopPropagation();
12351
+ }
12352
+ }, /*#__PURE__*/React__default.createElement("button", {
12353
+ type: "button",
12354
+ className: "stepBtn",
12355
+ "aria-label": "Decrease quantity",
12356
+ disabled: loading || hideDelete && (row === null || row === void 0 ? void 0 : row.quantity) <= 1,
12038
12357
  onClick: function onClick(e) {
12039
12358
  e.stopPropagation();
12040
12359
  if (loading) return;
12041
- if (!allowToProcessInvoiceForOutOfStockProductsEcommerce && (row === null || row === void 0 ? void 0 : row.availableQuantity) <= 0) {
12360
+ if (!allowToProcessInvoiceForOutOfStockProductsEcommerce && (row === null || row === void 0 ? void 0 : row.availableQuantity) <= 0 || (row === null || row === void 0 ? void 0 : row.quantity) === 1) {
12042
12361
  return handleRemoveProduct(row, index);
12043
12362
  }
12044
- handleIncrementDecrement('decrement', _extends({}, row, {
12045
- quantity: (row === null || row === void 0 ? void 0 : row.quantity) > (row === null || row === void 0 ? void 0 : row.availableQuantity) ? row === null || row === void 0 ? void 0 : row.availableQuantity : row === null || row === void 0 ? void 0 : row.quantity
12363
+ onChangeQuantity(_extends({}, row, {
12364
+ quantity: checkMinMaxQty({
12365
+ quantity: (row === null || row === void 0 ? void 0 : row.quantity) - 1,
12366
+ product: row,
12367
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
12368
+ })
12046
12369
  }));
12047
12370
  }
12048
- }, /*#__PURE__*/React__default.createElement(ai.AiOutlineMinus, {
12049
- style: {
12050
- fontSize: 'inherit'
12051
- }
12052
- })), /*#__PURE__*/React__default.createElement("div", {
12053
- className: "price"
12054
- }, /*#__PURE__*/React__default.createElement("p", null, row === null || row === void 0 ? void 0 : row.quantity)), /*#__PURE__*/React__default.createElement("div", {
12055
- className: "add",
12371
+ }, /*#__PURE__*/React__default.createElement(ai.AiOutlineMinus, null)), /*#__PURE__*/React__default.createElement("input", {
12372
+ type: "number",
12373
+ min: 1,
12374
+ inputMode: "numeric",
12375
+ value: quantity,
12376
+ disabled: loading,
12377
+ onChange: onChangeInput,
12378
+ onBlur: onBlurInput,
12379
+ onFocus: function onFocus(e) {
12380
+ return e.target.select();
12381
+ },
12382
+ "aria-label": "Quantity"
12383
+ }), /*#__PURE__*/React__default.createElement("button", {
12384
+ type: "button",
12385
+ className: "stepBtn",
12386
+ "aria-label": "Increase quantity",
12387
+ disabled: loading,
12056
12388
  onClick: function onClick(e) {
12057
12389
  e.stopPropagation();
12058
12390
  if (loading) return;
12059
- if (!allowToProcessInvoiceForOutOfStockProductsEcommerce && (row === null || row === void 0 ? void 0 : row.availableQuantity) <= 0) {
12060
- return handleRemoveProduct(row, index);
12061
- }
12062
- handleIncrementDecrement('increment', _extends({}, row, {
12063
- quantity: (row === null || row === void 0 ? void 0 : row.quantity) > (row === null || row === void 0 ? void 0 : row.availableQuantity) ? row === null || row === void 0 ? void 0 : row.availableQuantity : row === null || row === void 0 ? void 0 : row.quantity
12391
+ onChangeQuantity(_extends({}, row, {
12392
+ quantity: checkMinMaxQty({
12393
+ quantity: (row === null || row === void 0 ? void 0 : row.quantity) + 1,
12394
+ product: row,
12395
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
12396
+ })
12064
12397
  }));
12065
12398
  }
12066
- }, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, {
12067
- style: {
12068
- fontSize: 'inherit'
12069
- }
12070
- })))), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12071
- alig: "center",
12072
- className: "CartnoPaddingSm"
12399
+ }, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null)))), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12400
+ className: "cell-subtotal"
12073
12401
  }, /*#__PURE__*/React__default.createElement("p", {
12074
12402
  className: "price"
12075
- }, "$", (_row$subtotal = row.subtotal) === null || _row$subtotal === void 0 ? void 0 : _row$subtotal.toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12076
- alig: "center"
12403
+ }, /*#__PURE__*/React__default.createElement("span", {
12404
+ className: "mobileLabel"
12405
+ }, "Subtotal "), "$", (Number(row === null || row === void 0 ? void 0 : row.subtotal) || 0).toFixed(2))), !hideDelete && /*#__PURE__*/React__default.createElement(CartTableCell$2, {
12406
+ className: "cell-delete"
12077
12407
  }, /*#__PURE__*/React__default.createElement(DeleteBtn$1, {
12408
+ type: "button",
12409
+ "aria-label": "Remove product",
12410
+ title: "Remove",
12078
12411
  onClick: function onClick(e) {
12079
12412
  e.stopPropagation();
12080
12413
  if (loading) return;
@@ -12087,13 +12420,13 @@ var CardRow$1 = function CardRow(_ref) {
12087
12420
  }))));
12088
12421
  };
12089
12422
 
12090
- var _templateObject$H, _templateObject2$v, _templateObject3$p, _templateObject4$k, _templateObject5$g, _templateObject6$e, _templateObject7$a, _templateObject8$8, _templateObject9$6;
12423
+ var _templateObject$H, _templateObject2$w, _templateObject3$q, _templateObject4$l, _templateObject5$h, _templateObject6$f, _templateObject7$b, _templateObject8$9, _templateObject9$6, _templateObject10$5;
12091
12424
  var CartPageSection$1 = styled__default.section(_templateObject$H || (_templateObject$H = _taggedTemplateLiteralLoose(["\n background: ", ";\n max-width: 100%;\n width: fit-content;\n background: ", ";\n overflow: hidden;\n border-radius: 28px;\n\n @media screen and (max-width: 1200px) {\n padding: 0 1em;\n }\n @media screen and (max-width: 600px) {\n padding: 0 1em;\n }\n"])), function (props) {
12092
12425
  return props.bg;
12093
12426
  }, function (props) {
12094
12427
  return props.bg || '#FAE8E5';
12095
12428
  });
12096
- var CartPageContainer$1 = styled__default.div(_templateObject2$v || (_templateObject2$v = _taggedTemplateLiteralLoose(["\n max-width: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n border-radius: 28px 28px 28px 14px;\n padding: 2em 2.5em;\n padding-bottom: 3em;\n border-radius: 28px;\n opacity: ", ";\n .scrollDiv {\n width: 68%;\n max-height: 630px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n\n margin-right: 0.3em;\n &::-webkit-scrollbar {\n width: 10px;\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n\n border-radius: 16px;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 16px;\n border: 2px solid;\n }\n /* box-shadow: 0px 20px 35px rgba(0, 0, 0, 0.05); */\n }\n table {\n border-collapse: separate;\n border-spacing: 0 4px;\n row-gap: 4px;\n }\n\n td {\n /* border: solid 1px #000; */\n border-style: none solid solid none;\n /* padding: 10px; */\n /* margin-bottom:5px; */\n }\n\n tr:first-child td:first-child {\n border-top-left-radius: 10px;\n }\n tr td:last-child {\n border-top-right-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n\n tr td:first-child {\n border-bottom-left-radius: 10px;\n border-top-left-radius: 10px;\n }\n tr td:last-child {\n border-bottom-right-radius: 10px;\n }\n\n tr td {\n border-top-style: solid;\n }\n tr td:first-child {\n border-left-style: solid;\n }\n\n @media only screen and (max-width: 1200px) {\n flex-direction: column;\n align-items: center;\n padding: 0.5em;\n .scrollDiv {\n width: 100%;\n margin: 0;\n margin-bottom: 2em;\n padding: 0 0.4em;\n }\n }\n"])), function (props) {
12429
+ var CartPageContainer$1 = styled__default.div(_templateObject2$w || (_templateObject2$w = _taggedTemplateLiteralLoose(["\n max-width: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n border-radius: 28px 28px 28px 14px;\n padding: 2em 2.5em;\n padding-bottom: 3em;\n border-radius: 28px;\n opacity: ", ";\n .scrollDiv {\n width: 68%;\n max-height: 630px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n\n margin-right: 0.3em;\n &::-webkit-scrollbar {\n width: 10px;\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n\n border-radius: 16px;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 16px;\n border: 2px solid;\n }\n /* box-shadow: 0px 20px 35px rgba(0, 0, 0, 0.05); */\n }\n table {\n border-collapse: separate;\n border-spacing: 0 4px;\n row-gap: 4px;\n }\n\n td {\n /* border: solid 1px #000; */\n border-style: none solid solid none;\n /* padding: 10px; */\n /* margin-bottom:5px; */\n }\n\n tr:first-child td:first-child {\n border-top-left-radius: 10px;\n }\n tr td:last-child {\n border-top-right-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n\n tr td:first-child {\n border-bottom-left-radius: 10px;\n border-top-left-radius: 10px;\n }\n tr td:last-child {\n border-bottom-right-radius: 10px;\n }\n\n tr td {\n border-top-style: solid;\n }\n tr td:first-child {\n border-left-style: solid;\n }\n\n @media only screen and (max-width: 1200px) {\n flex-direction: column;\n align-items: center;\n padding: 0.5em;\n .scrollDiv {\n width: 100%;\n margin: 0;\n margin-bottom: 2em;\n padding: 0 0.4em;\n }\n }\n"])), function (props) {
12097
12430
  return props.maxWidth || '1600px';
12098
12431
  }, function (props) {
12099
12432
  return "min(" + (props.maxWidth || '1600px') + ",100%)";
@@ -12104,35 +12437,34 @@ var CartPageContainer$1 = styled__default.div(_templateObject2$v || (_templateOb
12104
12437
  }, function (props) {
12105
12438
  return props.color || '#BFC3CA';
12106
12439
  });
12107
- var CardsBox$1 = styled__default.div(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* min-height: 1000px; */\n position: relative;\n max-width: 860px;\n margin-right: auto;\n padding: 1em 2em;\n display: ", ";\n grid-template-columns: 1fr 1fr;\n flex-direction: column;\n align-items: flex-start;\n grid-gap: 1em;\n justify-content: flex-start;\n align-items: center;\n border-radius: 20px;\n @media only screen and (max-width: 900px) {\n display: flex;\n }\n @media only screen and (max-width: 600px) {\n padding: 1em 0.2em;\n }\n"])), function (props) {
12440
+ var CardsBox$1 = styled__default.div(_templateObject3$q || (_templateObject3$q = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* min-height: 1000px; */\n position: relative;\n max-width: 860px;\n margin-right: auto;\n padding: 1em 2em;\n display: ", ";\n grid-template-columns: 1fr 1fr;\n flex-direction: column;\n align-items: flex-start;\n grid-gap: 1em;\n justify-content: flex-start;\n align-items: center;\n border-radius: 20px;\n @media only screen and (max-width: 900px) {\n display: flex;\n }\n @media only screen and (max-width: 600px) {\n padding: 1em 0.2em;\n }\n"])), function (props) {
12108
12441
  return props.retail ? 'grid' : 'flex';
12109
12442
  });
12110
- var CartHeading$1 = styled__default.div(_templateObject4$k || (_templateObject4$k = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n /* margin-bottom: 2em; */\n margin-left: 2.3em;\n margin-top: 2em;\n\n color: ", ";\n h1 {\n font-weight: 600;\n font-size: 2.0375em;\n text-transform: capitalize;\n color: ", ";\n /* margin-bottom: 1em; */\n }\n p {\n font-size: 0.875em;\n color: inherit;\n margin-top: 0.5em;\n }\n"])), function (props) {
12443
+ var CartHeading$1 = styled__default.div(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n /* margin-bottom: 2em; */\n margin-left: 2.3em;\n margin-top: 2em;\n\n color: ", ";\n h1 {\n font-weight: 600;\n font-size: 2.0375em;\n text-transform: capitalize;\n color: ", ";\n /* margin-bottom: 1em; */\n }\n p {\n font-size: 0.875em;\n color: inherit;\n margin-top: 0.5em;\n }\n"])), function (props) {
12111
12444
  return props.color || 'black';
12112
12445
  }, function (props) {
12113
12446
  return props.h1 || 'inherit';
12114
12447
  });
12115
- var Loader$2 = styled__default.div(_templateObject5$g || (_templateObject5$g = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 40%;\n left: 47%;\n display: grid;\n place-items: center;\n z-index: 3;\n"])));
12116
- var CartTableCell$3 = styled__default(material.TableCell)(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n && {\n padding-bottom: 1em !important;\n // border: none !important;\n /* font-size: 0.75em; */\n font-size: 1em;\n color: rgba(98, 95, 95, 1);\n // background: ", ";\n color: ", ";\n }\n &.bg-transparent {\n // background-color: transparent !important;\n text-transform: uppercase;\n span {\n font-size: 0.75em;\n font-weight: 600;\n }\n svg {\n color: ", ";\n }\n .MuiTableSortLabel-root {\n color: ", "!important;\n }\n }\n"])), function (props) {
12448
+ var Loader$2 = styled__default.div(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 40%;\n left: 47%;\n display: grid;\n place-items: center;\n z-index: 3;\n"])));
12449
+ var CartTableCell$3 = styled__default(material.TableCell)(_templateObject6$f || (_templateObject6$f = _taggedTemplateLiteralLoose(["\n && {\n padding-bottom: 1em !important;\n // border: none !important;\n /* font-size: 0.75em; */\n font-size: 1em;\n color: rgba(98, 95, 95, 1);\n // background: ", ";\n color: ", ";\n }\n &.bg-transparent {\n // background-color: transparent !important;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n span {\n font-size: 0.75em;\n font-weight: 600;\n color: ", ";\n }\n .MuiTableSortLabel-root:hover,\n .MuiTableSortLabel-root:hover svg {\n color: ", " !important;\n }\n svg {\n color: ", ";\n }\n .MuiTableSortLabel-root {\n color: ", "!important;\n }\n }\n"])), function (props) {
12117
12450
  return "" + props.bg;
12118
12451
  }, function (props) {
12119
12452
  return "" + props.color || 'inherit';
12120
12453
  }, function (props) {
12454
+ return props.color || '#6b7280';
12455
+ }, getPrimary, function (props) {
12121
12456
  return "" + props.color || 'inherit';
12122
12457
  }, function (props) {
12123
12458
  return "" + props.color || 'inherit';
12124
12459
  });
12125
- var CartTableContainer$1 = styled__default(material.TableContainer)(_templateObject7$a || (_templateObject7$a = _taggedTemplateLiteralLoose(["\n max-height: 580px;\n padding-right: 1.5em;\n overflow: inherit !important;\n &::-webkit-scrollbar {\n width: 10px;\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 16px;\n width: 100%;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n border-radius: 16px;\n margin: 5px 2px;\n background: ", ";\n }\n @media screen and (max-width: 768px) {\n padding: 0;\n }\n"])), function (props) {
12460
+ var CartTableContainer$1 = styled__default(material.TableContainer)(_templateObject7$b || (_templateObject7$b = _taggedTemplateLiteralLoose(["\n max-height: 580px;\n padding-right: 1.5em;\n overflow: inherit !important;\n &::-webkit-scrollbar {\n width: 10px;\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 16px;\n width: 100%;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n border-radius: 16px;\n margin: 5px 2px;\n background: ", ";\n }\n @media screen and (max-width: 768px) {\n padding: 0;\n }\n"])), function (props) {
12126
12461
  return props.bg || '#fdccc480';
12127
12462
  }, function (props) {
12128
12463
  return props.color || 'red';
12129
12464
  });
12130
- var CartButtonsRow$1 = styled__default.div(_templateObject8$8 || (_templateObject8$8 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n padding-right: 1.85em;\n button {\n display: flex;\n align-items: center;\n background: ", ";\n color: ", ";\n padding: 0.5em 1em;\n margin-left: 1em;\n font-size: 0.85em;\n text-transform: uppercase;\n border: none;\n cursor: pointer;\n transition: 0.4s;\n font-size: 1rem;\n font-weight: 600;\n svg {\n margin-right: 0.4rem;\n }\n &:hover {\n transform: scale(0.95);\n }\n }\n"])), function (props) {
12131
- return props.bg || 'rgba(107, 106, 106, 1)';
12132
- }, function (props) {
12133
- return props.color || 'white';
12134
- });
12135
- var CartPageBox$1 = styled__default.div(_templateObject9$6 || (_templateObject9$6 = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n @media only screen and (max-width: 768px) {\n margin-right: 0;\n .CartnoBelowSm {\n display: none;\n }\n }\n"])));
12465
+ var CartButtonsRow$1 = styled__default.div(_templateObject8$9 || (_templateObject8$9 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n padding-right: 1.5em;\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n height: 42px;\n padding: 0 20px;\n border-radius: 8px;\n border: 1.5px solid ", ";\n font-size: 0.95rem;\n font-weight: 600;\n letter-spacing: 0.2px;\n white-space: nowrap;\n cursor: pointer;\n transition: background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;\n svg {\n font-size: 1.1em;\n }\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n &:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n }\n }\n .outlined {\n position: relative;\n isolation: isolate;\n background: #fff;\n color: ", ";\n /* Hover tint: the primary color at low opacity, behind the label. */\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n z-index: -1;\n border-radius: inherit;\n background: ", ";\n opacity: 0;\n transition: opacity 0.2s;\n }\n &:hover:not(:disabled)::before {\n opacity: 0.08;\n }\n }\n .filled {\n background: ", ";\n color: #fff;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n &:hover:not(:disabled) {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n opacity: 0.92;\n }\n }\n @media only screen and (max-width: 768px) {\n padding-right: 0;\n }\n @media only screen and (max-width: 600px) {\n button {\n flex: 1;\n height: 44px;\n padding: 0 12px;\n font-size: 0.875rem;\n }\n }\n"])), getPrimary, getPrimary, getPrimary, getPrimary, getPrimary);
12466
+ var CartPageBox$1 = styled__default.div(_templateObject9$6 || (_templateObject9$6 = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n @media only screen and (max-width: 768px) {\n margin-right: 0;\n .CartnoBelowSm {\n display: none;\n }\n /* Rows become stacked cards (see CardRow), so the table/body are blocks. */\n table,\n tbody {\n display: block;\n width: 100%;\n }\n }\n"])));
12467
+ var MobileSelectBar = styled__default.div(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n display: none;\n @media only screen and (max-width: 768px) {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 2px 8px;\n font-size: 0.9em;\n color: #555;\n label {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-weight: 500;\n }\n .count {\n font-size: 0.9em;\n color: #888;\n }\n }\n"])));
12136
12468
 
12137
12469
  var headCells$1 = [{
12138
12470
  id: 'image',
@@ -12153,6 +12485,13 @@ var headCells$1 = [{
12153
12485
  label: 'price',
12154
12486
  filter: true,
12155
12487
  noBelowSm: true
12488
+ }, {
12489
+ id: 'availableQuantity',
12490
+ numeric: true,
12491
+ disablePadding: false,
12492
+ label: 'stock',
12493
+ filter: true,
12494
+ noBelowSm: true
12156
12495
  }, {
12157
12496
  id: 'quantity',
12158
12497
  numeric: true,
@@ -12174,14 +12513,17 @@ var headCells$1 = [{
12174
12513
  noBelowSm: true
12175
12514
  }];
12176
12515
  function EnhancedTableHead$1(props) {
12177
- var _styles$cartSummary, _styles$cartSummary2;
12516
+ var _React$useContext, _styles$cartSummary, _styles$cartSummary2;
12178
12517
  var onSelectAllClick = props.onSelectAllClick,
12179
12518
  order = props.order,
12180
12519
  orderBy = props.orderBy,
12181
12520
  numSelected = props.numSelected,
12182
12521
  rowCount = props.rowCount,
12183
12522
  onRequestSort = props.onRequestSort,
12184
- styles = props.styles;
12523
+ styles = props.styles,
12524
+ hideDelete = props.hideDelete,
12525
+ hideStock = props.hideStock;
12526
+ var primaryColor = ((_React$useContext = React.useContext(styled.ThemeContext)) === null || _React$useContext === void 0 ? void 0 : _React$useContext.primaryColor) || DEFAULT_PRIMARY;
12185
12527
  var createSortHandler = function createSortHandler(property) {
12186
12528
  return function (event) {
12187
12529
  onRequestSort(event, property);
@@ -12208,8 +12550,14 @@ function EnhancedTableHead$1(props) {
12208
12550
  svg: {
12209
12551
  color: styles === null || styles === void 0 ? void 0 : (_styles$cartSummary2 = styles.cartSummary) === null || _styles$cartSummary2 === void 0 ? void 0 : _styles$cartSummary2.color
12210
12552
  }
12553
+ }, {
12554
+ '&.Mui-checked, &.MuiCheckbox-indeterminate': {
12555
+ color: primaryColor
12556
+ }
12211
12557
  })
12212
- })), headCells$1.map(function (headCell) {
12558
+ })), headCells$1.filter(function (headCell) {
12559
+ return !(hideDelete && headCell.id === 'delete') && !(hideStock && headCell.id === 'availableQuantity');
12560
+ }).map(function (headCell) {
12213
12561
  var _styles$cartSummary3;
12214
12562
  return /*#__PURE__*/React.createElement(CartTableCell$3, {
12215
12563
  key: headCell.id,
@@ -12239,19 +12587,31 @@ EnhancedTableHead$1.propTypes = {
12239
12587
  rowCount: propTypes.number.isRequired
12240
12588
  };
12241
12589
  function ProductTable(_ref) {
12242
- var _styles$scroll, _styles$scroll2, _sortBy, _styles$Btn, _styles$Btn2;
12590
+ var _React$useContext2, _styles$scroll, _styles$scroll2, _sortBy;
12243
12591
  var cartData = _ref.cartData,
12244
12592
  loading = _ref.loading,
12245
12593
  imgnotfoundUrl = _ref.imgnotfoundUrl,
12246
12594
  handleIncrementDecrement = _ref.handleIncrementDecrement,
12247
12595
  handleRemoveProduct = _ref.handleRemoveProduct,
12248
12596
  handleRemoveAll = _ref.handleRemoveAll,
12249
- styles = _ref.styles;
12250
- var cartList = cartData === null || cartData === void 0 ? void 0 : cartData.map(function (li) {
12597
+ handleAddToCart = _ref.handleAddToCart,
12598
+ styles = _ref.styles,
12599
+ _ref$allowToProcessIn = _ref.allowToProcessInvoiceForOutOfStockProductsEcommerce,
12600
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref$allowToProcessIn === void 0 ? false : _ref$allowToProcessIn,
12601
+ selectedIds = _ref.selectedIds,
12602
+ onSelectedIdsChange = _ref.onSelectedIdsChange,
12603
+ _ref$hideActions = _ref.hideActions,
12604
+ hideActions = _ref$hideActions === void 0 ? false : _ref$hideActions,
12605
+ _ref$hideDelete = _ref.hideDelete,
12606
+ hideDelete = _ref$hideDelete === void 0 ? false : _ref$hideDelete,
12607
+ _ref$hideStock = _ref.hideStock,
12608
+ hideStock = _ref$hideStock === void 0 ? false : _ref$hideStock;
12609
+ var cartList = (Array.isArray(cartData) ? cartData : []).filter(Boolean).map(function (li) {
12251
12610
  return _extends({}, li, {
12252
- subtotal: li.standardPrice * li.quantity
12611
+ subtotal: (Number(li === null || li === void 0 ? void 0 : li.standardPrice) || 0) * (Number(li === null || li === void 0 ? void 0 : li.quantity) || 0)
12253
12612
  });
12254
12613
  });
12614
+ var primaryColor = ((_React$useContext2 = React.useContext(styled.ThemeContext)) === null || _React$useContext2 === void 0 ? void 0 : _React$useContext2.primaryColor) || DEFAULT_PRIMARY;
12255
12615
  var _React$useState = React.useState('asc'),
12256
12616
  order = _React$useState[0],
12257
12617
  setOrder = _React$useState[1];
@@ -12259,8 +12619,14 @@ function ProductTable(_ref) {
12259
12619
  orderBy = _React$useState2[0],
12260
12620
  setOrderBy = _React$useState2[1];
12261
12621
  var _React$useState3 = React.useState([]),
12262
- selected = _React$useState3[0],
12263
- setSelected = _React$useState3[1];
12622
+ internalSelected = _React$useState3[0],
12623
+ setInternalSelected = _React$useState3[1];
12624
+ var selected = selectedIds != null ? selectedIds : internalSelected;
12625
+ var setSelected = function setSelected(updater) {
12626
+ var next = typeof updater === 'function' ? updater(selected) : updater;
12627
+ if (next === selected) return;
12628
+ if (onSelectedIdsChange) onSelectedIdsChange(next);else setInternalSelected(next);
12629
+ };
12264
12630
  var _React$useState4 = React.useState(cartList || []),
12265
12631
  cartArray = _React$useState4[0],
12266
12632
  setCartArray = _React$useState4[1];
@@ -12286,44 +12652,71 @@ function ProductTable(_ref) {
12286
12652
  setOrder(isAsc ? 'desc' : 'asc');
12287
12653
  setOrderBy(property);
12288
12654
  };
12289
- var handleSelectAllClick = function handleSelectAllClick(event) {
12290
- if ((selected === null || selected === void 0 ? void 0 : selected.length) < (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length)) {
12291
- var newSelected = [];
12292
- cartArray === null || cartArray === void 0 ? void 0 : cartArray.map(function (n) {
12293
- return newSelected.push(n);
12294
- });
12295
- setSelected(newSelected);
12296
- return;
12297
- }
12298
- setSelected([]);
12655
+ var handleSelectAllClick = function handleSelectAllClick() {
12656
+ var allIds = cartList.map(function (p) {
12657
+ return p === null || p === void 0 ? void 0 : p.rowId;
12658
+ });
12659
+ setSelected(function (prev) {
12660
+ return prev.length < allIds.length ? allIds : [];
12661
+ });
12299
12662
  };
12300
12663
  var handleClick = function handleClick(event, product) {
12301
- var includes = selected.includes(product);
12302
- if (includes) {
12303
- var removedId = selected.filter(function (item, i) {
12304
- return item.index !== i;
12305
- });
12306
- setSelected(removedId);
12307
- } else {
12308
- setSelected([].concat(selected, [product]));
12309
- }
12664
+ var id = product === null || product === void 0 ? void 0 : product.rowId;
12665
+ setSelected(function (prev) {
12666
+ return prev.includes(id) ? prev.filter(function (x) {
12667
+ return x !== id;
12668
+ }) : [].concat(prev, [id]);
12669
+ });
12310
12670
  };
12311
- var isSelected = function isSelected(name) {
12312
- return selected.includes(name);
12671
+ var isSelected = function isSelected(product) {
12672
+ return selected.includes(product === null || product === void 0 ? void 0 : product.rowId);
12673
+ };
12674
+ var handleRemoveSelected = function handleRemoveSelected() {
12675
+ if (loading) return;
12676
+ if (!selected.length) {
12677
+ alert('Please select at least one product to remove.');
12678
+ return;
12679
+ }
12680
+ handleRemoveAll(selected);
12313
12681
  };
12314
12682
  React.useEffect(function () {
12315
12683
  setCartArray(cartList);
12684
+ var ids = new Set(cartList.map(function (p) {
12685
+ return p === null || p === void 0 ? void 0 : p.rowId;
12686
+ }));
12687
+ setSelected(function (prev) {
12688
+ var next = prev.filter(function (id) {
12689
+ return ids.has(id);
12690
+ });
12691
+ return next.length === prev.length ? prev : next;
12692
+ });
12316
12693
  }, [cartData]);
12317
12694
  return /*#__PURE__*/React.createElement(CartPageBox$1, null, loading && /*#__PURE__*/React.createElement(Loader$2, null, /*#__PURE__*/React.createElement(reactSpinners.BounceLoader, {
12318
12695
  size: 40,
12319
- color: styles.Btn.background,
12696
+ color: primaryColor,
12320
12697
  loading: true
12321
12698
  })), /*#__PURE__*/React.createElement(Box, {
12322
12699
  sx: {
12323
12700
  width: '100%'
12324
12701
  },
12325
12702
  paddingBottom: "2em"
12326
- }, /*#__PURE__*/React.createElement(CartTableContainer$1, {
12703
+ }, /*#__PURE__*/React.createElement(MobileSelectBar, null, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement(material.Checkbox, {
12704
+ size: "small",
12705
+ indeterminate: (selected === null || selected === void 0 ? void 0 : selected.length) > 0 && (selected === null || selected === void 0 ? void 0 : selected.length) < (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length),
12706
+ checked: (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length) > 0 && (selected === null || selected === void 0 ? void 0 : selected.length) === (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length),
12707
+ onChange: handleSelectAllClick,
12708
+ inputProps: {
12709
+ 'aria-label': 'select all products'
12710
+ },
12711
+ sx: {
12712
+ pl: 0,
12713
+ '&.Mui-checked, &.MuiCheckbox-indeterminate': {
12714
+ color: primaryColor
12715
+ }
12716
+ }
12717
+ }), "Select all"), (selected === null || selected === void 0 ? void 0 : selected.length) > 0 && /*#__PURE__*/React.createElement("span", {
12718
+ className: "count"
12719
+ }, selected.length, " selected")), /*#__PURE__*/React.createElement(CartTableContainer$1, {
12327
12720
  bg: styles === null || styles === void 0 ? void 0 : (_styles$scroll = styles.scroll) === null || _styles$scroll === void 0 ? void 0 : _styles$scroll.bg,
12328
12721
  color: styles === null || styles === void 0 ? void 0 : (_styles$scroll2 = styles.scroll) === null || _styles$scroll2 === void 0 ? void 0 : _styles$scroll2.color
12329
12722
  }, /*#__PURE__*/React.createElement(Table, {
@@ -12337,12 +12730,15 @@ function ProductTable(_ref) {
12337
12730
  onSelectAllClick: handleSelectAllClick,
12338
12731
  onRequestSort: handleRequestSort,
12339
12732
  rowCount: cartArray === null || cartArray === void 0 ? void 0 : cartArray.length,
12340
- styles: styles
12733
+ styles: styles,
12734
+ hideDelete: hideDelete,
12735
+ hideStock: hideStock
12341
12736
  }), /*#__PURE__*/React.createElement(TableBody, null, (_sortBy = lodash.sortBy(cartArray, function (o) {
12342
12737
  return !((o === null || o === void 0 ? void 0 : o.quantity) > (o === null || o === void 0 ? void 0 : o.availableQuantity));
12343
12738
  })) === null || _sortBy === void 0 ? void 0 : _sortBy.map(function (row, index) {
12344
12739
  var isItemSelected = isSelected(row);
12345
12740
  return /*#__PURE__*/React.createElement(CardRow$1, {
12741
+ key: (row === null || row === void 0 ? void 0 : row.rowId) || index,
12346
12742
  row: row,
12347
12743
  index: index,
12348
12744
  isItemSelected: isItemSelected,
@@ -12351,66 +12747,365 @@ function ProductTable(_ref) {
12351
12747
  cartData: cartData,
12352
12748
  loading: loading,
12353
12749
  styles: styles,
12750
+ hideDelete: hideDelete,
12751
+ hideStock: hideStock,
12354
12752
  handleIncrementDecrement: handleIncrementDecrement,
12355
- handleRemoveProduct: handleRemoveProduct
12753
+ handleRemoveProduct: handleRemoveProduct,
12754
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
12356
12755
  });
12357
- }))))), /*#__PURE__*/React.createElement(CartButtonsRow$1, {
12358
- bg: styles === null || styles === void 0 ? void 0 : (_styles$Btn = styles.Btn) === null || _styles$Btn === void 0 ? void 0 : _styles$Btn.background,
12359
- color: styles === null || styles === void 0 ? void 0 : (_styles$Btn2 = styles.Btn) === null || _styles$Btn2 === void 0 ? void 0 : _styles$Btn2.color
12360
- }, /*#__PURE__*/React.createElement("button", {
12756
+ }))))), !hideActions && /*#__PURE__*/React.createElement(CartButtonsRow$1, null, /*#__PURE__*/React.createElement("button", {
12757
+ type: "button",
12758
+ className: "outlined",
12759
+ onClick: handleRemoveSelected,
12760
+ disabled: loading || !(selected !== null && selected !== void 0 && selected.length)
12761
+ }, /*#__PURE__*/React.createElement(ai.AiOutlineDelete, null), "Remove selected", selected !== null && selected !== void 0 && selected.length ? " (" + selected.length + ")" : ''), /*#__PURE__*/React.createElement("button", {
12762
+ type: "button",
12763
+ className: "filled",
12764
+ disabled: loading || !(cartArray !== null && cartArray !== void 0 && cartArray.length),
12361
12765
  onClick: function onClick() {
12362
- new Promise(function (resolve, reject) {
12363
- if (loading) return;
12364
- handleRemoveAll(selected);
12365
- resolve();
12366
- });
12367
- setSelected([]);
12766
+ if (loading) return;
12767
+ handleAddToCart && handleAddToCart(selected);
12368
12768
  }
12369
- }, /*#__PURE__*/React.createElement(ai.AiOutlineDelete, null), " remove selected"), /*#__PURE__*/React.createElement("button", null, /*#__PURE__*/React.createElement(ai.AiOutlinePlus, null), "Add to cart")));
12769
+ }, /*#__PURE__*/React.createElement(ai.AiOutlinePlus, null), loading ? 'Adding...' : selected !== null && selected !== void 0 && selected.length ? "Add selected to cart (" + selected.length + ")" : 'Add all to cart')));
12370
12770
  }
12371
12771
 
12372
- var QuickOrder = function QuickOrder(_ref) {
12373
- var _ref$colors = _ref.colors,
12374
- colors = _ref$colors === void 0 ? {
12375
- primaryColor: '#424242'
12376
- } : _ref$colors,
12772
+ var PAGE_SIZE = 20;
12773
+ var getInitialQuantity = function getInitialQuantity(product) {
12774
+ return (product === null || product === void 0 ? void 0 : product.minQuantityToSale) > 1 ? product.minQuantityToSale : 1;
12775
+ };
12776
+ var getRowId = function getRowId(product) {
12777
+ return "recent-" + (product === null || product === void 0 ? void 0 : product.productId);
12778
+ };
12779
+ var LastOrderedProductsDialog = function LastOrderedProductsDialog(_ref) {
12780
+ var open = _ref.open,
12781
+ onClose = _ref.onClose,
12782
+ onAdd = _ref.onAdd,
12377
12783
  apiEndPoint = _ref.apiEndPoint,
12378
12784
  token = _ref.token,
12379
12785
  imgnotfoundUrl = _ref.imgnotfoundUrl,
12380
- styles = _ref.styles;
12381
- var _useState = React.useState([]),
12382
- storeData = _useState[0],
12383
- setStoreData = _useState[1];
12384
- var storeIdList = Array.isArray(storeData) && (storeData === null || storeData === void 0 ? void 0 : storeData.length) > 0 ? storeData === null || storeData === void 0 ? void 0 : storeData.join(',') : '1';
12786
+ styles = _ref.styles,
12787
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _ref.allowToProcessInvoiceForOutOfStockProductsEcommerce,
12788
+ _ref$hideStock = _ref.hideStock,
12789
+ hideStock = _ref$hideStock === void 0 ? false : _ref$hideStock;
12790
+ var theme = React.useContext(styled.ThemeContext);
12791
+ var primaryColor = (theme === null || theme === void 0 ? void 0 : theme.primaryColor) || '#424242';
12792
+ var isSmallScreen = material.useMediaQuery('(max-width:600px)');
12793
+ var _useState = React.useState({}),
12794
+ rowsById = _useState[0],
12795
+ setRowsById = _useState[1];
12385
12796
  var _useState2 = React.useState([]),
12386
- products = _useState2[0],
12387
- setProducts = _useState2[1];
12388
- React.useEffect(function () {
12389
- (function () {
12390
- try {
12391
- var _temp = _catch(function () {
12797
+ pageRowIds = _useState2[0],
12798
+ setPageRowIds = _useState2[1];
12799
+ var _useState3 = React.useState([]),
12800
+ selectedIds = _useState3[0],
12801
+ setSelectedIds = _useState3[1];
12802
+ var _useState4 = React.useState(false),
12803
+ loading = _useState4[0],
12804
+ setLoading = _useState4[1];
12805
+ var _useState5 = React.useState(0),
12806
+ page = _useState5[0],
12807
+ setPage = _useState5[1];
12808
+ var _useState6 = React.useState(0),
12809
+ totalPages = _useState6[0],
12810
+ setTotalPages = _useState6[1];
12811
+ var _useState7 = React.useState(0),
12812
+ totalElements = _useState7[0],
12813
+ setTotalElements = _useState7[1];
12814
+ var requestId = React.useRef(0);
12815
+ var contentRef = React.useRef();
12816
+ var loadPage = function loadPage(pageToLoad) {
12817
+ try {
12818
+ var currentRequest = ++requestId.current;
12819
+ setLoading(true);
12820
+ return Promise.resolve(_finallyRethrows(function () {
12821
+ return _catch(function () {
12392
12822
  return Promise.resolve(API({
12393
12823
  apiEndPoint: apiEndPoint,
12394
12824
  token: token,
12395
- url: "store/store-ids"
12396
- })).then(function (data) {
12397
- setStoreData(data);
12825
+ url: '/ecommerce/product/recently-ordered',
12826
+ queryParams: {
12827
+ page: pageToLoad,
12828
+ size: PAGE_SIZE
12829
+ }
12830
+ })).then(function (result) {
12831
+ if (currentRequest !== requestId.current) return;
12832
+ var content = (Array.isArray(result === null || result === void 0 ? void 0 : result.content) ? result.content : []).filter(function (p) {
12833
+ return p && (p === null || p === void 0 ? void 0 : p.productId) != null;
12834
+ });
12835
+ setRowsById(function (prev) {
12836
+ var next = _extends({}, prev);
12837
+ content.forEach(function (p) {
12838
+ var rowId = getRowId(p);
12839
+ next[rowId] = prev[rowId] ? _extends({}, p, {
12840
+ quantity: prev[rowId].quantity,
12841
+ rowId: rowId
12842
+ }) : _extends({}, p, {
12843
+ quantity: getInitialQuantity(p),
12844
+ rowId: rowId
12845
+ });
12846
+ });
12847
+ return next;
12848
+ });
12849
+ setPageRowIds(content.map(getRowId));
12850
+ setPage(pageToLoad);
12851
+ setTotalPages((result === null || result === void 0 ? void 0 : result.totalPages) || 0);
12852
+ setTotalElements((result === null || result === void 0 ? void 0 : result.totalElements) || 0);
12853
+ if (contentRef.current) contentRef.current.scrollTop = 0;
12398
12854
  });
12399
12855
  }, function () {});
12400
- return _temp && _temp.then ? _temp.then(function () {}) : void 0;
12401
- } catch (e) {
12402
- Promise.reject(e);
12856
+ }, function (_wasThrown, _result) {
12857
+ if (currentRequest === requestId.current) setLoading(false);
12858
+ if (_wasThrown) throw _result;
12859
+ return _result;
12860
+ }));
12861
+ } catch (e) {
12862
+ return Promise.reject(e);
12863
+ }
12864
+ };
12865
+ React.useEffect(function () {
12866
+ if (!open) return;
12867
+ setRowsById({});
12868
+ setPageRowIds([]);
12869
+ setSelectedIds([]);
12870
+ setPage(0);
12871
+ setTotalPages(0);
12872
+ setTotalElements(0);
12873
+ loadPage(0);
12874
+ }, [open]);
12875
+ var pageRows = pageRowIds.map(function (id) {
12876
+ return rowsById[id];
12877
+ }).filter(Boolean);
12878
+ var pageIdSet = new Set(pageRows.map(function (p) {
12879
+ return p.rowId;
12880
+ }));
12881
+ var pageSelectedIds = selectedIds.filter(function (id) {
12882
+ return pageIdSet.has(id);
12883
+ });
12884
+ var handlePageSelectionChange = function handlePageSelectionChange(nextPageSelected) {
12885
+ setSelectedIds(function (prev) {
12886
+ return [].concat(prev.filter(function (id) {
12887
+ return !pageIdSet.has(id);
12888
+ }), nextPageSelected);
12889
+ });
12890
+ };
12891
+ var handleIncrementDecrement = function handleIncrementDecrement(data) {
12892
+ if (!(data !== null && data !== void 0 && data.rowId)) return;
12893
+ setRowsById(function (prev) {
12894
+ var _extends2;
12895
+ return prev[data.rowId] ? _extends({}, prev, (_extends2 = {}, _extends2[data.rowId] = _extends({}, prev[data.rowId], {
12896
+ quantity: data.quantity
12897
+ }), _extends2)) : prev;
12898
+ });
12899
+ setSelectedIds(function (prev) {
12900
+ return prev.includes(data.rowId) ? prev : [].concat(prev, [data.rowId]);
12901
+ });
12902
+ };
12903
+ var handleRemoveProduct = function handleRemoveProduct() {};
12904
+ var handlePageChange = function handlePageChange(event, value) {
12905
+ var nextPage = value - 1;
12906
+ if (nextPage === page || loading) return;
12907
+ loadPage(nextPage);
12908
+ };
12909
+ var handleAdd = function handleAdd() {
12910
+ if (!selectedIds.length) {
12911
+ alert('Please select at least one product to add.');
12912
+ return;
12913
+ }
12914
+ onAdd(selectedIds.map(function (id) {
12915
+ return rowsById[id];
12916
+ }).filter(Boolean));
12917
+ onClose();
12918
+ };
12919
+ return /*#__PURE__*/React__default.createElement(material.Dialog, {
12920
+ open: open,
12921
+ onClose: onClose,
12922
+ fullWidth: true,
12923
+ fullScreen: isSmallScreen,
12924
+ maxWidth: "lg",
12925
+ scroll: "paper"
12926
+ }, /*#__PURE__*/React__default.createElement(material.DialogTitle, {
12927
+ sx: {
12928
+ m: 0,
12929
+ p: 2,
12930
+ pr: 6
12931
+ }
12932
+ }, "Last Ordered Products", /*#__PURE__*/React__default.createElement(material.IconButton, {
12933
+ "aria-label": "close",
12934
+ onClick: onClose,
12935
+ sx: {
12936
+ position: 'absolute',
12937
+ right: 8,
12938
+ top: 8,
12939
+ '& svg': {
12940
+ fontSize: 20
12403
12941
  }
12404
- })();
12405
- }, []);
12942
+ }
12943
+ }, /*#__PURE__*/React__default.createElement(md.MdClose, null))), /*#__PURE__*/React__default.createElement(material.DialogContent, {
12944
+ dividers: true,
12945
+ ref: contentRef,
12946
+ sx: {
12947
+ px: {
12948
+ xs: 1.5,
12949
+ sm: 3
12950
+ }
12951
+ }
12952
+ }, pageRows.length > 0 ? /*#__PURE__*/React__default.createElement(ProductTable, {
12953
+ cartData: pageRows,
12954
+ loading: loading,
12955
+ imgnotfoundUrl: imgnotfoundUrl,
12956
+ styles: styles,
12957
+ handleRemoveProduct: handleRemoveProduct,
12958
+ handleIncrementDecrement: handleIncrementDecrement,
12959
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce,
12960
+ hideStock: hideStock,
12961
+ selectedIds: pageSelectedIds,
12962
+ onSelectedIdsChange: handlePageSelectionChange,
12963
+ hideActions: true,
12964
+ hideDelete: true
12965
+ }) : loading ? /*#__PURE__*/React__default.createElement(DialogLoadMore, null, "Loading products...") : /*#__PURE__*/React__default.createElement(NoData, null)), /*#__PURE__*/React__default.createElement(material.DialogActions, {
12966
+ sx: {
12967
+ p: 2
12968
+ }
12969
+ }, /*#__PURE__*/React__default.createElement(DialogFooter, null, /*#__PURE__*/React__default.createElement("div", {
12970
+ className: "pagination"
12971
+ }, totalPages > 1 && /*#__PURE__*/React__default.createElement(material.Pagination, {
12972
+ count: totalPages,
12973
+ page: page + 1,
12974
+ onChange: handlePageChange,
12975
+ disabled: loading,
12976
+ shape: "rounded",
12977
+ size: "small",
12978
+ sx: {
12979
+ '& .MuiPaginationItem-root.Mui-selected': {
12980
+ backgroundColor: primaryColor,
12981
+ color: '#fff'
12982
+ },
12983
+ '& .MuiPaginationItem-root.Mui-selected:hover': {
12984
+ backgroundColor: primaryColor,
12985
+ opacity: 0.9
12986
+ }
12987
+ }
12988
+ }), totalElements > 0 && /*#__PURE__*/React__default.createElement("span", {
12989
+ className: "count"
12990
+ }, page * PAGE_SIZE + 1, "\u2013", Math.min((page + 1) * PAGE_SIZE, totalElements), " of", ' ', totalElements)), /*#__PURE__*/React__default.createElement("div", {
12991
+ className: "buttons"
12992
+ }, /*#__PURE__*/React__default.createElement(DialogFooterButton, {
12993
+ type: "button",
12994
+ variant: "outlined",
12995
+ onClick: onClose
12996
+ }, "Cancel"), /*#__PURE__*/React__default.createElement(DialogFooterButton, {
12997
+ type: "button",
12998
+ onClick: handleAdd,
12999
+ disabled: !selectedIds.length
13000
+ }, "Add", selectedIds.length ? " (" + selectedIds.length + ")" : '')))));
13001
+ };
13002
+
13003
+ var _excluded$7 = ["rowId"];
13004
+ var QuickOrder = function QuickOrder(_ref) {
13005
+ var _erCookieStorage$getI;
13006
+ var _ref$colors = _ref.colors,
13007
+ colors = _ref$colors === void 0 ? {
13008
+ primaryColor: '#424242'
13009
+ } : _ref$colors,
13010
+ apiEndPoint = _ref.apiEndPoint,
13011
+ token = _ref.token,
13012
+ imgnotfoundUrl = _ref.imgnotfoundUrl,
13013
+ styles = _ref.styles,
13014
+ onAddToCart = _ref.onAddToCart,
13015
+ _ref$doNotShowStock = _ref.doNotShowStock,
13016
+ doNotShowStock = _ref$doNotShowStock === void 0 ? false : _ref$doNotShowStock;
13017
+ var _useAllSystemFeatureV = useAllSystemFeatureValues({
13018
+ apiEndPoint: apiEndPoint,
13019
+ token: token
13020
+ }),
13021
+ _useAllSystemFeatureV2 = _useAllSystemFeatureV.allowToProcessInvoiceForOutOfStockProductsEcommerce,
13022
+ allowToProcessInvoiceForOutOfStockProductsEcommerce = _useAllSystemFeatureV2 === void 0 ? false : _useAllSystemFeatureV2;
13023
+ var hideStock = !!allowToProcessInvoiceForOutOfStockProductsEcommerce || !!doNotShowStock;
13024
+ var storeId = (erCookieStorage === null || erCookieStorage === void 0 ? void 0 : (_erCookieStorage$getI = erCookieStorage.getItem) === null || _erCookieStorage$getI === void 0 ? void 0 : _erCookieStorage$getI.call(erCookieStorage, 'storeId')) || 2;
13025
+ var _useState = React.useState([]),
13026
+ products = _useState[0],
13027
+ setProducts = _useState[1];
13028
+ var _useState2 = React.useState(false),
13029
+ infoOpen = _useState2[0],
13030
+ setInfoOpen = _useState2[1];
13031
+ var _useState3 = React.useState(false),
13032
+ lastOrderedOpen = _useState3[0],
13033
+ setLastOrderedOpen = _useState3[1];
13034
+ var _useState4 = React.useState(false),
13035
+ addingToCart = _useState4[0],
13036
+ setAddingToCart = _useState4[1];
13037
+ var handleLastOrderedProducts = function handleLastOrderedProducts() {
13038
+ setLastOrderedOpen(true);
13039
+ };
13040
+ var isOutOfStock = function isOutOfStock(product) {
13041
+ var availableQuantity = product === null || product === void 0 ? void 0 : product.availableQuantity;
13042
+ return !allowToProcessInvoiceForOutOfStockProductsEcommerce && (1 > availableQuantity || availableQuantity <= 0);
13043
+ };
13044
+ var getProductKey = function getProductKey(product) {
13045
+ var _product$productId;
13046
+ return (_product$productId = product === null || product === void 0 ? void 0 : product.productId) != null ? _product$productId : product === null || product === void 0 ? void 0 : product.id;
13047
+ };
13048
+ var makeRowId = function makeRowId(product) {
13049
+ var _getProductKey;
13050
+ return ((_getProductKey = getProductKey(product)) != null ? _getProductKey : 'p') + "-" + Date.now() + "-" + Math.random();
13051
+ };
13052
+ var addProductsToList = function addProductsToList(newProducts) {
13053
+ if (newProducts === void 0) {
13054
+ newProducts = [];
13055
+ }
13056
+ if (!Array.isArray(newProducts)) return;
13057
+ var outOfStockNames = [];
13058
+ var next = [].concat(products || []);
13059
+ var added = [];
13060
+ newProducts.forEach(function (product) {
13061
+ if (!product) return;
13062
+ if (isOutOfStock(product)) {
13063
+ outOfStockNames.push((product === null || product === void 0 ? void 0 : product.productName) || '');
13064
+ return;
13065
+ }
13066
+ var key = getProductKey(product);
13067
+ var addQty = (product === null || product === void 0 ? void 0 : product.quantity) > 0 ? product.quantity : 1;
13068
+ var existing = key !== undefined && key !== null ? next.find(function (p) {
13069
+ return getProductKey(p) === key;
13070
+ }) : undefined;
13071
+ if (existing) {
13072
+ var quantity = checkMinMaxQty({
13073
+ quantity: (Number(existing === null || existing === void 0 ? void 0 : existing.quantity) || 0) + addQty,
13074
+ product: existing,
13075
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce
13076
+ });
13077
+ next = next.map(function (p) {
13078
+ return (p === null || p === void 0 ? void 0 : p.rowId) === (existing === null || existing === void 0 ? void 0 : existing.rowId) ? _extends({}, p, {
13079
+ quantity: quantity
13080
+ }) : p;
13081
+ });
13082
+ } else {
13083
+ var row = _extends({}, product, {
13084
+ quantity: addQty,
13085
+ rowId: makeRowId(product)
13086
+ });
13087
+ added.push(row);
13088
+ next.push(row);
13089
+ }
13090
+ });
13091
+ if (outOfStockNames.length) {
13092
+ alert(outOfStockNames.length === 1 ? "This product is out of stock: " + outOfStockNames[0] : "These products are out of stock:\n" + outOfStockNames.join('\n'));
13093
+ }
13094
+ var addedIds = new Set(added.map(function (p) {
13095
+ return p === null || p === void 0 ? void 0 : p.rowId;
13096
+ }));
13097
+ setProducts([].concat(added.slice().reverse(), next.filter(function (p) {
13098
+ return p && !addedIds.has(p === null || p === void 0 ? void 0 : p.rowId);
13099
+ })));
13100
+ };
12406
13101
  var searchProductAPIData = function searchProductAPIData() {
12407
13102
  return Object.freeze({
12408
13103
  apiEndPoint: apiEndPoint,
12409
13104
  token: token,
12410
- url: "/ecommerce/product/searchByProductOrCategory",
12411
- scanUrl: "/product/scan?storeIds=" + storeIdList,
13105
+ url: "/ecommerce/product/searchByProductOrCategory?storeIds=" + storeId,
13106
+ scanUrl: "/product/scan?storeIds=" + storeId,
12412
13107
  labelKey: function labelKey(option) {
12413
- return option.productName + " " + (option.upc ? "(" + option.upc + ")" : '');
13108
+ return ((option === null || option === void 0 ? void 0 : option.productName) || '') + " " + (option !== null && option !== void 0 && option.upc ? "(" + (option === null || option === void 0 ? void 0 : option.upc) + ")" : '');
12414
13109
  },
12415
13110
  getQueryParams: function getQueryParams(value) {
12416
13111
  var queryParams = {
@@ -12433,46 +13128,157 @@ var QuickOrder = function QuickOrder(_ref) {
12433
13128
  };
12434
13129
  var onUpdate = function onUpdate(searchedProduct, clearInput) {
12435
13130
  try {
12436
- clearInput();
12437
- setProducts([_extends({}, searchedProduct, {
13131
+ clearInput === null || clearInput === void 0 ? void 0 : clearInput();
13132
+ if (!searchedProduct) return Promise.resolve();
13133
+ addProductsToList([_extends({}, searchedProduct, {
12438
13134
  quantity: 1
12439
- })].concat(products));
13135
+ })]);
12440
13136
  return Promise.resolve();
12441
13137
  } catch (e) {
12442
13138
  return Promise.reject(e);
12443
13139
  }
12444
13140
  };
12445
- var handleRemoveProduct = function handleRemoveProduct(data, index) {
13141
+ var handleRemoveProduct = function handleRemoveProduct(data) {
12446
13142
  var response = confirm('Are you sure, do you want to delete this items?');
12447
13143
  if (response) {
12448
- var filterProduct = products === null || products === void 0 ? void 0 : products.filter(function (_, i) {
12449
- return i !== index;
13144
+ setProducts(function (prev) {
13145
+ return (prev || []).filter(function (p) {
13146
+ return (p === null || p === void 0 ? void 0 : p.rowId) !== (data === null || data === void 0 ? void 0 : data.rowId);
13147
+ });
13148
+ });
13149
+ }
13150
+ };
13151
+ var handleIncrementDecrement = function handleIncrementDecrement(data) {
13152
+ if (!(data !== null && data !== void 0 && data.rowId)) return;
13153
+ setProducts(function (prev) {
13154
+ return (prev || []).map(function (p) {
13155
+ return (p === null || p === void 0 ? void 0 : p.rowId) === (data === null || data === void 0 ? void 0 : data.rowId) ? _extends({}, p, {
13156
+ quantity: data === null || data === void 0 ? void 0 : data.quantity
13157
+ }) : p;
13158
+ });
13159
+ });
13160
+ };
13161
+ var handleAddToCart = function handleAddToCart(selectedIds) {
13162
+ if (selectedIds === void 0) {
13163
+ selectedIds = [];
13164
+ }
13165
+ try {
13166
+ if (typeof onAddToCart !== 'function' || addingToCart) return Promise.resolve();
13167
+ var safeSelectedIds = Array.isArray(selectedIds) ? selectedIds : [];
13168
+ var ids = new Set(safeSelectedIds);
13169
+ var allRows = (products || []).filter(Boolean);
13170
+ var rowsToAdd = safeSelectedIds.length ? allRows.filter(function (p) {
13171
+ return ids.has(p === null || p === void 0 ? void 0 : p.rowId);
13172
+ }) : allRows;
13173
+ var items = rowsToAdd.map(function (_ref2) {
13174
+ var rowId = _ref2.rowId,
13175
+ product = _objectWithoutPropertiesLoose(_ref2, _excluded$7);
13176
+ return product;
12450
13177
  });
12451
- setProducts([].concat(filterProduct));
13178
+ if (!items.length) return Promise.resolve();
13179
+ setAddingToCart(true);
13180
+ var _temp = _finallyRethrows(function () {
13181
+ return _catch(function () {
13182
+ return Promise.resolve(onAddToCart(items)).then(function (isAdded) {
13183
+ if (isAdded) {
13184
+ var addedIds = new Set(rowsToAdd.map(function (p) {
13185
+ return p === null || p === void 0 ? void 0 : p.rowId;
13186
+ }));
13187
+ setProducts(function (prev) {
13188
+ return (prev || []).filter(function (p) {
13189
+ return !addedIds.has(p === null || p === void 0 ? void 0 : p.rowId);
13190
+ });
13191
+ });
13192
+ }
13193
+ });
13194
+ }, function () {});
13195
+ }, function (_wasThrown, _result) {
13196
+ setAddingToCart(false);
13197
+ if (_wasThrown) throw _result;
13198
+ return _result;
13199
+ });
13200
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
13201
+ } catch (e) {
13202
+ return Promise.reject(e);
12452
13203
  }
12453
13204
  };
12454
- var handleIncrementDecrement = function handleIncrementDecrement(data) {};
12455
- var handleRemoveAll = function handleRemoveAll(data) {
12456
- if (confirm('Are you sure, do you wan to delete items?')) {
12457
- var _data = lodash.remove(products, function (n) {});
13205
+ var handleRemoveAll = function handleRemoveAll(selectedIds) {
13206
+ if (selectedIds === void 0) {
13207
+ selectedIds = [];
13208
+ }
13209
+ if (!Array.isArray(selectedIds) || !selectedIds.length) return;
13210
+ if (confirm("Are you sure you want to remove " + selectedIds.length + " selected item(s)?")) {
13211
+ var ids = new Set(selectedIds);
13212
+ setProducts(function (prev) {
13213
+ return (prev || []).filter(function (p) {
13214
+ return !ids.has(p === null || p === void 0 ? void 0 : p.rowId);
13215
+ });
13216
+ });
12458
13217
  }
12459
13218
  };
12460
13219
  return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
12461
- theme: colors
12462
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.CssBaseline, null), /*#__PURE__*/React__default.createElement(Container$2, null, /*#__PURE__*/React__default.createElement(AsyncSelect, {
13220
+ theme: colors || {
13221
+ primaryColor: '#424242'
13222
+ }
13223
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(material.CssBaseline, null), /*#__PURE__*/React__default.createElement(Container$2, null, /*#__PURE__*/React__default.createElement(TopBar, null, /*#__PURE__*/React__default.createElement("div", {
13224
+ className: "search"
13225
+ }, /*#__PURE__*/React__default.createElement(AsyncSelect, {
12463
13226
  placeholder: 'Search Product',
12464
13227
  minSearchChar: 3,
12465
13228
  apiData: searchProductAPIData(),
12466
13229
  onUpdate: onUpdate,
12467
13230
  autoFocus: true
12468
- }), (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ProductTable, {
13231
+ })), /*#__PURE__*/React__default.createElement(LastOrderedWrapper, null, /*#__PURE__*/React__default.createElement(LastOrderedButton, {
13232
+ type: "button",
13233
+ onClick: handleLastOrderedProducts
13234
+ }, "Last Ordered Products"), /*#__PURE__*/React__default.createElement(material.ClickAwayListener, {
13235
+ onClickAway: function onClickAway() {
13236
+ return setInfoOpen(false);
13237
+ }
13238
+ }, /*#__PURE__*/React__default.createElement(material.Tooltip, {
13239
+ title: "It will show the products from invoices from the last three months.",
13240
+ placement: "top",
13241
+ arrow: true,
13242
+ open: infoOpen,
13243
+ onOpen: function onOpen() {
13244
+ return setInfoOpen(true);
13245
+ },
13246
+ onClose: function onClose() {
13247
+ return setInfoOpen(false);
13248
+ }
13249
+ }, /*#__PURE__*/React__default.createElement(InfoIcon, {
13250
+ role: "button",
13251
+ tabIndex: 0,
13252
+ "aria-label": "Last ordered products info",
13253
+ onClick: function onClick() {
13254
+ return setInfoOpen(function (prev) {
13255
+ return !prev;
13256
+ });
13257
+ }
13258
+ }, /*#__PURE__*/React__default.createElement(ai.AiOutlineInfoCircle, null)))))), (products === null || products === void 0 ? void 0 : products.length) > 0 ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ProductTable, {
13259
+ handleAddToCart: handleAddToCart,
13260
+ loading: addingToCart,
12469
13261
  cartData: products,
12470
13262
  imgnotfoundUrl: imgnotfoundUrl,
12471
13263
  styles: styles,
12472
13264
  handleRemoveProduct: handleRemoveProduct,
12473
13265
  handleIncrementDecrement: handleIncrementDecrement,
12474
- handleRemoveAll: handleRemoveAll
12475
- })) : /*#__PURE__*/React__default.createElement(NoData, null))));
13266
+ handleRemoveAll: handleRemoveAll,
13267
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce,
13268
+ hideStock: hideStock
13269
+ })) : /*#__PURE__*/React__default.createElement(NoData, null), /*#__PURE__*/React__default.createElement(LastOrderedProductsDialog, {
13270
+ open: lastOrderedOpen,
13271
+ onClose: function onClose() {
13272
+ return setLastOrderedOpen(false);
13273
+ },
13274
+ onAdd: addProductsToList,
13275
+ apiEndPoint: apiEndPoint,
13276
+ token: token,
13277
+ imgnotfoundUrl: imgnotfoundUrl,
13278
+ styles: styles,
13279
+ allowToProcessInvoiceForOutOfStockProductsEcommerce: allowToProcessInvoiceForOutOfStockProductsEcommerce,
13280
+ hideStock: hideStock
13281
+ }))));
12476
13282
  };
12477
13283
 
12478
13284
  var RenderTawk = function RenderTawk(_ref) {
@@ -12537,7 +13343,7 @@ var SnowfallComponent = function SnowfallComponent(_ref) {
12537
13343
  }) : null;
12538
13344
  };
12539
13345
 
12540
- var _templateObject$I, _templateObject2$w;
13346
+ var _templateObject$I, _templateObject2$x;
12541
13347
  var ContactUsForm = function ContactUsForm(_ref) {
12542
13348
  var apiEndPoint = _ref.apiEndPoint,
12543
13349
  serviceApiEndPoint = _ref.serviceApiEndPoint,
@@ -12665,7 +13471,7 @@ var ContactUsForm = function ContactUsForm(_ref) {
12665
13471
  var TypographyContainer$8 = styled__default(material.Typography)(_templateObject$I || (_templateObject$I = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n font-size: 1.2rem !important;\n align-items: center;\n"])), function (props) {
12666
13472
  return props.fontColor;
12667
13473
  });
12668
- var RootContainer$3 = styled__default(material.Stack)(_templateObject2$w || (_templateObject2$w = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n border-radius: 14px !important;\n padding: 1.3rem;\n margin-bottom: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n p {\n margin: 0 !important;\n }\n"])), function (props) {
13474
+ var RootContainer$3 = styled__default(material.Stack)(_templateObject2$x || (_templateObject2$x = _taggedTemplateLiteralLoose(["\n background-color: ", " !important;\n border-radius: 14px !important;\n padding: 1.3rem;\n margin-bottom: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n p {\n margin: 0 !important;\n }\n"])), function (props) {
12669
13475
  return props.secondaryColor;
12670
13476
  });
12671
13477
 
@@ -13067,7 +13873,7 @@ var StaticPageList = function StaticPageList(_ref) {
13067
13873
  };
13068
13874
  var TitleContainer$2 = styled__default.div(_templateObject$N || (_templateObject$N = _taggedTemplateLiteralLoose(["\n padding: 1.2rem;\n cursor: pointer;\n color: #323232;\n img {\n max-width: 100%;\n }\n &:hover {\n img {\n transform: scale(1.01);\n }\n }\n"])));
13069
13875
 
13070
- var _excluded$7 = ["userName", "children", "style"];
13876
+ var _excluded$8 = ["userName", "children", "style"];
13071
13877
  var colors$1 = ['#FFB900', '#D83B01', '#B50E0E', '#E81123', '#B4009E', '#5C2D91', '#0078D7', '#00B4FF', '#008272', '#107C10'];
13072
13878
  var getRandomColor = function getRandomColor(userName) {
13073
13879
  return colors$1[(userName === null || userName === void 0 ? void 0 : userName.length) % (colors$1 === null || colors$1 === void 0 ? void 0 : colors$1.length)];
@@ -13086,7 +13892,7 @@ var Avatar = function Avatar(_ref) {
13086
13892
  var userName = _ref.userName,
13087
13893
  children = _ref.children,
13088
13894
  style = _ref.style,
13089
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
13895
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
13090
13896
  var backgroundColor = '#1f62ff';
13091
13897
  if (userName) {
13092
13898
  backgroundColor = getRandomColor(userName);
@@ -13101,7 +13907,7 @@ var Avatar = function Avatar(_ref) {
13101
13907
  }));
13102
13908
  };
13103
13909
 
13104
- var _templateObject$O, _templateObject2$x;
13910
+ var _templateObject$O, _templateObject2$y;
13105
13911
  var SwitchUser = function SwitchUser(_ref) {
13106
13912
  var _customerData$filter, _customerData$filter$;
13107
13913
  var apiEndPoint = _ref.apiEndPoint,
@@ -13189,13 +13995,13 @@ var SwitchUser = function SwitchUser(_ref) {
13189
13995
  }))));
13190
13996
  };
13191
13997
  var RootContainer$4 = styled__default.div(_templateObject$O || (_templateObject$O = _taggedTemplateLiteralLoose(["\n margin: auto;\n padding: 2.4rem;\n max-width: 1920px;\n"])));
13192
- var CustomerContainer = styled__default.div(_templateObject2$x || (_templateObject2$x = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n transition: all 0.5s;\n padding: 1.1rem;\n border-radius: 1rem;\n box-shadow: 2px 2px 6px 0px #00000020;\n &:hover {\n transform: scale(1.05);\n }\n .name {\n color: ", ";\n font-size: 2.5rem;\n font-weight: 700;\n }\n .infoDetails {\n font-size: 1.1rem;\n color: #46464680;\n margin: 1rem 0;\n display: flex;\n align-items: center;\n svg {\n color: ", ";\n font-size: 1.5rem;\n margin-right: 0.5rem;\n }\n }\n"])), function (props) {
13998
+ var CustomerContainer = styled__default.div(_templateObject2$y || (_templateObject2$y = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n transition: all 0.5s;\n padding: 1.1rem;\n border-radius: 1rem;\n box-shadow: 2px 2px 6px 0px #00000020;\n &:hover {\n transform: scale(1.05);\n }\n .name {\n color: ", ";\n font-size: 2.5rem;\n font-weight: 700;\n }\n .infoDetails {\n font-size: 1.1rem;\n color: #46464680;\n margin: 1rem 0;\n display: flex;\n align-items: center;\n svg {\n color: ", ";\n font-size: 1.5rem;\n margin-right: 0.5rem;\n }\n }\n"])), function (props) {
13193
13999
  return props.theme.primaryColor || '#000000d9';
13194
14000
  }, function (props) {
13195
14001
  return props.theme.primaryColor || '#000000d9';
13196
14002
  });
13197
14003
 
13198
- var _templateObject$P, _templateObject2$y;
14004
+ var _templateObject$P, _templateObject2$z;
13199
14005
  var ThankYou = function ThankYou(_ref) {
13200
14006
  var _ref$id = _ref.id,
13201
14007
  id = _ref$id === void 0 ? 0 : _ref$id,
@@ -13255,7 +14061,7 @@ var ThankYou = function ThankYou(_ref) {
13255
14061
  }, /*#__PURE__*/React__default.createElement("p", null, "Continue Shopping"))))))));
13256
14062
  };
13257
14063
  var Root$d = styled__default(material.Box)(_templateObject$P || (_templateObject$P = _taggedTemplateLiteralLoose([""])));
13258
- var StyledButton = styled__default.button(_templateObject2$y || (_templateObject2$y = _taggedTemplateLiteralLoose(["\n outline: none;\n border: 1px solid;\n border-color: ", ";\n background: none;\n border-radius: 14px;\n padding: 10px 20px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n transition: background 0.5s ease;\n width: 200px;\n color: ", ";\n text-transform: uppercase;\n &:hover {\n cursor: pointer;\n background: ", ";\n color: #fff;\n }\n"])), function (props) {
14064
+ var StyledButton = styled__default.button(_templateObject2$z || (_templateObject2$z = _taggedTemplateLiteralLoose(["\n outline: none;\n border: 1px solid;\n border-color: ", ";\n background: none;\n border-radius: 14px;\n padding: 10px 20px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n transition: background 0.5s ease;\n width: 200px;\n color: ", ";\n text-transform: uppercase;\n &:hover {\n cursor: pointer;\n background: ", ";\n color: #fff;\n }\n"])), function (props) {
13259
14065
  return props.theme.primaryColor;
13260
14066
  }, function (props) {
13261
14067
  return props.theme.primaryColor;
@@ -13409,38 +14215,38 @@ var DiscountSummaryModal = function DiscountSummaryModal(_ref) {
13409
14215
  }, "Okay"))));
13410
14216
  };
13411
14217
 
13412
- var _templateObject$Q, _templateObject2$z, _templateObject3$q, _templateObject4$l, _templateObject5$h, _templateObject6$f, _templateObject7$b, _templateObject8$9;
14218
+ var _templateObject$Q, _templateObject2$A, _templateObject3$r, _templateObject4$m, _templateObject5$i, _templateObject6$g, _templateObject7$c, _templateObject8$a;
13413
14219
  var CheckoutRootContainer = styled__default.div(_templateObject$Q || (_templateObject$Q = _taggedTemplateLiteralLoose(["\n width: 100%;\n padding: 2rem;\n background-color: ", ";\n font-size: 16px;\n\n div,\n button,\n span {\n font-size: 16px;\n }\n @media only screen and (max-width: 1600px) {\n padding: 3em 0.5em;\n }\n @media screen and (max-width: 900px) {\n div,\n button,\n span {\n font-size: 12px;\n }\n padding: 2rem 0.5rem;\n }\n"])), function (props) {
13414
14220
  return props.bg;
13415
14221
  });
13416
- var CheckoutPageContainer = styled__default.div(_templateObject2$z || (_templateObject2$z = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n background-color: ", ";\n margin: 0 auto;\n padding: 2em;\n padding-left: min(4.5em, 2.5vw);\n color: rgba(50, 50, 50, 1);\n /* max-height: 90vh; */\n overflow: hidden;\n /* background: gainsboro; */\n border-radius: 28px;\n /* background-color: #fff8f6; */\n @media only screen and (max-width: 1200px) {\n flex-direction: column;\n align-items: center;\n max-height: max-content;\n }\n @media only screen and (max-width: 768px) {\n padding: 1em 0.5em;\n }\n .icon {\n font-size: 12px;\n }\n ////////////checkout and cart fonts\n /////////////////\n /* /////remove arrows from number input */\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type='number'] {\n -moz-appearance: textfield;\n }\n\n /* //////mui inputs */\n\n .Mui-checked {\n color: ", ";\n }\n\n .MuiOutlinedInput-notchedOutline {\n border: none;\n outline: none;\n }\n\n .MuiInputBase-root .MuiOutlinedInput-root,\n .MuiInputBase-colorPrimary,\n .MuiInputBase-fullWidth,\n .MuiInputBase-formControl {\n border-radius: 10px;\n }\n // /* /////stepper length */\n .MuiStepConnector-line,\n .MuiStepConnector-lineVertical {\n min-height: 60px !important;\n }\n\n @media only screen and (max-width: 900px) {\n .MuiStepConnector-line,\n .MuiStepConnector-lineVertical {\n min-height: 40px !important;\n }\n }\n"])), function (props) {
14222
+ var CheckoutPageContainer = styled__default.div(_templateObject2$A || (_templateObject2$A = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n background-color: ", ";\n margin: 0 auto;\n padding: 2em;\n padding-left: min(4.5em, 2.5vw);\n color: rgba(50, 50, 50, 1);\n /* max-height: 90vh; */\n overflow: hidden;\n /* background: gainsboro; */\n border-radius: 28px;\n /* background-color: #fff8f6; */\n @media only screen and (max-width: 1200px) {\n flex-direction: column;\n align-items: center;\n max-height: max-content;\n }\n @media only screen and (max-width: 768px) {\n padding: 1em 0.5em;\n }\n .icon {\n font-size: 12px;\n }\n ////////////checkout and cart fonts\n /////////////////\n /* /////remove arrows from number input */\n /* Chrome, Safari, Edge, Opera */\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Firefox */\n input[type='number'] {\n -moz-appearance: textfield;\n }\n\n /* //////mui inputs */\n\n .Mui-checked {\n color: ", ";\n }\n\n .MuiOutlinedInput-notchedOutline {\n border: none;\n outline: none;\n }\n\n .MuiInputBase-root .MuiOutlinedInput-root,\n .MuiInputBase-colorPrimary,\n .MuiInputBase-fullWidth,\n .MuiInputBase-formControl {\n border-radius: 10px;\n }\n // /* /////stepper length */\n .MuiStepConnector-line,\n .MuiStepConnector-lineVertical {\n min-height: 60px !important;\n }\n\n @media only screen and (max-width: 900px) {\n .MuiStepConnector-line,\n .MuiStepConnector-lineVertical {\n min-height: 40px !important;\n }\n }\n"])), function (props) {
13417
14223
  return props.maxWidth || '1605px';
13418
14224
  }, function (props) {
13419
14225
  return props.bg || '#fff8f6';
13420
14226
  }, function (props) {
13421
14227
  return props.primaryColor || 'rgba(50, 50, 50, 1)';
13422
14228
  });
13423
- var Row = styled__default.div(_templateObject3$q || (_templateObject3$q = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"])));
13424
- var CheckoutMainWithHeader = styled__default(material.Stack)(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
13425
- var CheckoutMain = styled__default.div(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: 1008px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n margin-right: 2em;\n max-height: 65vh;\n padding-right: 2em;\n overflow-y: auto;\n position: relative;\n padding-top: 2em;\n padding-bottom: 3em;\n /* width */\n ::-webkit-scrollbar {\n width: 10px;\n background: ", ";\n border-radius: 16px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 16px;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 16px;\n }\n @media only screen and (max-width: 1200px) {\n margin-bottom: 3em;\n min-height: max-content;\n max-height: max-content;\n margin-right: 0;\n overflow: visible;\n }\n @media only screen and (max-width: 768px) {\n // max-width: 100vw;\n padding-right: 0;\n // width: 98vw;\n // min-width: 90vw;\n padding-top: 1em;\n }\n /* overflow: hidden; */\n"])), function (props) {
14229
+ var Row = styled__default.div(_templateObject3$r || (_templateObject3$r = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n"])));
14230
+ var CheckoutMainWithHeader = styled__default(material.Stack)(_templateObject4$m || (_templateObject4$m = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
14231
+ var CheckoutMain = styled__default.div(_templateObject5$i || (_templateObject5$i = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: 1008px;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n margin-right: 2em;\n max-height: 65vh;\n padding-right: 2em;\n overflow-y: auto;\n position: relative;\n padding-top: 2em;\n padding-bottom: 3em;\n /* width */\n ::-webkit-scrollbar {\n width: 10px;\n background: ", ";\n border-radius: 16px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 16px;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 16px;\n }\n @media only screen and (max-width: 1200px) {\n margin-bottom: 3em;\n min-height: max-content;\n max-height: max-content;\n margin-right: 0;\n overflow: visible;\n }\n @media only screen and (max-width: 768px) {\n // max-width: 100vw;\n padding-right: 0;\n // width: 98vw;\n // min-width: 90vw;\n padding-top: 1em;\n }\n /* overflow: hidden; */\n"])), function (props) {
13426
14232
  return props.bg || 'rgba(102,112,128,0.5)';
13427
14233
  }, function (props) {
13428
14234
  return props.bg || 'rgba(102,112,128,0.5)';
13429
14235
  }, function (props) {
13430
14236
  return props.color;
13431
14237
  });
13432
- var CheckoutHeading = styled__default.div(_templateObject6$f || (_templateObject6$f = _taggedTemplateLiteralLoose(["\n margin-left: 2.5em;\n margin-bottom: 2em;\n h5 {\n font-size: 2.3em;\n font-weight: 600;\n text-transform: capitalize;\n }\n p {\n font-size: 0.875em;\n margin-top: 0.5em;\n }\n @media only screen and (max-width: 768px) {\n margin-left: 0;\n padding-left: 1em;\n }\n"])));
13433
- var CheckoutHeader = styled__default(Row)(_templateObject7$b || (_templateObject7$b = _taggedTemplateLiteralLoose(["\n width: 100%;\n overflow: auto;\n justify-content: space-around;\n display: flex;\n flex-direction: row;\n align-items: center;\n position: sticky;\n top: 0;\n background-color: white;\n z-index: 1;\n justify-content: flex-start;\n min-height: 4em;\n max-height: 4em;\n max-width: 60em;\n background: #ffffff;\n border-radius: 20px;\n color: #7d7b7b;\n padding: 0 2em;\n margin: 0 2em 1em 1em;\n .row {\n display: flex;\n color: inherit;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n text-transform: capitalize;\n margin-right: 2.4%;\n .icon {\n font-size: 14px;\n font-weight: 400;\n display: grid;\n place-items: center;\n margin-right: 6px;\n color: inherit;\n }\n p,\n span {\n font-size: 0.95em;\n color: inherit;\n }\n }\n .checked {\n p,\n span {\n color: #323232;\n }\n .icon {\n color: #249937;\n }\n }\n @media only screen and (max-width: 1200px) {\n margin-right: 0em;\n }\n @media only screen and (max-width: 768px) {\n width: 100%;\n padding: 2em 1em;\n margin: 1.4em 0;\n .row {\n margin-right: 4.5%;\n p {\n font-size: 12px;\n }\n span {\n display: none;\n }\n }\n }\n"])));
13434
- var CheckoutStepIcon = styled__default.div(_templateObject8$9 || (_templateObject8$9 = _taggedTemplateLiteralLoose(["\n width: 20px;\n height: 20px;\n border-radius: 50%;\n font-size: 5px;\n display: grid;\n place-items: center;\n margin: auto;\n padding: 0;\n margin-left: 2px;\n .circle {\n width: 16px;\n height: 16px;\n border-radius: 50%;\n font-size: 5px;\n display: grid;\n place-items: center;\n margin: auto;\n padding: 0;\n }\n .ic {\n font-size: 8px;\n }\n"])));
14238
+ var CheckoutHeading = styled__default.div(_templateObject6$g || (_templateObject6$g = _taggedTemplateLiteralLoose(["\n margin-left: 2.5em;\n margin-bottom: 2em;\n h5 {\n font-size: 2.3em;\n font-weight: 600;\n text-transform: capitalize;\n }\n p {\n font-size: 0.875em;\n margin-top: 0.5em;\n }\n @media only screen and (max-width: 768px) {\n margin-left: 0;\n padding-left: 1em;\n }\n"])));
14239
+ var CheckoutHeader = styled__default(Row)(_templateObject7$c || (_templateObject7$c = _taggedTemplateLiteralLoose(["\n width: 100%;\n overflow: auto;\n justify-content: space-around;\n display: flex;\n flex-direction: row;\n align-items: center;\n position: sticky;\n top: 0;\n background-color: white;\n z-index: 1;\n justify-content: flex-start;\n min-height: 4em;\n max-height: 4em;\n max-width: 60em;\n background: #ffffff;\n border-radius: 20px;\n color: #7d7b7b;\n padding: 0 2em;\n margin: 0 2em 1em 1em;\n .row {\n display: flex;\n color: inherit;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n text-transform: capitalize;\n margin-right: 2.4%;\n .icon {\n font-size: 14px;\n font-weight: 400;\n display: grid;\n place-items: center;\n margin-right: 6px;\n color: inherit;\n }\n p,\n span {\n font-size: 0.95em;\n color: inherit;\n }\n }\n .checked {\n p,\n span {\n color: #323232;\n }\n .icon {\n color: #249937;\n }\n }\n @media only screen and (max-width: 1200px) {\n margin-right: 0em;\n }\n @media only screen and (max-width: 768px) {\n width: 100%;\n padding: 2em 1em;\n margin: 1.4em 0;\n .row {\n margin-right: 4.5%;\n p {\n font-size: 12px;\n }\n span {\n display: none;\n }\n }\n }\n"])));
14240
+ var CheckoutStepIcon = styled__default.div(_templateObject8$a || (_templateObject8$a = _taggedTemplateLiteralLoose(["\n width: 20px;\n height: 20px;\n border-radius: 50%;\n font-size: 5px;\n display: grid;\n place-items: center;\n margin: auto;\n padding: 0;\n margin-left: 2px;\n .circle {\n width: 16px;\n height: 16px;\n border-radius: 50%;\n font-size: 5px;\n display: grid;\n place-items: center;\n margin: auto;\n padding: 0;\n }\n .ic {\n font-size: 8px;\n }\n"])));
13435
14241
 
13436
- var _templateObject$R, _templateObject2$A, _templateObject3$r;
14242
+ var _templateObject$R, _templateObject2$B, _templateObject3$s;
13437
14243
  var CheckoutSummaryContainer = styled__default.div(_templateObject$R || (_templateObject$R = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: ", ";\n border-radius: 20px;\n padding: max(1.5em, 30px);\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n max-width: 25rem;\n min-width: min(25rem, 95%);\n font-size: 16px;\n margin-top: 6.15em;\n @media only screen and (max-width: 1200px) {\n margin-top: 0;\n }\n"])), function (props) {
13438
14244
  return props.bg || 'rgba(255, 240, 236, 1)';
13439
14245
  }, function (props) {
13440
14246
  return props.color || ' rgba(50, 50, 50, 1)';
13441
14247
  });
13442
- var TextRow = styled__default.div(_templateObject2$A || (_templateObject2$A = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n max-width: 90%;\n margin-bottom: 0.8rem;\n padding-bottom: 0.8rem;\n width: 90%;\n border-bottom: 1px solid #f7f7f7;\n .text {\n font-size: 1.1em;\n text-transform: capitalize;\n }\n .total {\n font-size: 1.65em;\n font-weight: 800;\n }\n"])));
13443
- var FilledInfo = styled__default.div(_templateObject3$r || (_templateObject3$r = _taggedTemplateLiteralLoose(["\n margin-bottom: 2em;\n .heading {\n font-size: 1.25em;\n font-weight: 800;\n margin-bottom: 0.8em;\n }\n\n p {\n font-size: 0.875em;\n text-transform: capitalize;\n max-width: 60%;\n }\n .bold {\n font-weight: 700;\n margin-bottom: 0.8em;\n max-width: 300px;\n width: fit-content;\n }\n .payment {\n width: 70px;\n height: 48px;\n background: #ffffff;\n border-radius: 15.875px;\n display: grid;\n place-items: center;\n overflow: hidden;\n }\n .blank {\n opacity: 0;\n }\n"])));
14248
+ var TextRow = styled__default.div(_templateObject2$B || (_templateObject2$B = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n max-width: 90%;\n margin-bottom: 0.8rem;\n padding-bottom: 0.8rem;\n width: 90%;\n border-bottom: 1px solid #f7f7f7;\n .text {\n font-size: 1.1em;\n text-transform: capitalize;\n }\n .total {\n font-size: 1.65em;\n font-weight: 800;\n }\n"])));
14249
+ var FilledInfo = styled__default.div(_templateObject3$s || (_templateObject3$s = _taggedTemplateLiteralLoose(["\n margin-bottom: 2em;\n .heading {\n font-size: 1.25em;\n font-weight: 800;\n margin-bottom: 0.8em;\n }\n\n p {\n font-size: 0.875em;\n text-transform: capitalize;\n max-width: 60%;\n }\n .bold {\n font-weight: 700;\n margin-bottom: 0.8em;\n max-width: 300px;\n width: fit-content;\n }\n .payment {\n width: 70px;\n height: 48px;\n background: #ffffff;\n border-radius: 15.875px;\n display: grid;\n place-items: center;\n overflow: hidden;\n }\n .blank {\n opacity: 0;\n }\n"])));
13444
14250
 
13445
14251
  var CheckoutSummary = function CheckoutSummary(_ref) {
13446
14252
  var billingInformation = _ref.billingInformation,
@@ -13512,14 +14318,14 @@ var CheckoutSummary = function CheckoutSummary(_ref) {
13512
14318
  }, renderMoney(orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.adjustmentValue))));
13513
14319
  };
13514
14320
 
13515
- var _templateObject$S, _templateObject2$B, _templateObject3$s, _templateObject4$m, _templateObject5$i, _templateObject6$g, _templateObject7$c, _templateObject8$a, _templateObject9$7, _templateObject10$5, _templateObject11$4, _templateObject12$3, _templateObject13$3, _templateObject14$3, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3;
14321
+ var _templateObject$S, _templateObject2$C, _templateObject3$t, _templateObject4$n, _templateObject5$j, _templateObject6$h, _templateObject7$d, _templateObject8$b, _templateObject9$7, _templateObject10$6, _templateObject11$4, _templateObject12$3, _templateObject13$3, _templateObject14$3, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3;
13516
14322
  var StepContainer = styled__default.div(_templateObject$S || (_templateObject$S = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: 60em;\n background: white;\n padding: 1em 2em;\n background: #ffffff;\n border-radius: 20px;\n margin-left: 2em;\n margin-top: -2em;\n margin-bottom: 1em;\n // @media screen and (max-width: 1200px) {\n // width: 80vw;\n // min-width: 0;\n // }\n @media screen and (max-width: 768px) {\n // width: 96%;\n margin-left: 1em;\n padding: 0.8em;\n }\n @media screen and (max-width: 600px) {\n // width: 94%;\n margin-left: 1.2em;\n }\n"])));
13517
- var StepsContent = styled__default.div(_templateObject2$B || (_templateObject2$B = _taggedTemplateLiteralLoose(["\n padding-left: 1.565em;\n min-height: max-content;\n .MuiOutlinedInput-root {\n background: ", ";\n }\n\n p {\n font-size: 0.75em;\n }\n .bold {\n text-transform: uppercase;\n word-spacing: 5px;\n margin-top: 0.95em;\n span {\n font-weight: 600;\n cursor: pointer;\n font-size: 0.94rem;\n }\n .red {\n color: ", ";\n }\n }\n @media screen and (max-width: 768px) {\n padding: 0;\n width: 100%;\n }\n"])), function (props) {
14323
+ var StepsContent = styled__default.div(_templateObject2$C || (_templateObject2$C = _taggedTemplateLiteralLoose(["\n padding-left: 1.565em;\n min-height: max-content;\n .MuiOutlinedInput-root {\n background: ", ";\n }\n\n p {\n font-size: 0.75em;\n }\n .bold {\n text-transform: uppercase;\n word-spacing: 5px;\n margin-top: 0.95em;\n span {\n font-weight: 600;\n cursor: pointer;\n font-size: 0.94rem;\n }\n .red {\n color: ", ";\n }\n }\n @media screen and (max-width: 768px) {\n padding: 0;\n width: 100%;\n }\n"])), function (props) {
13518
14324
  return 'transparent' + '!important';
13519
14325
  }, function (props) {
13520
14326
  return props.bg || 'red';
13521
14327
  });
13522
- var StepsHeaderContainer = styled__default.div(_templateObject3$s || (_templateObject3$s = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n color: #323232;\n /* padding: ", "; */\n margin-bottom: ", ";\n margin-top: ", ";\n margin-left: ", ";\n /* color: grey; */\n border-bottom: 1px solid #f6f6f6;\n background: #ffffff;\n border-radius: 20px;\n // max-width: 900px;\n min-height: 4.35em;\n max-height: 4.35em;\n padding: ", ";\n h5 {\n font-size: 16px;\n font-weight: 600;\n text-transform: capitalize;\n margin-left: 0.6em;\n }\n .icon {\n font-size: 1.3em;\n margin-right: 8px;\n }\n .dropIcon {\n font-size: 1.4em;\n cursor: pointer;\n transform: rotate(-90deg);\n transition: 0.3s;\n color: rgba(50, 50, 50, 0.75);\n cursor: ", ";\n }\n .red {\n font-weight: 600;\n color: #fd0015;\n font-size: inherit;\n }\n @media screen and (max-width: 768px) {\n max-width: 97%;\n margin-left: 0.5em;\n padding-right: 1em;\n h5 {\n font-size: 12px;\n }\n }\n"])), function (props) {
14328
+ var StepsHeaderContainer = styled__default.div(_templateObject3$t || (_templateObject3$t = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n color: #323232;\n /* padding: ", "; */\n margin-bottom: ", ";\n margin-top: ", ";\n margin-left: ", ";\n /* color: grey; */\n border-bottom: 1px solid #f6f6f6;\n background: #ffffff;\n border-radius: 20px;\n // max-width: 900px;\n min-height: 4.35em;\n max-height: 4.35em;\n padding: ", ";\n h5 {\n font-size: 16px;\n font-weight: 600;\n text-transform: capitalize;\n margin-left: 0.6em;\n }\n .icon {\n font-size: 1.3em;\n margin-right: 8px;\n }\n .dropIcon {\n font-size: 1.4em;\n cursor: pointer;\n transform: rotate(-90deg);\n transition: 0.3s;\n color: rgba(50, 50, 50, 0.75);\n cursor: ", ";\n }\n .red {\n font-weight: 600;\n color: #fd0015;\n font-size: inherit;\n }\n @media screen and (max-width: 768px) {\n max-width: 97%;\n margin-left: 0.5em;\n padding-right: 1em;\n h5 {\n font-size: 12px;\n }\n }\n"])), function (props) {
13523
14329
  return props.single ? '1.8em 2em' : '1em 0';
13524
14330
  }, function (props) {
13525
14331
  return props.single ? '-1.56em' : '1em';
@@ -13532,11 +14338,11 @@ var StepsHeaderContainer = styled__default.div(_templateObject3$s || (_templateO
13532
14338
  }, function (props) {
13533
14339
  return props.username ? 'not-allowed' : 'pointer';
13534
14340
  });
13535
- var TextFeildContainer = styled__default.div(_templateObject4$m || (_templateObject4$m = _taggedTemplateLiteralLoose(["\n label {\n color: rgba(107, 106, 106, 0.6) !important;\n }\n background: ", ";\n border-radius: 10px;\n && {\n input {\n font-size: 0.875em !important;\n color: black;\n &::placeholder {\n font-size: 0.975em !important;\n }\n }\n .icon {\n color: black;\n font-size: 1em;\n }\n }\n"])), function (props) {
14341
+ var TextFeildContainer = styled__default.div(_templateObject4$n || (_templateObject4$n = _taggedTemplateLiteralLoose(["\n label {\n color: rgba(107, 106, 106, 0.6) !important;\n }\n background: ", ";\n border-radius: 10px;\n && {\n input {\n font-size: 0.875em !important;\n color: black;\n &::placeholder {\n font-size: 0.975em !important;\n }\n }\n .icon {\n color: black;\n font-size: 1em;\n }\n }\n"])), function (props) {
13536
14342
  var _props$theme, _props$theme$input;
13537
14343
  return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : (_props$theme$input = _props$theme.input) === null || _props$theme$input === void 0 ? void 0 : _props$theme$input.bg) || 'transparent';
13538
14344
  });
13539
- var CommonCheckoutBtn = styled__default.button(_templateObject5$i || (_templateObject5$i = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n width: ", ";\n height: ", ";\n background: ", ";\n display: grid;\n place-items: center;\n color: white;\n margin: 0 1em;\n font-weight: 500;\n letter-spacing: 1px;\n text-transform: ", ";\n transition: 0.4s;\n cursor: ", ";\n &:hover,\n &:focus {\n opacity: 0.7;\n }\n"])), function (props) {
14345
+ var CommonCheckoutBtn = styled__default.button(_templateObject5$j || (_templateObject5$j = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n width: ", ";\n height: ", ";\n background: ", ";\n display: grid;\n place-items: center;\n color: white;\n margin: 0 1em;\n font-weight: 500;\n letter-spacing: 1px;\n text-transform: ", ";\n transition: 0.4s;\n cursor: ", ";\n &:hover,\n &:focus {\n opacity: 0.7;\n }\n"])), function (props) {
13540
14346
  return props.width || '8.05em';
13541
14347
  }, function (props) {
13542
14348
  return props.height || '2.25em';
@@ -13549,7 +14355,7 @@ var CommonCheckoutBtn = styled__default.button(_templateObject5$i || (_templateO
13549
14355
  });
13550
14356
  var Select = styled__default.div.attrs({
13551
14357
  className: 'checkout-input'
13552
- })(_templateObject6$g || (_templateObject6$g = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 54px;\n border-radius: 10px;\n background: ", ";\n outline: none;\n border: none;\n padding: 0 1em;\n cursor: pointer;\n select {\n width: 100%;\n height: 100%;\n border: none;\n outline: none;\n padding: 0.5em 0;\n color: rgba(107, 106, 106, 0.6);\n background: ", ";\n }\n"])), function (props) {
14358
+ })(_templateObject6$h || (_templateObject6$h = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 54px;\n border-radius: 10px;\n background: ", ";\n outline: none;\n border: none;\n padding: 0 1em;\n cursor: pointer;\n select {\n width: 100%;\n height: 100%;\n border: none;\n outline: none;\n padding: 0.5em 0;\n color: rgba(107, 106, 106, 0.6);\n background: ", ";\n }\n"])), function (props) {
13553
14359
  var _props$theme2, _props$theme2$input;
13554
14360
  return ((_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : (_props$theme2$input = _props$theme2.input) === null || _props$theme2$input === void 0 ? void 0 : _props$theme2$input.bg) || 'transparent';
13555
14361
  }, function (props) {
@@ -13557,12 +14363,12 @@ var Select = styled__default.div.attrs({
13557
14363
  });
13558
14364
  var SaveButton = styled__default.button.attrs({
13559
14365
  className: 'checkout-btn'
13560
- })(_templateObject7$c || (_templateObject7$c = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n font-size: 0.8125em;\n text-transform: uppercase;\n font-weight: 600;\n border-radius: 7px;\n padding: 0.55em 1em;\n background: ", ";\n display: grid;\n place-items: center;\n color: white;\n margin: 1em 0;\n letter-spacing: 1px;\n transition: 0.4s;\n cursor: ", ";\n &:hover,\n &:focus {\n opacity: 0.7;\n }\n"])), function (props) {
14366
+ })(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n border: none;\n outline: none;\n font-size: 0.8125em;\n text-transform: uppercase;\n font-weight: 600;\n border-radius: 7px;\n padding: 0.55em 1em;\n background: ", ";\n display: grid;\n place-items: center;\n color: white;\n margin: 1em 0;\n letter-spacing: 1px;\n transition: 0.4s;\n cursor: ", ";\n &:hover,\n &:focus {\n opacity: 0.7;\n }\n"])), function (props) {
13561
14367
  return props.color || '#FD0015';
13562
14368
  }, function (props) {
13563
14369
  return props.disabled ? 'not-allowed' : 'pointer';
13564
14370
  });
13565
- var ButtonRowContainer = styled__default.div(_templateObject8$a || (_templateObject8$a = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n button {\n width: 4.862em;\n height: 1.96em;\n border-radius: 0.43em;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n letter-spacing: 1px;\n color: white;\n opacity: ", ";\n background-color: ", ";\n border: 2px solid\n ", ";\n cursor: ", ";\n }\n .back {\n font-size: 0.875em;\n font-weight: 500;\n justify-content: flex-start;\n margin-right: 0.2em;\n color: #323232;\n background: transparent;\n border: none;\n cursor: ", ";\n font-size: 0.8em;\n transition: 0.4s;\n opacity: 1;\n .icon {\n font-size: 1.2em;\n margin-right: 2px;\n }\n &:hover,\n &:focus {\n letter-spacing: 1px;\n outline: none;\n }\n }\n"])), function (props) {
14371
+ var ButtonRowContainer = styled__default.div(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n button {\n width: 4.862em;\n height: 1.96em;\n border-radius: 0.43em;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n font-weight: 600;\n letter-spacing: 1px;\n color: white;\n opacity: ", ";\n background-color: ", ";\n border: 2px solid\n ", ";\n cursor: ", ";\n }\n .back {\n font-size: 0.875em;\n font-weight: 500;\n justify-content: flex-start;\n margin-right: 0.2em;\n color: #323232;\n background: transparent;\n border: none;\n cursor: ", ";\n font-size: 0.8em;\n transition: 0.4s;\n opacity: 1;\n .icon {\n font-size: 1.2em;\n margin-right: 2px;\n }\n &:hover,\n &:focus {\n letter-spacing: 1px;\n outline: none;\n }\n }\n"])), function (props) {
13566
14372
  return props.disabledNext && '0.5';
13567
14373
  }, function (props) {
13568
14374
  return props.color || '#fd0015';
@@ -13584,7 +14390,7 @@ var CheckBoxRow = styled__default.div(_templateObject9$7 || (_templateObject9$7
13584
14390
  }, function (prop) {
13585
14391
  return prop.colorText || 'red';
13586
14392
  });
13587
- var CreditCardFextField = styled__default.div(_templateObject10$5 || (_templateObject10$5 = _taggedTemplateLiteralLoose(["\n label {\n color: rgba(107, 106, 106, 0.6) !important;\n }\n .MuiOutlinedInput-root {\n background: ", ";\n }\n .save-btn {\n background: ", ";\n }\n"])), function (prop) {
14393
+ var CreditCardFextField = styled__default.div(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n label {\n color: rgba(107, 106, 106, 0.6) !important;\n }\n .MuiOutlinedInput-root {\n background: ", ";\n }\n .save-btn {\n background: ", ";\n }\n"])), function (prop) {
13588
14394
  return prop.bgInput + '!important' || '';
13589
14395
  }, function (prop) {
13590
14396
  return prop.btnBg + '!important' || '';
@@ -15086,7 +15892,7 @@ var erSessionStorage = {
15086
15892
  }
15087
15893
  };
15088
15894
 
15089
- var _templateObject$T, _templateObject2$C;
15895
+ var _templateObject$T, _templateObject2$D;
15090
15896
  var ConsentForm = function ConsentForm(_ref) {
15091
15897
  var apiEndPoint = _ref.apiEndPoint,
15092
15898
  token = _ref.token,
@@ -15265,7 +16071,7 @@ var InfoItem = function InfoItem(_ref3) {
15265
16071
  item: true
15266
16072
  }, /*#__PURE__*/React__default.createElement("p", null, value))));
15267
16073
  };
15268
- var InfoItemContainer = styled__default.div(_templateObject2$C || (_templateObject2$C = _taggedTemplateLiteralLoose(["\n background: #00000010;\n padding: 0.5rem;\n"])));
16074
+ var InfoItemContainer = styled__default.div(_templateObject2$D || (_templateObject2$D = _taggedTemplateLiteralLoose(["\n background: #00000010;\n padding: 0.5rem;\n"])));
15269
16075
 
15270
16076
  var PaypalComponent = function PaypalComponent(_ref) {
15271
16077
  var apiEndPoint = _ref.apiEndPoint,
@@ -16654,7 +17460,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref9) {
16654
17460
  }, props)));
16655
17461
  };
16656
17462
 
16657
- var _templateObject$U, _templateObject2$D, _templateObject3$t;
17463
+ var _templateObject$U, _templateObject2$E, _templateObject3$u;
16658
17464
  var columns$1 = [{
16659
17465
  id: 'id',
16660
17466
  label: 'Id',
@@ -16770,10 +17576,10 @@ var PurchaseOrderList = function PurchaseOrderList(_ref) {
16770
17576
  })));
16771
17577
  };
16772
17578
  var TableContainer$3 = styled__default.div(_templateObject$U || (_templateObject$U = _taggedTemplateLiteralLoose(["\n margin: 0.5rem;\n border-radius: 14px;\n"])));
16773
- var TypographyContainer$9 = styled__default(material.Typography)(_templateObject2$D || (_templateObject2$D = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
17579
+ var TypographyContainer$9 = styled__default(material.Typography)(_templateObject2$E || (_templateObject2$E = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
16774
17580
  return props.fontColor;
16775
17581
  });
16776
- var TitleContainer$3 = styled__default.h4(_templateObject3$t || (_templateObject3$t = _taggedTemplateLiteralLoose(["\n font-size: 2.7rem;\n span {\n color: '#000';\n font-weight: 500;\n }\n b {\n color: ", ";\n }\n @media only screen and (max-width: 608px) {\n font-size: 2.2rem;\n }\n"])), function (props) {
17582
+ var TitleContainer$3 = styled__default.h4(_templateObject3$u || (_templateObject3$u = _taggedTemplateLiteralLoose(["\n font-size: 2.7rem;\n span {\n color: '#000';\n font-weight: 500;\n }\n b {\n color: ", ";\n }\n @media only screen and (max-width: 608px) {\n font-size: 2.2rem;\n }\n"])), function (props) {
16777
17583
  return props.primaryColor;
16778
17584
  });
16779
17585
 
@@ -17344,7 +18150,7 @@ var VendorInventory = function VendorInventory(_ref) {
17344
18150
  })));
17345
18151
  };
17346
18152
 
17347
- var _templateObject$V, _templateObject2$E, _templateObject3$u, _templateObject4$n, _templateObject5$j, _templateObject6$h, _templateObject7$d, _templateObject8$b;
18153
+ var _templateObject$V, _templateObject2$F, _templateObject3$v, _templateObject4$o, _templateObject5$k, _templateObject6$i, _templateObject7$e, _templateObject8$c;
17348
18154
  var VendorLogin = function VendorLogin(_ref) {
17349
18155
  var primaryColor = _ref.primaryColor,
17350
18156
  API_BASE_URL = _ref.API_BASE_URL;
@@ -17451,15 +18257,15 @@ var VendorLogin = function VendorLogin(_ref) {
17451
18257
  }) : 'sign in'))))));
17452
18258
  };
17453
18259
  var Container$3 = styled__default.div(_templateObject$V || (_templateObject$V = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background: rgb(255, 255, 255);\n font-size: 16px !important;\n padding: 1rem;\n @media only screen and (max-width: 640px) {\n font-size: 14px !important;\n }\n"])));
17454
- var StyledLogin = styled__default.div(_templateObject2$E || (_templateObject2$E = _taggedTemplateLiteralLoose(["\n height: 70%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 1em;\n align-items: center;\n"])));
17455
- var StyledCard = styled__default(material.Card)(_templateObject3$u || (_templateObject3$u = _taggedTemplateLiteralLoose(["\n width: min(100%, 489px);\n height: 100%;\n max-height: 450px;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid #cac8c8;\n flex-direction: column;\n background: white;\n // min-height: 500px;\n h4 {\n font-size: 1.5em;\n margin-bottom: 1em;\n margin-top: -2em;\n text-transform: uppercase;\n font-weight: 500;\n }\n button {\n text-transform: capitalize;\n letter-spacing: 1px;\n font-size: 1em;\n font-weight: 500;\n }\n"])));
17456
- var H1 = styled__default(material.Typography)(_templateObject4$n || (_templateObject4$n = _taggedTemplateLiteralLoose(["\n margin-top: 1rem;\n"])));
17457
- var StyleInputBx = styled__default.div(_templateObject5$j || (_templateObject5$j = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid rgb(202, 200, 200);\n // padding:.5em;\n min-width: min(80vw, 360px);\n // border-radius: 20px;\n overflow: hidden;\n margin: 0.6em 0;\n // padding:.2em 0;\n .icon {\n border-right: 1px solid rgb(202, 200, 200);\n height: 100%;\n padding: 1em;\n display: grid;\n place-items: center;\n width: 15%;\n box-sizing: border-box;\n color: grey;\n }\n input {\n width: 85%;\n height: 100%;\n outline: none;\n padding: 0 1em;\n font-size: 1.1em;\n border: none;\n &:focus,\n &:hover {\n outline: none !important;\n }\n }\n"])));
17458
- var ShowPassBtn = styled__default.span(_templateObject6$h || (_templateObject6$h = _taggedTemplateLiteralLoose(["\n padding-right: 0.4em;\n display: grid;\n place-items: center;\n font-size: 25px;\n color: grey;\n cursor: pointer;\n"])));
17459
- var ButtonContianer = styled__default.span(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: 360px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n // @include flexRow(space-between);\n margin-top: 1em;\n @media only screen and (max-width: 640px) {\n padding: 0 1em;\n }\n"])));
17460
- var StyledButton$1 = styled__default(material.Button)(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n width: 100px;\n height: 46px;\n box-sizing: border-box;\n\n span {\n padding: 0.5em;\n }\n @media only screen and (max-width: 640px) {\n height: 35px;\n }\n"])));
18260
+ var StyledLogin = styled__default.div(_templateObject2$F || (_templateObject2$F = _taggedTemplateLiteralLoose(["\n height: 70%;\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 1em;\n align-items: center;\n"])));
18261
+ var StyledCard = styled__default(material.Card)(_templateObject3$v || (_templateObject3$v = _taggedTemplateLiteralLoose(["\n width: min(100%, 489px);\n height: 100%;\n max-height: 450px;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid #cac8c8;\n flex-direction: column;\n background: white;\n // min-height: 500px;\n h4 {\n font-size: 1.5em;\n margin-bottom: 1em;\n margin-top: -2em;\n text-transform: uppercase;\n font-weight: 500;\n }\n button {\n text-transform: capitalize;\n letter-spacing: 1px;\n font-size: 1em;\n font-weight: 500;\n }\n"])));
18262
+ var H1 = styled__default(material.Typography)(_templateObject4$o || (_templateObject4$o = _taggedTemplateLiteralLoose(["\n margin-top: 1rem;\n"])));
18263
+ var StyleInputBx = styled__default.div(_templateObject5$k || (_templateObject5$k = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid rgb(202, 200, 200);\n // padding:.5em;\n min-width: min(80vw, 360px);\n // border-radius: 20px;\n overflow: hidden;\n margin: 0.6em 0;\n // padding:.2em 0;\n .icon {\n border-right: 1px solid rgb(202, 200, 200);\n height: 100%;\n padding: 1em;\n display: grid;\n place-items: center;\n width: 15%;\n box-sizing: border-box;\n color: grey;\n }\n input {\n width: 85%;\n height: 100%;\n outline: none;\n padding: 0 1em;\n font-size: 1.1em;\n border: none;\n &:focus,\n &:hover {\n outline: none !important;\n }\n }\n"])));
18264
+ var ShowPassBtn = styled__default.span(_templateObject6$i || (_templateObject6$i = _taggedTemplateLiteralLoose(["\n padding-right: 0.4em;\n display: grid;\n place-items: center;\n font-size: 25px;\n color: grey;\n cursor: pointer;\n"])));
18265
+ var ButtonContianer = styled__default.span(_templateObject7$e || (_templateObject7$e = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: 360px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n // @include flexRow(space-between);\n margin-top: 1em;\n @media only screen and (max-width: 640px) {\n padding: 0 1em;\n }\n"])));
18266
+ var StyledButton$1 = styled__default(material.Button)(_templateObject8$c || (_templateObject8$c = _taggedTemplateLiteralLoose(["\n width: 100px;\n height: 46px;\n box-sizing: border-box;\n\n span {\n padding: 0.5em;\n }\n @media only screen and (max-width: 640px) {\n height: 35px;\n }\n"])));
17461
18267
 
17462
- var _templateObject$W, _templateObject2$F, _templateObject3$v, _templateObject4$o;
18268
+ var _templateObject$W, _templateObject2$G, _templateObject3$w, _templateObject4$p;
17463
18269
  var menuItems = [{
17464
18270
  name: 'My Account',
17465
18271
  Icon: ri.RiAccountBoxLine,
@@ -17668,7 +18474,7 @@ var VendorAccountDetails = function VendorAccountDetails(_ref) {
17668
18474
  }) : /*#__PURE__*/React__default.createElement(React.Fragment, null, API_BASE_URL && token && renderListItemComponent(tabValue)))))));
17669
18475
  };
17670
18476
  var Root$e = styled__default(material.Box)(_templateObject$W || (_templateObject$W = _taggedTemplateLiteralLoose(["\n padding: 1.4rem;\n background-color: #fff;\n @media only screen and (max-width: 608px) {\n padding: 0.5rem;\n }\n"])));
17671
- var MainContainer$4 = styled__default.div(_templateObject2$F || (_templateObject2$F = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n margin: auto;\n min-height: 100vh;\n background-color: #fff;\n max-width: ", ";\n padding: 2rem;\n border-radius: 14px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n @media only screen and (max-width: 608px) {\n padding: 0.5rem;\n }\n"])), function (props) {
18477
+ var MainContainer$4 = styled__default.div(_templateObject2$G || (_templateObject2$G = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n margin: auto;\n min-height: 100vh;\n background-color: #fff;\n max-width: ", ";\n padding: 2rem;\n border-radius: 14px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n @media only screen and (max-width: 608px) {\n padding: 0.5rem;\n }\n"])), function (props) {
17672
18478
  return props.open ? '1800px' : '1600px';
17673
18479
  });
17674
18480
  var Main$1 = styles.styled('main', {
@@ -17701,12 +18507,12 @@ var Main$1 = styles.styled('main', {
17701
18507
  overflow: 'auto'
17702
18508
  });
17703
18509
  });
17704
- var ContainerDrawer$1 = styled__default(material.Drawer)(_templateObject3$v || (_templateObject3$v = _taggedTemplateLiteralLoose(["\n // height: 100%;\n margin-right: ", ";\n .MuiDrawer-paper {\n padding: 1rem;\n position: relative;\n z-index: 1;\n background: ", ";\n border-radius: 14px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n }\n"])), function (props) {
18510
+ var ContainerDrawer$1 = styled__default(material.Drawer)(_templateObject3$w || (_templateObject3$w = _taggedTemplateLiteralLoose(["\n // height: 100%;\n margin-right: ", ";\n .MuiDrawer-paper {\n padding: 1rem;\n position: relative;\n z-index: 1;\n background: ", ";\n border-radius: 14px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px 0px;\n }\n"])), function (props) {
17705
18511
  return props.open && '2rem';
17706
18512
  }, function (props) {
17707
18513
  return props.primaryColor || transparent;
17708
18514
  });
17709
- var TypographyContainer$a = styled__default(material.Typography)(_templateObject4$o || (_templateObject4$o = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
18515
+ var TypographyContainer$a = styled__default(material.Typography)(_templateObject4$p || (_templateObject4$p = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: center;\n"])), function (props) {
17710
18516
  return props.fontColor;
17711
18517
  });
17712
18518
 
@@ -18072,7 +18878,7 @@ var ReStockedItem = function ReStockedItem(_ref) {
18072
18878
  })))))));
18073
18879
  };
18074
18880
 
18075
- var _excluded$8 = ["children", "value", "index"];
18881
+ var _excluded$9 = ["children", "value", "index"];
18076
18882
  var NewArrivalPage = function NewArrivalPage(_ref) {
18077
18883
  var apiEndPoint = _ref.apiEndPoint,
18078
18884
  token = _ref.token,
@@ -18180,7 +18986,7 @@ function CustomTabPanel(props) {
18180
18986
  var children = props.children,
18181
18987
  value = props.value,
18182
18988
  index = props.index,
18183
- other = _objectWithoutPropertiesLoose(props, _excluded$8);
18989
+ other = _objectWithoutPropertiesLoose(props, _excluded$9);
18184
18990
  return /*#__PURE__*/React__default.createElement("div", _extends({
18185
18991
  role: "tabpanel",
18186
18992
  hidden: value !== index,
@@ -18322,17 +19128,17 @@ var moveToCart = function moveToCart(_ref3) {
18322
19128
  }
18323
19129
  };
18324
19130
 
18325
- var _templateObject$Y, _templateObject2$G, _templateObject3$w, _templateObject4$p, _templateObject5$k, _templateObject6$i, _templateObject7$e, _templateObject8$c, _templateObject9$8, _templateObject10$6, _templateObject11$5;
19131
+ var _templateObject$Y, _templateObject2$H, _templateObject3$x, _templateObject4$q, _templateObject5$l, _templateObject6$j, _templateObject7$f, _templateObject8$d, _templateObject9$8, _templateObject10$7, _templateObject11$5;
18326
19132
  var EmptyStateText = styled__default.p(_templateObject$Y || (_templateObject$Y = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n color: #4b4b4b;\n margin: 16px 0;\n"])));
18327
- var ProductCardWrapper = styled__default.div(_templateObject2$G || (_templateObject2$G = _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"])));
18328
- var TopBar = styled__default.div(_templateObject3$w || (_templateObject3$w = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n"])));
18329
- var SearchWrapper = styled__default(material.Box)(_templateObject4$p || (_templateObject4$p = _taggedTemplateLiteralLoose(["\n && {\n margin-bottom: 24px;\n max-width: 400px;\n width: 100%;\n }\n"])));
18330
- var TotalItemsText = styled__default.div(_templateObject5$k || (_templateObject5$k = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 500;\n color: #4b4b4b;\n margin-bottom: 24px;\n white-space: nowrap;\n"])));
18331
- var DeleteButton = styled__default.button(_templateObject6$i || (_templateObject6$i = _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"])));
18332
- var PriceContainer = styled__default.div(_templateObject7$e || (_templateObject7$e = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
18333
- var DiscountPriceRow = styled__default.div(_templateObject8$c || (_templateObject8$c = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n"])));
19133
+ var ProductCardWrapper = styled__default.div(_templateObject2$H || (_templateObject2$H = _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"])));
19134
+ var TopBar$1 = styled__default.div(_templateObject3$x || (_templateObject3$x = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n"])));
19135
+ var SearchWrapper = styled__default(material.Box)(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n && {\n margin-bottom: 24px;\n max-width: 400px;\n width: 100%;\n }\n"])));
19136
+ var TotalItemsText = styled__default.div(_templateObject5$l || (_templateObject5$l = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 500;\n color: #4b4b4b;\n margin-bottom: 24px;\n white-space: nowrap;\n"])));
19137
+ var DeleteButton = styled__default.button(_templateObject6$j || (_templateObject6$j = _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"])));
19138
+ var PriceContainer = styled__default.div(_templateObject7$f || (_templateObject7$f = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
19139
+ var DiscountPriceRow = styled__default.div(_templateObject8$d || (_templateObject8$d = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n"])));
18334
19140
  var ProductName$2 = styled__default.div(_templateObject9$8 || (_templateObject9$8 = _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"])));
18335
- var ProductActionButton = styled__default(material.Button)(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])), function (_ref) {
19141
+ var ProductActionButton = styled__default(material.Button)(_templateObject10$7 || (_templateObject10$7 = _taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])), function (_ref) {
18336
19142
  var primaryColor = _ref.primaryColor;
18337
19143
  return primaryColor != null ? primaryColor : '#000000';
18338
19144
  });
@@ -18402,7 +19208,7 @@ var WishlistContent = function WishlistContent(_ref) {
18402
19208
  width: '100%',
18403
19209
  height: '100%'
18404
19210
  }
18405
- }, /*#__PURE__*/React__default.createElement(TopBar, {
19211
+ }, /*#__PURE__*/React__default.createElement(TopBar$1, {
18406
19212
  style: getStyleOverride(styleOverrides, 'topBar', 'TopBar')
18407
19213
  }, /*#__PURE__*/React__default.createElement(SearchWrapper, {
18408
19214
  style: getStyleOverride(styleOverrides, 'searchWrapper', 'SearchWrapper')
@@ -18812,17 +19618,17 @@ var moveToCartFromFavoriteItems = function moveToCartFromFavoriteItems(_ref3) {
18812
19618
  }
18813
19619
  };
18814
19620
 
18815
- var _templateObject$Z, _templateObject2$H, _templateObject3$x, _templateObject4$q, _templateObject5$l, _templateObject6$j, _templateObject7$f, _templateObject8$d, _templateObject9$9, _templateObject10$7, _templateObject11$6;
19621
+ var _templateObject$Z, _templateObject2$I, _templateObject3$y, _templateObject4$r, _templateObject5$m, _templateObject6$k, _templateObject7$g, _templateObject8$e, _templateObject9$9, _templateObject10$8, _templateObject11$6;
18816
19622
  var EmptyStateText$1 = styled__default.p(_templateObject$Z || (_templateObject$Z = _taggedTemplateLiteralLoose(["\n font-size: 16px;\n color: #4b4b4b;\n margin: 16px 0;\n"])));
18817
- var ProductCardWrapper$1 = styled__default.div(_templateObject2$H || (_templateObject2$H = _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"])));
18818
- var TopBar$1 = styled__default.div(_templateObject3$x || (_templateObject3$x = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n"])));
18819
- var SearchWrapper$1 = styled__default(material.Box)(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n && {\n margin-bottom: 24px;\n max-width: 400px;\n width: 100%;\n }\n"])));
18820
- var TotalItemsText$1 = styled__default.div(_templateObject5$l || (_templateObject5$l = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 500;\n color: #4b4b4b;\n margin-bottom: 24px;\n white-space: nowrap;\n"])));
18821
- var DeleteButton$1 = styled__default.button(_templateObject6$j || (_templateObject6$j = _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"])));
18822
- var PriceContainer$1 = styled__default.div(_templateObject7$f || (_templateObject7$f = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
18823
- var DiscountPriceRow$1 = styled__default.div(_templateObject8$d || (_templateObject8$d = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n"])));
19623
+ var ProductCardWrapper$1 = styled__default.div(_templateObject2$I || (_templateObject2$I = _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"])));
19624
+ var TopBar$2 = styled__default.div(_templateObject3$y || (_templateObject3$y = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n"])));
19625
+ var SearchWrapper$1 = styled__default(material.Box)(_templateObject4$r || (_templateObject4$r = _taggedTemplateLiteralLoose(["\n && {\n margin-bottom: 24px;\n max-width: 400px;\n width: 100%;\n }\n"])));
19626
+ var TotalItemsText$1 = styled__default.div(_templateObject5$m || (_templateObject5$m = _taggedTemplateLiteralLoose(["\n font-size: 14px;\n font-weight: 500;\n color: #4b4b4b;\n margin-bottom: 24px;\n white-space: nowrap;\n"])));
19627
+ var DeleteButton$1 = styled__default.button(_templateObject6$k || (_templateObject6$k = _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"])));
19628
+ var PriceContainer$1 = styled__default.div(_templateObject7$g || (_templateObject7$g = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])));
19629
+ var DiscountPriceRow$1 = styled__default.div(_templateObject8$e || (_templateObject8$e = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n"])));
18824
19630
  var ProductName$3 = styled__default.div(_templateObject9$9 || (_templateObject9$9 = _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"])));
18825
- var ProductActionButton$1 = styled__default(material.Button)(_templateObject10$7 || (_templateObject10$7 = _taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])), function (_ref) {
19631
+ var ProductActionButton$1 = styled__default(material.Button)(_templateObject10$8 || (_templateObject10$8 = _taggedTemplateLiteralLoose(["\n && {\n background-color: ", ";\n color: #ffffff;\n border-radius: 10px;\n font-weight: 500;\n }\n"])), function (_ref) {
18826
19632
  var primaryColor = _ref.primaryColor;
18827
19633
  return primaryColor != null ? primaryColor : '#000000';
18828
19634
  });
@@ -18886,7 +19692,7 @@ var FavoriteItemsContent = function FavoriteItemsContent(_ref) {
18886
19692
  width: '100%',
18887
19693
  height: '100%'
18888
19694
  }
18889
- }, /*#__PURE__*/React__default.createElement(TopBar$1, {
19695
+ }, /*#__PURE__*/React__default.createElement(TopBar$2, {
18890
19696
  style: getStyleOverride$1(styleOverrides, 'topBar', 'TopBar')
18891
19697
  }, /*#__PURE__*/React__default.createElement(SearchWrapper$1, {
18892
19698
  style: getStyleOverride$1(styleOverrides, 'searchWrapper', 'SearchWrapper')
@@ -19167,6 +19973,812 @@ var ProductCard$1 = function ProductCard(_ref4) {
19167
19973
  }, "Out Of stock")));
19168
19974
  };
19169
19975
 
19976
+ var getFilters = function getFilters(_ref) {
19977
+ var apiEndPoint = _ref.apiEndPoint,
19978
+ token = _ref.token,
19979
+ queryParams = _ref.queryParams;
19980
+ try {
19981
+ return Promise.resolve(API({
19982
+ apiEndPoint: apiEndPoint,
19983
+ token: token,
19984
+ method: 'GET',
19985
+ queryParams: queryParams,
19986
+ url: "/ecommerce/product/filter-data",
19987
+ hideErrorMessage: true
19988
+ }));
19989
+ } catch (e) {
19990
+ return Promise.reject(e);
19991
+ }
19992
+ };
19993
+ var getBrandList = function getBrandList(_ref2) {
19994
+ var apiEndPoint = _ref2.apiEndPoint,
19995
+ token = _ref2.token,
19996
+ businessTypeId = _ref2.businessTypeId;
19997
+ try {
19998
+ return Promise.resolve(API({
19999
+ apiEndPoint: apiEndPoint,
20000
+ token: token,
20001
+ method: 'GET',
20002
+ queryParams: _extends({
20003
+ size: 999
20004
+ }, businessTypeId != null && {
20005
+ businessTypeId: businessTypeId
20006
+ }),
20007
+ url: "/ecommerce/brand/list",
20008
+ hideErrorMessage: true
20009
+ })).then(function (data) {
20010
+ return (data === null || data === void 0 ? void 0 : data.content) || [];
20011
+ });
20012
+ } catch (e) {
20013
+ return Promise.reject(e);
20014
+ }
20015
+ };
20016
+
20017
+ var _templateObject$_, _templateObject2$J, _templateObject3$z, _templateObject4$s, _templateObject5$n, _templateObject6$l, _templateObject7$h, _templateObject8$f, _templateObject9$a, _templateObject10$9, _templateObject11$7, _templateObject12$4, _templateObject13$4, _templateObject14$4, _templateObject15$4, _templateObject16$4, _templateObject17$4, _templateObject18$4, _templateObject19$3, _templateObject20$2, _templateObject21$2, _templateObject22$2, _templateObject23$2, _templateObject24$2, _templateObject25$2, _templateObject26$2, _templateObject27$2;
20018
+ var DEFAULT_PRIMARY$1 = '#424242';
20019
+ var primary = function primary(p) {
20020
+ var _p$theme;
20021
+ return (p === null || p === void 0 ? void 0 : (_p$theme = p.theme) === null || _p$theme === void 0 ? void 0 : _p$theme.dfPrimary) || DEFAULT_PRIMARY$1;
20022
+ };
20023
+ var tint = function tint(color, amount) {
20024
+ try {
20025
+ return styles.alpha(color, amount);
20026
+ } catch (e) {
20027
+ return "color-mix(in srgb, " + color + " " + Math.round(amount * 100) + "%, transparent)";
20028
+ }
20029
+ };
20030
+ var primaryTint = function primaryTint(amount) {
20031
+ return function (p) {
20032
+ return tint(primary(p), amount);
20033
+ };
20034
+ };
20035
+ var TEXT = '#1f2329';
20036
+ var MUTED = '#6b7280';
20037
+ var BORDER = '#e8eaee';
20038
+ var FiltersWrapper = styled__default.div(_templateObject$_ || (_templateObject$_ = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n box-sizing: border-box;\n background: #fff;\n border: 1px solid ", ";\n border-radius: 14px;\n box-shadow: 0 4px 18px rgba(17, 24, 39, 0.05);\n font-size: 14px;\n color: ", ";\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n /* Inside the mobile dialog the dialog itself is the card. */\n ", "\n"])), BORDER, TEXT, function (p) {
20039
+ return p.inDialog && styled.css(_templateObject2$J || (_templateObject2$J = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n min-height: 100%;\n border: none;\n border-radius: 0;\n box-shadow: none;\n ", " {\n flex: 1;\n }\n ", " {\n position: sticky;\n top: 0;\n z-index: 1;\n background: #fff;\n }\n ", " {\n border-radius: 0;\n padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));\n }\n ", " {\n border-radius: 0;\n }\n "])), SectionsArea, PanelHeader, ActionBar, LoadingOverlay);
20040
+ });
20041
+ var HeaderActions = styled__default.div(_templateObject3$z || (_templateObject3$z = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));
20042
+ var CloseButton$1 = styled__default.button(_templateObject4$s || (_templateObject4$s = _taggedTemplateLiteralLoose(["\n all: unset;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n border-radius: 50%;\n cursor: pointer;\n color: ", ";\n &:hover {\n background: ", ";\n color: ", ";\n }\n &:focus-visible {\n outline: 2px solid ", ";\n }\n"])), MUTED, primaryTint(0.08), primary, primaryTint(0.4));
20043
+ var MobileFilterButton = styled__default.button(_templateObject5$n || (_templateObject5$n = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n gap: 8px;\n height: 40px;\n padding: 0 16px;\n border: 1.5px solid\n ", ";\n border-radius: 20px;\n background: ", ";\n color: ", ";\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s ease, border-color 0.15s ease;\n &:hover {\n background: ", ";\n border-color: ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px ", ";\n }\n"])), function (p) {
20044
+ return p.active ? primary(p) : primaryTint(0.35)(p);
20045
+ }, function (p) {
20046
+ return p.active ? primaryTint(0.06)(p) : '#fff';
20047
+ }, primary, primaryTint(0.08), primary, primaryTint(0.3));
20048
+ var PanelHeader = styled__default.div(_templateObject6$l || (_templateObject6$l = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 16px 18px;\n border-bottom: 1px solid ", ";\n"])), BORDER);
20049
+ var PanelTitle = styled__default.div(_templateObject7$h || (_templateObject7$h = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 16px;\n font-weight: 700;\n color: ", ";\n svg {\n color: ", ";\n }\n"])), TEXT, primary);
20050
+ var CountBadge = styled__default.span(_templateObject8$f || (_templateObject8$f = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n border-radius: 10px;\n font-size: 11px;\n font-weight: 700;\n line-height: 1;\n ", "\n"])), function (p) {
20051
+ return p.soft ? styled.css(_templateObject9$a || (_templateObject9$a = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: ", ";\n "])), primaryTint(0.12), primary) : styled.css(_templateObject10$9 || (_templateObject10$9 = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: #fff;\n "])), primary);
20052
+ });
20053
+ var ClearAllButton = styled__default.button(_templateObject11$7 || (_templateObject11$7 = _taggedTemplateLiteralLoose(["\n all: unset;\n cursor: pointer;\n font-size: 13px;\n font-weight: 600;\n color: ", ";\n padding: 4px 6px;\n border-radius: 6px;\n &:hover {\n background: ", ";\n }\n &:focus-visible {\n outline: 2px solid ", ";\n }\n"])), primary, primaryTint(0.08), primaryTint(0.4));
20054
+ var SectionsArea = styled__default.div(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n padding: 0 18px;\n"])));
20055
+ var Section = styled__default.div(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n padding: 14px 0;\n border-bottom: 1px solid ", ";\n &:last-child {\n border-bottom: none;\n }\n"])), BORDER);
20056
+ var SectionHeader$1 = styled__default.button(_templateObject14$4 || (_templateObject14$4 = _taggedTemplateLiteralLoose(["\n all: unset;\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n cursor: pointer;\n font-size: 12.5px;\n font-weight: 700;\n letter-spacing: 0.6px;\n text-transform: uppercase;\n color: ", ";\n .title {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .chevron {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n border-radius: 50%;\n color: ", ";\n transition: background 0.15s ease, color 0.15s ease;\n svg {\n transition: transform 0.2s ease;\n transform: rotate(", ");\n }\n }\n &:hover .chevron {\n background: ", ";\n color: ", ";\n }\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 4px;\n border-radius: 4px;\n }\n"])), TEXT, MUTED, function (p) {
20057
+ return p.open ? '0deg' : '180deg';
20058
+ }, primaryTint(0.08), primary, primaryTint(0.4));
20059
+ var SectionBody = styled__default.div(_templateObject15$4 || (_templateObject15$4 = _taggedTemplateLiteralLoose(["\n margin-top: 12px;\n"])));
20060
+ var SearchBox = styled__default.div(_templateObject16$4 || (_templateObject16$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 8px;\n height: 36px;\n padding: 0 12px;\n margin-bottom: 10px;\n border: 1px solid ", ";\n border-radius: 18px;\n background: #f7f8fa;\n color: #9aa1ab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease,\n background 0.15s ease;\n &:focus-within {\n background: #fff;\n border-color: ", ";\n box-shadow: 0 0 0 3px ", ";\n color: ", ";\n }\n input {\n flex: 1;\n min-width: 0;\n border: none;\n outline: none;\n background: transparent;\n font-size: 13.5px;\n color: ", ";\n &::placeholder {\n color: #9aa1ab;\n }\n }\n"])), BORDER, primary, primaryTint(0.12), primary, TEXT);
20061
+ var OptionList = styled__default.div(_templateObject17$4 || (_templateObject17$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 2px;\n max-height: 252px;\n overflow-y: auto;\n margin: 0 -8px;\n padding: 0 2px;\n scrollbar-width: thin;\n scrollbar-color: #d5d9df transparent;\n &::-webkit-scrollbar {\n width: 6px;\n }\n &::-webkit-scrollbar-thumb {\n background: #d5d9df;\n border-radius: 3px;\n }\n"])));
20062
+ var OptionRow = styled__default.label(_templateObject18$4 || (_templateObject18$4 = _taggedTemplateLiteralLoose(["\n position: relative;\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 7px 8px;\n border-radius: 8px;\n cursor: pointer;\n user-select: none;\n color: ", ";\n font-weight: ", ";\n background: ", ";\n transition: background 0.15s ease;\n &:hover {\n background: ", ";\n }\n\n /* Native input kept for accessibility, visually hidden. */\n input {\n position: absolute;\n opacity: 0;\n width: 1px;\n height: 1px;\n margin: 0;\n pointer-events: none;\n }\n input:focus-visible + .control {\n box-shadow: 0 0 0 3px ", ";\n }\n\n .control {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border: 1.5px solid ", ";\n border-radius: ", ";\n background: ", ";\n color: #fff;\n transition: all 0.15s ease;\n }\n &:hover .control {\n border-color: ", ";\n }\n .dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: ", ";\n }\n\n .label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 14px;\n }\n"])), function (p) {
20063
+ return p.checked ? TEXT : '#3f4650';
20064
+ }, function (p) {
20065
+ return p.checked ? 600 : 400;
20066
+ }, function (p) {
20067
+ return p.checked ? primaryTint(0.06)(p) : 'transparent';
20068
+ }, primaryTint(0.08), primaryTint(0.25), function (p) {
20069
+ return p.checked ? primary(p) : '#c5cbd3';
20070
+ }, function (p) {
20071
+ return p.radio ? '50%' : '5px';
20072
+ }, function (p) {
20073
+ return p.checked && !p.radio ? primary(p) : '#fff';
20074
+ }, primary, primary);
20075
+ var EmptyText = styled__default.div(_templateObject19$3 || (_templateObject19$3 = _taggedTemplateLiteralLoose(["\n padding: 6px 8px;\n color: #9aa1ab;\n font-size: 13px;\n"])));
20076
+ var SliderWrapper = styled__default.div(_templateObject20$2 || (_templateObject20$2 = _taggedTemplateLiteralLoose(["\n padding: 4px 10px 0;\n"])));
20077
+ var PriceRow = styled__default.div(_templateObject21$2 || (_templateObject21$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 10px;\n margin-top: 4px;\n .dash {\n color: #9aa1ab;\n }\n"])));
20078
+ var PriceBox = styled__default.div(_templateObject22$2 || (_templateObject22$2 = _taggedTemplateLiteralLoose(["\n flex: 1;\n padding: 7px 10px;\n border: 1px solid ", ";\n border-radius: 8px;\n background: #f7f8fa;\n .caption {\n display: block;\n font-size: 11px;\n color: ", ";\n margin-bottom: 2px;\n }\n .amount {\n font-size: 14px;\n font-weight: 600;\n color: ", ";\n }\n"])), BORDER, MUTED, TEXT);
20079
+ var ActionBar = styled__default.div(_templateObject23$2 || (_templateObject23$2 = _taggedTemplateLiteralLoose(["\n position: sticky;\n bottom: 0;\n z-index: 1;\n display: flex;\n gap: 10px;\n padding: 14px 18px;\n background: #fff;\n border-top: 1px solid ", ";\n border-radius: 0 0 14px 14px;\n"])), BORDER);
20080
+ var BaseButton = styled__default.button(_templateObject24$2 || (_templateObject24$2 = _taggedTemplateLiteralLoose(["\n flex: 1;\n height: 42px;\n padding: 0 16px;\n border-radius: 10px;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s ease, box-shadow 0.15s ease,\n transform 0.05s ease;\n &:active:not(:disabled) {\n transform: translateY(1px);\n }\n &:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px ", ";\n }\n"])), primaryTint(0.3));
20081
+ var ResetButton = styled__default(BaseButton)(_templateObject25$2 || (_templateObject25$2 = _taggedTemplateLiteralLoose(["\n background: #fff;\n color: ", ";\n border: 1.5px solid ", ";\n &:hover:not(:disabled) {\n background: ", ";\n border-color: ", ";\n }\n"])), primary, primaryTint(0.35), primaryTint(0.06), primary);
20082
+ var ApplyButton = styled__default(BaseButton)(_templateObject26$2 || (_templateObject26$2 = _taggedTemplateLiteralLoose(["\n background: ", ";\n color: #fff;\n border: 1.5px solid ", ";\n box-shadow: 0 4px 12px ", ";\n &:hover:not(:disabled) {\n box-shadow: 0 6px 16px ", ";\n }\n"])), primary, primary, primaryTint(0.25), primaryTint(0.35));
20083
+ var LoadingOverlay = styled__default.div(_templateObject27$2 || (_templateObject27$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n inset: 0;\n z-index: 2;\n display: flex;\n justify-content: center;\n padding-top: 90px;\n border-radius: 14px;\n background: rgba(255, 255, 255, 0.55);\n backdrop-filter: blur(1px);\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity 0.2s ease;\n"])), function (p) {
20084
+ return p.visible ? 1 : 0;
20085
+ }, function (p) {
20086
+ return p.visible ? 'auto' : 'none';
20087
+ });
20088
+
20089
+ var _excluded$a = ["inStock"];
20090
+ var STOCK_OPTIONS = [{
20091
+ id: 'true',
20092
+ name: 'In Stock'
20093
+ }, {
20094
+ id: 'false',
20095
+ name: 'Out of Stock'
20096
+ }];
20097
+ var toSubmitPayload = function toSubmitPayload(_temp) {
20098
+ var _ref = _temp === void 0 ? {} : _temp,
20099
+ inStock = _ref.inStock,
20100
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
20101
+ var payload = {};
20102
+ Object.entries(rest || {}).forEach(function (_ref2) {
20103
+ var key = _ref2[0],
20104
+ value = _ref2[1];
20105
+ if (value !== '' && value != null) payload[key] = value;
20106
+ });
20107
+ if (inStock !== '') payload.inStock = inStock === 'true';
20108
+ return payload;
20109
+ };
20110
+ var INITIAL_FILTER_STATE = {
20111
+ inStock: '',
20112
+ brandIdList: '',
20113
+ tagIds: '',
20114
+ variantLabelId: '',
20115
+ variantValueIds: '',
20116
+ minPrice: '',
20117
+ maxPrice: ''
20118
+ };
20119
+ var toFilterState = function toFilterState(initialFilters) {
20120
+ var _toList;
20121
+ var state = _extends({}, INITIAL_FILTER_STATE);
20122
+ if (!initialFilters) return state;
20123
+ var asList = function asList(value) {
20124
+ return Array.isArray(value) ? value.join(',') : value != null ? String(value) : '';
20125
+ };
20126
+ var asNumber = function asNumber(value) {
20127
+ var num = Number(value);
20128
+ return value === '' || value == null || !Number.isFinite(num) ? '' : num;
20129
+ };
20130
+ ['brandIdList', 'tagIds', 'variantValueIds'].forEach(function (key) {
20131
+ state[key] = asList(initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters[key]);
20132
+ });
20133
+ state.variantLabelId = ((_toList = toList(asList(initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.variantLabelId))) === null || _toList === void 0 ? void 0 : _toList[0]) || '';
20134
+ state.minPrice = asNumber(initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.minPrice);
20135
+ state.maxPrice = asNumber(initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.maxPrice);
20136
+ var inStock = initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.inStock;
20137
+ if (inStock === true || inStock === 'true') state.inStock = 'true';
20138
+ if (inStock === false || inStock === 'false') state.inStock = 'false';
20139
+ return state;
20140
+ };
20141
+ var SINGLE_SELECT_KEYS = ['variantLabelId', 'inStock'];
20142
+ var toList = function toList(value) {
20143
+ return value ? String(value).split(',').filter(Boolean) : [];
20144
+ };
20145
+ var toggleInList = function toggleInList(value, id) {
20146
+ if (value === void 0) {
20147
+ value = '';
20148
+ }
20149
+ var list = toList(value);
20150
+ var key = String(id);
20151
+ var next = list.includes(key) ? list.filter(function (item) {
20152
+ return item !== key;
20153
+ }) : [].concat(list, [key]);
20154
+ return next.join(',');
20155
+ };
20156
+ var countActiveFilters = function countActiveFilters(state) {
20157
+ var _state$minPrice, _state$maxPrice;
20158
+ return (state !== null && state !== void 0 && state.inStock ? 1 : 0) + toList(state === null || state === void 0 ? void 0 : state.brandIdList).length + toList(state === null || state === void 0 ? void 0 : state.tagIds).length + toList(state === null || state === void 0 ? void 0 : state.variantValueIds).length + (((_state$minPrice = state === null || state === void 0 ? void 0 : state.minPrice) != null ? _state$minPrice : '') !== '' || ((_state$maxPrice = state === null || state === void 0 ? void 0 : state.maxPrice) != null ? _state$maxPrice : '') !== '' ? 1 : 0);
20159
+ };
20160
+ var asArray = function asArray(value) {
20161
+ return Array.isArray(value) ? value.filter(Boolean) : [];
20162
+ };
20163
+ var ChevronIcon = function ChevronIcon() {
20164
+ return /*#__PURE__*/React__default.createElement("svg", {
20165
+ width: "14",
20166
+ height: "14",
20167
+ viewBox: "0 0 24 24",
20168
+ fill: "none"
20169
+ }, /*#__PURE__*/React__default.createElement("path", {
20170
+ d: "M6 15l6-6 6 6",
20171
+ stroke: "currentColor",
20172
+ strokeWidth: "2.2",
20173
+ strokeLinecap: "round",
20174
+ strokeLinejoin: "round"
20175
+ }));
20176
+ };
20177
+ var SearchIcon = function SearchIcon() {
20178
+ return /*#__PURE__*/React__default.createElement("svg", {
20179
+ width: "15",
20180
+ height: "15",
20181
+ viewBox: "0 0 24 24",
20182
+ fill: "none"
20183
+ }, /*#__PURE__*/React__default.createElement("circle", {
20184
+ cx: "11",
20185
+ cy: "11",
20186
+ r: "7",
20187
+ stroke: "currentColor",
20188
+ strokeWidth: "2"
20189
+ }), /*#__PURE__*/React__default.createElement("path", {
20190
+ d: "M20 20l-3.5-3.5",
20191
+ stroke: "currentColor",
20192
+ strokeWidth: "2",
20193
+ strokeLinecap: "round"
20194
+ }));
20195
+ };
20196
+ var FilterIcon = function FilterIcon() {
20197
+ return /*#__PURE__*/React__default.createElement("svg", {
20198
+ width: "18",
20199
+ height: "18",
20200
+ viewBox: "0 0 24 24",
20201
+ fill: "none"
20202
+ }, /*#__PURE__*/React__default.createElement("path", {
20203
+ d: "M4 6h16M7 12h10M10 18h4",
20204
+ stroke: "currentColor",
20205
+ strokeWidth: "2.2",
20206
+ strokeLinecap: "round"
20207
+ }));
20208
+ };
20209
+ var CloseIcon = function CloseIcon() {
20210
+ return /*#__PURE__*/React__default.createElement("svg", {
20211
+ width: "18",
20212
+ height: "18",
20213
+ viewBox: "0 0 24 24",
20214
+ fill: "none"
20215
+ }, /*#__PURE__*/React__default.createElement("path", {
20216
+ d: "M6 6l12 12M18 6L6 18",
20217
+ stroke: "currentColor",
20218
+ strokeWidth: "2.2",
20219
+ strokeLinecap: "round"
20220
+ }));
20221
+ };
20222
+ var CheckIcon = function CheckIcon() {
20223
+ return /*#__PURE__*/React__default.createElement("svg", {
20224
+ width: "12",
20225
+ height: "12",
20226
+ viewBox: "0 0 24 24",
20227
+ fill: "none"
20228
+ }, /*#__PURE__*/React__default.createElement("path", {
20229
+ d: "M5 12.5l4.5 4.5L19 7.5",
20230
+ stroke: "currentColor",
20231
+ strokeWidth: "3",
20232
+ strokeLinecap: "round",
20233
+ strokeLinejoin: "round"
20234
+ }));
20235
+ };
20236
+ var FilterSection = function FilterSection(_ref3) {
20237
+ var title = _ref3.title,
20238
+ count = _ref3.count,
20239
+ children = _ref3.children,
20240
+ _ref3$defaultOpen = _ref3.defaultOpen,
20241
+ defaultOpen = _ref3$defaultOpen === void 0 ? true : _ref3$defaultOpen;
20242
+ var _useState = React.useState(defaultOpen),
20243
+ open = _useState[0],
20244
+ setOpen = _useState[1];
20245
+ return /*#__PURE__*/React__default.createElement(Section, null, /*#__PURE__*/React__default.createElement(SectionHeader$1, {
20246
+ type: "button",
20247
+ open: open,
20248
+ onClick: function onClick() {
20249
+ return setOpen(function (prev) {
20250
+ return !prev;
20251
+ });
20252
+ },
20253
+ "aria-expanded": open
20254
+ }, /*#__PURE__*/React__default.createElement("span", {
20255
+ className: "title"
20256
+ }, title), count > 0 && /*#__PURE__*/React__default.createElement(CountBadge, {
20257
+ soft: true
20258
+ }, count), /*#__PURE__*/React__default.createElement("span", {
20259
+ className: "chevron"
20260
+ }, /*#__PURE__*/React__default.createElement(ChevronIcon, null))), open && /*#__PURE__*/React__default.createElement(SectionBody, null, children));
20261
+ };
20262
+ var SearchInput = function SearchInput(_ref4) {
20263
+ var value = _ref4.value,
20264
+ _onChange = _ref4.onChange,
20265
+ placeholder = _ref4.placeholder;
20266
+ return /*#__PURE__*/React__default.createElement(SearchBox, null, /*#__PURE__*/React__default.createElement(SearchIcon, null), /*#__PURE__*/React__default.createElement("input", {
20267
+ type: "text",
20268
+ placeholder: placeholder || 'Search',
20269
+ value: value,
20270
+ onChange: function onChange(e) {
20271
+ var _e$target$value, _e$target;
20272
+ return _onChange === null || _onChange === void 0 ? void 0 : _onChange((_e$target$value = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) != null ? _e$target$value : '');
20273
+ }
20274
+ }));
20275
+ };
20276
+ var filterByName = function filterByName(items, search) {
20277
+ return search ? items.filter(function (item) {
20278
+ var _item$name;
20279
+ return String((_item$name = item === null || item === void 0 ? void 0 : item.name) != null ? _item$name : '').toLowerCase().includes(String(search).toLowerCase());
20280
+ }) : items;
20281
+ };
20282
+ var OptionFilter = function OptionFilter(_ref5) {
20283
+ var title = _ref5.title,
20284
+ rawItems = _ref5.items,
20285
+ selected = _ref5.selected,
20286
+ onToggle = _ref5.onToggle,
20287
+ searchable = _ref5.searchable,
20288
+ single = _ref5.single;
20289
+ var _useState2 = React.useState(''),
20290
+ search = _useState2[0],
20291
+ setSearch = _useState2[1];
20292
+ var items = asArray(rawItems).filter(function (item) {
20293
+ return (item === null || item === void 0 ? void 0 : item.id) != null;
20294
+ });
20295
+ if (!items.length) return null;
20296
+ var selectedList = toList(selected);
20297
+ var visibleItems = filterByName(items, search);
20298
+ var showSearch = searchable && items.length > 6;
20299
+ return /*#__PURE__*/React__default.createElement(FilterSection, {
20300
+ title: title,
20301
+ count: selectedList.length
20302
+ }, showSearch && /*#__PURE__*/React__default.createElement(SearchInput, {
20303
+ value: search,
20304
+ onChange: setSearch,
20305
+ placeholder: "Search " + String(title != null ? title : '').toLowerCase()
20306
+ }), /*#__PURE__*/React__default.createElement(OptionList, {
20307
+ role: single ? 'radiogroup' : 'group'
20308
+ }, visibleItems.map(function (item) {
20309
+ var _item$name2, _item$name3;
20310
+ var checked = selectedList.includes(String(item === null || item === void 0 ? void 0 : item.id));
20311
+ return /*#__PURE__*/React__default.createElement(OptionRow, {
20312
+ key: item === null || item === void 0 ? void 0 : item.id,
20313
+ checked: checked,
20314
+ radio: single
20315
+ }, /*#__PURE__*/React__default.createElement("input", {
20316
+ type: "checkbox",
20317
+ role: single ? 'radio' : undefined,
20318
+ checked: checked,
20319
+ onChange: function onChange() {
20320
+ return onToggle === null || onToggle === void 0 ? void 0 : onToggle(item === null || item === void 0 ? void 0 : item.id);
20321
+ }
20322
+ }), /*#__PURE__*/React__default.createElement("span", {
20323
+ className: "control",
20324
+ "aria-hidden": "true"
20325
+ }, checked && (single ? /*#__PURE__*/React__default.createElement("span", {
20326
+ className: "dot"
20327
+ }) : /*#__PURE__*/React__default.createElement(CheckIcon, null))), /*#__PURE__*/React__default.createElement("span", {
20328
+ className: "label",
20329
+ title: (_item$name2 = item === null || item === void 0 ? void 0 : item.name) != null ? _item$name2 : ''
20330
+ }, (_item$name3 = item === null || item === void 0 ? void 0 : item.name) != null ? _item$name3 : ''));
20331
+ }), !visibleItems.length && /*#__PURE__*/React__default.createElement(EmptyText, null, "No results found")));
20332
+ };
20333
+ var formatPrice$1 = function formatPrice(value) {
20334
+ return "$" + Number(value || 0).toLocaleString(undefined, {
20335
+ maximumFractionDigits: 2
20336
+ });
20337
+ };
20338
+ var PriceFilter = function PriceFilter(_ref6) {
20339
+ var min = _ref6.min,
20340
+ max = _ref6.max,
20341
+ selectedMin = _ref6.selectedMin,
20342
+ selectedMax = _ref6.selectedMax,
20343
+ onCommit = _ref6.onCommit,
20344
+ primaryColor = _ref6.primaryColor;
20345
+ var _useState3 = React.useState([selectedMin === '' ? min : selectedMin, selectedMax === '' ? max : selectedMax]),
20346
+ range = _useState3[0],
20347
+ setRange = _useState3[1];
20348
+ var hasRange = Number.isFinite(min) && Number.isFinite(max) && max > min;
20349
+ if (!hasRange) return null;
20350
+ var isSet = selectedMin !== '' || selectedMax !== '';
20351
+ return /*#__PURE__*/React__default.createElement(FilterSection, {
20352
+ title: "Price",
20353
+ count: isSet ? 1 : 0
20354
+ }, /*#__PURE__*/React__default.createElement(SliderWrapper, null, /*#__PURE__*/React__default.createElement(material.Slider, {
20355
+ value: range,
20356
+ min: min,
20357
+ max: max,
20358
+ step: max - min > 1000 ? 10 : 1,
20359
+ onChange: function onChange(_, value) {
20360
+ return setRange(value);
20361
+ },
20362
+ onChangeCommitted: function onChangeCommitted(_, value) {
20363
+ return onCommit === null || onCommit === void 0 ? void 0 : onCommit(value);
20364
+ },
20365
+ valueLabelDisplay: "auto",
20366
+ valueLabelFormat: formatPrice$1,
20367
+ disableSwap: true,
20368
+ getAriaLabel: function getAriaLabel(index) {
20369
+ return index === 0 ? 'Minimum price' : 'Maximum price';
20370
+ },
20371
+ sx: {
20372
+ color: primaryColor,
20373
+ height: 4,
20374
+ '& .MuiSlider-rail': {
20375
+ backgroundColor: '#e5e7eb',
20376
+ opacity: 1
20377
+ },
20378
+ '& .MuiSlider-track': {
20379
+ border: 'none'
20380
+ },
20381
+ '& .MuiSlider-thumb': {
20382
+ width: 18,
20383
+ height: 18,
20384
+ backgroundColor: '#fff',
20385
+ border: "2px solid " + primaryColor,
20386
+ '&:hover, &.Mui-focusVisible, &.Mui-active': {
20387
+ boxShadow: "0 0 0 6px " + tint(primaryColor, 0.16)
20388
+ }
20389
+ },
20390
+ '& .MuiSlider-valueLabel': {
20391
+ backgroundColor: primaryColor,
20392
+ borderRadius: '6px',
20393
+ fontSize: 12,
20394
+ fontWeight: 600
20395
+ }
20396
+ }
20397
+ })), /*#__PURE__*/React__default.createElement(PriceRow, null, /*#__PURE__*/React__default.createElement(PriceBox, null, /*#__PURE__*/React__default.createElement("span", {
20398
+ className: "caption"
20399
+ }, "Min"), /*#__PURE__*/React__default.createElement("span", {
20400
+ className: "amount"
20401
+ }, formatPrice$1(range === null || range === void 0 ? void 0 : range[0]))), /*#__PURE__*/React__default.createElement("span", {
20402
+ className: "dash"
20403
+ }, "\u2013"), /*#__PURE__*/React__default.createElement(PriceBox, null, /*#__PURE__*/React__default.createElement("span", {
20404
+ className: "caption"
20405
+ }, "Max"), /*#__PURE__*/React__default.createElement("span", {
20406
+ className: "amount"
20407
+ }, formatPrice$1(range === null || range === void 0 ? void 0 : range[1])))));
20408
+ };
20409
+ var normalizeVariantValues = function normalizeVariantValues(variantValues) {
20410
+ return asArray(variantValues).map(function (item) {
20411
+ var _ref7, _item$value, _item$labelId;
20412
+ return {
20413
+ id: item === null || item === void 0 ? void 0 : item.id,
20414
+ name: String((_ref7 = (_item$value = item === null || item === void 0 ? void 0 : item.value) != null ? _item$value : item === null || item === void 0 ? void 0 : item.name) != null ? _ref7 : '').trim(),
20415
+ variantLabelId: (_item$labelId = item === null || item === void 0 ? void 0 : item.labelId) != null ? _item$labelId : item === null || item === void 0 ? void 0 : item.variantLabelId
20416
+ };
20417
+ });
20418
+ };
20419
+ var groupVariantValues = function groupVariantValues(variantLabels, rawVariantValues) {
20420
+ var variantValues = normalizeVariantValues(rawVariantValues);
20421
+ var groups = asArray(variantLabels).map(function (label) {
20422
+ return {
20423
+ id: label === null || label === void 0 ? void 0 : label.id,
20424
+ name: label === null || label === void 0 ? void 0 : label.name,
20425
+ values: variantValues.filter(function (value) {
20426
+ return String(value === null || value === void 0 ? void 0 : value.variantLabelId) === String(label === null || label === void 0 ? void 0 : label.id);
20427
+ })
20428
+ };
20429
+ }).filter(function (group) {
20430
+ var _group$values;
20431
+ return group === null || group === void 0 ? void 0 : (_group$values = group.values) === null || _group$values === void 0 ? void 0 : _group$values.length;
20432
+ });
20433
+ var groupedIds = new Set(groups.flatMap(function (group) {
20434
+ return ((group === null || group === void 0 ? void 0 : group.values) || []).map(function (value) {
20435
+ return String(value === null || value === void 0 ? void 0 : value.id);
20436
+ });
20437
+ }));
20438
+ var ungrouped = variantValues.filter(function (value) {
20439
+ return !groupedIds.has(String(value === null || value === void 0 ? void 0 : value.id));
20440
+ });
20441
+ if (ungrouped.length) {
20442
+ groups.push({
20443
+ id: 'ungrouped',
20444
+ name: 'Variant Values',
20445
+ values: ungrouped
20446
+ });
20447
+ }
20448
+ return groups;
20449
+ };
20450
+ var FiltersContent = function FiltersContent(_ref8) {
20451
+ var _filterState$minPrice, _filterState$maxPrice;
20452
+ var data = _ref8.data,
20453
+ _ref8$brands = _ref8.brands,
20454
+ brands = _ref8$brands === void 0 ? [] : _ref8$brands,
20455
+ filterState = _ref8.filterState,
20456
+ primaryColor = _ref8.primaryColor,
20457
+ toggleFilter = _ref8.toggleFilter,
20458
+ updatePrice = _ref8.updatePrice,
20459
+ loading = _ref8.loading,
20460
+ resetCount = _ref8.resetCount,
20461
+ onApply = _ref8.onApply,
20462
+ onReset = _ref8.onReset,
20463
+ inDialog = _ref8.inDialog,
20464
+ onClose = _ref8.onClose;
20465
+ var productTags = asArray(data === null || data === void 0 ? void 0 : data.productTags);
20466
+ var variantLabels = asArray(data === null || data === void 0 ? void 0 : data.variantLabels);
20467
+ var minPrice = data === null || data === void 0 ? void 0 : data.minPrice;
20468
+ var maxPrice = data === null || data === void 0 ? void 0 : data.maxPrice;
20469
+ var variantGroups = groupVariantValues(variantLabels, data === null || data === void 0 ? void 0 : data.variantValues);
20470
+ var activeCount = countActiveFilters(filterState);
20471
+ return /*#__PURE__*/React__default.createElement(FiltersWrapper, {
20472
+ "aria-busy": loading,
20473
+ inDialog: inDialog
20474
+ }, /*#__PURE__*/React__default.createElement(LoadingOverlay, {
20475
+ visible: loading
20476
+ }, loading && /*#__PURE__*/React__default.createElement(material.CircularProgress, {
20477
+ size: 28,
20478
+ sx: {
20479
+ color: primaryColor
20480
+ }
20481
+ })), /*#__PURE__*/React__default.createElement(PanelHeader, null, /*#__PURE__*/React__default.createElement(PanelTitle, {
20482
+ id: inDialog ? 'dynamic-filters-title' : undefined
20483
+ }, /*#__PURE__*/React__default.createElement(FilterIcon, null), "Filters", activeCount > 0 && /*#__PURE__*/React__default.createElement(CountBadge, null, activeCount)), /*#__PURE__*/React__default.createElement(HeaderActions, null, activeCount > 0 && /*#__PURE__*/React__default.createElement(ClearAllButton, {
20484
+ type: "button",
20485
+ onClick: onReset,
20486
+ disabled: loading
20487
+ }, "Clear all"), inDialog && /*#__PURE__*/React__default.createElement(CloseButton$1, {
20488
+ type: "button",
20489
+ onClick: function onClick() {
20490
+ return onClose === null || onClose === void 0 ? void 0 : onClose();
20491
+ },
20492
+ "aria-label": "Close filters"
20493
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, null)))), /*#__PURE__*/React__default.createElement(SectionsArea, null, /*#__PURE__*/React__default.createElement(OptionFilter, {
20494
+ title: "Availability",
20495
+ items: STOCK_OPTIONS,
20496
+ selected: filterState === null || filterState === void 0 ? void 0 : filterState.inStock,
20497
+ onToggle: function onToggle(id) {
20498
+ return toggleFilter('inStock', id);
20499
+ },
20500
+ single: true
20501
+ }), /*#__PURE__*/React__default.createElement(OptionFilter, {
20502
+ title: "Brands",
20503
+ items: brands,
20504
+ selected: filterState === null || filterState === void 0 ? void 0 : filterState.brandIdList,
20505
+ onToggle: function onToggle(id) {
20506
+ return toggleFilter('brandIdList', id);
20507
+ },
20508
+ searchable: true
20509
+ }), /*#__PURE__*/React__default.createElement(OptionFilter, {
20510
+ title: "Product Tags",
20511
+ items: productTags,
20512
+ selected: filterState === null || filterState === void 0 ? void 0 : filterState.tagIds,
20513
+ onToggle: function onToggle(id) {
20514
+ return toggleFilter('tagIds', id);
20515
+ },
20516
+ searchable: true
20517
+ }), /*#__PURE__*/React__default.createElement(OptionFilter, {
20518
+ title: "Variants",
20519
+ items: variantLabels,
20520
+ selected: filterState === null || filterState === void 0 ? void 0 : filterState.variantLabelId,
20521
+ onToggle: function onToggle(id) {
20522
+ return toggleFilter('variantLabelId', id);
20523
+ },
20524
+ searchable: true,
20525
+ single: true
20526
+ }), variantGroups.map(function (group) {
20527
+ return /*#__PURE__*/React__default.createElement(OptionFilter, {
20528
+ key: group === null || group === void 0 ? void 0 : group.id,
20529
+ title: group === null || group === void 0 ? void 0 : group.name,
20530
+ items: group === null || group === void 0 ? void 0 : group.values,
20531
+ selected: filterState === null || filterState === void 0 ? void 0 : filterState.variantValueIds,
20532
+ onToggle: function onToggle(id) {
20533
+ return toggleFilter('variantValueIds', id);
20534
+ },
20535
+ searchable: true
20536
+ });
20537
+ }), /*#__PURE__*/React__default.createElement(PriceFilter, {
20538
+ key: minPrice + "-" + maxPrice + "-" + resetCount,
20539
+ min: minPrice,
20540
+ max: maxPrice,
20541
+ selectedMin: (_filterState$minPrice = filterState === null || filterState === void 0 ? void 0 : filterState.minPrice) != null ? _filterState$minPrice : '',
20542
+ selectedMax: (_filterState$maxPrice = filterState === null || filterState === void 0 ? void 0 : filterState.maxPrice) != null ? _filterState$maxPrice : '',
20543
+ onCommit: updatePrice,
20544
+ primaryColor: primaryColor
20545
+ })), /*#__PURE__*/React__default.createElement(ActionBar, null, /*#__PURE__*/React__default.createElement(ResetButton, {
20546
+ type: "button",
20547
+ onClick: onReset,
20548
+ disabled: loading
20549
+ }, "Reset"), /*#__PURE__*/React__default.createElement(ApplyButton, {
20550
+ type: "button",
20551
+ onClick: onApply,
20552
+ disabled: loading
20553
+ }, "Apply", activeCount > 0 ? " (" + activeCount + ")" : '')));
20554
+ };
20555
+ var DynamicFilters = function DynamicFilters(_ref9) {
20556
+ var token = _ref9.token,
20557
+ apiEndPoint = _ref9.apiEndPoint,
20558
+ primaryColor = _ref9.primaryColor,
20559
+ onFilterSubmit = _ref9.onFilterSubmit,
20560
+ brandId = _ref9.brandId,
20561
+ categoryId = _ref9.categoryId,
20562
+ businessTypeId = _ref9.businessTypeId,
20563
+ initialFilters = _ref9.initialFilters,
20564
+ _ref9$mobileBreakpoin = _ref9.mobileBreakpoint,
20565
+ mobileBreakpoint = _ref9$mobileBreakpoin === void 0 ? 1280 : _ref9$mobileBreakpoin;
20566
+ var color = primaryColor || DEFAULT_PRIMARY$1;
20567
+ var breakpoint = Number(mobileBreakpoint) || 1280;
20568
+ var isMobile = material.useMediaQuery("(max-width:" + (breakpoint - 0.02) + "px)", {
20569
+ noSsr: true
20570
+ });
20571
+ var isPhone = material.useMediaQuery('(max-width:599.98px)', {
20572
+ noSsr: true
20573
+ });
20574
+ var _useState4 = React.useState(false),
20575
+ dialogOpen = _useState4[0],
20576
+ setDialogOpen = _useState4[1];
20577
+ var _useState5 = React.useState([]),
20578
+ brands = _useState5[0],
20579
+ setBrands = _useState5[1];
20580
+ React.useEffect(function () {
20581
+ var cancelled = false;
20582
+ (function () {
20583
+ try {
20584
+ var _temp2 = _catch(function () {
20585
+ return Promise.resolve(getBrandList({
20586
+ apiEndPoint: apiEndPoint,
20587
+ token: token,
20588
+ businessTypeId: businessTypeId
20589
+ })).then(function (list) {
20590
+ if (!cancelled) setBrands(asArray(list));
20591
+ });
20592
+ }, function () {
20593
+ if (!cancelled) setBrands([]);
20594
+ });
20595
+ return _temp2 && _temp2.then ? _temp2.then(function () {}) : void 0;
20596
+ } catch (e) {
20597
+ Promise.reject(e);
20598
+ }
20599
+ })();
20600
+ return function () {
20601
+ cancelled = true;
20602
+ };
20603
+ }, [apiEndPoint, token, businessTypeId]);
20604
+ var _useState6 = React.useState(function () {
20605
+ return toFilterState(initialFilters);
20606
+ }),
20607
+ filterState = _useState6[0],
20608
+ setFilterState = _useState6[1];
20609
+ var _useState7 = React.useState(function () {
20610
+ return toFilterState(initialFilters);
20611
+ }),
20612
+ appliedState = _useState7[0],
20613
+ setAppliedState = _useState7[1];
20614
+ var _useState8 = React.useState(null),
20615
+ data = _useState8[0],
20616
+ setData = _useState8[1];
20617
+ var _useState9 = React.useState('loading'),
20618
+ status = _useState9[0],
20619
+ setStatus = _useState9[1];
20620
+ var _useState10 = React.useState(0),
20621
+ resetCount = _useState10[0],
20622
+ setResetCount = _useState10[1];
20623
+ var initialFiltersKey = JSON.stringify(toFilterState(initialFilters));
20624
+ var lastInitialKey = React.useRef(initialFiltersKey);
20625
+ React.useEffect(function () {
20626
+ if ((lastInitialKey === null || lastInitialKey === void 0 ? void 0 : lastInitialKey.current) === initialFiltersKey) return;
20627
+ lastInitialKey.current = initialFiltersKey;
20628
+ var restored = toFilterState(initialFilters);
20629
+ setFilterState(restored);
20630
+ setAppliedState(restored);
20631
+ setResetCount(function (count) {
20632
+ return count + 1;
20633
+ });
20634
+ }, [initialFiltersKey]);
20635
+ var filterStateRef = React.useRef(filterState);
20636
+ filterStateRef.current = filterState;
20637
+ var handleApply = function handleApply() {
20638
+ var current = filterState || INITIAL_FILTER_STATE;
20639
+ setAppliedState(current);
20640
+ setDialogOpen(false);
20641
+ onFilterSubmit === null || onFilterSubmit === void 0 ? void 0 : onFilterSubmit(toSubmitPayload(current));
20642
+ };
20643
+ var handleReset = function handleReset() {
20644
+ setFilterState(INITIAL_FILTER_STATE);
20645
+ setAppliedState(INITIAL_FILTER_STATE);
20646
+ setResetCount(function (count) {
20647
+ return count + 1;
20648
+ });
20649
+ setDialogOpen(false);
20650
+ onFilterSubmit === null || onFilterSubmit === void 0 ? void 0 : onFilterSubmit(toSubmitPayload(INITIAL_FILTER_STATE));
20651
+ };
20652
+ var handleDialogDismiss = function handleDialogDismiss() {
20653
+ setDialogOpen(false);
20654
+ var applied = appliedState || INITIAL_FILTER_STATE;
20655
+ if (JSON.stringify(filterState != null ? filterState : {}) !== JSON.stringify(applied)) {
20656
+ setFilterState(applied);
20657
+ setResetCount(function (count) {
20658
+ return count + 1;
20659
+ });
20660
+ }
20661
+ };
20662
+ React.useEffect(function () {
20663
+ if (!isMobile && dialogOpen) setDialogOpen(false);
20664
+ }, [isMobile, dialogOpen]);
20665
+ var toggleFilter = function toggleFilter(key, id) {
20666
+ var _extends2;
20667
+ if (id == null) return;
20668
+ var isSingle = SINGLE_SELECT_KEYS.includes(key);
20669
+ var nextValue = isSingle ? String(filterState === null || filterState === void 0 ? void 0 : filterState[key]) === String(id) ? '' : String(id) : toggleInList(filterState === null || filterState === void 0 ? void 0 : filterState[key], id);
20670
+ setFilterState(_extends({}, filterState || INITIAL_FILTER_STATE, (_extends2 = {}, _extends2[key] = nextValue, _extends2)));
20671
+ };
20672
+ var updatePrice = function updatePrice(range) {
20673
+ if (!Array.isArray(range)) return;
20674
+ var min = range[0],
20675
+ max = range[1];
20676
+ setFilterState(_extends({}, filterState || INITIAL_FILTER_STATE, {
20677
+ minPrice: min != null ? min : '',
20678
+ maxPrice: max != null ? max : ''
20679
+ }));
20680
+ };
20681
+ var variantLabelId = filterState === null || filterState === void 0 ? void 0 : filterState.variantLabelId;
20682
+ React.useEffect(function () {
20683
+ var cancelled = false;
20684
+ var queryParams = _extends({}, categoryId != null && {
20685
+ categoryId: categoryId
20686
+ }, brandId != null && {
20687
+ brandId: brandId
20688
+ }, variantLabelId && {
20689
+ variantLabelId: variantLabelId
20690
+ });
20691
+ (function () {
20692
+ try {
20693
+ return _catch(function () {
20694
+ setStatus('loading');
20695
+ return Promise.resolve(getFilters({
20696
+ apiEndPoint: apiEndPoint,
20697
+ token: token,
20698
+ queryParams: queryParams
20699
+ })).then(function (result) {
20700
+ var _current$variantValue;
20701
+ if (cancelled) return;
20702
+ setData(result || {});
20703
+ setStatus('success');
20704
+ var current = filterStateRef.current || INITIAL_FILTER_STATE;
20705
+ var availableIds = new Set(asArray(result === null || result === void 0 ? void 0 : result.variantValues).map(function (value) {
20706
+ return String(value === null || value === void 0 ? void 0 : value.id);
20707
+ }));
20708
+ var keptIds = toList(current === null || current === void 0 ? void 0 : current.variantValueIds).filter(function (id) {
20709
+ return availableIds.has(id);
20710
+ }).join(',');
20711
+ if (keptIds !== ((_current$variantValue = current === null || current === void 0 ? void 0 : current.variantValueIds) != null ? _current$variantValue : '')) {
20712
+ setFilterState(_extends({}, current, {
20713
+ variantValueIds: keptIds
20714
+ }));
20715
+ }
20716
+ });
20717
+ }, function () {
20718
+ if (!cancelled) setStatus('error');
20719
+ });
20720
+ } catch (e) {
20721
+ Promise.reject(e);
20722
+ }
20723
+ })();
20724
+ return function () {
20725
+ cancelled = true;
20726
+ };
20727
+ }, [apiEndPoint, token, categoryId, brandId, variantLabelId]);
20728
+ var renderPanel = function renderPanel(inDialog) {
20729
+ if (!data) {
20730
+ if (status === 'error') return /*#__PURE__*/React__default.createElement(EmptyText, null, "Unable to load filters");
20731
+ return /*#__PURE__*/React__default.createElement(Loader, {
20732
+ skeleton: 300,
20733
+ height: 300
20734
+ });
20735
+ }
20736
+ return /*#__PURE__*/React__default.createElement(FiltersContent, {
20737
+ data: data,
20738
+ brands: brandId != null ? [] : brands,
20739
+ filterState: filterState,
20740
+ primaryColor: color,
20741
+ toggleFilter: toggleFilter,
20742
+ updatePrice: updatePrice,
20743
+ loading: status === 'loading',
20744
+ resetCount: resetCount,
20745
+ onApply: handleApply,
20746
+ onReset: handleReset,
20747
+ inDialog: inDialog,
20748
+ onClose: handleDialogDismiss
20749
+ });
20750
+ };
20751
+ var appliedCount = countActiveFilters(appliedState);
20752
+ return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
20753
+ theme: {
20754
+ dfPrimary: color
20755
+ }
20756
+ }, isMobile ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MobileFilterButton, {
20757
+ type: "button",
20758
+ active: appliedCount > 0,
20759
+ onClick: function onClick() {
20760
+ return setDialogOpen(true);
20761
+ },
20762
+ "aria-haspopup": "dialog",
20763
+ "aria-label": appliedCount > 0 ? "Filters, " + appliedCount + " applied" : 'Filters'
20764
+ }, /*#__PURE__*/React__default.createElement(FilterIcon, null), "Filters", appliedCount > 0 && /*#__PURE__*/React__default.createElement(CountBadge, null, appliedCount)), /*#__PURE__*/React__default.createElement(material.Dialog, {
20765
+ open: dialogOpen,
20766
+ onClose: handleDialogDismiss,
20767
+ fullScreen: isPhone,
20768
+ fullWidth: true,
20769
+ maxWidth: "xs",
20770
+ scroll: "paper",
20771
+ "aria-labelledby": "dynamic-filters-title",
20772
+ PaperProps: {
20773
+ sx: {
20774
+ borderRadius: isPhone ? 0 : '14px',
20775
+ overflowY: 'auto',
20776
+ maxHeight: isPhone ? '100%' : 'calc(100% - 64px)'
20777
+ }
20778
+ }
20779
+ }, renderPanel(true))) : renderPanel(false));
20780
+ };
20781
+
19170
20782
  exports.APIStaticPage = APIStaticPage;
19171
20783
  exports.AccountDetails = AccountDetails;
19172
20784
  exports.BrandList = BrandList;
@@ -19176,6 +20788,7 @@ exports.CartDrawer = CartDrawer;
19176
20788
  exports.CartPageComponent = CartPageComponent;
19177
20789
  exports.CheckoutPageComponent = CheckoutPageComponent;
19178
20790
  exports.ContactUsForm = ContactUsForm;
20791
+ exports.DynamicFilters = DynamicFilters;
19179
20792
  exports.FavoriteItems = FavoriteItemsComponent;
19180
20793
  exports.GTagManager = GTagManager;
19181
20794
  exports.HomeBanner = HomeBanner;