@bringg/dashboard-sdk 9.50.4-pre → 9.50.4

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.
@@ -842,7 +842,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
842
842
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
843
843
 
844
844
  "use strict";
845
- eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ExclusionWindowApi = void 0;\nvar data_store_1 = __importDefault(__webpack_require__(/*! ../../data-store */ \"./dist/data-store.js\"));\nvar storable_data_service_1 = __importDefault(__webpack_require__(/*! ../../storable-data-service */ \"./dist/storable-data-service.js\"));\nvar exclusion_window_consts_1 = __webpack_require__(/*! ./exclusion-window.consts */ \"./dist/ExclusionWindow/v2/exclusion-window.consts.js\");\nvar exclusion_window_service_1 = __importDefault(__webpack_require__(/*! ./exclusion-window-service */ \"./dist/ExclusionWindow/v2/exclusion-window-service.js\"));\nvar ExclusionWindowApi = /** @class */ (function () {\n function ExclusionWindowApi(session) {\n var groupFilters = [\n {\n groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team,\n keyFunc: function (exclusionWindow) { return exclusionWindow.team_id; }\n }\n ];\n this.exclusionWindowStore = new data_store_1.default(groupFilters);\n this.exclusionWindowService = new exclusion_window_service_1.default(session);\n this.storableDataService = new storable_data_service_1.default(this.exclusionWindowStore);\n }\n ExclusionWindowApi.prototype.loadAllByTeam = function (request, options) {\n var _this = this;\n return this.storableDataService.loadAll('loadAllByTeam', function () { return _this.exclusionWindowService.loadAllByTeam(request); }, __assign(__assign({}, options), { groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team, groupValue: request.team_id }));\n };\n ExclusionWindowApi.prototype.loadAllWithoutTeam = function (request, options) {\n var _this = this;\n return this.storableDataService.loadAll('loadAllWithoutTeam', function () { return _this.exclusionWindowService.loadAllWithoutTeam(request); }, __assign(__assign({}, options), { groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team, groupValue: null }));\n };\n ExclusionWindowApi.prototype.create = function (request) {\n var _this = this;\n return this.storableDataService.modify('create', function () { return _this.exclusionWindowService.create(request); });\n };\n ExclusionWindowApi.prototype.update = function (id, request) {\n var _this = this;\n return this.storableDataService.modify('update', function () { return _this.exclusionWindowService.update(id, request); });\n };\n ExclusionWindowApi.prototype.createMany = function (request) {\n var _this = this;\n return this.storableDataService.modifyMany('createMany', function () { return _this.exclusionWindowService.createMany(request); });\n };\n ExclusionWindowApi.prototype.delete = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var response;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.storableDataService.delete('delete', function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.exclusionWindowService.delete(id)];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n }); }, id)];\n case 1:\n _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n ExclusionWindowApi.prototype.copyFromMerchant = function (teamId, exclusionWindowId) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.exclusionWindowService.copyFromMerchant(teamId, exclusionWindowId)];\n });\n });\n };\n ExclusionWindowApi.prototype.get = function (id) {\n return this.exclusionWindowStore.get(id);\n };\n ExclusionWindowApi.prototype.getByIds = function (ids) {\n var _this = this;\n return ids.map(function (id) { return _this.get(id); });\n };\n ExclusionWindowApi.prototype.getAll = function () {\n return this.exclusionWindowStore.getAll();\n };\n ExclusionWindowApi.prototype.removeAll = function () {\n this.exclusionWindowStore.removeAll();\n };\n ExclusionWindowApi.prototype.getGroup = function (group, groupValue) {\n return this.exclusionWindowStore.getGroup(group, groupValue);\n };\n return ExclusionWindowApi;\n}());\nexports.ExclusionWindowApi = ExclusionWindowApi;\n//# sourceMappingURL=exclusion-window-api.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/ExclusionWindow/v2/exclusion-window-api.js?");
845
+ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ExclusionWindowApi = void 0;\nvar data_store_1 = __importDefault(__webpack_require__(/*! ../../data-store */ \"./dist/data-store.js\"));\nvar storable_data_service_1 = __importDefault(__webpack_require__(/*! ../../storable-data-service */ \"./dist/storable-data-service.js\"));\nvar exclusion_window_consts_1 = __webpack_require__(/*! ./exclusion-window.consts */ \"./dist/ExclusionWindow/v2/exclusion-window.consts.js\");\nvar exclusion_window_service_1 = __importDefault(__webpack_require__(/*! ./exclusion-window-service */ \"./dist/ExclusionWindow/v2/exclusion-window-service.js\"));\nvar ExclusionWindowApi = /** @class */ (function () {\n function ExclusionWindowApi(session) {\n var groupFilters = [\n {\n groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team,\n keyFunc: function (exclusionWindow) { return exclusionWindow.team_id; }\n }\n ];\n this.exclusionWindowStore = new data_store_1.default(groupFilters);\n this.exclusionWindowService = new exclusion_window_service_1.default(session);\n this.storableDataService = new storable_data_service_1.default(this.exclusionWindowStore);\n }\n ExclusionWindowApi.prototype.loadAllByTeam = function (request, options) {\n var _this = this;\n return this.storableDataService.loadAll('loadAllByTeam', function () { return _this.exclusionWindowService.loadAllByTeam(request); }, __assign(__assign({}, options), { groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team, groupValue: request.team_id }));\n };\n ExclusionWindowApi.prototype.loadAllWithoutTeam = function (request, options) {\n var _this = this;\n return this.storableDataService.loadAll('loadAllWithoutTeam', function () { return _this.exclusionWindowService.loadAllWithoutTeam(request); }, __assign(__assign({}, options), { groupType: exclusion_window_consts_1.ExclusionWindowsFilterGroups.Team, groupValue: null }));\n };\n ExclusionWindowApi.prototype.create = function (request) {\n var _this = this;\n return this.storableDataService.modify('create', function () { return _this.exclusionWindowService.create(request); });\n };\n ExclusionWindowApi.prototype.update = function (id, request) {\n var _this = this;\n return this.storableDataService.modify('update', function () { return _this.exclusionWindowService.update(id, request); });\n };\n ExclusionWindowApi.prototype.createMany = function (request) {\n var _this = this;\n return this.storableDataService.modifyMany('createMany', function () { return _this.exclusionWindowService.createMany(request); });\n };\n ExclusionWindowApi.prototype.delete = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var response;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.storableDataService.delete('delete', function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.exclusionWindowService.delete(id)];\n case 1:\n response = _a.sent();\n return [2 /*return*/];\n }\n });\n }); }, id)];\n case 1:\n _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n ExclusionWindowApi.prototype.copyFromMerchant = function (teamId, exclusionWindowId) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, this.exclusionWindowService.copyFromMerchant(teamId, exclusionWindowId)];\n });\n });\n };\n ExclusionWindowApi.prototype.get = function (id) {\n return this.exclusionWindowStore.get(id);\n };\n ExclusionWindowApi.prototype.getByIds = function (ids) {\n var _this = this;\n return ids.map(function (id) { return _this.get(id); });\n };\n ExclusionWindowApi.prototype.getAll = function () {\n return this.exclusionWindowStore.getAll();\n };\n ExclusionWindowApi.prototype.removeAll = function () {\n this.exclusionWindowStore.removeAll();\n };\n ExclusionWindowApi.prototype.getGroup = function (group, groupValue) {\n return this.exclusionWindowStore.getGroup(group, groupValue);\n };\n return ExclusionWindowApi;\n}());\nexports.ExclusionWindowApi = ExclusionWindowApi;\n//# sourceMappingURL=exclusion-window-api.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/ExclusionWindow/v2/exclusion-window-api.js?");
846
846
 
847
847
  /***/ }),
848
848
 
@@ -2030,7 +2030,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
2030
2030
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2031
2031
 
2032
2032
  "use strict";
2033
- eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar CrudService_1 = __importDefault(__webpack_require__(/*! ../Core/CrudService */ \"./dist/Core/CrudService.js\"));\nvar RouteGenerator_1 = __webpack_require__(/*! ../Core/RouteGenerator */ \"./dist/Core/RouteGenerator.js\");\nvar Route_1 = __webpack_require__(/*! ../Services/Route */ \"./dist/Services/Route.js\");\nvar RouteOptimizationApi = /** @class */ (function () {\n function RouteOptimizationApi(session) {\n this.optimization = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);\n this.get_optimization_result = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);\n this.cancel_requests = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);\n this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);\n this.update_user_modified_data = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);\n this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);\n this.service = new CrudService_1.default(session, '');\n }\n RouteOptimizationApi.prototype.cancelRequests = function (requestUuids) {\n return this.service.handleAuthorizedRequest({\n route: this.cancel_requests,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call cancel optimization requests'),\n queryString: { request_uuids: requestUuids }\n });\n };\n RouteOptimizationApi.prototype.optimize = function (optimizationProps) {\n return this.service.handleAuthorizedRequest({\n route: this.optimization,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call optimization requests'),\n payload: optimizationProps\n });\n };\n RouteOptimizationApi.prototype.optimizationResult = function (request_uuid) {\n return this.service.handleAuthorizedRequest({\n route: this.get_optimization_result,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get optimization results'),\n routeParams: { request_uuid: request_uuid }\n });\n };\n RouteOptimizationApi.prototype.assignUsersByIds = function (teams) {\n var fiveMinutesInMs = 1000 * 60 * 5;\n return this.service.handleAuthorizedRequest({\n route: this.assign_users_by_ids,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign users by id'),\n payload: { origin: 'route_optimization', teams: teams },\n timeout: fiveMinutesInMs\n });\n };\n RouteOptimizationApi.prototype.updateOptimizationModifiedData = function (updateData) {\n return this.service.handleAuthorizedRequest({\n route: this.update_user_modified_data,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to update optimization user data'),\n payload: __assign({}, updateData)\n });\n };\n RouteOptimizationApi.prototype.assignUserManualOptimization = function (updateData) {\n var fiveMinutesInMs = 1000 * 60 * 5;\n return this.service.handleAuthorizedRequest({\n route: this.assign_user_manual_optimization,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign user manual optimization data'),\n payload: __assign({}, updateData),\n timeout: fiveMinutesInMs\n });\n };\n RouteOptimizationApi.prototype.calculatePlannedEta = function (data, _a) {\n if (_a === void 0) { _a = {}; }\n var _b = _a.timeout, timeout = _b === void 0 ? 10000 : _b, options = __rest(_a, [\"timeout\"]);\n return __awaiter(this, void 0, void 0, function () {\n var payload, result, asyncResult;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n payload = {\n team_id: data.team_id,\n data: __assign(__assign({}, data), { deadline: Date.now() + timeout })\n };\n return [4 /*yield*/, this.service.routeGenerator\n .post('/own-fleet-optimization-service/route_optimization/calculate_planned_eta')\n .withPayload(payload)\n .setException('Failed to calculate planned eta')\n .withCommonOptions(options)\n .invoke()];\n case 1:\n result = _c.sent();\n return [4 /*yield*/, this.service.session.sdk.asyncOperationStatus.waitForResponse({\n requestId: result.uuid,\n timeoutInMs: timeout,\n signal: options.signal\n })];\n case 2:\n asyncResult = _c.sent();\n return [2 /*return*/, asyncResult.data];\n }\n });\n });\n };\n return RouteOptimizationApi;\n}());\nexports[\"default\"] = RouteOptimizationApi;\n//# sourceMappingURL=RouteOptimizationApi.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/RouteOptimization/RouteOptimizationApi.js?");
2033
+ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar CrudService_1 = __importDefault(__webpack_require__(/*! ../Core/CrudService */ \"./dist/Core/CrudService.js\"));\nvar RouteGenerator_1 = __webpack_require__(/*! ../Core/RouteGenerator */ \"./dist/Core/RouteGenerator.js\");\nvar Route_1 = __webpack_require__(/*! ../Services/Route */ \"./dist/Services/Route.js\");\nvar RouteOptimizationApi = /** @class */ (function () {\n function RouteOptimizationApi(session) {\n this.optimization = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimize', 1 /* HttpMethod.POST */);\n this.get_optimization_result = new Route_1.Route('/own-fleet-optimization-service/route_optimization/get_optimization_result/{:request_uuid}', 0 /* HttpMethod.GET */);\n this.cancel_requests = new Route_1.Route('/own-fleet-optimization-service/route_optimization/optimization', 4 /* HttpMethod.DELETE */);\n this.assign_users_by_ids = new Route_1.Route('/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);\n this.assign_users_by_ids_in_background_process = new Route_1.Route('/own-fleet-optimization-service/route_optimizations/assign_users_by_ids', 1 /* HttpMethod.POST */);\n this.update_user_modified_data = new Route_1.Route('/own-fleet-optimization-service/route_optimization/update_user_modified_data', 1 /* HttpMethod.POST */);\n this.assign_user_manual_optimization = new Route_1.Route('/route_optimizations/assign_user_manual_optimization', 1 /* HttpMethod.POST */);\n this.service = new CrudService_1.default(session, '');\n }\n RouteOptimizationApi.prototype.cancelRequests = function (requestUuids) {\n return this.service.handleAuthorizedRequest({\n route: this.cancel_requests,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call cancel optimization requests'),\n queryString: { request_uuids: requestUuids }\n });\n };\n RouteOptimizationApi.prototype.optimize = function (optimizationProps) {\n return this.service.handleAuthorizedRequest({\n route: this.optimization,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to call optimization requests'),\n payload: optimizationProps\n });\n };\n RouteOptimizationApi.prototype.optimizationResult = function (request_uuid) {\n return this.service.handleAuthorizedRequest({\n route: this.get_optimization_result,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to get optimization results'),\n routeParams: { request_uuid: request_uuid }\n });\n };\n RouteOptimizationApi.prototype.assignUsersByIds = function (teams, isBackgroundProcess) {\n var fiveMinutesInMs = 1000 * 60 * 5;\n return this.service.handleAuthorizedRequest({\n route: isBackgroundProcess ? this.assign_users_by_ids_in_background_process : this.assign_users_by_ids,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign users by id'),\n payload: { origin: 'route_optimization', teams: teams },\n timeout: fiveMinutesInMs\n });\n };\n RouteOptimizationApi.prototype.updateOptimizationModifiedData = function (updateData) {\n return this.service.handleAuthorizedRequest({\n route: this.update_user_modified_data,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to update optimization user data'),\n payload: __assign({}, updateData)\n });\n };\n RouteOptimizationApi.prototype.assignUserManualOptimization = function (updateData) {\n var fiveMinutesInMs = 1000 * 60 * 5;\n return this.service.handleAuthorizedRequest({\n route: this.assign_user_manual_optimization,\n extractor: RouteGenerator_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Failed to assign user manual optimization data'),\n payload: __assign({}, updateData),\n timeout: fiveMinutesInMs\n });\n };\n RouteOptimizationApi.prototype.calculatePlannedEta = function (data, _a) {\n if (_a === void 0) { _a = {}; }\n var _b = _a.timeout, timeout = _b === void 0 ? 10000 : _b, options = __rest(_a, [\"timeout\"]);\n return __awaiter(this, void 0, void 0, function () {\n var payload, result, asyncResult;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n payload = {\n team_id: data.team_id,\n data: __assign(__assign({}, data), { deadline: Date.now() + timeout })\n };\n return [4 /*yield*/, this.service.routeGenerator\n .post('/own-fleet-optimization-service/route_optimization/calculate_planned_eta')\n .withPayload(payload)\n .setException('Failed to calculate planned eta')\n .withCommonOptions(options)\n .invoke()];\n case 1:\n result = _c.sent();\n return [4 /*yield*/, this.service.session.sdk.asyncOperationStatus.waitForResponse({\n requestId: result.uuid,\n timeoutInMs: timeout,\n signal: options.signal\n })];\n case 2:\n asyncResult = _c.sent();\n return [2 /*return*/, asyncResult.data];\n }\n });\n });\n };\n return RouteOptimizationApi;\n}());\nexports[\"default\"] = RouteOptimizationApi;\n//# sourceMappingURL=RouteOptimizationApi.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/RouteOptimization/RouteOptimizationApi.js?");
2034
2034
 
2035
2035
  /***/ }),
2036
2036
 
@@ -2349,7 +2349,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
2349
2349
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2350
2350
 
2351
2351
  "use strict";
2352
- eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __importDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar Logger_1 = __importDefault(__webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\"));\nvar abort_1 = __webpack_require__(/*! ../utils/abort */ \"./dist/utils/abort.js\");\nvar version = '9.50.4-pre';\nfunction logErrorResponse(response) {\n var data = response.data, status = response.status;\n try {\n Logger_1.default.error(response.config.method.toUpperCase(), response.config.url, status);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) {\n //\n }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, queryString, authenticationToken, headers, responseType, signal) {\n // NiceToHave: move headers to HttpHeaders class\n this.headers = __assign(__assign({ 'Content-Type': 'application/json' }, headers), { 'sdk-version': version, Client: clientId });\n this.timeout = timeout;\n this.validateStatus = lodash_1.stubTrue;\n if (queryString) {\n this.params = queryString;\n }\n if (authenticationToken) {\n this.headers['Authorization'] = \"Token token=\".concat(authenticationToken);\n }\n if (responseType) {\n this.responseType = responseType;\n }\n if (signal) {\n this.signal = signal;\n }\n }\n RequestOptions.new = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.clientId, clientId = _c === void 0 ? 'Bringg Dashboard' : _c, _d = _b.timeout, timeout = _d === void 0 ? DEFAULT_TIMEOUT : _d, queryString = _b.queryString, authenticationToken = _b.authenticationToken, headers = _b.headers, responseType = _b.responseType, signal = _b.signal;\n return new RequestOptions(clientId, timeout || DEFAULT_TIMEOUT, queryString, authenticationToken, headers, responseType, signal);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response, signal) {\n this.axiosPromise = response;\n this.signal = signal;\n }\n ResponseHandler.prototype.handle = function (consumer) {\n return __awaiter(this, void 0, void 0, function () {\n var axiosResponse, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if ((0, lodash_1.isUndefined)(consumer)) {\n throw new Error('consumer must be defined');\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.axiosPromise];\n case 2:\n axiosResponse = _a.sent();\n return [2 /*return*/, consumer(axiosResponse)];\n case 3:\n e_1 = _a.sent();\n if (axios_1.default.isCancel(e_1)) {\n (0, abort_1.throwAbortError)(this.signal, 'Request Aborted');\n }\n if (e_1 instanceof BringgException_1.BringgException) {\n throw e_1;\n }\n return [2 /*return*/, consumer(e_1)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n return ResponseHandler;\n}());\nexports.ResponseHandler = ResponseHandler;\nfunction get(axiosInstance, host, uri, queryString, signal) {\n return new ResponseHandler(axiosInstance.get(\"\".concat(host).concat(uri), { params: queryString, signal: signal }), signal);\n}\nfunction post(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.post(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction put(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.put(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction patch(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.patch(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction remove(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.delete(\"\".concat(host).concat(uri), { params: queryString, data: payload, signal: signal }), signal);\n}\nfunction routify(axiosInstance, endpoint, route, routeParams, queryString, payload, signal) {\n switch (route.httpMethod) {\n case 0 /* HttpMethod.GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, signal);\n case 1 /* HttpMethod.POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 2 /* HttpMethod.PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 3 /* HttpMethod.PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 4 /* HttpMethod.DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n }\n}\nfunction wrapWithInterceptors(axios) {\n axios.interceptors.request.use(function (req) {\n var method = req.method, url = req.url, params = req.params, headers = req.headers, data = req.data;\n try {\n Logger_1.default.debug('REQUEST:', method.toUpperCase(), url);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('REQUEST-query-string:', params);\n Logger_1.default.trace('REQUEST-headers:', headers);\n Logger_1.default.trace('REQUEST-data:', data);\n }\n catch (e) {\n //\n }\n return req;\n });\n axios.interceptors.response.use(function (res) {\n var statusText = res.statusText, status = res.status, headers = res.headers, data = res.data;\n try {\n Logger_1.default.debug('RESPONSE:', res.config.url, status, statusText);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) {\n //\n }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, headers, responseType, timeout, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers, responseType: responseType, timeout: timeout, signal: signal })));\n}\nfunction anonymousAxiosInstance(clientId, headers, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers, signal: signal })));\n}\nvar AuthorizedServiceRequest = /** @class */ (function () {\n function AuthorizedServiceRequest(clientId, authToken) {\n this.authToken = authToken;\n this.clientId = clientId;\n }\n AuthorizedServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload, headers, responseType, timeout, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(axiosInstance(this.clientId, this.authToken, headers, responseType, timeout), endpoint, route, routeParams, queryString, payload, signal);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId, headers) {\n this.clientId = clientId;\n this.headers = headers;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(anonymousAxiosInstance(this.clientId, this.headers, signal), endpoint, route, routeParams, queryString, payload);\n };\n return AnonymousServiceRequest;\n}());\nexports.AnonymousServiceRequest = AnonymousServiceRequest;\n//# sourceMappingURL=ServiceRequest.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/ServiceRequest.js?");
2352
+ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __importDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar Logger_1 = __importDefault(__webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\"));\nvar abort_1 = __webpack_require__(/*! ../utils/abort */ \"./dist/utils/abort.js\");\nvar version = '9.50.4';\nfunction logErrorResponse(response) {\n var data = response.data, status = response.status;\n try {\n Logger_1.default.error(response.config.method.toUpperCase(), response.config.url, status);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) {\n //\n }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, queryString, authenticationToken, headers, responseType, signal) {\n // NiceToHave: move headers to HttpHeaders class\n this.headers = __assign(__assign({ 'Content-Type': 'application/json' }, headers), { 'sdk-version': version, Client: clientId });\n this.timeout = timeout;\n this.validateStatus = lodash_1.stubTrue;\n if (queryString) {\n this.params = queryString;\n }\n if (authenticationToken) {\n this.headers['Authorization'] = \"Token token=\".concat(authenticationToken);\n }\n if (responseType) {\n this.responseType = responseType;\n }\n if (signal) {\n this.signal = signal;\n }\n }\n RequestOptions.new = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.clientId, clientId = _c === void 0 ? 'Bringg Dashboard' : _c, _d = _b.timeout, timeout = _d === void 0 ? DEFAULT_TIMEOUT : _d, queryString = _b.queryString, authenticationToken = _b.authenticationToken, headers = _b.headers, responseType = _b.responseType, signal = _b.signal;\n return new RequestOptions(clientId, timeout || DEFAULT_TIMEOUT, queryString, authenticationToken, headers, responseType, signal);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response, signal) {\n this.axiosPromise = response;\n this.signal = signal;\n }\n ResponseHandler.prototype.handle = function (consumer) {\n return __awaiter(this, void 0, void 0, function () {\n var axiosResponse, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if ((0, lodash_1.isUndefined)(consumer)) {\n throw new Error('consumer must be defined');\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.axiosPromise];\n case 2:\n axiosResponse = _a.sent();\n return [2 /*return*/, consumer(axiosResponse)];\n case 3:\n e_1 = _a.sent();\n if (axios_1.default.isCancel(e_1)) {\n (0, abort_1.throwAbortError)(this.signal, 'Request Aborted');\n }\n if (e_1 instanceof BringgException_1.BringgException) {\n throw e_1;\n }\n return [2 /*return*/, consumer(e_1)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n return ResponseHandler;\n}());\nexports.ResponseHandler = ResponseHandler;\nfunction get(axiosInstance, host, uri, queryString, signal) {\n return new ResponseHandler(axiosInstance.get(\"\".concat(host).concat(uri), { params: queryString, signal: signal }), signal);\n}\nfunction post(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.post(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction put(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.put(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction patch(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.patch(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction remove(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.delete(\"\".concat(host).concat(uri), { params: queryString, data: payload, signal: signal }), signal);\n}\nfunction routify(axiosInstance, endpoint, route, routeParams, queryString, payload, signal) {\n switch (route.httpMethod) {\n case 0 /* HttpMethod.GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, signal);\n case 1 /* HttpMethod.POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 2 /* HttpMethod.PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 3 /* HttpMethod.PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 4 /* HttpMethod.DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n }\n}\nfunction wrapWithInterceptors(axios) {\n axios.interceptors.request.use(function (req) {\n var method = req.method, url = req.url, params = req.params, headers = req.headers, data = req.data;\n try {\n Logger_1.default.debug('REQUEST:', method.toUpperCase(), url);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('REQUEST-query-string:', params);\n Logger_1.default.trace('REQUEST-headers:', headers);\n Logger_1.default.trace('REQUEST-data:', data);\n }\n catch (e) {\n //\n }\n return req;\n });\n axios.interceptors.response.use(function (res) {\n var statusText = res.statusText, status = res.status, headers = res.headers, data = res.data;\n try {\n Logger_1.default.debug('RESPONSE:', res.config.url, status, statusText);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) {\n //\n }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, headers, responseType, timeout, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers, responseType: responseType, timeout: timeout, signal: signal })));\n}\nfunction anonymousAxiosInstance(clientId, headers, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers, signal: signal })));\n}\nvar AuthorizedServiceRequest = /** @class */ (function () {\n function AuthorizedServiceRequest(clientId, authToken) {\n this.authToken = authToken;\n this.clientId = clientId;\n }\n AuthorizedServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload, headers, responseType, timeout, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(axiosInstance(this.clientId, this.authToken, headers, responseType, timeout), endpoint, route, routeParams, queryString, payload, signal);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId, headers) {\n this.clientId = clientId;\n this.headers = headers;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(anonymousAxiosInstance(this.clientId, this.headers, signal), endpoint, route, routeParams, queryString, payload);\n };\n return AnonymousServiceRequest;\n}());\nexports.AnonymousServiceRequest = AnonymousServiceRequest;\n//# sourceMappingURL=ServiceRequest.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/ServiceRequest.js?");
2353
2353
 
2354
2354
  /***/ }),
2355
2355
 
@@ -3449,7 +3449,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar
3449
3449
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3450
3450
 
3451
3451
  "use strict";
3452
- eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgDashboardSDK_1 = __webpack_require__(/*! ./BringgDashboardSDK */ \"./dist/BringgDashboardSDK.js\");\nvar data_entity_1 = __webpack_require__(/*! ./data-entity */ \"./dist/data-entity.js\");\nvar StorableDataService = /** @class */ (function () {\n function StorableDataService(dataStore, mapper, extraDataStores) {\n var _this = this;\n this.dataStore = dataStore;\n this.extraDataStores = extraDataStores || [];\n this.mapper = mapper || (function (item) { return ({ current: item, diff: _this.dataStore.get(item.id) }); });\n }\n StorableDataService.prototype.loadAll = function (action, loadFunc, options) {\n return __awaiter(this, void 0, void 0, function () {\n var unloadedItems, shouldLoad, groupValue, loadFnIdsParams, items, mappedItems_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n unloadedItems = [];\n shouldLoad = false;\n if (Array.isArray(options.groupValue)) {\n unloadedItems = options.groupValue.filter(function (value) { return !_this.dataStore.isGroupInitialized(options.groupType, value); });\n shouldLoad = unloadedItems.length > 0;\n groupValue = unloadedItems;\n }\n else {\n shouldLoad = !this.dataStore.isGroupInitialized(options.groupType, options.groupValue);\n groupValue = options.groupValue;\n }\n if (!(!options.useCache || shouldLoad)) return [3 /*break*/, 2];\n loadFnIdsParams = groupValue;\n if (!options.useCache) {\n loadFnIdsParams = options.groupValue;\n }\n return [4 /*yield*/, loadFunc(loadFnIdsParams)];\n case 1:\n items = _a.sent();\n mappedItems_1 = items.map(function (item) { return _this.mapper(item, { action: action }); });\n if (options.groupType) {\n this.dataStore.setGroup(options.groupType, groupValue, mappedItems_1);\n }\n else {\n this.dataStore.setAll(mappedItems_1);\n }\n this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(mappedItems_1, options.fields); });\n _a.label = 2;\n case 2: return [2 /*return*/, options.groupType\n ? this.dataStore.getGroup(options.groupType, options.groupValue)\n : this.dataStore.getAll()];\n }\n });\n });\n };\n StorableDataService.prototype.loadMany = function (action, loadFunc, ids, options) {\n return __awaiter(this, void 0, void 0, function () {\n var unloadedIds, clientItems;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n if (!options.useCache) {\n return [2 /*return*/, this.loadInChunks(ids, loadFunc, action, options)];\n }\n unloadedIds = ids.filter(function (id) {\n var item = _this.dataStore.get(id);\n if (!item) {\n return true;\n }\n return _this.extraDataStores.some(function (dataStore) { return !dataStore.has(item, options.fields); });\n });\n if (!(ids.length === 0 || unloadedIds.length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.loadInChunks(unloadedIds, loadFunc, action, options)];\n case 1:\n clientItems = _a.sent();\n if (ids.length === 0) {\n return [2 /*return*/, clientItems];\n }\n _a.label = 2;\n case 2: return [2 /*return*/, ids.map(function (id) { return _this.dataStore.get(id); }).filter(Boolean)];\n }\n });\n });\n };\n StorableDataService.prototype.loadInChunks = function (idsToLoad, loadFunc, action, options) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var allClientItems, items, clientItems, chunkSize, i, chunkIds, items, clientItems;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n allClientItems = [];\n if (!(idsToLoad.length === 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, loadFunc([])];\n case 1:\n items = _b.sent();\n clientItems = this.updateManyInStores(items, action, options.fields);\n allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));\n return [3 /*break*/, 6];\n case 2:\n chunkSize = options.chunkSize || idsToLoad.length;\n i = 0;\n _b.label = 3;\n case 3:\n if (!(i < idsToLoad.length)) return [3 /*break*/, 6];\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n throw new Error('Operation was aborted');\n }\n chunkIds = idsToLoad.slice(i, i + chunkSize);\n return [4 /*yield*/, loadFunc(chunkIds)];\n case 4:\n items = _b.sent();\n clientItems = this.updateManyInStores(items, action, options.fields);\n allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));\n _b.label = 5;\n case 5:\n i += chunkSize;\n return [3 /*break*/, 3];\n case 6: return [2 /*return*/, allClientItems.map(function (mappedItems) { return mappedItems.current; })];\n }\n });\n });\n };\n StorableDataService.prototype.load = function (action, loadFunc, id, options) {\n return __awaiter(this, void 0, void 0, function () {\n var item;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n if (!(!options.useCache || !this.dataStore.get(id))) return [3 /*break*/, 2];\n return [4 /*yield*/, loadFunc()];\n case 1:\n item = _a.sent();\n this.updateInStores(item, action);\n _a.label = 2;\n case 2: return [2 /*return*/, this.dataStore.get(id)];\n }\n });\n });\n };\n StorableDataService.prototype.modify = function (action, updateFunc, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var item, modifiedItems;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, updateFunc()];\n case 1:\n item = _a.sent();\n modifiedItems = this.updateInStores(item, action);\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(modifiedItems);\n return [2 /*return*/, modifiedItems.current];\n }\n });\n });\n };\n StorableDataService.prototype.modifyMany = function (action, updateFunc, fields, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var items, modifiedItems;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, updateFunc()];\n case 1:\n items = _a.sent();\n modifiedItems = this.updateManyInStores(items, action, fields);\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(modifiedItems);\n return [2 /*return*/, modifiedItems.map(function (mappedItems) { return mappedItems.current; })];\n }\n });\n });\n };\n // If I'm not mistaken delete for Automations doesn't return { success: true }\n // We should align the API contract instead of introducing workarounds\n StorableDataService.prototype.delete = function (action, deleteFunc, id) {\n return __awaiter(this, void 0, void 0, function () {\n var response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, deleteFunc()];\n case 1:\n response = _a.sent();\n if (response.success || (0, lodash_1.isNil)(response.success)) {\n return [2 /*return*/, this.removeFromStores(id)];\n }\n return [2 /*return*/, undefined];\n }\n });\n });\n };\n StorableDataService.prototype.deleteMany = function (action, deleteFunc, ids) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, deleteFunc()];\n case 1:\n _a.sent();\n return [2 /*return*/, (0, BringgDashboardSDK_1.getGlobals)().mobx.runInAction(function () {\n return ids.map(function (id) { return _this.removeFromStores(id); });\n })];\n }\n });\n });\n };\n StorableDataService.prototype.updateInStores = function (item, action, fields, extraMapperParams) {\n return this.updateManyInStores([item], action, fields, extraMapperParams)[0];\n };\n StorableDataService.prototype.updateManyInStores = function (items, action, fields, extraMapperParams) {\n var _this = this;\n return (0, BringgDashboardSDK_1.getGlobals)().mobx.runInAction(function () {\n var clientItems = items.map(function (item) { return _this.mapper(item, __assign({ action: action }, extraMapperParams)); });\n _this.dataStore.setMany(clientItems);\n _this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(clientItems, fields); });\n return clientItems;\n });\n };\n StorableDataService.prototype.removeFromStores = function (id) {\n var item = this.dataStore.get(id);\n this.dataStore.remove(id);\n this.extraDataStores.forEach(function (dataStore) { return dataStore.remove(id); });\n return item;\n };\n StorableDataService.prototype.getFromStores = function (ids, fields) {\n var _this = this;\n return ids\n .map(function (id) {\n var item = _this.dataStore.get(id);\n return item && (!fields || _this.extraDataStores.every(function (dataStore) { return dataStore.has(item, fields); }))\n ? item\n : undefined;\n })\n .filter(Boolean);\n };\n return StorableDataService;\n}());\nexports[\"default\"] = StorableDataService;\n//# sourceMappingURL=storable-data-service.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/storable-data-service.js?");
3452
+ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgDashboardSDK_1 = __webpack_require__(/*! ./BringgDashboardSDK */ \"./dist/BringgDashboardSDK.js\");\nvar data_entity_1 = __webpack_require__(/*! ./data-entity */ \"./dist/data-entity.js\");\nvar StorableDataService = /** @class */ (function () {\n function StorableDataService(dataStore, mapper, extraDataStores) {\n var _this = this;\n this.dataStore = dataStore;\n this.extraDataStores = extraDataStores || [];\n this.mapper = mapper || (function (item) { return ({ current: item, diff: _this.dataStore.get(item.id) }); });\n }\n StorableDataService.prototype.loadAll = function (action, loadFunc, options) {\n return __awaiter(this, void 0, void 0, function () {\n var unloadedItems, shouldLoad, groupValue, loadFnIdsParams, items, mappedItems_1;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n unloadedItems = [];\n shouldLoad = false;\n if (Array.isArray(options.groupValue)) {\n unloadedItems = options.groupValue.filter(function (value) { return !_this.dataStore.isGroupInitialized(options.groupType, value); });\n shouldLoad = unloadedItems.length > 0;\n groupValue = unloadedItems;\n }\n else {\n shouldLoad = !this.dataStore.isGroupInitialized(options.groupType, options.groupValue);\n groupValue = options.groupValue;\n }\n if (!(!options.useCache || shouldLoad)) return [3 /*break*/, 2];\n loadFnIdsParams = groupValue;\n if (!options.useCache) {\n loadFnIdsParams = options.groupValue;\n }\n return [4 /*yield*/, loadFunc(loadFnIdsParams)];\n case 1:\n items = _a.sent();\n mappedItems_1 = items.map(function (item) { return _this.mapper(item, { action: action }); });\n if (options.groupType) {\n this.dataStore.setGroup(options.groupType, groupValue, mappedItems_1);\n }\n else {\n this.dataStore.setAll(mappedItems_1);\n }\n this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(mappedItems_1, options.fields); });\n _a.label = 2;\n case 2: return [2 /*return*/, options.groupType\n ? this.dataStore.getGroup(options.groupType, options.groupValue)\n : this.dataStore.getAll()];\n }\n });\n });\n };\n StorableDataService.prototype.loadMany = function (action, loadFunc, ids, options) {\n return __awaiter(this, void 0, void 0, function () {\n var unloadedIds, clientItems;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n if (!options.useCache) {\n return [2 /*return*/, this.loadInChunks(ids, loadFunc, action, options)];\n }\n unloadedIds = ids.filter(function (id) {\n var item = _this.dataStore.get(id);\n if (!item) {\n return true;\n }\n return _this.extraDataStores.some(function (dataStore) { return !dataStore.has(item, options.fields); });\n });\n if (!(ids.length === 0 || unloadedIds.length > 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, this.loadInChunks(unloadedIds, loadFunc, action, options)];\n case 1:\n clientItems = _a.sent();\n if (ids.length === 0) {\n return [2 /*return*/, clientItems];\n }\n _a.label = 2;\n case 2: return [2 /*return*/, ids.map(function (id) { return _this.dataStore.get(id); }).filter(Boolean)];\n }\n });\n });\n };\n StorableDataService.prototype.loadInChunks = function (idsToLoad, loadFunc, action, options) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var allClientItems, items, clientItems, chunkSize, i, chunkIds, items, clientItems;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n allClientItems = [];\n if (!(idsToLoad.length === 0)) return [3 /*break*/, 2];\n return [4 /*yield*/, loadFunc([])];\n case 1:\n items = _b.sent();\n clientItems = this.updateManyInStores(items, action, options.fields);\n allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));\n return [3 /*break*/, 6];\n case 2:\n chunkSize = options.chunkSize || idsToLoad.length;\n i = 0;\n _b.label = 3;\n case 3:\n if (!(i < idsToLoad.length)) return [3 /*break*/, 6];\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n throw new Error('Operation was aborted');\n }\n chunkIds = idsToLoad.slice(i, i + chunkSize);\n return [4 /*yield*/, loadFunc(chunkIds)];\n case 4:\n items = _b.sent();\n clientItems = this.updateManyInStores(items, action, options.fields);\n allClientItems.push.apply(allClientItems, __spreadArray([], __read(clientItems), false));\n _b.label = 5;\n case 5:\n i += chunkSize;\n return [3 /*break*/, 3];\n case 6: return [2 /*return*/, allClientItems.map(function (mappedItems) { return mappedItems.current; })];\n }\n });\n });\n };\n StorableDataService.prototype.load = function (action, loadFunc, id, options) {\n return __awaiter(this, void 0, void 0, function () {\n var item;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n options = (0, lodash_1.defaults)(options, data_entity_1.DEFAULT_OPTIONS);\n if (!(!options.useCache || !this.dataStore.get(id))) return [3 /*break*/, 2];\n return [4 /*yield*/, loadFunc()];\n case 1:\n item = _a.sent();\n this.updateInStores(item, action);\n _a.label = 2;\n case 2: return [2 /*return*/, this.dataStore.get(id)];\n }\n });\n });\n };\n StorableDataService.prototype.modify = function (action, updateFunc, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var item, modifiedItems;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, updateFunc()];\n case 1:\n item = _a.sent();\n modifiedItems = this.updateInStores(item, action);\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(modifiedItems);\n return [2 /*return*/, modifiedItems.current];\n }\n });\n });\n };\n StorableDataService.prototype.modifyMany = function (action, updateFunc, fields, onUpdate) {\n return __awaiter(this, void 0, void 0, function () {\n var items, modifiedItems;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, updateFunc()];\n case 1:\n items = _a.sent();\n modifiedItems = this.updateManyInStores(items, action, fields);\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(modifiedItems);\n return [2 /*return*/, modifiedItems.map(function (mappedItems) { return mappedItems.current; })];\n }\n });\n });\n };\n StorableDataService.prototype.delete = function (action, deleteFunc, id) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, deleteFunc()];\n case 1:\n _a.sent();\n return [2 /*return*/, this.removeFromStores(id)];\n }\n });\n });\n };\n StorableDataService.prototype.deleteMany = function (action, deleteFunc, ids) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, deleteFunc()];\n case 1:\n _a.sent();\n return [2 /*return*/, (0, BringgDashboardSDK_1.getGlobals)().mobx.runInAction(function () {\n return ids.map(function (id) { return _this.removeFromStores(id); });\n })];\n }\n });\n });\n };\n StorableDataService.prototype.updateInStores = function (item, action, fields, extraMapperParams) {\n return this.updateManyInStores([item], action, fields, extraMapperParams)[0];\n };\n StorableDataService.prototype.updateManyInStores = function (items, action, fields, extraMapperParams) {\n var _this = this;\n return (0, BringgDashboardSDK_1.getGlobals)().mobx.runInAction(function () {\n var clientItems = items.map(function (item) { return _this.mapper(item, __assign({ action: action }, extraMapperParams)); });\n _this.dataStore.setMany(clientItems);\n _this.extraDataStores.forEach(function (dataStore) { return dataStore.setMany(clientItems, fields); });\n return clientItems;\n });\n };\n StorableDataService.prototype.removeFromStores = function (id) {\n var item = this.dataStore.get(id);\n this.dataStore.remove(id);\n this.extraDataStores.forEach(function (dataStore) { return dataStore.remove(id); });\n return item;\n };\n StorableDataService.prototype.getFromStores = function (ids, fields) {\n var _this = this;\n return ids\n .map(function (id) {\n var item = _this.dataStore.get(id);\n return item && (!fields || _this.extraDataStores.every(function (dataStore) { return dataStore.has(item, fields); }))\n ? item\n : undefined;\n })\n .filter(Boolean);\n };\n return StorableDataService;\n}());\nexports[\"default\"] = StorableDataService;\n//# sourceMappingURL=storable-data-service.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/storable-data-service.js?");
3453
3453
 
3454
3454
  /***/ }),
3455
3455