@fctc/edu-logic-lib 1.0.0 → 1.0.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.
@@ -0,0 +1,61 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/constants/api/key-constant.ts
2
+ var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
3
+ KeyConstants2["PROFILE"] = "userinfo";
4
+ KeyConstants2["CURRENT_COMPANY"] = "current_company";
5
+ KeyConstants2["LIST_COMPANY"] = "list_company";
6
+ KeyConstants2["COMPANY_INFO"] = "company_info";
7
+ KeyConstants2["MENU"] = "menus";
8
+ KeyConstants2["GET_VIEW_BY_ACTION"] = "get_view_by_action";
9
+ KeyConstants2["ACTION_DETAIL"] = "action_detail";
10
+ KeyConstants2["GET_DATA_SELECTION"] = "get_data_select";
11
+ KeyConstants2["WEB_SAVE"] = "web_save";
12
+ KeyConstants2["WEB_READ"] = "web_read";
13
+ KeyConstants2["GET_PROVIDER"] = "get_provider";
14
+ return KeyConstants2;
15
+ })(KeyConstants || {});
16
+
17
+ // src/constants/api/method-constant.ts
18
+ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
19
+ MethodConstants2["WEB_SEARCH_READ"] = "web_search_read";
20
+ MethodConstants2["WEB_READ_GROUP"] = "web_read_group";
21
+ MethodConstants2["WEB_READ"] = "web_read";
22
+ MethodConstants2["WEB_SAVE"] = "web_save";
23
+ MethodConstants2["UNLINK"] = "unlink";
24
+ MethodConstants2["ONCHANGE"] = "onchange";
25
+ MethodConstants2["GET_ONCHANGE_FIELDS"] = "get_fields_onchange";
26
+ MethodConstants2["GET_FIELD_VIEW"] = "get_fields_view_v2";
27
+ return MethodConstants2;
28
+ })(MethodConstants || {});
29
+
30
+ // src/constants/api/uri-constant.ts
31
+ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
32
+ UriConstants2["AUTH_TOKEN_PATH"] = "/authentication/oauth2/token";
33
+ UriConstants2["GENTOKEN_SOCIAL"] = "/token/generate";
34
+ UriConstants2["CALL_PATH"] = "/call";
35
+ UriConstants2["COMPANY_PATH"] = "/company";
36
+ UriConstants2["PROFILE_PATH"] = "/userinfo";
37
+ UriConstants2["RESET_PASSWORD_PATH"] = "/reset_password";
38
+ UriConstants2["CHANGE_PASSWORD_PATH"] = "/change_password";
39
+ UriConstants2["UPDATE_PASSWORD_PATH"] = "/change_password_parent";
40
+ UriConstants2["LOAD_ACTION"] = `/load_action`;
41
+ UriConstants2["REPORT_PATH"] = `/report`;
42
+ UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
43
+ UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
44
+ UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
45
+ UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
46
+ UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
47
+ UriConstants2["DELETE_MESSAGE"] = `/chatter/message/update_content`;
48
+ UriConstants2["IMAGE_PATH"] = `/web/image`;
49
+ UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
50
+ UriConstants2["TOKEN"] = `/check_token`;
51
+ UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
52
+ UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
53
+ UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
54
+ return UriConstants2;
55
+ })(UriConstants || {});
56
+
57
+
58
+
59
+
60
+
61
+ exports.KeyConstants = KeyConstants; exports.MethodConstants = MethodConstants; exports.UriConstants = UriConstants;
@@ -0,0 +1,102 @@
1
+ import {
2
+ axiosClient
3
+ } from "./chunk-6QXB3XX7.mjs";
4
+ import {
5
+ envStore,
6
+ setAllowCompanies,
7
+ setCompanies,
8
+ setDefaultCompany,
9
+ setEnv,
10
+ setLang,
11
+ setUid,
12
+ setUser
13
+ } from "./chunk-QLUONJPQ.mjs";
14
+
15
+ // src/environment/EnvStore.ts
16
+ var EnvStore = class {
17
+ envStore;
18
+ baseUrl;
19
+ requests;
20
+ context;
21
+ defaultCompany;
22
+ config;
23
+ companies;
24
+ user;
25
+ db;
26
+ localStorageUtils;
27
+ sessionStorageUtils;
28
+ constructor(envStore2, localStorageUtils, sessionStorageUtils) {
29
+ this.envStore = envStore2;
30
+ this.localStorageUtils = localStorageUtils;
31
+ this.sessionStorageUtils = sessionStorageUtils;
32
+ this.setup();
33
+ }
34
+ setup() {
35
+ const env2 = this.envStore.getState().env;
36
+ this.baseUrl = env2?.baseUrl;
37
+ this.requests = env2?.requests;
38
+ this.context = env2?.context;
39
+ this.defaultCompany = env2?.defaultCompany;
40
+ this.config = env2?.config;
41
+ this.companies = env2?.companies || [];
42
+ this.user = env2?.user;
43
+ this.db = env2?.db;
44
+ }
45
+ setupEnv(envConfig) {
46
+ const dispatch = this.envStore.dispatch;
47
+ const env2 = {
48
+ ...envConfig,
49
+ localStorageUtils: this.localStorageUtils,
50
+ sessionStorageUtils: this.sessionStorageUtils
51
+ };
52
+ const requests = axiosClient.init(env2);
53
+ dispatch(setEnv({ ...env2, requests }));
54
+ this.setup();
55
+ }
56
+ setUid(uid) {
57
+ const dispatch = this.envStore.dispatch;
58
+ dispatch(setUid(uid));
59
+ this.setup();
60
+ }
61
+ setLang(lang) {
62
+ const dispatch = this.envStore.dispatch;
63
+ dispatch(setLang(lang));
64
+ this.setup();
65
+ }
66
+ setAllowCompanies(allowCompanies) {
67
+ const dispatch = this.envStore.dispatch;
68
+ dispatch(setAllowCompanies(allowCompanies));
69
+ this.setup();
70
+ }
71
+ setCompanies(companies) {
72
+ const dispatch = this.envStore.dispatch;
73
+ dispatch(setCompanies(companies));
74
+ this.setup();
75
+ }
76
+ setDefaultCompany(company) {
77
+ const dispatch = this.envStore.dispatch;
78
+ dispatch(setDefaultCompany(company));
79
+ this.setup();
80
+ }
81
+ setUserInfo(userInfo) {
82
+ const dispatch = this.envStore.dispatch;
83
+ dispatch(setUser(userInfo));
84
+ this.setup();
85
+ }
86
+ };
87
+ var env = null;
88
+ function initEnv({}) {
89
+ env = new EnvStore(envStore);
90
+ return env;
91
+ }
92
+ function getEnv() {
93
+ if (!env) env = new EnvStore(envStore);
94
+ return env;
95
+ }
96
+
97
+ export {
98
+ EnvStore,
99
+ env,
100
+ initEnv,
101
+ getEnv
102
+ };
@@ -0,0 +1,61 @@
1
+ // src/constants/api/key-constant.ts
2
+ var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
3
+ KeyConstants2["PROFILE"] = "userinfo";
4
+ KeyConstants2["CURRENT_COMPANY"] = "current_company";
5
+ KeyConstants2["LIST_COMPANY"] = "list_company";
6
+ KeyConstants2["COMPANY_INFO"] = "company_info";
7
+ KeyConstants2["MENU"] = "menus";
8
+ KeyConstants2["GET_VIEW_BY_ACTION"] = "get_view_by_action";
9
+ KeyConstants2["ACTION_DETAIL"] = "action_detail";
10
+ KeyConstants2["GET_DATA_SELECTION"] = "get_data_select";
11
+ KeyConstants2["WEB_SAVE"] = "web_save";
12
+ KeyConstants2["WEB_READ"] = "web_read";
13
+ KeyConstants2["GET_PROVIDER"] = "get_provider";
14
+ return KeyConstants2;
15
+ })(KeyConstants || {});
16
+
17
+ // src/constants/api/method-constant.ts
18
+ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
19
+ MethodConstants2["WEB_SEARCH_READ"] = "web_search_read";
20
+ MethodConstants2["WEB_READ_GROUP"] = "web_read_group";
21
+ MethodConstants2["WEB_READ"] = "web_read";
22
+ MethodConstants2["WEB_SAVE"] = "web_save";
23
+ MethodConstants2["UNLINK"] = "unlink";
24
+ MethodConstants2["ONCHANGE"] = "onchange";
25
+ MethodConstants2["GET_ONCHANGE_FIELDS"] = "get_fields_onchange";
26
+ MethodConstants2["GET_FIELD_VIEW"] = "get_fields_view_v2";
27
+ return MethodConstants2;
28
+ })(MethodConstants || {});
29
+
30
+ // src/constants/api/uri-constant.ts
31
+ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
32
+ UriConstants2["AUTH_TOKEN_PATH"] = "/authentication/oauth2/token";
33
+ UriConstants2["GENTOKEN_SOCIAL"] = "/token/generate";
34
+ UriConstants2["CALL_PATH"] = "/call";
35
+ UriConstants2["COMPANY_PATH"] = "/company";
36
+ UriConstants2["PROFILE_PATH"] = "/userinfo";
37
+ UriConstants2["RESET_PASSWORD_PATH"] = "/reset_password";
38
+ UriConstants2["CHANGE_PASSWORD_PATH"] = "/change_password";
39
+ UriConstants2["UPDATE_PASSWORD_PATH"] = "/change_password_parent";
40
+ UriConstants2["LOAD_ACTION"] = `/load_action`;
41
+ UriConstants2["REPORT_PATH"] = `/report`;
42
+ UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
43
+ UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
44
+ UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
45
+ UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
46
+ UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
47
+ UriConstants2["DELETE_MESSAGE"] = `/chatter/message/update_content`;
48
+ UriConstants2["IMAGE_PATH"] = `/web/image`;
49
+ UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
50
+ UriConstants2["TOKEN"] = `/check_token`;
51
+ UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
52
+ UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
53
+ UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
54
+ return UriConstants2;
55
+ })(UriConstants || {});
56
+
57
+ export {
58
+ KeyConstants,
59
+ MethodConstants,
60
+ UriConstants
61
+ };