@salesgenterp/ui-components 0.4.367 → 0.4.368
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 +12 -50
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +12 -50
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -455,14 +455,15 @@ var API = function API(apiData) {
|
|
|
455
455
|
}
|
|
456
456
|
var apiUrl = ("/" + url).replace(/\/\//g, '/');
|
|
457
457
|
var accessToken = token;
|
|
458
|
-
var requestHeaders = _extends({}, headers
|
|
458
|
+
var requestHeaders = _extends({}, headers, {
|
|
459
|
+
Accept: "application/json, text/plain"
|
|
460
|
+
});
|
|
459
461
|
if (formData) {
|
|
460
462
|
requestHeaders['Content-Type'] = 'multipart/form-data';
|
|
461
463
|
}
|
|
462
|
-
if (byPassAuthAPIs.indexOf(url) === -1) {
|
|
464
|
+
if (byPassAuthAPIs.indexOf(url) === -1 && accessToken) {
|
|
463
465
|
requestHeaders = _extends({}, requestHeaders, {
|
|
464
|
-
Authorization: "Bearer " + accessToken
|
|
465
|
-
Accept: "application/json, text/plain"
|
|
466
|
+
Authorization: "Bearer " + accessToken
|
|
466
467
|
});
|
|
467
468
|
}
|
|
468
469
|
var response;
|
|
@@ -1741,43 +1742,6 @@ var getCartDiscountList = function getCartDiscountList(_ref5) {
|
|
|
1741
1742
|
return Promise.reject(e);
|
|
1742
1743
|
}
|
|
1743
1744
|
};
|
|
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
1745
|
var addCartDiscount = function addCartDiscount(_ref7) {
|
|
1782
1746
|
var apiEndPoint = _ref7.apiEndPoint,
|
|
1783
1747
|
token = _ref7.token,
|
|
@@ -1789,8 +1753,8 @@ var addCartDiscount = function addCartDiscount(_ref7) {
|
|
|
1789
1753
|
url: "/cartDiscount?storeId=2",
|
|
1790
1754
|
method: 'post',
|
|
1791
1755
|
body: body,
|
|
1792
|
-
|
|
1793
|
-
|
|
1756
|
+
successMessage: 'Discount added successfully.',
|
|
1757
|
+
errorMessage: 'Error in adding discount.'
|
|
1794
1758
|
}));
|
|
1795
1759
|
} catch (e) {
|
|
1796
1760
|
return Promise.reject(e);
|
|
@@ -7152,18 +7116,16 @@ var CartSummary = function CartSummary(_ref) {
|
|
|
7152
7116
|
setCouponText('');
|
|
7153
7117
|
setButtonLoading(false);
|
|
7154
7118
|
};
|
|
7155
|
-
var
|
|
7156
|
-
|
|
7157
|
-
|
|
7119
|
+
var body = {
|
|
7120
|
+
cartTotal: cartAmount,
|
|
7121
|
+
couponCode: value
|
|
7158
7122
|
};
|
|
7159
7123
|
setButtonLoading(true);
|
|
7160
7124
|
var _temp = _catch(function () {
|
|
7161
|
-
return Promise.resolve(
|
|
7125
|
+
return Promise.resolve(addCartDiscount({
|
|
7162
7126
|
apiEndPoint: apiEndPoint,
|
|
7163
7127
|
token: token,
|
|
7164
|
-
body:
|
|
7165
|
-
storeIdList: storeIdList,
|
|
7166
|
-
cartAmount: subtotal
|
|
7128
|
+
body: body
|
|
7167
7129
|
})).then(function () {
|
|
7168
7130
|
onChangeDiscountCoupon && onChangeDiscountCoupon();
|
|
7169
7131
|
});
|