complexqa_frontend_core 1.13.9 → 1.14.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "complexqa_frontend_core",
3
- "version": "1.13.9",
3
+ "version": "1.14.2",
4
4
  "description": "core of web ",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,100 @@
1
+ /**
2
+ *
3
+ * @version v.1.0 (01/05/2026)
4
+ */
5
+ import { echo } from "../utils/utils.js";
6
+
7
+ export class BaseException extends Error
8
+ {
9
+
10
+ error_log_vendor;
11
+
12
+ /**
13
+ * Сообщение об ошибке
14
+ * @type {string}
15
+ */
16
+ message = '';
17
+
18
+ /**
19
+ * Нативная ошибка
20
+ * @type {null|Error}
21
+ */
22
+ error = null;
23
+
24
+ constructor(options = {})
25
+ {
26
+ super();
27
+
28
+ if (options.message)
29
+ {
30
+ this.message = options.message;
31
+ }
32
+
33
+ if (options.error instanceof Error)
34
+ {
35
+ this.error = options.error;
36
+ }
37
+
38
+ this.capture_exception();
39
+ }
40
+
41
+
42
+ /**
43
+ *
44
+ * @version v.1.0 (01/05/2026)
45
+ * @returns {string}
46
+ */
47
+ get_message()
48
+ {
49
+ if (this.error instanceof Error)
50
+ {
51
+ return this?.error?.message;
52
+ }
53
+ else
54
+ {
55
+ return this.message;
56
+ }
57
+ }
58
+
59
+
60
+ /**
61
+ *
62
+ * @version v.1.0 (01/05/2026)
63
+ */
64
+ set_context()
65
+ {
66
+ if (this.error_log_vendor)
67
+ {
68
+ this.error_log_vendor.setTag('frontend_host', window.ApiService.frontend_host);
69
+ this.error_log_vendor.setTag('general_domain', window.ApiService.general_domain);
70
+ this.error_log_vendor.setTag('current_user_id', UserService.current_user_id);
71
+ }
72
+ }
73
+
74
+
75
+ /**
76
+ *
77
+ * @version v.1.0 (01/05/2026)
78
+ */
79
+ capture_exception()
80
+ {
81
+ if (this.error_log_vendor)
82
+ {
83
+ echo('start');
84
+ Sentry.captureException(new Error(this.message), scope =>
85
+ {
86
+ scope.clear();
87
+ this.set_context();
88
+
89
+ scope.setTag('frontend_host', window.ApiService.frontend_host);
90
+ scope.setTag('general_domain', window.ApiService.general_domain);
91
+ scope.setTag('current_user_id', UserService.current_user_id);
92
+
93
+ echo('done');
94
+ return scope;
95
+ });
96
+ }
97
+
98
+ }
99
+
100
+ }
@@ -1,15 +1,12 @@
1
- export class ApiException extends Error
1
+ import { BaseException } from './0_BaseException.js';
2
+
3
+ /**
4
+ *
5
+ * @version v.1.0 (01/05/2026)
6
+ */
7
+ export class ApiException extends BaseException
2
8
  {
3
- /**
4
- * Сообщение об ошибке
5
- * @type {string}
6
- */
7
- #message = '';
8
- /**
9
- * Нативная ошибка
10
- * @type {null|Error}
11
- */
12
- #error = null;
9
+
13
10
 
14
11
 
15
12
  api_response = null;
@@ -18,19 +15,13 @@ export class ApiException extends Error
18
15
  api_error = null;
19
16
 
20
17
 
18
+ /**
19
+ *
20
+ * @version v.1.0 (01/05/2026)
21
+ */
21
22
  constructor(options)
22
23
  {
23
- super();
24
-
25
- if (options.message)
26
- {
27
- this.#message = options.message;
28
- }
29
-
30
- if (options.error instanceof Error)
31
- {
32
- this.#error = options.error;
33
- }
24
+ super(options);
34
25
 
35
26
 
36
27
  if (options?.api_response)
@@ -54,16 +45,4 @@ export class ApiException extends Error
54
45
  }
55
46
  }
56
47
 
57
-
58
- get_message()
59
- {
60
- if (this.#error instanceof Error)
61
- {
62
- return this.#error.message;
63
- }
64
- else
65
- {
66
- return this.#message;
67
- }
68
- }
69
48
  }
@@ -0,0 +1,96 @@
1
+ /**
2
+ *
3
+ * @version v.1.0 (01/05/2026)
4
+ */
5
+ export class BaseException extends Error
6
+ {
7
+
8
+ error_log_vendor;
9
+
10
+ /**
11
+ * Сообщение об ошибке
12
+ * @type {string}
13
+ */
14
+ message = '';
15
+
16
+ /**
17
+ * Нативная ошибка
18
+ * @type {null|Error}
19
+ */
20
+ error = null;
21
+
22
+ constructor(options)
23
+ {
24
+ super();
25
+
26
+ if (options.message)
27
+ {
28
+ this.message = options.message;
29
+ }
30
+
31
+ if (options.error instanceof Error)
32
+ {
33
+ this.error = options.error;
34
+ }
35
+
36
+ this.capture_exception();
37
+ }
38
+
39
+
40
+ /**
41
+ *
42
+ * @version v.1.0 (01/05/2026)
43
+ * @returns {string}
44
+ */
45
+ get_message()
46
+ {
47
+ if (this.error instanceof Error)
48
+ {
49
+ return this.error.message;
50
+ }
51
+ else
52
+ {
53
+ return this.message;
54
+ }
55
+ }
56
+
57
+
58
+ /**
59
+ *
60
+ * @version v.1.0 (01/05/2026)
61
+ */
62
+ set_context()
63
+ {
64
+ if (this.error_log_vendor)
65
+ {
66
+ this.error_log_vendor.setTag('frontend_host', window.ApiService.frontend_host);
67
+ this.error_log_vendor.setTag('general_domain', window.ApiService.general_domain);
68
+ this.error_log_vendor.setTag('current_user_id', UserService.current_user_id);
69
+ }
70
+ }
71
+
72
+
73
+ /**
74
+ *
75
+ * @version v.1.0 (01/05/2026)
76
+ */
77
+ capture_exception()
78
+ {
79
+ if (this.error_log_vendor)
80
+ {
81
+ Sentry.captureException(new Error(this.message), scope =>
82
+ {
83
+ scope.clear();
84
+ this.set_context();
85
+
86
+ scope.setTag('frontend_host', window.ApiService.frontend_host);
87
+ scope.setTag('general_domain', window.ApiService.general_domain);
88
+ scope.setTag('current_user_id', UserService.current_user_id);
89
+
90
+ return scope;
91
+ });
92
+ }
93
+
94
+ }
95
+
96
+ }
@@ -0,0 +1,19 @@
1
+ import { BaseException } from './0_BaseException.js';
2
+
3
+ /**
4
+ *
5
+ * @version v.1.0 (01/05/2026)
6
+ */
7
+ export class GeneralException extends BaseException
8
+ {
9
+
10
+ /**
11
+ *
12
+ * @version v.1.0 (01/05/2026)
13
+ * @param options
14
+ */
15
+ constructor(options)
16
+ {
17
+ super(options);
18
+ }
19
+ }
package/publish/index.js CHANGED
@@ -22,6 +22,9 @@ export { typeTeamTotalStatistic } from './types/family_contracts/typeTeamTotalSt
22
22
 
23
23
  export { typeTask } from './types/family_elements/typeTask.js';
24
24
 
25
+ export { DeveloperService } from './services/DeveloperService.js';
26
+
27
+ export { GeneralException } from './exceptions/GeneralException.js';
25
28
 
26
29
  /**
27
30
  *
@@ -0,0 +1,107 @@
1
+ import { abstractService } from "./abstractService.js";
2
+
3
+ /**
4
+ *
5
+ * @version v.1.0 (01/05/2026)
6
+ */
7
+ export class DeveloperService extends abstractService
8
+ {
9
+ static stages = {
10
+ production: {
11
+ cookie: ''
12
+ },
13
+ test_stage: {
14
+ cookie: 'test-stage-frontend.complexqa.com'
15
+ },
16
+ local : {
17
+ cookie: 'frontend.localhost'
18
+ },
19
+ };
20
+
21
+ static current_stage = 'production';
22
+
23
+ /********************************************************************************************/
24
+ /********************************************************************************************/
25
+
26
+ /********************************************************************************************/
27
+
28
+ /**
29
+ *
30
+ *
31
+ * @version v.1.0 (18/11/2024)
32
+ *
33
+ * @param init_options
34
+ * @returns {*}
35
+ */
36
+ constructor(init_options = false)
37
+ {
38
+ super();
39
+ if (this.constructor._instance)
40
+ {
41
+ return this.constructor._instance;
42
+ }
43
+
44
+ this.init_options = init_options;
45
+
46
+ this.constructor._instance = this;
47
+ }
48
+
49
+
50
+ /********************************************************************************************/
51
+ /********************************************************************************************/
52
+
53
+ /********************************************************************************************/
54
+
55
+
56
+ /**
57
+ *
58
+ * @version v.1.0 (01/05/2026)
59
+ * @param {string} stage
60
+ * @returns {boolean}
61
+ */
62
+ static set_stage(stage)
63
+ {
64
+ if (!DeveloperService.stages[ stage ])
65
+ {
66
+ return false;
67
+ }
68
+
69
+ let cookie = DeveloperService.stages[ stage ].cookie;
70
+
71
+ DeveloperService.set_cookie('frontend_host', cookie);
72
+
73
+ window.location.reload()
74
+ }
75
+
76
+
77
+ /**
78
+ *
79
+ * @version v.1.0 (01/05/2026)
80
+ * @param name
81
+ * @param value
82
+ * @param days
83
+ */
84
+ static set_cookie(name, value, days = 60)
85
+ {
86
+ let expires = "";
87
+
88
+ if (days)
89
+ {
90
+ let date = new Date();
91
+ date.setTime(date.getTime() + ( days * 24 * 60 * 60 * 1000 ));
92
+ expires = "; expires=" + date.toUTCString();
93
+ }
94
+
95
+ return document.cookie = name + "=" + ( value || "" ) + expires + "; path=/";
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @version v.1.0 (01/05/2026)
101
+ * @returns {string}
102
+ */
103
+ static get_stage()
104
+ {
105
+ return DeveloperService.current_stage;
106
+ }
107
+ }
@@ -79,6 +79,11 @@ export class UserService extends abstractService
79
79
  static start_page = '/web/en/project/listing';
80
80
 
81
81
 
82
+ /********************************************************************************************/
83
+ /********************************************************************************************/
84
+ /********************************************************************************************/
85
+
86
+
82
87
  /**
83
88
  *
84
89
  *
@@ -100,6 +105,11 @@ export class UserService extends abstractService
100
105
  this.constructor._instance = this;
101
106
  }
102
107
 
108
+ /********************************************************************************************/
109
+ /********************************************************************************************/
110
+ /********************************************************************************************/
111
+
112
+
103
113
  static mock()
104
114
  {
105
115
  MockUserService.mock_attributes.map((row) =>
@@ -8,6 +8,8 @@ import { echo, is_object } from "../../utils/utils";
8
8
  export class typeTeamMember extends familyGeneralElement
9
9
  {
10
10
  team_member_id;
11
+ first_name;
12
+ last_name;
11
13
  team_id;
12
14
  user_id;
13
15
  team_member_status;
@@ -21,6 +23,8 @@ export class typeTeamMember extends familyGeneralElement
21
23
 
22
24
  structure_scheme = {
23
25
  team_member_id : 'integer | require',
26
+ first_name : 'string | optional',
27
+ last_name : 'string | optional',
24
28
  team_id : 'integer | require',
25
29
  user_id : 'integer | require',
26
30
  team_member_status: 'string | enum | require',
@@ -37,6 +41,8 @@ export class typeTeamMember extends familyGeneralElement
37
41
 
38
42
  attribute_name_translate_matrix = {
39
43
  en: {
44
+ first_name : 'First name',
45
+ last_name : 'Last name',
40
46
  team_member_id : 'ID',
41
47
  team_id : 'Team',
42
48
  team_member_status: 'Status',
@@ -45,10 +51,12 @@ export class typeTeamMember extends familyGeneralElement
45
51
  updated_at : 'Updated at',
46
52
  },
47
53
  ru: {
54
+ first_name : 'Имя',
55
+ last_name : 'Фамилия',
48
56
  team_member_id : 'ID',
49
57
  team_id : 'Команда',
50
58
  team_member_status: 'Статус',
51
- member_role : 'Золь',
59
+ member_role : 'Роль',
52
60
  created_at : 'Создано',
53
61
  updated_at : 'Обновлено',
54
62
  },
@@ -57,6 +65,7 @@ export class typeTeamMember extends familyGeneralElement
57
65
 
58
66
  /******************************************************************************************/
59
67
  /******************************************************************************************/
68
+
60
69
  /******************************************************************************************/
61
70
 
62
71