@fctc/interface-logic 5.2.4 → 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-OV7EKGYM.mjs → chunk-F4RE57FT.mjs} +171 -326
- 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-5STZNSW4.js → chunk-U2COUTK5.js} +187 -347
- 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 -23
- package/dist/hooks.d.ts +7 -23
- package/dist/hooks.js +160 -177
- 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 -636
- 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 -12
- package/dist/provider.d.ts +4 -12
- package/dist/provider.js +14 -19
- package/dist/provider.mjs +5 -6
- package/dist/services.d.mts +6 -10
- package/dist/services.d.ts +6 -10
- 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,76 +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
|
-
const getVouchers = react.useCallback(async () => {
|
|
2189
|
-
const body = {
|
|
2190
|
-
model: "loyalty.program",
|
|
2191
|
-
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
2192
|
-
kwargs: {
|
|
2193
|
-
domain: [["is_voucher", "=", true]],
|
|
2194
|
-
limit: 10,
|
|
2195
|
-
offset: 0,
|
|
2196
|
-
count_limit: 10001,
|
|
2197
|
-
order: "",
|
|
2198
|
-
specification: {
|
|
2199
|
-
voucher_code: {},
|
|
2200
|
-
name: {},
|
|
2201
|
-
voucher_type: {},
|
|
2202
|
-
voucher_value: {},
|
|
2203
|
-
voucher_state: {},
|
|
2204
|
-
date_from: {},
|
|
2205
|
-
date_to: {}
|
|
2206
|
-
}
|
|
2207
|
-
},
|
|
2208
|
-
with_context: {
|
|
2209
|
-
uid: 104,
|
|
2210
|
-
lang: "vi_VN",
|
|
2211
|
-
tz: "Asia/Saigon",
|
|
2212
|
-
default_is_voucher: true,
|
|
2213
|
-
default_program_type: "promo_code",
|
|
2214
|
-
default_trigger: "with_code",
|
|
2215
|
-
default_applies_on: "current",
|
|
2216
|
-
default_pos_ok: true,
|
|
2217
|
-
force_vnd_currency: true
|
|
2218
|
-
}
|
|
2219
|
-
};
|
|
2220
|
-
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
2221
|
-
headers: {
|
|
2222
|
-
"Content-Type": "application/json",
|
|
2223
|
-
service: "emenu",
|
|
2224
|
-
"x-node": "2032919254WSCunipay_89234578"
|
|
2225
|
-
}
|
|
2226
|
-
});
|
|
2227
|
-
}, [env]);
|
|
2228
2259
|
return {
|
|
2229
2260
|
getView,
|
|
2230
2261
|
getMenu,
|
|
@@ -2245,10 +2276,7 @@ function useViewService() {
|
|
|
2245
2276
|
getCountry,
|
|
2246
2277
|
getCity,
|
|
2247
2278
|
getWard,
|
|
2248
|
-
getPartnerTitle
|
|
2249
|
-
getPoints,
|
|
2250
|
-
getOrders,
|
|
2251
|
-
getVouchers
|
|
2279
|
+
getPartnerTitle
|
|
2252
2280
|
};
|
|
2253
2281
|
}
|
|
2254
2282
|
function useDashboardService() {
|
|
@@ -2699,7 +2727,7 @@ var getListService = (env) => {
|
|
|
2699
2727
|
const jsonData = {
|
|
2700
2728
|
model,
|
|
2701
2729
|
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
2702
|
-
kwargs:
|
|
2730
|
+
kwargs: chunkU4Q3MW45_js.cleanObject({
|
|
2703
2731
|
domain,
|
|
2704
2732
|
offset,
|
|
2705
2733
|
limit,
|
|
@@ -2901,7 +2929,7 @@ var getProductImageService = (env) => {
|
|
|
2901
2929
|
offset,
|
|
2902
2930
|
domain
|
|
2903
2931
|
};
|
|
2904
|
-
const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${
|
|
2932
|
+
const url = searchParams ? `${"/search_read" /* SEARCH_READ */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/search_read" /* SEARCH_READ */;
|
|
2905
2933
|
return env?.requests.post(
|
|
2906
2934
|
url,
|
|
2907
2935
|
jsonData,
|
|
@@ -3051,7 +3079,7 @@ var loadDataPosSessionService = (env) => {
|
|
|
3051
3079
|
models_to_load: modelsToLoad
|
|
3052
3080
|
}
|
|
3053
3081
|
};
|
|
3054
|
-
const url = searchParams ? `${"/call" /* CALL_PATH */}?${
|
|
3082
|
+
const url = searchParams ? `${"/call" /* CALL_PATH */}?${chunkU4Q3MW45_js.toQueryString(searchParams)}` : "/call" /* CALL_PATH */;
|
|
3055
3083
|
return env?.requests.post(
|
|
3056
3084
|
url,
|
|
3057
3085
|
jsonData,
|
|
@@ -3069,10 +3097,10 @@ var loadDataPosSessionService = (env) => {
|
|
|
3069
3097
|
const loadDataPosSessionSupabase = react.useCallback(async () => {
|
|
3070
3098
|
if (!supabase) return {};
|
|
3071
3099
|
try {
|
|
3072
|
-
const allModels = Object.values(
|
|
3100
|
+
const allModels = Object.values(chunkCOC7NGXP_js.LoadDataModel);
|
|
3073
3101
|
const results = await Promise.all(
|
|
3074
3102
|
allModels.map(async (modelName) => {
|
|
3075
|
-
const tableName =
|
|
3103
|
+
const tableName = chunkCOC7NGXP_js.MODEL_TO_TABLE[modelName];
|
|
3076
3104
|
if (!tableName) return createModelResult(modelName);
|
|
3077
3105
|
const { data, error } = await supabase.from(tableName).select("*");
|
|
3078
3106
|
if (error) {
|
|
@@ -3617,6 +3645,30 @@ var syncFromUiService = (env) => {
|
|
|
3617
3645
|
syncFromUi
|
|
3618
3646
|
};
|
|
3619
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
|
+
};
|
|
3620
3672
|
var addFloorSupabaseService = () => {
|
|
3621
3673
|
const supabase = useSupabaseOptional();
|
|
3622
3674
|
const addFloorSupabase = react.useCallback(
|
|
@@ -3927,7 +3979,7 @@ var updateOrderSupabaseService = () => {
|
|
|
3927
3979
|
return [];
|
|
3928
3980
|
}
|
|
3929
3981
|
const { order_id, ...rest } = values;
|
|
3930
|
-
const updateData =
|
|
3982
|
+
const updateData = chunkU4Q3MW45_js.cleanObject({
|
|
3931
3983
|
...rest,
|
|
3932
3984
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3933
3985
|
});
|
|
@@ -4040,7 +4092,7 @@ var addProductSupabaseService = () => {
|
|
|
4040
4092
|
console.error("Supabase client not initialized");
|
|
4041
4093
|
return null;
|
|
4042
4094
|
}
|
|
4043
|
-
const insertData =
|
|
4095
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4044
4096
|
name: values.name,
|
|
4045
4097
|
product_tmpl_id: values.product_tmpl_id,
|
|
4046
4098
|
product_template_variant_value_ids: values.product_template_variant_value_ids ?? [],
|
|
@@ -4083,7 +4135,7 @@ var addPaymentMethodSupabaseService = () => {
|
|
|
4083
4135
|
return null;
|
|
4084
4136
|
}
|
|
4085
4137
|
const { name, ...rest } = values;
|
|
4086
|
-
const insertData =
|
|
4138
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4087
4139
|
name,
|
|
4088
4140
|
...rest
|
|
4089
4141
|
});
|
|
@@ -4184,7 +4236,7 @@ var createCustomerSupabaseService = () => {
|
|
|
4184
4236
|
return null;
|
|
4185
4237
|
}
|
|
4186
4238
|
try {
|
|
4187
|
-
const insertData =
|
|
4239
|
+
const insertData = chunkU4Q3MW45_js.cleanObject({
|
|
4188
4240
|
name: values.name,
|
|
4189
4241
|
phone: values.phone,
|
|
4190
4242
|
email: values.email,
|
|
@@ -4223,7 +4275,7 @@ var updateCustomerSupabaseService = () => {
|
|
|
4223
4275
|
}
|
|
4224
4276
|
try {
|
|
4225
4277
|
const { customer_id, ...rest } = values;
|
|
4226
|
-
const updateData =
|
|
4278
|
+
const updateData = chunkU4Q3MW45_js.cleanObject({
|
|
4227
4279
|
...rest,
|
|
4228
4280
|
write_date: (/* @__PURE__ */ new Date()).toISOString()
|
|
4229
4281
|
});
|
|
@@ -4500,7 +4552,7 @@ var updateProductSupabaseService = () => {
|
|
|
4500
4552
|
}
|
|
4501
4553
|
try {
|
|
4502
4554
|
const { product_id, ...rest } = values;
|
|
4503
|
-
const updateData =
|
|
4555
|
+
const updateData = chunkU4Q3MW45_js.cleanObject(rest);
|
|
4504
4556
|
const { data, error } = await supabase.from("products" /* PRODUCTS */).update(updateData).eq("id", product_id).select("id").single();
|
|
4505
4557
|
if (error) {
|
|
4506
4558
|
console.error("Error updating product:", error);
|
|
@@ -4608,6 +4660,7 @@ var serviceFactories = [
|
|
|
4608
4660
|
applyVoucherService,
|
|
4609
4661
|
removeVoucherService,
|
|
4610
4662
|
syncFromUiService,
|
|
4663
|
+
getCustomerLoyaltyPointService,
|
|
4611
4664
|
addFloorSupabaseService,
|
|
4612
4665
|
addTableSupabaseService,
|
|
4613
4666
|
updateFloorSupabaseService,
|
|
@@ -4653,164 +4706,8 @@ var usePosService = () => {
|
|
|
4653
4706
|
}
|
|
4654
4707
|
return service;
|
|
4655
4708
|
};
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
const [ready, setReady] = react.useState(false);
|
|
4659
|
-
const { getVersion } = useViewService();
|
|
4660
|
-
react.useEffect(() => {
|
|
4661
|
-
const clearVersion = () => {
|
|
4662
|
-
queryClient.clear();
|
|
4663
|
-
localStorage.removeItem("__api_version__");
|
|
4664
|
-
};
|
|
4665
|
-
const validateVersion = async () => {
|
|
4666
|
-
const serverVersion = await getVersion();
|
|
4667
|
-
const cached = localStorage.getItem("__api_version__");
|
|
4668
|
-
if (cached !== serverVersion?.api_version) {
|
|
4669
|
-
clearVersion();
|
|
4670
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
4671
|
-
} else {
|
|
4672
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
4673
|
-
}
|
|
4674
|
-
setReady(true);
|
|
4675
|
-
};
|
|
4676
|
-
validateVersion();
|
|
4677
|
-
if (typeof window !== "undefined") {
|
|
4678
|
-
const onKey = (e) => {
|
|
4679
|
-
const key = e.key.toLowerCase();
|
|
4680
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
4681
|
-
if (isHardRefresh) clearVersion();
|
|
4682
|
-
};
|
|
4683
|
-
window.addEventListener("keydown", onKey);
|
|
4684
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
4685
|
-
}
|
|
4686
|
-
}, [queryClient]);
|
|
4687
|
-
return ready ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : null;
|
|
4688
|
-
};
|
|
4689
|
-
var initialEnvState = {
|
|
4690
|
-
env: null,
|
|
4691
|
-
baseUrl: "",
|
|
4692
|
-
requests: null,
|
|
4693
|
-
companies: [],
|
|
4694
|
-
user: {},
|
|
4695
|
-
config: null,
|
|
4696
|
-
envFile: null,
|
|
4697
|
-
defaultCompany: {
|
|
4698
|
-
id: null,
|
|
4699
|
-
logo: "",
|
|
4700
|
-
secondary_color: "",
|
|
4701
|
-
primary_color: "",
|
|
4702
|
-
secondary_logo: ""
|
|
4703
|
-
},
|
|
4704
|
-
context: {
|
|
4705
|
-
uid: null,
|
|
4706
|
-
lang: "vi_VN",
|
|
4707
|
-
tz: "Asia/Saigon"
|
|
4708
|
-
},
|
|
4709
|
-
excludeLanguages: [],
|
|
4710
|
-
isSupaMode: false
|
|
4711
|
-
};
|
|
4712
|
-
var EnvContext = react.createContext(null);
|
|
4713
|
-
function EnvProvider({
|
|
4714
|
-
children,
|
|
4715
|
-
localStorageUtils: localStorageUtil = chunkJDXUTKMX_js.localStorageUtils(),
|
|
4716
|
-
sessionStorageUtils: sessionStorageUtil = chunkJDXUTKMX_js.sessionStorageUtils
|
|
4717
|
-
}) {
|
|
4718
|
-
const [env, setEnvState] = react.useState({
|
|
4719
|
-
...initialEnvState,
|
|
4720
|
-
localStorageUtils: localStorageUtil,
|
|
4721
|
-
sessionStorageUtils: sessionStorageUtil
|
|
4722
|
-
});
|
|
4723
|
-
const setupEnv = react.useCallback(
|
|
4724
|
-
(envConfig) => {
|
|
4725
|
-
const updatedEnv = {
|
|
4726
|
-
...env,
|
|
4727
|
-
...envConfig,
|
|
4728
|
-
localStorageUtils: localStorageUtil,
|
|
4729
|
-
sessionStorageUtils: sessionStorageUtil
|
|
4730
|
-
};
|
|
4731
|
-
const requests = chunkQ5YXX4OR_js.axiosClient.init(updatedEnv);
|
|
4732
|
-
setEnvState({ ...updatedEnv, requests });
|
|
4733
|
-
return updatedEnv;
|
|
4734
|
-
},
|
|
4735
|
-
[env, localStorageUtil, sessionStorageUtil]
|
|
4736
|
-
);
|
|
4737
|
-
const setUid = react.useCallback((uid) => {
|
|
4738
|
-
setEnvState((prev) => ({
|
|
4739
|
-
...prev,
|
|
4740
|
-
context: { ...prev.context, uid }
|
|
4741
|
-
}));
|
|
4742
|
-
}, []);
|
|
4743
|
-
const setLang = react.useCallback((lang) => {
|
|
4744
|
-
setEnvState((prev) => ({
|
|
4745
|
-
...prev,
|
|
4746
|
-
context: { ...prev.context, lang }
|
|
4747
|
-
}));
|
|
4748
|
-
}, []);
|
|
4749
|
-
const setAllowCompanies = react.useCallback((allowed_company_ids) => {
|
|
4750
|
-
setEnvState((prev) => ({
|
|
4751
|
-
...prev,
|
|
4752
|
-
context: { ...prev.context, allowed_company_ids }
|
|
4753
|
-
}));
|
|
4754
|
-
}, []);
|
|
4755
|
-
const setCompanies = react.useCallback((companies) => {
|
|
4756
|
-
setEnvState((prev) => ({
|
|
4757
|
-
...prev,
|
|
4758
|
-
companies
|
|
4759
|
-
}));
|
|
4760
|
-
}, []);
|
|
4761
|
-
const setDefaultCompany = react.useCallback(
|
|
4762
|
-
(defaultCompany) => {
|
|
4763
|
-
setEnvState((prev) => ({
|
|
4764
|
-
...prev,
|
|
4765
|
-
defaultCompany
|
|
4766
|
-
}));
|
|
4767
|
-
},
|
|
4768
|
-
[]
|
|
4769
|
-
);
|
|
4770
|
-
const setUserInfo = react.useCallback((user) => {
|
|
4771
|
-
setEnvState((prev) => ({
|
|
4772
|
-
...prev,
|
|
4773
|
-
user
|
|
4774
|
-
}));
|
|
4775
|
-
}, []);
|
|
4776
|
-
const setConfig = react.useCallback((config) => {
|
|
4777
|
-
setEnvState((prev) => ({
|
|
4778
|
-
...prev,
|
|
4779
|
-
config
|
|
4780
|
-
}));
|
|
4781
|
-
}, []);
|
|
4782
|
-
const setEnvFile = react.useCallback((envFile) => {
|
|
4783
|
-
setEnvState((prev) => ({
|
|
4784
|
-
...prev,
|
|
4785
|
-
envFile
|
|
4786
|
-
}));
|
|
4787
|
-
}, []);
|
|
4788
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4789
|
-
EnvContext.Provider,
|
|
4790
|
-
{
|
|
4791
|
-
value: {
|
|
4792
|
-
env,
|
|
4793
|
-
setupEnv,
|
|
4794
|
-
setUid,
|
|
4795
|
-
setLang,
|
|
4796
|
-
setAllowCompanies,
|
|
4797
|
-
setCompanies,
|
|
4798
|
-
setDefaultCompany,
|
|
4799
|
-
setUserInfo,
|
|
4800
|
-
setConfig,
|
|
4801
|
-
setEnvFile
|
|
4802
|
-
},
|
|
4803
|
-
children
|
|
4804
|
-
}
|
|
4805
|
-
);
|
|
4806
|
-
}
|
|
4807
|
-
function useEnv() {
|
|
4808
|
-
const context = react.useContext(EnvContext);
|
|
4809
|
-
if (!context) {
|
|
4810
|
-
throw new Error("useEnv must be used within an EnvProvider");
|
|
4811
|
-
}
|
|
4812
|
-
return context;
|
|
4813
|
-
}
|
|
4709
|
+
|
|
4710
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
4814
4711
|
var useForgotPassword = () => {
|
|
4815
4712
|
const { forgotPassword } = useAuthService();
|
|
4816
4713
|
return reactQuery.useMutation({
|
|
@@ -5219,24 +5116,6 @@ var useGetFormView = ({
|
|
|
5219
5116
|
});
|
|
5220
5117
|
};
|
|
5221
5118
|
var use_get_form_view_default = useGetFormView;
|
|
5222
|
-
var useGetImage = ({
|
|
5223
|
-
data,
|
|
5224
|
-
queryKey,
|
|
5225
|
-
src
|
|
5226
|
-
}) => {
|
|
5227
|
-
const { getImage } = useFormService();
|
|
5228
|
-
return reactQuery.useQuery({
|
|
5229
|
-
queryKey,
|
|
5230
|
-
queryFn: () => getImage({ data }).then((res) => {
|
|
5231
|
-
if (res) {
|
|
5232
|
-
return res;
|
|
5233
|
-
}
|
|
5234
|
-
}),
|
|
5235
|
-
enabled: !src && !chunkJDXUTKMX_js.isBase64File(src),
|
|
5236
|
-
refetchOnWindowFocus: false
|
|
5237
|
-
});
|
|
5238
|
-
};
|
|
5239
|
-
var use_get_image_default = useGetImage;
|
|
5240
5119
|
var useSendComment = () => {
|
|
5241
5120
|
const { sentComment } = useFormService();
|
|
5242
5121
|
return reactQuery.useMutation({
|
|
@@ -5460,7 +5339,7 @@ var useModel = () => {
|
|
|
5460
5339
|
const initModel = react.useCallback((modelData) => {
|
|
5461
5340
|
switch (modelData?.name) {
|
|
5462
5341
|
default:
|
|
5463
|
-
return new
|
|
5342
|
+
return new chunkWTPKTZQC_js.BaseModel(modelData);
|
|
5464
5343
|
}
|
|
5465
5344
|
}, []);
|
|
5466
5345
|
return {
|
|
@@ -6130,43 +6009,6 @@ var useActionServerHome = () => {
|
|
|
6130
6009
|
});
|
|
6131
6010
|
};
|
|
6132
6011
|
var use_action_server_home_default = useActionServerHome;
|
|
6133
|
-
var useActionOpenHome = () => {
|
|
6134
|
-
const { actionOpenHome } = useActionService();
|
|
6135
|
-
return reactQuery.useMutation({
|
|
6136
|
-
mutationFn: ({ model, method }) => actionOpenHome({
|
|
6137
|
-
model,
|
|
6138
|
-
method
|
|
6139
|
-
})
|
|
6140
|
-
});
|
|
6141
|
-
};
|
|
6142
|
-
var use_action_open_home_default = useActionOpenHome;
|
|
6143
|
-
var useGetPoints = ({ path }) => {
|
|
6144
|
-
const { getPoints } = useViewService();
|
|
6145
|
-
return reactQuery.useMutation({
|
|
6146
|
-
mutationFn: () => getPoints(path)
|
|
6147
|
-
});
|
|
6148
|
-
};
|
|
6149
|
-
var use_get_point_default = useGetPoints;
|
|
6150
|
-
var useGetOrders = ({
|
|
6151
|
-
kwargs,
|
|
6152
|
-
withContext
|
|
6153
|
-
}) => {
|
|
6154
|
-
const { getOrders } = useViewService();
|
|
6155
|
-
return reactQuery.useMutation({
|
|
6156
|
-
mutationFn: () => getOrders({
|
|
6157
|
-
kwargs,
|
|
6158
|
-
withContext
|
|
6159
|
-
})
|
|
6160
|
-
});
|
|
6161
|
-
};
|
|
6162
|
-
var use_get_order_default = useGetOrders;
|
|
6163
|
-
var useGetVouchers = () => {
|
|
6164
|
-
const { getVouchers } = useViewService();
|
|
6165
|
-
return reactQuery.useMutation({
|
|
6166
|
-
mutationFn: () => getVouchers()
|
|
6167
|
-
});
|
|
6168
|
-
};
|
|
6169
|
-
var use_get_voucher_default = useGetVouchers;
|
|
6170
6012
|
var useReadGroup = (services, xNode, body, enabled) => {
|
|
6171
6013
|
const { readGroup } = useDashboardService();
|
|
6172
6014
|
return reactQuery.useQuery({
|
|
@@ -6443,6 +6285,13 @@ var useSyncFromUi = () => {
|
|
|
6443
6285
|
});
|
|
6444
6286
|
};
|
|
6445
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;
|
|
6446
6295
|
var useAddFloor = () => {
|
|
6447
6296
|
const { addFloorSupabase } = addFloorSupabaseService();
|
|
6448
6297
|
return reactQuery.useMutation({
|
|
@@ -6698,7 +6547,6 @@ var ServiceProvider = ({
|
|
|
6698
6547
|
useDeleteComment: use_delete_comment_default,
|
|
6699
6548
|
useGetComment: use_get_comment_default,
|
|
6700
6549
|
useGetFormView: use_get_form_view_default,
|
|
6701
|
-
useGetImage: use_get_image_default,
|
|
6702
6550
|
useSendComment: use_send_comment_default,
|
|
6703
6551
|
useSupaUploadImage: use_supa_upload_image_default,
|
|
6704
6552
|
useDelete: use_delete_default,
|
|
@@ -6824,10 +6672,7 @@ var ServiceProvider = ({
|
|
|
6824
6672
|
useDeleteProduct: use_delete_product_default,
|
|
6825
6673
|
useTogglePosRestaurant: use_toggle_pos_restaurant_default,
|
|
6826
6674
|
useActionServerHome: use_action_server_home_default,
|
|
6827
|
-
|
|
6828
|
-
useGetPoints: use_get_point_default,
|
|
6829
|
-
useGetOrders: use_get_order_default,
|
|
6830
|
-
useGetVouchers: use_get_voucher_default
|
|
6675
|
+
useGetCustomerLoyaltyPoint: use_get_customer_loyalty_point_default
|
|
6831
6676
|
};
|
|
6832
6677
|
return /* @__PURE__ */ jsxRuntime.jsx(ServiceContext.Provider, { value: services, children });
|
|
6833
6678
|
};
|
|
@@ -6897,7 +6742,6 @@ exports.MetaProvider = MetaProvider;
|
|
|
6897
6742
|
exports.ReactQueryProvider = ReactQueryProvider;
|
|
6898
6743
|
exports.ServiceProvider = ServiceProvider;
|
|
6899
6744
|
exports.SupabaseProvider = SupabaseProvider;
|
|
6900
|
-
exports.VersionGate = VersionGate;
|
|
6901
6745
|
exports.useActionService = useActionService;
|
|
6902
6746
|
exports.useAuthService = useAuthService;
|
|
6903
6747
|
exports.useCompanyService = useCompanyService;
|
|
@@ -6912,7 +6756,6 @@ exports.useService = useService;
|
|
|
6912
6756
|
exports.useSupabase = useSupabase;
|
|
6913
6757
|
exports.useUserService = useUserService;
|
|
6914
6758
|
exports.useViewService = useViewService;
|
|
6915
|
-
exports.use_action_open_home_default = use_action_open_home_default;
|
|
6916
6759
|
exports.use_action_server_home_default = use_action_server_home_default;
|
|
6917
6760
|
exports.use_add_category_default = use_add_category_default;
|
|
6918
6761
|
exports.use_add_entity_default = use_add_entity_default;
|
|
@@ -6965,6 +6808,7 @@ exports.use_get_country_default = use_get_country_default;
|
|
|
6965
6808
|
exports.use_get_currency_default = use_get_currency_default;
|
|
6966
6809
|
exports.use_get_current_company_default = use_get_current_company_default;
|
|
6967
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;
|
|
6968
6812
|
exports.use_get_data_chart_default = use_get_data_chart_default;
|
|
6969
6813
|
exports.use_get_detail_default = use_get_detail_default;
|
|
6970
6814
|
exports.use_get_e_invoice_info_default = use_get_e_invoice_info_default;
|
|
@@ -6975,7 +6819,6 @@ exports.use_get_file_excel_default = use_get_file_excel_default;
|
|
|
6975
6819
|
exports.use_get_form_view_default = use_get_form_view_default;
|
|
6976
6820
|
exports.use_get_functional_modules_default = use_get_functional_modules_default;
|
|
6977
6821
|
exports.use_get_groups_default = use_get_groups_default;
|
|
6978
|
-
exports.use_get_image_default = use_get_image_default;
|
|
6979
6822
|
exports.use_get_list_company_default = use_get_list_company_default;
|
|
6980
6823
|
exports.use_get_list_data_default = use_get_list_data_default;
|
|
6981
6824
|
exports.use_get_list_default = use_get_list_default;
|
|
@@ -6984,11 +6827,9 @@ exports.use_get_list_roles_default = use_get_list_roles_default;
|
|
|
6984
6827
|
exports.use_get_list_users_default = use_get_list_users_default;
|
|
6985
6828
|
exports.use_get_menu_default = use_get_menu_default;
|
|
6986
6829
|
exports.use_get_notifications_default = use_get_notifications_default;
|
|
6987
|
-
exports.use_get_order_default = use_get_order_default;
|
|
6988
6830
|
exports.use_get_order_line_default = use_get_order_line_default;
|
|
6989
6831
|
exports.use_get_partner_title_default = use_get_partner_title_default;
|
|
6990
6832
|
exports.use_get_pin_code_default = use_get_pin_code_default;
|
|
6991
|
-
exports.use_get_point_default = use_get_point_default;
|
|
6992
6833
|
exports.use_get_pos_default = use_get_pos_default;
|
|
6993
6834
|
exports.use_get_preparation_display_data_default = use_get_preparation_display_data_default;
|
|
6994
6835
|
exports.use_get_print_report_default = use_get_print_report_default;
|
|
@@ -7005,7 +6846,6 @@ exports.use_get_token_default = use_get_token_default;
|
|
|
7005
6846
|
exports.use_get_user_default = use_get_user_default;
|
|
7006
6847
|
exports.use_get_version_default = use_get_version_default;
|
|
7007
6848
|
exports.use_get_view_default = use_get_view_default;
|
|
7008
|
-
exports.use_get_voucher_default = use_get_voucher_default;
|
|
7009
6849
|
exports.use_get_ward_default = use_get_ward_default;
|
|
7010
6850
|
exports.use_grant_access_default = use_grant_access_default;
|
|
7011
6851
|
exports.use_handle_close_session_default = use_handle_close_session_default;
|