@fctc/interface-logic 5.0.6 → 5.0.8
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/configs.js +2577 -7
- package/dist/configs.mjs +2545 -3
- package/dist/constants.d.mts +16 -4
- package/dist/constants.d.ts +16 -4
- package/dist/constants.js +355 -65
- package/dist/constants.mjs +318 -1
- package/dist/environment.js +2704 -16
- package/dist/environment.mjs +2670 -4
- package/dist/hooks.d.mts +84 -19
- package/dist/hooks.d.ts +84 -19
- package/dist/hooks.js +10316 -557
- package/dist/hooks.mjs +10136 -6
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +12549 -1179
- package/dist/index.mjs +12214 -8
- package/dist/models.js +143 -7
- package/dist/models.mjs +120 -2
- package/dist/provider.d.mts +13 -2
- package/dist/provider.d.ts +13 -2
- package/dist/provider.js +10866 -37
- package/dist/provider.mjs +10834 -6
- package/dist/services.d.mts +98 -18
- package/dist/services.d.ts +98 -18
- package/dist/services.js +8088 -40
- package/dist/services.mjs +8056 -6
- package/dist/store.js +817 -320
- package/dist/store.mjs +717 -1
- package/dist/types.js +17 -3
- package/dist/types.mjs +0 -1
- package/dist/utils.js +3094 -134
- package/dist/utils.mjs +3030 -2
- package/package.json +92 -93
- package/dist/chunk-2YGHWZ4C.js +0 -116
- package/dist/chunk-3VJCGAPH.js +0 -6321
- package/dist/chunk-4NLKHYBY.js +0 -131
- package/dist/chunk-6LSKTACC.js +0 -687
- package/dist/chunk-B432GFRR.mjs +0 -606
- package/dist/chunk-BPJZ3QRN.mjs +0 -3025
- package/dist/chunk-BZYCE2VA.js +0 -301
- package/dist/chunk-FDVY2DBI.mjs +0 -127
- package/dist/chunk-GGNOJ77I.js +0 -2
- package/dist/chunk-IUYYGSEL.js +0 -321
- package/dist/chunk-JDXUTKMX.js +0 -3065
- package/dist/chunk-JNLBHOL4.mjs +0 -284
- package/dist/chunk-MJEZ4MMQ.mjs +0 -315
- package/dist/chunk-UB3A7GIQ.mjs +0 -6161
- package/dist/chunk-VKS6GVJY.mjs +0 -114
- package/dist/chunk-WAXGOBY2.mjs +0 -1
package/dist/chunk-4NLKHYBY.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
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;
|