@fctc/interface-logic 4.3.9 → 4.4.1
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/constants.d.mts +3 -1
- package/dist/constants.d.ts +3 -1
- package/dist/constants.js +2 -0
- package/dist/constants.mjs +2 -0
- package/dist/environment.d.mts +1 -1
- package/dist/environment.d.ts +1 -1
- package/dist/hooks.d.mts +8 -3
- package/dist/hooks.d.ts +8 -3
- package/dist/hooks.js +347 -805
- package/dist/hooks.mjs +196 -654
- package/dist/provider.d.mts +14 -6
- package/dist/provider.d.ts +14 -6
- package/dist/provider.js +262 -703
- package/dist/provider.mjs +236 -679
- package/dist/services.d.mts +16 -8
- package/dist/services.d.ts +16 -8
- package/dist/services.js +303 -762
- package/dist/services.mjs +285 -743
- package/dist/store.js +1 -1
- package/dist/store.mjs +1 -1
- package/package.json +92 -91
- package/dist/import-snapshot-Ds0gqFFm.d.mts +0 -3
- package/dist/import-snapshot-Ds0gqFFm.d.ts +0 -3
package/dist/services.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(services_exports, {
|
|
|
35
35
|
useCompanyService: () => useCompanyService,
|
|
36
36
|
useDashboardService: () => useDashboardService,
|
|
37
37
|
useExcelService: () => useExcelService,
|
|
38
|
-
useFileSystemService: () => useFileSystemService,
|
|
39
38
|
useFormService: () => useFormService,
|
|
40
39
|
useKanbanService: () => useKanbanService,
|
|
41
40
|
useModelService: () => useModelService,
|
|
@@ -46,7 +45,7 @@ __export(services_exports, {
|
|
|
46
45
|
module.exports = __toCommonJS(services_exports);
|
|
47
46
|
|
|
48
47
|
// src/services/action-service/index.ts
|
|
49
|
-
var
|
|
48
|
+
var import_react39 = require("react");
|
|
50
49
|
|
|
51
50
|
// src/constants/api/uri-constant.ts
|
|
52
51
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
@@ -97,6 +96,58 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
97
96
|
// src/utils/format.ts
|
|
98
97
|
var import_moment = __toESM(require("moment"));
|
|
99
98
|
|
|
99
|
+
// src/constants/model/model-constant.ts
|
|
100
|
+
var LoadDataModel = /* @__PURE__ */ ((LoadDataModel2) => {
|
|
101
|
+
LoadDataModel2["ACCOUNT_CASH_ROUNDING"] = "account.cash.rounding";
|
|
102
|
+
LoadDataModel2["ACCOUNT_FISCAL_POSITION"] = "account.fiscal.position";
|
|
103
|
+
LoadDataModel2["ACCOUNT_FISCAL_POSITION_TAX"] = "account.fiscal.position.tax";
|
|
104
|
+
LoadDataModel2["ACCOUNT_TAX"] = "account.tax";
|
|
105
|
+
LoadDataModel2["ACCOUNT_TAX_GROUP"] = "account.tax.group";
|
|
106
|
+
LoadDataModel2["DECIMAL_PRECISION"] = "decimal.precision";
|
|
107
|
+
LoadDataModel2["IR_MODULE_MODULE"] = "ir.module.module";
|
|
108
|
+
LoadDataModel2["IR_UI_VIEW"] = "ir.ui.view";
|
|
109
|
+
LoadDataModel2["POS_BILL"] = "pos.bill";
|
|
110
|
+
LoadDataModel2["POS_CATEGORY"] = "pos.category";
|
|
111
|
+
LoadDataModel2["POS_CONFIG"] = "pos.config";
|
|
112
|
+
LoadDataModel2["POS_NOTE"] = "pos.note";
|
|
113
|
+
LoadDataModel2["POS_ORDER"] = "pos.order";
|
|
114
|
+
LoadDataModel2["POS_ORDER_LINE"] = "pos.order.line";
|
|
115
|
+
LoadDataModel2["POS_PACK_OPERATION_LOT"] = "pos.pack.operation.lot";
|
|
116
|
+
LoadDataModel2["POS_PAYMENT"] = "pos.payment";
|
|
117
|
+
LoadDataModel2["POS_PAYMENT_METHOD"] = "pos.payment.method";
|
|
118
|
+
LoadDataModel2["POS_PRINTER"] = "pos.printer";
|
|
119
|
+
LoadDataModel2["POS_SESSION"] = "pos.session";
|
|
120
|
+
LoadDataModel2["POS_PREPARATION_DISPLAY_DISPLAY"] = "pos_preparation_display.display";
|
|
121
|
+
LoadDataModel2["PRODUCT_ATTRIBUTE"] = "product.attribute";
|
|
122
|
+
LoadDataModel2["PRODUCT_ATTRIBUTE_CUSTOM_VALUE"] = "product.attribute.custom.value";
|
|
123
|
+
LoadDataModel2["PRODUCT_CATEGORY"] = "product.category";
|
|
124
|
+
LoadDataModel2["PRODUCT_COMBO"] = "product.combo";
|
|
125
|
+
LoadDataModel2["PRODUCT_COMBO_ITEM"] = "product.combo.item";
|
|
126
|
+
LoadDataModel2["PRODUCT_PACKAGING"] = "product.packaging";
|
|
127
|
+
LoadDataModel2["PRODUCT_PRICELIST"] = "product.pricelist";
|
|
128
|
+
LoadDataModel2["PRODUCT_PRICELIST_ITEM"] = "product.pricelist.item";
|
|
129
|
+
LoadDataModel2["PRODUCT_PRODUCT"] = "product.product";
|
|
130
|
+
LoadDataModel2["PRODUCT_TAG"] = "product.tag";
|
|
131
|
+
LoadDataModel2["PRODUCT_TEMPLATE_ATTRIBUTE_LINE"] = "product.template.attribute.line";
|
|
132
|
+
LoadDataModel2["PRODUCT_TEMPLATE_ATTRIBUTE_VALUE"] = "product.template.attribute.value";
|
|
133
|
+
LoadDataModel2["RES_COMPANY"] = "res.company";
|
|
134
|
+
LoadDataModel2["RES_COUNTRY"] = "res.country";
|
|
135
|
+
LoadDataModel2["RES_COUNTRY_STATE"] = "res.country.state";
|
|
136
|
+
LoadDataModel2["RES_CURRENCY"] = "res.currency";
|
|
137
|
+
LoadDataModel2["RES_LANG"] = "res.lang";
|
|
138
|
+
LoadDataModel2["RES_PARTNER"] = "res.partner";
|
|
139
|
+
LoadDataModel2["RES_USERS"] = "res.users";
|
|
140
|
+
LoadDataModel2["STOCK_PICKING_TYPE"] = "stock.picking.type";
|
|
141
|
+
LoadDataModel2["UOM_CATEGORY"] = "uom.category";
|
|
142
|
+
LoadDataModel2["UOM_UOM"] = "uom.uom";
|
|
143
|
+
LoadDataModel2["LOYALTY_PROGRAM"] = "loyalty.program";
|
|
144
|
+
LoadDataModel2["LOYALTY_RULE"] = "loyalty.rule";
|
|
145
|
+
LoadDataModel2["RESTAURANT_TABLE"] = "restaurant.table";
|
|
146
|
+
LoadDataModel2["RESTAURANT_FLOOR"] = "restaurant.floor";
|
|
147
|
+
LoadDataModel2["POS_MAKE_PAYMENT"] = "pos.make.payment";
|
|
148
|
+
return LoadDataModel2;
|
|
149
|
+
})(LoadDataModel || {});
|
|
150
|
+
|
|
100
151
|
// src/utils/domain/py_tokenizer.ts
|
|
101
152
|
var TokenizerError = class extends Error {
|
|
102
153
|
};
|
|
@@ -2225,13 +2276,6 @@ function cleanObject(obj) {
|
|
|
2225
2276
|
}
|
|
2226
2277
|
return result;
|
|
2227
2278
|
}
|
|
2228
|
-
var extractIdFromDomain = (domain) => {
|
|
2229
|
-
if (!domain || !Array.isArray(domain)) return null;
|
|
2230
|
-
const idCond = domain.find(
|
|
2231
|
-
([field, operator]) => field === "id" && operator === "="
|
|
2232
|
-
);
|
|
2233
|
-
return idCond ? Number(idCond[2]) : null;
|
|
2234
|
-
};
|
|
2235
2279
|
|
|
2236
2280
|
// src/provider/react-query-provider.tsx
|
|
2237
2281
|
var import_react2 = require("react");
|
|
@@ -2284,7 +2328,7 @@ var initialState2 = {
|
|
|
2284
2328
|
lang: "vi_VN",
|
|
2285
2329
|
tz: "Asia/Saigon"
|
|
2286
2330
|
},
|
|
2287
|
-
|
|
2331
|
+
isSupaMode: false
|
|
2288
2332
|
};
|
|
2289
2333
|
var envSlice = (0, import_toolkit2.createSlice)({
|
|
2290
2334
|
name: "env",
|
|
@@ -2891,7 +2935,7 @@ function useEnv() {
|
|
|
2891
2935
|
}
|
|
2892
2936
|
|
|
2893
2937
|
// src/provider/service-provider.tsx
|
|
2894
|
-
var
|
|
2938
|
+
var import_react37 = require("react");
|
|
2895
2939
|
|
|
2896
2940
|
// src/hooks/auth/use-forgot-password.ts
|
|
2897
2941
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -3195,544 +3239,7 @@ var getASessionService = (env) => {
|
|
|
3195
3239
|
|
|
3196
3240
|
// src/services/pos-service/add-entity.ts
|
|
3197
3241
|
var import_react7 = require("react");
|
|
3198
|
-
|
|
3199
|
-
// src/services/filesystem-service/file-service.ts
|
|
3200
|
-
var import_filesystem = require("@capacitor/filesystem");
|
|
3201
|
-
var fileService = {
|
|
3202
|
-
read: async (path) => {
|
|
3203
|
-
try {
|
|
3204
|
-
const res = await import_filesystem.Filesystem.readFile({
|
|
3205
|
-
path,
|
|
3206
|
-
directory: import_filesystem.Directory.Data,
|
|
3207
|
-
encoding: import_filesystem.Encoding.UTF8
|
|
3208
|
-
});
|
|
3209
|
-
if (typeof res.data === "string") return res.data;
|
|
3210
|
-
if (res.data instanceof Blob) return await res.data.text();
|
|
3211
|
-
return null;
|
|
3212
|
-
} catch {
|
|
3213
|
-
return null;
|
|
3214
|
-
}
|
|
3215
|
-
},
|
|
3216
|
-
write: async (path, data) => {
|
|
3217
|
-
await import_filesystem.Filesystem.writeFile({
|
|
3218
|
-
path,
|
|
3219
|
-
data,
|
|
3220
|
-
directory: import_filesystem.Directory.Data,
|
|
3221
|
-
encoding: import_filesystem.Encoding.UTF8,
|
|
3222
|
-
recursive: true
|
|
3223
|
-
});
|
|
3224
|
-
},
|
|
3225
|
-
writeAtomic: async (path, data) => {
|
|
3226
|
-
const tempPath = path + ".tmp";
|
|
3227
|
-
await import_filesystem.Filesystem.writeFile({
|
|
3228
|
-
path: tempPath,
|
|
3229
|
-
data,
|
|
3230
|
-
directory: import_filesystem.Directory.Data,
|
|
3231
|
-
encoding: import_filesystem.Encoding.UTF8,
|
|
3232
|
-
recursive: true
|
|
3233
|
-
});
|
|
3234
|
-
try {
|
|
3235
|
-
await import_filesystem.Filesystem.deleteFile({
|
|
3236
|
-
path,
|
|
3237
|
-
directory: import_filesystem.Directory.Data
|
|
3238
|
-
});
|
|
3239
|
-
} catch {
|
|
3240
|
-
}
|
|
3241
|
-
await import_filesystem.Filesystem.rename({
|
|
3242
|
-
from: tempPath,
|
|
3243
|
-
to: path,
|
|
3244
|
-
directory: import_filesystem.Directory.Data
|
|
3245
|
-
});
|
|
3246
|
-
},
|
|
3247
|
-
delete: async (path) => {
|
|
3248
|
-
try {
|
|
3249
|
-
await import_filesystem.Filesystem.deleteFile({
|
|
3250
|
-
path,
|
|
3251
|
-
directory: import_filesystem.Directory.Data
|
|
3252
|
-
});
|
|
3253
|
-
} catch {
|
|
3254
|
-
}
|
|
3255
|
-
},
|
|
3256
|
-
exists: async (path) => {
|
|
3257
|
-
try {
|
|
3258
|
-
await import_filesystem.Filesystem.stat({
|
|
3259
|
-
path,
|
|
3260
|
-
directory: import_filesystem.Directory.Data
|
|
3261
|
-
});
|
|
3262
|
-
return true;
|
|
3263
|
-
} catch {
|
|
3264
|
-
return false;
|
|
3265
|
-
}
|
|
3266
|
-
},
|
|
3267
|
-
mkdir: async (path) => {
|
|
3268
|
-
try {
|
|
3269
|
-
await import_filesystem.Filesystem.mkdir({
|
|
3270
|
-
path,
|
|
3271
|
-
directory: import_filesystem.Directory.Data,
|
|
3272
|
-
recursive: true
|
|
3273
|
-
});
|
|
3274
|
-
} catch (e) {
|
|
3275
|
-
if (!String(e?.message).includes("Exists")) {
|
|
3276
|
-
throw e;
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
},
|
|
3280
|
-
list: async (path) => {
|
|
3281
|
-
return import_filesystem.Filesystem.readdir({
|
|
3282
|
-
path,
|
|
3283
|
-
directory: import_filesystem.Directory.Data
|
|
3284
|
-
});
|
|
3285
|
-
},
|
|
3286
|
-
getUri: async (path) => {
|
|
3287
|
-
return import_filesystem.Filesystem.getUri({
|
|
3288
|
-
path,
|
|
3289
|
-
directory: import_filesystem.Directory.Data
|
|
3290
|
-
});
|
|
3291
|
-
}
|
|
3292
|
-
};
|
|
3293
|
-
|
|
3294
|
-
// src/services/filesystem-service/json-worker.ts
|
|
3295
|
-
function createWorkerBlob() {
|
|
3296
|
-
const workerCode = `
|
|
3297
|
-
self.addEventListener("message", async (ev) => {
|
|
3298
|
-
const { id, cmd, payload } = ev.data;
|
|
3299
|
-
try {
|
|
3300
|
-
if (cmd === "parse") {
|
|
3301
|
-
const parsed = JSON.parse(payload);
|
|
3302
|
-
self.postMessage({ id, ok: true, result: parsed });
|
|
3303
|
-
} else if (cmd === "stringify") {
|
|
3304
|
-
const str = JSON.stringify(payload);
|
|
3305
|
-
self.postMessage({ id, ok: true, result: str });
|
|
3306
|
-
}
|
|
3307
|
-
} catch (err) {
|
|
3308
|
-
self.postMessage({ id, ok: false, error: err?.message || String(err) });
|
|
3309
|
-
}
|
|
3310
|
-
});
|
|
3311
|
-
`;
|
|
3312
|
-
const blob = new Blob([workerCode], { type: "application/javascript" });
|
|
3313
|
-
return URL.createObjectURL(blob);
|
|
3314
|
-
}
|
|
3315
|
-
function spawnParseWorker(raw) {
|
|
3316
|
-
return new Promise((resolve, reject) => {
|
|
3317
|
-
const workerUrl = createWorkerBlob();
|
|
3318
|
-
const worker = new Worker(workerUrl);
|
|
3319
|
-
const id = Math.random().toString(36).slice(2);
|
|
3320
|
-
worker.onmessage = (ev) => {
|
|
3321
|
-
const { ok, result, error } = ev.data;
|
|
3322
|
-
if (ok) {
|
|
3323
|
-
resolve(result);
|
|
3324
|
-
} else {
|
|
3325
|
-
reject(new Error(error));
|
|
3326
|
-
}
|
|
3327
|
-
URL.revokeObjectURL(workerUrl);
|
|
3328
|
-
worker.terminate();
|
|
3329
|
-
};
|
|
3330
|
-
worker.onerror = (err) => {
|
|
3331
|
-
reject(err);
|
|
3332
|
-
URL.revokeObjectURL(workerUrl);
|
|
3333
|
-
worker.terminate();
|
|
3334
|
-
};
|
|
3335
|
-
worker.postMessage({ id, cmd: "parse", payload: raw });
|
|
3336
|
-
});
|
|
3337
|
-
}
|
|
3338
|
-
function spawnStringifyWorker(obj) {
|
|
3339
|
-
return new Promise((resolve, reject) => {
|
|
3340
|
-
const workerUrl = createWorkerBlob();
|
|
3341
|
-
const worker = new Worker(workerUrl);
|
|
3342
|
-
worker.onmessage = (ev) => {
|
|
3343
|
-
const { ok, result, error } = ev.data;
|
|
3344
|
-
if (ok) resolve(result);
|
|
3345
|
-
else reject(new Error(error));
|
|
3346
|
-
URL.revokeObjectURL(workerUrl);
|
|
3347
|
-
worker.terminate();
|
|
3348
|
-
};
|
|
3349
|
-
worker.onerror = (err) => {
|
|
3350
|
-
reject(err);
|
|
3351
|
-
URL.revokeObjectURL(workerUrl);
|
|
3352
|
-
worker.terminate();
|
|
3353
|
-
};
|
|
3354
|
-
worker.postMessage({ cmd: "stringify", payload: obj });
|
|
3355
|
-
});
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3358
|
-
// src/services/filesystem-service/manifest.ts
|
|
3359
|
-
var MANIFEST_PATH = "pos/manifest.json";
|
|
3360
|
-
var MANIFEST_BAK_PATH = "pos/manifest.bak.json";
|
|
3361
|
-
async function writeManifest(manifest) {
|
|
3362
|
-
const oldRaw = await fileService.read(MANIFEST_PATH);
|
|
3363
|
-
if (oldRaw !== null) {
|
|
3364
|
-
await fileService.writeAtomic(MANIFEST_BAK_PATH, oldRaw);
|
|
3365
|
-
}
|
|
3366
|
-
await fileService.writeAtomic(MANIFEST_PATH, JSON.stringify(manifest));
|
|
3367
|
-
try {
|
|
3368
|
-
await fileService.delete(MANIFEST_BAK_PATH);
|
|
3369
|
-
} catch {
|
|
3370
|
-
}
|
|
3371
|
-
}
|
|
3372
|
-
|
|
3373
|
-
// src/services/filesystem-service/import-snapshot.ts
|
|
3374
|
-
var DATA_DIR = "pos";
|
|
3375
|
-
var MODELS_DIR = `${DATA_DIR}/models`;
|
|
3376
|
-
var MODELS_META_DIR = `${DATA_DIR}/models_meta`;
|
|
3377
|
-
var importSnapshot = async ({ data, onProgress }) => {
|
|
3378
|
-
onProgress?.(1, "Parsing snapshot");
|
|
3379
|
-
const parsed = await spawnParseWorker(data);
|
|
3380
|
-
const modelNames = Object.keys(parsed);
|
|
3381
|
-
const total = modelNames.length;
|
|
3382
|
-
const manifest = { version: (/* @__PURE__ */ new Date()).toISOString(), models: {} };
|
|
3383
|
-
const TMP_PREFIX = `pos/data/tmp_import_${Date.now()}`;
|
|
3384
|
-
await fileService.writeAtomic(`${TMP_PREFIX}/.marker`, "1");
|
|
3385
|
-
let i = 0;
|
|
3386
|
-
for (const model of modelNames) {
|
|
3387
|
-
i++;
|
|
3388
|
-
onProgress?.(
|
|
3389
|
-
Math.round(i / total * 100),
|
|
3390
|
-
`Processing ${model} (${i}/${total})`
|
|
3391
|
-
);
|
|
3392
|
-
const block = parsed[model];
|
|
3393
|
-
const dataPart = block?.data ?? block ?? [];
|
|
3394
|
-
const fields = block?.fields ?? [];
|
|
3395
|
-
const relations = block?.relations ?? {};
|
|
3396
|
-
const serialized = await spawnStringifyWorker(dataPart);
|
|
3397
|
-
const tmpModelPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.json`;
|
|
3398
|
-
await fileService.writeAtomic(tmpModelPath, serialized);
|
|
3399
|
-
const meta = {
|
|
3400
|
-
fields,
|
|
3401
|
-
relations,
|
|
3402
|
-
count: Array.isArray(dataPart) ? dataPart.length : 0,
|
|
3403
|
-
writtenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3404
|
-
};
|
|
3405
|
-
const tmpMetaPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`;
|
|
3406
|
-
await fileService.writeAtomic(tmpMetaPath, JSON.stringify(meta));
|
|
3407
|
-
manifest.models[model] = {
|
|
3408
|
-
file: `${MODELS_DIR}/${encodeURIComponent(model)}.json`,
|
|
3409
|
-
metaFile: `${MODELS_META_DIR}/${encodeURIComponent(model)}.meta.json`,
|
|
3410
|
-
count: meta.count,
|
|
3411
|
-
updatedAt: meta.writtenAt
|
|
3412
|
-
};
|
|
3413
|
-
}
|
|
3414
|
-
onProgress?.(95, "Committing import (moving files)");
|
|
3415
|
-
for (const model of modelNames) {
|
|
3416
|
-
const tmpModelPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.json`;
|
|
3417
|
-
const finalModelPath = `${MODELS_DIR}/${encodeURIComponent(model)}.json`;
|
|
3418
|
-
const tmpMetaPath = `${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`;
|
|
3419
|
-
const finalMetaPath = `${MODELS_META_DIR}/${encodeURIComponent(
|
|
3420
|
-
model
|
|
3421
|
-
)}.meta.json`;
|
|
3422
|
-
const tmpRaw = await fileService.read(tmpModelPath);
|
|
3423
|
-
if (tmpRaw !== null) await fileService.writeAtomic(finalModelPath, tmpRaw);
|
|
3424
|
-
const tmpMetaRaw = await fileService.read(tmpMetaPath);
|
|
3425
|
-
if (tmpMetaRaw !== null)
|
|
3426
|
-
await fileService.writeAtomic(finalMetaPath, tmpMetaRaw);
|
|
3427
|
-
onProgress?.(
|
|
3428
|
-
95 + Math.round(
|
|
3429
|
-
(Object.keys(manifest.models).indexOf(model) + 1) / modelNames.length * 5
|
|
3430
|
-
),
|
|
3431
|
-
`Committed ${model}`
|
|
3432
|
-
);
|
|
3433
|
-
}
|
|
3434
|
-
await writeManifest(manifest);
|
|
3435
|
-
try {
|
|
3436
|
-
for (const model of modelNames) {
|
|
3437
|
-
await fileService.delete(
|
|
3438
|
-
`${TMP_PREFIX}/${encodeURIComponent(model)}.json`
|
|
3439
|
-
);
|
|
3440
|
-
await fileService.delete(
|
|
3441
|
-
`${TMP_PREFIX}/${encodeURIComponent(model)}.meta.json`
|
|
3442
|
-
);
|
|
3443
|
-
}
|
|
3444
|
-
await fileService.delete(`${TMP_PREFIX}/.marker`);
|
|
3445
|
-
} catch (e) {
|
|
3446
|
-
console.log("Failed to cleanup tmp import files:", e);
|
|
3447
|
-
}
|
|
3448
|
-
onProgress?.(100, "Import complete");
|
|
3449
|
-
return manifest;
|
|
3450
|
-
};
|
|
3451
|
-
var import_snapshot_default = importSnapshot;
|
|
3452
|
-
|
|
3453
|
-
// src/services/filesystem-service/memory-cache.ts
|
|
3454
|
-
var MemoryCache = class {
|
|
3455
|
-
map = /* @__PURE__ */ new Map();
|
|
3456
|
-
get(k) {
|
|
3457
|
-
const e = this.map.get(k);
|
|
3458
|
-
if (!e) return null;
|
|
3459
|
-
if (e.ttl && Date.now() - e.t > e.ttl) {
|
|
3460
|
-
this.map.delete(k);
|
|
3461
|
-
return null;
|
|
3462
|
-
}
|
|
3463
|
-
return e.value;
|
|
3464
|
-
}
|
|
3465
|
-
set(k, v, ttl = 5 * 60 * 1e3) {
|
|
3466
|
-
this.map.set(k, { value: v, t: Date.now(), ttl });
|
|
3467
|
-
}
|
|
3468
|
-
del(k) {
|
|
3469
|
-
this.map.delete(k);
|
|
3470
|
-
}
|
|
3471
|
-
clear() {
|
|
3472
|
-
this.map.clear();
|
|
3473
|
-
}
|
|
3474
|
-
};
|
|
3475
|
-
var memoryCache = new MemoryCache();
|
|
3476
|
-
|
|
3477
|
-
// src/services/filesystem-service/model-loader.ts
|
|
3478
|
-
var MODELS_DIR2 = "pos/models";
|
|
3479
|
-
var MODELS_META_DIR2 = "pos/models_meta";
|
|
3480
|
-
async function loadModelData(modelName, includeMeta = true) {
|
|
3481
|
-
const key = `model:${modelName}:meta:${includeMeta}`;
|
|
3482
|
-
const cached = memoryCache.get(key);
|
|
3483
|
-
if (cached) return cached;
|
|
3484
|
-
const dataPath = `${MODELS_DIR2}/${encodeURIComponent(modelName)}.json`;
|
|
3485
|
-
const metaPath = `${MODELS_META_DIR2}/${encodeURIComponent(
|
|
3486
|
-
modelName
|
|
3487
|
-
)}.meta.json`;
|
|
3488
|
-
const rawData = await fileService.read(dataPath);
|
|
3489
|
-
if (!rawData) return null;
|
|
3490
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
3491
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
3492
|
-
if (!includeMeta) {
|
|
3493
|
-
const result2 = { data };
|
|
3494
|
-
memoryCache.set(key, result2, 1e3 * 60 * 60);
|
|
3495
|
-
return result2;
|
|
3496
|
-
}
|
|
3497
|
-
const rawMeta = await fileService.read(metaPath);
|
|
3498
|
-
let fields = [];
|
|
3499
|
-
let relations = {};
|
|
3500
|
-
if (rawMeta) {
|
|
3501
|
-
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
3502
|
-
fields = parsedMeta?.fields ?? [];
|
|
3503
|
-
relations = parsedMeta?.relations ?? {};
|
|
3504
|
-
}
|
|
3505
|
-
const result = {
|
|
3506
|
-
data,
|
|
3507
|
-
fields,
|
|
3508
|
-
relations
|
|
3509
|
-
};
|
|
3510
|
-
memoryCache.set(key, result, 1e3 * 60 * 60);
|
|
3511
|
-
return result;
|
|
3512
|
-
}
|
|
3513
|
-
async function loadData(includeMeta = true) {
|
|
3514
|
-
try {
|
|
3515
|
-
const listResult = await fileService.list(MODELS_DIR2);
|
|
3516
|
-
if (!listResult || !Array.isArray(listResult.files)) {
|
|
3517
|
-
console.log("No models found");
|
|
3518
|
-
return {};
|
|
3519
|
-
}
|
|
3520
|
-
const result = {};
|
|
3521
|
-
for (const file of listResult.files) {
|
|
3522
|
-
if (file.type !== "file") continue;
|
|
3523
|
-
if (!file.name.endsWith(".json")) continue;
|
|
3524
|
-
const fileName = file.name;
|
|
3525
|
-
const modelName = fileName.replace(/\.json$/, "");
|
|
3526
|
-
const dataPath = `${MODELS_DIR2}/${fileName}`;
|
|
3527
|
-
const rawData = await fileService.read(dataPath);
|
|
3528
|
-
if (!rawData) continue;
|
|
3529
|
-
const parsedData = await spawnParseWorker(rawData);
|
|
3530
|
-
const data = Array.isArray(parsedData) ? parsedData : [];
|
|
3531
|
-
if (!includeMeta) {
|
|
3532
|
-
result[modelName] = { data };
|
|
3533
|
-
continue;
|
|
3534
|
-
}
|
|
3535
|
-
const metaPath = `${MODELS_META_DIR2}/${encodeURIComponent(
|
|
3536
|
-
modelName
|
|
3537
|
-
)}.meta.json`;
|
|
3538
|
-
const rawMeta = await fileService.read(metaPath);
|
|
3539
|
-
let fields = [];
|
|
3540
|
-
let relations = {};
|
|
3541
|
-
if (rawMeta) {
|
|
3542
|
-
const parsedMeta = await spawnParseWorker(rawMeta);
|
|
3543
|
-
fields = parsedMeta?.fields ?? [];
|
|
3544
|
-
relations = parsedMeta?.relations ?? {};
|
|
3545
|
-
}
|
|
3546
|
-
result[modelName] = {
|
|
3547
|
-
data,
|
|
3548
|
-
fields,
|
|
3549
|
-
relations
|
|
3550
|
-
};
|
|
3551
|
-
}
|
|
3552
|
-
return result;
|
|
3553
|
-
} catch (error) {
|
|
3554
|
-
console.error("Error loading data:", error);
|
|
3555
|
-
throw error;
|
|
3556
|
-
}
|
|
3557
|
-
}
|
|
3558
|
-
|
|
3559
|
-
// src/services/filesystem-service/snapshot-helper.ts
|
|
3560
|
-
var createEmptySnapshot = () => {
|
|
3561
|
-
return {
|
|
3562
|
-
data: []
|
|
3563
|
-
};
|
|
3564
|
-
};
|
|
3565
|
-
var generateNextId = (existingIds, startFrom = 1) => {
|
|
3566
|
-
if (!existingIds || existingIds.length === 0) {
|
|
3567
|
-
return startFrom;
|
|
3568
|
-
}
|
|
3569
|
-
const maxId = Math.max(...existingIds, startFrom - 1);
|
|
3570
|
-
return maxId + 1;
|
|
3571
|
-
};
|
|
3572
|
-
var loadSnapshot = async ({
|
|
3573
|
-
modelName
|
|
3574
|
-
}) => {
|
|
3575
|
-
try {
|
|
3576
|
-
const snapshot = await loadModelData(modelName);
|
|
3577
|
-
if (!snapshot || typeof snapshot !== "object") {
|
|
3578
|
-
console.warn("invalid snapshot, creating new one");
|
|
3579
|
-
return createEmptySnapshot();
|
|
3580
|
-
}
|
|
3581
|
-
return {
|
|
3582
|
-
data: Array.isArray(snapshot.data) ? snapshot.data : []
|
|
3583
|
-
};
|
|
3584
|
-
} catch (error) {
|
|
3585
|
-
console.error("Failed to load snapshot:", error);
|
|
3586
|
-
return createEmptySnapshot();
|
|
3587
|
-
}
|
|
3588
|
-
};
|
|
3589
|
-
var getExistingIds = (snapshot) => {
|
|
3590
|
-
return snapshot.data.map((order) => order.id).filter((id) => typeof id === "number");
|
|
3591
|
-
};
|
|
3592
|
-
var saveSnapshot = async ({
|
|
3593
|
-
snapshot,
|
|
3594
|
-
modelName
|
|
3595
|
-
}) => {
|
|
3596
|
-
try {
|
|
3597
|
-
await import_snapshot_default({
|
|
3598
|
-
data: JSON.stringify({
|
|
3599
|
-
[modelName]: snapshot
|
|
3600
|
-
})
|
|
3601
|
-
});
|
|
3602
|
-
return true;
|
|
3603
|
-
} catch (error) {
|
|
3604
|
-
console.error("failed to save snapshot:", error);
|
|
3605
|
-
return false;
|
|
3606
|
-
}
|
|
3607
|
-
};
|
|
3608
|
-
var addRecordResponseHandler = ({
|
|
3609
|
-
modelName,
|
|
3610
|
-
id,
|
|
3611
|
-
data
|
|
3612
|
-
}) => {
|
|
3613
|
-
if (modelName === "restaurant.floor" /* RESTAURANT_FLOOR */ || modelName === "res.partner" /* RES_PARTNER */) {
|
|
3614
|
-
return [[id, ""]];
|
|
3615
|
-
}
|
|
3616
|
-
return data;
|
|
3617
|
-
};
|
|
3618
|
-
|
|
3619
|
-
// src/services/filesystem-service/model-repository.ts
|
|
3620
|
-
var ModelRepository = class {
|
|
3621
|
-
getAll = async ({ modelName }) => {
|
|
3622
|
-
try {
|
|
3623
|
-
const snapshot = await loadSnapshot({
|
|
3624
|
-
modelName
|
|
3625
|
-
});
|
|
3626
|
-
return snapshot.data;
|
|
3627
|
-
} catch (error) {
|
|
3628
|
-
console.error("failed to get all records:", error);
|
|
3629
|
-
return [];
|
|
3630
|
-
}
|
|
3631
|
-
};
|
|
3632
|
-
getRecord = async ({
|
|
3633
|
-
id,
|
|
3634
|
-
modelName
|
|
3635
|
-
}) => {
|
|
3636
|
-
try {
|
|
3637
|
-
const snapshot = await loadSnapshot({
|
|
3638
|
-
modelName
|
|
3639
|
-
});
|
|
3640
|
-
return snapshot.data.find((record) => record.id === id) || null;
|
|
3641
|
-
} catch (error) {
|
|
3642
|
-
console.error("failed to get record:", error);
|
|
3643
|
-
return null;
|
|
3644
|
-
}
|
|
3645
|
-
};
|
|
3646
|
-
addRecord = async ({
|
|
3647
|
-
newRecord,
|
|
3648
|
-
modelName
|
|
3649
|
-
}) => {
|
|
3650
|
-
try {
|
|
3651
|
-
const snapshot = await loadSnapshot({
|
|
3652
|
-
modelName
|
|
3653
|
-
});
|
|
3654
|
-
const existingIds = getExistingIds(snapshot);
|
|
3655
|
-
const newId = generateNextId(existingIds, snapshot.data.length);
|
|
3656
|
-
snapshot.data.push({
|
|
3657
|
-
...newRecord,
|
|
3658
|
-
id: newId
|
|
3659
|
-
});
|
|
3660
|
-
const saved = await saveSnapshot({
|
|
3661
|
-
snapshot,
|
|
3662
|
-
modelName
|
|
3663
|
-
});
|
|
3664
|
-
if (!saved) {
|
|
3665
|
-
console.error("failed to add new record");
|
|
3666
|
-
return [];
|
|
3667
|
-
}
|
|
3668
|
-
console.log("lib data:", snapshot.data);
|
|
3669
|
-
const response = addRecordResponseHandler({
|
|
3670
|
-
id: newId,
|
|
3671
|
-
modelName,
|
|
3672
|
-
data: snapshot.data
|
|
3673
|
-
});
|
|
3674
|
-
return response;
|
|
3675
|
-
} catch (error) {
|
|
3676
|
-
console.error("failed to add new record:", error);
|
|
3677
|
-
return [];
|
|
3678
|
-
}
|
|
3679
|
-
};
|
|
3680
|
-
updateRecord = async ({
|
|
3681
|
-
id,
|
|
3682
|
-
update,
|
|
3683
|
-
modelName
|
|
3684
|
-
}) => {
|
|
3685
|
-
try {
|
|
3686
|
-
const snapshot = await loadSnapshot({
|
|
3687
|
-
modelName
|
|
3688
|
-
});
|
|
3689
|
-
const index = snapshot.data.findIndex((record) => record.id === id);
|
|
3690
|
-
if (index === -1) {
|
|
3691
|
-
console.error(`record with id ${id} not found`);
|
|
3692
|
-
return false;
|
|
3693
|
-
}
|
|
3694
|
-
snapshot.data[index] = {
|
|
3695
|
-
...snapshot.data[index],
|
|
3696
|
-
...update
|
|
3697
|
-
};
|
|
3698
|
-
return await saveSnapshot({
|
|
3699
|
-
snapshot,
|
|
3700
|
-
modelName
|
|
3701
|
-
});
|
|
3702
|
-
} catch (error) {
|
|
3703
|
-
console.error("error updating record:", error);
|
|
3704
|
-
return false;
|
|
3705
|
-
}
|
|
3706
|
-
};
|
|
3707
|
-
deleteRecord = async ({
|
|
3708
|
-
id,
|
|
3709
|
-
modelName
|
|
3710
|
-
}) => {
|
|
3711
|
-
try {
|
|
3712
|
-
const snapshot = await loadSnapshot({
|
|
3713
|
-
modelName
|
|
3714
|
-
});
|
|
3715
|
-
const before = snapshot.data.length;
|
|
3716
|
-
snapshot.data = snapshot.data.filter((record) => record.id !== id);
|
|
3717
|
-
if (snapshot.data.length === before) {
|
|
3718
|
-
console.error(`record with id ${id} not found`);
|
|
3719
|
-
return false;
|
|
3720
|
-
}
|
|
3721
|
-
return await saveSnapshot({
|
|
3722
|
-
snapshot,
|
|
3723
|
-
modelName
|
|
3724
|
-
});
|
|
3725
|
-
} catch (error) {
|
|
3726
|
-
console.error("error deleting record:", error);
|
|
3727
|
-
return false;
|
|
3728
|
-
}
|
|
3729
|
-
};
|
|
3730
|
-
};
|
|
3731
|
-
|
|
3732
|
-
// src/services/pos-service/add-entity.ts
|
|
3733
3242
|
var addEntityService = (env) => {
|
|
3734
|
-
const isLocalMode = env?.isLocalMode;
|
|
3735
|
-
const repo = new ModelRepository();
|
|
3736
3243
|
const addEntity = (0, import_react7.useCallback)(
|
|
3737
3244
|
({
|
|
3738
3245
|
model,
|
|
@@ -3741,12 +3248,6 @@ var addEntityService = (env) => {
|
|
|
3741
3248
|
service,
|
|
3742
3249
|
isCreateEndpoint = false
|
|
3743
3250
|
}) => {
|
|
3744
|
-
if (isLocalMode) {
|
|
3745
|
-
return repo.addRecord({
|
|
3746
|
-
newRecord: values,
|
|
3747
|
-
modelName: model
|
|
3748
|
-
});
|
|
3749
|
-
}
|
|
3750
3251
|
const jsonData = {
|
|
3751
3252
|
model,
|
|
3752
3253
|
values
|
|
@@ -3763,7 +3264,7 @@ var addEntityService = (env) => {
|
|
|
3763
3264
|
service
|
|
3764
3265
|
);
|
|
3765
3266
|
},
|
|
3766
|
-
[env
|
|
3267
|
+
[env]
|
|
3767
3268
|
);
|
|
3768
3269
|
return {
|
|
3769
3270
|
addEntity
|
|
@@ -3885,8 +3386,6 @@ var createEInvoiceService = (env) => {
|
|
|
3885
3386
|
// src/services/pos-service/create-entity.ts
|
|
3886
3387
|
var import_react11 = require("react");
|
|
3887
3388
|
var createEntityService = (env) => {
|
|
3888
|
-
const isLocalMode = env?.isLocalMode;
|
|
3889
|
-
const repo = new ModelRepository();
|
|
3890
3389
|
const createEntity = (0, import_react11.useCallback)(
|
|
3891
3390
|
({
|
|
3892
3391
|
model,
|
|
@@ -3894,12 +3393,6 @@ var createEntityService = (env) => {
|
|
|
3894
3393
|
xNode,
|
|
3895
3394
|
service
|
|
3896
3395
|
}) => {
|
|
3897
|
-
if (isLocalMode) {
|
|
3898
|
-
return repo.addRecord({
|
|
3899
|
-
newRecord: args[0],
|
|
3900
|
-
modelName: model
|
|
3901
|
-
});
|
|
3902
|
-
}
|
|
3903
3396
|
const jsonData = {
|
|
3904
3397
|
model,
|
|
3905
3398
|
method: "create" /* CREATE */,
|
|
@@ -3917,7 +3410,7 @@ var createEntityService = (env) => {
|
|
|
3917
3410
|
service
|
|
3918
3411
|
);
|
|
3919
3412
|
},
|
|
3920
|
-
[env
|
|
3413
|
+
[env]
|
|
3921
3414
|
);
|
|
3922
3415
|
return {
|
|
3923
3416
|
createEntity
|
|
@@ -4002,8 +3495,6 @@ var createSessionService = (env) => {
|
|
|
4002
3495
|
// src/services/pos-service/delete-entity.ts
|
|
4003
3496
|
var import_react14 = require("react");
|
|
4004
3497
|
var deleteEntityService = (env) => {
|
|
4005
|
-
const isLocalMode = env?.isLocalMode;
|
|
4006
|
-
const repo = new ModelRepository();
|
|
4007
3498
|
const deleteEntity = (0, import_react14.useCallback)(
|
|
4008
3499
|
({
|
|
4009
3500
|
model,
|
|
@@ -4012,14 +3503,6 @@ var deleteEntityService = (env) => {
|
|
|
4012
3503
|
service,
|
|
4013
3504
|
method
|
|
4014
3505
|
}) => {
|
|
4015
|
-
if (isLocalMode) {
|
|
4016
|
-
const id = ids[0];
|
|
4017
|
-
if (!id) return;
|
|
4018
|
-
return repo.deleteRecord({
|
|
4019
|
-
modelName: model,
|
|
4020
|
-
id
|
|
4021
|
-
});
|
|
4022
|
-
}
|
|
4023
3506
|
const jsonData = {
|
|
4024
3507
|
model,
|
|
4025
3508
|
ids,
|
|
@@ -4037,7 +3520,7 @@ var deleteEntityService = (env) => {
|
|
|
4037
3520
|
service
|
|
4038
3521
|
);
|
|
4039
3522
|
},
|
|
4040
|
-
[env
|
|
3523
|
+
[env]
|
|
4041
3524
|
);
|
|
4042
3525
|
return {
|
|
4043
3526
|
deleteEntity
|
|
@@ -4114,8 +3597,6 @@ var getCurrentUserService = (env) => {
|
|
|
4114
3597
|
// src/services/pos-service/get-list.ts
|
|
4115
3598
|
var import_react17 = require("react");
|
|
4116
3599
|
var getListService = (env) => {
|
|
4117
|
-
const isLocalMode = env?.isLocalMode;
|
|
4118
|
-
const repo = new ModelRepository();
|
|
4119
3600
|
const getList = (0, import_react17.useCallback)(
|
|
4120
3601
|
async ({
|
|
4121
3602
|
model,
|
|
@@ -4126,12 +3607,6 @@ var getListService = (env) => {
|
|
|
4126
3607
|
offset,
|
|
4127
3608
|
limit
|
|
4128
3609
|
}) => {
|
|
4129
|
-
if (isLocalMode) {
|
|
4130
|
-
const data = await repo.getAll({
|
|
4131
|
-
modelName: model
|
|
4132
|
-
});
|
|
4133
|
-
return data;
|
|
4134
|
-
}
|
|
4135
3610
|
const jsonData = {
|
|
4136
3611
|
model,
|
|
4137
3612
|
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
@@ -4154,7 +3629,7 @@ var getListService = (env) => {
|
|
|
4154
3629
|
service
|
|
4155
3630
|
);
|
|
4156
3631
|
},
|
|
4157
|
-
[env
|
|
3632
|
+
[env]
|
|
4158
3633
|
);
|
|
4159
3634
|
return {
|
|
4160
3635
|
getList
|
|
@@ -4482,10 +3957,43 @@ var handleClosingSessionService = (env) => {
|
|
|
4482
3957
|
};
|
|
4483
3958
|
|
|
4484
3959
|
// src/services/pos-service/load-data-pos-session.ts
|
|
3960
|
+
var import_react27 = require("react");
|
|
3961
|
+
|
|
3962
|
+
// src/provider/supabase-provider.tsx
|
|
4485
3963
|
var import_react26 = require("react");
|
|
3964
|
+
var import_supabase_js = require("@supabase/supabase-js");
|
|
3965
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3966
|
+
var SupabaseContext = (0, import_react26.createContext)(null);
|
|
3967
|
+
var useSupabase = () => {
|
|
3968
|
+
const context = (0, import_react26.useContext)(SupabaseContext);
|
|
3969
|
+
if (!context) {
|
|
3970
|
+
throw new Error(
|
|
3971
|
+
"useSupabase must be used within a SupabaseProvider or check your env config"
|
|
3972
|
+
);
|
|
3973
|
+
}
|
|
3974
|
+
return context;
|
|
3975
|
+
};
|
|
3976
|
+
|
|
3977
|
+
// src/services/pos-service/load-data-pos-session.ts
|
|
3978
|
+
var MODEL_TO_TABLE = {
|
|
3979
|
+
["account.tax" /* ACCOUNT_TAX */]: "account_taxes",
|
|
3980
|
+
["res.company" /* RES_COMPANY */]: "companies",
|
|
3981
|
+
["res.partner" /* RES_PARTNER */]: "customers",
|
|
3982
|
+
["res.users" /* RES_USERS */]: "employees",
|
|
3983
|
+
["loyalty.program" /* LOYALTY_PROGRAM */]: "loyalty_programs",
|
|
3984
|
+
["loyalty.rule" /* LOYALTY_RULE */]: "loyalty_rules",
|
|
3985
|
+
["pos.order.line" /* POS_ORDER_LINE */]: "order_lines",
|
|
3986
|
+
["pos.order" /* POS_ORDER */]: "orders",
|
|
3987
|
+
["pos.payment.method" /* POS_PAYMENT_METHOD */]: "payment_methods",
|
|
3988
|
+
["pos.payment" /* POS_PAYMENT */]: "payments",
|
|
3989
|
+
["product.category" /* PRODUCT_CATEGORY */]: "product_categories",
|
|
3990
|
+
["product.product" /* PRODUCT_PRODUCT */]: "products",
|
|
3991
|
+
["restaurant.floor" /* RESTAURANT_FLOOR */]: "restaurant_floors",
|
|
3992
|
+
["restaurant.table" /* RESTAURANT_TABLE */]: "restaurant_tables"
|
|
3993
|
+
};
|
|
4486
3994
|
var loadDataPosSessionService = (env) => {
|
|
4487
|
-
const
|
|
4488
|
-
const loadDataPosSession = (0,
|
|
3995
|
+
const supabase = useSupabase();
|
|
3996
|
+
const loadDataPosSession = (0, import_react27.useCallback)(
|
|
4489
3997
|
async ({
|
|
4490
3998
|
model,
|
|
4491
3999
|
ids,
|
|
@@ -4495,10 +4003,6 @@ var loadDataPosSessionService = (env) => {
|
|
|
4495
4003
|
modelsToLoad = [],
|
|
4496
4004
|
searchParams
|
|
4497
4005
|
}) => {
|
|
4498
|
-
if (isLocalMode) {
|
|
4499
|
-
const data = await loadData();
|
|
4500
|
-
return data;
|
|
4501
|
-
}
|
|
4502
4006
|
const jsonData = {
|
|
4503
4007
|
model,
|
|
4504
4008
|
method: "load_data" /* LOAD_DATA */,
|
|
@@ -4525,17 +4029,66 @@ var loadDataPosSessionService = (env) => {
|
|
|
4525
4029
|
service
|
|
4526
4030
|
);
|
|
4527
4031
|
},
|
|
4528
|
-
[env
|
|
4032
|
+
[env]
|
|
4529
4033
|
);
|
|
4034
|
+
const loadDataPosSessionSupabase = (0, import_react27.useCallback)(async () => {
|
|
4035
|
+
try {
|
|
4036
|
+
const allModels = Object.values(LoadDataModel);
|
|
4037
|
+
const promises = allModels.map(async (modelName) => {
|
|
4038
|
+
const tableName = MODEL_TO_TABLE[modelName];
|
|
4039
|
+
if (!tableName) {
|
|
4040
|
+
return {
|
|
4041
|
+
modelName,
|
|
4042
|
+
data: [],
|
|
4043
|
+
fields: {},
|
|
4044
|
+
relations: {}
|
|
4045
|
+
};
|
|
4046
|
+
}
|
|
4047
|
+
const { data, error } = await supabase.from(tableName).select("*");
|
|
4048
|
+
if (error) {
|
|
4049
|
+
console.error(`Error loading ${modelName}:`, error);
|
|
4050
|
+
return {
|
|
4051
|
+
modelName,
|
|
4052
|
+
data: [],
|
|
4053
|
+
fields: {},
|
|
4054
|
+
relations: {}
|
|
4055
|
+
};
|
|
4056
|
+
}
|
|
4057
|
+
return {
|
|
4058
|
+
modelName,
|
|
4059
|
+
data: data || [],
|
|
4060
|
+
fields: {},
|
|
4061
|
+
relations: {}
|
|
4062
|
+
};
|
|
4063
|
+
});
|
|
4064
|
+
const results = await Promise.all(promises);
|
|
4065
|
+
const response = results.reduce(
|
|
4066
|
+
(acc, { modelName, data, fields, relations }) => {
|
|
4067
|
+
acc[modelName] = {
|
|
4068
|
+
data,
|
|
4069
|
+
fields,
|
|
4070
|
+
relations
|
|
4071
|
+
};
|
|
4072
|
+
return acc;
|
|
4073
|
+
},
|
|
4074
|
+
{}
|
|
4075
|
+
);
|
|
4076
|
+
return response;
|
|
4077
|
+
} catch (error) {
|
|
4078
|
+
console.error("Error loading data from Supabase:", error);
|
|
4079
|
+
return {};
|
|
4080
|
+
}
|
|
4081
|
+
}, [supabase]);
|
|
4530
4082
|
return {
|
|
4531
|
-
loadDataPosSession
|
|
4083
|
+
loadDataPosSession,
|
|
4084
|
+
loadDataPosSessionSupabase
|
|
4532
4085
|
};
|
|
4533
4086
|
};
|
|
4534
4087
|
|
|
4535
4088
|
// src/services/pos-service/manage-onchange.ts
|
|
4536
|
-
var
|
|
4089
|
+
var import_react28 = require("react");
|
|
4537
4090
|
var manageOnchangeService = (env) => {
|
|
4538
|
-
const manageOnChange = (0,
|
|
4091
|
+
const manageOnChange = (0, import_react28.useCallback)(
|
|
4539
4092
|
({
|
|
4540
4093
|
model,
|
|
4541
4094
|
ids,
|
|
@@ -4569,9 +4122,9 @@ var manageOnchangeService = (env) => {
|
|
|
4569
4122
|
};
|
|
4570
4123
|
|
|
4571
4124
|
// src/services/pos-service/manage-session.ts
|
|
4572
|
-
var
|
|
4125
|
+
var import_react29 = require("react");
|
|
4573
4126
|
var manageSessionService = (env) => {
|
|
4574
|
-
const manageSession = (0,
|
|
4127
|
+
const manageSession = (0, import_react29.useCallback)(
|
|
4575
4128
|
({
|
|
4576
4129
|
model,
|
|
4577
4130
|
method,
|
|
@@ -4608,9 +4161,9 @@ var manageSessionService = (env) => {
|
|
|
4608
4161
|
};
|
|
4609
4162
|
|
|
4610
4163
|
// src/services/pos-service/process-order.ts
|
|
4611
|
-
var
|
|
4164
|
+
var import_react30 = require("react");
|
|
4612
4165
|
var processOrderService = (env) => {
|
|
4613
|
-
const processOrder = (0,
|
|
4166
|
+
const processOrder = (0, import_react30.useCallback)(
|
|
4614
4167
|
({
|
|
4615
4168
|
orderId,
|
|
4616
4169
|
xNode,
|
|
@@ -4643,9 +4196,9 @@ var processOrderService = (env) => {
|
|
|
4643
4196
|
};
|
|
4644
4197
|
|
|
4645
4198
|
// src/services/pos-service/save-pin-code.ts
|
|
4646
|
-
var
|
|
4199
|
+
var import_react31 = require("react");
|
|
4647
4200
|
var savePinCodeService = (env) => {
|
|
4648
|
-
const savePinCode = (0,
|
|
4201
|
+
const savePinCode = (0, import_react31.useCallback)(
|
|
4649
4202
|
({
|
|
4650
4203
|
serialNumber,
|
|
4651
4204
|
pinCode,
|
|
@@ -4676,9 +4229,9 @@ var savePinCodeService = (env) => {
|
|
|
4676
4229
|
};
|
|
4677
4230
|
|
|
4678
4231
|
// src/services/pos-service/search-journal.ts
|
|
4679
|
-
var
|
|
4232
|
+
var import_react32 = require("react");
|
|
4680
4233
|
var searchJournalService = (env) => {
|
|
4681
|
-
const searchJournal = (0,
|
|
4234
|
+
const searchJournal = (0, import_react32.useCallback)(
|
|
4682
4235
|
({
|
|
4683
4236
|
model,
|
|
4684
4237
|
method,
|
|
@@ -4713,9 +4266,9 @@ var searchJournalService = (env) => {
|
|
|
4713
4266
|
};
|
|
4714
4267
|
|
|
4715
4268
|
// src/services/pos-service/update-closed-session.ts
|
|
4716
|
-
var
|
|
4269
|
+
var import_react33 = require("react");
|
|
4717
4270
|
var updateClosedSessionService = (env) => {
|
|
4718
|
-
const updateClosedSession = (0,
|
|
4271
|
+
const updateClosedSession = (0, import_react33.useCallback)(
|
|
4719
4272
|
({
|
|
4720
4273
|
model,
|
|
4721
4274
|
domain,
|
|
@@ -4748,11 +4301,9 @@ var updateClosedSessionService = (env) => {
|
|
|
4748
4301
|
};
|
|
4749
4302
|
|
|
4750
4303
|
// src/services/pos-service/update-entity.ts
|
|
4751
|
-
var
|
|
4304
|
+
var import_react34 = require("react");
|
|
4752
4305
|
var updateEntityService = (env) => {
|
|
4753
|
-
const
|
|
4754
|
-
const repo = new ModelRepository();
|
|
4755
|
-
const updateEntity = (0, import_react33.useCallback)(
|
|
4306
|
+
const updateEntity = (0, import_react34.useCallback)(
|
|
4756
4307
|
({
|
|
4757
4308
|
model,
|
|
4758
4309
|
domain,
|
|
@@ -4761,15 +4312,6 @@ var updateEntityService = (env) => {
|
|
|
4761
4312
|
xNode,
|
|
4762
4313
|
service
|
|
4763
4314
|
}) => {
|
|
4764
|
-
if (isLocalMode) {
|
|
4765
|
-
const id = extractIdFromDomain(domain);
|
|
4766
|
-
if (!id) return;
|
|
4767
|
-
return repo.updateRecord({
|
|
4768
|
-
update: values,
|
|
4769
|
-
modelName: model,
|
|
4770
|
-
id
|
|
4771
|
-
});
|
|
4772
|
-
}
|
|
4773
4315
|
const jsonData = {
|
|
4774
4316
|
model,
|
|
4775
4317
|
domain,
|
|
@@ -4787,7 +4329,7 @@ var updateEntityService = (env) => {
|
|
|
4787
4329
|
service
|
|
4788
4330
|
);
|
|
4789
4331
|
},
|
|
4790
|
-
[env
|
|
4332
|
+
[env]
|
|
4791
4333
|
);
|
|
4792
4334
|
return {
|
|
4793
4335
|
updateEntity
|
|
@@ -4795,9 +4337,9 @@ var updateEntityService = (env) => {
|
|
|
4795
4337
|
};
|
|
4796
4338
|
|
|
4797
4339
|
// src/services/pos-service/update-order-status.ts
|
|
4798
|
-
var
|
|
4340
|
+
var import_react35 = require("react");
|
|
4799
4341
|
var updateOrderStatusService = (env) => {
|
|
4800
|
-
const updateOrderStatus = (0,
|
|
4342
|
+
const updateOrderStatus = (0, import_react35.useCallback)(
|
|
4801
4343
|
({
|
|
4802
4344
|
orderId,
|
|
4803
4345
|
state,
|
|
@@ -4827,6 +4369,49 @@ var updateOrderStatusService = (env) => {
|
|
|
4827
4369
|
};
|
|
4828
4370
|
};
|
|
4829
4371
|
|
|
4372
|
+
// src/services/pos-service/complete-current-stage.ts
|
|
4373
|
+
var import_react36 = require("react");
|
|
4374
|
+
var completeCurrentStageService = (env) => {
|
|
4375
|
+
const completeCurrentStage = (0, import_react36.useCallback)(
|
|
4376
|
+
({
|
|
4377
|
+
ids,
|
|
4378
|
+
withContext,
|
|
4379
|
+
xNode,
|
|
4380
|
+
service,
|
|
4381
|
+
requestStageId
|
|
4382
|
+
}) => {
|
|
4383
|
+
const jsonData = {
|
|
4384
|
+
model: "pos_preparation_display.orderline" /* POS_PREPARATION_ORDER_LINE */,
|
|
4385
|
+
method: "complete_current_stage" /* COMPLETE_CURRENT_STAGE */,
|
|
4386
|
+
ids,
|
|
4387
|
+
kwargs: {
|
|
4388
|
+
request_stage_id: requestStageId
|
|
4389
|
+
},
|
|
4390
|
+
with_context: withContext || {
|
|
4391
|
+
lang: "vi_VN",
|
|
4392
|
+
tz: "Asia/Ho_Chi_Minh",
|
|
4393
|
+
uid: 2
|
|
4394
|
+
}
|
|
4395
|
+
};
|
|
4396
|
+
return env?.requests.post(
|
|
4397
|
+
"/call" /* CALL_PATH */,
|
|
4398
|
+
jsonData,
|
|
4399
|
+
{
|
|
4400
|
+
headers: {
|
|
4401
|
+
"Content-Type": "application/json",
|
|
4402
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
4403
|
+
}
|
|
4404
|
+
},
|
|
4405
|
+
service
|
|
4406
|
+
);
|
|
4407
|
+
},
|
|
4408
|
+
[env]
|
|
4409
|
+
);
|
|
4410
|
+
return {
|
|
4411
|
+
completeCurrentStage
|
|
4412
|
+
};
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4830
4415
|
// src/services/pos-service/index.ts
|
|
4831
4416
|
var serviceFactories = [
|
|
4832
4417
|
addEntityService,
|
|
@@ -4857,7 +4442,8 @@ var serviceFactories = [
|
|
|
4857
4442
|
searchJournalService,
|
|
4858
4443
|
updateClosedSessionService,
|
|
4859
4444
|
updateEntityService,
|
|
4860
|
-
updateOrderStatusService
|
|
4445
|
+
updateOrderStatusService,
|
|
4446
|
+
completeCurrentStageService
|
|
4861
4447
|
];
|
|
4862
4448
|
var usePosService = () => {
|
|
4863
4449
|
const { env } = useEnv();
|
|
@@ -4953,21 +4539,21 @@ var import_react_query111 = require("@tanstack/react-query");
|
|
|
4953
4539
|
// src/hooks/pos/use-update-order-status.ts
|
|
4954
4540
|
var import_react_query112 = require("@tanstack/react-query");
|
|
4955
4541
|
|
|
4956
|
-
// src/hooks/pos/use-
|
|
4542
|
+
// src/hooks/pos/use-complete-current-stage.ts
|
|
4957
4543
|
var import_react_query113 = require("@tanstack/react-query");
|
|
4958
4544
|
|
|
4959
4545
|
// src/provider/service-provider.tsx
|
|
4960
|
-
var
|
|
4961
|
-
var ServiceContext = (0,
|
|
4546
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4547
|
+
var ServiceContext = (0, import_react37.createContext)(null);
|
|
4962
4548
|
|
|
4963
4549
|
// src/provider/meta-provider.tsx
|
|
4964
|
-
var
|
|
4965
|
-
var
|
|
4550
|
+
var import_react38 = require("react");
|
|
4551
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
4966
4552
|
|
|
4967
4553
|
// src/services/action-service/index.ts
|
|
4968
4554
|
function useActionService() {
|
|
4969
4555
|
const { env } = useEnv();
|
|
4970
|
-
const loadAction = (0,
|
|
4556
|
+
const loadAction = (0, import_react39.useCallback)(
|
|
4971
4557
|
async ({
|
|
4972
4558
|
idAction,
|
|
4973
4559
|
context,
|
|
@@ -4991,7 +4577,7 @@ function useActionService() {
|
|
|
4991
4577
|
},
|
|
4992
4578
|
[env]
|
|
4993
4579
|
);
|
|
4994
|
-
const callButton = (0,
|
|
4580
|
+
const callButton = (0, import_react39.useCallback)(
|
|
4995
4581
|
async ({
|
|
4996
4582
|
model,
|
|
4997
4583
|
ids = [],
|
|
@@ -5025,7 +4611,7 @@ function useActionService() {
|
|
|
5025
4611
|
},
|
|
5026
4612
|
[env]
|
|
5027
4613
|
);
|
|
5028
|
-
const removeRows = (0,
|
|
4614
|
+
const removeRows = (0, import_react39.useCallback)(
|
|
5029
4615
|
async ({
|
|
5030
4616
|
model,
|
|
5031
4617
|
ids,
|
|
@@ -5051,7 +4637,7 @@ function useActionService() {
|
|
|
5051
4637
|
},
|
|
5052
4638
|
[env]
|
|
5053
4639
|
);
|
|
5054
|
-
const duplicateRecord = (0,
|
|
4640
|
+
const duplicateRecord = (0, import_react39.useCallback)(
|
|
5055
4641
|
async ({
|
|
5056
4642
|
model,
|
|
5057
4643
|
id,
|
|
@@ -5077,7 +4663,7 @@ function useActionService() {
|
|
|
5077
4663
|
},
|
|
5078
4664
|
[env]
|
|
5079
4665
|
);
|
|
5080
|
-
const getPrintReportName = (0,
|
|
4666
|
+
const getPrintReportName = (0, import_react39.useCallback)(
|
|
5081
4667
|
async ({ id }) => {
|
|
5082
4668
|
const jsonData = {
|
|
5083
4669
|
model: "ir.actions.report",
|
|
@@ -5095,7 +4681,7 @@ function useActionService() {
|
|
|
5095
4681
|
},
|
|
5096
4682
|
[env]
|
|
5097
4683
|
);
|
|
5098
|
-
const print = (0,
|
|
4684
|
+
const print = (0, import_react39.useCallback)(
|
|
5099
4685
|
async ({ id, report, db }) => {
|
|
5100
4686
|
const jsonData = {
|
|
5101
4687
|
report,
|
|
@@ -5113,7 +4699,7 @@ function useActionService() {
|
|
|
5113
4699
|
},
|
|
5114
4700
|
[env]
|
|
5115
4701
|
);
|
|
5116
|
-
const runAction = (0,
|
|
4702
|
+
const runAction = (0, import_react39.useCallback)(
|
|
5117
4703
|
async ({
|
|
5118
4704
|
idAction,
|
|
5119
4705
|
context,
|
|
@@ -5140,7 +4726,7 @@ function useActionService() {
|
|
|
5140
4726
|
},
|
|
5141
4727
|
[env]
|
|
5142
4728
|
);
|
|
5143
|
-
const generateSerialNumber = (0,
|
|
4729
|
+
const generateSerialNumber = (0, import_react39.useCallback)(
|
|
5144
4730
|
async ({
|
|
5145
4731
|
kwargs,
|
|
5146
4732
|
context,
|
|
@@ -5178,10 +4764,10 @@ function useActionService() {
|
|
|
5178
4764
|
}
|
|
5179
4765
|
|
|
5180
4766
|
// src/services/auth-service/index.ts
|
|
5181
|
-
var
|
|
4767
|
+
var import_react40 = require("react");
|
|
5182
4768
|
function useAuthService() {
|
|
5183
4769
|
const { env } = useEnv();
|
|
5184
|
-
const login = (0,
|
|
4770
|
+
const login = (0, import_react40.useCallback)(
|
|
5185
4771
|
async (body) => {
|
|
5186
4772
|
const payload = Object.fromEntries(
|
|
5187
4773
|
Object.entries({
|
|
@@ -5206,7 +4792,7 @@ function useAuthService() {
|
|
|
5206
4792
|
},
|
|
5207
4793
|
[env]
|
|
5208
4794
|
);
|
|
5209
|
-
const forgotPassword = (0,
|
|
4795
|
+
const forgotPassword = (0, import_react40.useCallback)(
|
|
5210
4796
|
async (email) => {
|
|
5211
4797
|
const bodyData = {
|
|
5212
4798
|
login: email,
|
|
@@ -5220,7 +4806,7 @@ function useAuthService() {
|
|
|
5220
4806
|
},
|
|
5221
4807
|
[env]
|
|
5222
4808
|
);
|
|
5223
|
-
const forgotPasswordSSO = (0,
|
|
4809
|
+
const forgotPasswordSSO = (0, import_react40.useCallback)(
|
|
5224
4810
|
async ({
|
|
5225
4811
|
email,
|
|
5226
4812
|
with_context,
|
|
@@ -5243,7 +4829,7 @@ function useAuthService() {
|
|
|
5243
4829
|
},
|
|
5244
4830
|
[env]
|
|
5245
4831
|
);
|
|
5246
|
-
const resetPassword = (0,
|
|
4832
|
+
const resetPassword = (0, import_react40.useCallback)(
|
|
5247
4833
|
async (data, token) => {
|
|
5248
4834
|
const bodyData = {
|
|
5249
4835
|
token,
|
|
@@ -5258,7 +4844,7 @@ function useAuthService() {
|
|
|
5258
4844
|
},
|
|
5259
4845
|
[env]
|
|
5260
4846
|
);
|
|
5261
|
-
const resetPasswordSSO = (0,
|
|
4847
|
+
const resetPasswordSSO = (0, import_react40.useCallback)(
|
|
5262
4848
|
async ({
|
|
5263
4849
|
method,
|
|
5264
4850
|
password,
|
|
@@ -5281,7 +4867,7 @@ function useAuthService() {
|
|
|
5281
4867
|
},
|
|
5282
4868
|
[env]
|
|
5283
4869
|
);
|
|
5284
|
-
const updatePassword = (0,
|
|
4870
|
+
const updatePassword = (0, import_react40.useCallback)(
|
|
5285
4871
|
async (data, token) => {
|
|
5286
4872
|
const bodyData = {
|
|
5287
4873
|
token,
|
|
@@ -5296,7 +4882,7 @@ function useAuthService() {
|
|
|
5296
4882
|
},
|
|
5297
4883
|
[env]
|
|
5298
4884
|
);
|
|
5299
|
-
const isValidToken = (0,
|
|
4885
|
+
const isValidToken = (0, import_react40.useCallback)(
|
|
5300
4886
|
async (token) => {
|
|
5301
4887
|
const bodyData = {
|
|
5302
4888
|
token
|
|
@@ -5309,7 +4895,7 @@ function useAuthService() {
|
|
|
5309
4895
|
},
|
|
5310
4896
|
[env]
|
|
5311
4897
|
);
|
|
5312
|
-
const isValidActionToken = (0,
|
|
4898
|
+
const isValidActionToken = (0, import_react40.useCallback)(
|
|
5313
4899
|
async (actionToken) => {
|
|
5314
4900
|
const bodyData = {};
|
|
5315
4901
|
return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
|
|
@@ -5322,7 +4908,7 @@ function useAuthService() {
|
|
|
5322
4908
|
},
|
|
5323
4909
|
[env]
|
|
5324
4910
|
);
|
|
5325
|
-
const loginSocial = (0,
|
|
4911
|
+
const loginSocial = (0, import_react40.useCallback)(
|
|
5326
4912
|
async ({
|
|
5327
4913
|
db,
|
|
5328
4914
|
state,
|
|
@@ -5340,13 +4926,13 @@ function useAuthService() {
|
|
|
5340
4926
|
},
|
|
5341
4927
|
[env]
|
|
5342
4928
|
);
|
|
5343
|
-
const getProviders = (0,
|
|
4929
|
+
const getProviders = (0, import_react40.useCallback)(
|
|
5344
4930
|
async (db) => {
|
|
5345
4931
|
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
5346
4932
|
},
|
|
5347
4933
|
[env]
|
|
5348
4934
|
);
|
|
5349
|
-
const getAccessByCode = (0,
|
|
4935
|
+
const getAccessByCode = (0, import_react40.useCallback)(
|
|
5350
4936
|
async (code) => {
|
|
5351
4937
|
const data = new URLSearchParams();
|
|
5352
4938
|
data.append("code", code);
|
|
@@ -5366,7 +4952,7 @@ function useAuthService() {
|
|
|
5366
4952
|
},
|
|
5367
4953
|
[env]
|
|
5368
4954
|
);
|
|
5369
|
-
const logout = (0,
|
|
4955
|
+
const logout = (0, import_react40.useCallback)(
|
|
5370
4956
|
async (service) => {
|
|
5371
4957
|
return env?.requests?.post(
|
|
5372
4958
|
"/logout" /* LOGOUT */,
|
|
@@ -5383,7 +4969,7 @@ function useAuthService() {
|
|
|
5383
4969
|
},
|
|
5384
4970
|
[env]
|
|
5385
4971
|
);
|
|
5386
|
-
const getTenantMapping = (0,
|
|
4972
|
+
const getTenantMapping = (0, import_react40.useCallback)(
|
|
5387
4973
|
async ({ shortName, service }) => {
|
|
5388
4974
|
const bodyData = {
|
|
5389
4975
|
short_name: shortName
|
|
@@ -5401,7 +4987,7 @@ function useAuthService() {
|
|
|
5401
4987
|
},
|
|
5402
4988
|
[env]
|
|
5403
4989
|
);
|
|
5404
|
-
const getToken = (0,
|
|
4990
|
+
const getToken = (0, import_react40.useCallback)(
|
|
5405
4991
|
async ({
|
|
5406
4992
|
phone,
|
|
5407
4993
|
name,
|
|
@@ -5445,10 +5031,10 @@ function useAuthService() {
|
|
|
5445
5031
|
}
|
|
5446
5032
|
|
|
5447
5033
|
// src/services/company-service/index.ts
|
|
5448
|
-
var
|
|
5034
|
+
var import_react41 = require("react");
|
|
5449
5035
|
function useCompanyService() {
|
|
5450
5036
|
const { env } = useEnv();
|
|
5451
|
-
const getCurrentCompany = (0,
|
|
5037
|
+
const getCurrentCompany = (0, import_react41.useCallback)(
|
|
5452
5038
|
async (service, extraHeaders) => {
|
|
5453
5039
|
return await env.requests.get(
|
|
5454
5040
|
"/company" /* COMPANY_PATH */,
|
|
@@ -5465,7 +5051,7 @@ function useCompanyService() {
|
|
|
5465
5051
|
},
|
|
5466
5052
|
[env]
|
|
5467
5053
|
);
|
|
5468
|
-
const getInfoCompany = (0,
|
|
5054
|
+
const getInfoCompany = (0, import_react41.useCallback)(
|
|
5469
5055
|
async (id, service) => {
|
|
5470
5056
|
const jsonData = {
|
|
5471
5057
|
ids: [id],
|
|
@@ -5501,10 +5087,10 @@ function useCompanyService() {
|
|
|
5501
5087
|
}
|
|
5502
5088
|
|
|
5503
5089
|
// src/services/excel-service/index.ts
|
|
5504
|
-
var
|
|
5090
|
+
var import_react42 = require("react");
|
|
5505
5091
|
function useExcelService() {
|
|
5506
5092
|
const { env } = useEnv();
|
|
5507
|
-
const uploadFileExcel = (0,
|
|
5093
|
+
const uploadFileExcel = (0, import_react42.useCallback)(
|
|
5508
5094
|
async ({
|
|
5509
5095
|
formData,
|
|
5510
5096
|
service,
|
|
@@ -5521,7 +5107,7 @@ function useExcelService() {
|
|
|
5521
5107
|
},
|
|
5522
5108
|
[env]
|
|
5523
5109
|
);
|
|
5524
|
-
const uploadIdFile = (0,
|
|
5110
|
+
const uploadIdFile = (0, import_react42.useCallback)(
|
|
5525
5111
|
async ({
|
|
5526
5112
|
formData,
|
|
5527
5113
|
service,
|
|
@@ -5538,7 +5124,7 @@ function useExcelService() {
|
|
|
5538
5124
|
},
|
|
5539
5125
|
[env]
|
|
5540
5126
|
);
|
|
5541
|
-
const parsePreview = (0,
|
|
5127
|
+
const parsePreview = (0, import_react42.useCallback)(
|
|
5542
5128
|
async ({
|
|
5543
5129
|
id,
|
|
5544
5130
|
selectedSheet,
|
|
@@ -5587,7 +5173,7 @@ function useExcelService() {
|
|
|
5587
5173
|
},
|
|
5588
5174
|
[env]
|
|
5589
5175
|
);
|
|
5590
|
-
const executeImport = (0,
|
|
5176
|
+
const executeImport = (0, import_react42.useCallback)(
|
|
5591
5177
|
async ({
|
|
5592
5178
|
columns,
|
|
5593
5179
|
fields,
|
|
@@ -5621,7 +5207,7 @@ function useExcelService() {
|
|
|
5621
5207
|
},
|
|
5622
5208
|
[env]
|
|
5623
5209
|
);
|
|
5624
|
-
const getFileExcel = (0,
|
|
5210
|
+
const getFileExcel = (0, import_react42.useCallback)(
|
|
5625
5211
|
async ({
|
|
5626
5212
|
model,
|
|
5627
5213
|
service,
|
|
@@ -5645,7 +5231,7 @@ function useExcelService() {
|
|
|
5645
5231
|
},
|
|
5646
5232
|
[env]
|
|
5647
5233
|
);
|
|
5648
|
-
const getFieldExport = (0,
|
|
5234
|
+
const getFieldExport = (0, import_react42.useCallback)(
|
|
5649
5235
|
async ({
|
|
5650
5236
|
ids,
|
|
5651
5237
|
model,
|
|
@@ -5685,7 +5271,7 @@ function useExcelService() {
|
|
|
5685
5271
|
},
|
|
5686
5272
|
[env]
|
|
5687
5273
|
);
|
|
5688
|
-
const exportExcel = (0,
|
|
5274
|
+
const exportExcel = (0, import_react42.useCallback)(
|
|
5689
5275
|
async ({
|
|
5690
5276
|
model,
|
|
5691
5277
|
domain,
|
|
@@ -5733,10 +5319,10 @@ function useExcelService() {
|
|
|
5733
5319
|
}
|
|
5734
5320
|
|
|
5735
5321
|
// src/services/form-service/index.ts
|
|
5736
|
-
var
|
|
5322
|
+
var import_react43 = require("react");
|
|
5737
5323
|
function useFormService() {
|
|
5738
5324
|
const { env } = useEnv();
|
|
5739
|
-
const getComment = (0,
|
|
5325
|
+
const getComment = (0, import_react43.useCallback)(
|
|
5740
5326
|
async ({ data }) => {
|
|
5741
5327
|
const jsonData = {
|
|
5742
5328
|
thread_id: data.thread_id,
|
|
@@ -5754,7 +5340,7 @@ function useFormService() {
|
|
|
5754
5340
|
},
|
|
5755
5341
|
[env]
|
|
5756
5342
|
);
|
|
5757
|
-
const getThreadData = (0,
|
|
5343
|
+
const getThreadData = (0, import_react43.useCallback)(
|
|
5758
5344
|
async ({
|
|
5759
5345
|
data,
|
|
5760
5346
|
xNode,
|
|
@@ -5781,7 +5367,7 @@ function useFormService() {
|
|
|
5781
5367
|
},
|
|
5782
5368
|
[env]
|
|
5783
5369
|
);
|
|
5784
|
-
const getThreadMessages = (0,
|
|
5370
|
+
const getThreadMessages = (0, import_react43.useCallback)(
|
|
5785
5371
|
async ({
|
|
5786
5372
|
data,
|
|
5787
5373
|
xNode,
|
|
@@ -5807,7 +5393,7 @@ function useFormService() {
|
|
|
5807
5393
|
},
|
|
5808
5394
|
[env]
|
|
5809
5395
|
);
|
|
5810
|
-
const sentComment = (0,
|
|
5396
|
+
const sentComment = (0, import_react43.useCallback)(
|
|
5811
5397
|
async ({ data }) => {
|
|
5812
5398
|
const jsonData = {
|
|
5813
5399
|
context: {
|
|
@@ -5835,7 +5421,7 @@ function useFormService() {
|
|
|
5835
5421
|
},
|
|
5836
5422
|
[env]
|
|
5837
5423
|
);
|
|
5838
|
-
const deleteComment = (0,
|
|
5424
|
+
const deleteComment = (0, import_react43.useCallback)(
|
|
5839
5425
|
async ({ data }) => {
|
|
5840
5426
|
const jsonData = {
|
|
5841
5427
|
attachment_ids: [],
|
|
@@ -5851,7 +5437,7 @@ function useFormService() {
|
|
|
5851
5437
|
},
|
|
5852
5438
|
[env]
|
|
5853
5439
|
);
|
|
5854
|
-
const getImage = (0,
|
|
5440
|
+
const getImage = (0, import_react43.useCallback)(
|
|
5855
5441
|
async ({ data }) => {
|
|
5856
5442
|
return env.requests.get(
|
|
5857
5443
|
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
@@ -5864,7 +5450,7 @@ function useFormService() {
|
|
|
5864
5450
|
},
|
|
5865
5451
|
[env]
|
|
5866
5452
|
);
|
|
5867
|
-
const uploadImage = (0,
|
|
5453
|
+
const uploadImage = (0, import_react43.useCallback)(
|
|
5868
5454
|
async ({
|
|
5869
5455
|
formData,
|
|
5870
5456
|
service,
|
|
@@ -5883,7 +5469,7 @@ function useFormService() {
|
|
|
5883
5469
|
},
|
|
5884
5470
|
[env]
|
|
5885
5471
|
);
|
|
5886
|
-
const uploadFile = (0,
|
|
5472
|
+
const uploadFile = (0, import_react43.useCallback)(
|
|
5887
5473
|
async ({
|
|
5888
5474
|
formData,
|
|
5889
5475
|
service,
|
|
@@ -5903,7 +5489,7 @@ function useFormService() {
|
|
|
5903
5489
|
},
|
|
5904
5490
|
[env]
|
|
5905
5491
|
);
|
|
5906
|
-
const getFormView = (0,
|
|
5492
|
+
const getFormView = (0, import_react43.useCallback)(
|
|
5907
5493
|
async ({ data }) => {
|
|
5908
5494
|
const jsonData = {
|
|
5909
5495
|
model: data.model,
|
|
@@ -5919,7 +5505,7 @@ function useFormService() {
|
|
|
5919
5505
|
},
|
|
5920
5506
|
[env]
|
|
5921
5507
|
);
|
|
5922
|
-
const changeStatus = (0,
|
|
5508
|
+
const changeStatus = (0, import_react43.useCallback)(
|
|
5923
5509
|
async ({ data }) => {
|
|
5924
5510
|
const vals = {
|
|
5925
5511
|
[data.name]: data.stage_id
|
|
@@ -5948,7 +5534,7 @@ function useFormService() {
|
|
|
5948
5534
|
},
|
|
5949
5535
|
[env]
|
|
5950
5536
|
);
|
|
5951
|
-
const getExternalTab = (0,
|
|
5537
|
+
const getExternalTab = (0, import_react43.useCallback)(
|
|
5952
5538
|
async ({ method, context, service, xNode }) => {
|
|
5953
5539
|
return env?.requests?.post(
|
|
5954
5540
|
"/call" /* CALL_PATH */,
|
|
@@ -5983,10 +5569,10 @@ function useFormService() {
|
|
|
5983
5569
|
}
|
|
5984
5570
|
|
|
5985
5571
|
// src/services/kanban-service/index.ts
|
|
5986
|
-
var
|
|
5572
|
+
var import_react44 = require("react");
|
|
5987
5573
|
function useKanbanService() {
|
|
5988
5574
|
const { env } = useEnv();
|
|
5989
|
-
const getGroups = (0,
|
|
5575
|
+
const getGroups = (0, import_react44.useCallback)(
|
|
5990
5576
|
async ({ model, width_context }) => {
|
|
5991
5577
|
const jsonData = {
|
|
5992
5578
|
model,
|
|
@@ -6006,7 +5592,7 @@ function useKanbanService() {
|
|
|
6006
5592
|
},
|
|
6007
5593
|
[env]
|
|
6008
5594
|
);
|
|
6009
|
-
const getProgressBar = (0,
|
|
5595
|
+
const getProgressBar = (0, import_react44.useCallback)(
|
|
6010
5596
|
async ({ field, color, model, width_context }) => {
|
|
6011
5597
|
const jsonData = {
|
|
6012
5598
|
model,
|
|
@@ -6036,10 +5622,10 @@ function useKanbanService() {
|
|
|
6036
5622
|
}
|
|
6037
5623
|
|
|
6038
5624
|
// src/services/model-service/index.ts
|
|
6039
|
-
var
|
|
5625
|
+
var import_react45 = require("react");
|
|
6040
5626
|
function useModelService() {
|
|
6041
5627
|
const { env } = useEnv();
|
|
6042
|
-
const getListMyBankAccount = (0,
|
|
5628
|
+
const getListMyBankAccount = (0, import_react45.useCallback)(
|
|
6043
5629
|
async ({
|
|
6044
5630
|
domain,
|
|
6045
5631
|
spectification,
|
|
@@ -6063,7 +5649,7 @@ function useModelService() {
|
|
|
6063
5649
|
},
|
|
6064
5650
|
[env]
|
|
6065
5651
|
);
|
|
6066
|
-
const getCurrency = (0,
|
|
5652
|
+
const getCurrency = (0, import_react45.useCallback)(async () => {
|
|
6067
5653
|
const jsonData = {
|
|
6068
5654
|
model: "res.currency",
|
|
6069
5655
|
method: "web_search_read",
|
|
@@ -6083,7 +5669,7 @@ function useModelService() {
|
|
|
6083
5669
|
}
|
|
6084
5670
|
});
|
|
6085
5671
|
}, [env]);
|
|
6086
|
-
const getConversionRate = (0,
|
|
5672
|
+
const getConversionRate = (0, import_react45.useCallback)(async () => {
|
|
6087
5673
|
const jsonData = {
|
|
6088
5674
|
model: "res.currency",
|
|
6089
5675
|
method: "web_search_read",
|
|
@@ -6109,7 +5695,7 @@ function useModelService() {
|
|
|
6109
5695
|
}
|
|
6110
5696
|
});
|
|
6111
5697
|
}, [env]);
|
|
6112
|
-
const getAll = (0,
|
|
5698
|
+
const getAll = (0, import_react45.useCallback)(
|
|
6113
5699
|
async ({
|
|
6114
5700
|
data,
|
|
6115
5701
|
service,
|
|
@@ -6151,7 +5737,7 @@ function useModelService() {
|
|
|
6151
5737
|
},
|
|
6152
5738
|
[env]
|
|
6153
5739
|
);
|
|
6154
|
-
const getListCalendar = (0,
|
|
5740
|
+
const getListCalendar = (0, import_react45.useCallback)(
|
|
6155
5741
|
async ({ data }) => {
|
|
6156
5742
|
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
6157
5743
|
fields: data.fields,
|
|
@@ -6182,7 +5768,7 @@ function useModelService() {
|
|
|
6182
5768
|
},
|
|
6183
5769
|
[env]
|
|
6184
5770
|
);
|
|
6185
|
-
const getList = (0,
|
|
5771
|
+
const getList = (0, import_react45.useCallback)(
|
|
6186
5772
|
async ({
|
|
6187
5773
|
model,
|
|
6188
5774
|
ids = [],
|
|
@@ -6214,7 +5800,7 @@ function useModelService() {
|
|
|
6214
5800
|
},
|
|
6215
5801
|
[env]
|
|
6216
5802
|
);
|
|
6217
|
-
const getDetail = (0,
|
|
5803
|
+
const getDetail = (0, import_react45.useCallback)(
|
|
6218
5804
|
async ({
|
|
6219
5805
|
ids = [],
|
|
6220
5806
|
model,
|
|
@@ -6246,7 +5832,7 @@ function useModelService() {
|
|
|
6246
5832
|
},
|
|
6247
5833
|
[env]
|
|
6248
5834
|
);
|
|
6249
|
-
const save = (0,
|
|
5835
|
+
const save = (0, import_react45.useCallback)(
|
|
6250
5836
|
async ({
|
|
6251
5837
|
model,
|
|
6252
5838
|
ids = [],
|
|
@@ -6281,7 +5867,7 @@ function useModelService() {
|
|
|
6281
5867
|
},
|
|
6282
5868
|
[env]
|
|
6283
5869
|
);
|
|
6284
|
-
const deleteApi = (0,
|
|
5870
|
+
const deleteApi = (0, import_react45.useCallback)(
|
|
6285
5871
|
async ({ ids = [], model, service }) => {
|
|
6286
5872
|
const jsonData = {
|
|
6287
5873
|
model,
|
|
@@ -6301,7 +5887,7 @@ function useModelService() {
|
|
|
6301
5887
|
},
|
|
6302
5888
|
[env]
|
|
6303
5889
|
);
|
|
6304
|
-
const onChange = (0,
|
|
5890
|
+
const onChange = (0, import_react45.useCallback)(
|
|
6305
5891
|
async ({
|
|
6306
5892
|
ids = [],
|
|
6307
5893
|
model,
|
|
@@ -6337,7 +5923,7 @@ function useModelService() {
|
|
|
6337
5923
|
},
|
|
6338
5924
|
[env]
|
|
6339
5925
|
);
|
|
6340
|
-
const getListFieldsOnchange = (0,
|
|
5926
|
+
const getListFieldsOnchange = (0, import_react45.useCallback)(
|
|
6341
5927
|
async ({
|
|
6342
5928
|
model,
|
|
6343
5929
|
service,
|
|
@@ -6361,7 +5947,7 @@ function useModelService() {
|
|
|
6361
5947
|
},
|
|
6362
5948
|
[env]
|
|
6363
5949
|
);
|
|
6364
|
-
const parseORMOdoo = (0,
|
|
5950
|
+
const parseORMOdoo = (0, import_react45.useCallback)((data) => {
|
|
6365
5951
|
for (const key in data) {
|
|
6366
5952
|
if (key === "display_name") {
|
|
6367
5953
|
delete data[key];
|
|
@@ -6372,7 +5958,7 @@ function useModelService() {
|
|
|
6372
5958
|
}
|
|
6373
5959
|
return { ...data };
|
|
6374
5960
|
}, []);
|
|
6375
|
-
const toDataJS = (0,
|
|
5961
|
+
const toDataJS = (0, import_react45.useCallback)(
|
|
6376
5962
|
(data, viewData, model) => {
|
|
6377
5963
|
for (const key in data) {
|
|
6378
5964
|
if (data[key] === false) {
|
|
@@ -6430,10 +6016,10 @@ function useModelService() {
|
|
|
6430
6016
|
}
|
|
6431
6017
|
|
|
6432
6018
|
// src/services/user-service/index.ts
|
|
6433
|
-
var
|
|
6019
|
+
var import_react46 = require("react");
|
|
6434
6020
|
function useUserService() {
|
|
6435
6021
|
const { env } = useEnv();
|
|
6436
|
-
const getProfile = (0,
|
|
6022
|
+
const getProfile = (0, import_react46.useCallback)(
|
|
6437
6023
|
async (service, path, extraHeaders) => {
|
|
6438
6024
|
return env?.requests?.get(
|
|
6439
6025
|
path || "/userinfo" /* PROFILE_PATH */,
|
|
@@ -6450,7 +6036,7 @@ function useUserService() {
|
|
|
6450
6036
|
},
|
|
6451
6037
|
[env]
|
|
6452
6038
|
);
|
|
6453
|
-
const getUser = (0,
|
|
6039
|
+
const getUser = (0, import_react46.useCallback)(
|
|
6454
6040
|
async ({ context, id }) => {
|
|
6455
6041
|
const jsonData = {
|
|
6456
6042
|
model: "res.users",
|
|
@@ -6488,7 +6074,7 @@ function useUserService() {
|
|
|
6488
6074
|
},
|
|
6489
6075
|
[env]
|
|
6490
6076
|
);
|
|
6491
|
-
const switchUserLocale = (0,
|
|
6077
|
+
const switchUserLocale = (0, import_react46.useCallback)(
|
|
6492
6078
|
async ({ id, values, service }) => {
|
|
6493
6079
|
const jsonData = {
|
|
6494
6080
|
model: "res.users",
|
|
@@ -6516,10 +6102,10 @@ function useUserService() {
|
|
|
6516
6102
|
}
|
|
6517
6103
|
|
|
6518
6104
|
// src/services/view-service/index.ts
|
|
6519
|
-
var
|
|
6105
|
+
var import_react47 = require("react");
|
|
6520
6106
|
function useViewService() {
|
|
6521
6107
|
const { env } = useEnv();
|
|
6522
|
-
const getView = (0,
|
|
6108
|
+
const getView = (0, import_react47.useCallback)(
|
|
6523
6109
|
async ({
|
|
6524
6110
|
model,
|
|
6525
6111
|
views,
|
|
@@ -6559,7 +6145,7 @@ function useViewService() {
|
|
|
6559
6145
|
},
|
|
6560
6146
|
[env]
|
|
6561
6147
|
);
|
|
6562
|
-
const getMenu = (0,
|
|
6148
|
+
const getMenu = (0, import_react47.useCallback)(
|
|
6563
6149
|
async (context, specification, domain, service) => {
|
|
6564
6150
|
const jsonData = {
|
|
6565
6151
|
model: "ir.ui.menu" /* MENU */,
|
|
@@ -6590,7 +6176,7 @@ function useViewService() {
|
|
|
6590
6176
|
},
|
|
6591
6177
|
[env]
|
|
6592
6178
|
);
|
|
6593
|
-
const getActionDetail = (0,
|
|
6179
|
+
const getActionDetail = (0, import_react47.useCallback)(
|
|
6594
6180
|
async (aid, context) => {
|
|
6595
6181
|
const jsonData = {
|
|
6596
6182
|
model: "ir.actions.act_window" /* WINDOW_ACTION */,
|
|
@@ -6620,7 +6206,7 @@ function useViewService() {
|
|
|
6620
6206
|
},
|
|
6621
6207
|
[env]
|
|
6622
6208
|
);
|
|
6623
|
-
const getResequence = (0,
|
|
6209
|
+
const getResequence = (0, import_react47.useCallback)(
|
|
6624
6210
|
async ({
|
|
6625
6211
|
model,
|
|
6626
6212
|
ids,
|
|
@@ -6650,7 +6236,7 @@ function useViewService() {
|
|
|
6650
6236
|
},
|
|
6651
6237
|
[env]
|
|
6652
6238
|
);
|
|
6653
|
-
const getSelectionItem = (0,
|
|
6239
|
+
const getSelectionItem = (0, import_react47.useCallback)(
|
|
6654
6240
|
async ({
|
|
6655
6241
|
data,
|
|
6656
6242
|
service,
|
|
@@ -6687,7 +6273,7 @@ function useViewService() {
|
|
|
6687
6273
|
},
|
|
6688
6274
|
[env]
|
|
6689
6275
|
);
|
|
6690
|
-
const loadMessages = (0,
|
|
6276
|
+
const loadMessages = (0, import_react47.useCallback)(async () => {
|
|
6691
6277
|
return env.requests.post(
|
|
6692
6278
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
6693
6279
|
{},
|
|
@@ -6698,14 +6284,14 @@ function useViewService() {
|
|
|
6698
6284
|
}
|
|
6699
6285
|
);
|
|
6700
6286
|
}, [env]);
|
|
6701
|
-
const getVersion = (0,
|
|
6287
|
+
const getVersion = (0, import_react47.useCallback)(async () => {
|
|
6702
6288
|
return env?.requests?.get("", {
|
|
6703
6289
|
headers: {
|
|
6704
6290
|
"Content-Type": "application/json"
|
|
6705
6291
|
}
|
|
6706
6292
|
});
|
|
6707
6293
|
}, [env]);
|
|
6708
|
-
const grantAccess = (0,
|
|
6294
|
+
const grantAccess = (0, import_react47.useCallback)(
|
|
6709
6295
|
async ({
|
|
6710
6296
|
redirect_uri,
|
|
6711
6297
|
state,
|
|
@@ -6732,7 +6318,7 @@ function useViewService() {
|
|
|
6732
6318
|
},
|
|
6733
6319
|
[env]
|
|
6734
6320
|
);
|
|
6735
|
-
const removeTotpSetUp = (0,
|
|
6321
|
+
const removeTotpSetUp = (0, import_react47.useCallback)(
|
|
6736
6322
|
async ({ method, token }) => {
|
|
6737
6323
|
const jsonData = {
|
|
6738
6324
|
method,
|
|
@@ -6753,7 +6339,7 @@ function useViewService() {
|
|
|
6753
6339
|
},
|
|
6754
6340
|
[env]
|
|
6755
6341
|
);
|
|
6756
|
-
const requestSetupTotp = (0,
|
|
6342
|
+
const requestSetupTotp = (0, import_react47.useCallback)(
|
|
6757
6343
|
async ({ method, token }) => {
|
|
6758
6344
|
const jsonData = {
|
|
6759
6345
|
method,
|
|
@@ -6772,7 +6358,7 @@ function useViewService() {
|
|
|
6772
6358
|
},
|
|
6773
6359
|
[env]
|
|
6774
6360
|
);
|
|
6775
|
-
const settingsWebRead2fa = (0,
|
|
6361
|
+
const settingsWebRead2fa = (0, import_react47.useCallback)(
|
|
6776
6362
|
async ({
|
|
6777
6363
|
method,
|
|
6778
6364
|
model,
|
|
@@ -6800,7 +6386,7 @@ function useViewService() {
|
|
|
6800
6386
|
},
|
|
6801
6387
|
[env]
|
|
6802
6388
|
);
|
|
6803
|
-
const signInSSO = (0,
|
|
6389
|
+
const signInSSO = (0, import_react47.useCallback)(
|
|
6804
6390
|
async ({
|
|
6805
6391
|
redirect_uri,
|
|
6806
6392
|
state,
|
|
@@ -6832,7 +6418,7 @@ function useViewService() {
|
|
|
6832
6418
|
},
|
|
6833
6419
|
[env]
|
|
6834
6420
|
);
|
|
6835
|
-
const verify2FA = (0,
|
|
6421
|
+
const verify2FA = (0, import_react47.useCallback)(
|
|
6836
6422
|
({
|
|
6837
6423
|
method,
|
|
6838
6424
|
with_context,
|
|
@@ -6865,7 +6451,7 @@ function useViewService() {
|
|
|
6865
6451
|
},
|
|
6866
6452
|
[env]
|
|
6867
6453
|
);
|
|
6868
|
-
const get2FAMethods = (0,
|
|
6454
|
+
const get2FAMethods = (0, import_react47.useCallback)(
|
|
6869
6455
|
({ method, with_context }) => {
|
|
6870
6456
|
const jsonData = {
|
|
6871
6457
|
method,
|
|
@@ -6884,7 +6470,7 @@ function useViewService() {
|
|
|
6884
6470
|
},
|
|
6885
6471
|
[env]
|
|
6886
6472
|
);
|
|
6887
|
-
const verifyTotp = (0,
|
|
6473
|
+
const verifyTotp = (0, import_react47.useCallback)(
|
|
6888
6474
|
({
|
|
6889
6475
|
method,
|
|
6890
6476
|
action_token,
|
|
@@ -6909,7 +6495,7 @@ function useViewService() {
|
|
|
6909
6495
|
},
|
|
6910
6496
|
[env]
|
|
6911
6497
|
);
|
|
6912
|
-
const getNotifications = (0,
|
|
6498
|
+
const getNotifications = (0, import_react47.useCallback)(
|
|
6913
6499
|
async ({
|
|
6914
6500
|
service,
|
|
6915
6501
|
xNode,
|
|
@@ -6929,7 +6515,7 @@ function useViewService() {
|
|
|
6929
6515
|
},
|
|
6930
6516
|
[env]
|
|
6931
6517
|
);
|
|
6932
|
-
const getCountry = (0,
|
|
6518
|
+
const getCountry = (0, import_react47.useCallback)(
|
|
6933
6519
|
async ({
|
|
6934
6520
|
service,
|
|
6935
6521
|
xNode,
|
|
@@ -6956,7 +6542,7 @@ function useViewService() {
|
|
|
6956
6542
|
},
|
|
6957
6543
|
[env]
|
|
6958
6544
|
);
|
|
6959
|
-
const getCity = (0,
|
|
6545
|
+
const getCity = (0, import_react47.useCallback)(
|
|
6960
6546
|
async ({
|
|
6961
6547
|
service,
|
|
6962
6548
|
xNode,
|
|
@@ -6983,7 +6569,7 @@ function useViewService() {
|
|
|
6983
6569
|
},
|
|
6984
6570
|
[env]
|
|
6985
6571
|
);
|
|
6986
|
-
const getWard = (0,
|
|
6572
|
+
const getWard = (0, import_react47.useCallback)(
|
|
6987
6573
|
async ({
|
|
6988
6574
|
service,
|
|
6989
6575
|
xNode,
|
|
@@ -7008,7 +6594,7 @@ function useViewService() {
|
|
|
7008
6594
|
},
|
|
7009
6595
|
[env]
|
|
7010
6596
|
);
|
|
7011
|
-
const getPartnerTitle = (0,
|
|
6597
|
+
const getPartnerTitle = (0, import_react47.useCallback)(
|
|
7012
6598
|
async ({
|
|
7013
6599
|
service,
|
|
7014
6600
|
xNode,
|
|
@@ -7060,10 +6646,10 @@ function useViewService() {
|
|
|
7060
6646
|
}
|
|
7061
6647
|
|
|
7062
6648
|
// src/services/dashboard-service/index.ts
|
|
7063
|
-
var
|
|
6649
|
+
var import_react48 = require("react");
|
|
7064
6650
|
function useDashboardService() {
|
|
7065
6651
|
const { env } = useEnv();
|
|
7066
|
-
const readGroup = (0,
|
|
6652
|
+
const readGroup = (0, import_react48.useCallback)(
|
|
7067
6653
|
async ({
|
|
7068
6654
|
service,
|
|
7069
6655
|
xNode,
|
|
@@ -7080,7 +6666,7 @@ function useDashboardService() {
|
|
|
7080
6666
|
},
|
|
7081
6667
|
[env]
|
|
7082
6668
|
);
|
|
7083
|
-
const getDataChart = (0,
|
|
6669
|
+
const getDataChart = (0, import_react48.useCallback)(
|
|
7084
6670
|
async ({
|
|
7085
6671
|
service,
|
|
7086
6672
|
xNode,
|
|
@@ -7114,50 +6700,6 @@ function useDashboardService() {
|
|
|
7114
6700
|
);
|
|
7115
6701
|
return { readGroup, getDataChart };
|
|
7116
6702
|
}
|
|
7117
|
-
|
|
7118
|
-
// src/services/filesystem-service/init-snapshot.ts
|
|
7119
|
-
var isSnapshotReady = async () => {
|
|
7120
|
-
try {
|
|
7121
|
-
const raw = await fileService.read("pos/manifest.json");
|
|
7122
|
-
if (!raw) return false;
|
|
7123
|
-
const manifest = JSON.parse(raw);
|
|
7124
|
-
if (!manifest.models || typeof manifest.models !== "object") {
|
|
7125
|
-
return false;
|
|
7126
|
-
}
|
|
7127
|
-
const modelEntries = Object.values(manifest.models);
|
|
7128
|
-
if (modelEntries.length === 0) return false;
|
|
7129
|
-
const firstModel = modelEntries[0];
|
|
7130
|
-
if (!firstModel.file) return false;
|
|
7131
|
-
const modelExists = await fileService.exists(firstModel.file);
|
|
7132
|
-
return modelExists;
|
|
7133
|
-
} catch {
|
|
7134
|
-
return false;
|
|
7135
|
-
}
|
|
7136
|
-
};
|
|
7137
|
-
async function initSnapshot(onProgress) {
|
|
7138
|
-
const ready = await isSnapshotReady();
|
|
7139
|
-
if (ready) {
|
|
7140
|
-
console.log("skip initialization.");
|
|
7141
|
-
return;
|
|
7142
|
-
}
|
|
7143
|
-
console.log("initializing from data.json...");
|
|
7144
|
-
const jsonData = await fetch("/data.json").then((r) => r.text());
|
|
7145
|
-
if (!jsonData) {
|
|
7146
|
-
console.error("cannot load data.json");
|
|
7147
|
-
return;
|
|
7148
|
-
}
|
|
7149
|
-
await import_snapshot_default({
|
|
7150
|
-
data: jsonData,
|
|
7151
|
-
onProgress
|
|
7152
|
-
});
|
|
7153
|
-
}
|
|
7154
|
-
|
|
7155
|
-
// src/services/filesystem-service/index.ts
|
|
7156
|
-
var useFileSystemService = () => {
|
|
7157
|
-
return {
|
|
7158
|
-
initSnapshot
|
|
7159
|
-
};
|
|
7160
|
-
};
|
|
7161
6703
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7162
6704
|
0 && (module.exports = {
|
|
7163
6705
|
useActionService,
|
|
@@ -7165,7 +6707,6 @@ var useFileSystemService = () => {
|
|
|
7165
6707
|
useCompanyService,
|
|
7166
6708
|
useDashboardService,
|
|
7167
6709
|
useExcelService,
|
|
7168
|
-
useFileSystemService,
|
|
7169
6710
|
useFormService,
|
|
7170
6711
|
useKanbanService,
|
|
7171
6712
|
useModelService,
|