@bringg/dashboard-sdk 0.4.103 → 0.5.0-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Core/BringgException.d.ts +1 -0
- package/dist/Core/BringgException.js.map +1 -1
- package/dist/DeliveryCatalog/DeliveryCatalog.consts.d.ts +81 -0
- package/dist/DeliveryCatalog/DeliveryCatalogApi.d.ts +7 -1
- package/dist/DeliveryCatalog/DeliveryCatalogApi.js +20 -0
- package/dist/DeliveryCatalog/DeliveryCatalogApi.js.map +1 -1
- package/dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.d.ts +7 -1
- package/dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.js +27 -3
- package/dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.js.map +1 -1
- package/dist/Run/Store/RunStore.js +6 -11
- package/dist/Run/Store/RunStore.js.map +1 -1
- package/dist/Services/ServiceRequest.js +1 -1
- package/dist/Services/SessionBasedService.js +3 -1
- package/dist/Services/SessionBasedService.js.map +1 -1
- package/dist/User/Store/UsersStore.d.ts +10 -9
- package/dist/User/Store/UsersStore.js +26 -26
- package/dist/User/Store/UsersStore.js.map +1 -1
- package/dist/User/Users.d.ts +6 -6
- package/dist/User/Users.js +21 -74
- package/dist/User/Users.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +104 -116
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +7 -7
- package/dist/bringg-dashboard-sdk.min.js +2 -2
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -902,7 +902,7 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
902
902
|
/***/ (function(module, exports, __webpack_require__) {
|
|
903
903
|
|
|
904
904
|
"use strict";
|
|
905
|
-
eval("\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DeliveryCatalogEntity_1 = __webpack_require__(/*! ./Entity/DeliveryCatalogEntity */ \"./dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.js\");\nvar DeliveryCatalogApi = /** @class */ (function () {\n function DeliveryCatalogApi(session) {\n this.deliveryCatalogEntity = new DeliveryCatalogEntity_1.default(session);\n }\n DeliveryCatalogApi.prototype.getProviders = function (payload) {\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*/, this.deliveryCatalogEntity.getProviders(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getFilters = function () {\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*/, this.deliveryCatalogEntity.getFilters()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getFiltersDetails = function (payload) {\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*/, this.deliveryCatalogEntity.getFiltersDetails(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.toggleFavorites = function (payload) {\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*/, this.deliveryCatalogEntity.toggleFavorites(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.sendEmailNotification = function (payload) {\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*/, this.deliveryCatalogEntity.sendEmailNotification(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n return DeliveryCatalogApi;\n}());\nexports.default = DeliveryCatalogApi;\n//# sourceMappingURL=DeliveryCatalogApi.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/DeliveryCatalog/DeliveryCatalogApi.js?");
|
|
905
|
+
eval("\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar DeliveryCatalogEntity_1 = __webpack_require__(/*! ./Entity/DeliveryCatalogEntity */ \"./dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.js\");\nvar DeliveryCatalogApi = /** @class */ (function () {\n function DeliveryCatalogApi(session) {\n this.deliveryCatalogEntity = new DeliveryCatalogEntity_1.default(session);\n }\n DeliveryCatalogApi.prototype.getProviders = function (payload) {\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*/, this.deliveryCatalogEntity.getProviders(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getFilters = function () {\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*/, this.deliveryCatalogEntity.getFilters()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getFiltersDetails = function (payload) {\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*/, this.deliveryCatalogEntity.getFiltersDetails(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.toggleFavorites = function (payload) {\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*/, this.deliveryCatalogEntity.toggleFavorites(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.sendEmailNotification = function (payload) {\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*/, this.deliveryCatalogEntity.sendEmailNotification(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getFleetById = function (payload) {\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*/, this.deliveryCatalogEntity.getFleetById(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogApi.prototype.getDeliveryById = function (payload) {\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*/, this.deliveryCatalogEntity.getDeliveryById(payload)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n return DeliveryCatalogApi;\n}());\nexports.default = DeliveryCatalogApi;\n//# sourceMappingURL=DeliveryCatalogApi.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/DeliveryCatalog/DeliveryCatalogApi.js?");
|
|
906
906
|
|
|
907
907
|
/***/ }),
|
|
908
908
|
|
|
@@ -915,7 +915,7 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument
|
|
|
915
915
|
/***/ (function(module, exports, __webpack_require__) {
|
|
916
916
|
|
|
917
917
|
"use strict";
|
|
918
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Entity_1 = __webpack_require__(/*! ../../Core/Entity */ \"./dist/Core/Entity.js\");\nvar servicePrefix = '/fleet-service';\nvar baseRouteProviders =
|
|
918
|
+
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Entity_1 = __webpack_require__(/*! ../../Core/Entity */ \"./dist/Core/Entity.js\");\nvar servicePrefix = '/fleet-service';\nvar servicePrefixDeliveryProvider = '/delivery-provider-service';\nvar baseRouteProviders = servicePrefixDeliveryProvider + \"/v1/delivery-providers\";\nvar baseRouteMerchant = servicePrefixDeliveryProvider + \"/v1/merchant/delivery-providers\";\nvar baseRouteFleets = servicePrefix + \"/v1/fleets\";\nvar ROUTES = {\n PROVIDERS: \"\" + baseRouteProviders,\n FILTERS: baseRouteProviders + \"/filters\",\n FILTERS_DETAILS: baseRouteProviders + \"/filters/details\",\n FAVOURITES: baseRouteProviders + \"/favorites\",\n NOTIFICATION: baseRouteMerchant + \"/notify\",\n FLEETS: baseRouteFleets + \"/fleet\",\n GET_DELIVERY_PROVIDER: baseRouteProviders + \"/delivery-provider\"\n};\nvar DeliveryCatalogEntity = /** @class */ (function (_super) {\n __extends(DeliveryCatalogEntity, _super);\n function DeliveryCatalogEntity(session) {\n return _super.call(this, {\n session: session,\n entityName: 'fleet-service'\n }) || this;\n }\n DeliveryCatalogEntity.prototype.getProviders = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.PROVIDERS).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.getFilters = function () {\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*/, this.service.routeGenerator.post(ROUTES.FILTERS).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.getFiltersDetails = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.FILTERS_DETAILS).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.toggleFavorites = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.FAVOURITES).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.sendEmailNotification = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.NOTIFICATION).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.getFleetById = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.FLEETS).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n DeliveryCatalogEntity.prototype.getDeliveryById = function (payload) {\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*/, this.service.routeGenerator.post(ROUTES.GET_DELIVERY_PROVIDER).withPayload(payload).invoke()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n return DeliveryCatalogEntity;\n}(Entity_1.default));\nexports.default = DeliveryCatalogEntity;\n//# sourceMappingURL=DeliveryCatalogEntity.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/DeliveryCatalog/Entity/DeliveryCatalogEntity.js?");
|
|
919
919
|
|
|
920
920
|
/***/ }),
|
|
921
921
|
|
|
@@ -1890,7 +1890,7 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
1890
1890
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1891
1891
|
|
|
1892
1892
|
"use strict";
|
|
1893
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar StoreEntity_1 = __webpack_require__(/*! ../../Core/StoreEntity */ \"./dist/Core/StoreEntity.js\");\nvar runs_consts_1 = __webpack_require__(/*! ../runs.consts */ \"./dist/Run/runs.consts.js\");\nvar Tasks_consts_1 = __webpack_require__(/*! ../../Task/Tasks.consts */ \"./dist/Task/Tasks.consts.js\");\nvar RunStore = /** @class */ (function (_super) {\n __extends(RunStore, _super);\n function RunStore(session) {\n var _this = _super.call(this, { session: session, entityName: 'runs' }) || this;\n _this.createRun = function (payload) {\n return _this.createOrUpdateRun(payload, _this.onCreate.bind(_this));\n };\n _this.updateRun = function (payload) {\n return _this.createOrUpdateRun(payload, _this.onUpdate.bind(_this));\n };\n _this.createOrUpdateRun = function (payload, callback) {\n var existingRunModel = _this.store.getItem(payload.run.id);\n var updatedRunModel = { id: payload.run.id, run: payload.run, taskIds: undefined };\n if (existingRunModel) {\n updatedRunModel.taskIds = existingRunModel.taskIds;\n }\n else {\n updatedRunModel.taskIds = _this.taskIdsWaitingForRun.get(payload.run.id) || new Set();\n _this.taskIdsWaitingForRun.delete(payload.run.id);\n }\n _this.storeItem(updatedRunModel);\n callback(_this.store.getItem(payload.run.id));\n };\n _this.deleteRun = function (payload) {\n var runModel = _this.store.getItem(payload.id);\n _this.store.removeFromStore(payload.id);\n _this.onDelete(runModel);\n };\n _this.updateTaskIdsOnDelete = function (task) {\n var
|
|
1893
|
+
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar StoreEntity_1 = __webpack_require__(/*! ../../Core/StoreEntity */ \"./dist/Core/StoreEntity.js\");\nvar runs_consts_1 = __webpack_require__(/*! ../runs.consts */ \"./dist/Run/runs.consts.js\");\nvar Tasks_consts_1 = __webpack_require__(/*! ../../Task/Tasks.consts */ \"./dist/Task/Tasks.consts.js\");\nvar RunStore = /** @class */ (function (_super) {\n __extends(RunStore, _super);\n function RunStore(session) {\n var _this = _super.call(this, { session: session, entityName: 'runs' }) || this;\n _this.createRun = function (payload) {\n return _this.createOrUpdateRun(payload, _this.onCreate.bind(_this));\n };\n _this.updateRun = function (payload) {\n return _this.createOrUpdateRun(payload, _this.onUpdate.bind(_this));\n };\n _this.createOrUpdateRun = function (payload, callback) {\n var existingRunModel = _this.store.getItem(payload.run.id);\n var updatedRunModel = { id: payload.run.id, run: payload.run, taskIds: undefined };\n if (existingRunModel) {\n updatedRunModel.taskIds = existingRunModel.taskIds;\n }\n else {\n updatedRunModel.taskIds = _this.taskIdsWaitingForRun.get(payload.run.id) || new Set();\n _this.taskIdsWaitingForRun.delete(payload.run.id);\n }\n _this.storeItem(updatedRunModel);\n callback(_this.store.getItem(payload.run.id));\n };\n _this.deleteRun = function (payload) {\n var runModel = _this.store.getItem(payload.id);\n _this.store.removeFromStore(payload.id);\n _this.onDelete(runModel);\n };\n _this.updateTaskIdsOnDelete = function (task) {\n var existingRunModel = _this.store.getItem(task.run_id);\n if (!existingRunModel) {\n return;\n }\n existingRunModel.taskIds.delete(task.id);\n _this.updateRun(existingRunModel);\n };\n _this.updateTaskIds = function (task) {\n var runId = task.run_id || _this.taskIdToRunId.get(task.id);\n var existingRunModel = _this.store.getItem(runId);\n if (!existingRunModel) {\n _this.backupTasksUntilRunIsCreated(task);\n }\n else if (_this.taskAddedToRun(task, existingRunModel)) {\n existingRunModel.taskIds.add(task.id);\n _this.updateRun(existingRunModel);\n }\n else if (_this.taskRemovedFromRun(task, existingRunModel)) {\n existingRunModel.taskIds.delete(task.id);\n _this.updateRun(existingRunModel);\n }\n _this.updatePreviousRun(task);\n _this.taskIdToRunId.set(task.id, task.run_id);\n };\n _this.taskIdsWaitingForRun = new Map();\n _this.taskIdToRunId = new Map();\n return _this;\n }\n RunStore.prototype.attachSubscriptions = function () {\n if (this.subscribedToRealtime) {\n return;\n }\n this.subscribedToRealtime = true;\n this.realTime.on(runs_consts_1.RunEvents.CREATED, this.createRun);\n this.realTime.on(runs_consts_1.RunEvents.UPDATED, this.updateRun);\n this.realTime.on(runs_consts_1.RunEvents.DELETED, this.deleteRun);\n this.realTime.on(Tasks_consts_1.TaskRealTimeEvents.TASK_DELETED, this.updateTaskIdsOnDelete);\n this.realTime.on(Tasks_consts_1.TaskRealTimeEvents.TASK_UPDATE, this.updateTaskIds);\n this.realTime.on(Tasks_consts_1.TaskRealTimeEvents.NEW_TASK, this.updateTaskIds);\n };\n RunStore.prototype.set = function (run) {\n return this.setAll([run])[0];\n };\n RunStore.prototype.setAll = function (runs) {\n var _this = this;\n var runModels = runs.map(function (run) {\n var _a;\n return ({\n id: run.id,\n run: run,\n taskIds: new Set(run.task_ids || ((_a = run.tasks) === null || _a === void 0 ? void 0 : _a.map(function (task) { return task.id; })))\n });\n });\n var _loop_1 = function (runModel) {\n runModel.taskIds.forEach(function (taskId) {\n _this.taskIdToRunId.set(taskId, runModel.id);\n });\n };\n for (var _i = 0, runModels_1 = runModels; _i < runModels_1.length; _i++) {\n var runModel = runModels_1[_i];\n _loop_1(runModel);\n }\n this.storeAllItems(runModels);\n return runModels;\n };\n RunStore.prototype.updatePreviousRun = function (task) {\n var previousRunId = this.taskIdToRunId.get(task.id);\n if (previousRunId && previousRunId != task.run_id) {\n if (this.taskIdsWaitingForRun.has(previousRunId)) {\n this.taskIdsWaitingForRun.get(previousRunId).delete(task.id);\n }\n var previousRunModel = this.store.getItem(previousRunId);\n if (previousRunModel) {\n previousRunModel.taskIds.delete(task.id);\n this.updateRun(previousRunModel);\n }\n }\n };\n RunStore.prototype.taskRemovedFromRun = function (task, existingRunModel) {\n return !task.run_id && existingRunModel.taskIds.has(task.id);\n };\n RunStore.prototype.taskAddedToRun = function (task, existingRunModel) {\n return task.run_id && !existingRunModel.taskIds.has(task.id);\n };\n RunStore.prototype.backupTasksUntilRunIsCreated = function (task) {\n if (!task.run_id) {\n return;\n }\n if (!this.taskIdsWaitingForRun.has(task.run_id)) {\n this.taskIdsWaitingForRun.set(task.run_id, new Set());\n }\n this.taskIdsWaitingForRun.get(task.run_id).add(task.id);\n };\n return RunStore;\n}(StoreEntity_1.default));\nexports.default = RunStore;\n//# sourceMappingURL=RunStore.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Run/Store/RunStore.js?");
|
|
1894
1894
|
|
|
1895
1895
|
/***/ }),
|
|
1896
1896
|
|
|
@@ -2150,7 +2150,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexport
|
|
|
2150
2150
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2151
2151
|
|
|
2152
2152
|
"use strict";
|
|
2153
|
-
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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\nvar Logger_1 = __webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar version = '0.4.103';\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 try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) { }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) { }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, queryString, authenticationToken, headers) {\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=\" + authenticationToken;\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, _e = _b.queryString, queryString = _e === void 0 ? undefined : _e, _f = _b.authenticationToken, authenticationToken = _f === void 0 ? undefined : _f, _g = _b.headers, headers = _g === void 0 ? undefined : _g;\n return new RequestOptions(clientId, timeout, queryString, authenticationToken, headers);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response) {\n this.axiosPromise = response;\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 (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 (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) {\n return new ResponseHandler(axiosInstance.get(\"\" + host + uri, { params: queryString }));\n}\nfunction post(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.post(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction put(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.put(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction patch(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.patch(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction remove(axiosInstance, host, uri, queryString) {\n return new ResponseHandler(axiosInstance.delete(\"\" + host + uri, { params: queryString }));\n}\nfunction routify(axiosInstance, endpoint, route, routeParams, queryString, payload) {\n switch (route.httpMethod) {\n case 0 /* GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString);\n case 1 /* POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 2 /* PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 3 /* PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 4 /* DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString);\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 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 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 try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) { }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, headers) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers })));\n}\nfunction anonymousAxiosInstance(clientId, headers) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers })));\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) {\n return routify(axiosInstance(this.clientId, this.authToken, headers), endpoint, route, routeParams, queryString, payload);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId) {\n this.clientId = clientId;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload) {\n return routify(anonymousAxiosInstance(this.clientId), 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?");
|
|
2153
|
+
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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\nvar Logger_1 = __webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar version = '0.5.0-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 try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) { }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) { }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, queryString, authenticationToken, headers) {\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=\" + authenticationToken;\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, _e = _b.queryString, queryString = _e === void 0 ? undefined : _e, _f = _b.authenticationToken, authenticationToken = _f === void 0 ? undefined : _f, _g = _b.headers, headers = _g === void 0 ? undefined : _g;\n return new RequestOptions(clientId, timeout, queryString, authenticationToken, headers);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response) {\n this.axiosPromise = response;\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 (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 (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) {\n return new ResponseHandler(axiosInstance.get(\"\" + host + uri, { params: queryString }));\n}\nfunction post(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.post(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction put(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.put(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction patch(axiosInstance, host, uri, queryString, payload) {\n return new ResponseHandler(axiosInstance.patch(\"\" + host + uri, payload, { params: queryString }));\n}\nfunction remove(axiosInstance, host, uri, queryString) {\n return new ResponseHandler(axiosInstance.delete(\"\" + host + uri, { params: queryString }));\n}\nfunction routify(axiosInstance, endpoint, route, routeParams, queryString, payload) {\n switch (route.httpMethod) {\n case 0 /* GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString);\n case 1 /* POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 2 /* PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 3 /* PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload);\n case 4 /* DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString);\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 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 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 try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) { }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, headers) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers })));\n}\nfunction anonymousAxiosInstance(clientId, headers) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers })));\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) {\n return routify(axiosInstance(this.clientId, this.authToken, headers), endpoint, route, routeParams, queryString, payload);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId) {\n this.clientId = clientId;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, routeParams, queryString, payload) {\n return routify(anonymousAxiosInstance(this.clientId), 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?");
|
|
2154
2154
|
|
|
2155
2155
|
/***/ }),
|
|
2156
2156
|
|
|
@@ -2163,7 +2163,7 @@ eval("\nvar __assign = (this && this.__assign) || function () {\n __assign =
|
|
|
2163
2163
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2164
2164
|
|
|
2165
2165
|
"use strict";
|
|
2166
|
-
eval("\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionBasedService = exports.HTTP_EVENTS = void 0;\nvar ServiceRequest_1 = __webpack_require__(/*! ./ServiceRequest */ \"./dist/Services/ServiceRequest.js\");\nvar Enums_1 = __webpack_require__(/*! ../Core/Http/Enums */ \"./dist/Core/Http/Enums.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nexports.HTTP_EVENTS = {\n HTTP_REQUEST_FAILURE: 'http failure'\n};\nvar SessionBasedService = /** @class */ (function () {\n function SessionBasedService(endpoint, session) {\n this._endpoint = endpoint;\n this._session = session;\n }\n Object.defineProperty(SessionBasedService.prototype, \"sendDataEvent\", {\n get: function () {\n return this.session.sendDataEvent;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SessionBasedService.prototype, \"endpoint\", {\n get: function () {\n return this._endpoint;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SessionBasedService.prototype, \"session\", {\n get: function () {\n return this._session;\n },\n enumerable: false,\n configurable: true\n });\n SessionBasedService.prototype.handleAuthorizedRequest = function (route, extractor, exceptionProducer, payload, routeParams, queryString, headers) {\n if (payload === void 0) { payload = {}; }\n if (routeParams === void 0) { routeParams = {}; }\n if (queryString === void 0) { queryString = {}; }\n if (headers === void 0) { headers = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var response, responseAsDefault, bringgException;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, new ServiceRequest_1.AuthorizedServiceRequest(this.session.clientId, this.session.user.authentication_token)\n .invoke(this.endpoint, route, routeParams, queryString, payload, headers)\n .handle(function (response) {\n var data = response.data, status = response.status;\n if (status != Enums_1.HttpStatusCode.OK &&\n status != Enums_1.HttpStatusCode.CREATED &&\n status != Enums_1.HttpStatusCode.NO_CONTENT) {\n _this.notifyHttpError(new BringgException_1.BringgException(ExceptionReason_1.ExceptionReason.fromHttpStatusCode(status), Enums_1.HttpStatusCode.getStatusText(status), null, {\n request: {\n route: route,\n payload: payload,\n routeParams: routeParams,\n queryString: queryString,\n headers: headers,\n clientId: _this.session.clientId,\n authenticationToken: _this.session.user.authentication_token\n },\n response: response\n }));\n ServiceRequest_1.logErrorResponse(response);\n throw lodash_1.isFunction(exceptionProducer) ? exceptionProducer() : response;\n }\n return data;\n })];\n case 1:\n response = _a.sent();\n responseAsDefault = response;\n if (responseAsDefault.success === false) {\n bringgException = exceptionProducer();\n bringgException.details = responseAsDefault.message;\n bringgException.rc = responseAsDefault.rc;\n throw bringgException;\n }\n return [2 /*return*/, extractor(response)];\n }\n });\n });\n };\n SessionBasedService.prototype.notifyHttpError = function (error) {\n this.sendDataEvent(exports.HTTP_EVENTS.HTTP_REQUEST_FAILURE, error);\n };\n return SessionBasedService;\n}());\nexports.SessionBasedService = SessionBasedService;\n//# sourceMappingURL=SessionBasedService.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/SessionBasedService.js?");
|
|
2166
|
+
eval("\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SessionBasedService = exports.HTTP_EVENTS = void 0;\nvar ServiceRequest_1 = __webpack_require__(/*! ./ServiceRequest */ \"./dist/Services/ServiceRequest.js\");\nvar Enums_1 = __webpack_require__(/*! ../Core/Http/Enums */ \"./dist/Core/Http/Enums.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nexports.HTTP_EVENTS = {\n HTTP_REQUEST_FAILURE: 'http failure'\n};\nvar SessionBasedService = /** @class */ (function () {\n function SessionBasedService(endpoint, session) {\n this._endpoint = endpoint;\n this._session = session;\n }\n Object.defineProperty(SessionBasedService.prototype, \"sendDataEvent\", {\n get: function () {\n return this.session.sendDataEvent;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SessionBasedService.prototype, \"endpoint\", {\n get: function () {\n return this._endpoint;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SessionBasedService.prototype, \"session\", {\n get: function () {\n return this._session;\n },\n enumerable: false,\n configurable: true\n });\n SessionBasedService.prototype.handleAuthorizedRequest = function (route, extractor, exceptionProducer, payload, routeParams, queryString, headers) {\n if (payload === void 0) { payload = {}; }\n if (routeParams === void 0) { routeParams = {}; }\n if (queryString === void 0) { queryString = {}; }\n if (headers === void 0) { headers = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var statusCode, response, responseAsDefault, bringgException;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, new ServiceRequest_1.AuthorizedServiceRequest(this.session.clientId, this.session.user.authentication_token)\n .invoke(this.endpoint, route, routeParams, queryString, payload, headers)\n .handle(function (response) {\n var data = response.data, status = response.status;\n statusCode = status;\n if (status != Enums_1.HttpStatusCode.OK &&\n status != Enums_1.HttpStatusCode.CREATED &&\n status != Enums_1.HttpStatusCode.NO_CONTENT) {\n _this.notifyHttpError(new BringgException_1.BringgException(ExceptionReason_1.ExceptionReason.fromHttpStatusCode(status), Enums_1.HttpStatusCode.getStatusText(status), null, {\n request: {\n route: route,\n payload: payload,\n routeParams: routeParams,\n queryString: queryString,\n headers: headers,\n clientId: _this.session.clientId,\n authenticationToken: _this.session.user.authentication_token\n },\n response: response\n }));\n ServiceRequest_1.logErrorResponse(response);\n throw lodash_1.isFunction(exceptionProducer) ? exceptionProducer() : response;\n }\n return data;\n })];\n case 1:\n response = _a.sent();\n responseAsDefault = response;\n if (responseAsDefault.success === false) {\n bringgException = exceptionProducer();\n bringgException.details = responseAsDefault.message;\n bringgException.rc = responseAsDefault.rc;\n bringgException.statusCode = statusCode;\n throw bringgException;\n }\n return [2 /*return*/, extractor(response)];\n }\n });\n });\n };\n SessionBasedService.prototype.notifyHttpError = function (error) {\n this.sendDataEvent(exports.HTTP_EVENTS.HTTP_REQUEST_FAILURE, error);\n };\n return SessionBasedService;\n}());\nexports.SessionBasedService = SessionBasedService;\n//# sourceMappingURL=SessionBasedService.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/SessionBasedService.js?");
|
|
2167
2167
|
|
|
2168
2168
|
/***/ }),
|
|
2169
2169
|
|
|
@@ -2540,7 +2540,7 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
2540
2540
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2541
2541
|
|
|
2542
2542
|
"use strict";
|
|
2543
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BaseStore_1 = __webpack_require__(/*! ../../Core/BaseStore */ \"./dist/Core/BaseStore.js\");\nvar UsersService_1 = __webpack_require__(/*! ../Service/UsersService */ \"./dist/User/Service/UsersService.js\");\nvar User_consts_1 = __webpack_require__(/*! ../User.consts */ \"./dist/User/User.consts.js\");\nvar operators_1 = __webpack_require__(/*! rxjs/operators */ \"./node_modules/rxjs/_esm5/operators/index.js\");\nvar rxjs_1 = __webpack_require__(/*! rxjs */ \"./node_modules/rxjs/_esm5/index.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar THROTTLE_TIME = 500;\nvar UsersStore = /** @class */ (function (_super) {\n __extends(UsersStore, _super);\n function UsersStore(session, throttleTimeValue) {\n var _this = _super.call(this) || this;\n _this.groupUpdateEvents = [];\n _this.groupedValues = new Map();\n _this.fetchedStatus = {\n drivers: false,\n customers: false,\n adminsAndDispatchers: false\n };\n _this.usersService = new UsersService_1.default(session, _this);\n throttleTimeValue = throttleTimeValue || THROTTLE_TIME;\n //group by and save ids | can add config to throttle through users( maybe increase if admin )\n _this.state$\n .pipe(operators_1.throttleTime(throttleTimeValue, rxjs_1.asyncScheduler, { trailing: true, leading: false }))\n .subscribe(function (map) {\n rxjs_1.from(map.values())\n .pipe(operators_1.groupBy(User_consts_1.userToGroupMapper, function (user) { return user.id; }), operators_1.mergeMap(function (group) { return rxjs_1.zip(rxjs_1.of(group.key), group.pipe(operators_1.toArray())); }))\n .subscribe(function (_a) {\n var groupId = _a[0], groupValues = _a[1];\n _this.groupedValues.set(groupId, groupValues);\n _this.emitGroupEvents();\n });\n });\n return _this;\n }\n UsersStore.prototype.create = function (user) {\n return __awaiter(this, void 0, void 0, function () {\n var newUser;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.create(user)];\n case 1:\n newUser = _a.sent();\n this.addToStore(newUser);\n return [2 /*return*/, newUser];\n }\n });\n });\n };\n UsersStore.prototype.getDriversByTeam = function (teamId) {\n return __awaiter(this, void 0, void 0, function () {\n var users;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.getDriversByTeam(teamId)];\n case 1:\n users = _a.sent();\n users.forEach(function (user) { return _this.addToStore(user); });\n return [2 /*return*/, users];\n }\n });\n });\n };\n UsersStore.prototype.getAll = function (page, limit) {\n if (page === void 0) { page = 1; }\n if (limit === void 0) { limit = 50; }\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.usersService.getAll(page, limit)];\n case 1:\n response = _a.sent();\n lodash_1.forEach(response.users, function (user) { return (_this.getItem(user.id) ? _this.updateInStore(user) : _this.addToStore(user)); });\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersStore.prototype.getAllKeysetPagination = function (request) {\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.usersService.getAllKeysetPagination(request)];\n case 1:\n response = _a.sent();\n lodash_1.forEach(response.users, function (user) { return (_this.getItem(user.id) ? _this.updateInStore(user) : _this.addToStore(user)); });\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersStore.prototype.invite = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.invite(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.inviteByEmail = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.inviteByEmail(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.getAllAdminsAndDispatchers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.adminsAndDispatchers, function (isAllAdminsAndDispatchersFetched) {\n return (_this.fetchedStatus.adminsAndDispatchers = isAllAdminsAndDispatchersFetched);\n }, function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = _this.usersService).getAllAdminsAndDispatchers.apply(_a, args);\n }, function () { return _this.getAllLocalAdminsAndDispatchers(); })];\n });\n });\n };\n UsersStore.prototype.getAllDrivers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var options;\n var _this = this;\n return __generator(this, function (_a) {\n options = request.options;\n if (lodash_1.get(options, 'onlyCustomers')) {\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.customers, function (isAllCustomersFetched) { return (_this.fetchedStatus.customers = isAllCustomersFetched); }, this.usersService.getAllDrivers, function () { return _this.getAllLocalCustomers(); })];\n }\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.drivers, function (isAllDriversFetched) { return (_this.fetchedStatus.drivers = isAllDriversFetched); }, function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = _this.usersService).getAllDrivers.apply(_a, args);\n }, function () { return _this.getAllLocalDrivers(); })];\n });\n });\n };\n UsersStore.prototype.getOrFetchUsers = function (request, isFetchedFlag, setIsFetchedFlag, fetchUsers, getLocalUsers) {\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:\n if (!!isFetchedFlag) return [3 /*break*/, 2];\n return [4 /*yield*/, fetchUsers(request)];\n case 1:\n response = _a.sent();\n response.users.forEach(function (driver) { return _this.addToStore(driver); });\n if (!response.next_page_cursor && !response.previous_page_cursor) {\n setIsFetchedFlag(true);\n }\n return [2 /*return*/, response];\n case 2: return [2 /*return*/, {\n next_page_cursor: null,\n previous_page_cursor: null,\n users: getLocalUsers()\n }];\n }\n });\n });\n };\n UsersStore.prototype.byUserType = function (userTypeId) {\n return __awaiter(this, void 0, void 0, function () {\n var users;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.byUserType(userTypeId)];\n case 1:\n users = _a.sent();\n users.forEach(function (user) { return _this.addToStore(user); });\n return [2 /*return*/, users];\n }\n });\n });\n };\n UsersStore.prototype.makeAdmin = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.makeAdmin(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.update = function (userId, userDelta) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.update(userId, userDelta)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.delete = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var success;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.delete(userId)];\n case 1:\n success = _a.sent();\n if (success) {\n this.removeFromStore(userId);\n }\n return [2 /*return*/, success];\n }\n });\n });\n };\n UsersStore.prototype.get = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.getItem(id);\n if (_a) return [3 /*break*/, 2];\n return [4 /*yield*/, this.usersService.get(id)];\n case 1:\n _a = (_b.sent());\n _b.label = 2;\n case 2: return [2 /*return*/, _a];\n }\n });\n });\n };\n UsersStore.prototype.unlock = function (userId) {\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*/, this.usersService.unlock(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.assignedTasksCount = function (userId) {\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*/, this.usersService.assignedTasksCount(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.totalEmployeesCount = function () {\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*/, this.usersService.totalEmployeesCount()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.totalDriversCount = function () {\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*/, this.usersService.totalDriversCount()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.getProfileImage = function (userId) {\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*/, this.usersService.getProfileImage(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.validatePhone = function (phone) {\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*/, this.usersService.validatePhone(phone)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.closedTasks = function (userId, page) {\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*/, this.usersService.closedTasks(userId, page)];\n case 1: return [2 /*return*/, _a.sent()]; // in future - add this tasks to store :)\n }\n });\n });\n };\n UsersStore.prototype.messageDriver = function (userId, message) {\n return this.usersService.messageDriver(userId, message);\n };\n UsersStore.prototype.subscribeToGroupUpdates = function (fn) {\n this.groupUpdateEvents.push(fn);\n };\n UsersStore.prototype.getOfflineDriversIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.OfflineDrivers) || [];\n };\n UsersStore.prototype.getOnlineDriversIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.OnlineDrivers) || [];\n };\n UsersStore.prototype.getOnShiftDriversIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.OnShiftDrivers) || [];\n };\n UsersStore.prototype.getCustomersIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.Customers) || [];\n };\n UsersStore.prototype.getAdminsIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.Admins) || [];\n };\n UsersStore.prototype.getDispatchersIds = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.Dispatchers) || [];\n };\n UsersStore.prototype.emitGroupEvents = function () {\n var _this = this;\n this.groupUpdateEvents.forEach(function (fn) { return fn(_this.groupedValues); });\n };\n UsersStore.prototype.getAllLocalDrivers = function () {\n var _this = this;\n var onlineDrivers = this.getOnlineDriversIds().map(function (driverId) { return _this.getItem(driverId); });\n var offlineDrivers = this.getOfflineDriversIds().map(function (driverId) { return _this.getItem(driverId); });\n return onlineDrivers.concat(offlineDrivers);\n };\n UsersStore.prototype.getAllLocalCustomers = function () {\n var _this = this;\n return this.getCustomersIds().map(function (driverId) { return _this.getItem(driverId); });\n };\n UsersStore.prototype.getAllLocalAdminsAndDispatchers = function () {\n var _this = this;\n return this.getAdminsIds()\n .concat(this.getDispatchersIds())\n .map(function (userId) { return _this.getItem(userId); });\n };\n return UsersStore;\n}(BaseStore_1.default));\nexports.default = UsersStore;\n//# sourceMappingURL=UsersStore.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Store/UsersStore.js?");
|
|
2543
|
+
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar BaseStore_1 = __webpack_require__(/*! ../../Core/BaseStore */ \"./dist/Core/BaseStore.js\");\nvar UsersService_1 = __webpack_require__(/*! ../Service/UsersService */ \"./dist/User/Service/UsersService.js\");\nvar User_consts_1 = __webpack_require__(/*! ../User.consts */ \"./dist/User/User.consts.js\");\nvar operators_1 = __webpack_require__(/*! rxjs/operators */ \"./node_modules/rxjs/_esm5/operators/index.js\");\nvar rxjs_1 = __webpack_require__(/*! rxjs */ \"./node_modules/rxjs/_esm5/index.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar THROTTLE_TIME = 500;\nvar UsersStore = /** @class */ (function (_super) {\n __extends(UsersStore, _super);\n function UsersStore(session, throttleTimeValue) {\n var _this = _super.call(this) || this;\n _this.groupUpdateEvents = [];\n _this.groupedValues = new Map();\n _this.drivers = [];\n _this.fetchedStatus = {\n drivers: false,\n customers: false,\n adminsAndDispatchers: false\n };\n _this.usersService = new UsersService_1.default(session, _this);\n throttleTimeValue = throttleTimeValue || THROTTLE_TIME;\n //group by and save ids | can add config to throttle through users( maybe increase if admin )\n _this.state$\n .pipe(operators_1.throttleTime(throttleTimeValue, rxjs_1.asyncScheduler, { trailing: true, leading: false }))\n .subscribe(function (map) {\n rxjs_1.from(map.values())\n .pipe(operators_1.groupBy(User_consts_1.userToGroupMapper, function (user) { return user; }), operators_1.mergeMap(function (group) { return rxjs_1.zip(rxjs_1.of(group.key), group.pipe(operators_1.toArray())); }))\n .subscribe(function (_a) {\n var groupId = _a[0], groupValues = _a[1];\n _this.groupedValues.set(groupId, new Set(groupValues));\n _this.emitGroupEvents();\n if (groupId === User_consts_1.GROUP_VALUES.OfflineDrivers || groupId === User_consts_1.GROUP_VALUES.OnlineDrivers) {\n _this.drivers.length = 0;\n Array.prototype.push.apply(_this.drivers, _this.calcAllLocalDrivers());\n }\n });\n });\n return _this;\n }\n UsersStore.prototype.create = function (user) {\n return __awaiter(this, void 0, void 0, function () {\n var newUser;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.create(user)];\n case 1:\n newUser = _a.sent();\n this.addToStore(newUser);\n return [2 /*return*/, newUser];\n }\n });\n });\n };\n UsersStore.prototype.getDriversByTeam = function (teamId) {\n return __awaiter(this, void 0, void 0, function () {\n var users;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.getDriversByTeam(teamId)];\n case 1:\n users = _a.sent();\n users.forEach(function (user) { return _this.addToStore(user); });\n return [2 /*return*/, users];\n }\n });\n });\n };\n UsersStore.prototype.getAll = function (page, limit) {\n if (page === void 0) { page = 1; }\n if (limit === void 0) { limit = 50; }\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.usersService.getAll(page, limit)];\n case 1:\n response = _a.sent();\n lodash_1.forEach(response.users, function (user) { return (_this.getItem(user.id) ? _this.updateInStore(user) : _this.addToStore(user)); });\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersStore.prototype.getAllKeysetPagination = function (request) {\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.usersService.getAllKeysetPagination(request)];\n case 1:\n response = _a.sent();\n lodash_1.forEach(response.users, function (user) { return (_this.getItem(user.id) ? _this.updateInStore(user) : _this.addToStore(user)); });\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersStore.prototype.invite = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.invite(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.inviteByEmail = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.inviteByEmail(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.getAllAdminsAndDispatchers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.adminsAndDispatchers, function (isAllAdminsAndDispatchersFetched) {\n return (_this.fetchedStatus.adminsAndDispatchers = isAllAdminsAndDispatchersFetched);\n }, function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = _this.usersService).getAllAdminsAndDispatchers.apply(_a, args);\n }, function () { return _this.getAllLocalAdminsAndDispatchers(); })];\n });\n });\n };\n UsersStore.prototype.getAllDrivers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var options;\n var _this = this;\n return __generator(this, function (_a) {\n options = request.options;\n if (lodash_1.get(options, 'onlyCustomers')) {\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.customers, function (isAllCustomersFetched) { return (_this.fetchedStatus.customers = isAllCustomersFetched); }, this.usersService.getAllDrivers, function () { return _this.getCustomers(); })];\n }\n return [2 /*return*/, this.getOrFetchUsers(request, this.fetchedStatus.drivers, function (isAllDriversFetched) { return (_this.fetchedStatus.drivers = isAllDriversFetched); }, function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = _this.usersService).getAllDrivers.apply(_a, args);\n }, function () { return _this.getAllLocalDrivers(); })];\n });\n });\n };\n UsersStore.prototype.getOrFetchUsers = function (request, isFetchedFlag, setIsFetchedFlag, fetchUsers, getLocalUsers) {\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:\n if (!!isFetchedFlag) return [3 /*break*/, 2];\n return [4 /*yield*/, fetchUsers(request)];\n case 1:\n response = _a.sent();\n response.users.forEach(function (driver) { return _this.addToStore(driver); });\n if (!response.next_page_cursor && !response.previous_page_cursor) {\n setIsFetchedFlag(true);\n }\n return [2 /*return*/, response];\n case 2: return [2 /*return*/, {\n next_page_cursor: null,\n previous_page_cursor: null,\n users: getLocalUsers()\n }];\n }\n });\n });\n };\n UsersStore.prototype.byUserType = function (userTypeId) {\n return __awaiter(this, void 0, void 0, function () {\n var users;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.byUserType(userTypeId)];\n case 1:\n users = _a.sent();\n users.forEach(function (user) { return _this.addToStore(user); });\n return [2 /*return*/, users];\n }\n });\n });\n };\n UsersStore.prototype.makeAdmin = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.makeAdmin(userId)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.update = function (userId, userDelta) {\n return __awaiter(this, void 0, void 0, function () {\n var user;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.update(userId, userDelta)];\n case 1:\n user = _a.sent();\n this.updateInStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n UsersStore.prototype.delete = function (userId) {\n return __awaiter(this, void 0, void 0, function () {\n var success;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.usersService.delete(userId)];\n case 1:\n success = _a.sent();\n if (success) {\n this.removeFromStore(userId);\n }\n return [2 /*return*/, success];\n }\n });\n });\n };\n UsersStore.prototype.get = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _a = this.getItem(id);\n if (_a) return [3 /*break*/, 2];\n return [4 /*yield*/, this.usersService.get(id)];\n case 1:\n _a = (_b.sent());\n _b.label = 2;\n case 2: return [2 /*return*/, _a];\n }\n });\n });\n };\n UsersStore.prototype.unlock = function (userId) {\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*/, this.usersService.unlock(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.assignedTasksCount = function (userId) {\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*/, this.usersService.assignedTasksCount(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.totalEmployeesCount = function () {\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*/, this.usersService.totalEmployeesCount()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.totalDriversCount = function () {\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*/, this.usersService.totalDriversCount()];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.getProfileImage = function (userId) {\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*/, this.usersService.getProfileImage(userId)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.validatePhone = function (phone) {\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*/, this.usersService.validatePhone(phone)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersStore.prototype.closedTasks = function (userId, page) {\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*/, this.usersService.closedTasks(userId, page)];\n case 1: return [2 /*return*/, _a.sent()]; // in future - add this tasks to store :)\n }\n });\n });\n };\n UsersStore.prototype.messageDriver = function (userId, message) {\n return this.usersService.messageDriver(userId, message);\n };\n UsersStore.prototype.subscribeToGroupUpdates = function (fn) {\n this.groupUpdateEvents.push(fn);\n };\n UsersStore.prototype.getOfflineDrivers = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.OfflineDrivers) || new Set();\n };\n UsersStore.prototype.getOnlineDrivers = function () {\n return this.groupedValues.get(User_consts_1.GROUP_VALUES.OnlineDrivers) || new Set();\n };\n UsersStore.prototype.getOnShiftDrivers = function () {\n return Array.from(this.groupedValues.get(User_consts_1.GROUP_VALUES.OnShiftDrivers) || []);\n };\n UsersStore.prototype.getCustomers = function () {\n return Array.from(this.groupedValues.get(User_consts_1.GROUP_VALUES.Customers) || []);\n };\n UsersStore.prototype.getAdmins = function () {\n return Array.from(this.groupedValues.get(User_consts_1.GROUP_VALUES.Admins) || []);\n };\n UsersStore.prototype.getDispatchers = function () {\n return Array.from(this.groupedValues.get(User_consts_1.GROUP_VALUES.Dispatchers) || []);\n };\n UsersStore.prototype.emitGroupEvents = function () {\n var _this = this;\n this.groupUpdateEvents.forEach(function (fn) { return fn(_this.groupedValues); });\n };\n UsersStore.prototype.calcAllLocalDrivers = function () {\n var onlineDrivers = Array.from(this.getOnlineDrivers());\n var offlineDrivers = Array.from(this.getOfflineDrivers());\n return onlineDrivers.concat(offlineDrivers);\n };\n UsersStore.prototype.getAllLocalDrivers = function () {\n return this.drivers;\n };\n UsersStore.prototype.getAllLocalAdminsAndDispatchers = function () {\n return this.getAdmins().concat(this.getDispatchers());\n };\n return UsersStore;\n}(BaseStore_1.default));\nexports.default = UsersStore;\n//# sourceMappingURL=UsersStore.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Store/UsersStore.js?");
|
|
2544
2544
|
|
|
2545
2545
|
/***/ }),
|
|
2546
2546
|
|
|
@@ -2579,7 +2579,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexport
|
|
|
2579
2579
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2580
2580
|
|
|
2581
2581
|
"use strict";
|
|
2582
|
-
eval("\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UserKeys = void 0;\nvar UsersStore_1 = __webpack_require__(/*! ./Store/UsersStore */ \"./dist/User/Store/UsersStore.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar MethodsArgsDecorators_1 = __webpack_require__(/*! ../Core/MethodsArgsDecorators */ \"./dist/Core/MethodsArgsDecorators.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar User_consts_1 = __webpack_require__(/*! ./User.consts */ \"./dist/User/User.consts.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar ALLOWED_KEYS = {\n CREATE_USER: ['name', 'job_description', 'password', 'email', 'phone']\n};\nexports.UserKeys = [\n 'id',\n 'admin',\n 'driver',\n 'dispatcher',\n 'name',\n 'status',\n 'sub',\n 'lat',\n 'lng',\n 'phone',\n 'email',\n 'job_description',\n 'driver_current_sign_in_at',\n 'driver_sign_in_count',\n 'average_rating',\n 'num_ratings',\n 'last_sign_in_at',\n 'active_shift_id',\n 'created_at',\n 'feature_flags',\n 'authorization_flags',\n 'confirmed_at',\n 'confirmation_sent_at',\n 'battery',\n 'uuid',\n 'external_id',\n 'mobile_type',\n 'mobile_version',\n 'device_model',\n 'default_user_activity',\n 'language',\n 'merchant_id',\n 'user_type_id',\n 'privilege_id',\n 'estimated_last_address',\n 'estimated_last_lat',\n 'estimated_last_lng',\n 'estimated_last_etl',\n 'at_home',\n 'company',\n 'eta_to_home',\n 'private_vehicle',\n 'in_beacon_range',\n 'home_address',\n 'home_lat',\n 'home_lng',\n 'team_ids',\n 'allowed_user_type_ids',\n 'locked',\n 'beta',\n 'debug',\n 'profile_image',\n 'authentication_token',\n 'partner_user',\n 'password',\n 'skills'\n];\nvar Users = /** @class */ (function () {\n function Users(session) {\n this.usersStore = new UsersStore_1.default(session);\n //keep previous names for backward compatibility\n this.onListUpdate = this.usersStore.onListUpdate;\n this.onUpdate = this.usersStore.onItemUpdate;\n this.onDelete = this.usersStore.onItemRemoved;\n this.onCreate = this.usersStore.onItemCreated;\n this.unsubscribe = this.usersStore.unsubscribe;\n }\n Users.prototype.create = function (user) {\n if (lodash_1.isNil(user.email) && lodash_1.isNil(user.phone)) {\n throw new BringgException_1.BringgException(ExceptionReason_1.ExceptionReason.INVALID_ARGUMENTS, 'Phone or Email is required');\n }\n return this.usersStore.create(user);\n };\n Users.prototype.getAllAdminsAndDispatchers = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 25 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor;\n return this.usersStore.getAllAdminsAndDispatchers({ limit: limit, page_action: page_action, cursor: cursor });\n };\n Users.prototype.getAllDrivers = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 25 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor, options = _a.options;\n var optionsWithDefaults = lodash_1.defaults(options, { onlyOnlineDriver: false, onlyCustomers: false });\n return this.usersStore.getAllDrivers({ limit: limit, page_action: page_action, cursor: cursor, options: optionsWithDefaults });\n };\n Users.prototype.byUserType = function (userTypeId) {\n return this.usersStore.byUserType(userTypeId);\n };\n Users.prototype.makeAdmin = function (userId) {\n return this.usersStore.makeAdmin(userId);\n };\n Users.prototype.totalEmployeesCount = function () {\n return this.usersStore.totalEmployeesCount();\n };\n Users.prototype.totalDriversCount = function () {\n return this.usersStore.totalDriversCount();\n };\n Users.prototype.getAdmin = function (adminId) {\n return this.usersStore.get(adminId);\n };\n Users.prototype.getDriver = function (driverId) {\n return this.usersStore.get(driverId);\n };\n Users.prototype.getDispatcher = function (dispatcherId) {\n return this.usersStore.get(dispatcherId);\n };\n Users.prototype.getDriversByTeam = function (teamId) {\n return this.usersStore.getDriversByTeam(teamId);\n };\n Users.prototype.getAll = function (page, limit) {\n if (page === void 0) { page = 1; }\n if (limit === void 0) { limit = 50; }\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*/, this.usersStore.getAll(page, limit)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n Users.prototype.getAllKeysetPagination = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 2500 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor;\n return this.usersStore.getAllKeysetPagination({ limit: limit, page_action: page_action, cursor: cursor });\n };\n Users.prototype.get = function (userId) {\n return this.usersStore.get(userId);\n };\n Users.prototype.invite = function (userId) {\n return this.usersStore.invite(userId);\n };\n Users.prototype.unlock = function (userId) {\n return this.usersStore.unlock(userId);\n };\n Users.prototype.assignedTasksCount = function (userId) {\n return this.usersStore.assignedTasksCount(userId);\n };\n Users.prototype.inviteByEmail = function (userId) {\n return this.usersStore.inviteByEmail(userId);\n };\n Users.prototype.validatePhone = function (phone) {\n return this.usersStore.validatePhone(phone);\n };\n Users.prototype.closedTasks = function (userId, page) {\n return this.usersStore.closedTasks(userId, page);\n };\n Users.prototype.update = function (userId, userDelta) {\n var _this = this;\n return this.usersStore.update(userId, userDelta).then(function (user) { return _this.updateCurrentUserIfNeeded(user); });\n };\n Users.prototype.updateCurrentUserIfNeeded = function (user) {\n var currentUser = this.usersStore.usersService.session.user;\n if (currentUser.id === user.id) {\n this.usersStore.usersService.session.user = lodash_1.merge(currentUser, user);\n this.usersStore.usersService.session.sendDataEvent(User_consts_1.UserEvents.CURRENT_USER_UPDATED, this.usersStore.usersService.session.user);\n }\n return user;\n };\n Users.prototype.delete = function (userId) {\n return this.usersStore.delete(userId);\n };\n Users.prototype.getProfileImage = function (userId) {\n return this.usersStore.getProfileImage(userId);\n };\n Users.prototype.subscribeToGroupUpdates = function (fn) {\n this.usersStore.subscribeToGroupUpdates(fn);\n };\n Users.prototype.getOfflineDriversIds = function () {\n return this.usersStore.getOfflineDriversIds();\n };\n Users.prototype.getOnlineDriversIds = function () {\n return this.usersStore.getOnlineDriversIds();\n };\n Users.prototype.getOnShiftDriversIds = function () {\n return this.usersStore.getOnShiftDriversIds();\n };\n Users.prototype.getAdminsIds = function () {\n return this.usersStore.getAdminsIds();\n };\n Users.prototype.getDispatchersIds = function () {\n return this.usersStore.getDispatchersIds();\n };\n Users.prototype.messageDriver = function (userId, message) {\n return this.usersStore.messageDriver(userId, message);\n };\n __decorate([\n BringgException_1.logOnException,\n MethodsArgsDecorators_1.processArguments,\n __param(0, MethodsArgsDecorators_1.sanitize(ALLOWED_KEYS.CREATE_USER))\n ], Users.prototype, \"create\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllAdminsAndDispatchers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"byUserType\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"makeAdmin\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"totalEmployeesCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"totalDriversCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAdmin\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriver\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDispatcher\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriversByTeam\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAll\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllKeysetPagination\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"get\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"invite\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"unlock\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"assignedTasksCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"inviteByEmail\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"validatePhone\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"closedTasks\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"update\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"delete\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getProfileImage\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"subscribeToGroupUpdates\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOfflineDriversIds\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOnlineDriversIds\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOnShiftDriversIds\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAdminsIds\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDispatchersIds\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"messageDriver\", null);\n return Users;\n}());\nexports.default = Users;\n//# sourceMappingURL=Users.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Users.js?");
|
|
2582
|
+
eval("\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\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 (_) 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};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar UsersStore_1 = __webpack_require__(/*! ./Store/UsersStore */ \"./dist/User/Store/UsersStore.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar MethodsArgsDecorators_1 = __webpack_require__(/*! ../Core/MethodsArgsDecorators */ \"./dist/Core/MethodsArgsDecorators.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar User_consts_1 = __webpack_require__(/*! ./User.consts */ \"./dist/User/User.consts.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar ALLOWED_KEYS = {\n CREATE_USER: ['name', 'job_description', 'password', 'email', 'phone']\n};\nvar Users = /** @class */ (function () {\n function Users(session) {\n this.usersStore = new UsersStore_1.default(session);\n //keep previous names for backward compatibility\n this.onListUpdate = this.usersStore.onListUpdate;\n this.onUpdate = this.usersStore.onItemUpdate;\n this.onDelete = this.usersStore.onItemRemoved;\n this.onCreate = this.usersStore.onItemCreated;\n this.unsubscribe = this.usersStore.unsubscribe;\n }\n Users.prototype.create = function (user) {\n if (lodash_1.isNil(user.email) && lodash_1.isNil(user.phone)) {\n throw new BringgException_1.BringgException(ExceptionReason_1.ExceptionReason.INVALID_ARGUMENTS, 'Phone or Email is required');\n }\n return this.usersStore.create(user);\n };\n Users.prototype.getAllAdminsAndDispatchers = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 25 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor;\n return this.usersStore.getAllAdminsAndDispatchers({ limit: limit, page_action: page_action, cursor: cursor });\n };\n Users.prototype.getAllDrivers = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 25 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor, options = _a.options;\n var optionsWithDefaults = lodash_1.defaults(options, { onlyOnlineDriver: false, onlyCustomers: false });\n return this.usersStore.getAllDrivers({ limit: limit, page_action: page_action, cursor: cursor, options: optionsWithDefaults });\n };\n Users.prototype.byUserType = function (userTypeId) {\n return this.usersStore.byUserType(userTypeId);\n };\n Users.prototype.makeAdmin = function (userId) {\n return this.usersStore.makeAdmin(userId);\n };\n Users.prototype.totalEmployeesCount = function () {\n return this.usersStore.totalEmployeesCount();\n };\n Users.prototype.totalDriversCount = function () {\n return this.usersStore.totalDriversCount();\n };\n Users.prototype.getAdmin = function (adminId) {\n return this.usersStore.get(adminId);\n };\n Users.prototype.getDriver = function (driverId) {\n return this.usersStore.get(driverId);\n };\n Users.prototype.getDispatcher = function (dispatcherId) {\n return this.usersStore.get(dispatcherId);\n };\n Users.prototype.getDriversByTeam = function (teamId) {\n return this.usersStore.getDriversByTeam(teamId);\n };\n Users.prototype.getAll = function (page, limit) {\n if (page === void 0) { page = 1; }\n if (limit === void 0) { limit = 50; }\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*/, this.usersStore.getAll(page, limit)];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n Users.prototype.getAllKeysetPagination = function (_a) {\n var _b = _a.limit, limit = _b === void 0 ? 2500 : _b, _c = _a.page_action, page_action = _c === void 0 ? keyset_pagination_consts_1.KeysetPaginationPageAction.NEXT : _c, cursor = _a.cursor;\n return this.usersStore.getAllKeysetPagination({ limit: limit, page_action: page_action, cursor: cursor });\n };\n Users.prototype.get = function (userId) {\n return this.usersStore.get(userId);\n };\n Users.prototype.invite = function (userId) {\n return this.usersStore.invite(userId);\n };\n Users.prototype.unlock = function (userId) {\n return this.usersStore.unlock(userId);\n };\n Users.prototype.assignedTasksCount = function (userId) {\n return this.usersStore.assignedTasksCount(userId);\n };\n Users.prototype.inviteByEmail = function (userId) {\n return this.usersStore.inviteByEmail(userId);\n };\n Users.prototype.validatePhone = function (phone) {\n return this.usersStore.validatePhone(phone);\n };\n Users.prototype.closedTasks = function (userId, page) {\n return this.usersStore.closedTasks(userId, page);\n };\n Users.prototype.update = function (userId, userDelta) {\n var _this = this;\n return this.usersStore.update(userId, userDelta).then(function (user) { return _this.updateCurrentUserIfNeeded(user); });\n };\n Users.prototype.updateCurrentUserIfNeeded = function (user) {\n var currentUser = this.usersStore.usersService.session.user;\n if (currentUser.id === user.id) {\n this.usersStore.usersService.session.user = lodash_1.merge(currentUser, user);\n this.usersStore.usersService.session.sendDataEvent(User_consts_1.UserEvents.CURRENT_USER_UPDATED, this.usersStore.usersService.session.user);\n }\n return user;\n };\n Users.prototype.delete = function (userId) {\n return this.usersStore.delete(userId);\n };\n Users.prototype.getProfileImage = function (userId) {\n return this.usersStore.getProfileImage(userId);\n };\n Users.prototype.subscribeToGroupUpdates = function (fn) {\n this.usersStore.subscribeToGroupUpdates(fn);\n };\n Users.prototype.getOfflineDrivers = function () {\n return this.usersStore.getOfflineDrivers();\n };\n Users.prototype.getOnlineDrivers = function () {\n return this.usersStore.getOnlineDrivers();\n };\n Users.prototype.getAllLocalDrivers = function () {\n return this.usersStore.getAllLocalDrivers();\n };\n Users.prototype.getOnShiftDrivers = function () {\n return this.usersStore.getOnShiftDrivers();\n };\n Users.prototype.getAdmins = function () {\n return this.usersStore.getAdmins();\n };\n Users.prototype.getDispatchers = function () {\n return this.usersStore.getDispatchers();\n };\n Users.prototype.messageDriver = function (userId, message) {\n return this.usersStore.messageDriver(userId, message);\n };\n __decorate([\n BringgException_1.logOnException,\n MethodsArgsDecorators_1.processArguments,\n __param(0, MethodsArgsDecorators_1.sanitize(ALLOWED_KEYS.CREATE_USER))\n ], Users.prototype, \"create\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllAdminsAndDispatchers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"byUserType\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"makeAdmin\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"totalEmployeesCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"totalDriversCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAdmin\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriver\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDispatcher\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriversByTeam\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAll\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllKeysetPagination\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"get\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"invite\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"unlock\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"assignedTasksCount\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"inviteByEmail\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"validatePhone\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"closedTasks\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"update\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"delete\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getProfileImage\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"subscribeToGroupUpdates\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOfflineDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOnlineDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAllLocalDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getOnShiftDrivers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getAdmins\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDispatchers\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"messageDriver\", null);\n return Users;\n}());\nexports.default = Users;\n//# sourceMappingURL=Users.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Users.js?");
|
|
2583
2583
|
|
|
2584
2584
|
/***/ }),
|
|
2585
2585
|
|