@crystaldesign/product-handler 26.4.0-beta.9 → 26.4.0-rc.1
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/build/cjs/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
60
60
|
_defineProperty__default["default"](this, "_mediaService", '');
|
|
61
61
|
_defineProperty__default["default"](this, "_basketService", '');
|
|
62
62
|
_defineProperty__default["default"](this, "_api2", '');
|
|
63
|
+
_defineProperty__default["default"](this, "_enricherService", '');
|
|
63
64
|
_defineProperty__default["default"](this, "_sessionGuid", '');
|
|
64
65
|
_defineProperty__default["default"](this, "_organization", {});
|
|
65
66
|
}
|
|
@@ -103,6 +104,14 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
103
104
|
set: function set(val) {
|
|
104
105
|
this._api2 = val;
|
|
105
106
|
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "enricherService",
|
|
109
|
+
get: function get() {
|
|
110
|
+
return this._enricherService;
|
|
111
|
+
},
|
|
112
|
+
set: function set(val) {
|
|
113
|
+
this._enricherService = val;
|
|
114
|
+
}
|
|
106
115
|
}, {
|
|
107
116
|
key: "sessionGuid",
|
|
108
117
|
get: function get() {
|
|
@@ -313,7 +322,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
313
322
|
}
|
|
314
323
|
_context2.next = 18;
|
|
315
324
|
return Promise.all((_baseProduct$configur3 = (_baseProduct$configur4 = baseProduct.configuration) === null || _baseProduct$configur4 === void 0 ? void 0 : _baseProduct$configur4.OrderSets.map(function (os) {
|
|
316
|
-
return _this.apiGetCatalogData(os.CatalogCodex, os.CatalogGUID, currentLang, os.AccountGUID);
|
|
325
|
+
return _this.apiGetCatalogData(os.CatalogCodex, os.CatalogGUID, currentLang, os.AccountGUID, os.IsIDMFormat);
|
|
317
326
|
})) !== null && _baseProduct$configur3 !== void 0 ? _baseProduct$configur3 : []);
|
|
318
327
|
case 18:
|
|
319
328
|
catalogData = _context2.sent;
|
|
@@ -322,7 +331,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
322
331
|
case 21:
|
|
323
332
|
_context2.next = 23;
|
|
324
333
|
return Promise.all((_basket$OrderSets$map2 = basket === null || basket === void 0 ? void 0 : basket.OrderSets.map(function (os) {
|
|
325
|
-
return _this.apiGetCatalogData(os.CatalogCodex, os.CatalogGUID, currentLang, os.AccountGUID);
|
|
334
|
+
return _this.apiGetCatalogData(os.CatalogCodex, os.CatalogGUID, currentLang, os.AccountGUID, os.IsIDMFormat);
|
|
326
335
|
})) !== null && _basket$OrderSets$map2 !== void 0 ? _basket$OrderSets$map2 : []);
|
|
327
336
|
case 23:
|
|
328
337
|
catalogData = _context2.sent;
|
|
@@ -1710,24 +1719,30 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1710
1719
|
}, {
|
|
1711
1720
|
key: "apiGetCatalogData",
|
|
1712
1721
|
value: function () {
|
|
1713
|
-
var _apiGetCatalogData = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(catalogCodex, catalogId, language, accountId) {
|
|
1722
|
+
var _apiGetCatalogData = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(catalogCodex, catalogId, language, accountId, isIDMFormat) {
|
|
1714
1723
|
var _response$CollectionG, _response$Properties, _response$Properties2;
|
|
1715
1724
|
var currentAccountSessionId, fullUrl, response, actCatalogInfoData;
|
|
1716
1725
|
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context9) {
|
|
1717
1726
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1718
1727
|
case 0:
|
|
1719
|
-
|
|
1720
|
-
|
|
1728
|
+
if (!isIDMFormat) {
|
|
1729
|
+
_context9.next = 2;
|
|
1730
|
+
break;
|
|
1731
|
+
}
|
|
1732
|
+
return _context9.abrupt("return", this.apiGetCatalogDataIDM(catalogCodex, language, accountId));
|
|
1721
1733
|
case 2:
|
|
1734
|
+
_context9.next = 4;
|
|
1735
|
+
return this.apiAccountLogin(accountId, catalogId);
|
|
1736
|
+
case 4:
|
|
1722
1737
|
currentAccountSessionId = _context9.sent;
|
|
1723
1738
|
if (currentAccountSessionId) {
|
|
1724
|
-
_context9.next =
|
|
1739
|
+
_context9.next = 7;
|
|
1725
1740
|
break;
|
|
1726
1741
|
}
|
|
1727
1742
|
return _context9.abrupt("return");
|
|
1728
|
-
case
|
|
1743
|
+
case 7:
|
|
1729
1744
|
fullUrl = this.api2 + '?function=GetJsonCatalogData' + '&catalogCodex=' + catalogCodex + '&IncludeVariantValues=True&lang=' + language.toLocaleUpperCase();
|
|
1730
|
-
_context9.next =
|
|
1745
|
+
_context9.next = 10;
|
|
1731
1746
|
return fetch(fullUrl, {
|
|
1732
1747
|
headers: {
|
|
1733
1748
|
sessionGuid: currentAccountSessionId
|
|
@@ -1738,14 +1753,14 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1738
1753
|
}
|
|
1739
1754
|
return res.json();
|
|
1740
1755
|
});
|
|
1741
|
-
case
|
|
1756
|
+
case 10:
|
|
1742
1757
|
response = _context9.sent;
|
|
1743
1758
|
if (!response.Error) {
|
|
1744
|
-
_context9.next =
|
|
1759
|
+
_context9.next = 13;
|
|
1745
1760
|
break;
|
|
1746
1761
|
}
|
|
1747
1762
|
throw new Error(response.Error);
|
|
1748
|
-
case
|
|
1763
|
+
case 13:
|
|
1749
1764
|
actCatalogInfoData = {
|
|
1750
1765
|
lang: language,
|
|
1751
1766
|
guid: response.GUID,
|
|
@@ -1775,83 +1790,158 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1775
1790
|
})) !== null && _response$Properties2 !== void 0 && _response$Properties2.Value)
|
|
1776
1791
|
};
|
|
1777
1792
|
return _context9.abrupt("return", actCatalogInfoData);
|
|
1778
|
-
case
|
|
1793
|
+
case 15:
|
|
1779
1794
|
case "end":
|
|
1780
1795
|
return _context9.stop();
|
|
1781
1796
|
}
|
|
1782
1797
|
}, _callee7, this);
|
|
1783
1798
|
}));
|
|
1784
|
-
function apiGetCatalogData(_x9, _x10, _x11, _x12) {
|
|
1799
|
+
function apiGetCatalogData(_x9, _x10, _x11, _x12, _x13) {
|
|
1785
1800
|
return _apiGetCatalogData.apply(this, arguments);
|
|
1786
1801
|
}
|
|
1787
1802
|
return apiGetCatalogData;
|
|
1788
1803
|
}()
|
|
1789
1804
|
}, {
|
|
1790
|
-
key: "
|
|
1805
|
+
key: "apiGetCatalogDataIDM",
|
|
1791
1806
|
value: function () {
|
|
1792
|
-
var
|
|
1793
|
-
var
|
|
1807
|
+
var _apiGetCatalogDataIDM = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(serieNo, language, catalogId) {
|
|
1808
|
+
var _cat$Properties, _cat$detailInfos$filt, _cat$detailInfos;
|
|
1809
|
+
var fullUrl, response, cat, actCatalogInfoData;
|
|
1794
1810
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context10) {
|
|
1795
1811
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1812
|
+
case 0:
|
|
1813
|
+
fullUrl = this.enricherService + '/live/v3.0/catalogs/' + catalogId + '/series/' + serieNo;
|
|
1814
|
+
_context10.next = 3;
|
|
1815
|
+
return fetch(fullUrl, {
|
|
1816
|
+
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
1817
|
+
'Content-Type': 'application/json'
|
|
1818
|
+
})
|
|
1819
|
+
}).then(function (res) {
|
|
1820
|
+
if (res.status !== 200) {
|
|
1821
|
+
throw new Error('IDM catalog data not loaded.');
|
|
1822
|
+
}
|
|
1823
|
+
return res.json();
|
|
1824
|
+
});
|
|
1825
|
+
case 3:
|
|
1826
|
+
response = _context10.sent;
|
|
1827
|
+
if (!response.Error) {
|
|
1828
|
+
_context10.next = 6;
|
|
1829
|
+
break;
|
|
1830
|
+
}
|
|
1831
|
+
throw new Error(response.Error);
|
|
1832
|
+
case 6:
|
|
1833
|
+
cat = response;
|
|
1834
|
+
if (cat) {
|
|
1835
|
+
_context10.next = 9;
|
|
1836
|
+
break;
|
|
1837
|
+
}
|
|
1838
|
+
throw new Error('serieNo: ' + serieNo + ' not found');
|
|
1839
|
+
case 9:
|
|
1840
|
+
actCatalogInfoData = {
|
|
1841
|
+
lang: language,
|
|
1842
|
+
guid: cat._id,
|
|
1843
|
+
name: DivaUtils__default["default"].getLocals(cat.seriesName, language),
|
|
1844
|
+
name_locales: cat.seriesName,
|
|
1845
|
+
codex: serieNo,
|
|
1846
|
+
description: DivaUtils__default["default"].getLocals(cat.seriesFullText, language),
|
|
1847
|
+
description_locales: cat.seriesFullText,
|
|
1848
|
+
hasPlanner: true,
|
|
1849
|
+
accountGuid: catalogId,
|
|
1850
|
+
supplierGuid: catalogId,
|
|
1851
|
+
options: cat.Options,
|
|
1852
|
+
optionValues: cat.Optionvalues,
|
|
1853
|
+
has3D: !!((_cat$Properties = cat.Properties) !== null && _cat$Properties !== void 0 && (_cat$Properties = _cat$Properties.find(function (p) {
|
|
1854
|
+
return p.Codex == 'DIVA3D_RENDERING';
|
|
1855
|
+
})) !== null && _cat$Properties !== void 0 && _cat$Properties.Value),
|
|
1856
|
+
images: (_cat$detailInfos$filt = (_cat$detailInfos = cat.detailInfos) === null || _cat$detailInfos === void 0 || (_cat$detailInfos = _cat$detailInfos.filter(function (d) {
|
|
1857
|
+
return d.functionType == 'CAT_SHO';
|
|
1858
|
+
})) === null || _cat$detailInfos === void 0 ? void 0 : _cat$detailInfos.map(function (d) {
|
|
1859
|
+
return {
|
|
1860
|
+
name: d.name,
|
|
1861
|
+
thumbUrl: d.url,
|
|
1862
|
+
url: d.url
|
|
1863
|
+
};
|
|
1864
|
+
})) !== null && _cat$detailInfos$filt !== void 0 ? _cat$detailInfos$filt : [],
|
|
1865
|
+
documents: []
|
|
1866
|
+
};
|
|
1867
|
+
return _context10.abrupt("return", actCatalogInfoData);
|
|
1868
|
+
case 11:
|
|
1869
|
+
case "end":
|
|
1870
|
+
return _context10.stop();
|
|
1871
|
+
}
|
|
1872
|
+
}, _callee8, this);
|
|
1873
|
+
}));
|
|
1874
|
+
function apiGetCatalogDataIDM(_x14, _x15, _x16) {
|
|
1875
|
+
return _apiGetCatalogDataIDM.apply(this, arguments);
|
|
1876
|
+
}
|
|
1877
|
+
return apiGetCatalogDataIDM;
|
|
1878
|
+
}()
|
|
1879
|
+
}, {
|
|
1880
|
+
key: "apiAccountLogin",
|
|
1881
|
+
value: function () {
|
|
1882
|
+
var _apiAccountLogin = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(accountId, catalogId) {
|
|
1883
|
+
var fullUrl, response, fallbackUrl, fallbackResponse;
|
|
1884
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context11) {
|
|
1885
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1796
1886
|
case 0:
|
|
1797
1887
|
fullUrl = this.api2 + '?function=JsonAccountLogin&UserRole=v&accountGuid=' + accountId;
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1888
|
+
_context11.t0 = fetch;
|
|
1889
|
+
_context11.t1 = fullUrl;
|
|
1890
|
+
_context11.next = 5;
|
|
1801
1891
|
return this.sessionGuid;
|
|
1802
1892
|
case 5:
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
sessionGuid:
|
|
1893
|
+
_context11.t2 = _context11.sent;
|
|
1894
|
+
_context11.t3 = {
|
|
1895
|
+
sessionGuid: _context11.t2
|
|
1806
1896
|
};
|
|
1807
|
-
|
|
1808
|
-
headers:
|
|
1897
|
+
_context11.t4 = {
|
|
1898
|
+
headers: _context11.t3
|
|
1809
1899
|
};
|
|
1810
|
-
|
|
1811
|
-
return (0,
|
|
1900
|
+
_context11.next = 10;
|
|
1901
|
+
return (0, _context11.t0)(_context11.t1, _context11.t4).then(function (res) {
|
|
1812
1902
|
if (res.status !== 200) {
|
|
1813
1903
|
throw new Error('Collections not loaded.');
|
|
1814
1904
|
}
|
|
1815
1905
|
return res.json();
|
|
1816
1906
|
});
|
|
1817
1907
|
case 10:
|
|
1818
|
-
response =
|
|
1908
|
+
response = _context11.sent;
|
|
1819
1909
|
if (!response.SessionGUID) {
|
|
1820
|
-
|
|
1910
|
+
_context11.next = 13;
|
|
1821
1911
|
break;
|
|
1822
1912
|
}
|
|
1823
|
-
return
|
|
1913
|
+
return _context11.abrupt("return", response.SessionGUID);
|
|
1824
1914
|
case 13:
|
|
1825
1915
|
fallbackUrl = this.api2 + '?function=JsonAccountLogin&UserRole=v&catalogGuid=' + catalogId;
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1916
|
+
_context11.t5 = fetch;
|
|
1917
|
+
_context11.t6 = fallbackUrl;
|
|
1918
|
+
_context11.next = 18;
|
|
1829
1919
|
return this.sessionGuid;
|
|
1830
1920
|
case 18:
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
sessionGuid:
|
|
1921
|
+
_context11.t7 = _context11.sent;
|
|
1922
|
+
_context11.t8 = {
|
|
1923
|
+
sessionGuid: _context11.t7
|
|
1834
1924
|
};
|
|
1835
|
-
|
|
1836
|
-
headers:
|
|
1925
|
+
_context11.t9 = {
|
|
1926
|
+
headers: _context11.t8
|
|
1837
1927
|
};
|
|
1838
|
-
|
|
1839
|
-
return (0,
|
|
1928
|
+
_context11.next = 23;
|
|
1929
|
+
return (0, _context11.t5)(_context11.t6, _context11.t9).then(function (res) {
|
|
1840
1930
|
if (res.status !== 200) {
|
|
1841
1931
|
throw new Error('Collections not loaded.');
|
|
1842
1932
|
}
|
|
1843
1933
|
return res.json();
|
|
1844
1934
|
});
|
|
1845
1935
|
case 23:
|
|
1846
|
-
fallbackResponse =
|
|
1847
|
-
return
|
|
1936
|
+
fallbackResponse = _context11.sent;
|
|
1937
|
+
return _context11.abrupt("return", fallbackResponse.SessionGUID);
|
|
1848
1938
|
case 25:
|
|
1849
1939
|
case "end":
|
|
1850
|
-
return
|
|
1940
|
+
return _context11.stop();
|
|
1851
1941
|
}
|
|
1852
|
-
},
|
|
1942
|
+
}, _callee9, this);
|
|
1853
1943
|
}));
|
|
1854
|
-
function apiAccountLogin(
|
|
1944
|
+
function apiAccountLogin(_x17, _x18) {
|
|
1855
1945
|
return _apiAccountLogin.apply(this, arguments);
|
|
1856
1946
|
}
|
|
1857
1947
|
return apiAccountLogin;
|
|
@@ -1859,49 +1949,49 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1859
1949
|
}, {
|
|
1860
1950
|
key: "apiGetProductVariants",
|
|
1861
1951
|
value: function () {
|
|
1862
|
-
var _apiGetProductVariants = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
1952
|
+
var _apiGetProductVariants = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(id, full) {
|
|
1863
1953
|
var _res2;
|
|
1864
1954
|
var fullUrl, res, resData;
|
|
1865
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
1866
|
-
while (1) switch (
|
|
1955
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context12) {
|
|
1956
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1867
1957
|
case 0:
|
|
1868
1958
|
fullUrl = this.catalogService + '/v1/products/' + id + '/variants' + (full ? '?full=true' : '');
|
|
1869
|
-
|
|
1870
|
-
|
|
1959
|
+
_context12.prev = 1;
|
|
1960
|
+
_context12.next = 4;
|
|
1871
1961
|
return axios__default["default"].get(fullUrl, {
|
|
1872
1962
|
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
1873
1963
|
'Content-Type': 'application/json'
|
|
1874
1964
|
})
|
|
1875
1965
|
});
|
|
1876
1966
|
case 4:
|
|
1877
|
-
res =
|
|
1878
|
-
|
|
1967
|
+
res = _context12.sent;
|
|
1968
|
+
_context12.next = 7;
|
|
1879
1969
|
return res.data;
|
|
1880
1970
|
case 7:
|
|
1881
|
-
resData =
|
|
1882
|
-
|
|
1971
|
+
resData = _context12.sent;
|
|
1972
|
+
_context12.next = 13;
|
|
1883
1973
|
break;
|
|
1884
1974
|
case 10:
|
|
1885
|
-
|
|
1886
|
-
|
|
1975
|
+
_context12.prev = 10;
|
|
1976
|
+
_context12.t0 = _context12["catch"](1);
|
|
1887
1977
|
throw new Error('Could not get existing products', {
|
|
1888
|
-
cause:
|
|
1978
|
+
cause: _context12.t0
|
|
1889
1979
|
});
|
|
1890
1980
|
case 13:
|
|
1891
1981
|
if (!(((_res2 = res) === null || _res2 === void 0 ? void 0 : _res2.status) == 200)) {
|
|
1892
|
-
|
|
1982
|
+
_context12.next = 15;
|
|
1893
1983
|
break;
|
|
1894
1984
|
}
|
|
1895
|
-
return
|
|
1985
|
+
return _context12.abrupt("return", resData);
|
|
1896
1986
|
case 15:
|
|
1897
1987
|
throw new Error(resData.error);
|
|
1898
1988
|
case 16:
|
|
1899
1989
|
case "end":
|
|
1900
|
-
return
|
|
1990
|
+
return _context12.stop();
|
|
1901
1991
|
}
|
|
1902
|
-
},
|
|
1992
|
+
}, _callee10, this, [[1, 10]]);
|
|
1903
1993
|
}));
|
|
1904
|
-
function apiGetProductVariants(
|
|
1994
|
+
function apiGetProductVariants(_x19, _x20) {
|
|
1905
1995
|
return _apiGetProductVariants.apply(this, arguments);
|
|
1906
1996
|
}
|
|
1907
1997
|
return apiGetProductVariants;
|
|
@@ -1909,7 +1999,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1909
1999
|
}, {
|
|
1910
2000
|
key: "apiGetProductByFilter",
|
|
1911
2001
|
value: function () {
|
|
1912
|
-
var _apiGetProductByFilter = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2002
|
+
var _apiGetProductByFilter = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee11(filter) {
|
|
1913
2003
|
var _res3;
|
|
1914
2004
|
var limit,
|
|
1915
2005
|
useFilter,
|
|
@@ -1918,39 +2008,39 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1918
2008
|
res,
|
|
1919
2009
|
resData,
|
|
1920
2010
|
filterParam,
|
|
1921
|
-
|
|
1922
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
1923
|
-
while (1) switch (
|
|
2011
|
+
_args13 = arguments;
|
|
2012
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee11$(_context13) {
|
|
2013
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1924
2014
|
case 0:
|
|
1925
|
-
limit =
|
|
1926
|
-
useFilter =
|
|
1927
|
-
hierarchy =
|
|
2015
|
+
limit = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : 1;
|
|
2016
|
+
useFilter = _args13.length > 2 ? _args13[2] : undefined;
|
|
2017
|
+
hierarchy = _args13.length > 3 ? _args13[3] : undefined;
|
|
1928
2018
|
fullUrl = this.catalogService + '/v1/products';
|
|
1929
|
-
|
|
2019
|
+
_context13.prev = 4;
|
|
1930
2020
|
filterParam = useFilter ? 'filter' : 'search';
|
|
1931
|
-
|
|
2021
|
+
_context13.next = 8;
|
|
1932
2022
|
return axios__default["default"].get("".concat(fullUrl, "?organizationIds=").concat(this.organization._id, "&").concat(filterParam, "=").concat(encodeURIComponent(this.parseFilter(filter)), "&limit=").concat(limit, "&hierarchy=").concat(hierarchy !== null && hierarchy !== void 0 ? hierarchy : false), {
|
|
1933
2023
|
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
1934
2024
|
'Content-Type': 'application/json'
|
|
1935
2025
|
})
|
|
1936
2026
|
});
|
|
1937
2027
|
case 8:
|
|
1938
|
-
res =
|
|
1939
|
-
|
|
2028
|
+
res = _context13.sent;
|
|
2029
|
+
_context13.next = 11;
|
|
1940
2030
|
return res.data;
|
|
1941
2031
|
case 11:
|
|
1942
|
-
resData =
|
|
1943
|
-
|
|
2032
|
+
resData = _context13.sent;
|
|
2033
|
+
_context13.next = 17;
|
|
1944
2034
|
break;
|
|
1945
2035
|
case 14:
|
|
1946
|
-
|
|
1947
|
-
|
|
2036
|
+
_context13.prev = 14;
|
|
2037
|
+
_context13.t0 = _context13["catch"](4);
|
|
1948
2038
|
throw new Error('Could not get existing products', {
|
|
1949
|
-
cause:
|
|
2039
|
+
cause: _context13.t0
|
|
1950
2040
|
});
|
|
1951
2041
|
case 17:
|
|
1952
2042
|
if (!(((_res3 = res) === null || _res3 === void 0 ? void 0 : _res3.status) == 200)) {
|
|
1953
|
-
|
|
2043
|
+
_context13.next = 20;
|
|
1954
2044
|
break;
|
|
1955
2045
|
}
|
|
1956
2046
|
//in order to be backwardscompatible we must transform old products here
|
|
@@ -1963,16 +2053,16 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1963
2053
|
}
|
|
1964
2054
|
return d;
|
|
1965
2055
|
});
|
|
1966
|
-
return
|
|
2056
|
+
return _context13.abrupt("return", resData);
|
|
1967
2057
|
case 20:
|
|
1968
2058
|
throw new Error(resData.error);
|
|
1969
2059
|
case 21:
|
|
1970
2060
|
case "end":
|
|
1971
|
-
return
|
|
2061
|
+
return _context13.stop();
|
|
1972
2062
|
}
|
|
1973
|
-
},
|
|
2063
|
+
}, _callee11, this, [[4, 14]]);
|
|
1974
2064
|
}));
|
|
1975
|
-
function apiGetProductByFilter(
|
|
2065
|
+
function apiGetProductByFilter(_x21) {
|
|
1976
2066
|
return _apiGetProductByFilter.apply(this, arguments);
|
|
1977
2067
|
}
|
|
1978
2068
|
return apiGetProductByFilter;
|
|
@@ -1980,7 +2070,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1980
2070
|
}, {
|
|
1981
2071
|
key: "apiGetProductByQuery",
|
|
1982
2072
|
value: function () {
|
|
1983
|
-
var _apiGetProductByQuery = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2073
|
+
var _apiGetProductByQuery = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee12(filter) {
|
|
1984
2074
|
var _res4;
|
|
1985
2075
|
var limit,
|
|
1986
2076
|
useFilter,
|
|
@@ -1989,12 +2079,12 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
1989
2079
|
queryString,
|
|
1990
2080
|
res,
|
|
1991
2081
|
resData,
|
|
1992
|
-
|
|
1993
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
1994
|
-
while (1) switch (
|
|
2082
|
+
_args14 = arguments;
|
|
2083
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee12$(_context14) {
|
|
2084
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1995
2085
|
case 0:
|
|
1996
|
-
limit =
|
|
1997
|
-
useFilter =
|
|
2086
|
+
limit = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : 1;
|
|
2087
|
+
useFilter = _args14.length > 2 ? _args14[2] : undefined;
|
|
1998
2088
|
filterParam = useFilter ? 'filter' : 'search';
|
|
1999
2089
|
fullUrl = new URL(this.catalogService + '/v1/products/query');
|
|
2000
2090
|
queryString = new URLSearchParams();
|
|
@@ -2002,42 +2092,42 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2002
2092
|
queryString.append('sort', encodeURIComponent('{-created}'));
|
|
2003
2093
|
queryString.append('limit', limit.toString());
|
|
2004
2094
|
fullUrl.search = queryString.toString();
|
|
2005
|
-
|
|
2006
|
-
|
|
2095
|
+
_context14.prev = 9;
|
|
2096
|
+
_context14.next = 12;
|
|
2007
2097
|
return axios__default["default"].get(fullUrl.toString(), {
|
|
2008
2098
|
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
2009
2099
|
'Content-Type': 'application/json'
|
|
2010
2100
|
})
|
|
2011
2101
|
});
|
|
2012
2102
|
case 12:
|
|
2013
|
-
res =
|
|
2014
|
-
|
|
2103
|
+
res = _context14.sent;
|
|
2104
|
+
_context14.next = 15;
|
|
2015
2105
|
return res.data;
|
|
2016
2106
|
case 15:
|
|
2017
|
-
resData =
|
|
2018
|
-
|
|
2107
|
+
resData = _context14.sent;
|
|
2108
|
+
_context14.next = 21;
|
|
2019
2109
|
break;
|
|
2020
2110
|
case 18:
|
|
2021
|
-
|
|
2022
|
-
|
|
2111
|
+
_context14.prev = 18;
|
|
2112
|
+
_context14.t0 = _context14["catch"](9);
|
|
2023
2113
|
throw new Error('Could not get existing products', {
|
|
2024
|
-
cause:
|
|
2114
|
+
cause: _context14.t0
|
|
2025
2115
|
});
|
|
2026
2116
|
case 21:
|
|
2027
2117
|
if (!(((_res4 = res) === null || _res4 === void 0 ? void 0 : _res4.status) == 200)) {
|
|
2028
|
-
|
|
2118
|
+
_context14.next = 23;
|
|
2029
2119
|
break;
|
|
2030
2120
|
}
|
|
2031
|
-
return
|
|
2121
|
+
return _context14.abrupt("return", resData);
|
|
2032
2122
|
case 23:
|
|
2033
2123
|
throw new Error(resData.error);
|
|
2034
2124
|
case 24:
|
|
2035
2125
|
case "end":
|
|
2036
|
-
return
|
|
2126
|
+
return _context14.stop();
|
|
2037
2127
|
}
|
|
2038
|
-
},
|
|
2128
|
+
}, _callee12, this, [[9, 18]]);
|
|
2039
2129
|
}));
|
|
2040
|
-
function apiGetProductByQuery(
|
|
2130
|
+
function apiGetProductByQuery(_x22) {
|
|
2041
2131
|
return _apiGetProductByQuery.apply(this, arguments);
|
|
2042
2132
|
}
|
|
2043
2133
|
return apiGetProductByQuery;
|
|
@@ -2045,50 +2135,50 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2045
2135
|
}, {
|
|
2046
2136
|
key: "apiMarkAsFavorite",
|
|
2047
2137
|
value: function () {
|
|
2048
|
-
var _apiMarkAsFavorite = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2138
|
+
var _apiMarkAsFavorite = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee13(id, organizationId) {
|
|
2049
2139
|
var _res5;
|
|
2050
2140
|
var fullUrl, res, resData;
|
|
2051
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
2052
|
-
while (1) switch (
|
|
2141
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee13$(_context15) {
|
|
2142
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2053
2143
|
case 0:
|
|
2054
2144
|
fullUrl = new URL(this.catalogService + '/v1/products/' + id + '/favorite');
|
|
2055
2145
|
fullUrl.searchParams.append('organizationId', organizationId);
|
|
2056
|
-
|
|
2057
|
-
|
|
2146
|
+
_context15.prev = 2;
|
|
2147
|
+
_context15.next = 5;
|
|
2058
2148
|
return axios__default["default"].post(fullUrl.toString(), undefined, {
|
|
2059
2149
|
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
2060
2150
|
'Content-Type': 'application/json'
|
|
2061
2151
|
})
|
|
2062
2152
|
});
|
|
2063
2153
|
case 5:
|
|
2064
|
-
res =
|
|
2065
|
-
|
|
2154
|
+
res = _context15.sent;
|
|
2155
|
+
_context15.next = 8;
|
|
2066
2156
|
return res.data;
|
|
2067
2157
|
case 8:
|
|
2068
|
-
resData =
|
|
2069
|
-
|
|
2158
|
+
resData = _context15.sent;
|
|
2159
|
+
_context15.next = 14;
|
|
2070
2160
|
break;
|
|
2071
2161
|
case 11:
|
|
2072
|
-
|
|
2073
|
-
|
|
2162
|
+
_context15.prev = 11;
|
|
2163
|
+
_context15.t0 = _context15["catch"](2);
|
|
2074
2164
|
throw new Error('Error on activate product', {
|
|
2075
|
-
cause:
|
|
2165
|
+
cause: _context15.t0
|
|
2076
2166
|
});
|
|
2077
2167
|
case 14:
|
|
2078
2168
|
if (!(((_res5 = res) === null || _res5 === void 0 ? void 0 : _res5.status) == 204)) {
|
|
2079
|
-
|
|
2169
|
+
_context15.next = 16;
|
|
2080
2170
|
break;
|
|
2081
2171
|
}
|
|
2082
|
-
return
|
|
2172
|
+
return _context15.abrupt("return");
|
|
2083
2173
|
case 16:
|
|
2084
2174
|
throw new Error(resData.error);
|
|
2085
2175
|
case 17:
|
|
2086
2176
|
case "end":
|
|
2087
|
-
return
|
|
2177
|
+
return _context15.stop();
|
|
2088
2178
|
}
|
|
2089
|
-
},
|
|
2179
|
+
}, _callee13, this, [[2, 11]]);
|
|
2090
2180
|
}));
|
|
2091
|
-
function apiMarkAsFavorite(
|
|
2181
|
+
function apiMarkAsFavorite(_x23, _x24) {
|
|
2092
2182
|
return _apiMarkAsFavorite.apply(this, arguments);
|
|
2093
2183
|
}
|
|
2094
2184
|
return apiMarkAsFavorite;
|
|
@@ -2096,47 +2186,47 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2096
2186
|
}, {
|
|
2097
2187
|
key: "apiGetUniqueDivaNr",
|
|
2098
2188
|
value: function () {
|
|
2099
|
-
var _apiGetUniqueDivaNr = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2189
|
+
var _apiGetUniqueDivaNr = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee14() {
|
|
2100
2190
|
var _res6;
|
|
2101
2191
|
var fullUrl, res, resData;
|
|
2102
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
2103
|
-
while (1) switch (
|
|
2192
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee14$(_context16) {
|
|
2193
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2104
2194
|
case 0:
|
|
2105
2195
|
fullUrl = new URL(this.basketService + '/baskets/uniqueDivaNr');
|
|
2106
|
-
|
|
2107
|
-
|
|
2196
|
+
_context16.prev = 1;
|
|
2197
|
+
_context16.next = 4;
|
|
2108
2198
|
return axios__default["default"].get(fullUrl.toString(), {
|
|
2109
2199
|
headers: _objectSpread(_objectSpread({}, this.getHeaders()), {}, {
|
|
2110
2200
|
'Content-Type': 'application/json'
|
|
2111
2201
|
})
|
|
2112
2202
|
});
|
|
2113
2203
|
case 4:
|
|
2114
|
-
res =
|
|
2115
|
-
|
|
2204
|
+
res = _context16.sent;
|
|
2205
|
+
_context16.next = 7;
|
|
2116
2206
|
return res.data;
|
|
2117
2207
|
case 7:
|
|
2118
|
-
resData =
|
|
2119
|
-
|
|
2208
|
+
resData = _context16.sent;
|
|
2209
|
+
_context16.next = 13;
|
|
2120
2210
|
break;
|
|
2121
2211
|
case 10:
|
|
2122
|
-
|
|
2123
|
-
|
|
2212
|
+
_context16.prev = 10;
|
|
2213
|
+
_context16.t0 = _context16["catch"](1);
|
|
2124
2214
|
throw new Error('Error on activate product', {
|
|
2125
|
-
cause:
|
|
2215
|
+
cause: _context16.t0
|
|
2126
2216
|
});
|
|
2127
2217
|
case 13:
|
|
2128
2218
|
if (!(((_res6 = res) === null || _res6 === void 0 ? void 0 : _res6.status) == 200)) {
|
|
2129
|
-
|
|
2219
|
+
_context16.next = 15;
|
|
2130
2220
|
break;
|
|
2131
2221
|
}
|
|
2132
|
-
return
|
|
2222
|
+
return _context16.abrupt("return", resData.divaNr);
|
|
2133
2223
|
case 15:
|
|
2134
2224
|
throw new Error(resData.error);
|
|
2135
2225
|
case 16:
|
|
2136
2226
|
case "end":
|
|
2137
|
-
return
|
|
2227
|
+
return _context16.stop();
|
|
2138
2228
|
}
|
|
2139
|
-
},
|
|
2229
|
+
}, _callee14, this, [[1, 10]]);
|
|
2140
2230
|
}));
|
|
2141
2231
|
function apiGetUniqueDivaNr() {
|
|
2142
2232
|
return _apiGetUniqueDivaNr.apply(this, arguments);
|
|
@@ -2146,10 +2236,10 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2146
2236
|
}, {
|
|
2147
2237
|
key: "apiLoadProductVariantsGrouped",
|
|
2148
2238
|
value: function () {
|
|
2149
|
-
var _apiLoadProductVariantsGrouped = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2239
|
+
var _apiLoadProductVariantsGrouped = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee15(_ref45) {
|
|
2150
2240
|
var limit, skip, fields, _ref45$search, search, sort, favorites, abortController, fullUrl, headers, promise;
|
|
2151
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
2152
|
-
while (1) switch (
|
|
2241
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee15$(_context17) {
|
|
2242
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2153
2243
|
case 0:
|
|
2154
2244
|
limit = _ref45.limit, skip = _ref45.skip, fields = _ref45.fields, _ref45$search = _ref45.search, search = _ref45$search === void 0 ? [] : _ref45$search, sort = _ref45.sort, favorites = _ref45.favorites, abortController = _ref45.abortController;
|
|
2155
2245
|
fullUrl = this.catalogService + '/v1/products/groups' + '?organizationId=' + this.organization._id + (this._organization.parentOrganizationIds ? '&parentOrganizationIds=' + this._organization.parentOrganizationIds.join(',') : '') + (limit ? '&limit=' + limit : '') + (skip ? '&skip=' + skip : '') + (fields ? '&fileds=' + DivaUtils__default["default"].fixedEncodeURIComponent('{' + fields.join(',') + '}') : '') + (search.length ? '&search=' + DivaUtils__default["default"].fixedEncodeURIComponent(this.parseFilter(search)) : '') + (sort ? '&sort=' + DivaUtils__default["default"].fixedEncodeURIComponent(sort) : '') + (favorites ? '&favorites=true' : '');
|
|
@@ -2173,17 +2263,17 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2173
2263
|
reject('Error loading products grouped by variants: ' + error.message);
|
|
2174
2264
|
});
|
|
2175
2265
|
});
|
|
2176
|
-
|
|
2266
|
+
_context17.next = 7;
|
|
2177
2267
|
return promise;
|
|
2178
2268
|
case 7:
|
|
2179
|
-
return
|
|
2269
|
+
return _context17.abrupt("return", _context17.sent);
|
|
2180
2270
|
case 8:
|
|
2181
2271
|
case "end":
|
|
2182
|
-
return
|
|
2272
|
+
return _context17.stop();
|
|
2183
2273
|
}
|
|
2184
|
-
},
|
|
2274
|
+
}, _callee15, this);
|
|
2185
2275
|
}));
|
|
2186
|
-
function apiLoadProductVariantsGrouped(
|
|
2276
|
+
function apiLoadProductVariantsGrouped(_x25) {
|
|
2187
2277
|
return _apiLoadProductVariantsGrouped.apply(this, arguments);
|
|
2188
2278
|
}
|
|
2189
2279
|
return apiLoadProductVariantsGrouped;
|
|
@@ -2191,11 +2281,11 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2191
2281
|
}, {
|
|
2192
2282
|
key: "apiSaveProducts",
|
|
2193
2283
|
value: function () {
|
|
2194
|
-
var _apiSaveProducts = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2284
|
+
var _apiSaveProducts = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee16(serverUrl, jwt, products, awaitPDF, removedProductIds) {
|
|
2195
2285
|
var _this$openModal3, _this$t3;
|
|
2196
2286
|
var fullUrl, response, status, BATCH_SIZE, productsPackages, groupIndex, baseProduct, i, _productsPackages$gro, _productsPackages$gro2, responseProducts, timeItTook, _i2, _this$openModal4, _this$t4, startTime, endTime, estTime, _loop3, j;
|
|
2197
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
2198
|
-
while (1) switch (
|
|
2287
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee16$(_context19) {
|
|
2288
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2199
2289
|
case 0:
|
|
2200
2290
|
fullUrl = serverUrl + '/v1/products/groups';
|
|
2201
2291
|
BATCH_SIZE = 10;
|
|
@@ -2204,22 +2294,22 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2204
2294
|
i = 0;
|
|
2205
2295
|
case 5:
|
|
2206
2296
|
if (!(i < products.length)) {
|
|
2207
|
-
|
|
2297
|
+
_context19.next = 15;
|
|
2208
2298
|
break;
|
|
2209
2299
|
}
|
|
2210
2300
|
if (!products[i].baseProduct) {
|
|
2211
|
-
|
|
2301
|
+
_context19.next = 9;
|
|
2212
2302
|
break;
|
|
2213
2303
|
}
|
|
2214
2304
|
baseProduct = products[i];
|
|
2215
|
-
return
|
|
2305
|
+
return _context19.abrupt("continue", 12);
|
|
2216
2306
|
case 9:
|
|
2217
2307
|
if (BATCH_SIZE < ((_productsPackages$gro = (_productsPackages$gro2 = productsPackages[groupIndex]) === null || _productsPackages$gro2 === void 0 ? void 0 : _productsPackages$gro2.length) !== null && _productsPackages$gro !== void 0 ? _productsPackages$gro : 0)) groupIndex++;
|
|
2218
2308
|
if (!productsPackages[groupIndex]) productsPackages[groupIndex] = [];
|
|
2219
2309
|
productsPackages[groupIndex].push(products[i]);
|
|
2220
2310
|
case 12:
|
|
2221
2311
|
i++;
|
|
2222
|
-
|
|
2312
|
+
_context19.next = 5;
|
|
2223
2313
|
break;
|
|
2224
2314
|
case 15:
|
|
2225
2315
|
responseProducts = [];
|
|
@@ -2232,13 +2322,13 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2232
2322
|
_i2 = 0;
|
|
2233
2323
|
case 19:
|
|
2234
2324
|
if (!(_i2 < productsPackages.length)) {
|
|
2235
|
-
|
|
2325
|
+
_context19.next = 47;
|
|
2236
2326
|
break;
|
|
2237
2327
|
}
|
|
2238
2328
|
if (baseProduct && _i2 == 0) productsPackages[_i2].unshift(baseProduct);
|
|
2239
2329
|
startTime = Date.now();
|
|
2240
|
-
|
|
2241
|
-
|
|
2330
|
+
_context19.prev = 22;
|
|
2331
|
+
_context19.next = 25;
|
|
2242
2332
|
return fetch(fullUrl, {
|
|
2243
2333
|
method: 'PUT',
|
|
2244
2334
|
headers: {
|
|
@@ -2258,18 +2348,18 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2258
2348
|
return res.json();
|
|
2259
2349
|
});
|
|
2260
2350
|
case 25:
|
|
2261
|
-
response =
|
|
2351
|
+
response = _context19.sent;
|
|
2262
2352
|
if (!response.Error) {
|
|
2263
|
-
|
|
2353
|
+
_context19.next = 28;
|
|
2264
2354
|
break;
|
|
2265
2355
|
}
|
|
2266
2356
|
throw new Error('Error saving Basket and Products. serverError: ' + response.Error);
|
|
2267
2357
|
case 28:
|
|
2268
|
-
|
|
2358
|
+
_context19.next = 33;
|
|
2269
2359
|
break;
|
|
2270
2360
|
case 30:
|
|
2271
|
-
|
|
2272
|
-
|
|
2361
|
+
_context19.prev = 30;
|
|
2362
|
+
_context19.t0 = _context19["catch"](22);
|
|
2273
2363
|
throw Error(status);
|
|
2274
2364
|
case 33:
|
|
2275
2365
|
endTime = Date.now();
|
|
@@ -2283,8 +2373,8 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2283
2373
|
dontRenderForm: true
|
|
2284
2374
|
});
|
|
2285
2375
|
_loop3 = /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _loop3(j) {
|
|
2286
|
-
return _regeneratorRuntime__default["default"].wrap(function _loop3$(
|
|
2287
|
-
while (1) switch (
|
|
2376
|
+
return _regeneratorRuntime__default["default"].wrap(function _loop3$(_context18) {
|
|
2377
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2288
2378
|
case 0:
|
|
2289
2379
|
if (response.products[j].baseProduct) baseProduct = response.products[j];
|
|
2290
2380
|
if (!responseProducts.find(function (p) {
|
|
@@ -2294,34 +2384,34 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2294
2384
|
}
|
|
2295
2385
|
case 2:
|
|
2296
2386
|
case "end":
|
|
2297
|
-
return
|
|
2387
|
+
return _context18.stop();
|
|
2298
2388
|
}
|
|
2299
2389
|
}, _loop3);
|
|
2300
2390
|
});
|
|
2301
2391
|
j = 0;
|
|
2302
2392
|
case 39:
|
|
2303
2393
|
if (!(j < response.products.length)) {
|
|
2304
|
-
|
|
2394
|
+
_context19.next = 44;
|
|
2305
2395
|
break;
|
|
2306
2396
|
}
|
|
2307
|
-
return
|
|
2397
|
+
return _context19.delegateYield(_loop3(j), "t1", 41);
|
|
2308
2398
|
case 41:
|
|
2309
2399
|
j++;
|
|
2310
|
-
|
|
2400
|
+
_context19.next = 39;
|
|
2311
2401
|
break;
|
|
2312
2402
|
case 44:
|
|
2313
2403
|
_i2++;
|
|
2314
|
-
|
|
2404
|
+
_context19.next = 19;
|
|
2315
2405
|
break;
|
|
2316
2406
|
case 47:
|
|
2317
|
-
return
|
|
2407
|
+
return _context19.abrupt("return", responseProducts);
|
|
2318
2408
|
case 48:
|
|
2319
2409
|
case "end":
|
|
2320
|
-
return
|
|
2410
|
+
return _context19.stop();
|
|
2321
2411
|
}
|
|
2322
|
-
},
|
|
2412
|
+
}, _callee16, this, [[22, 30]]);
|
|
2323
2413
|
}));
|
|
2324
|
-
function apiSaveProducts(
|
|
2414
|
+
function apiSaveProducts(_x26, _x27, _x28, _x29, _x30) {
|
|
2325
2415
|
return _apiSaveProducts.apply(this, arguments);
|
|
2326
2416
|
}
|
|
2327
2417
|
return apiSaveProducts;
|
|
@@ -2546,10 +2636,10 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2546
2636
|
}, {
|
|
2547
2637
|
key: "loadSelectOptions",
|
|
2548
2638
|
value: function () {
|
|
2549
|
-
var _loadSelectOptions = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function
|
|
2639
|
+
var _loadSelectOptions = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee17(sessionGuid, dataSource, additionalFilter) {
|
|
2550
2640
|
var values, apiUrl, i, apiResult, _i3, value, text;
|
|
2551
|
-
return _regeneratorRuntime__default["default"].wrap(function
|
|
2552
|
-
while (1) switch (
|
|
2641
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee17$(_context20) {
|
|
2642
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2553
2643
|
case 0:
|
|
2554
2644
|
values = [];
|
|
2555
2645
|
apiUrl = dataSource.url;
|
|
@@ -2558,7 +2648,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2558
2648
|
apiUrl += '&' + additionalFilter[i].key + '=' + additionalFilter[i].value;
|
|
2559
2649
|
}
|
|
2560
2650
|
}
|
|
2561
|
-
|
|
2651
|
+
_context20.next = 5;
|
|
2562
2652
|
return fetch(apiUrl, {
|
|
2563
2653
|
headers: {
|
|
2564
2654
|
sessionGuid: sessionGuid
|
|
@@ -2570,7 +2660,7 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2570
2660
|
return res.json();
|
|
2571
2661
|
});
|
|
2572
2662
|
case 5:
|
|
2573
|
-
apiResult =
|
|
2663
|
+
apiResult = _context20.sent;
|
|
2574
2664
|
if (dataSource.useKey) {
|
|
2575
2665
|
apiResult = apiResult[dataSource.useKey];
|
|
2576
2666
|
}
|
|
@@ -2582,14 +2672,14 @@ var ProductHandlerAbstract = /*#__PURE__*/function () {
|
|
|
2582
2672
|
text: text
|
|
2583
2673
|
});
|
|
2584
2674
|
}
|
|
2585
|
-
return
|
|
2675
|
+
return _context20.abrupt("return", values);
|
|
2586
2676
|
case 9:
|
|
2587
2677
|
case "end":
|
|
2588
|
-
return
|
|
2678
|
+
return _context20.stop();
|
|
2589
2679
|
}
|
|
2590
|
-
},
|
|
2680
|
+
}, _callee17);
|
|
2591
2681
|
}));
|
|
2592
|
-
function loadSelectOptions(
|
|
2682
|
+
function loadSelectOptions(_x31, _x32, _x33) {
|
|
2593
2683
|
return _loadSelectOptions.apply(this, arguments);
|
|
2594
2684
|
}
|
|
2595
2685
|
return loadSelectOptions;
|