@fctc/interface-logic 5.2.3 → 5.2.5
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-Q5YXX4OR.js → chunk-CCTDGAMA.js} +11 -11
- package/dist/{chunk-WBGK2SHU.js → chunk-COC7NGXP.js} +1 -0
- package/dist/{chunk-6ARYI77N.mjs → chunk-F2VAAEVB.mjs} +2 -2
- package/dist/{chunk-ROATD4ZZ.mjs → chunk-F4RE57FT.mjs} +171 -277
- package/dist/{chunk-C5QQGBN4.js → chunk-FWBYTZIV.js} +6 -6
- package/dist/{chunk-BPJZ3QRN.mjs → chunk-HQVNK2EW.mjs} +107 -771
- package/dist/{chunk-VBYRP2P7.mjs → chunk-Q3Y6RCJ4.mjs} +1 -0
- package/dist/{chunk-JV7VWG5W.js → chunk-U2COUTK5.js} +187 -297
- package/dist/{chunk-JDXUTKMX.js → chunk-U4Q3MW45.js} +113 -800
- package/dist/{chunk-QOXPJWSN.mjs → chunk-VBVNP77T.mjs} +1 -1
- package/dist/{chunk-RPWKWEMA.js → chunk-WTPKTZQC.js} +2 -2
- package/dist/{chunk-ACSPOGTI.mjs → chunk-ZDXEWQQD.mjs} +5 -5
- package/dist/configs.js +3 -4
- package/dist/configs.mjs +2 -3
- package/dist/constants.d.mts +2 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +17 -17
- package/dist/constants.mjs +1 -1
- package/dist/environment.d.mts +1 -1
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +6 -7
- package/dist/environment.mjs +3 -4
- package/dist/hooks.d.mts +7 -21
- package/dist/hooks.d.ts +7 -21
- package/dist/hooks.js +160 -173
- package/dist/hooks.mjs +5 -6
- package/dist/index.d.mts +4 -10
- package/dist/index.d.ts +4 -10
- package/dist/index.js +227 -632
- package/dist/index.mjs +6 -7
- package/dist/{local-storage-BPvoMGYJ.d.mts → local-storage-AbiOQTLK.d.mts} +1 -1
- package/dist/{local-storage-BPvoMGYJ.d.ts → local-storage-AbiOQTLK.d.ts} +1 -1
- package/dist/models.js +3 -3
- package/dist/models.mjs +2 -2
- package/dist/provider.d.mts +4 -11
- package/dist/provider.d.ts +4 -11
- package/dist/provider.js +14 -19
- package/dist/provider.mjs +5 -6
- package/dist/services.d.mts +6 -9
- package/dist/services.d.ts +6 -9
- package/dist/services.js +16 -17
- package/dist/services.mjs +5 -6
- package/dist/utils.d.mts +33 -61
- package/dist/utils.d.ts +33 -61
- package/dist/utils.js +26 -95
- package/dist/utils.mjs +1 -2
- package/package.json +15 -29
- package/dist/chunk-6LSKTACC.js +0 -687
- package/dist/chunk-B432GFRR.mjs +0 -606
- package/dist/store.d.mts +0 -382
- package/dist/store.d.ts +0 -382
- package/dist/store.js +0 -326
- package/dist/store.mjs +0 -1
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var chunkWBGK2SHU_js = require('./chunk-WBGK2SHU.js');
|
|
3
|
+
var chunkCCTDGAMA_js = require('./chunk-CCTDGAMA.js');
|
|
4
|
+
var chunkU4Q3MW45_js = require('./chunk-U4Q3MW45.js');
|
|
5
|
+
var chunkWTPKTZQC_js = require('./chunk-WTPKTZQC.js');
|
|
6
|
+
var chunkCOC7NGXP_js = require('./chunk-COC7NGXP.js');
|
|
8
7
|
var react = require('react');
|
|
9
8
|
var reactQuery = require('@tanstack/react-query');
|
|
10
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
-
var reactRedux = require('react-redux');
|
|
12
10
|
var supabaseJs = require('@supabase/supabase-js');
|
|
13
11
|
|
|
14
12
|
var ReactQueryProvider = ({ children }) => {
|
|
@@ -26,12 +24,134 @@ var ReactQueryProvider = ({ children }) => {
|
|
|
26
24
|
);
|
|
27
25
|
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
|
|
28
26
|
};
|
|
29
|
-
var ReduxProvider = ({ children }) => {
|
|
30
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store: chunk6LSKTACC_js.envStore, children });
|
|
31
|
-
};
|
|
32
27
|
var MainProvider = ({ children }) => {
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ReactQueryProvider, { children });
|
|
34
29
|
};
|
|
30
|
+
var initialEnvState = {
|
|
31
|
+
env: null,
|
|
32
|
+
baseUrl: "",
|
|
33
|
+
requests: null,
|
|
34
|
+
companies: [],
|
|
35
|
+
user: {},
|
|
36
|
+
config: null,
|
|
37
|
+
envFile: null,
|
|
38
|
+
defaultCompany: {
|
|
39
|
+
id: null,
|
|
40
|
+
logo: "",
|
|
41
|
+
secondary_color: "",
|
|
42
|
+
primary_color: "",
|
|
43
|
+
secondary_logo: ""
|
|
44
|
+
},
|
|
45
|
+
context: {
|
|
46
|
+
uid: null,
|
|
47
|
+
lang: "vi_VN",
|
|
48
|
+
tz: "Asia/Saigon"
|
|
49
|
+
},
|
|
50
|
+
excludeLanguages: [],
|
|
51
|
+
isSupaMode: false
|
|
52
|
+
};
|
|
53
|
+
var EnvContext = react.createContext(null);
|
|
54
|
+
function EnvProvider({
|
|
55
|
+
children,
|
|
56
|
+
localStorageUtils: localStorageUtil = chunkU4Q3MW45_js.localStorageUtils(),
|
|
57
|
+
sessionStorageUtils: sessionStorageUtil = chunkU4Q3MW45_js.sessionStorageUtils
|
|
58
|
+
}) {
|
|
59
|
+
const [env, setEnvState] = react.useState({
|
|
60
|
+
...initialEnvState,
|
|
61
|
+
localStorageUtils: localStorageUtil,
|
|
62
|
+
sessionStorageUtils: sessionStorageUtil
|
|
63
|
+
});
|
|
64
|
+
const setupEnv = react.useCallback(
|
|
65
|
+
(envConfig) => {
|
|
66
|
+
const updatedEnv = {
|
|
67
|
+
...env,
|
|
68
|
+
...envConfig,
|
|
69
|
+
localStorageUtils: localStorageUtil,
|
|
70
|
+
sessionStorageUtils: sessionStorageUtil
|
|
71
|
+
};
|
|
72
|
+
const requests = chunkCCTDGAMA_js.axiosClient.init(updatedEnv);
|
|
73
|
+
setEnvState({ ...updatedEnv, requests });
|
|
74
|
+
return updatedEnv;
|
|
75
|
+
},
|
|
76
|
+
[env, localStorageUtil, sessionStorageUtil]
|
|
77
|
+
);
|
|
78
|
+
const setUid = react.useCallback((uid) => {
|
|
79
|
+
setEnvState((prev) => ({
|
|
80
|
+
...prev,
|
|
81
|
+
context: { ...prev.context, uid }
|
|
82
|
+
}));
|
|
83
|
+
}, []);
|
|
84
|
+
const setLang = react.useCallback((lang) => {
|
|
85
|
+
setEnvState((prev) => ({
|
|
86
|
+
...prev,
|
|
87
|
+
context: { ...prev.context, lang }
|
|
88
|
+
}));
|
|
89
|
+
}, []);
|
|
90
|
+
const setAllowCompanies = react.useCallback((allowed_company_ids) => {
|
|
91
|
+
setEnvState((prev) => ({
|
|
92
|
+
...prev,
|
|
93
|
+
context: { ...prev.context, allowed_company_ids }
|
|
94
|
+
}));
|
|
95
|
+
}, []);
|
|
96
|
+
const setCompanies = react.useCallback((companies) => {
|
|
97
|
+
setEnvState((prev) => ({
|
|
98
|
+
...prev,
|
|
99
|
+
companies
|
|
100
|
+
}));
|
|
101
|
+
}, []);
|
|
102
|
+
const setDefaultCompany = react.useCallback(
|
|
103
|
+
(defaultCompany) => {
|
|
104
|
+
setEnvState((prev) => ({
|
|
105
|
+
...prev,
|
|
106
|
+
defaultCompany
|
|
107
|
+
}));
|
|
108
|
+
},
|
|
109
|
+
[]
|
|
110
|
+
);
|
|
111
|
+
const setUserInfo = react.useCallback((user) => {
|
|
112
|
+
setEnvState((prev) => ({
|
|
113
|
+
...prev,
|
|
114
|
+
user
|
|
115
|
+
}));
|
|
116
|
+
}, []);
|
|
117
|
+
const setConfig = react.useCallback((config) => {
|
|
118
|
+
setEnvState((prev) => ({
|
|
119
|
+
...prev,
|
|
120
|
+
config
|
|
121
|
+
}));
|
|
122
|
+
}, []);
|
|
123
|
+
const setEnvFile = react.useCallback((envFile) => {
|
|
124
|
+
setEnvState((prev) => ({
|
|
125
|
+
...prev,
|
|
126
|
+
envFile
|
|
127
|
+
}));
|
|
128
|
+
}, []);
|
|
129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
EnvContext.Provider,
|
|
131
|
+
{
|
|
132
|
+
value: {
|
|
133
|
+
env,
|
|
134
|
+
setupEnv,
|
|
135
|
+
setUid,
|
|
136
|
+
setLang,
|
|
137
|
+
setAllowCompanies,
|
|
138
|
+
setCompanies,
|
|
139
|
+
setDefaultCompany,
|
|
140
|
+
setUserInfo,
|
|
141
|
+
setConfig,
|
|
142
|
+
setEnvFile
|
|
143
|
+
},
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function useEnv() {
|
|
149
|
+
const context = react.useContext(EnvContext);
|
|
150
|
+
if (!context) {
|
|
151
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
152
|
+
}
|
|
153
|
+
return context;
|
|
154
|
+
}
|
|
35
155
|
function useActionService() {
|
|
36
156
|
const { env } = useEnv();
|
|
37
157
|
const loadAction = react.useCallback(
|
|
@@ -46,7 +166,7 @@ function useActionService() {
|
|
|
46
166
|
action_id: idAction,
|
|
47
167
|
with_context: { ...context }
|
|
48
168
|
};
|
|
49
|
-
const url = searchParams ? `${"/load_action" /* LOAD_ACTION */}?${
|
|
169
|
+
const url = searchParams ? `${"/load_action" /* LOAD_ACTION */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/load_action" /* LOAD_ACTION */;
|
|
50
170
|
return env.requests.post(
|
|
51
171
|
url,
|
|
52
172
|
jsonData,
|
|
@@ -171,7 +291,7 @@ function useActionService() {
|
|
|
171
291
|
file_response: true,
|
|
172
292
|
db
|
|
173
293
|
};
|
|
174
|
-
const queryString =
|
|
294
|
+
const queryString = chunkU4Q3MW45_js.toQueryString(jsonData);
|
|
175
295
|
const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
|
|
176
296
|
return env.requests.get(urlWithParams, {
|
|
177
297
|
headers: { "Content-Type": "application/json" },
|
|
@@ -192,7 +312,7 @@ function useActionService() {
|
|
|
192
312
|
action_id: idAction,
|
|
193
313
|
with_context: { ...context }
|
|
194
314
|
};
|
|
195
|
-
const url = searchParams ? `${"/run_action" /* RUN_ACTION_PATH */}?${
|
|
315
|
+
const url = searchParams ? `${"/run_action" /* RUN_ACTION_PATH */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/run_action" /* RUN_ACTION_PATH */;
|
|
196
316
|
return env.requests.post(
|
|
197
317
|
url,
|
|
198
318
|
jsonData,
|
|
@@ -239,20 +359,6 @@ function useActionService() {
|
|
|
239
359
|
}
|
|
240
360
|
});
|
|
241
361
|
}, [env]);
|
|
242
|
-
const actionOpenHome = react.useCallback(
|
|
243
|
-
async ({ model, method }) => {
|
|
244
|
-
const jsonData = {
|
|
245
|
-
model,
|
|
246
|
-
method
|
|
247
|
-
};
|
|
248
|
-
return await env.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
249
|
-
headers: {
|
|
250
|
-
"Content-Type": "application/json"
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
},
|
|
254
|
-
[env]
|
|
255
|
-
);
|
|
256
362
|
return {
|
|
257
363
|
loadAction,
|
|
258
364
|
callButton,
|
|
@@ -262,8 +368,7 @@ function useActionService() {
|
|
|
262
368
|
print,
|
|
263
369
|
runAction,
|
|
264
370
|
generateSerialNumber,
|
|
265
|
-
actionServerHome
|
|
266
|
-
actionOpenHome
|
|
371
|
+
actionServerHome
|
|
267
372
|
};
|
|
268
373
|
}
|
|
269
374
|
var SupabaseContext = react.createContext(null);
|
|
@@ -319,9 +424,7 @@ function useAuthService() {
|
|
|
319
424
|
encodedData,
|
|
320
425
|
{
|
|
321
426
|
headers: {
|
|
322
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
323
|
-
service: "emenu",
|
|
324
|
-
"x-node": "2032919254WSCunipay_89234578"
|
|
427
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
325
428
|
}
|
|
326
429
|
},
|
|
327
430
|
body.service
|
|
@@ -1260,7 +1363,7 @@ function useModelService() {
|
|
|
1260
1363
|
...jsonReadGroup
|
|
1261
1364
|
}
|
|
1262
1365
|
};
|
|
1263
|
-
const url = searchParams ? `${"/call" /* CALL_PATH */}?${
|
|
1366
|
+
const url = searchParams ? `${"/call" /* CALL_PATH */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
|
|
1264
1367
|
return env.requests.post(
|
|
1265
1368
|
url,
|
|
1266
1369
|
jsonData,
|
|
@@ -1617,7 +1720,7 @@ function useUserService() {
|
|
|
1617
1720
|
values
|
|
1618
1721
|
};
|
|
1619
1722
|
return env?.requests.post(
|
|
1620
|
-
|
|
1723
|
+
chunkCOC7NGXP_js.UriConstants?.CREATE_UPDATE_PATH,
|
|
1621
1724
|
jsonData,
|
|
1622
1725
|
{
|
|
1623
1726
|
headers: {
|
|
@@ -1662,7 +1765,7 @@ function useViewService() {
|
|
|
1662
1765
|
},
|
|
1663
1766
|
with_context: context
|
|
1664
1767
|
};
|
|
1665
|
-
const url = searchParams ? `${"/call" /* CALL_PATH */}?${
|
|
1768
|
+
const url = searchParams ? `${"/call" /* CALL_PATH */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
|
|
1666
1769
|
return env?.requests?.post(
|
|
1667
1770
|
url,
|
|
1668
1771
|
jsonDataView,
|
|
@@ -1700,8 +1803,6 @@ function useViewService() {
|
|
|
1700
1803
|
jsonData,
|
|
1701
1804
|
{
|
|
1702
1805
|
headers: {
|
|
1703
|
-
service: "emenu",
|
|
1704
|
-
"x-node": "2032919254WSCunipay_89234578",
|
|
1705
1806
|
"Content-Type": "application/json"
|
|
1706
1807
|
}
|
|
1707
1808
|
},
|
|
@@ -2155,36 +2256,6 @@ function useViewService() {
|
|
|
2155
2256
|
},
|
|
2156
2257
|
[env]
|
|
2157
2258
|
);
|
|
2158
|
-
const getPoints = react.useCallback(
|
|
2159
|
-
async (path) => {
|
|
2160
|
-
return env?.requests?.get(path, {
|
|
2161
|
-
headers: {
|
|
2162
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
2163
|
-
"x-node": "2032919254WSCunipay_89234578",
|
|
2164
|
-
service: "emenu"
|
|
2165
|
-
}
|
|
2166
|
-
});
|
|
2167
|
-
},
|
|
2168
|
-
[env]
|
|
2169
|
-
);
|
|
2170
|
-
const getOrders = react.useCallback(
|
|
2171
|
-
async ({ kwargs, withContext }) => {
|
|
2172
|
-
const body = {
|
|
2173
|
-
model: "pos.order",
|
|
2174
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
2175
|
-
kwargs,
|
|
2176
|
-
with_context: withContext
|
|
2177
|
-
};
|
|
2178
|
-
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
2179
|
-
headers: {
|
|
2180
|
-
"Content-Type": "application/json",
|
|
2181
|
-
service: "emenu",
|
|
2182
|
-
"x-node": "2032919254WSCunipay_89234578"
|
|
2183
|
-
}
|
|
2184
|
-
});
|
|
2185
|
-
},
|
|
2186
|
-
[env]
|
|
2187
|
-
);
|
|
2188
2259
|
return {
|
|
2189
2260
|
getView,
|
|
2190
2261
|
getMenu,
|
|
@@ -2205,9 +2276,7 @@ function useViewService() {
|
|
|
2205
2276
|
getCountry,
|
|
2206
2277
|
getCity,
|
|
2207
2278
|
getWard,
|
|
2208
|
-
getPartnerTitle
|
|
2209
|
-
getPoints,
|
|
2210
|
-
getOrders
|
|
2279
|
+
getPartnerTitle
|
|
2211
2280
|
};
|
|
2212
2281
|
}
|
|
2213
2282
|
function useDashboardService() {
|
|
@@ -2658,7 +2727,7 @@ var getListService = (env) => {
|
|
|
2658
2727
|
const jsonData = {
|
|
2659
2728
|
model,
|
|
2660
2729
|
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
2661
|
-
kwargs:
|
|
2730
|
+
kwargs: chunkU4Q3MW45_js.cleanObject({
|
|
2662
2731
|
domain,
|
|
2663
2732
|
offset,
|
|
2664
2733
|
limit,
|
|
@@ -2860,7 +2929,7 @@ var getProductImageService = (env) => {
|
|
|
2860
2929
|
offset,
|
|
2861
2930
|
domain
|
|
2862
2931
|
};
|
|
2863
|
-
const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${
|
|
2932
|
+
const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/search_read" /* SEARCH_READ */;
|
|
2864
2933
|
return env?.requests.post(
|
|
2865
2934
|
url,
|
|
2866
2935
|
jsonData,
|
|
@@ -3010,7 +3079,7 @@ var loadDataPosSessionService = (env) => {
|
|
|
3010
3079
|
models_to_load: modelsToLoad
|
|
3011
3080
|
}
|
|
3012
3081
|
};
|
|
3013
|
-
const url = searchParams ? `${"/call" /* CALL_PATH */}?${
|
|
3082
|
+
const url = searchParams ? `${"/call" /* CALL_PATH */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
|
|
3014
3083
|
return env?.requests.post(
|
|
3015
3084
|
url,
|
|
3016
3085
|
jsonData,
|
|
@@ -3028,10 +3097,10 @@ var loadDataPosSessionService = (env) => {
|
|
|
3028
3097
|
const loadDataPosSessionSupabase = react.useCallback(async () => {
|
|
3029
3098
|
if (!supabase) return {};
|
|
3030
3099
|
try {
|
|
3031
|
-
const allModels = Object.values(
|
|
3100
|
+
const allModels = Object.values(chunkCOC7NGXP_js.LoadDataModel);
|
|
3032
3101
|
const results = await Promise.all(
|
|
3033
3102
|
allModels.map(async (modelName) => {
|
|
3034
|
-
const tableName =
|
|
3103
|
+
const tableName = chunkCOC7NGXP_js.MODEL_TO_TABLE[modelName];
|
|
3035
3104
|
if (!tableName) return createModelResult(modelName);
|
|
3036
3105
|
const { data, error } = await supabase.from(tableName).select("*");
|
|
3037
3106
|
if (error) {
|
|
@@ -3576,6 +3645,30 @@ var syncFromUiService = (env) => {
|
|
|
3576
3645
|
syncFromUi
|
|
3577
3646
|
};
|
|
3578
3647
|
};
|
|
3648
|
+
var getCustomerLoyaltyPointService = (env) => {
|
|
3649
|
+
const getCustomerLoyaltyPoint = react.useCallback(
|
|
3650
|
+
async ({
|
|
3651
|
+
xNode,
|
|
3652
|
+
service,
|
|
3653
|
+
partnerId
|
|
3654
|
+
}) => {
|
|
3655
|
+
return env?.requests.get(
|
|
3656
|
+
`${"/loyalty/point" /* LOYALTY_POINT */}/${partnerId}`,
|
|
3657
|
+
{
|
|
3658
|
+
headers: {
|
|
3659
|
+
"Content-Type": "application/json",
|
|
3660
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
3661
|
+
}
|
|
3662
|
+
},
|
|
3663
|
+
service
|
|
3664
|
+
);
|
|
3665
|
+
},
|
|
3666
|
+
[env]
|
|
3667
|
+
);
|
|
3668
|
+
return {
|
|
3669
|
+
getCustomerLoyaltyPoint
|
|
3670
|
+
};
|
|
3671
|
+
};
|
|
3579
3672
|
var addFloorSupabaseService = () => {
|
|
3580
3673
|
const supabase = useSupabaseOptional();
|
|
3581
3674
|
const addFloorSupabase = react.useCallback(
|
|
@@ -3886,7 +3979,7 @@ var updateOrderSupabaseService = () => {
|
|
|
3886
3979
|
return [];
|
|
3887
3980
|
}
|
|
3888
3981
|
const { order_id, ...rest } = values;
|
|
3889
|
-
const updateData =
|
|
3982
|
+
const updateData = chunkU4Q3MW45_js.cleanObject({
|
|
3890
3983
|
...rest,
|
|
3891
3984
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3892
3985
|
});
|
|
@@ -3999,7 +4092,7 @@ var addProductSupabaseService = () => {
|
|
|
3999
4092
|
console.error("Supabase client not initialized");
|
|
4000
4093
|
return null;
|
|
4001
4094
|
}
|
|
4002
|
-
const insertData =
|
|
4095
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4003
4096
|
name: values.name,
|
|
4004
4097
|
product_tmpl_id: values.product_tmpl_id,
|
|
4005
4098
|
product_template_variant_value_ids: values.product_template_variant_value_ids ?? [],
|
|
@@ -4042,7 +4135,7 @@ var addPaymentMethodSupabaseService = () => {
|
|
|
4042
4135
|
return null;
|
|
4043
4136
|
}
|
|
4044
4137
|
const { name, ...rest } = values;
|
|
4045
|
-
const insertData =
|
|
4138
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4046
4139
|
name,
|
|
4047
4140
|
...rest
|
|
4048
4141
|
});
|
|
@@ -4143,7 +4236,7 @@ var createCustomerSupabaseService = () => {
|
|
|
4143
4236
|
return null;
|
|
4144
4237
|
}
|
|
4145
4238
|
try {
|
|
4146
|
-
const insertData =
|
|
4239
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4147
4240
|
name: values.name,
|
|
4148
4241
|
phone: values.phone,
|
|
4149
4242
|
email: values.email,
|
|
@@ -4182,7 +4275,7 @@ var updateCustomerSupabaseService = () => {
|
|
|
4182
4275
|
}
|
|
4183
4276
|
try {
|
|
4184
4277
|
const { customer_id, ...rest } = values;
|
|
4185
|
-
const updateData =
|
|
4278
|
+
const updateData = chunkU4Q3MW45_js.cleanObject({
|
|
4186
4279
|
...rest,
|
|
4187
4280
|
write_date: (/* @__PURE__ */ new Date()).toISOString()
|
|
4188
4281
|
});
|
|
@@ -4459,7 +4552,7 @@ var updateProductSupabaseService = () => {
|
|
|
4459
4552
|
}
|
|
4460
4553
|
try {
|
|
4461
4554
|
const { product_id, ...rest } = values;
|
|
4462
|
-
const updateData =
|
|
4555
|
+
const updateData = chunkU4Q3MW45_js.cleanObject(rest);
|
|
4463
4556
|
const { data, error } = await supabase.from("products" /* PRODUCTS */).update(updateData).eq("id", product_id).select("id").single();
|
|
4464
4557
|
if (error) {
|
|
4465
4558
|
console.error("Error updating product:", error);
|
|
@@ -4567,6 +4660,7 @@ var serviceFactories = [
|
|
|
4567
4660
|
applyVoucherService,
|
|
4568
4661
|
removeVoucherService,
|
|
4569
4662
|
syncFromUiService,
|
|
4663
|
+
getCustomerLoyaltyPointService,
|
|
4570
4664
|
addFloorSupabaseService,
|
|
4571
4665
|
addTableSupabaseService,
|
|
4572
4666
|
updateFloorSupabaseService,
|
|
@@ -4612,164 +4706,8 @@ var usePosService = () => {
|
|
|
4612
4706
|
}
|
|
4613
4707
|
return service;
|
|
4614
4708
|
};
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
const [ready, setReady] = react.useState(false);
|
|
4618
|
-
const { getVersion } = useViewService();
|
|
4619
|
-
react.useEffect(() => {
|
|
4620
|
-
const clearVersion = () => {
|
|
4621
|
-
queryClient.clear();
|
|
4622
|
-
localStorage.removeItem("__api_version__");
|
|
4623
|
-
};
|
|
4624
|
-
const validateVersion = async () => {
|
|
4625
|
-
const serverVersion = await getVersion();
|
|
4626
|
-
const cached = localStorage.getItem("__api_version__");
|
|
4627
|
-
if (cached !== serverVersion?.api_version) {
|
|
4628
|
-
clearVersion();
|
|
4629
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
4630
|
-
} else {
|
|
4631
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
4632
|
-
}
|
|
4633
|
-
setReady(true);
|
|
4634
|
-
};
|
|
4635
|
-
validateVersion();
|
|
4636
|
-
if (typeof window !== "undefined") {
|
|
4637
|
-
const onKey = (e) => {
|
|
4638
|
-
const key = e.key.toLowerCase();
|
|
4639
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
4640
|
-
if (isHardRefresh) clearVersion();
|
|
4641
|
-
};
|
|
4642
|
-
window.addEventListener("keydown", onKey);
|
|
4643
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
4644
|
-
}
|
|
4645
|
-
}, [queryClient]);
|
|
4646
|
-
return ready ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : null;
|
|
4647
|
-
};
|
|
4648
|
-
var initialEnvState = {
|
|
4649
|
-
env: null,
|
|
4650
|
-
baseUrl: "",
|
|
4651
|
-
requests: null,
|
|
4652
|
-
companies: [],
|
|
4653
|
-
user: {},
|
|
4654
|
-
config: null,
|
|
4655
|
-
envFile: null,
|
|
4656
|
-
defaultCompany: {
|
|
4657
|
-
id: null,
|
|
4658
|
-
logo: "",
|
|
4659
|
-
secondary_color: "",
|
|
4660
|
-
primary_color: "",
|
|
4661
|
-
secondary_logo: ""
|
|
4662
|
-
},
|
|
4663
|
-
context: {
|
|
4664
|
-
uid: null,
|
|
4665
|
-
lang: "vi_VN",
|
|
4666
|
-
tz: "Asia/Saigon"
|
|
4667
|
-
},
|
|
4668
|
-
excludeLanguages: [],
|
|
4669
|
-
isSupaMode: false
|
|
4670
|
-
};
|
|
4671
|
-
var EnvContext = react.createContext(null);
|
|
4672
|
-
function EnvProvider({
|
|
4673
|
-
children,
|
|
4674
|
-
localStorageUtils: localStorageUtil = chunkJDXUTKMX_js.localStorageUtils(),
|
|
4675
|
-
sessionStorageUtils: sessionStorageUtil = chunkJDXUTKMX_js.sessionStorageUtils
|
|
4676
|
-
}) {
|
|
4677
|
-
const [env, setEnvState] = react.useState({
|
|
4678
|
-
...initialEnvState,
|
|
4679
|
-
localStorageUtils: localStorageUtil,
|
|
4680
|
-
sessionStorageUtils: sessionStorageUtil
|
|
4681
|
-
});
|
|
4682
|
-
const setupEnv = react.useCallback(
|
|
4683
|
-
(envConfig) => {
|
|
4684
|
-
const updatedEnv = {
|
|
4685
|
-
...env,
|
|
4686
|
-
...envConfig,
|
|
4687
|
-
localStorageUtils: localStorageUtil,
|
|
4688
|
-
sessionStorageUtils: sessionStorageUtil
|
|
4689
|
-
};
|
|
4690
|
-
const requests = chunkQ5YXX4OR_js.axiosClient.init(updatedEnv);
|
|
4691
|
-
setEnvState({ ...updatedEnv, requests });
|
|
4692
|
-
return updatedEnv;
|
|
4693
|
-
},
|
|
4694
|
-
[env, localStorageUtil, sessionStorageUtil]
|
|
4695
|
-
);
|
|
4696
|
-
const setUid = react.useCallback((uid) => {
|
|
4697
|
-
setEnvState((prev) => ({
|
|
4698
|
-
...prev,
|
|
4699
|
-
context: { ...prev.context, uid }
|
|
4700
|
-
}));
|
|
4701
|
-
}, []);
|
|
4702
|
-
const setLang = react.useCallback((lang) => {
|
|
4703
|
-
setEnvState((prev) => ({
|
|
4704
|
-
...prev,
|
|
4705
|
-
context: { ...prev.context, lang }
|
|
4706
|
-
}));
|
|
4707
|
-
}, []);
|
|
4708
|
-
const setAllowCompanies = react.useCallback((allowed_company_ids) => {
|
|
4709
|
-
setEnvState((prev) => ({
|
|
4710
|
-
...prev,
|
|
4711
|
-
context: { ...prev.context, allowed_company_ids }
|
|
4712
|
-
}));
|
|
4713
|
-
}, []);
|
|
4714
|
-
const setCompanies = react.useCallback((companies) => {
|
|
4715
|
-
setEnvState((prev) => ({
|
|
4716
|
-
...prev,
|
|
4717
|
-
companies
|
|
4718
|
-
}));
|
|
4719
|
-
}, []);
|
|
4720
|
-
const setDefaultCompany = react.useCallback(
|
|
4721
|
-
(defaultCompany) => {
|
|
4722
|
-
setEnvState((prev) => ({
|
|
4723
|
-
...prev,
|
|
4724
|
-
defaultCompany
|
|
4725
|
-
}));
|
|
4726
|
-
},
|
|
4727
|
-
[]
|
|
4728
|
-
);
|
|
4729
|
-
const setUserInfo = react.useCallback((user) => {
|
|
4730
|
-
setEnvState((prev) => ({
|
|
4731
|
-
...prev,
|
|
4732
|
-
user
|
|
4733
|
-
}));
|
|
4734
|
-
}, []);
|
|
4735
|
-
const setConfig = react.useCallback((config) => {
|
|
4736
|
-
setEnvState((prev) => ({
|
|
4737
|
-
...prev,
|
|
4738
|
-
config
|
|
4739
|
-
}));
|
|
4740
|
-
}, []);
|
|
4741
|
-
const setEnvFile = react.useCallback((envFile) => {
|
|
4742
|
-
setEnvState((prev) => ({
|
|
4743
|
-
...prev,
|
|
4744
|
-
envFile
|
|
4745
|
-
}));
|
|
4746
|
-
}, []);
|
|
4747
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4748
|
-
EnvContext.Provider,
|
|
4749
|
-
{
|
|
4750
|
-
value: {
|
|
4751
|
-
env,
|
|
4752
|
-
setupEnv,
|
|
4753
|
-
setUid,
|
|
4754
|
-
setLang,
|
|
4755
|
-
setAllowCompanies,
|
|
4756
|
-
setCompanies,
|
|
4757
|
-
setDefaultCompany,
|
|
4758
|
-
setUserInfo,
|
|
4759
|
-
setConfig,
|
|
4760
|
-
setEnvFile
|
|
4761
|
-
},
|
|
4762
|
-
children
|
|
4763
|
-
}
|
|
4764
|
-
);
|
|
4765
|
-
}
|
|
4766
|
-
function useEnv() {
|
|
4767
|
-
const context = react.useContext(EnvContext);
|
|
4768
|
-
if (!context) {
|
|
4769
|
-
throw new Error("useEnv must be used within an EnvProvider");
|
|
4770
|
-
}
|
|
4771
|
-
return context;
|
|
4772
|
-
}
|
|
4709
|
+
|
|
4710
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
4773
4711
|
var useForgotPassword = () => {
|
|
4774
4712
|
const { forgotPassword } = useAuthService();
|
|
4775
4713
|
return reactQuery.useMutation({
|
|
@@ -5178,24 +5116,6 @@ var useGetFormView = ({
|
|
|
5178
5116
|
});
|
|
5179
5117
|
};
|
|
5180
5118
|
var use_get_form_view_default = useGetFormView;
|
|
5181
|
-
var useGetImage = ({
|
|
5182
|
-
data,
|
|
5183
|
-
queryKey,
|
|
5184
|
-
src
|
|
5185
|
-
}) => {
|
|
5186
|
-
const { getImage } = useFormService();
|
|
5187
|
-
return reactQuery.useQuery({
|
|
5188
|
-
queryKey,
|
|
5189
|
-
queryFn: () => getImage({ data }).then((res) => {
|
|
5190
|
-
if (res) {
|
|
5191
|
-
return res;
|
|
5192
|
-
}
|
|
5193
|
-
}),
|
|
5194
|
-
enabled: !src && !chunkJDXUTKMX_js.isBase64File(src),
|
|
5195
|
-
refetchOnWindowFocus: false
|
|
5196
|
-
});
|
|
5197
|
-
};
|
|
5198
|
-
var use_get_image_default = useGetImage;
|
|
5199
5119
|
var useSendComment = () => {
|
|
5200
5120
|
const { sentComment } = useFormService();
|
|
5201
5121
|
return reactQuery.useMutation({
|
|
@@ -5419,7 +5339,7 @@ var useModel = () => {
|
|
|
5419
5339
|
const initModel = react.useCallback((modelData) => {
|
|
5420
5340
|
switch (modelData?.name) {
|
|
5421
5341
|
default:
|
|
5422
|
-
return new
|
|
5342
|
+
return new chunkWTPKTZQC_js.BaseModel(modelData);
|
|
5423
5343
|
}
|
|
5424
5344
|
}, []);
|
|
5425
5345
|
return {
|
|
@@ -6089,36 +6009,6 @@ var useActionServerHome = () => {
|
|
|
6089
6009
|
});
|
|
6090
6010
|
};
|
|
6091
6011
|
var use_action_server_home_default = useActionServerHome;
|
|
6092
|
-
var useActionOpenHome = () => {
|
|
6093
|
-
const { actionOpenHome } = useActionService();
|
|
6094
|
-
return reactQuery.useMutation({
|
|
6095
|
-
mutationFn: ({ model, method }) => actionOpenHome({
|
|
6096
|
-
model,
|
|
6097
|
-
method
|
|
6098
|
-
})
|
|
6099
|
-
});
|
|
6100
|
-
};
|
|
6101
|
-
var use_action_open_home_default = useActionOpenHome;
|
|
6102
|
-
var useGetPoints = ({ path }) => {
|
|
6103
|
-
const { getPoints } = useViewService();
|
|
6104
|
-
return reactQuery.useMutation({
|
|
6105
|
-
mutationFn: () => getPoints(path)
|
|
6106
|
-
});
|
|
6107
|
-
};
|
|
6108
|
-
var use_get_point_default = useGetPoints;
|
|
6109
|
-
var useGetOrders = ({
|
|
6110
|
-
kwargs,
|
|
6111
|
-
withContext
|
|
6112
|
-
}) => {
|
|
6113
|
-
const { getOrders } = useViewService();
|
|
6114
|
-
return reactQuery.useMutation({
|
|
6115
|
-
mutationFn: () => getOrders({
|
|
6116
|
-
kwargs,
|
|
6117
|
-
withContext
|
|
6118
|
-
})
|
|
6119
|
-
});
|
|
6120
|
-
};
|
|
6121
|
-
var use_get_order_default = useGetOrders;
|
|
6122
6012
|
var useReadGroup = (services, xNode, body, enabled) => {
|
|
6123
6013
|
const { readGroup } = useDashboardService();
|
|
6124
6014
|
return reactQuery.useQuery({
|
|
@@ -6395,6 +6285,13 @@ var useSyncFromUi = () => {
|
|
|
6395
6285
|
});
|
|
6396
6286
|
};
|
|
6397
6287
|
var use_sync_from_ui_default = useSyncFromUi;
|
|
6288
|
+
var useGetCustomerLoyaltyPoint = () => {
|
|
6289
|
+
const pos = usePosService();
|
|
6290
|
+
return reactQuery.useMutation({
|
|
6291
|
+
mutationFn: pos.getCustomerLoyaltyPoint
|
|
6292
|
+
});
|
|
6293
|
+
};
|
|
6294
|
+
var use_get_customer_loyalty_point_default = useGetCustomerLoyaltyPoint;
|
|
6398
6295
|
var useAddFloor = () => {
|
|
6399
6296
|
const { addFloorSupabase } = addFloorSupabaseService();
|
|
6400
6297
|
return reactQuery.useMutation({
|
|
@@ -6650,7 +6547,6 @@ var ServiceProvider = ({
|
|
|
6650
6547
|
useDeleteComment: use_delete_comment_default,
|
|
6651
6548
|
useGetComment: use_get_comment_default,
|
|
6652
6549
|
useGetFormView: use_get_form_view_default,
|
|
6653
|
-
useGetImage: use_get_image_default,
|
|
6654
6550
|
useSendComment: use_send_comment_default,
|
|
6655
6551
|
useSupaUploadImage: use_supa_upload_image_default,
|
|
6656
6552
|
useDelete: use_delete_default,
|
|
@@ -6776,9 +6672,7 @@ var ServiceProvider = ({
|
|
|
6776
6672
|
useDeleteProduct: use_delete_product_default,
|
|
6777
6673
|
useTogglePosRestaurant: use_toggle_pos_restaurant_default,
|
|
6778
6674
|
useActionServerHome: use_action_server_home_default,
|
|
6779
|
-
|
|
6780
|
-
useGetPoints: use_get_point_default,
|
|
6781
|
-
useGetOrders: use_get_order_default
|
|
6675
|
+
useGetCustomerLoyaltyPoint: use_get_customer_loyalty_point_default
|
|
6782
6676
|
};
|
|
6783
6677
|
return /* @__PURE__ */ jsxRuntime.jsx(ServiceContext.Provider, { value: services, children });
|
|
6784
6678
|
};
|
|
@@ -6848,7 +6742,6 @@ exports.MetaProvider = MetaProvider;
|
|
|
6848
6742
|
exports.ReactQueryProvider = ReactQueryProvider;
|
|
6849
6743
|
exports.ServiceProvider = ServiceProvider;
|
|
6850
6744
|
exports.SupabaseProvider = SupabaseProvider;
|
|
6851
|
-
exports.VersionGate = VersionGate;
|
|
6852
6745
|
exports.useActionService = useActionService;
|
|
6853
6746
|
exports.useAuthService = useAuthService;
|
|
6854
6747
|
exports.useCompanyService = useCompanyService;
|
|
@@ -6863,7 +6756,6 @@ exports.useService = useService;
|
|
|
6863
6756
|
exports.useSupabase = useSupabase;
|
|
6864
6757
|
exports.useUserService = useUserService;
|
|
6865
6758
|
exports.useViewService = useViewService;
|
|
6866
|
-
exports.use_action_open_home_default = use_action_open_home_default;
|
|
6867
6759
|
exports.use_action_server_home_default = use_action_server_home_default;
|
|
6868
6760
|
exports.use_add_category_default = use_add_category_default;
|
|
6869
6761
|
exports.use_add_entity_default = use_add_entity_default;
|
|
@@ -6916,6 +6808,7 @@ exports.use_get_country_default = use_get_country_default;
|
|
|
6916
6808
|
exports.use_get_currency_default = use_get_currency_default;
|
|
6917
6809
|
exports.use_get_current_company_default = use_get_current_company_default;
|
|
6918
6810
|
exports.use_get_current_user_default = use_get_current_user_default;
|
|
6811
|
+
exports.use_get_customer_loyalty_point_default = use_get_customer_loyalty_point_default;
|
|
6919
6812
|
exports.use_get_data_chart_default = use_get_data_chart_default;
|
|
6920
6813
|
exports.use_get_detail_default = use_get_detail_default;
|
|
6921
6814
|
exports.use_get_e_invoice_info_default = use_get_e_invoice_info_default;
|
|
@@ -6926,7 +6819,6 @@ exports.use_get_file_excel_default = use_get_file_excel_default;
|
|
|
6926
6819
|
exports.use_get_form_view_default = use_get_form_view_default;
|
|
6927
6820
|
exports.use_get_functional_modules_default = use_get_functional_modules_default;
|
|
6928
6821
|
exports.use_get_groups_default = use_get_groups_default;
|
|
6929
|
-
exports.use_get_image_default = use_get_image_default;
|
|
6930
6822
|
exports.use_get_list_company_default = use_get_list_company_default;
|
|
6931
6823
|
exports.use_get_list_data_default = use_get_list_data_default;
|
|
6932
6824
|
exports.use_get_list_default = use_get_list_default;
|
|
@@ -6935,11 +6827,9 @@ exports.use_get_list_roles_default = use_get_list_roles_default;
|
|
|
6935
6827
|
exports.use_get_list_users_default = use_get_list_users_default;
|
|
6936
6828
|
exports.use_get_menu_default = use_get_menu_default;
|
|
6937
6829
|
exports.use_get_notifications_default = use_get_notifications_default;
|
|
6938
|
-
exports.use_get_order_default = use_get_order_default;
|
|
6939
6830
|
exports.use_get_order_line_default = use_get_order_line_default;
|
|
6940
6831
|
exports.use_get_partner_title_default = use_get_partner_title_default;
|
|
6941
6832
|
exports.use_get_pin_code_default = use_get_pin_code_default;
|
|
6942
|
-
exports.use_get_point_default = use_get_point_default;
|
|
6943
6833
|
exports.use_get_pos_default = use_get_pos_default;
|
|
6944
6834
|
exports.use_get_preparation_display_data_default = use_get_preparation_display_data_default;
|
|
6945
6835
|
exports.use_get_print_report_default = use_get_print_report_default;
|