@salesgenterp/ui-components 0.4.366 → 0.4.367
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 +521 -284
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +523 -286
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -324,29 +324,6 @@ var CARD_METHODS = {
|
|
|
324
324
|
DEBIT_CARD: 3
|
|
325
325
|
};
|
|
326
326
|
|
|
327
|
-
var erLocalStorage = {
|
|
328
|
-
setItem: function setItem(key, value) {
|
|
329
|
-
localStorage.setItem(key, value);
|
|
330
|
-
},
|
|
331
|
-
getItem: function getItem(key) {
|
|
332
|
-
return localStorage.getItem(key);
|
|
333
|
-
},
|
|
334
|
-
removeItem: function removeItem(key) {
|
|
335
|
-
localStorage.removeItem(key);
|
|
336
|
-
},
|
|
337
|
-
setJSONItem: function setJSONItem(key, value) {
|
|
338
|
-
value = JSON.stringify(value);
|
|
339
|
-
localStorage.setItem(key, value);
|
|
340
|
-
},
|
|
341
|
-
getJSONItem: function getJSONItem(key) {
|
|
342
|
-
var returnValue = {};
|
|
343
|
-
try {
|
|
344
|
-
returnValue = localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : {};
|
|
345
|
-
} catch (e) {}
|
|
346
|
-
return returnValue;
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
|
|
350
327
|
var ErCache = /*#__PURE__*/function () {
|
|
351
328
|
function ErCache() {
|
|
352
329
|
this.sessionStorage = typeof window !== 'undefined' ? window.sessionStorage : {};
|
|
@@ -381,6 +358,29 @@ var ErCache = /*#__PURE__*/function () {
|
|
|
381
358
|
}();
|
|
382
359
|
var erCache = new ErCache();
|
|
383
360
|
|
|
361
|
+
var erLocalStorage = {
|
|
362
|
+
setItem: function setItem(key, value) {
|
|
363
|
+
localStorage.setItem(key, value);
|
|
364
|
+
},
|
|
365
|
+
getItem: function getItem(key) {
|
|
366
|
+
return localStorage.getItem(key);
|
|
367
|
+
},
|
|
368
|
+
removeItem: function removeItem(key) {
|
|
369
|
+
localStorage.removeItem(key);
|
|
370
|
+
},
|
|
371
|
+
setJSONItem: function setJSONItem(key, value) {
|
|
372
|
+
value = JSON.stringify(value);
|
|
373
|
+
localStorage.setItem(key, value);
|
|
374
|
+
},
|
|
375
|
+
getJSONItem: function getJSONItem(key) {
|
|
376
|
+
var returnValue = {};
|
|
377
|
+
try {
|
|
378
|
+
returnValue = localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : {};
|
|
379
|
+
} catch (e) {}
|
|
380
|
+
return returnValue;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
384
|
var byPassAuthAPIs = ['/authenticate'];
|
|
385
385
|
var API_CACHE_PREFIX = 'API_CACHE';
|
|
386
386
|
var getKeyFromPath = function getKeyFromPath(_ref) {
|
|
@@ -411,7 +411,7 @@ var setAPIDataToCache = function setAPIDataToCache(_ref3) {
|
|
|
411
411
|
};
|
|
412
412
|
var CancelToken = axios.CancelToken;
|
|
413
413
|
var source;
|
|
414
|
-
var API
|
|
414
|
+
var API = function API(apiData) {
|
|
415
415
|
try {
|
|
416
416
|
var url = apiData.url,
|
|
417
417
|
method = apiData.method,
|
|
@@ -421,30 +421,46 @@ var API$1 = function API(apiData) {
|
|
|
421
421
|
body = apiData.body,
|
|
422
422
|
isCancelToken = apiData.isCancelToken,
|
|
423
423
|
cache = apiData.cache,
|
|
424
|
+
forceUpdateCache = apiData.forceUpdateCache,
|
|
424
425
|
_apiData$headers = apiData.headers,
|
|
425
426
|
headers = _apiData$headers === void 0 ? {} : _apiData$headers,
|
|
426
427
|
successMessage = apiData.successMessage,
|
|
428
|
+
hideSuccessMessage = apiData.hideSuccessMessage,
|
|
427
429
|
hideErrorMessage = apiData.hideErrorMessage,
|
|
428
430
|
responseTypeData = apiData.responseTypeData,
|
|
431
|
+
notAppendApiText = apiData.notAppendApiText,
|
|
432
|
+
getStatusWithData = apiData.getStatusWithData,
|
|
433
|
+
processResponse = apiData.processResponse,
|
|
429
434
|
apiEndPoint = apiData.apiEndPoint,
|
|
430
435
|
token = apiData.token;
|
|
431
436
|
return Promise.resolve(_finallyRethrows(function () {
|
|
432
437
|
return _catch(function () {
|
|
433
438
|
function _temp2() {
|
|
434
|
-
if (
|
|
435
|
-
|
|
439
|
+
if (!hideSuccessMessage) {
|
|
440
|
+
if (successMessage) {
|
|
441
|
+
alert(successMessage);
|
|
442
|
+
}
|
|
436
443
|
}
|
|
444
|
+
var apiResponse;
|
|
437
445
|
if (responseTypeData) {
|
|
438
|
-
|
|
446
|
+
var _response;
|
|
447
|
+
apiResponse = (_response = response) === null || _response === void 0 ? void 0 : _response.data;
|
|
439
448
|
} else {
|
|
440
|
-
|
|
449
|
+
var _response2, _response2$data, _response3, _response3$data, _response4, _response4$data;
|
|
450
|
+
apiResponse = getStatusWithData ? _extends({
|
|
451
|
+
status: (_response2 = response) === null || _response2 === void 0 ? void 0 : (_response2$data = _response2.data) === null || _response2$data === void 0 ? void 0 : _response2$data.status
|
|
452
|
+
}, (_response3 = response) === null || _response3 === void 0 ? void 0 : (_response3$data = _response3.data) === null || _response3$data === void 0 ? void 0 : _response3$data.result) : (_response4 = response) === null || _response4 === void 0 ? void 0 : (_response4$data = _response4.data) === null || _response4$data === void 0 ? void 0 : _response4$data.result;
|
|
441
453
|
}
|
|
454
|
+
return processResponse ? processResponse(apiResponse) : apiResponse;
|
|
442
455
|
}
|
|
443
456
|
var apiUrl = ("/" + url).replace(/\/\//g, '/');
|
|
444
457
|
var accessToken = token;
|
|
445
|
-
var requestHeaders = headers;
|
|
446
|
-
if (
|
|
447
|
-
requestHeaders =
|
|
458
|
+
var requestHeaders = _extends({}, headers);
|
|
459
|
+
if (formData) {
|
|
460
|
+
requestHeaders['Content-Type'] = 'multipart/form-data';
|
|
461
|
+
}
|
|
462
|
+
if (byPassAuthAPIs.indexOf(url) === -1) {
|
|
463
|
+
requestHeaders = _extends({}, requestHeaders, {
|
|
448
464
|
Authorization: "Bearer " + accessToken,
|
|
449
465
|
Accept: "application/json, text/plain"
|
|
450
466
|
});
|
|
@@ -460,7 +476,7 @@ var API$1 = function API(apiData) {
|
|
|
460
476
|
apiUrl = "" + (API_END_POINT || apiEndPoint) + apiUrl;
|
|
461
477
|
}
|
|
462
478
|
var _temp = function () {
|
|
463
|
-
if (cache && getAPICacheData({
|
|
479
|
+
if (!forceUpdateCache && cache && getAPICacheData({
|
|
464
480
|
path: apiUrl,
|
|
465
481
|
queryParams: queryParams
|
|
466
482
|
})) {
|
|
@@ -491,44 +507,17 @@ var API$1 = function API(apiData) {
|
|
|
491
507
|
}();
|
|
492
508
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
493
509
|
}, function (exception) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}));
|
|
504
|
-
}
|
|
505
|
-
}();
|
|
506
|
-
}
|
|
507
|
-
var exceptionResponse = exception.response;
|
|
508
|
-
var _temp3 = function () {
|
|
509
|
-
if (exceptionResponse.data.hasError) {
|
|
510
|
-
return function () {
|
|
511
|
-
if (!hideErrorMessage) {
|
|
512
|
-
alert(exceptionResponse.data.error.message);
|
|
513
|
-
return function () {
|
|
514
|
-
if (exceptionResponse.data.exception) {
|
|
515
|
-
return Promise.resolve(handleError({
|
|
516
|
-
exception: exception,
|
|
517
|
-
apiEndPoint: apiEndPoint,
|
|
518
|
-
url: url,
|
|
519
|
-
apiData: apiData,
|
|
520
|
-
hideErrorMessage: true
|
|
521
|
-
})).then(function (_await$handleError) {
|
|
522
|
-
_exit = true;
|
|
523
|
-
return _await$handleError;
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
}();
|
|
527
|
-
}
|
|
528
|
-
}();
|
|
510
|
+
return function () {
|
|
511
|
+
if (axios.isCancel(exception)) {} else {
|
|
512
|
+
return Promise.resolve(handleError({
|
|
513
|
+
exception: exception,
|
|
514
|
+
url: url,
|
|
515
|
+
apiData: apiData,
|
|
516
|
+
hideErrorMessage: hideErrorMessage,
|
|
517
|
+
getStatusWithData: getStatusWithData
|
|
518
|
+
}));
|
|
529
519
|
}
|
|
530
520
|
}();
|
|
531
|
-
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
532
521
|
});
|
|
533
522
|
}, function (_wasThrown, _result) {
|
|
534
523
|
if (_wasThrown) throw _result;
|
|
@@ -538,35 +527,35 @@ var API$1 = function API(apiData) {
|
|
|
538
527
|
return Promise.reject(e);
|
|
539
528
|
}
|
|
540
529
|
};
|
|
541
|
-
API
|
|
542
|
-
return API
|
|
530
|
+
API.get = function (url, options) {
|
|
531
|
+
return API(_extends({
|
|
543
532
|
url: url,
|
|
544
533
|
method: 'get'
|
|
545
534
|
}, options));
|
|
546
535
|
};
|
|
547
|
-
API
|
|
548
|
-
return API
|
|
536
|
+
API.put = function (url, body, options) {
|
|
537
|
+
return API(_extends({
|
|
549
538
|
url: url,
|
|
550
539
|
body: body,
|
|
551
540
|
method: 'put'
|
|
552
541
|
}, options));
|
|
553
542
|
};
|
|
554
|
-
API
|
|
555
|
-
return API
|
|
543
|
+
API.patch = function (url, body, options) {
|
|
544
|
+
return API(_extends({
|
|
556
545
|
url: url,
|
|
557
546
|
body: body,
|
|
558
547
|
method: 'patch'
|
|
559
548
|
}, options));
|
|
560
549
|
};
|
|
561
|
-
API
|
|
562
|
-
return API
|
|
550
|
+
API.post = function (url, body, options) {
|
|
551
|
+
return API(_extends({
|
|
563
552
|
url: url,
|
|
564
553
|
body: body,
|
|
565
554
|
method: 'post'
|
|
566
555
|
}, options));
|
|
567
556
|
};
|
|
568
|
-
API
|
|
569
|
-
return API
|
|
557
|
+
API["delete"] = function (url, body, options) {
|
|
558
|
+
return API(_extends({
|
|
570
559
|
url: url,
|
|
571
560
|
body: body,
|
|
572
561
|
method: 'delete'
|
|
@@ -576,32 +565,25 @@ var handleError = function handleError(_ref6) {
|
|
|
576
565
|
var exception = _ref6.exception,
|
|
577
566
|
url = _ref6.url,
|
|
578
567
|
apiData = _ref6.apiData,
|
|
579
|
-
hideErrorMessage = _ref6.hideErrorMessage
|
|
568
|
+
hideErrorMessage = _ref6.hideErrorMessage,
|
|
569
|
+
getStatusWithData = _ref6.getStatusWithData;
|
|
580
570
|
try {
|
|
581
|
-
var
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
showAPIError = apiData.showAPIError;
|
|
585
|
-
if (exception.response && (exception.response.status === 401 || exception.response.status === 403) && url !== '/authenticate' && url !== '/refreshToken') {
|
|
586
|
-
try {} catch (e) {
|
|
587
|
-
alert(e);
|
|
588
|
-
if (throwException) {
|
|
589
|
-
throw exception;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
} else {
|
|
571
|
+
var errorMessage = apiData === null || apiData === void 0 ? void 0 : apiData.errorMessage;
|
|
572
|
+
var exceptionResponse = exception === null || exception === void 0 ? void 0 : exception.response;
|
|
573
|
+
if (url !== '/refreshToken') {
|
|
593
574
|
if (!hideErrorMessage) {
|
|
594
|
-
var
|
|
595
|
-
|
|
596
|
-
errMessage = lodash.get(exception, 'response.data.message');
|
|
597
|
-
}
|
|
598
|
-
alert(errMessage);
|
|
599
|
-
}
|
|
600
|
-
if (throwException) {
|
|
601
|
-
throw exception;
|
|
575
|
+
var _exceptionResponse$da, _exceptionResponse$da2, _exceptionResponse$da3, _exceptionResponse$da4;
|
|
576
|
+
alert((exceptionResponse === null || exceptionResponse === void 0 ? void 0 : (_exceptionResponse$da = exceptionResponse.data) === null || _exceptionResponse$da === void 0 ? void 0 : (_exceptionResponse$da2 = _exceptionResponse$da.error) === null || _exceptionResponse$da2 === void 0 ? void 0 : _exceptionResponse$da2.details) || (exceptionResponse === null || exceptionResponse === void 0 ? void 0 : (_exceptionResponse$da3 = exceptionResponse.data) === null || _exceptionResponse$da3 === void 0 ? void 0 : (_exceptionResponse$da4 = _exceptionResponse$da3.error) === null || _exceptionResponse$da4 === void 0 ? void 0 : _exceptionResponse$da4.message) || errorMessage || 'Something went wrong.');
|
|
602
577
|
}
|
|
603
578
|
}
|
|
604
|
-
|
|
579
|
+
if (getStatusWithData) {
|
|
580
|
+
var _exception$response, _exception$response2, _exception$response2$, _exception$response2$2;
|
|
581
|
+
return Promise.resolve({
|
|
582
|
+
status: exception === null || exception === void 0 ? void 0 : (_exception$response = exception.response) === null || _exception$response === void 0 ? void 0 : _exception$response.status,
|
|
583
|
+
message: exception === null || exception === void 0 ? void 0 : (_exception$response2 = exception.response) === null || _exception$response2 === void 0 ? void 0 : (_exception$response2$ = _exception$response2.data) === null || _exception$response2$ === void 0 ? void 0 : (_exception$response2$2 = _exception$response2$.error) === null || _exception$response2$2 === void 0 ? void 0 : _exception$response2$2.message
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
throw exception;
|
|
605
587
|
} catch (e) {
|
|
606
588
|
return Promise.reject(e);
|
|
607
589
|
}
|
|
@@ -620,7 +602,7 @@ var getcsvData = function getcsvData(_ref3) {
|
|
|
620
602
|
token = _ref3.token;
|
|
621
603
|
try {
|
|
622
604
|
return Promise.resolve(_catch(function () {
|
|
623
|
-
return Promise.resolve(API
|
|
605
|
+
return Promise.resolve(API({
|
|
624
606
|
method: 'GET',
|
|
625
607
|
url: url,
|
|
626
608
|
responseTypeData: 'blob',
|
|
@@ -684,12 +666,28 @@ var MuiButton = function MuiButton(props) {
|
|
|
684
666
|
disabled: loading ? true : disabled
|
|
685
667
|
}), loading ? /*#__PURE__*/React__default.createElement(material.CircularProgress, {
|
|
686
668
|
color: "inherit",
|
|
687
|
-
size:
|
|
669
|
+
size: 20
|
|
688
670
|
}) : children));
|
|
689
671
|
};
|
|
690
672
|
var ButtonContainer = styled__default(material.Button)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n background: ", " !important;\n"])), function (props) {
|
|
691
673
|
return props.primaryColor;
|
|
692
674
|
});
|
|
675
|
+
var MuiIconButton = function MuiIconButton(props) {
|
|
676
|
+
var fontColor = props.fontColor,
|
|
677
|
+
primaryColor = props.primaryColor,
|
|
678
|
+
children = props.children,
|
|
679
|
+
loading = props.loading,
|
|
680
|
+
disabled = props.disabled;
|
|
681
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(material.IconButton, _extends({
|
|
682
|
+
fontColor: fontColor,
|
|
683
|
+
primaryColor: primaryColor
|
|
684
|
+
}, props, {
|
|
685
|
+
disabled: loading ? true : disabled
|
|
686
|
+
}), loading ? /*#__PURE__*/React__default.createElement(material.CircularProgress, {
|
|
687
|
+
color: "inherit",
|
|
688
|
+
size: 16
|
|
689
|
+
}) : children));
|
|
690
|
+
};
|
|
693
691
|
|
|
694
692
|
var convertCamCaseToSnake = function convertCamCaseToSnake(child) {
|
|
695
693
|
var _Object$keys;
|
|
@@ -938,7 +936,7 @@ var ContactUsForm = function ContactUsForm(_ref) {
|
|
|
938
936
|
};
|
|
939
937
|
setIsLoading(true);
|
|
940
938
|
var _temp = _catch(function () {
|
|
941
|
-
return Promise.resolve(API
|
|
939
|
+
return Promise.resolve(API({
|
|
942
940
|
apiEndPoint: apiEndPoint === null || apiEndPoint === void 0 ? void 0 : apiEndPoint.replace('/api', '/services/pdf'),
|
|
943
941
|
method: 'POST',
|
|
944
942
|
url: "/email/customer/contact-us",
|
|
@@ -1083,7 +1081,7 @@ var APIStaticPage = function APIStaticPage(_ref) {
|
|
|
1083
1081
|
setStaticPage(_response3);
|
|
1084
1082
|
var _temp = function (_response, _response$title, _response2, _response2$urlAlias) {
|
|
1085
1083
|
if (((_response = _response3) === null || _response === void 0 ? void 0 : (_response$title = _response.title) === null || _response$title === void 0 ? void 0 : _response$title.toLowerCase()) === 'contact us' || ((_response2 = _response3) === null || _response2 === void 0 ? void 0 : (_response2$urlAlias = _response2.urlAlias) === null || _response2$urlAlias === void 0 ? void 0 : _response2$urlAlias.toLowerCase()) === 'contact-us') {
|
|
1086
|
-
return Promise.resolve(API
|
|
1084
|
+
return Promise.resolve(API({
|
|
1087
1085
|
apiEndPoint: apiEndPoint,
|
|
1088
1086
|
url: "/store"
|
|
1089
1087
|
})).then(function (storeData) {
|
|
@@ -1098,7 +1096,7 @@ var APIStaticPage = function APIStaticPage(_ref) {
|
|
|
1098
1096
|
var _response3;
|
|
1099
1097
|
var _temp2 = function () {
|
|
1100
1098
|
if (id || alias) {
|
|
1101
|
-
return Promise.resolve(API
|
|
1099
|
+
return Promise.resolve(API({
|
|
1102
1100
|
apiEndPoint: apiEndPoint,
|
|
1103
1101
|
url: "/ecommerce/staticPage",
|
|
1104
1102
|
queryParams: {
|
|
@@ -1227,7 +1225,7 @@ var ChangePassword = function ChangePassword(_ref) {
|
|
|
1227
1225
|
};
|
|
1228
1226
|
setIsLoading(true);
|
|
1229
1227
|
var _temp = _catch(function () {
|
|
1230
|
-
return Promise.resolve(API
|
|
1228
|
+
return Promise.resolve(API({
|
|
1231
1229
|
apiEndPoint: apiEndPoint,
|
|
1232
1230
|
token: token,
|
|
1233
1231
|
method: 'POST',
|
|
@@ -1502,7 +1500,7 @@ var APITable = React.forwardRef(function (_ref, ref) {
|
|
|
1502
1500
|
apiResponse = _asyncService;
|
|
1503
1501
|
});
|
|
1504
1502
|
} else {
|
|
1505
|
-
return Promise.resolve(API
|
|
1503
|
+
return Promise.resolve(API(_extends({}, apiData, {
|
|
1506
1504
|
queryParams: queryParams
|
|
1507
1505
|
}))).then(function (_API) {
|
|
1508
1506
|
apiResponse = _API;
|
|
@@ -1677,7 +1675,7 @@ var getPaymentMethods = function getPaymentMethods(_ref) {
|
|
|
1677
1675
|
var apiEndPoint = _ref.apiEndPoint,
|
|
1678
1676
|
token = _ref.token;
|
|
1679
1677
|
try {
|
|
1680
|
-
return Promise.resolve(API
|
|
1678
|
+
return Promise.resolve(API({
|
|
1681
1679
|
apiEndPoint: apiEndPoint,
|
|
1682
1680
|
token: token,
|
|
1683
1681
|
url: "/store/paymentMode"
|
|
@@ -1690,7 +1688,7 @@ var getStoreFeatureDetails = function getStoreFeatureDetails(_ref2) {
|
|
|
1690
1688
|
var apiEndPoint = _ref2.apiEndPoint,
|
|
1691
1689
|
token = _ref2.token;
|
|
1692
1690
|
try {
|
|
1693
|
-
return Promise.resolve(API
|
|
1691
|
+
return Promise.resolve(API({
|
|
1694
1692
|
apiEndPoint: apiEndPoint,
|
|
1695
1693
|
token: token,
|
|
1696
1694
|
url: "/store/feature"
|
|
@@ -1704,7 +1702,7 @@ var getAuthorizeDotNetCreditCards = function getAuthorizeDotNetCreditCards(_ref3
|
|
|
1704
1702
|
token = _ref3.token,
|
|
1705
1703
|
customerId = _ref3.customerId;
|
|
1706
1704
|
try {
|
|
1707
|
-
return Promise.resolve(API
|
|
1705
|
+
return Promise.resolve(API({
|
|
1708
1706
|
apiEndPoint: apiEndPoint,
|
|
1709
1707
|
token: token,
|
|
1710
1708
|
url: "/ecommerce/authoriseDotNet/customerProfile?customerId=" + customerId
|
|
@@ -1718,7 +1716,7 @@ var addAuthoriseDotNetCard = function addAuthoriseDotNetCard(_ref4) {
|
|
|
1718
1716
|
token = _ref4.token,
|
|
1719
1717
|
body = _ref4.body;
|
|
1720
1718
|
try {
|
|
1721
|
-
return Promise.resolve(API
|
|
1719
|
+
return Promise.resolve(API({
|
|
1722
1720
|
apiEndPoint: apiEndPoint,
|
|
1723
1721
|
token: token,
|
|
1724
1722
|
url: "/ecommerce/authoriseDotNet/paymentProfile",
|
|
@@ -1730,6 +1728,91 @@ var addAuthoriseDotNetCard = function addAuthoriseDotNetCard(_ref4) {
|
|
|
1730
1728
|
return Promise.reject(e);
|
|
1731
1729
|
}
|
|
1732
1730
|
};
|
|
1731
|
+
var getCartDiscountList = function getCartDiscountList(_ref5) {
|
|
1732
|
+
var apiEndPoint = _ref5.apiEndPoint,
|
|
1733
|
+
token = _ref5.token;
|
|
1734
|
+
try {
|
|
1735
|
+
return Promise.resolve(API({
|
|
1736
|
+
apiEndPoint: apiEndPoint,
|
|
1737
|
+
token: token,
|
|
1738
|
+
url: "/cartDiscount?storeId=2"
|
|
1739
|
+
}));
|
|
1740
|
+
} catch (e) {
|
|
1741
|
+
return Promise.reject(e);
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
var validateDiscount = function validateDiscount(_ref6) {
|
|
1745
|
+
var apiEndPoint = _ref6.apiEndPoint,
|
|
1746
|
+
token = _ref6.token,
|
|
1747
|
+
body = _ref6.body,
|
|
1748
|
+
storeIdList = _ref6.storeIdList,
|
|
1749
|
+
cartAmount = _ref6.cartAmount;
|
|
1750
|
+
try {
|
|
1751
|
+
var _temp2 = _catch(function () {
|
|
1752
|
+
return Promise.resolve(API({
|
|
1753
|
+
apiEndPoint: apiEndPoint,
|
|
1754
|
+
token: token,
|
|
1755
|
+
method: 'POST',
|
|
1756
|
+
url: "/ecommerce/discount/validate?storeId=" + storeIdList,
|
|
1757
|
+
body: body
|
|
1758
|
+
})).then(function () {
|
|
1759
|
+
var _temp = function (_body$couponNames) {
|
|
1760
|
+
if (body !== null && body !== void 0 && (_body$couponNames = body.couponNames) !== null && _body$couponNames !== void 0 && _body$couponNames[0]) {
|
|
1761
|
+
var _body$couponNames2;
|
|
1762
|
+
var discountBody = {
|
|
1763
|
+
cartTotal: cartAmount,
|
|
1764
|
+
couponCode: body === null || body === void 0 ? void 0 : (_body$couponNames2 = body.couponNames) === null || _body$couponNames2 === void 0 ? void 0 : _body$couponNames2[0]
|
|
1765
|
+
};
|
|
1766
|
+
return Promise.resolve(addCartDiscount({
|
|
1767
|
+
apiEndPoint: apiEndPoint,
|
|
1768
|
+
token: token,
|
|
1769
|
+
body: discountBody
|
|
1770
|
+
})).then(function () {});
|
|
1771
|
+
}
|
|
1772
|
+
}();
|
|
1773
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
1774
|
+
});
|
|
1775
|
+
}, function () {});
|
|
1776
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
1777
|
+
} catch (e) {
|
|
1778
|
+
return Promise.reject(e);
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
var addCartDiscount = function addCartDiscount(_ref7) {
|
|
1782
|
+
var apiEndPoint = _ref7.apiEndPoint,
|
|
1783
|
+
token = _ref7.token,
|
|
1784
|
+
body = _ref7.body;
|
|
1785
|
+
try {
|
|
1786
|
+
return Promise.resolve(API({
|
|
1787
|
+
apiEndPoint: apiEndPoint,
|
|
1788
|
+
token: token,
|
|
1789
|
+
url: "/cartDiscount?storeId=2",
|
|
1790
|
+
method: 'post',
|
|
1791
|
+
body: body,
|
|
1792
|
+
errorMessage: 'Error in adding discount.',
|
|
1793
|
+
successMessage: 'Discount added successfully.'
|
|
1794
|
+
}));
|
|
1795
|
+
} catch (e) {
|
|
1796
|
+
return Promise.reject(e);
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
var deleteCartDiscount = function deleteCartDiscount(_ref8) {
|
|
1800
|
+
var apiEndPoint = _ref8.apiEndPoint,
|
|
1801
|
+
token = _ref8.token,
|
|
1802
|
+
discountId = _ref8.discountId;
|
|
1803
|
+
try {
|
|
1804
|
+
return Promise.resolve(API({
|
|
1805
|
+
apiEndPoint: apiEndPoint,
|
|
1806
|
+
token: token,
|
|
1807
|
+
url: "/cartDiscount?cartDiscountMapId=" + discountId + "&storeId=2",
|
|
1808
|
+
method: 'delete',
|
|
1809
|
+
successMessage: 'Discount removed successfully.',
|
|
1810
|
+
errorMessage: 'Error in removing discount.'
|
|
1811
|
+
}));
|
|
1812
|
+
} catch (e) {
|
|
1813
|
+
return Promise.reject(e);
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1733
1816
|
|
|
1734
1817
|
var _templateObject$9;
|
|
1735
1818
|
var _excluded$2 = ["children", "onClose", "fontColor"];
|
|
@@ -1911,7 +1994,7 @@ var getStatesById = function getStatesById(_ref) {
|
|
|
1911
1994
|
token = _ref.token,
|
|
1912
1995
|
id = _ref.id;
|
|
1913
1996
|
try {
|
|
1914
|
-
return Promise.resolve(API
|
|
1997
|
+
return Promise.resolve(API({
|
|
1915
1998
|
apiEndPoint: apiEndPoint,
|
|
1916
1999
|
token: token,
|
|
1917
2000
|
url: "/country/" + id + "/allState",
|
|
@@ -1925,7 +2008,7 @@ var getCountry = function getCountry(_ref2) {
|
|
|
1925
2008
|
var apiEndPoint = _ref2.apiEndPoint,
|
|
1926
2009
|
token = _ref2.token;
|
|
1927
2010
|
try {
|
|
1928
|
-
return Promise.resolve(API
|
|
2011
|
+
return Promise.resolve(API({
|
|
1929
2012
|
apiEndPoint: apiEndPoint,
|
|
1930
2013
|
token: token,
|
|
1931
2014
|
url: "/country/all",
|
|
@@ -2254,7 +2337,7 @@ var PaymentModal = function PaymentModal(_ref) {
|
|
|
2254
2337
|
};
|
|
2255
2338
|
setDataLoading(true);
|
|
2256
2339
|
var _temp = _catch(function () {
|
|
2257
|
-
return Promise.resolve(API
|
|
2340
|
+
return Promise.resolve(API({
|
|
2258
2341
|
url: "/ecommerce/order/" + orderId + "?storeIds=" + storeIdList,
|
|
2259
2342
|
apiEndPoint: apiEndPoint,
|
|
2260
2343
|
token: token
|
|
@@ -2333,7 +2416,7 @@ var PaymentModal = function PaymentModal(_ref) {
|
|
|
2333
2416
|
authorizeDotNetCustomerPaymentProfileId: authorizeDotNetCardData === null || authorizeDotNetCardData === void 0 ? void 0 : authorizeDotNetCardData.customerPaymentProfileId,
|
|
2334
2417
|
authorizeDotNetCustomerProfileId: customerCreditCards === null || customerCreditCards === void 0 ? void 0 : (_customerCreditCards$3 = customerCreditCards.profile) === null || _customerCreditCards$3 === void 0 ? void 0 : _customerCreditCards$3.customerProfileId
|
|
2335
2418
|
}), ['authorizeDotNetCard']));
|
|
2336
|
-
return Promise.resolve(API
|
|
2419
|
+
return Promise.resolve(API({
|
|
2337
2420
|
apiEndPoint: apiEndPoint,
|
|
2338
2421
|
token: token,
|
|
2339
2422
|
method: 'post',
|
|
@@ -2689,14 +2772,14 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
2689
2772
|
(function () {
|
|
2690
2773
|
try {
|
|
2691
2774
|
var _temp = _catch(function () {
|
|
2692
|
-
return Promise.resolve(API
|
|
2775
|
+
return Promise.resolve(API({
|
|
2693
2776
|
url: "/ecommerce/customer",
|
|
2694
2777
|
apiEndPoint: apiEndPoint,
|
|
2695
2778
|
token: token,
|
|
2696
2779
|
hideErrorMessage: true
|
|
2697
2780
|
})).then(function (customerDataResponse) {
|
|
2698
2781
|
setCustomerData(customerDataResponse);
|
|
2699
|
-
return Promise.resolve(API
|
|
2782
|
+
return Promise.resolve(API({
|
|
2700
2783
|
url: "/ecommerce/dashboard",
|
|
2701
2784
|
apiEndPoint: apiEndPoint,
|
|
2702
2785
|
token: token
|
|
@@ -3156,7 +3239,7 @@ var MyProfile = function MyProfile(_ref) {
|
|
|
3156
3239
|
(function () {
|
|
3157
3240
|
try {
|
|
3158
3241
|
var _temp = _catch(function () {
|
|
3159
|
-
return Promise.resolve(API
|
|
3242
|
+
return Promise.resolve(API({
|
|
3160
3243
|
apiEndPoint: apiEndPoint,
|
|
3161
3244
|
token: token,
|
|
3162
3245
|
url: "/ecommerce/customer",
|
|
@@ -3179,7 +3262,7 @@ var MyProfile = function MyProfile(_ref) {
|
|
|
3179
3262
|
};
|
|
3180
3263
|
setIsLoading(true);
|
|
3181
3264
|
var _temp2 = _catch(function () {
|
|
3182
|
-
return Promise.resolve(API
|
|
3265
|
+
return Promise.resolve(API({
|
|
3183
3266
|
apiEndPoint: apiEndPoint,
|
|
3184
3267
|
token: token,
|
|
3185
3268
|
method: 'put',
|
|
@@ -3733,13 +3816,13 @@ var Statement = function Statement(_ref) {
|
|
|
3733
3816
|
var _temp2 = function () {
|
|
3734
3817
|
if (token && apiEndPoint) {
|
|
3735
3818
|
var _temp = _catch(function () {
|
|
3736
|
-
return Promise.resolve(API
|
|
3819
|
+
return Promise.resolve(API({
|
|
3737
3820
|
url: "/ecommerce/customer",
|
|
3738
3821
|
apiEndPoint: apiEndPoint,
|
|
3739
3822
|
token: token
|
|
3740
3823
|
})).then(function (customerDataResponse) {
|
|
3741
3824
|
setCustomerData(customerDataResponse);
|
|
3742
|
-
return Promise.resolve(API
|
|
3825
|
+
return Promise.resolve(API({
|
|
3743
3826
|
apiEndPoint: apiEndPoint,
|
|
3744
3827
|
token: token,
|
|
3745
3828
|
url: "/ecommerce/customer/child"
|
|
@@ -3770,7 +3853,7 @@ var Statement = function Statement(_ref) {
|
|
|
3770
3853
|
var _customerData$custome3, _customerData$custome4;
|
|
3771
3854
|
setLoading(true);
|
|
3772
3855
|
var customerIds = queryParams !== null && queryParams !== void 0 && queryParams.customerIds ? (queryParams === null || queryParams === void 0 ? void 0 : queryParams.customerIds) + "," + (customerData === null || customerData === void 0 ? void 0 : (_customerData$custome3 = customerData.customerDto) === null || _customerData$custome3 === void 0 ? void 0 : _customerData$custome3.id) : customerData === null || customerData === void 0 ? void 0 : (_customerData$custome4 = customerData.customerDto) === null || _customerData$custome4 === void 0 ? void 0 : _customerData$custome4.id;
|
|
3773
|
-
return Promise.resolve(API
|
|
3856
|
+
return Promise.resolve(API({
|
|
3774
3857
|
url: "/ecommerce/customer/report/statement?storeIds=" + storeIdList + "&page=0&size=20",
|
|
3775
3858
|
apiEndPoint: apiEndPoint,
|
|
3776
3859
|
token: token,
|
|
@@ -3996,7 +4079,7 @@ var AddEditAddress = function AddEditAddress(_ref) {
|
|
|
3996
4079
|
setIsLoading(true);
|
|
3997
4080
|
var _temp2 = _catch(function () {
|
|
3998
4081
|
var _customer$customerDto, _customer$customerDto2;
|
|
3999
|
-
return Promise.resolve(API
|
|
4082
|
+
return Promise.resolve(API({
|
|
4000
4083
|
apiEndPoint: apiEndPoint,
|
|
4001
4084
|
token: token,
|
|
4002
4085
|
url: "/ecommerce/customer/" + (customer === null || customer === void 0 ? void 0 : (_customer$customerDto = customer.customerDto) === null || _customer$customerDto === void 0 ? void 0 : _customer$customerDto.id) + "/address",
|
|
@@ -4322,7 +4405,7 @@ var StoreTabs = function StoreTabs(_ref) {
|
|
|
4322
4405
|
try {
|
|
4323
4406
|
var _temp2 = _catch(function () {
|
|
4324
4407
|
var _customer$customerDto2;
|
|
4325
|
-
return Promise.resolve(API
|
|
4408
|
+
return Promise.resolve(API({
|
|
4326
4409
|
apiEndPoint: apiEndPoint,
|
|
4327
4410
|
token: token,
|
|
4328
4411
|
url: "/ecommerce/customer/" + (customer === null || customer === void 0 ? void 0 : (_customer$customerDto2 = customer.customerDto) === null || _customer$customerDto2 === void 0 ? void 0 : _customer$customerDto2.id) + "/address",
|
|
@@ -4389,7 +4472,7 @@ var StoreList = function StoreList(_ref) {
|
|
|
4389
4472
|
setCustomer = _useState[1];
|
|
4390
4473
|
React.useEffect(function () {
|
|
4391
4474
|
try {
|
|
4392
|
-
return Promise.resolve(API
|
|
4475
|
+
return Promise.resolve(API({
|
|
4393
4476
|
apiEndPoint: apiEndPoint,
|
|
4394
4477
|
token: token,
|
|
4395
4478
|
url: "/ecommerce/customer",
|
|
@@ -4528,7 +4611,7 @@ var AccountDetails = function AccountDetails(_ref) {
|
|
|
4528
4611
|
};
|
|
4529
4612
|
setDataLoading(true);
|
|
4530
4613
|
var _temp = _catch(function () {
|
|
4531
|
-
return Promise.resolve(API
|
|
4614
|
+
return Promise.resolve(API({
|
|
4532
4615
|
apiEndPoint: apiEndPoint,
|
|
4533
4616
|
token: token,
|
|
4534
4617
|
url: "/store"
|
|
@@ -4935,7 +5018,7 @@ var BrandList = function BrandList(_ref) {
|
|
|
4935
5018
|
};
|
|
4936
5019
|
setLoading(true);
|
|
4937
5020
|
var _temp = _catch(function () {
|
|
4938
|
-
return Promise.resolve(API
|
|
5021
|
+
return Promise.resolve(API({
|
|
4939
5022
|
apiEndPoint: apiEndPoint,
|
|
4940
5023
|
url: "/ecommerce/brand/list?size=" + (size || 20)
|
|
4941
5024
|
})).then(function (data) {
|
|
@@ -4997,7 +5080,7 @@ var AsyncDataLoad = function AsyncDataLoad(_ref) {
|
|
|
4997
5080
|
data = _asyncService;
|
|
4998
5081
|
});
|
|
4999
5082
|
} else {
|
|
5000
|
-
return Promise.resolve(API
|
|
5083
|
+
return Promise.resolve(API(_extends({
|
|
5001
5084
|
apiEndPoint: apiEndPoint,
|
|
5002
5085
|
token: token,
|
|
5003
5086
|
hideErrorMessage: true
|
|
@@ -5053,7 +5136,7 @@ var BrandStock = function BrandStock(_ref) {
|
|
|
5053
5136
|
(function () {
|
|
5054
5137
|
try {
|
|
5055
5138
|
var _temp = _catch(function () {
|
|
5056
|
-
return Promise.resolve(API
|
|
5139
|
+
return Promise.resolve(API({
|
|
5057
5140
|
apiEndPoint: apiEndPoint,
|
|
5058
5141
|
url: "/ecommerce/brand/list?size=9999"
|
|
5059
5142
|
})).then(function (brandList) {
|
|
@@ -5072,7 +5155,7 @@ var BrandStock = function BrandStock(_ref) {
|
|
|
5072
5155
|
var brand = _ref2.brand;
|
|
5073
5156
|
return Promise.resolve(_catch(function () {
|
|
5074
5157
|
var data = [];
|
|
5075
|
-
return Promise.resolve(API
|
|
5158
|
+
return Promise.resolve(API({
|
|
5076
5159
|
apiEndPoint: apiEndPoint,
|
|
5077
5160
|
url: "/ecommerce/product/brand?brandIdList=" + (brand === null || brand === void 0 ? void 0 : brand.id) + "&storeIds=2&size=9999"
|
|
5078
5161
|
})).then(function (products) {
|
|
@@ -5084,7 +5167,7 @@ var BrandStock = function BrandStock(_ref) {
|
|
|
5084
5167
|
data = products === null || products === void 0 ? void 0 : products.content;
|
|
5085
5168
|
var updatePromises = [];
|
|
5086
5169
|
var _temp2 = _forOf(products === null || products === void 0 ? void 0 : products.content, function (product) {
|
|
5087
|
-
return Promise.resolve(API
|
|
5170
|
+
return Promise.resolve(API({
|
|
5088
5171
|
apiEndPoint: apiEndPoint,
|
|
5089
5172
|
url: "/ecommerce/product/" + (product === null || product === void 0 ? void 0 : product.productId) + "?storeIds=2"
|
|
5090
5173
|
})).then(function (childProducts) {
|
|
@@ -5316,7 +5399,7 @@ var CartPageSection = styled__default.section(_templateObject$s || (_templateObj
|
|
|
5316
5399
|
}, function (props) {
|
|
5317
5400
|
return props.bg || '#FAE8E5';
|
|
5318
5401
|
});
|
|
5319
|
-
var CartPageContainer = styled__default.div(_templateObject2$i || (_templateObject2$i = _taggedTemplateLiteralLoose(["\n max-width: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n padding: 2rem;\n padding-bottom: 2em;\n border-radius: 12px;\n opacity: ", ";\n .scrollDiv {\n width: 68%;\n
|
|
5402
|
+
var CartPageContainer = styled__default.div(_templateObject2$i || (_templateObject2$i = _taggedTemplateLiteralLoose(["\n max-width: ", ";\n width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n padding: 2rem;\n padding-bottom: 2em;\n border-radius: 12px;\n opacity: ", ";\n .scrollDiv {\n width: 68%;\n max-height: 630px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n margin-right: 0.3em;\n &::-webkit-scrollbar {\n width: 10px;\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 /* 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: 1rem 0;\n .scrollDiv {\n width: 100%;\n margin: 0;\n margin-bottom: 2em;\n // padding: 0 0.4em;\n }\n }\n"])), function (props) {
|
|
5320
5403
|
return props.maxWidth || '1600px';
|
|
5321
5404
|
}, function (props) {
|
|
5322
5405
|
return "min(" + (props.maxWidth || '1600px') + ",100%)";
|
|
@@ -5345,7 +5428,7 @@ var CartTableCell = styled__default(material.TableCell)(_templateObject6$5 || (_
|
|
|
5345
5428
|
}, function (props) {
|
|
5346
5429
|
return "" + props.color || 'inherit';
|
|
5347
5430
|
});
|
|
5348
|
-
var CartTableContainer = styled__default(material.TableContainer)(_templateObject7$4 || (_templateObject7$4 = _taggedTemplateLiteralLoose(["\n max-height: 580px;\n
|
|
5431
|
+
var CartTableContainer = styled__default(material.TableContainer)(_templateObject7$4 || (_templateObject7$4 = _taggedTemplateLiteralLoose(["\n max-height: 580px;\n padding-right: 1rem;\n\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) {
|
|
5349
5432
|
return 'rgba(102, 112, 128, 0.5)';
|
|
5350
5433
|
}, function (props) {
|
|
5351
5434
|
return props.color;
|
|
@@ -6847,7 +6930,7 @@ function EnhancedTable(_ref) {
|
|
|
6847
6930
|
handleIncrementDecrement: handleIncrementDecrement,
|
|
6848
6931
|
handleRemoveProduct: handleRemoveProduct
|
|
6849
6932
|
});
|
|
6850
|
-
}))))), /*#__PURE__*/React.createElement(CartButtonsRow, {
|
|
6933
|
+
}))))), (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length) > 0 && /*#__PURE__*/React.createElement(CartButtonsRow, {
|
|
6851
6934
|
bg: styles === null || styles === void 0 ? void 0 : (_styles$Btn2 = styles.Btn) === null || _styles$Btn2 === void 0 ? void 0 : _styles$Btn2.background,
|
|
6852
6935
|
color: styles === null || styles === void 0 ? void 0 : (_styles$Btn3 = styles.Btn) === null || _styles$Btn3 === void 0 ? void 0 : _styles$Btn3.color
|
|
6853
6936
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -6989,7 +7072,7 @@ var CartPageMainRetail = function CartPageMainRetail(_ref) {
|
|
|
6989
7072
|
};
|
|
6990
7073
|
|
|
6991
7074
|
var _templateObject$v, _templateObject2$l, _templateObject3$f, _templateObject4$c, _templateObject5$a, _templateObject6$8, _templateObject7$6, _templateObject8$4;
|
|
6992
|
-
var CartSummaryContainer = styled__default.div(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n width: 25rem;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n border-radius: 20px;\n padding: 2em
|
|
7075
|
+
var CartSummaryContainer = styled__default.div(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n width: 25rem;\n max-width: 100%;\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n border-radius: 20px;\n padding: 2em;\n align-items: center;\n /* margin-top: 3em; */\n p {\n font-size: 1.189em;\n font-weight: 600;\n align-self: flex-start;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n .continueShopping {\n font-size: 0.75em;\n color: inherit;\n text-transform: capitalize;\n height: 20px;\n border-bottom: 1px solid;\n border-color: ", ";\n cursor: pointer;\n }\n"])), function (props) {
|
|
6993
7076
|
return props.background || '#667080';
|
|
6994
7077
|
}, function (props) {
|
|
6995
7078
|
return props.color || 'white';
|
|
@@ -7001,10 +7084,10 @@ var CartSummaryRow = styled__default.div(_templateObject2$l || (_templateObject2
|
|
|
7001
7084
|
}, function (props) {
|
|
7002
7085
|
return props.h5 || '1.31em';
|
|
7003
7086
|
});
|
|
7004
|
-
var CartSummaryHr = styled__default.span(_templateObject3$f || (_templateObject3$f = _taggedTemplateLiteralLoose(["\n border: none;\n width: 100%;\n height: 1px;\n background-color: ", ";\n margin:
|
|
7087
|
+
var CartSummaryHr = styled__default.span(_templateObject3$f || (_templateObject3$f = _taggedTemplateLiteralLoose(["\n border: none;\n width: 100%;\n height: 1px;\n background-color: ", ";\n margin: 1em 0;\n"])), function (props) {
|
|
7005
7088
|
return props.color || 'rgba(255, 255, 255, 0.5)';
|
|
7006
7089
|
});
|
|
7007
|
-
var CartSummaryInputBox = styled__default.form(_templateObject4$c || (_templateObject4$c = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding-bottom: ", ";\n background-color: transparent;\n width: 100%;\n input {\n width: 65%;\n height: 2.
|
|
7090
|
+
var CartSummaryInputBox = styled__default.form(_templateObject4$c || (_templateObject4$c = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding-bottom: ", ";\n background-color: transparent;\n width: 100%;\n input {\n width: 65%;\n height: 2.5rem;\n padding: 0.2rem 0.8rem;\n font-size: 0.89rem;\n border: none;\n outline: none;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n }\n }\n button {\n width: 35%;\n height: 2.5rem;\n line-height: 0.8rem;\n background: ", ";\n display: grid;\n color: ", ";\n place-items: center;\n border: none;\n border-radius: 0;\n outline: none;\n text-transform: uppercase;\n cursor: pointer;\n font-size: 0.75em;\n transition: 0.3s;\n &:hover {\n letter-spacing: 1px;\n background: ", ";\n }\n }\n"])), function (props) {
|
|
7008
7091
|
return props.paddingBottom ? '0' : '0';
|
|
7009
7092
|
}, function (props) {
|
|
7010
7093
|
return props.background || '#bfc3ca';
|
|
@@ -7019,8 +7102,8 @@ var CartSummaryInputBox = styled__default.form(_templateObject4$c || (_templateO
|
|
|
7019
7102
|
}, function (props) {
|
|
7020
7103
|
return props.btn || '#393f48';
|
|
7021
7104
|
});
|
|
7022
|
-
var DiscountCouponContainer = styled__default.div(_templateObject5$a || (_templateObject5$a = _taggedTemplateLiteralLoose(["\n padding: 0.
|
|
7023
|
-
var DiscountCouponCard = styled__default.div(_templateObject6$8 || (_templateObject6$8 = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n padding: 0.3rem;\n
|
|
7105
|
+
var DiscountCouponContainer = styled__default.div(_templateObject5$a || (_templateObject5$a = _taggedTemplateLiteralLoose(["\n padding-top: 0.5rem;\n width: 100%;\n max-height: 200px;\n overflow: auto;\n"])));
|
|
7106
|
+
var DiscountCouponCard = styled__default.div(_templateObject6$8 || (_templateObject6$8 = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.3rem;\n button {\n color: ", ";\n font-size: 1.4rem;\n &:hover {\n color: red;\n }\n }\n"])), function (props) {
|
|
7024
7107
|
return props.btn || '#393f48';
|
|
7025
7108
|
});
|
|
7026
7109
|
var CartSummaryCheckoutBtn = styled__default.button(_templateObject7$6 || (_templateObject7$6 = _taggedTemplateLiteralLoose(["\n font-size: 0.95em;\n font-weight: 600;\n background: ", ";\n color: ", ";\n cursor: pointer;\n text-transform: uppercase;\n border: none;\n outline: none;\n width: 16.81em;\n height: 3.4em;\n display: grid;\n place-items: center;\n font-size: 0.75em;\n padding: 0;\n font-size: 0.94em;\n margin: 1em auto;\n transition: 0.3s;\n margin-top: 3em;\n &:hover {\n opacity: 0.8;\n }\n"])), function (props) {
|
|
@@ -7048,7 +7131,8 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7048
7131
|
onChangeDiscountCoupon = _ref.onChangeDiscountCoupon,
|
|
7049
7132
|
_ref$discountCoupons = _ref.discountCoupons,
|
|
7050
7133
|
discountCoupons = _ref$discountCoupons === void 0 ? [] : _ref$discountCoupons,
|
|
7051
|
-
cartDiscount = _ref.cartDiscount
|
|
7134
|
+
cartDiscount = _ref.cartDiscount,
|
|
7135
|
+
couponDiscountTotal = _ref.couponDiscountTotal;
|
|
7052
7136
|
var storeIdList = (storeData === null || storeData === void 0 ? void 0 : (_storeData$map = storeData.map(function (data) {
|
|
7053
7137
|
return data === null || data === void 0 ? void 0 : data.id;
|
|
7054
7138
|
})) === null || _storeData$map === void 0 ? void 0 : _storeData$map.join(',')) || 2;
|
|
@@ -7060,14 +7144,12 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7060
7144
|
var _useState2 = React.useState(''),
|
|
7061
7145
|
couponText = _useState2[0],
|
|
7062
7146
|
setCouponText = _useState2[1];
|
|
7063
|
-
var _useState3 = React.useState(discountCoupons),
|
|
7064
|
-
discountCouponData = _useState3[0],
|
|
7065
|
-
setDiscountCouponData = _useState3[1];
|
|
7066
7147
|
var ValidateDiscountCoupon = function ValidateDiscountCoupon(value) {
|
|
7067
7148
|
try {
|
|
7068
7149
|
var _temp3 = function () {
|
|
7069
7150
|
if (apiEndPoint && token) {
|
|
7070
7151
|
var _temp2 = function _temp2() {
|
|
7152
|
+
setCouponText('');
|
|
7071
7153
|
setButtonLoading(false);
|
|
7072
7154
|
};
|
|
7073
7155
|
var couponListObj = {
|
|
@@ -7076,23 +7158,14 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7076
7158
|
};
|
|
7077
7159
|
setButtonLoading(true);
|
|
7078
7160
|
var _temp = _catch(function () {
|
|
7079
|
-
return Promise.resolve(
|
|
7161
|
+
return Promise.resolve(validateDiscount({
|
|
7080
7162
|
apiEndPoint: apiEndPoint,
|
|
7081
7163
|
token: token,
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
})).then(function (
|
|
7086
|
-
|
|
7087
|
-
return {
|
|
7088
|
-
id: item.discountId,
|
|
7089
|
-
discountName: item.discountName,
|
|
7090
|
-
couponCode: item.couponCode,
|
|
7091
|
-
amount: item.amount
|
|
7092
|
-
};
|
|
7093
|
-
});
|
|
7094
|
-
setDiscountCouponData(lodash.uniqBy([].concat(discountCouponData, couponData), 'id'));
|
|
7095
|
-
onChangeDiscountCoupon && onChangeDiscountCoupon(lodash.uniqBy([].concat(discountCouponData, couponData), 'id'));
|
|
7164
|
+
body: couponListObj,
|
|
7165
|
+
storeIdList: storeIdList,
|
|
7166
|
+
cartAmount: subtotal
|
|
7167
|
+
})).then(function () {
|
|
7168
|
+
onChangeDiscountCoupon && onChangeDiscountCoupon();
|
|
7096
7169
|
});
|
|
7097
7170
|
}, function () {});
|
|
7098
7171
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
@@ -7103,10 +7176,6 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7103
7176
|
return Promise.reject(e);
|
|
7104
7177
|
}
|
|
7105
7178
|
};
|
|
7106
|
-
var discountTotal = cartDiscount || 0;
|
|
7107
|
-
discountCouponData === null || discountCouponData === void 0 ? void 0 : discountCouponData.forEach(function (element) {
|
|
7108
|
-
discountTotal = discountTotal + element.amount;
|
|
7109
|
-
});
|
|
7110
7179
|
return /*#__PURE__*/React__default.createElement(CartSummaryContainer, {
|
|
7111
7180
|
background: cartSummary.bg,
|
|
7112
7181
|
color: cartSummary.color
|
|
@@ -7114,7 +7183,7 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7114
7183
|
color: cartSummary.hr
|
|
7115
7184
|
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "subtotal"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(subtotal))), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
7116
7185
|
color: cartSummary.hr
|
|
7117
|
-
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "Discount"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(
|
|
7186
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "Order Discount"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(cartDiscount))), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
7118
7187
|
color: cartSummary.hr
|
|
7119
7188
|
}), /*#__PURE__*/React__default.createElement(CartSummaryInputBox, {
|
|
7120
7189
|
background: cartSummary === null || cartSummary === void 0 ? void 0 : (_cartSummary$input = cartSummary.input) === null || _cartSummary$input === void 0 ? void 0 : _cartSummary$input.bg,
|
|
@@ -7138,32 +7207,31 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7138
7207
|
type: "submit",
|
|
7139
7208
|
variant: "contained",
|
|
7140
7209
|
loading: buttonLoading
|
|
7141
|
-
}, "apply coupon")), /*#__PURE__*/React__default.createElement(DiscountCouponContainer, {
|
|
7210
|
+
}, "apply coupon")), (discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.length) > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DiscountCouponContainer, {
|
|
7142
7211
|
background: cartSummary === null || cartSummary === void 0 ? void 0 : (_cartSummary$input3 = cartSummary.input) === null || _cartSummary$input3 === void 0 ? void 0 : _cartSummary$input3.bg,
|
|
7143
7212
|
color: cartSummary === null || cartSummary === void 0 ? void 0 : (_cartSummary$input4 = cartSummary.input) === null || _cartSummary$input4 === void 0 ? void 0 : _cartSummary$input4.color,
|
|
7144
7213
|
btn: Btn === null || Btn === void 0 ? void 0 : Btn.background,
|
|
7145
7214
|
Btncolor: Btn === null || Btn === void 0 ? void 0 : Btn.color
|
|
7146
|
-
},
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
onChangeDiscountCoupon(data);
|
|
7160
|
-
}
|
|
7161
|
-
}));
|
|
7215
|
+
}, discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.map(function (coupon, index) {
|
|
7216
|
+
return /*#__PURE__*/React__default.createElement(DiscountItemCard, {
|
|
7217
|
+
key: index,
|
|
7218
|
+
index: index,
|
|
7219
|
+
discountCoupons: discountCoupons,
|
|
7220
|
+
cartSummary: cartSummary,
|
|
7221
|
+
Btn: Btn,
|
|
7222
|
+
coupon: coupon,
|
|
7223
|
+
deleteCartDiscount: deleteCartDiscount,
|
|
7224
|
+
onChangeDiscountCoupon: onChangeDiscountCoupon,
|
|
7225
|
+
apiEndPoint: apiEndPoint,
|
|
7226
|
+
token: token
|
|
7227
|
+
});
|
|
7162
7228
|
})), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
7163
7229
|
color: cartSummary.hr
|
|
7230
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "Coupon Discount"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(couponDiscountTotal)))), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
7231
|
+
color: cartSummary.hr
|
|
7164
7232
|
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
7165
7233
|
h5: "1.64em"
|
|
7166
|
-
}, /*#__PURE__*/React__default.createElement("h6", null, "order total"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(totalCartPrice + ((selectedShipping === null || selectedShipping === void 0 ? void 0 : selectedShipping.amount) || 0) -
|
|
7234
|
+
}, /*#__PURE__*/React__default.createElement("h6", null, "order total"), /*#__PURE__*/React__default.createElement("h5", null, renderMoney(totalCartPrice + ((selectedShipping === null || selectedShipping === void 0 ? void 0 : selectedShipping.amount) || 0) - couponDiscountTotal))), /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
7167
7235
|
justify: "center"
|
|
7168
7236
|
}, /*#__PURE__*/React__default.createElement(CartSummaryCheckoutBtn, {
|
|
7169
7237
|
onClick: function onClick() {
|
|
@@ -7182,6 +7250,62 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7182
7250
|
}
|
|
7183
7251
|
}, "Continue to shopping")));
|
|
7184
7252
|
};
|
|
7253
|
+
var DiscountItemCard = function DiscountItemCard(_ref2) {
|
|
7254
|
+
var _cartSummary$input5, _cartSummary$input6;
|
|
7255
|
+
var index = _ref2.index,
|
|
7256
|
+
discountCoupons = _ref2.discountCoupons,
|
|
7257
|
+
cartSummary = _ref2.cartSummary,
|
|
7258
|
+
Btn = _ref2.Btn,
|
|
7259
|
+
coupon = _ref2.coupon,
|
|
7260
|
+
deleteCartDiscount = _ref2.deleteCartDiscount,
|
|
7261
|
+
onChangeDiscountCoupon = _ref2.onChangeDiscountCoupon,
|
|
7262
|
+
apiEndPoint = _ref2.apiEndPoint,
|
|
7263
|
+
token = _ref2.token;
|
|
7264
|
+
var _useState3 = React.useState(false),
|
|
7265
|
+
deleteLoading = _useState3[0],
|
|
7266
|
+
setDeleteLoading = _useState3[1];
|
|
7267
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
7268
|
+
style: {
|
|
7269
|
+
display: 'flex',
|
|
7270
|
+
flexDirection: 'column'
|
|
7271
|
+
}
|
|
7272
|
+
}, /*#__PURE__*/React__default.createElement(DiscountCouponCard, {
|
|
7273
|
+
background: cartSummary === null || cartSummary === void 0 ? void 0 : (_cartSummary$input5 = cartSummary.input) === null || _cartSummary$input5 === void 0 ? void 0 : _cartSummary$input5.bg,
|
|
7274
|
+
color: cartSummary === null || cartSummary === void 0 ? void 0 : (_cartSummary$input6 = cartSummary.input) === null || _cartSummary$input6 === void 0 ? void 0 : _cartSummary$input6.color,
|
|
7275
|
+
btn: Btn === null || Btn === void 0 ? void 0 : Btn.background,
|
|
7276
|
+
Btncolor: Btn === null || Btn === void 0 ? void 0 : Btn.color
|
|
7277
|
+
}, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", null, coupon === null || coupon === void 0 ? void 0 : coupon.couponCode)), /*#__PURE__*/React__default.createElement("b", null, renderMoney(coupon === null || coupon === void 0 ? void 0 : coupon.amount))), /*#__PURE__*/React__default.createElement(MuiIconButton, {
|
|
7278
|
+
loading: deleteLoading,
|
|
7279
|
+
onClick: function onClick() {
|
|
7280
|
+
try {
|
|
7281
|
+
var _temp6 = function _temp6() {
|
|
7282
|
+
setDeleteLoading(false);
|
|
7283
|
+
};
|
|
7284
|
+
setDeleteLoading(true);
|
|
7285
|
+
var _temp5 = _catch(function () {
|
|
7286
|
+
return Promise.resolve(deleteCartDiscount({
|
|
7287
|
+
apiEndPoint: apiEndPoint,
|
|
7288
|
+
token: token,
|
|
7289
|
+
discountId: coupon === null || coupon === void 0 ? void 0 : coupon.id
|
|
7290
|
+
})).then(function () {
|
|
7291
|
+
function _temp4(_onChangeDiscountCoup) {
|
|
7292
|
+
_onChangeDiscountCoup;
|
|
7293
|
+
}
|
|
7294
|
+
return onChangeDiscountCoupon ? Promise.resolve(onChangeDiscountCoupon()).then(_temp4) : _temp4(onChangeDiscountCoupon);
|
|
7295
|
+
});
|
|
7296
|
+
}, function () {});
|
|
7297
|
+
return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
|
|
7298
|
+
} catch (e) {
|
|
7299
|
+
return Promise.reject(e);
|
|
7300
|
+
}
|
|
7301
|
+
}
|
|
7302
|
+
}, /*#__PURE__*/React__default.createElement(md.MdDelete, null))), (discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.length) - 1 !== index && /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
7303
|
+
color: cartSummary.hr,
|
|
7304
|
+
style: {
|
|
7305
|
+
margin: 0
|
|
7306
|
+
}
|
|
7307
|
+
}));
|
|
7308
|
+
};
|
|
7185
7309
|
|
|
7186
7310
|
var CartPageComponent = function CartPageComponent(_ref) {
|
|
7187
7311
|
var _styles$input;
|
|
@@ -7198,8 +7322,6 @@ var CartPageComponent = function CartPageComponent(_ref) {
|
|
|
7198
7322
|
loading = _ref.loading,
|
|
7199
7323
|
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
7200
7324
|
styles = _ref.styles,
|
|
7201
|
-
onChangeDiscountCoupon = _ref.onChangeDiscountCoupon,
|
|
7202
|
-
discountCoupons = _ref.discountCoupons,
|
|
7203
7325
|
disabledSelectAllProductCheckbox = _ref.disabledSelectAllProductCheckbox;
|
|
7204
7326
|
var _useState = React.useState([]),
|
|
7205
7327
|
storeData = _useState[0],
|
|
@@ -7207,6 +7329,13 @@ var CartPageComponent = function CartPageComponent(_ref) {
|
|
|
7207
7329
|
var _useWindowSize = useWindowSize(),
|
|
7208
7330
|
width = _useWindowSize.width;
|
|
7209
7331
|
var retail = width <= 768;
|
|
7332
|
+
var _useState2 = React.useState([]),
|
|
7333
|
+
discountCoupons = _useState2[0],
|
|
7334
|
+
setDiscountCoupons = _useState2[1];
|
|
7335
|
+
var _useState3 = React.useState(),
|
|
7336
|
+
customer = _useState3[0],
|
|
7337
|
+
setCustomer = _useState3[1];
|
|
7338
|
+
var couponDiscountTotal = lodash.sumBy(discountCoupons, 'amount');
|
|
7210
7339
|
React.useEffect(function () {
|
|
7211
7340
|
(function () {
|
|
7212
7341
|
try {
|
|
@@ -7230,6 +7359,77 @@ var CartPageComponent = function CartPageComponent(_ref) {
|
|
|
7230
7359
|
}
|
|
7231
7360
|
})();
|
|
7232
7361
|
}, []);
|
|
7362
|
+
React.useEffect(function () {
|
|
7363
|
+
(function () {
|
|
7364
|
+
try {
|
|
7365
|
+
var _temp4 = function () {
|
|
7366
|
+
if (apiEndPoint && token) {
|
|
7367
|
+
var _temp3 = _catch(function () {
|
|
7368
|
+
return Promise.resolve(API({
|
|
7369
|
+
apiEndPoint: apiEndPoint,
|
|
7370
|
+
token: token,
|
|
7371
|
+
url: "/ecommerce/customer",
|
|
7372
|
+
hideErrorMessage: true
|
|
7373
|
+
})).then(function (data) {
|
|
7374
|
+
setCustomer(data);
|
|
7375
|
+
});
|
|
7376
|
+
}, function () {});
|
|
7377
|
+
if (_temp3 && _temp3.then) return _temp3.then(function () {});
|
|
7378
|
+
}
|
|
7379
|
+
}();
|
|
7380
|
+
return _temp4 && _temp4.then ? _temp4.then(function () {}) : void 0;
|
|
7381
|
+
} catch (e) {
|
|
7382
|
+
Promise.reject(e);
|
|
7383
|
+
}
|
|
7384
|
+
})();
|
|
7385
|
+
}, [token]);
|
|
7386
|
+
React.useEffect(function () {
|
|
7387
|
+
(function () {
|
|
7388
|
+
try {
|
|
7389
|
+
var _temp5 = function () {
|
|
7390
|
+
if (customer) {
|
|
7391
|
+
return Promise.resolve(getDiscountList()).then(function () {});
|
|
7392
|
+
}
|
|
7393
|
+
}();
|
|
7394
|
+
return _temp5 && _temp5.then ? _temp5.then(function () {}) : void 0;
|
|
7395
|
+
} catch (e) {
|
|
7396
|
+
Promise.reject(e);
|
|
7397
|
+
}
|
|
7398
|
+
})();
|
|
7399
|
+
}, [cartData, customer]);
|
|
7400
|
+
var inDebounce;
|
|
7401
|
+
var getDiscountList = function getDiscountList() {
|
|
7402
|
+
try {
|
|
7403
|
+
inDebounce = setTimeout(function () {
|
|
7404
|
+
(function () {
|
|
7405
|
+
try {
|
|
7406
|
+
var _temp7 = function () {
|
|
7407
|
+
if (apiEndPoint && token) {
|
|
7408
|
+
var _temp6 = _catch(function () {
|
|
7409
|
+
return Promise.resolve(getCartDiscountList({
|
|
7410
|
+
apiEndPoint: apiEndPoint,
|
|
7411
|
+
token: token
|
|
7412
|
+
})).then(function (data) {
|
|
7413
|
+
setDiscountCoupons(data);
|
|
7414
|
+
});
|
|
7415
|
+
}, function () {});
|
|
7416
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
7417
|
+
}
|
|
7418
|
+
}();
|
|
7419
|
+
return _temp7 && _temp7.then ? _temp7.then(function () {}) : void 0;
|
|
7420
|
+
} catch (e) {
|
|
7421
|
+
Promise.reject(e);
|
|
7422
|
+
}
|
|
7423
|
+
})();
|
|
7424
|
+
}, 500);
|
|
7425
|
+
return Promise.resolve();
|
|
7426
|
+
} catch (e) {
|
|
7427
|
+
return Promise.reject(e);
|
|
7428
|
+
}
|
|
7429
|
+
};
|
|
7430
|
+
var onChangeDiscountCoupon = function onChangeDiscountCoupon() {
|
|
7431
|
+
return Promise.resolve(getDiscountList()).then(function () {});
|
|
7432
|
+
};
|
|
7233
7433
|
var onChangeQuantity = function onChangeQuantity(product) {
|
|
7234
7434
|
handleIncrementDecrement(product, product);
|
|
7235
7435
|
};
|
|
@@ -7277,7 +7477,8 @@ var CartPageComponent = function CartPageComponent(_ref) {
|
|
|
7277
7477
|
loading: loading,
|
|
7278
7478
|
cartDiscount: cartData === null || cartData === void 0 ? void 0 : cartData.cartDiscount,
|
|
7279
7479
|
onChangeDiscountCoupon: onChangeDiscountCoupon,
|
|
7280
|
-
discountCoupons: discountCoupons
|
|
7480
|
+
discountCoupons: discountCoupons,
|
|
7481
|
+
couponDiscountTotal: couponDiscountTotal
|
|
7281
7482
|
})));
|
|
7282
7483
|
};
|
|
7283
7484
|
var checkMinMaxQty = function checkMinMaxQty(_ref2) {
|
|
@@ -7637,7 +7838,7 @@ var HomeBanner = function HomeBanner(_ref) {
|
|
|
7637
7838
|
};
|
|
7638
7839
|
setLoading(true);
|
|
7639
7840
|
var _temp = _catch(function () {
|
|
7640
|
-
return Promise.resolve(API
|
|
7841
|
+
return Promise.resolve(API({
|
|
7641
7842
|
apiEndPoint: apiEndPoint,
|
|
7642
7843
|
token: token,
|
|
7643
7844
|
url: "/home/sliderTypes"
|
|
@@ -7665,7 +7866,7 @@ var HomeBanner = function HomeBanner(_ref) {
|
|
|
7665
7866
|
return Promise.resolve(function () {
|
|
7666
7867
|
if (businessTypeId) {
|
|
7667
7868
|
return _catch(function () {
|
|
7668
|
-
return Promise.resolve(API
|
|
7869
|
+
return Promise.resolve(API({
|
|
7669
7870
|
apiEndPoint: apiEndPoint,
|
|
7670
7871
|
token: token,
|
|
7671
7872
|
url: "/home/sliderImages?sliderTypeId=" + sliderTypeId + "&businessTypeId=" + businessTypeId
|
|
@@ -7826,7 +8027,7 @@ var OutOfStock = function OutOfStock(_ref) {
|
|
|
7826
8027
|
}
|
|
7827
8028
|
var _temp = function () {
|
|
7828
8029
|
if (tag === 'variant') {
|
|
7829
|
-
return Promise.resolve(API
|
|
8030
|
+
return Promise.resolve(API({
|
|
7830
8031
|
apiEndPoint: apiEndPoint,
|
|
7831
8032
|
method: 'POST',
|
|
7832
8033
|
url: "/ecommerce/product/notifyWhenInStock",
|
|
@@ -7835,7 +8036,7 @@ var OutOfStock = function OutOfStock(_ref) {
|
|
|
7835
8036
|
successMessage: 'Created notification successfully.'
|
|
7836
8037
|
})).then(function () {});
|
|
7837
8038
|
} else {
|
|
7838
|
-
return Promise.resolve(API
|
|
8039
|
+
return Promise.resolve(API({
|
|
7839
8040
|
apiEndPoint: apiEndPoint,
|
|
7840
8041
|
method: 'POST',
|
|
7841
8042
|
url: "/ecommerce/product/notifyWhenInStock",
|
|
@@ -8208,7 +8409,7 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
8208
8409
|
if (!(scanningRef !== null && scanningRef !== void 0 && scanningRef.current) && apiData && apiData.url) {
|
|
8209
8410
|
var defaultQueryParams = (apiData.getQueryParams ? apiData.getQueryParams() : apiData.queryParams) || {};
|
|
8210
8411
|
var defaultParam = !apiData.getQueryParams && {};
|
|
8211
|
-
return Promise.resolve(API
|
|
8412
|
+
return Promise.resolve(API(_extends({}, apiData, {
|
|
8212
8413
|
isCancelToken: false,
|
|
8213
8414
|
queryParams: _extends({
|
|
8214
8415
|
size: DEFAULT_SEARCH_RESULT_SIZE
|
|
@@ -8259,7 +8460,7 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
8259
8460
|
var _ref2;
|
|
8260
8461
|
var defaultQueryParams = (apiData.getQueryParams ? apiData.getQueryParams(searchValue) : apiData.queryParams) || {};
|
|
8261
8462
|
var defaultParam = !apiData.getQueryParams && (_ref2 = {}, _ref2[queryParam] = searchValue, _ref2);
|
|
8262
|
-
return Promise.resolve(API
|
|
8463
|
+
return Promise.resolve(API(_extends({}, apiData, {
|
|
8263
8464
|
isCancelToken: true,
|
|
8264
8465
|
queryParams: _extends({
|
|
8265
8466
|
size: DEFAULT_SEARCH_RESULT_SIZE
|
|
@@ -8319,7 +8520,7 @@ var AsyncSelectField = function AsyncSelectField(_ref) {
|
|
|
8319
8520
|
var _temp9 = function () {
|
|
8320
8521
|
if (isSearchProduct && apiData && apiData.url && searchValue.length >= minSearchChar) {
|
|
8321
8522
|
var defaultQueryParams = (apiData.getScanQueryParams ? apiData.getScanQueryParams(searchValue) : apiData.queryParams) || {};
|
|
8322
|
-
return Promise.resolve(API
|
|
8523
|
+
return Promise.resolve(API(_extends({}, apiData, {
|
|
8323
8524
|
url: apiData.scanUrl,
|
|
8324
8525
|
queryParams: _extends({}, defaultQueryParams, {
|
|
8325
8526
|
size: DEFAULT_SEARCH_RESULT_SIZE
|
|
@@ -8632,7 +8833,7 @@ var CartPageSection$1 = styled__default.section(_templateObject$E || (_templateO
|
|
|
8632
8833
|
}, function (props) {
|
|
8633
8834
|
return props.bg || '#FAE8E5';
|
|
8634
8835
|
});
|
|
8635
|
-
var CartPageContainer$1 = styled__default.div(_templateObject2$s || (_templateObject2$s = _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
|
|
8836
|
+
var CartPageContainer$1 = styled__default.div(_templateObject2$s || (_templateObject2$s = _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) {
|
|
8636
8837
|
return props.maxWidth || '1600px';
|
|
8637
8838
|
}, function (props) {
|
|
8638
8839
|
return "min(" + (props.maxWidth || '1600px') + ",100%)";
|
|
@@ -8931,7 +9132,7 @@ var QuickOrder = function QuickOrder(_ref) {
|
|
|
8931
9132
|
(function () {
|
|
8932
9133
|
try {
|
|
8933
9134
|
var _temp = _catch(function () {
|
|
8934
|
-
return Promise.resolve(API
|
|
9135
|
+
return Promise.resolve(API({
|
|
8935
9136
|
apiEndPoint: apiEndPoint,
|
|
8936
9137
|
token: token,
|
|
8937
9138
|
url: "/store"
|
|
@@ -9174,7 +9375,7 @@ var StaticPageList = function StaticPageList(_ref) {
|
|
|
9174
9375
|
};
|
|
9175
9376
|
setLoading(true);
|
|
9176
9377
|
var _temp = _catch(function () {
|
|
9177
|
-
return Promise.resolve(API
|
|
9378
|
+
return Promise.resolve(API({
|
|
9178
9379
|
apiEndPoint: apiEndPoint,
|
|
9179
9380
|
url: "/ecommerce/staticPage/list?page=0&size=9999",
|
|
9180
9381
|
queryParams: queryParams
|
|
@@ -9302,12 +9503,12 @@ var SwitchUser = function SwitchUser(_ref) {
|
|
|
9302
9503
|
try {
|
|
9303
9504
|
if (token && apiEndPoint) {
|
|
9304
9505
|
try {
|
|
9305
|
-
var getCustomer = API
|
|
9506
|
+
var getCustomer = API({
|
|
9306
9507
|
apiEndPoint: apiEndPoint,
|
|
9307
9508
|
token: token,
|
|
9308
9509
|
url: "/ecommerce/customer"
|
|
9309
9510
|
});
|
|
9310
|
-
var getChildCustomer = API
|
|
9511
|
+
var getChildCustomer = API({
|
|
9311
9512
|
apiEndPoint: apiEndPoint,
|
|
9312
9513
|
token: token,
|
|
9313
9514
|
url: "/ecommerce/customer/child"
|
|
@@ -9487,12 +9688,7 @@ var CheckoutSummary = function CheckoutSummary(_ref) {
|
|
|
9487
9688
|
shippingMethod = _ref.shippingMethod,
|
|
9488
9689
|
bg = _ref.bg,
|
|
9489
9690
|
color = _ref.color,
|
|
9490
|
-
discountCoupons = _ref.discountCoupons,
|
|
9491
9691
|
orderTotal = _ref.orderTotal;
|
|
9492
|
-
var discountTotal = 0;
|
|
9493
|
-
discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.forEach(function (element) {
|
|
9494
|
-
discountTotal = discountTotal + element.amount;
|
|
9495
|
-
});
|
|
9496
9692
|
return /*#__PURE__*/React__default.createElement(CheckoutSummaryContainer, {
|
|
9497
9693
|
bg: bg,
|
|
9498
9694
|
color: color
|
|
@@ -9507,14 +9703,21 @@ var CheckoutSummary = function CheckoutSummary(_ref) {
|
|
|
9507
9703
|
style: {
|
|
9508
9704
|
fontSize: '1rem'
|
|
9509
9705
|
}
|
|
9510
|
-
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.taxAmount) || 0))) : null,
|
|
9706
|
+
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.taxAmount) || 0))) : null, (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.cartDiscount) > 0 ? /*#__PURE__*/React__default.createElement(TextRow, null, /*#__PURE__*/React__default.createElement("p", {
|
|
9707
|
+
className: "text"
|
|
9708
|
+
}, "Order Discount:"), /*#__PURE__*/React__default.createElement("h6", {
|
|
9709
|
+
className: "total",
|
|
9710
|
+
style: {
|
|
9711
|
+
fontSize: '1rem'
|
|
9712
|
+
}
|
|
9713
|
+
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.cartDiscount) || 0))) : null, (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.couponDiscountTotal) > 0 ? /*#__PURE__*/React__default.createElement(TextRow, null, /*#__PURE__*/React__default.createElement("p", {
|
|
9511
9714
|
className: "text"
|
|
9512
|
-
}, "Discount
|
|
9715
|
+
}, "Coupon Discount:"), /*#__PURE__*/React__default.createElement("h6", {
|
|
9513
9716
|
className: "total",
|
|
9514
9717
|
style: {
|
|
9515
9718
|
fontSize: '1rem'
|
|
9516
9719
|
}
|
|
9517
|
-
}, renderMoney(
|
|
9720
|
+
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.couponDiscountTotal) || 0))) : null, /*#__PURE__*/React__default.createElement(FilledInfo, null, /*#__PURE__*/React__default.createElement("h6", {
|
|
9518
9721
|
className: "heading"
|
|
9519
9722
|
}, "Billing Information"), billingInformation ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
|
|
9520
9723
|
className: "bold"
|
|
@@ -10149,14 +10352,9 @@ var Step2 = function Step2(_ref) {
|
|
|
10149
10352
|
showShipping = _ref.showShipping,
|
|
10150
10353
|
styles = _ref.styles,
|
|
10151
10354
|
shippingAddressId = _ref.shippingAddressId,
|
|
10152
|
-
discountCoupons = _ref.discountCoupons,
|
|
10153
10355
|
showShippingPriceRangeLimit = _ref.showShippingPriceRangeLimit,
|
|
10154
10356
|
customer = _ref.customer;
|
|
10155
|
-
var
|
|
10156
|
-
discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.forEach(function (element) {
|
|
10157
|
-
discountTotal = discountTotal + element.amount;
|
|
10158
|
-
});
|
|
10159
|
-
var totalCartPrice = ((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount) || 0) - discountTotal;
|
|
10357
|
+
var totalCartPrice = (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount) || 0;
|
|
10160
10358
|
var modifyOptions = (_filter = lodash.filter(options, {
|
|
10161
10359
|
ecommerce: true
|
|
10162
10360
|
})) === null || _filter === void 0 ? void 0 : _filter.map(function (item) {
|
|
@@ -10283,7 +10481,7 @@ var Step2 = function Step2(_ref) {
|
|
|
10283
10481
|
return Promise.resolve(function () {
|
|
10284
10482
|
if (shipStore || shipStore !== null && shipStore !== void 0 && shipStore.showSkuOnSalePage) {
|
|
10285
10483
|
return _catch(function () {
|
|
10286
|
-
return Promise.resolve(API
|
|
10484
|
+
return Promise.resolve(API({
|
|
10287
10485
|
apiEndPoint: apiEndPoint,
|
|
10288
10486
|
token: token,
|
|
10289
10487
|
url: "/shipstation/getShippingRates",
|
|
@@ -10297,7 +10495,7 @@ var Step2 = function Step2(_ref) {
|
|
|
10297
10495
|
return function () {
|
|
10298
10496
|
if (carrier !== null && carrier !== void 0 && carrier.id) {
|
|
10299
10497
|
return _catch(function () {
|
|
10300
|
-
return Promise.resolve(API
|
|
10498
|
+
return Promise.resolve(API({
|
|
10301
10499
|
apiEndPoint: apiEndPoint,
|
|
10302
10500
|
token: token,
|
|
10303
10501
|
url: "/shipping/options/v1?parentShippingId=" + (carrier === null || carrier === void 0 ? void 0 : carrier.id)
|
|
@@ -11027,7 +11225,7 @@ var ConsentForm = function ConsentForm(_ref) {
|
|
|
11027
11225
|
};
|
|
11028
11226
|
setLoadingData(true);
|
|
11029
11227
|
var _temp = _catch(function () {
|
|
11030
|
-
return Promise.resolve(API
|
|
11228
|
+
return Promise.resolve(API({
|
|
11031
11229
|
apiEndPoint: apiEndPoint,
|
|
11032
11230
|
url: "/ecommerce/staticPage/list",
|
|
11033
11231
|
queryParams: {
|
|
@@ -11038,7 +11236,7 @@ var ConsentForm = function ConsentForm(_ref) {
|
|
|
11038
11236
|
})).then(function (staticPageDataResponse) {
|
|
11039
11237
|
var _staticPageDataRespon;
|
|
11040
11238
|
setStaticPageData(staticPageDataResponse === null || staticPageDataResponse === void 0 ? void 0 : (_staticPageDataRespon = staticPageDataResponse.content) === null || _staticPageDataRespon === void 0 ? void 0 : _staticPageDataRespon[0]);
|
|
11041
|
-
return Promise.resolve(API
|
|
11239
|
+
return Promise.resolve(API({
|
|
11042
11240
|
apiEndPoint: apiEndPoint,
|
|
11043
11241
|
token: token,
|
|
11044
11242
|
url: "/cartLineItem/totalTax",
|
|
@@ -11048,7 +11246,7 @@ var ConsentForm = function ConsentForm(_ref) {
|
|
|
11048
11246
|
}
|
|
11049
11247
|
})).then(function (taxDataResponse) {
|
|
11050
11248
|
setTaxData(taxDataResponse);
|
|
11051
|
-
return Promise.resolve(API
|
|
11249
|
+
return Promise.resolve(API({
|
|
11052
11250
|
apiEndPoint: apiEndPoint,
|
|
11053
11251
|
token: token,
|
|
11054
11252
|
url: "/store"
|
|
@@ -11228,7 +11426,7 @@ var PaypalComponent = function PaypalComponent(_ref) {
|
|
|
11228
11426
|
try {
|
|
11229
11427
|
var _temp2 = function () {
|
|
11230
11428
|
if (paymentWithPaypal) {
|
|
11231
|
-
return Promise.resolve(API
|
|
11429
|
+
return Promise.resolve(API({
|
|
11232
11430
|
apiEndPoint: apiEndPoint,
|
|
11233
11431
|
token: token,
|
|
11234
11432
|
url: "/payment/paypal/config"
|
|
@@ -11325,10 +11523,6 @@ var Step4 = function Step4(_ref) {
|
|
|
11325
11523
|
var _React$useState3 = React__default.useState(''),
|
|
11326
11524
|
comments = _React$useState3[0],
|
|
11327
11525
|
setComments = _React$useState3[1];
|
|
11328
|
-
var discountTotal = 0;
|
|
11329
|
-
discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.forEach(function (element) {
|
|
11330
|
-
discountTotal = discountTotal + element.amount;
|
|
11331
|
-
});
|
|
11332
11526
|
var storeCr = storeCredits > (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount) ? orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount : storeCredits;
|
|
11333
11527
|
var onSubmitPaypal = function onSubmitPaypal(transactionId) {
|
|
11334
11528
|
try {
|
|
@@ -11442,7 +11636,20 @@ var Step4 = function Step4(_ref) {
|
|
|
11442
11636
|
align: "right"
|
|
11443
11637
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11444
11638
|
className: "max sm primaryColor"
|
|
11445
|
-
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.taxAmount) || 0)))),
|
|
11639
|
+
}, renderMoney((orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.taxAmount) || 0)))), (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.cartDiscount) > 0 ? /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11640
|
+
colSpan: 1,
|
|
11641
|
+
noSmall: true
|
|
11642
|
+
}), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11643
|
+
colSpan: 1
|
|
11644
|
+
}), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11645
|
+
colSpan: 1
|
|
11646
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11647
|
+
className: "max sm"
|
|
11648
|
+
}, "Order Discount")), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11649
|
+
align: "right"
|
|
11650
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11651
|
+
className: "max sm primaryColor"
|
|
11652
|
+
}, renderMoney(orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.cartDiscount)))) : null, discountCoupons === null || discountCoupons === void 0 ? void 0 : discountCoupons.map(function (coupon) {
|
|
11446
11653
|
return /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11447
11654
|
colSpan: 1,
|
|
11448
11655
|
noSmall: true
|
|
@@ -11455,7 +11662,7 @@ var Step4 = function Step4(_ref) {
|
|
|
11455
11662
|
style: {
|
|
11456
11663
|
fontSize: '0.8rem'
|
|
11457
11664
|
}
|
|
11458
|
-
}, coupon === null || coupon === void 0 ? void 0 : coupon.
|
|
11665
|
+
}, coupon === null || coupon === void 0 ? void 0 : coupon.name)), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11459
11666
|
align: "right"
|
|
11460
11667
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11461
11668
|
className: "max sm primaryColor",
|
|
@@ -11463,7 +11670,7 @@ var Step4 = function Step4(_ref) {
|
|
|
11463
11670
|
fontSize: '0.8rem'
|
|
11464
11671
|
}
|
|
11465
11672
|
}, renderMoney(coupon === null || coupon === void 0 ? void 0 : coupon.amount))));
|
|
11466
|
-
}),
|
|
11673
|
+
}), (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.couponDiscountTotal) > 0 ? /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11467
11674
|
colSpan: 1,
|
|
11468
11675
|
noSmall: true
|
|
11469
11676
|
}), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
@@ -11472,11 +11679,11 @@ var Step4 = function Step4(_ref) {
|
|
|
11472
11679
|
colSpan: 1
|
|
11473
11680
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11474
11681
|
className: "max sm"
|
|
11475
|
-
}, "Discount
|
|
11682
|
+
}, "Total Coupon Discount")), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11476
11683
|
align: "right"
|
|
11477
11684
|
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11478
11685
|
className: "max sm primaryColor"
|
|
11479
|
-
}, renderMoney(
|
|
11686
|
+
}, renderMoney(orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.couponDiscountTotal)))) : null, storeCredits && storeCredits > 0 ? /*#__PURE__*/React__default.createElement(StyledTableRow, null, /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
11480
11687
|
colSpan: 1,
|
|
11481
11688
|
noSmall: true
|
|
11482
11689
|
}), /*#__PURE__*/React__default.createElement(StyledTableCell, {
|
|
@@ -11673,8 +11880,6 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11673
11880
|
cartData = _ref.cartData,
|
|
11674
11881
|
handleLogin = _ref.handleLogin,
|
|
11675
11882
|
placeOrder = _ref.placeOrder,
|
|
11676
|
-
_ref$discountCoupons = _ref.discountCoupons,
|
|
11677
|
-
discountCoupons = _ref$discountCoupons === void 0 ? [] : _ref$discountCoupons,
|
|
11678
11883
|
clickRedirect = _ref.clickRedirect,
|
|
11679
11884
|
shippingText = _ref.shippingText,
|
|
11680
11885
|
showShippingPriceRangeLimit = _ref.showShippingPriceRangeLimit,
|
|
@@ -11732,10 +11937,9 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11732
11937
|
var _useState17 = React.useState({}),
|
|
11733
11938
|
orderTotal = _useState17[0],
|
|
11734
11939
|
setOrderTotal = _useState17[1];
|
|
11735
|
-
var
|
|
11736
|
-
|
|
11737
|
-
|
|
11738
|
-
});
|
|
11940
|
+
var _useState18 = React.useState([]),
|
|
11941
|
+
discountCoupons = _useState18[0],
|
|
11942
|
+
setDiscountCoupons = _useState18[1];
|
|
11739
11943
|
React.useEffect(function () {
|
|
11740
11944
|
if (apiEndPoint && token) {
|
|
11741
11945
|
(function () {
|
|
@@ -11791,7 +11995,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11791
11995
|
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
11792
11996
|
}
|
|
11793
11997
|
var _temp3 = _catch(function () {
|
|
11794
|
-
return Promise.resolve(API
|
|
11998
|
+
return Promise.resolve(API({
|
|
11795
11999
|
apiEndPoint: apiEndPoint,
|
|
11796
12000
|
token: token,
|
|
11797
12001
|
url: "/shipping/options"
|
|
@@ -11802,7 +12006,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11802
12006
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
11803
12007
|
};
|
|
11804
12008
|
var _temp5 = _catch(function () {
|
|
11805
|
-
return Promise.resolve(API
|
|
12009
|
+
return Promise.resolve(API({
|
|
11806
12010
|
apiEndPoint: apiEndPoint,
|
|
11807
12011
|
token: token,
|
|
11808
12012
|
url: "/ecommerce/customer",
|
|
@@ -11827,63 +12031,96 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11827
12031
|
setCurrStep(0);
|
|
11828
12032
|
}
|
|
11829
12033
|
}, [customer, currStep]);
|
|
12034
|
+
var inDebounce;
|
|
11830
12035
|
React.useEffect(function () {
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
12036
|
+
if (customer) {
|
|
12037
|
+
cartTotalOnChangeData();
|
|
12038
|
+
}
|
|
12039
|
+
}, [customer, cartData, shippingMethod, ccProcessingFees, shippingAddressId]);
|
|
12040
|
+
var cartTotalOnChangeData = function cartTotalOnChangeData() {
|
|
12041
|
+
clearTimeout(inDebounce);
|
|
12042
|
+
inDebounce = setTimeout(function () {
|
|
12043
|
+
(function () {
|
|
12044
|
+
try {
|
|
12045
|
+
var _temp13 = function () {
|
|
12046
|
+
if (apiEndPoint && token) {
|
|
12047
|
+
var _temp12 = function _temp12() {
|
|
12048
|
+
function _temp10() {
|
|
12049
|
+
var _taxAmount, _ref2, _ref3, _cartData$cartDiscoun, _cartData$cartSubTota, _ref4;
|
|
12050
|
+
var totalData = {
|
|
12051
|
+
taxAmount: parseFloat((_taxAmount = _taxAmount2) === null || _taxAmount === void 0 ? void 0 : _taxAmount.toFixed(2)),
|
|
12052
|
+
shippingAmount: parseFloat((_ref2 = (shippingMethod === null || shippingMethod === void 0 ? void 0 : shippingMethod.amount) || 0) === null || _ref2 === void 0 ? void 0 : _ref2.toFixed(2)),
|
|
12053
|
+
couponDiscountTotal: _couponDiscountTotal,
|
|
12054
|
+
adjustmentValue: parseFloat((_ref3 = ccProcessingFees ? (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice) * (ccProcessingFees / 100) : 0) === null || _ref3 === void 0 ? void 0 : _ref3.toFixed(2)),
|
|
12055
|
+
cartDiscount: parseFloat(cartData === null || cartData === void 0 ? void 0 : (_cartData$cartDiscoun = cartData.cartDiscount) === null || _cartData$cartDiscoun === void 0 ? void 0 : _cartData$cartDiscoun.toFixed(2)),
|
|
12056
|
+
subTotal: parseFloat(cartData === null || cartData === void 0 ? void 0 : (_cartData$cartSubTota = cartData.cartSubTotal) === null || _cartData$cartSubTota === void 0 ? void 0 : _cartData$cartSubTota.toFixed(2)),
|
|
12057
|
+
totalAmount: parseFloat((_ref4 = (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice) + _taxAmount2 + ((shippingMethod === null || shippingMethod === void 0 ? void 0 : shippingMethod.amount) || 0) - _couponDiscountTotal + (ccProcessingFees ? (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice) * (ccProcessingFees / 100) : 0)) === null || _ref4 === void 0 ? void 0 : _ref4.toFixed(2)),
|
|
12058
|
+
totalQuantity: cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity
|
|
12059
|
+
};
|
|
12060
|
+
setOrderTotal(totalData);
|
|
12061
|
+
}
|
|
12062
|
+
var _temp9 = _catch(function () {
|
|
12063
|
+
return Promise.resolve(getCartDiscountList({
|
|
12064
|
+
apiEndPoint: apiEndPoint,
|
|
12065
|
+
token: token
|
|
12066
|
+
})).then(function (discountCouponsData) {
|
|
12067
|
+
var _ref5;
|
|
12068
|
+
_couponDiscountTotal = parseFloat((_ref5 = lodash.sumBy(discountCouponsData, 'amount') || 0) === null || _ref5 === void 0 ? void 0 : _ref5.toFixed(2));
|
|
12069
|
+
setDiscountCoupons(discountCouponsData);
|
|
12070
|
+
});
|
|
12071
|
+
}, function () {});
|
|
12072
|
+
return _temp9 && _temp9.then ? _temp9.then(_temp10) : _temp10(_temp9);
|
|
12073
|
+
};
|
|
12074
|
+
var _taxAmount2 = 0;
|
|
12075
|
+
var _couponDiscountTotal = 0;
|
|
12076
|
+
var _temp11 = function (_cartData$cartLineIte) {
|
|
12077
|
+
if (taxExempt && shippingAddressId && (cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.length) > 0) {
|
|
12078
|
+
var _temp8 = _catch(function () {
|
|
12079
|
+
return Promise.resolve(API({
|
|
12080
|
+
apiEndPoint: apiEndPoint,
|
|
12081
|
+
token: token,
|
|
12082
|
+
url: "/cartLineItem/totalTax",
|
|
12083
|
+
queryParams: {
|
|
12084
|
+
storeId: 2,
|
|
12085
|
+
customerShippingAddressId: shippingAddressId
|
|
12086
|
+
}
|
|
12087
|
+
})).then(function (taxData) {
|
|
12088
|
+
var _customer$customerDto;
|
|
12089
|
+
_taxAmount2 = !(customer !== null && customer !== void 0 && (_customer$customerDto = customer.customerDto) !== null && _customer$customerDto !== void 0 && _customer$customerDto.taxable) ? 0 : lodash.sumBy(taxData, 'taxAmount') || 0;
|
|
12090
|
+
});
|
|
12091
|
+
}, function () {});
|
|
12092
|
+
if (_temp8 && _temp8.then) return _temp8.then(function () {});
|
|
12093
|
+
}
|
|
12094
|
+
}();
|
|
12095
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
|
|
12096
|
+
}
|
|
12097
|
+
}();
|
|
12098
|
+
return _temp13 && _temp13.then ? _temp13.then(function () {}) : void 0;
|
|
12099
|
+
} catch (e) {
|
|
12100
|
+
Promise.reject(e);
|
|
12101
|
+
}
|
|
12102
|
+
})();
|
|
12103
|
+
}, 500);
|
|
12104
|
+
};
|
|
11868
12105
|
var onLoginCustomer = function onLoginCustomer(data) {
|
|
11869
12106
|
try {
|
|
11870
|
-
var
|
|
12107
|
+
var _temp15 = function _temp15() {
|
|
11871
12108
|
setLoginLoading(false);
|
|
11872
12109
|
};
|
|
11873
12110
|
setLoginLoading(true);
|
|
11874
|
-
var
|
|
12111
|
+
var _temp14 = _catch(function () {
|
|
11875
12112
|
return Promise.resolve(handleLogin(data)).then(function () {});
|
|
11876
12113
|
}, function () {});
|
|
11877
|
-
return Promise.resolve(
|
|
12114
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp15) : _temp15(_temp14));
|
|
11878
12115
|
} catch (e) {
|
|
11879
12116
|
return Promise.reject(e);
|
|
11880
12117
|
}
|
|
11881
12118
|
};
|
|
11882
12119
|
var addStoreAddress = function addStoreAddress(data) {
|
|
11883
12120
|
try {
|
|
11884
|
-
var
|
|
12121
|
+
var _temp17 = _catch(function () {
|
|
11885
12122
|
var _customer$customerDto2, _customer$customerDto3;
|
|
11886
|
-
return Promise.resolve(API
|
|
12123
|
+
return Promise.resolve(API({
|
|
11887
12124
|
apiEndPoint: apiEndPoint,
|
|
11888
12125
|
token: token,
|
|
11889
12126
|
method: 'POST',
|
|
@@ -11894,9 +12131,9 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11894
12131
|
successMessage: 'Address added successfully.',
|
|
11895
12132
|
errorMessage: 'Error in added the address.'
|
|
11896
12133
|
})).then(function (result) {
|
|
11897
|
-
var
|
|
12134
|
+
var _temp16 = function () {
|
|
11898
12135
|
if (result) {
|
|
11899
|
-
return Promise.resolve(API
|
|
12136
|
+
return Promise.resolve(API({
|
|
11900
12137
|
apiEndPoint: apiEndPoint,
|
|
11901
12138
|
token: token,
|
|
11902
12139
|
url: "/ecommerce/customer"
|
|
@@ -11905,10 +12142,10 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11905
12142
|
});
|
|
11906
12143
|
}
|
|
11907
12144
|
}();
|
|
11908
|
-
if (
|
|
12145
|
+
if (_temp16 && _temp16.then) return _temp16.then(function () {});
|
|
11909
12146
|
});
|
|
11910
12147
|
}, function () {});
|
|
11911
|
-
return Promise.resolve(
|
|
12148
|
+
return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
|
|
11912
12149
|
} catch (e) {
|
|
11913
12150
|
return Promise.reject(e);
|
|
11914
12151
|
}
|
|
@@ -11952,11 +12189,11 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
11952
12189
|
};
|
|
11953
12190
|
var onPlaceOrder = function onPlaceOrder(note, transactionId) {
|
|
11954
12191
|
try {
|
|
11955
|
-
var
|
|
12192
|
+
var _temp19 = function _temp19() {
|
|
11956
12193
|
setOrdering(false);
|
|
11957
12194
|
};
|
|
11958
12195
|
setOrdering(true);
|
|
11959
|
-
var
|
|
12196
|
+
var _temp18 = _catch(function () {
|
|
11960
12197
|
var authorizeCustomerCardData = {
|
|
11961
12198
|
authorizeDotNetCustomerProfileId: selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.authorizeDotNetCustomerProfileId,
|
|
11962
12199
|
authorizeDotNetCustomerPaymentProfileId: selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.authorizeDotNetCustomerPaymentProfileId
|
|
@@ -12013,12 +12250,12 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
12013
12250
|
paymentModeId: selectedStoreCredits === null || selectedStoreCredits === void 0 ? void 0 : selectedStoreCredits.id
|
|
12014
12251
|
}];
|
|
12015
12252
|
} else if (selectedStoreCredits && (selectedStoreCredits === null || selectedStoreCredits === void 0 ? void 0 : selectedStoreCredits.amount) < (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount)) {
|
|
12016
|
-
var _selectedStoreCredits,
|
|
12253
|
+
var _selectedStoreCredits, _ref6;
|
|
12017
12254
|
orderPaymentList = [{
|
|
12018
12255
|
amount: parseFloat(selectedStoreCredits === null || selectedStoreCredits === void 0 ? void 0 : (_selectedStoreCredits = selectedStoreCredits.amount) === null || _selectedStoreCredits === void 0 ? void 0 : _selectedStoreCredits.toFixed(2)),
|
|
12019
12256
|
paymentModeId: selectedStoreCredits === null || selectedStoreCredits === void 0 ? void 0 : selectedStoreCredits.id
|
|
12020
12257
|
}, _extends({
|
|
12021
|
-
amount: parseFloat((
|
|
12258
|
+
amount: parseFloat((_ref6 = (orderTotal === null || orderTotal === void 0 ? void 0 : orderTotal.totalAmount) - (selectedStoreCredits === null || selectedStoreCredits === void 0 ? void 0 : selectedStoreCredits.amount)) === null || _ref6 === void 0 ? void 0 : _ref6.toFixed(2)),
|
|
12022
12259
|
paymentModeId: selectedPaymentMethod === null || selectedPaymentMethod === void 0 ? void 0 : selectedPaymentMethod.id
|
|
12023
12260
|
}, authorizeCustomerCardData)];
|
|
12024
12261
|
} else {
|
|
@@ -12041,7 +12278,7 @@ var CheckoutPageComponent = function CheckoutPageComponent(_ref) {
|
|
|
12041
12278
|
}
|
|
12042
12279
|
return Promise.resolve(placeOrder(body)).then(function () {});
|
|
12043
12280
|
}, function () {});
|
|
12044
|
-
return Promise.resolve(
|
|
12281
|
+
return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(_temp19) : _temp19(_temp18));
|
|
12045
12282
|
} catch (e) {
|
|
12046
12283
|
return Promise.reject(e);
|
|
12047
12284
|
}
|