@escapenavigator/services 1.10.99 → 1.10.100

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.
@@ -0,0 +1,15 @@
1
+ import { ApiMethodDeclaration } from '..';
2
+ type ParamsData = {
3
+ questroomId: number;
4
+ monthStart: string;
5
+ };
6
+ type ResponseData = Array<{
7
+ day: string;
8
+ visits: number;
9
+ bookings: number;
10
+ cancellations: number;
11
+ conversion: number;
12
+ cancellationRate: number;
13
+ }>;
14
+ export declare const getAggregatorQuestroomDailyStatistics: ApiMethodDeclaration<ParamsData, ResponseData>;
15
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.getAggregatorQuestroomDailyStatistics = void 0;
15
+ var getAggregatorQuestroomDailyStatistics = function (_a) {
16
+ var questroomId = _a.questroomId, params = __rest(_a, ["questroomId"]);
17
+ return ({
18
+ url: "/aggregator-orders/statistics/questrooms/".concat(questroomId, "/days"),
19
+ method: 'GET',
20
+ params: params,
21
+ });
22
+ };
23
+ exports.getAggregatorQuestroomDailyStatistics = getAggregatorQuestroomDailyStatistics;
@@ -0,0 +1,19 @@
1
+ import { ApiMethodDeclaration } from '..';
2
+ type ParamsData = void;
3
+ type ResponseData = {
4
+ minVisitsForConfidence: number;
5
+ minBookingsForCancelPenalty: number;
6
+ priorRating: number;
7
+ priorRatingWeight: number;
8
+ conversionP90: number;
9
+ cancelRateBaseline: number;
10
+ weightRating: number;
11
+ weightConversion: number;
12
+ cancelPenaltySlope: number;
13
+ minCancelFactor: number;
14
+ totalVisits30d: number;
15
+ totalBookings30d: number;
16
+ updatedAt: string;
17
+ };
18
+ export declare const getAggregatorStatisticsConstants: ApiMethodDeclaration<ParamsData, ResponseData>;
19
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAggregatorStatisticsConstants = void 0;
4
+ var getAggregatorStatisticsConstants = function () { return ({
5
+ url: '/aggregator-orders/statistics/constants',
6
+ method: 'GET',
7
+ }); };
8
+ exports.getAggregatorStatisticsConstants = getAggregatorStatisticsConstants;
@@ -0,0 +1,14 @@
1
+ import { ApiMethodDeclaration } from '..';
2
+ type ParamsData = {
3
+ adminEmail: string;
4
+ date: string;
5
+ hour?: number;
6
+ };
7
+ type ResponseData = Array<{
8
+ id: number;
9
+ requestTime: Date;
10
+ path: string;
11
+ method: string;
12
+ }>;
13
+ export declare const getAllAdminsActivityRequests: ApiMethodDeclaration<ParamsData, ResponseData>;
14
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllAdminsActivityRequests = void 0;
4
+ var getAllAdminsActivityRequests = function (params) { return ({
5
+ url: "/admins/activity/all/".concat(encodeURIComponent(params.adminEmail), "/date/").concat(params.date, "/requests"),
6
+ method: 'GET',
7
+ params: {
8
+ hour: params.hour,
9
+ },
10
+ }); };
11
+ exports.getAllAdminsActivityRequests = getAllAdminsActivityRequests;
@@ -17,6 +17,10 @@ import { getWorkingHoursByDate } from './get-working-hours-by-date';
17
17
  import { getActivityStats } from './get-activity-stats';
18
18
  import { getAllAdminsActivityStats } from './get-all-admins-activity-stats';
19
19
  import { getAllAdminsActivityByDate } from './get-all-admins-activity-by-date';
20
+ import { getAllAdminsActivityRequests } from './get-all-admins-activity-requests';
21
+ import { getAggregatorStatisticsConstants } from './get-aggregator-statistics-constants';
22
+ import { queryAggregatorQuestroomStatistics } from './query-aggregator-questroom-statistics';
23
+ import { getAggregatorQuestroomDailyStatistics } from './get-aggregator-questroom-daily-statistics';
20
24
  type ApiDeclaration = {
21
25
  removeIssues: typeof removeIssues;
22
26
  findAllIssues: typeof findAllIssues;
@@ -37,6 +41,10 @@ type ApiDeclaration = {
37
41
  getActivityStats: typeof getActivityStats;
38
42
  getAllAdminsActivityStats: typeof getAllAdminsActivityStats;
39
43
  getAllAdminsActivityByDate: typeof getAllAdminsActivityByDate;
44
+ getAllAdminsActivityRequests: typeof getAllAdminsActivityRequests;
45
+ getAggregatorStatisticsConstants: typeof getAggregatorStatisticsConstants;
46
+ queryAggregatorQuestroomStatistics: typeof queryAggregatorQuestroomStatistics;
47
+ getAggregatorQuestroomDailyStatistics: typeof getAggregatorQuestroomDailyStatistics;
40
48
  };
41
49
  export declare const adminsApiDeclaration: ApiDeclaration;
42
50
  export {};
@@ -20,6 +20,10 @@ var get_working_hours_by_date_1 = require("./get-working-hours-by-date");
20
20
  var get_activity_stats_1 = require("./get-activity-stats");
21
21
  var get_all_admins_activity_stats_1 = require("./get-all-admins-activity-stats");
22
22
  var get_all_admins_activity_by_date_1 = require("./get-all-admins-activity-by-date");
23
+ var get_all_admins_activity_requests_1 = require("./get-all-admins-activity-requests");
24
+ var get_aggregator_statistics_constants_1 = require("./get-aggregator-statistics-constants");
25
+ var query_aggregator_questroom_statistics_1 = require("./query-aggregator-questroom-statistics");
26
+ var get_aggregator_questroom_daily_statistics_1 = require("./get-aggregator-questroom-daily-statistics");
23
27
  exports.adminsApiDeclaration = {
24
28
  removeIssues: remove_issue_1.removeIssues,
25
29
  findAllIssues: find_all_issues_1.findAllIssues,
@@ -40,4 +44,8 @@ exports.adminsApiDeclaration = {
40
44
  getActivityStats: get_activity_stats_1.getActivityStats,
41
45
  getAllAdminsActivityStats: get_all_admins_activity_stats_1.getAllAdminsActivityStats,
42
46
  getAllAdminsActivityByDate: get_all_admins_activity_by_date_1.getAllAdminsActivityByDate,
47
+ getAllAdminsActivityRequests: get_all_admins_activity_requests_1.getAllAdminsActivityRequests,
48
+ getAggregatorStatisticsConstants: get_aggregator_statistics_constants_1.getAggregatorStatisticsConstants,
49
+ queryAggregatorQuestroomStatistics: query_aggregator_questroom_statistics_1.queryAggregatorQuestroomStatistics,
50
+ getAggregatorQuestroomDailyStatistics: get_aggregator_questroom_daily_statistics_1.getAggregatorQuestroomDailyStatistics,
43
51
  };
@@ -0,0 +1,22 @@
1
+ import { QueryRO } from '@escapenavigator/types/dist/shared/query.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ type ParamsData = {
4
+ monthStart: string;
5
+ page?: number;
6
+ limit?: number;
7
+ searchText?: string;
8
+ };
9
+ type ResponseData = QueryRO<{
10
+ questroomId: number;
11
+ profileId: number;
12
+ profileTitle: string;
13
+ questroomTitle: string;
14
+ country?: string;
15
+ visits: number;
16
+ bookings: number;
17
+ cancellations: number;
18
+ conversion: number;
19
+ cancellationRate: number;
20
+ }>;
21
+ export declare const queryAggregatorQuestroomStatistics: ApiMethodDeclaration<ParamsData, ResponseData>;
22
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.queryAggregatorQuestroomStatistics = void 0;
4
+ var queryAggregatorQuestroomStatistics = function (params) { return ({
5
+ url: '/aggregator-orders/statistics/questrooms',
6
+ method: 'GET',
7
+ params: params,
8
+ }); };
9
+ exports.queryAggregatorQuestroomStatistics = queryAggregatorQuestroomStatistics;
package/dist/api/index.js CHANGED
@@ -56,6 +56,13 @@ exports.initApi = void 0;
56
56
  /* eslint-disable @typescript-eslint/no-unused-vars */
57
57
  /* eslint-disable @typescript-eslint/no-explicit-any */
58
58
  var axios_1 = __importDefault(require("axios"));
59
+ var getAuthLoginPathBySubdomain = function () {
60
+ var _a;
61
+ var subdomain = (_a = window.location.hostname.split('.')[0]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
62
+ if (subdomain === 'admin')
63
+ return '/auth/admins';
64
+ return '/auth/questrooms';
65
+ };
59
66
  function initApi(apiDeclaration, baseURL) {
60
67
  var _this = this;
61
68
  var api = {};
@@ -64,7 +71,7 @@ function initApi(apiDeclaration, baseURL) {
64
71
  api[key] = function (params) {
65
72
  if (params === void 0) { params = undefined; }
66
73
  return __awaiter(_this, void 0, void 0, function () {
67
- var axiosConfig, result, error_1, e;
74
+ var axiosConfig, result, error_1, e, redirectUrl;
68
75
  var _a;
69
76
  return __generator(this, function (_b) {
70
77
  switch (_b.label) {
@@ -85,7 +92,9 @@ function initApi(apiDeclaration, baseURL) {
85
92
  document.cookie = 'user=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
86
93
  document.cookie = 'token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
87
94
  if (!location.href.includes('auth')) {
88
- location.href = process.env.REACT_APP_AUTH_DOMAIN;
95
+ redirectUrl = encodeURIComponent(window.location.href);
96
+ location.href =
97
+ "".concat(process.env.REACT_APP_AUTH_DOMAIN).concat(getAuthLoginPathBySubdomain(), "?redirect=").concat(redirectUrl);
89
98
  }
90
99
  }
91
100
  throw error_1;
@@ -48,6 +48,7 @@ import { deleteRoom } from './rooms/delete';
48
48
  import { getAllRooms } from './rooms/get-all';
49
49
  import { getRoom } from './rooms/get-one';
50
50
  import { updateRoom } from './rooms/update';
51
+ import { registerQuestroomVisit } from './register-questroom-visit';
51
52
  import { createSmtp } from './smtp/create-smtp';
52
53
  import { getSmtps } from './smtp/get-smtps';
53
54
  import { removeSmtp } from './smtp/remove-smtp';
@@ -81,6 +82,7 @@ type ApiDeclaration = {
81
82
  createRoom: typeof createRoom;
82
83
  getRoom: typeof getRoom;
83
84
  updateRoom: typeof updateRoom;
85
+ registerQuestroomVisit: typeof registerQuestroomVisit;
84
86
  deleteAction: typeof deleteAction;
85
87
  queryCalls: typeof queryCalls;
86
88
  adjustBalance: typeof adjustBalance;
@@ -51,6 +51,7 @@ var delete_1 = require("./rooms/delete");
51
51
  var get_all_1 = require("./rooms/get-all");
52
52
  var get_one_1 = require("./rooms/get-one");
53
53
  var update_2 = require("./rooms/update");
54
+ var register_questroom_visit_1 = require("./register-questroom-visit");
54
55
  var create_smtp_1 = require("./smtp/create-smtp");
55
56
  var get_smtps_1 = require("./smtp/get-smtps");
56
57
  var remove_smtp_1 = require("./smtp/remove-smtp");
@@ -81,6 +82,7 @@ var update_step_1 = require("./update-step");
81
82
  exports.profilesApiDeclaration = {
82
83
  getAllRooms: get_all_1.getAllRooms,
83
84
  deleteRoom: delete_1.deleteRoom,
85
+ registerQuestroomVisit: register_questroom_visit_1.registerQuestroomVisit,
84
86
  updateNotificationChanel: update_1.updateNotificationChanel,
85
87
  getRoom: get_one_1.getRoom,
86
88
  createRoom: create_3.createRoom,
@@ -0,0 +1,8 @@
1
+ import { SuccessRO } from '@escapenavigator/types/dist/shared/success.ro';
2
+ import { ApiMethodDeclaration } from '..';
3
+ type ParamsData = {
4
+ questroomId: number;
5
+ };
6
+ type ResponseData = SuccessRO;
7
+ export declare const registerQuestroomVisit: ApiMethodDeclaration<ParamsData, ResponseData>;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerQuestroomVisit = void 0;
4
+ var registerQuestroomVisit = function (_a) {
5
+ var questroomId = _a.questroomId;
6
+ return ({
7
+ url: "/api/profiles/pro/questrooms/".concat(questroomId, "/visit"),
8
+ method: 'POST',
9
+ });
10
+ };
11
+ exports.registerQuestroomVisit = registerQuestroomVisit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escapenavigator/services",
3
- "version": "1.10.99",
3
+ "version": "1.10.100",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,10 +12,10 @@
12
12
  "scripts": {
13
13
  "build": "rm -rf dist && tsc --project tsconfig.json"
14
14
  },
15
- "gitHead": "6a2ab59e51d49e9db29f25ad30f07252b637dee1",
15
+ "gitHead": "8cf420f7773f7cd3769bca1115256ab253f56cc9",
16
16
  "dependencies": {
17
- "@escapenavigator/types": "^1.10.91",
18
- "@escapenavigator/utils": "^1.10.95",
17
+ "@escapenavigator/types": "^1.10.92",
18
+ "@escapenavigator/utils": "^1.10.96",
19
19
  "axios": "^0.21.4",
20
20
  "class-transformer": "^0.5.1",
21
21
  "class-validator": "^0.13.2",