@bringg/dashboard-sdk 9.28.6 → 9.28.7
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/Services/ServiceRequest.js +1 -1
- package/dist/User/Service/UsersService.d.ts +1 -0
- package/dist/User/Service/UsersService.js +17 -1
- package/dist/User/Service/UsersService.js.map +1 -1
- package/dist/User/Users.d.ts +1 -0
- package/dist/User/Users.js +6 -0
- package/dist/User/Users.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +24 -2
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +3 -3
- package/dist/bringg-dashboard-sdk.min.js +1 -1
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2393,7 +2393,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
2393
2393
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2394
2394
|
|
|
2395
2395
|
"use strict";
|
|
2396
|
-
eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __importDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar Logger_1 = __importDefault(__webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\"));\nvar abort_1 = __webpack_require__(/*! ../utils/abort */ \"./dist/utils/abort.js\");\nvar version = '9.28.6';\nfunction logErrorResponse(response) {\n var data = response.data, status = response.status;\n try {\n Logger_1.default.error(response.config.method.toUpperCase(), response.config.url, status);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) {\n //\n }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, authenticationToken, \n // eslint-disable-next-line @typescript-eslint/ban-types\n headers, responseType, signal) {\n // NiceToHave: move headers to HttpHeaders class\n this.headers = __assign(__assign({ 'Content-Type': 'application/json' }, headers), { 'sdk-version': version, Client: clientId });\n this.timeout = timeout;\n this.validateStatus = lodash_1.stubTrue;\n if (queryString) {\n this.params = queryString;\n }\n if (authenticationToken) {\n this.headers['Authorization'] = \"Token token=\".concat(authenticationToken);\n }\n if (responseType) {\n this.responseType = responseType;\n }\n if (signal) {\n this.signal = signal;\n }\n }\n RequestOptions.new = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.clientId, clientId = _c === void 0 ? 'Bringg Dashboard' : _c, _d = _b.timeout, timeout = _d === void 0 ? DEFAULT_TIMEOUT : _d, queryString = _b.queryString, authenticationToken = _b.authenticationToken, headers = _b.headers, responseType = _b.responseType, signal = _b.signal;\n return new RequestOptions(clientId, timeout || DEFAULT_TIMEOUT, queryString, authenticationToken, headers, responseType, signal);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response, signal) {\n this.axiosPromise = response;\n this.signal = signal;\n }\n ResponseHandler.prototype.handle = function (consumer) {\n return __awaiter(this, void 0, void 0, function () {\n var axiosResponse, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if ((0, lodash_1.isUndefined)(consumer)) {\n throw new Error('consumer must be defined');\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.axiosPromise];\n case 2:\n axiosResponse = _a.sent();\n return [2 /*return*/, consumer(axiosResponse)];\n case 3:\n e_1 = _a.sent();\n if (axios_1.default.isCancel(e_1)) {\n (0, abort_1.throwAbortError)(this.signal, 'Request Aborted');\n }\n if (e_1 instanceof BringgException_1.BringgException) {\n throw e_1;\n }\n return [2 /*return*/, consumer(e_1)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n return ResponseHandler;\n}());\nexports.ResponseHandler = ResponseHandler;\nfunction get(axiosInstance, host, uri, queryString, signal) {\n return new ResponseHandler(axiosInstance.get(\"\".concat(host).concat(uri), { params: queryString, signal: signal }), signal);\n}\nfunction post(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.post(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction put(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.put(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction patch(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.patch(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction remove(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.delete(\"\".concat(host).concat(uri), { params: queryString, data: payload, signal: signal }), signal);\n}\nfunction routify(axiosInstance, endpoint, route, \n// eslint-disable-next-line @typescript-eslint/ban-types\nrouteParams, queryString, payload, signal) {\n switch (route.httpMethod) {\n case 0 /* HttpMethod.GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, signal);\n case 1 /* HttpMethod.POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 2 /* HttpMethod.PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 3 /* HttpMethod.PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 4 /* HttpMethod.DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n }\n}\nfunction wrapWithInterceptors(axios) {\n axios.interceptors.request.use(function (req) {\n var method = req.method, url = req.url, params = req.params, headers = req.headers, data = req.data;\n try {\n Logger_1.default.debug('REQUEST:', method.toUpperCase(), url);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('REQUEST-query-string:', params);\n Logger_1.default.trace('REQUEST-headers:', headers);\n Logger_1.default.trace('REQUEST-data:', data);\n }\n catch (e) {\n //\n }\n return req;\n });\n axios.interceptors.response.use(function (res) {\n var statusText = res.statusText, status = res.status, headers = res.headers, data = res.data;\n try {\n Logger_1.default.debug('RESPONSE:', res.config.url, status, statusText);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) {\n //\n }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, \n// eslint-disable-next-line @typescript-eslint/ban-types\nheaders, responseType, timeout, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers, responseType: responseType, timeout: timeout, signal: signal })));\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction anonymousAxiosInstance(clientId, headers, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers, signal: signal })));\n}\nvar AuthorizedServiceRequest = /** @class */ (function () {\n function AuthorizedServiceRequest(clientId, authToken) {\n this.authToken = authToken;\n this.clientId = clientId;\n }\n AuthorizedServiceRequest.prototype.invoke = function (endpoint, route, \n // eslint-disable-next-line @typescript-eslint/ban-types\n routeParams, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, payload, \n // eslint-disable-next-line @typescript-eslint/ban-types\n headers, responseType, timeout, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(axiosInstance(this.clientId, this.authToken, headers, responseType, timeout), endpoint, route, routeParams, queryString, payload, signal);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId, headers) {\n this.clientId = clientId;\n this.headers = headers;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, \n // eslint-disable-next-line @typescript-eslint/ban-types\n routeParams, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, payload, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(anonymousAxiosInstance(this.clientId, this.headers, signal), endpoint, route, routeParams, queryString, payload);\n };\n return AnonymousServiceRequest;\n}());\nexports.AnonymousServiceRequest = AnonymousServiceRequest;\n//# sourceMappingURL=ServiceRequest.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/ServiceRequest.js?");
|
|
2396
|
+
eval("\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.AnonymousServiceRequest = exports.AuthorizedServiceRequest = exports.ResponseHandler = exports.RequestOptions = exports.logErrorResponse = void 0;\nvar axios_1 = __importDefault(__webpack_require__(/*! axios */ \"./node_modules/axios/index.js\"));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar Logger_1 = __importDefault(__webpack_require__(/*! ../Core/Logger */ \"./dist/Core/Logger.js\"));\nvar abort_1 = __webpack_require__(/*! ../utils/abort */ \"./dist/utils/abort.js\");\nvar version = '9.28.7';\nfunction logErrorResponse(response) {\n var data = response.data, status = response.status;\n try {\n Logger_1.default.error(response.config.method.toUpperCase(), response.config.url, status);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.info(response.config.method.toUpperCase(), response.config.url, status, data);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.debug(response);\n }\n catch (e) {\n //\n }\n}\nexports.logErrorResponse = logErrorResponse;\nvar DEFAULT_TIMEOUT = 120000;\nvar RequestOptions = /** @class */ (function () {\n function RequestOptions(clientId, timeout, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, authenticationToken, \n // eslint-disable-next-line @typescript-eslint/ban-types\n headers, responseType, signal) {\n // NiceToHave: move headers to HttpHeaders class\n this.headers = __assign(__assign({ 'Content-Type': 'application/json' }, headers), { 'sdk-version': version, Client: clientId });\n this.timeout = timeout;\n this.validateStatus = lodash_1.stubTrue;\n if (queryString) {\n this.params = queryString;\n }\n if (authenticationToken) {\n this.headers['Authorization'] = \"Token token=\".concat(authenticationToken);\n }\n if (responseType) {\n this.responseType = responseType;\n }\n if (signal) {\n this.signal = signal;\n }\n }\n RequestOptions.new = function (_a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.clientId, clientId = _c === void 0 ? 'Bringg Dashboard' : _c, _d = _b.timeout, timeout = _d === void 0 ? DEFAULT_TIMEOUT : _d, queryString = _b.queryString, authenticationToken = _b.authenticationToken, headers = _b.headers, responseType = _b.responseType, signal = _b.signal;\n return new RequestOptions(clientId, timeout || DEFAULT_TIMEOUT, queryString, authenticationToken, headers, responseType, signal);\n };\n return RequestOptions;\n}());\nexports.RequestOptions = RequestOptions;\nvar ResponseHandler = /** @class */ (function () {\n function ResponseHandler(response, signal) {\n this.axiosPromise = response;\n this.signal = signal;\n }\n ResponseHandler.prototype.handle = function (consumer) {\n return __awaiter(this, void 0, void 0, function () {\n var axiosResponse, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if ((0, lodash_1.isUndefined)(consumer)) {\n throw new Error('consumer must be defined');\n }\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.axiosPromise];\n case 2:\n axiosResponse = _a.sent();\n return [2 /*return*/, consumer(axiosResponse)];\n case 3:\n e_1 = _a.sent();\n if (axios_1.default.isCancel(e_1)) {\n (0, abort_1.throwAbortError)(this.signal, 'Request Aborted');\n }\n if (e_1 instanceof BringgException_1.BringgException) {\n throw e_1;\n }\n return [2 /*return*/, consumer(e_1)];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n return ResponseHandler;\n}());\nexports.ResponseHandler = ResponseHandler;\nfunction get(axiosInstance, host, uri, queryString, signal) {\n return new ResponseHandler(axiosInstance.get(\"\".concat(host).concat(uri), { params: queryString, signal: signal }), signal);\n}\nfunction post(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.post(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction put(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.put(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction patch(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.patch(\"\".concat(host).concat(uri), payload, { params: queryString, signal: signal }), signal);\n}\nfunction remove(axiosInstance, host, uri, queryString, payload, signal) {\n return new ResponseHandler(axiosInstance.delete(\"\".concat(host).concat(uri), { params: queryString, data: payload, signal: signal }), signal);\n}\nfunction routify(axiosInstance, endpoint, route, \n// eslint-disable-next-line @typescript-eslint/ban-types\nrouteParams, queryString, payload, signal) {\n switch (route.httpMethod) {\n case 0 /* HttpMethod.GET */:\n return get(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, signal);\n case 1 /* HttpMethod.POST */:\n return post(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 2 /* HttpMethod.PUT */:\n return put(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 3 /* HttpMethod.PATCH */:\n return patch(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n case 4 /* HttpMethod.DELETE */:\n return remove(axiosInstance, endpoint.encode(), route.applyParams(routeParams), queryString, payload, signal);\n }\n}\nfunction wrapWithInterceptors(axios) {\n axios.interceptors.request.use(function (req) {\n var method = req.method, url = req.url, params = req.params, headers = req.headers, data = req.data;\n try {\n Logger_1.default.debug('REQUEST:', method.toUpperCase(), url);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('REQUEST-query-string:', params);\n Logger_1.default.trace('REQUEST-headers:', headers);\n Logger_1.default.trace('REQUEST-data:', data);\n }\n catch (e) {\n //\n }\n return req;\n });\n axios.interceptors.response.use(function (res) {\n var statusText = res.statusText, status = res.status, headers = res.headers, data = res.data;\n try {\n Logger_1.default.debug('RESPONSE:', res.config.url, status, statusText);\n }\n catch (e) {\n //\n }\n try {\n Logger_1.default.trace('RESPONSE-headers:', headers);\n Logger_1.default.trace('RESPONSE-data:', data);\n }\n catch (e) {\n //\n }\n return res;\n });\n return axios;\n}\nfunction axiosInstance(clientId, authenticationToken, \n// eslint-disable-next-line @typescript-eslint/ban-types\nheaders, responseType, timeout, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, authenticationToken: authenticationToken, headers: headers, responseType: responseType, timeout: timeout, signal: signal })));\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction anonymousAxiosInstance(clientId, headers, signal) {\n return wrapWithInterceptors(axios_1.default.create(RequestOptions.new({ clientId: clientId, headers: headers, signal: signal })));\n}\nvar AuthorizedServiceRequest = /** @class */ (function () {\n function AuthorizedServiceRequest(clientId, authToken) {\n this.authToken = authToken;\n this.clientId = clientId;\n }\n AuthorizedServiceRequest.prototype.invoke = function (endpoint, route, \n // eslint-disable-next-line @typescript-eslint/ban-types\n routeParams, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, payload, \n // eslint-disable-next-line @typescript-eslint/ban-types\n headers, responseType, timeout, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(axiosInstance(this.clientId, this.authToken, headers, responseType, timeout), endpoint, route, routeParams, queryString, payload, signal);\n };\n return AuthorizedServiceRequest;\n}());\nexports.AuthorizedServiceRequest = AuthorizedServiceRequest;\nvar AnonymousServiceRequest = /** @class */ (function () {\n function AnonymousServiceRequest(clientId, headers) {\n this.clientId = clientId;\n this.headers = headers;\n }\n AnonymousServiceRequest.prototype.invoke = function (endpoint, route, \n // eslint-disable-next-line @typescript-eslint/ban-types\n routeParams, \n // eslint-disable-next-line @typescript-eslint/ban-types\n queryString, payload, signal) {\n if (signal === null || signal === void 0 ? void 0 : signal.aborted) {\n (0, abort_1.throwAbortError)(signal, 'Request aborted (before even started the request)');\n }\n return routify(anonymousAxiosInstance(this.clientId, this.headers, signal), endpoint, route, routeParams, queryString, payload);\n };\n return AnonymousServiceRequest;\n}());\nexports.AnonymousServiceRequest = AnonymousServiceRequest;\n//# sourceMappingURL=ServiceRequest.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/Services/ServiceRequest.js?");
|
|
2397
2397
|
|
|
2398
2398
|
/***/ }),
|
|
2399
2399
|
|
|
@@ -3020,7 +3020,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
3020
3020
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3021
3021
|
|
|
3022
3022
|
"use strict";
|
|
3023
|
-
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 __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar RouteGenerator_1 = __webpack_require__(/*! ../../Core/RouteGenerator */ \"./dist/Core/RouteGenerator.js\");\nvar PubSubEvents_1 = __webpack_require__(/*! ../../Services/PubSubEvents */ \"./dist/Services/PubSubEvents.js\");\nvar PubSubService_1 = __webpack_require__(/*! ../../Services/PubSubService */ \"./dist/Services/PubSubService.js\");\nvar Route_1 = __webpack_require__(/*! ../../Services/Route */ \"./dist/Services/Route.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar User_consts_1 = __webpack_require__(/*! ../User.consts */ \"./dist/User/User.consts.js\");\nvar ROUTES = {\n GET: new Route_1.Route('/users/{:userId}', 0 /* HttpMethod.GET */),\n GET_ALL: new Route_1.Route('/users/', 0 /* HttpMethod.GET */),\n GET_ALL_DRIVERS: new Route_1.Route('/users/drivers', 0 /* HttpMethod.GET */),\n GET_USERS_WITH_USER_TYPE: new Route_1.Route('/user_types/{:userTypeId}/users', 0 /* HttpMethod.GET */),\n GET_DRIVERS_BY_TEAM: new Route_1.Route('/teams/{:teamId}/users', 0 /* HttpMethod.GET */),\n MAKE_ADMIN: new Route_1.Route('/users/{:userId}/admin', 1 /* HttpMethod.POST */),\n CREATE_USER: new Route_1.Route('/users/', 1 /* HttpMethod.POST */),\n INVITE: new Route_1.Route('/users/{:userId}/reinvite', 1 /* HttpMethod.POST */),\n TOTAL_TASKS: new Route_1.Route('/users/{:userId}/tasks/count', 0 /* HttpMethod.GET */),\n TOTAL_EMPLOYEES: new Route_1.Route('/users/count', 0 /* HttpMethod.GET */),\n TOTAL_DRIVERS: new Route_1.Route('/users/drivers/count', 0 /* HttpMethod.GET */),\n UNLOCK: new Route_1.Route('/users/{:userId}/unlock', 1 /* HttpMethod.POST */),\n INVITE_VIA_EMAIL: new Route_1.Route('/users/{:userId}/reinvite_via_email', 1 /* HttpMethod.POST */),\n VALIDATE_PHONE: new Route_1.Route('/api/user/validate_phone', 0 /* HttpMethod.GET */),\n CLOSED_TASKS: new Route_1.Route('/users/{:userId}/tasks/closed_tasks', 0 /* HttpMethod.GET */),\n UPDATE: new Route_1.Route('/users/{:id}', 3 /* HttpMethod.PATCH */),\n DELETE: new Route_1.Route('/users/{:id}', 4 /* HttpMethod.DELETE */),\n GET_PROFILE_IMAGE: new Route_1.Route('/users/{:userId}/profile_image', 0 /* HttpMethod.GET */),\n MESSAGE_DRIVER: new Route_1.Route('/announcement/user/{:userId}', 2 /* HttpMethod.PUT */),\n DRIVER_COST: new Route_1.Route('/users/{:userId}/driver_cost', 0 /* HttpMethod.GET */)\n};\nvar UsersService = /** @class */ (function (_super) {\n __extends(UsersService, _super);\n function UsersService(session, store) {\n var _this = _super.call(this, session.config.getApiEndpoint(), session) || this;\n _this.store = store;\n return _this;\n }\n UsersService.prototype.create = function (user) {\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.handleAuthorizedRequest({\n route: ROUTES.CREATE_USER,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not create user'),\n payload: user\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getDriversByTeam = function (teamId) {\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.handleAuthorizedRequest({\n route: ROUTES.GET_DRIVERS_BY_TEAM,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get drivers'),\n routeParams: { teamId: teamId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.get = 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.handleAuthorizedRequest({\n route: ROUTES.GET,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get user \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getMany = function (_a, commonOptions) {\n var usersIds = _a.usersIds, _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.limit, limit = _c === void 0 ? 50 : _c;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_d) {\n return [2 /*return*/, new RouteGenerator_1.Request(this, ROUTES.GET_ALL)\n .withQueryString({ ids: usersIds, page: page, limit: limit })\n .withExtractor(function (response) { return ({ has_next_page: response.has_next_page, users: response.users }); })\n .setException('Could not get users by ids')\n .withCommonOptions(commonOptions)\n .invoke()];\n });\n });\n };\n UsersService.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 return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({ has_next_page: response.has_next_page, users: response.users }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n queryString: { page: page, limit: limit }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.getAllKeysetPagination = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor;\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.invite = 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.handleAuthorizedRequest({\n route: ROUTES.INVITE,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not invite user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.UNLOCK,\n extractor: User_consts_1.successExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not unlock user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_TASKS,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get task count for user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_EMPLOYEES,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get total employee count\"; })\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_DRIVERS,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get total drivers count\"; })\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.inviteByEmail = 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.handleAuthorizedRequest({\n route: ROUTES.INVITE_VIA_EMAIL,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not invite user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.VALIDATE_PHONE,\n extractor: function (response) { return response.phone_valid; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Phone is not valid: \".concat(phone); }),\n queryString: { phone: phone }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.closedTasks = function (userId, page) {\n if (page === void 0) { page = 0; }\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.handleAuthorizedRequest({\n route: ROUTES.CLOSED_TASKS,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get tasks for user: \".concat(userId); }),\n routeParams: { userId: userId },\n queryString: { page: page }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.update = function (id, userDelta) {\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.handleAuthorizedRequest({\n route: ROUTES.UPDATE,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not update user: \".concat(id); }),\n payload: __assign({ id: id }, userDelta),\n routeParams: { id: id }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getAllAdminsAndDispatchers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, scopes, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor;\n scopes = [User_consts_1.UsersScopes.DISPATCHERS, User_consts_1.UsersScopes.ADMINS];\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get admins and dispatchers'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, scopes: scopes, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.getAllDrivers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, options, scopes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor, options = request.options;\n scopes = [];\n if ((0, lodash_1.get)(options, 'onlyCustomers')) {\n scopes.push(User_consts_1.UsersScopes.CUSTOMERS);\n }\n else {\n scopes.push(User_consts_1.UsersScopes.DRIVERS);\n }\n if (options.onlyOnlineDriver) {\n scopes.push(User_consts_1.UsersScopes.MARKED_AS_ONLINE);\n }\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get drivers'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, scopes: scopes, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.delete = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.DELETE,\n extractor: User_consts_1.successExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not delete user: \".concat(id); }),\n routeParams: { id: id }\n })];\n case 1:\n result = _a.sent();\n return [2 /*return*/, result];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.GET_PROFILE_IMAGE,\n extractor: function (response) { return response.profile_image; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get user's \".concat(userId, \" profile image\"); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.messageDriver = function (userId, message) {\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.handleAuthorizedRequest({\n route: ROUTES.MESSAGE_DRIVER,\n extractor: function (response) { return response.announcement_id; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not message to user \".concat(userId); }),\n payload: { user_id: userId, message: message },\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getDriverCost = 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.handleAuthorizedRequest({\n route: ROUTES.DRIVER_COST,\n extractor: function (response) { return response; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get cost to user \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.byUserType = function (userTypeId) {\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.handleAuthorizedRequest({\n route: ROUTES.GET_USERS_WITH_USER_TYPE,\n extractor: User_consts_1.usersExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n routeParams: { userTypeId: userTypeId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.makeAdmin = 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.handleAuthorizedRequest({\n route: ROUTES.MAKE_ADMIN,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not set admin on userId: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.fetchAllPages = function (fn, options) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var result, hasMore, cursor, _b, values, hasMoreInPage, nextCursor;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n result = [];\n hasMore = true;\n cursor = undefined;\n _c.label = 1;\n case 1:\n if (!hasMore) return [3 /*break*/, 3];\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n throw new Error('Aborted');\n }\n return [4 /*yield*/, fn(cursor)];\n case 2:\n _b = _c.sent(), values = _b.values, hasMoreInPage = _b.hasMore, nextCursor = _b.nextCursor;\n result = result.concat(values);\n hasMore = hasMoreInPage;\n cursor = nextCursor;\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, result];\n }\n });\n });\n };\n UsersService.prototype.attachSubscriptions = function () {\n var _this = this;\n this.subscribeToEvent(PubSubEvents_1.DELETE_EMPLOYEE, function (user) {\n _this.store.removeFromStore(user.user_id);\n });\n this.subscribeToEvent(PubSubEvents_1.EMPLOYEE_UPDATE_EVENT, function (user) {\n _this.store.updateInStore(user);\n });\n this.subscribeToEvent(PubSubEvents_1.NEW_EMPLOYEE, function (user) {\n _this.store.addToStore(user);\n });\n };\n return UsersService;\n}(PubSubService_1.PubSubService));\nexports[\"default\"] = UsersService;\n//# sourceMappingURL=UsersService.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Service/UsersService.js?");
|
|
3023
|
+
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 __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar RouteGenerator_1 = __webpack_require__(/*! ../../Core/RouteGenerator */ \"./dist/Core/RouteGenerator.js\");\nvar PubSubEvents_1 = __webpack_require__(/*! ../../Services/PubSubEvents */ \"./dist/Services/PubSubEvents.js\");\nvar PubSubService_1 = __webpack_require__(/*! ../../Services/PubSubService */ \"./dist/Services/PubSubService.js\");\nvar Route_1 = __webpack_require__(/*! ../../Services/Route */ \"./dist/Services/Route.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar User_consts_1 = __webpack_require__(/*! ../User.consts */ \"./dist/User/User.consts.js\");\nvar ROUTES = {\n GET: new Route_1.Route('/users/{:userId}', 0 /* HttpMethod.GET */),\n GET_ALL: new Route_1.Route('/users/', 0 /* HttpMethod.GET */),\n GET_ALL_DRIVERS: new Route_1.Route('/users/drivers', 0 /* HttpMethod.GET */),\n GET_USERS_WITH_USER_TYPE: new Route_1.Route('/user_types/{:userTypeId}/users', 0 /* HttpMethod.GET */),\n GET_DRIVERS_BY_TEAM: new Route_1.Route('/teams/{:teamId}/users', 0 /* HttpMethod.GET */),\n MAKE_ADMIN: new Route_1.Route('/users/{:userId}/admin', 1 /* HttpMethod.POST */),\n CREATE_USER: new Route_1.Route('/users/', 1 /* HttpMethod.POST */),\n INVITE: new Route_1.Route('/users/{:userId}/reinvite', 1 /* HttpMethod.POST */),\n TOTAL_TASKS: new Route_1.Route('/users/{:userId}/tasks/count', 0 /* HttpMethod.GET */),\n TOTAL_EMPLOYEES: new Route_1.Route('/users/count', 0 /* HttpMethod.GET */),\n TOTAL_DRIVERS: new Route_1.Route('/users/drivers/count', 0 /* HttpMethod.GET */),\n UNLOCK: new Route_1.Route('/users/{:userId}/unlock', 1 /* HttpMethod.POST */),\n INVITE_VIA_EMAIL: new Route_1.Route('/users/{:userId}/reinvite_via_email', 1 /* HttpMethod.POST */),\n VALIDATE_PHONE: new Route_1.Route('/api/user/validate_phone', 0 /* HttpMethod.GET */),\n CLOSED_TASKS: new Route_1.Route('/users/{:userId}/tasks/closed_tasks', 0 /* HttpMethod.GET */),\n UPDATE: new Route_1.Route('/users/{:id}', 3 /* HttpMethod.PATCH */),\n DELETE: new Route_1.Route('/users/{:id}', 4 /* HttpMethod.DELETE */),\n GET_PROFILE_IMAGE: new Route_1.Route('/users/{:userId}/profile_image', 0 /* HttpMethod.GET */),\n MESSAGE_DRIVER: new Route_1.Route('/announcement/user/{:userId}', 2 /* HttpMethod.PUT */),\n DRIVER_COST: new Route_1.Route('/users/{:userId}/driver_cost', 0 /* HttpMethod.GET */),\n GENERATE_RESET_PASSWORD_TOKEN: new Route_1.Route('/users/generate_reset_password_token', 1 /* HttpMethod.POST */)\n};\nvar UsersService = /** @class */ (function (_super) {\n __extends(UsersService, _super);\n function UsersService(session, store) {\n var _this = _super.call(this, session.config.getApiEndpoint(), session) || this;\n _this.store = store;\n return _this;\n }\n UsersService.prototype.create = function (user) {\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.handleAuthorizedRequest({\n route: ROUTES.CREATE_USER,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not create user'),\n payload: user\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getDriversByTeam = function (teamId) {\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.handleAuthorizedRequest({\n route: ROUTES.GET_DRIVERS_BY_TEAM,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get drivers'),\n routeParams: { teamId: teamId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.get = 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.handleAuthorizedRequest({\n route: ROUTES.GET,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get user \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getMany = function (_a, commonOptions) {\n var usersIds = _a.usersIds, _b = _a.page, page = _b === void 0 ? 1 : _b, _c = _a.limit, limit = _c === void 0 ? 50 : _c;\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_d) {\n return [2 /*return*/, new RouteGenerator_1.Request(this, ROUTES.GET_ALL)\n .withQueryString({ ids: usersIds, page: page, limit: limit })\n .withExtractor(function (response) { return ({ has_next_page: response.has_next_page, users: response.users }); })\n .setException('Could not get users by ids')\n .withCommonOptions(commonOptions)\n .invoke()];\n });\n });\n };\n UsersService.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 return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({ has_next_page: response.has_next_page, users: response.users }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n queryString: { page: page, limit: limit }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.getAllKeysetPagination = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor;\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.invite = 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.handleAuthorizedRequest({\n route: ROUTES.INVITE,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not invite user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.UNLOCK,\n extractor: User_consts_1.successExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not unlock user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_TASKS,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get task count for user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_EMPLOYEES,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get total employee count\"; })\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.TOTAL_DRIVERS,\n extractor: User_consts_1.countExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get total drivers count\"; })\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.inviteByEmail = 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.handleAuthorizedRequest({\n route: ROUTES.INVITE_VIA_EMAIL,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not invite user with id: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.VALIDATE_PHONE,\n extractor: function (response) { return response.phone_valid; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Phone is not valid: \".concat(phone); }),\n queryString: { phone: phone }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.closedTasks = function (userId, page) {\n if (page === void 0) { page = 0; }\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.handleAuthorizedRequest({\n route: ROUTES.CLOSED_TASKS,\n extractor: User_consts_1.defaultExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get tasks for user: \".concat(userId); }),\n routeParams: { userId: userId },\n queryString: { page: page }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.update = function (id, userDelta) {\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.handleAuthorizedRequest({\n route: ROUTES.UPDATE,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not update user: \".concat(id); }),\n payload: __assign({ id: id }, userDelta),\n routeParams: { id: id }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getAllAdminsAndDispatchers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, scopes, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor;\n scopes = [User_consts_1.UsersScopes.DISPATCHERS, User_consts_1.UsersScopes.ADMINS];\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get admins and dispatchers'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, scopes: scopes, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1:\n response = _a.sent();\n return [2 /*return*/, response];\n }\n });\n });\n };\n UsersService.prototype.getAllDrivers = function (request) {\n return __awaiter(this, void 0, void 0, function () {\n var limit, page_action, cursor, options, scopes;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n limit = request.limit, page_action = request.page_action, cursor = request.cursor, options = request.options;\n scopes = [];\n if ((0, lodash_1.get)(options, 'onlyCustomers')) {\n scopes.push(User_consts_1.UsersScopes.CUSTOMERS);\n }\n else {\n scopes.push(User_consts_1.UsersScopes.DRIVERS);\n }\n if (options.onlyOnlineDriver) {\n scopes.push(User_consts_1.UsersScopes.MARKED_AS_ONLINE);\n }\n return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.GET_ALL,\n extractor: function (response) { return ({\n next_page_cursor: response.next_page_cursor,\n previous_page_cursor: response.previous_page_cursor,\n users: response.users\n }); },\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get drivers'),\n queryString: { pgver: keyset_pagination_consts_1.KEYSET_PAGINATION_VER, scopes: scopes, limit: limit, page_action: page_action, cursor: cursor }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.delete = function (id) {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.handleAuthorizedRequest({\n route: ROUTES.DELETE,\n extractor: User_consts_1.successExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not delete user: \".concat(id); }),\n routeParams: { id: id }\n })];\n case 1:\n result = _a.sent();\n return [2 /*return*/, result];\n }\n });\n });\n };\n UsersService.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.handleAuthorizedRequest({\n route: ROUTES.GET_PROFILE_IMAGE,\n extractor: function (response) { return response.profile_image; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get user's \".concat(userId, \" profile image\"); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.messageDriver = function (userId, message) {\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.handleAuthorizedRequest({\n route: ROUTES.MESSAGE_DRIVER,\n extractor: function (response) { return response.announcement_id; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not message to user \".concat(userId); }),\n payload: { user_id: userId, message: message },\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.getDriverCost = 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.handleAuthorizedRequest({\n route: ROUTES.DRIVER_COST,\n extractor: function (response) { return response; },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not get cost to user \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.byUserType = function (userTypeId) {\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.handleAuthorizedRequest({\n route: ROUTES.GET_USERS_WITH_USER_TYPE,\n extractor: User_consts_1.usersExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException('Could not get users'),\n routeParams: { userTypeId: userTypeId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.makeAdmin = 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.handleAuthorizedRequest({\n route: ROUTES.MAKE_ADMIN,\n extractor: User_consts_1.userExtractor,\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not set admin on userId: \".concat(userId); }),\n routeParams: { userId: userId }\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n UsersService.prototype.fetchAllPages = function (fn, options) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var result, hasMore, cursor, _b, values, hasMoreInPage, nextCursor;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n result = [];\n hasMore = true;\n cursor = undefined;\n _c.label = 1;\n case 1:\n if (!hasMore) return [3 /*break*/, 3];\n if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted) {\n throw new Error('Aborted');\n }\n return [4 /*yield*/, fn(cursor)];\n case 2:\n _b = _c.sent(), values = _b.values, hasMoreInPage = _b.hasMore, nextCursor = _b.nextCursor;\n result = result.concat(values);\n hasMore = hasMoreInPage;\n cursor = nextCursor;\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, result];\n }\n });\n });\n };\n UsersService.prototype.attachSubscriptions = function () {\n var _this = this;\n this.subscribeToEvent(PubSubEvents_1.DELETE_EMPLOYEE, function (user) {\n _this.store.removeFromStore(user.user_id);\n });\n this.subscribeToEvent(PubSubEvents_1.EMPLOYEE_UPDATE_EVENT, function (user) {\n _this.store.updateInStore(user);\n });\n this.subscribeToEvent(PubSubEvents_1.NEW_EMPLOYEE, function (user) {\n _this.store.addToStore(user);\n });\n };\n UsersService.prototype.generateResetPasswordToken = function (email) {\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.handleAuthorizedRequest({\n route: ROUTES.GENERATE_RESET_PASSWORD_TOKEN,\n extractor: function (response) { return response.reset_password_token; },\n payload: { email: email },\n exceptionProducer: BringgException_1.BringgException.serviceException(function () { return \"Could not generate token\"; })\n })];\n case 1: return [2 /*return*/, _a.sent()];\n }\n });\n });\n };\n return UsersService;\n}(PubSubService_1.PubSubService));\nexports[\"default\"] = UsersService;\n//# sourceMappingURL=UsersService.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Service/UsersService.js?");
|
|
3024
3024
|
|
|
3025
3025
|
/***/ }),
|
|
3026
3026
|
|
|
@@ -3064,7 +3064,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
3064
3064
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3065
3065
|
|
|
3066
3066
|
"use strict";
|
|
3067
|
-
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar UsersStore_1 = __importDefault(__webpack_require__(/*! ./Store/UsersStore */ \"./dist/User/Store/UsersStore.js\"));\nvar User_consts_1 = __webpack_require__(/*! ./User.consts */ \"./dist/User/User.consts.js\");\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 ((0, lodash_1.isNil)(user.email) && (0, 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 = (0, 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 __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.usersStore.get(userId)];\n case 1:\n user = _a.sent();\n this.usersStore.addToStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n Users.prototype.getMany = function (usersIds, commonOptions) {\n return this.usersStore.getMany(usersIds, commonOptions);\n };\n Users.prototype.getLocal = function (userId) {\n return this.usersStore.getItem(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 = (0, 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 Users.prototype.getDriverCost = function (userId) {\n return this.usersStore.usersService.getDriverCost(userId);\n };\n __decorate([\n BringgException_1.logOnException\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, \"getMany\", 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 __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriverCost\", null);\n return Users;\n}());\nexports[\"default\"] = Users;\n//# sourceMappingURL=Users.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Users.js?");
|
|
3067
|
+
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar lodash_1 = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nvar BringgException_1 = __webpack_require__(/*! ../Core/BringgException */ \"./dist/Core/BringgException.js\");\nvar ExceptionReason_1 = __webpack_require__(/*! ../Core/ExceptionReason */ \"./dist/Core/ExceptionReason.js\");\nvar keyset_pagination_consts_1 = __webpack_require__(/*! ../utils/consts/keyset-pagination.consts */ \"./dist/utils/consts/keyset-pagination.consts.js\");\nvar UsersStore_1 = __importDefault(__webpack_require__(/*! ./Store/UsersStore */ \"./dist/User/Store/UsersStore.js\"));\nvar User_consts_1 = __webpack_require__(/*! ./User.consts */ \"./dist/User/User.consts.js\");\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 ((0, lodash_1.isNil)(user.email) && (0, 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 = (0, 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 __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.usersStore.get(userId)];\n case 1:\n user = _a.sent();\n this.usersStore.addToStore(user);\n return [2 /*return*/, user];\n }\n });\n });\n };\n Users.prototype.getMany = function (usersIds, commonOptions) {\n return this.usersStore.getMany(usersIds, commonOptions);\n };\n Users.prototype.getLocal = function (userId) {\n return this.usersStore.getItem(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 = (0, 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 Users.prototype.getDriverCost = function (userId) {\n return this.usersStore.usersService.getDriverCost(userId);\n };\n Users.prototype.generateResetPasswordToken = function (email) {\n return this.usersStore.usersService.generateResetPasswordToken(email);\n };\n __decorate([\n BringgException_1.logOnException\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, \"getMany\", 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 __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"getDriverCost\", null);\n __decorate([\n BringgException_1.logOnException\n ], Users.prototype, \"generateResetPasswordToken\", null);\n return Users;\n}());\nexports[\"default\"] = Users;\n//# sourceMappingURL=Users.js.map\n\n//# sourceURL=webpack://BringgDashboardSDK/./dist/User/Users.js?");
|
|
3068
3068
|
|
|
3069
3069
|
/***/ }),
|
|
3070
3070
|
|