@fctc/interface-logic 5.0.5 → 5.0.6
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/chunk-2YGHWZ4C.js +116 -0
- package/dist/chunk-3VJCGAPH.js +6321 -0
- package/dist/chunk-4NLKHYBY.js +131 -0
- package/dist/chunk-6LSKTACC.js +687 -0
- package/dist/chunk-B432GFRR.mjs +606 -0
- package/dist/chunk-BPJZ3QRN.mjs +3025 -0
- package/dist/chunk-BZYCE2VA.js +301 -0
- package/dist/chunk-FDVY2DBI.mjs +127 -0
- package/dist/chunk-GGNOJ77I.js +2 -0
- package/dist/chunk-IUYYGSEL.js +321 -0
- package/dist/chunk-JDXUTKMX.js +3065 -0
- package/dist/chunk-JNLBHOL4.mjs +284 -0
- package/dist/chunk-MJEZ4MMQ.mjs +315 -0
- package/dist/chunk-UB3A7GIQ.mjs +6161 -0
- package/dist/chunk-VKS6GVJY.mjs +114 -0
- package/dist/chunk-WAXGOBY2.mjs +1 -0
- package/dist/configs.js +7 -2577
- package/dist/configs.mjs +3 -2545
- package/dist/constants.d.mts +2 -10
- package/dist/constants.d.ts +2 -10
- package/dist/constants.js +65 -351
- package/dist/constants.mjs +1 -314
- package/dist/environment.js +16 -2704
- package/dist/environment.mjs +4 -2670
- package/dist/hooks.d.mts +19 -55
- package/dist/hooks.d.ts +19 -55
- package/dist/hooks.js +557 -10131
- package/dist/hooks.mjs +6 -9955
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1179 -12357
- package/dist/index.mjs +8 -12026
- package/dist/models.js +7 -143
- package/dist/models.mjs +2 -120
- package/dist/provider.d.mts +2 -9
- package/dist/provider.d.ts +2 -9
- package/dist/provider.js +37 -10685
- package/dist/provider.mjs +6 -10653
- package/dist/services.d.mts +18 -69
- package/dist/services.d.ts +18 -69
- package/dist/services.js +40 -7939
- package/dist/services.mjs +6 -7907
- package/dist/store.js +320 -817
- package/dist/store.mjs +1 -717
- package/dist/types.js +3 -17
- package/dist/types.mjs +1 -0
- package/dist/utils.js +134 -3094
- package/dist/utils.mjs +2 -3030
- package/package.json +93 -92
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkIUYYGSEL_js = require('./chunk-IUYYGSEL.js');
|
|
4
|
+
var chunkJDXUTKMX_js = require('./chunk-JDXUTKMX.js');
|
|
5
|
+
|
|
6
|
+
// src/environment/EnvStore.ts
|
|
7
|
+
var EventEmitter = class {
|
|
8
|
+
listeners = {};
|
|
9
|
+
on(event, callback) {
|
|
10
|
+
if (!this.listeners[event]) {
|
|
11
|
+
this.listeners[event] = [];
|
|
12
|
+
}
|
|
13
|
+
this.listeners[event].push(callback);
|
|
14
|
+
}
|
|
15
|
+
emit(event, data) {
|
|
16
|
+
if (this.listeners[event]) {
|
|
17
|
+
this.listeners[event].forEach((callback) => callback(data));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var EnvStore = class {
|
|
22
|
+
state;
|
|
23
|
+
emitter;
|
|
24
|
+
localStorageUtil;
|
|
25
|
+
sessionStorageUtil;
|
|
26
|
+
constructor(localStorageUtil = chunkJDXUTKMX_js.localStorageUtils(), sessionStorageUtil = chunkJDXUTKMX_js.sessionStorageUtils) {
|
|
27
|
+
this.state = {
|
|
28
|
+
baseUrl: "",
|
|
29
|
+
requests: null,
|
|
30
|
+
companies: [],
|
|
31
|
+
user: {},
|
|
32
|
+
config: null,
|
|
33
|
+
envFile: null,
|
|
34
|
+
defaultCompany: {
|
|
35
|
+
id: null,
|
|
36
|
+
logo: "",
|
|
37
|
+
secondary_color: "",
|
|
38
|
+
primary_color: ""
|
|
39
|
+
},
|
|
40
|
+
context: {
|
|
41
|
+
uid: null,
|
|
42
|
+
allowed_company_ids: [],
|
|
43
|
+
lang: "vi_VN",
|
|
44
|
+
tz: "Asia/Saigon"
|
|
45
|
+
},
|
|
46
|
+
localStorageUtils: localStorageUtil,
|
|
47
|
+
sessionStorageUtils: sessionStorageUtil
|
|
48
|
+
};
|
|
49
|
+
this.emitter = new EventEmitter();
|
|
50
|
+
this.localStorageUtil = localStorageUtil;
|
|
51
|
+
this.sessionStorageUtil = sessionStorageUtil;
|
|
52
|
+
}
|
|
53
|
+
getEnv() {
|
|
54
|
+
return { ...this.state };
|
|
55
|
+
}
|
|
56
|
+
onUpdate(callback) {
|
|
57
|
+
this.emitter.on("update", callback);
|
|
58
|
+
}
|
|
59
|
+
setupEnv(envConfig) {
|
|
60
|
+
this.state = {
|
|
61
|
+
...this.state,
|
|
62
|
+
...envConfig,
|
|
63
|
+
localStorageUtils: this.localStorageUtil,
|
|
64
|
+
sessionStorageUtils: this.sessionStorageUtil
|
|
65
|
+
};
|
|
66
|
+
this.state.requests = chunkIUYYGSEL_js.axiosClient.init(this.state);
|
|
67
|
+
this.emitter.emit("update", this.getEnv());
|
|
68
|
+
return this.getEnv();
|
|
69
|
+
}
|
|
70
|
+
setUid(uid) {
|
|
71
|
+
this.state = {
|
|
72
|
+
...this.state,
|
|
73
|
+
context: { ...this.state.context, uid }
|
|
74
|
+
};
|
|
75
|
+
this.emitter.emit("update", this.getEnv());
|
|
76
|
+
}
|
|
77
|
+
setLang(lang) {
|
|
78
|
+
this.state = {
|
|
79
|
+
...this.state,
|
|
80
|
+
context: { ...this.state.context, lang }
|
|
81
|
+
};
|
|
82
|
+
this.emitter.emit("update", this.getEnv());
|
|
83
|
+
}
|
|
84
|
+
setAllowCompanies(allowed_company_ids) {
|
|
85
|
+
this.state = {
|
|
86
|
+
...this.state,
|
|
87
|
+
context: { ...this.state.context, allowed_company_ids }
|
|
88
|
+
};
|
|
89
|
+
this.emitter.emit("update", this.getEnv());
|
|
90
|
+
}
|
|
91
|
+
setCompanies(companies) {
|
|
92
|
+
this.state = { ...this.state, companies };
|
|
93
|
+
this.emitter.emit("update", this.getEnv());
|
|
94
|
+
}
|
|
95
|
+
setDefaultCompany(defaultCompany) {
|
|
96
|
+
this.state = { ...this.state, defaultCompany };
|
|
97
|
+
this.emitter.emit("update", this.getEnv());
|
|
98
|
+
}
|
|
99
|
+
setUserInfo(user) {
|
|
100
|
+
this.state = { ...this.state, user };
|
|
101
|
+
this.emitter.emit("update", this.getEnv());
|
|
102
|
+
}
|
|
103
|
+
setConfig(config) {
|
|
104
|
+
this.state = { ...this.state, config };
|
|
105
|
+
this.emitter.emit("update", this.getEnv());
|
|
106
|
+
}
|
|
107
|
+
setEnvFile(envFile) {
|
|
108
|
+
this.state = { ...this.state, envFile };
|
|
109
|
+
this.emitter.emit("update", this.getEnv());
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var env = null;
|
|
113
|
+
function initEnv({
|
|
114
|
+
localStorageUtils: localStorageUtil = chunkJDXUTKMX_js.localStorageUtils(),
|
|
115
|
+
sessionStorageUtils: sessionStorageUtil = chunkJDXUTKMX_js.sessionStorageUtils
|
|
116
|
+
}) {
|
|
117
|
+
if (!env) {
|
|
118
|
+
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|
|
119
|
+
}
|
|
120
|
+
return env;
|
|
121
|
+
}
|
|
122
|
+
function getEnv() {
|
|
123
|
+
if (!env) {
|
|
124
|
+
env = initEnv({});
|
|
125
|
+
}
|
|
126
|
+
return env?.getEnv();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.EnvStore = EnvStore;
|
|
130
|
+
exports.getEnv = getEnv;
|
|
131
|
+
exports.initEnv = initEnv;
|