@fctc/interface-logic 1.10.4 → 1.10.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/services.mjs CHANGED
@@ -4044,1107 +4044,6 @@ var ViewService = {
4044
4044
  }
4045
4045
  };
4046
4046
  var view_service_default = ViewService;
4047
-
4048
- // src/services/auth-service/backup.ts
4049
- import { useCallback as useCallback3 } from "react";
4050
-
4051
- // src/provider/react-query-provider.tsx
4052
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4053
- import { jsx } from "react/jsx-runtime";
4054
-
4055
- // src/provider/redux-provider.tsx
4056
- import { Provider } from "react-redux";
4057
-
4058
- // src/store/index.ts
4059
- import { useDispatch, useSelector } from "react-redux";
4060
-
4061
- // src/store/reducers/breadcrums-slice/index.ts
4062
- import { createSlice } from "@reduxjs/toolkit";
4063
- var initialState = {
4064
- breadCrumbs: []
4065
- };
4066
- var breadcrumbsSlice = createSlice({
4067
- name: "breadcrumbs",
4068
- initialState,
4069
- reducers: {
4070
- setBreadCrumbs: (state, action) => {
4071
- state.breadCrumbs = [...state.breadCrumbs, action.payload];
4072
- }
4073
- }
4074
- });
4075
- var { setBreadCrumbs } = breadcrumbsSlice.actions;
4076
- var breadcrums_slice_default = breadcrumbsSlice.reducer;
4077
-
4078
- // src/store/reducers/env-slice/index.ts
4079
- import { createSlice as createSlice2 } from "@reduxjs/toolkit";
4080
- var initialState2 = {
4081
- baseUrl: "",
4082
- companies: [],
4083
- user: {},
4084
- db: "",
4085
- refreshTokenEndpoint: "",
4086
- config: null,
4087
- envFile: null,
4088
- requests: null,
4089
- defaultCompany: {
4090
- id: null,
4091
- logo: "",
4092
- secondary_color: "",
4093
- primary_color: ""
4094
- },
4095
- context: {
4096
- uid: null,
4097
- allowed_company_ids: [],
4098
- lang: "vi_VN",
4099
- tz: "Asia/Saigon"
4100
- }
4101
- };
4102
- var envSlice = createSlice2({
4103
- name: "env",
4104
- initialState: initialState2,
4105
- reducers: {
4106
- setEnv: (state, action) => {
4107
- Object.assign(state, action.payload);
4108
- },
4109
- setUid: (state, action) => {
4110
- state.context.uid = action.payload;
4111
- },
4112
- setAllowCompanies: (state, action) => {
4113
- state.context.allowed_company_ids = action.payload;
4114
- },
4115
- setCompanies: (state, action) => {
4116
- state.companies = action.payload;
4117
- },
4118
- setDefaultCompany: (state, action) => {
4119
- state.defaultCompany = action.payload;
4120
- },
4121
- setLang: (state, action) => {
4122
- state.context.lang = action.payload;
4123
- },
4124
- setUser: (state, action) => {
4125
- state.user = action.payload;
4126
- },
4127
- setConfig: (state, action) => {
4128
- state.config = action.payload;
4129
- },
4130
- setEnvFile: (state, action) => {
4131
- state.envFile = action.payload;
4132
- }
4133
- }
4134
- });
4135
- var {
4136
- setEnv,
4137
- setUid,
4138
- setLang,
4139
- setAllowCompanies,
4140
- setCompanies,
4141
- setDefaultCompany,
4142
- setUser,
4143
- setConfig,
4144
- setEnvFile
4145
- } = envSlice.actions;
4146
- var env_slice_default = envSlice.reducer;
4147
-
4148
- // src/store/reducers/excel-slice/index.ts
4149
- import { createSlice as createSlice3 } from "@reduxjs/toolkit";
4150
- var initialState3 = {
4151
- dataParse: null,
4152
- idFile: null,
4153
- isFileLoaded: false,
4154
- loadingImport: false,
4155
- selectedFile: null,
4156
- errorData: null
4157
- };
4158
- var excelSlice = createSlice3({
4159
- name: "excel",
4160
- initialState: initialState3,
4161
- reducers: {
4162
- setDataParse: (state, action) => {
4163
- state.dataParse = action.payload;
4164
- },
4165
- setIdFile: (state, action) => {
4166
- state.idFile = action.payload;
4167
- },
4168
- setIsFileLoaded: (state, action) => {
4169
- state.isFileLoaded = action.payload;
4170
- },
4171
- setLoadingImport: (state, action) => {
4172
- state.loadingImport = action.payload;
4173
- },
4174
- setSelectedFile: (state, action) => {
4175
- state.selectedFile = action.payload;
4176
- },
4177
- setErrorData: (state, action) => {
4178
- state.errorData = action.payload;
4179
- }
4180
- }
4181
- });
4182
- var {
4183
- setDataParse,
4184
- setIdFile,
4185
- setIsFileLoaded,
4186
- setLoadingImport,
4187
- setSelectedFile,
4188
- setErrorData
4189
- } = excelSlice.actions;
4190
- var excel_slice_default = excelSlice.reducer;
4191
-
4192
- // src/store/reducers/form-slice/index.ts
4193
- import { createSlice as createSlice4 } from "@reduxjs/toolkit";
4194
- var initialState4 = {
4195
- viewDataStore: {},
4196
- isShowingModalDetail: false,
4197
- isShowModalTranslate: false,
4198
- formSubmitComponent: {},
4199
- fieldTranslation: null,
4200
- listSubject: {},
4201
- dataUser: {}
4202
- };
4203
- var formSlice = createSlice4({
4204
- name: "form",
4205
- initialState: initialState4,
4206
- reducers: {
4207
- setViewDataStore: (state, action) => {
4208
- state.viewDataStore = action.payload;
4209
- },
4210
- setIsShowingModalDetail: (state, action) => {
4211
- state.isShowingModalDetail = action.payload;
4212
- },
4213
- setIsShowModalTranslate: (state, action) => {
4214
- state.isShowModalTranslate = action.payload;
4215
- },
4216
- setFormSubmitComponent: (state, action) => {
4217
- state.formSubmitComponent[action.payload.key] = action.payload.component;
4218
- },
4219
- setFieldTranslate: (state, action) => {
4220
- state.fieldTranslation = action.payload;
4221
- },
4222
- setListSubject: (state, action) => {
4223
- state.listSubject = action.payload;
4224
- },
4225
- setDataUser: (state, action) => {
4226
- state.dataUser = action.payload;
4227
- }
4228
- }
4229
- });
4230
- var {
4231
- setViewDataStore,
4232
- setIsShowingModalDetail,
4233
- setIsShowModalTranslate,
4234
- setFormSubmitComponent,
4235
- setFieldTranslate,
4236
- setListSubject,
4237
- setDataUser
4238
- } = formSlice.actions;
4239
- var form_slice_default = formSlice.reducer;
4240
-
4241
- // src/store/reducers/header-slice/index.ts
4242
- import { createSlice as createSlice5 } from "@reduxjs/toolkit";
4243
- var headerSlice = createSlice5({
4244
- name: "header",
4245
- initialState: {
4246
- value: { allowedCompanyIds: [] }
4247
- },
4248
- reducers: {
4249
- setHeader: (state, action) => {
4250
- state.value = { ...state.value, ...action.payload };
4251
- },
4252
- setAllowedCompanyIds: (state, action) => {
4253
- state.value.allowedCompanyIds = action.payload;
4254
- }
4255
- }
4256
- });
4257
- var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
4258
- var header_slice_default = headerSlice.reducer;
4259
-
4260
- // src/store/reducers/list-slice/index.ts
4261
- import { createSlice as createSlice6 } from "@reduxjs/toolkit";
4262
- var initialState5 = {
4263
- pageLimit: 10,
4264
- fields: {},
4265
- order: "",
4266
- selectedRowKeys: [],
4267
- selectedRadioKey: 0,
4268
- indexRowTableModal: -2,
4269
- isUpdateTableModal: false,
4270
- footerGroupTable: {},
4271
- transferDetail: null,
4272
- page: 0,
4273
- domainTable: []
4274
- };
4275
- var listSlice = createSlice6({
4276
- name: "list",
4277
- initialState: initialState5,
4278
- reducers: {
4279
- setPageLimit: (state, action) => {
4280
- state.pageLimit = action.payload;
4281
- },
4282
- setFields: (state, action) => {
4283
- state.fields = action.payload;
4284
- },
4285
- setOrder: (state, action) => {
4286
- state.order = action.payload;
4287
- },
4288
- setSelectedRowKeys: (state, action) => {
4289
- state.selectedRowKeys = action.payload;
4290
- },
4291
- setSelectedRadioKey: (state, action) => {
4292
- state.selectedRadioKey = action.payload;
4293
- },
4294
- setIndexRowTableModal: (state, action) => {
4295
- state.indexRowTableModal = action.payload;
4296
- },
4297
- setTransferDetail: (state, action) => {
4298
- state.transferDetail = action.payload;
4299
- },
4300
- setIsUpdateTableModal: (state, action) => {
4301
- state.isUpdateTableModal = action.payload;
4302
- },
4303
- setPage: (state, action) => {
4304
- state.page = action.payload;
4305
- },
4306
- setDomainTable: (state, action) => {
4307
- state.domainTable = action.payload;
4308
- }
4309
- }
4310
- });
4311
- var {
4312
- setPageLimit,
4313
- setFields,
4314
- setOrder,
4315
- setSelectedRowKeys,
4316
- setIndexRowTableModal,
4317
- setIsUpdateTableModal,
4318
- setPage,
4319
- setSelectedRadioKey,
4320
- setTransferDetail,
4321
- setDomainTable
4322
- } = listSlice.actions;
4323
- var list_slice_default = listSlice.reducer;
4324
-
4325
- // src/store/reducers/login-slice/index.ts
4326
- import { createSlice as createSlice7 } from "@reduxjs/toolkit";
4327
- var initialState6 = {
4328
- db: "",
4329
- redirectTo: "/",
4330
- forgotPasswordUrl: "/"
4331
- };
4332
- var loginSlice = createSlice7({
4333
- name: "login",
4334
- initialState: initialState6,
4335
- reducers: {
4336
- setDb: (state, action) => {
4337
- state.db = action.payload;
4338
- },
4339
- setRedirectTo: (state, action) => {
4340
- state.redirectTo = action.payload;
4341
- },
4342
- setForgotPasswordUrl: (state, action) => {
4343
- state.forgotPasswordUrl = action.payload;
4344
- }
4345
- }
4346
- });
4347
- var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
4348
- var login_slice_default = loginSlice.reducer;
4349
-
4350
- // src/store/reducers/navbar-slice/index.ts
4351
- import { createSlice as createSlice8 } from "@reduxjs/toolkit";
4352
- var initialState7 = {
4353
- menuFocus: {},
4354
- menuAction: {},
4355
- navbarWidth: 250,
4356
- menuList: []
4357
- };
4358
- var navbarSlice = createSlice8({
4359
- name: "navbar",
4360
- initialState: initialState7,
4361
- reducers: {
4362
- setMenuFocus: (state, action) => {
4363
- state.menuFocus = action.payload;
4364
- },
4365
- setMenuFocusAction: (state, action) => {
4366
- state.menuAction = action.payload;
4367
- },
4368
- setNavbarWidth: (state, action) => {
4369
- state.navbarWidth = action.payload;
4370
- },
4371
- setMenuList: (state, action) => {
4372
- state.menuList = action.payload;
4373
- }
4374
- }
4375
- });
4376
- var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
4377
- var navbar_slice_default = navbarSlice.reducer;
4378
-
4379
- // src/store/reducers/profile-slice/index.ts
4380
- import { createSlice as createSlice9 } from "@reduxjs/toolkit";
4381
- var initialState8 = {
4382
- profile: {}
4383
- };
4384
- var profileSlice = createSlice9({
4385
- name: "profile",
4386
- initialState: initialState8,
4387
- reducers: {
4388
- setProfile: (state, action) => {
4389
- state.profile = action.payload;
4390
- }
4391
- }
4392
- });
4393
- var { setProfile } = profileSlice.actions;
4394
- var profile_slice_default = profileSlice.reducer;
4395
-
4396
- // src/store/reducers/search-slice/index.ts
4397
- import { createSlice as createSlice10 } from "@reduxjs/toolkit";
4398
- var initialState9 = {
4399
- groupByDomain: null,
4400
- searchBy: [],
4401
- searchString: "",
4402
- hoveredIndexSearchList: null,
4403
- selectedTags: [],
4404
- firstDomain: null,
4405
- searchMap: {},
4406
- filterBy: [],
4407
- groupBy: []
4408
- };
4409
- var searchSlice = createSlice10({
4410
- name: "search",
4411
- initialState: initialState9,
4412
- reducers: {
4413
- setGroupByDomain: (state, action) => {
4414
- state.groupByDomain = action.payload;
4415
- },
4416
- setSearchBy: (state, action) => {
4417
- state.searchBy = action.payload;
4418
- },
4419
- setSearchString: (state, action) => {
4420
- state.searchString = action.payload;
4421
- },
4422
- setHoveredIndexSearchList: (state, action) => {
4423
- state.hoveredIndexSearchList = action.payload;
4424
- },
4425
- setSelectedTags: (state, action) => {
4426
- state.selectedTags = action.payload;
4427
- },
4428
- setFirstDomain: (state, action) => {
4429
- state.firstDomain = action.payload;
4430
- },
4431
- setFilterBy: (state, action) => {
4432
- state.filterBy = action.payload;
4433
- },
4434
- setGroupBy: (state, action) => {
4435
- state.groupBy = action.payload;
4436
- },
4437
- setSearchMap: (state, action) => {
4438
- state.searchMap = action.payload;
4439
- },
4440
- updateSearchMap: (state, action) => {
4441
- if (!state.searchMap[action.payload.key]) {
4442
- state.searchMap[action.payload.key] = [];
4443
- }
4444
- state.searchMap[action.payload.key].push(action.payload.value);
4445
- },
4446
- removeKeyFromSearchMap: (state, action) => {
4447
- const { key, item } = action.payload;
4448
- const values = state.searchMap[key];
4449
- if (!values) return;
4450
- if (item) {
4451
- const filtered = values.filter((value) => value.name !== item.name);
4452
- if (filtered.length > 0) {
4453
- state.searchMap[key] = filtered;
4454
- } else {
4455
- delete state.searchMap[key];
4456
- }
4457
- } else {
4458
- delete state.searchMap[key];
4459
- }
4460
- },
4461
- clearSearchMap: (state) => {
4462
- state.searchMap = {};
4463
- }
4464
- }
4465
- });
4466
- var {
4467
- setGroupByDomain,
4468
- setSelectedTags,
4469
- setSearchString,
4470
- setHoveredIndexSearchList,
4471
- setFirstDomain,
4472
- setSearchBy,
4473
- setFilterBy,
4474
- setSearchMap,
4475
- updateSearchMap,
4476
- removeKeyFromSearchMap,
4477
- setGroupBy,
4478
- clearSearchMap
4479
- } = searchSlice.actions;
4480
- var search_slice_default = searchSlice.reducer;
4481
-
4482
- // src/store/store.ts
4483
- import { configureStore } from "@reduxjs/toolkit";
4484
-
4485
- // node_modules/redux/dist/redux.mjs
4486
- function formatProdErrorMessage(code) {
4487
- return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
4488
- }
4489
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
4490
- var ActionTypes = {
4491
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
4492
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
4493
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
4494
- };
4495
- var actionTypes_default = ActionTypes;
4496
- function isPlainObject(obj) {
4497
- if (typeof obj !== "object" || obj === null)
4498
- return false;
4499
- let proto = obj;
4500
- while (Object.getPrototypeOf(proto) !== null) {
4501
- proto = Object.getPrototypeOf(proto);
4502
- }
4503
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
4504
- }
4505
- function miniKindOf(val) {
4506
- if (val === void 0)
4507
- return "undefined";
4508
- if (val === null)
4509
- return "null";
4510
- const type = typeof val;
4511
- switch (type) {
4512
- case "boolean":
4513
- case "string":
4514
- case "number":
4515
- case "symbol":
4516
- case "function": {
4517
- return type;
4518
- }
4519
- }
4520
- if (Array.isArray(val))
4521
- return "array";
4522
- if (isDate(val))
4523
- return "date";
4524
- if (isError(val))
4525
- return "error";
4526
- const constructorName = ctorName(val);
4527
- switch (constructorName) {
4528
- case "Symbol":
4529
- case "Promise":
4530
- case "WeakMap":
4531
- case "WeakSet":
4532
- case "Map":
4533
- case "Set":
4534
- return constructorName;
4535
- }
4536
- return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
4537
- }
4538
- function ctorName(val) {
4539
- return typeof val.constructor === "function" ? val.constructor.name : null;
4540
- }
4541
- function isError(val) {
4542
- return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
4543
- }
4544
- function isDate(val) {
4545
- if (val instanceof Date)
4546
- return true;
4547
- return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
4548
- }
4549
- function kindOf(val) {
4550
- let typeOfVal = typeof val;
4551
- if (process.env.NODE_ENV !== "production") {
4552
- typeOfVal = miniKindOf(val);
4553
- }
4554
- return typeOfVal;
4555
- }
4556
- function warning(message) {
4557
- if (typeof console !== "undefined" && typeof console.error === "function") {
4558
- console.error(message);
4559
- }
4560
- try {
4561
- throw new Error(message);
4562
- } catch (e) {
4563
- }
4564
- }
4565
- function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
4566
- const reducerKeys = Object.keys(reducers);
4567
- const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
4568
- if (reducerKeys.length === 0) {
4569
- return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
4570
- }
4571
- if (!isPlainObject(inputState)) {
4572
- return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
4573
- }
4574
- const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
4575
- unexpectedKeys.forEach((key) => {
4576
- unexpectedKeyCache[key] = true;
4577
- });
4578
- if (action && action.type === actionTypes_default.REPLACE)
4579
- return;
4580
- if (unexpectedKeys.length > 0) {
4581
- return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
4582
- }
4583
- }
4584
- function assertReducerShape(reducers) {
4585
- Object.keys(reducers).forEach((key) => {
4586
- const reducer = reducers[key];
4587
- const initialState10 = reducer(void 0, {
4588
- type: actionTypes_default.INIT
4589
- });
4590
- if (typeof initialState10 === "undefined") {
4591
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
4592
- }
4593
- if (typeof reducer(void 0, {
4594
- type: actionTypes_default.PROBE_UNKNOWN_ACTION()
4595
- }) === "undefined") {
4596
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
4597
- }
4598
- });
4599
- }
4600
- function combineReducers(reducers) {
4601
- const reducerKeys = Object.keys(reducers);
4602
- const finalReducers = {};
4603
- for (let i = 0; i < reducerKeys.length; i++) {
4604
- const key = reducerKeys[i];
4605
- if (process.env.NODE_ENV !== "production") {
4606
- if (typeof reducers[key] === "undefined") {
4607
- warning(`No reducer provided for key "${key}"`);
4608
- }
4609
- }
4610
- if (typeof reducers[key] === "function") {
4611
- finalReducers[key] = reducers[key];
4612
- }
4613
- }
4614
- const finalReducerKeys = Object.keys(finalReducers);
4615
- let unexpectedKeyCache;
4616
- if (process.env.NODE_ENV !== "production") {
4617
- unexpectedKeyCache = {};
4618
- }
4619
- let shapeAssertionError;
4620
- try {
4621
- assertReducerShape(finalReducers);
4622
- } catch (e) {
4623
- shapeAssertionError = e;
4624
- }
4625
- return function combination(state = {}, action) {
4626
- if (shapeAssertionError) {
4627
- throw shapeAssertionError;
4628
- }
4629
- if (process.env.NODE_ENV !== "production") {
4630
- const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
4631
- if (warningMessage) {
4632
- warning(warningMessage);
4633
- }
4634
- }
4635
- let hasChanged = false;
4636
- const nextState = {};
4637
- for (let i = 0; i < finalReducerKeys.length; i++) {
4638
- const key = finalReducerKeys[i];
4639
- const reducer = finalReducers[key];
4640
- const previousStateForKey = state[key];
4641
- const nextStateForKey = reducer(previousStateForKey, action);
4642
- if (typeof nextStateForKey === "undefined") {
4643
- const actionType = action && action.type;
4644
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
4645
- }
4646
- nextState[key] = nextStateForKey;
4647
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
4648
- }
4649
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
4650
- return hasChanged ? nextState : state;
4651
- };
4652
- }
4653
-
4654
- // src/store/store.ts
4655
- var rootReducer = combineReducers({
4656
- env: env_slice_default,
4657
- header: header_slice_default,
4658
- navbar: navbar_slice_default,
4659
- list: list_slice_default,
4660
- search: search_slice_default,
4661
- form: form_slice_default,
4662
- breadcrumbs: breadcrums_slice_default,
4663
- login: login_slice_default,
4664
- excel: excel_slice_default,
4665
- profile: profile_slice_default
4666
- });
4667
- var envStore = configureStore({
4668
- reducer: rootReducer,
4669
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
4670
- serializableCheck: false
4671
- })
4672
- });
4673
-
4674
- // src/provider/redux-provider.tsx
4675
- import { jsx as jsx2 } from "react/jsx-runtime";
4676
-
4677
- // src/provider/main-provider.tsx
4678
- import { jsx as jsx3 } from "react/jsx-runtime";
4679
-
4680
- // src/provider/version-gate-provider.tsx
4681
- import { useEffect as useEffect2, useState as useState3 } from "react";
4682
- import { useQueryClient } from "@tanstack/react-query";
4683
-
4684
- // src/services/view-service/backup.ts
4685
- import { useCallback } from "react";
4686
-
4687
- // src/hooks/auth/use-forgot-password.ts
4688
- import { useMutation } from "@tanstack/react-query";
4689
-
4690
- // src/hooks/auth/use-forgotpassword-sso.ts
4691
- import { useMutation as useMutation2 } from "@tanstack/react-query";
4692
-
4693
- // src/hooks/auth/use-get-provider.ts
4694
- import { useMutation as useMutation3 } from "@tanstack/react-query";
4695
-
4696
- // src/hooks/auth/use-isvalid-token.ts
4697
- import { useMutation as useMutation4 } from "@tanstack/react-query";
4698
-
4699
- // src/hooks/auth/use-login-credential.tsx
4700
- import { useMutation as useMutation5 } from "@tanstack/react-query";
4701
-
4702
- // src/provider/env-provider.tsx
4703
- import { createContext, useContext, useState as useState2, useCallback as useCallback2 } from "react";
4704
- import { jsx as jsx4 } from "react/jsx-runtime";
4705
- var initialEnvState = {
4706
- env: null,
4707
- baseUrl: "",
4708
- requests: null,
4709
- companies: [],
4710
- user: {},
4711
- config: null,
4712
- envFile: null,
4713
- defaultCompany: {
4714
- id: null,
4715
- logo: "",
4716
- secondary_color: "",
4717
- primary_color: ""
4718
- },
4719
- context: {
4720
- uid: null,
4721
- allowed_company_ids: [],
4722
- lang: "vi_VN",
4723
- tz: "Asia/Saigon"
4724
- }
4725
- };
4726
- var EnvContext = createContext(null);
4727
- function useEnv() {
4728
- const context = useContext(EnvContext);
4729
- console.log("useEnv context:", context, new Error().stack);
4730
- if (!context) {
4731
- return initialEnvState;
4732
- }
4733
- return context;
4734
- }
4735
-
4736
- // src/hooks/auth/use-login-socical.ts
4737
- import { useMutation as useMutation6 } from "@tanstack/react-query";
4738
-
4739
- // src/hooks/auth/use-reset-password.ts
4740
- import { useMutation as useMutation7 } from "@tanstack/react-query";
4741
-
4742
- // src/hooks/auth/use-reset-password-sso.ts
4743
- import { useMutation as useMutation8 } from "@tanstack/react-query";
4744
-
4745
- // src/hooks/auth/use-update-password.ts
4746
- import { useMutation as useMutation9 } from "@tanstack/react-query";
4747
-
4748
- // src/hooks/auth/use-logout.ts
4749
- import { useMutation as useMutation10 } from "@tanstack/react-query";
4750
-
4751
- // src/hooks/auth/use-get-access-by-code.ts
4752
- import { useMutation as useMutation11 } from "@tanstack/react-query";
4753
-
4754
- // src/hooks/auth/use-validate-action-token.ts
4755
- import { useMutation as useMutation12 } from "@tanstack/react-query";
4756
-
4757
- // src/hooks/company/use-get-company-info.ts
4758
- import { useMutation as useMutation13 } from "@tanstack/react-query";
4759
-
4760
- // src/hooks/company/use-get-current-company.ts
4761
- import { useMutation as useMutation14 } from "@tanstack/react-query";
4762
-
4763
- // src/hooks/company/use-get-list-company.ts
4764
- import { useQuery } from "@tanstack/react-query";
4765
-
4766
- // src/hooks/excel/use-export-excel.ts
4767
- import { useMutation as useMutation15 } from "@tanstack/react-query";
4768
-
4769
- // src/hooks/excel/use-get-field-export.ts
4770
- import { useMutation as useMutation16 } from "@tanstack/react-query";
4771
-
4772
- // src/hooks/excel/use-get-file-excel.ts
4773
- import { useQuery as useQuery2 } from "@tanstack/react-query";
4774
-
4775
- // src/hooks/excel/use-parse-preview.ts
4776
- import { useMutation as useMutation17 } from "@tanstack/react-query";
4777
-
4778
- // src/hooks/excel/use-upload-file.ts
4779
- import { useMutation as useMutation18 } from "@tanstack/react-query";
4780
-
4781
- // src/hooks/excel/use-upload-id-file.ts
4782
- import { useMutation as useMutation19 } from "@tanstack/react-query";
4783
-
4784
- // src/hooks/excel/uss-execute-import.ts
4785
- import { useMutation as useMutation20 } from "@tanstack/react-query";
4786
-
4787
- // src/hooks/form/use-change-status.ts
4788
- import { useMutation as useMutation21 } from "@tanstack/react-query";
4789
-
4790
- // src/hooks/form/use-delete-comment.ts
4791
- import { useMutation as useMutation22 } from "@tanstack/react-query";
4792
-
4793
- // src/hooks/form/use-get-comment.ts
4794
- import { useQuery as useQuery3 } from "@tanstack/react-query";
4795
-
4796
- // src/hooks/form/use-get-form-view.ts
4797
- import { useQuery as useQuery4 } from "@tanstack/react-query";
4798
-
4799
- // src/hooks/form/use-get-image.ts
4800
- import { useQuery as useQuery5 } from "@tanstack/react-query";
4801
-
4802
- // src/hooks/form/use-send-comment.ts
4803
- import { useMutation as useMutation23 } from "@tanstack/react-query";
4804
-
4805
- // src/hooks/form/use-upload-image.ts
4806
- import { useMutation as useMutation24 } from "@tanstack/react-query";
4807
-
4808
- // src/hooks/model/use-delete.ts
4809
- import { useMutation as useMutation25 } from "@tanstack/react-query";
4810
-
4811
- // src/hooks/model/use-get-all.ts
4812
- import { useQuery as useQuery6 } from "@tanstack/react-query";
4813
-
4814
- // src/hooks/model/use-get-conversion-rate.ts
4815
- import { useQuery as useQuery7 } from "@tanstack/react-query";
4816
-
4817
- // src/hooks/model/use-get-currency.ts
4818
- import { useQuery as useQuery8 } from "@tanstack/react-query";
4819
-
4820
- // src/hooks/model/use-get-detail.ts
4821
- import { useMutation as useMutation26 } from "@tanstack/react-query";
4822
-
4823
- // src/hooks/model/use-get-field-onchange.ts
4824
- import { useQuery as useQuery9 } from "@tanstack/react-query";
4825
-
4826
- // src/hooks/model/use-get-list-my-bank-account.ts
4827
- import { useQuery as useQuery10 } from "@tanstack/react-query";
4828
-
4829
- // src/hooks/model/use-onchange-form.ts
4830
- import { useMutation as useMutation27 } from "@tanstack/react-query";
4831
-
4832
- // src/hooks/model/use-save.ts
4833
- import { useMutation as useMutation28 } from "@tanstack/react-query";
4834
-
4835
- // src/hooks/user/use-get-profile.ts
4836
- import { useMutation as useMutation29 } from "@tanstack/react-query";
4837
-
4838
- // src/hooks/user/use-get-user.ts
4839
- import { useMutation as useMutation30 } from "@tanstack/react-query";
4840
-
4841
- // src/hooks/user/use-switch-locale.ts
4842
- import { useMutation as useMutation31 } from "@tanstack/react-query";
4843
-
4844
- // src/hooks/view/use-button.ts
4845
- import { useMutation as useMutation32 } from "@tanstack/react-query";
4846
-
4847
- // src/hooks/view/use-duplicate-record.ts
4848
- import { useMutation as useMutation33 } from "@tanstack/react-query";
4849
-
4850
- // src/hooks/view/use-get-action-detail.ts
4851
- import { useQuery as useQuery11 } from "@tanstack/react-query";
4852
-
4853
- // src/hooks/view/use-get-calendar.ts
4854
- import { useQuery as useQuery12 } from "@tanstack/react-query";
4855
-
4856
- // src/hooks/view/use-get-groups.ts
4857
- import { useQuery as useQuery13 } from "@tanstack/react-query";
4858
-
4859
- // src/hooks/view/use-get-list-data.ts
4860
- import { useQuery as useQuery14 } from "@tanstack/react-query";
4861
-
4862
- // src/hooks/view/use-get-menu.ts
4863
- import { useQuery as useQuery15 } from "@tanstack/react-query";
4864
-
4865
- // src/hooks/view/use-get-print-report.ts
4866
- import { useMutation as useMutation34 } from "@tanstack/react-query";
4867
-
4868
- // src/hooks/view/use-get-progress-bar.ts
4869
- import { useQuery as useQuery16 } from "@tanstack/react-query";
4870
-
4871
- // src/hooks/view/use-get-selection.ts
4872
- import { useQuery as useQuery17 } from "@tanstack/react-query";
4873
-
4874
- // src/hooks/view/use-get-view.ts
4875
- import { useQuery as useQuery18 } from "@tanstack/react-query";
4876
-
4877
- // src/hooks/view/use-load-action.ts
4878
- import { useMutation as useMutation35 } from "@tanstack/react-query";
4879
-
4880
- // src/hooks/view/use-load-message.ts
4881
- import { useQuery as useQuery19 } from "@tanstack/react-query";
4882
-
4883
- // src/hooks/view/use-print.ts
4884
- import { useMutation as useMutation36 } from "@tanstack/react-query";
4885
-
4886
- // src/hooks/view/use-remove-row.ts
4887
- import { useMutation as useMutation37 } from "@tanstack/react-query";
4888
-
4889
- // src/hooks/view/use-resequence.ts
4890
- import { useQuery as useQuery20 } from "@tanstack/react-query";
4891
-
4892
- // src/hooks/view/use-run-action.ts
4893
- import { useMutation as useMutation38 } from "@tanstack/react-query";
4894
-
4895
- // src/hooks/view/use-signin-sso.ts
4896
- import { useMutation as useMutation39 } from "@tanstack/react-query";
4897
-
4898
- // src/hooks/view/use-verify-2FA.ts
4899
- import { useMutation as useMutation40 } from "@tanstack/react-query";
4900
-
4901
- // src/hooks/view/uset-get-2FA-method.ts
4902
- import { useMutation as useMutation41 } from "@tanstack/react-query";
4903
-
4904
- // src/hooks/view/use-get-fields-view-security.ts
4905
- import { useMutation as useMutation42 } from "@tanstack/react-query";
4906
-
4907
- // src/hooks/view/use-grant-access.ts
4908
- import { useMutation as useMutation43 } from "@tanstack/react-query";
4909
-
4910
- // src/hooks/view/use-remove-totp-setup.ts
4911
- import { useMutation as useMutation44 } from "@tanstack/react-query";
4912
-
4913
- // src/hooks/view/use-request-setup-totp.ts
4914
- import { useMutation as useMutation45 } from "@tanstack/react-query";
4915
-
4916
- // src/hooks/view/use-settings-web-read-2fa.ts
4917
- import { useMutation as useMutation46 } from "@tanstack/react-query";
4918
-
4919
- // src/hooks/view/use-verify-totp.ts
4920
- import { useMutation as useMutation47 } from "@tanstack/react-query";
4921
-
4922
- // src/provider/version-gate-provider.tsx
4923
- import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
4924
-
4925
- // src/provider/env-share.tsx
4926
- import { createContext as createContext2, useContext as useContext2 } from "react";
4927
- import { jsx as jsx6 } from "react/jsx-runtime";
4928
- var EnvShareContext = createContext2(null);
4929
-
4930
- // src/services/auth-service/backup.ts
4931
- function useAuthService() {
4932
- const { env: env2 } = useEnv();
4933
- console.log("auth env", env2);
4934
- const login = useCallback3(
4935
- async (body) => {
4936
- const payload = Object.fromEntries(
4937
- Object.entries({
4938
- username: body.email,
4939
- password: body.password,
4940
- grant_type: env2?.config?.grantType || "",
4941
- client_id: env2?.config?.clientId || "",
4942
- client_secret: env2?.config?.clientSecret || ""
4943
- }).filter(([_, value]) => !!value)
4944
- );
4945
- const encodedData = new URLSearchParams(payload).toString();
4946
- return env2?.requests?.post(body.path, encodedData, {
4947
- headers: {
4948
- "Content-Type": "application/x-www-form-urlencoded"
4949
- }
4950
- });
4951
- },
4952
- [env2]
4953
- );
4954
- const forgotPassword = useCallback3(
4955
- async (email) => {
4956
- const bodyData = {
4957
- login: email,
4958
- url: `${window.location.origin}/reset-password`
4959
- };
4960
- return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
4961
- headers: {
4962
- "Content-Type": "application/json"
4963
- }
4964
- });
4965
- },
4966
- [env2]
4967
- );
4968
- const forgotPasswordSSO = useCallback3(
4969
- async ({
4970
- email,
4971
- with_context,
4972
- method
4973
- }) => {
4974
- const body = {
4975
- method,
4976
- kwargs: {
4977
- vals: {
4978
- email
4979
- }
4980
- },
4981
- with_context
4982
- };
4983
- return env2?.requests?.post("/call" /* CALL_PATH */, body, {
4984
- headers: {
4985
- "Content-Type": "application/json"
4986
- }
4987
- });
4988
- },
4989
- [env2]
4990
- );
4991
- const resetPassword = useCallback3(
4992
- async (data, token) => {
4993
- const bodyData = {
4994
- token,
4995
- password: data.password,
4996
- new_password: data.confirmPassword
4997
- };
4998
- return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
4999
- headers: {
5000
- "Content-Type": "application/json"
5001
- }
5002
- });
5003
- },
5004
- [env2]
5005
- );
5006
- const resetPasswordSSO = useCallback3(
5007
- async ({
5008
- method,
5009
- password,
5010
- with_context
5011
- }) => {
5012
- const bodyData = {
5013
- method,
5014
- kwargs: {
5015
- vals: {
5016
- password
5017
- }
5018
- },
5019
- with_context
5020
- };
5021
- return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
5022
- headers: {
5023
- "Content-Type": "application/json"
5024
- }
5025
- });
5026
- },
5027
- [env2]
5028
- );
5029
- const updatePassword = useCallback3(
5030
- async (data, token) => {
5031
- const bodyData = {
5032
- token,
5033
- old_password: data.oldPassword,
5034
- new_password: data.newPassword
5035
- };
5036
- return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
5037
- headers: {
5038
- "Content-Type": "application/json"
5039
- }
5040
- });
5041
- },
5042
- [env2]
5043
- );
5044
- const isValidToken = useCallback3(
5045
- async (token) => {
5046
- const bodyData = {
5047
- token
5048
- };
5049
- return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
5050
- headers: {
5051
- "Content-Type": "application/json"
5052
- }
5053
- });
5054
- },
5055
- [env2]
5056
- );
5057
- const isValidActionToken = useCallback3(
5058
- async (actionToken, path) => {
5059
- return env2?.requests?.post(
5060
- path,
5061
- {},
5062
- {
5063
- headers: {
5064
- "Content-Type": "application/json"
5065
- },
5066
- useActionToken: true,
5067
- actionToken
5068
- }
5069
- );
5070
- },
5071
- [env2]
5072
- );
5073
- const loginSocial = useCallback3(
5074
- async ({
5075
- db,
5076
- state,
5077
- access_token
5078
- }) => {
5079
- return env2?.requests?.post(
5080
- "/token/generate" /* GENTOKEN_SOCIAL */,
5081
- { state, access_token },
5082
- {
5083
- headers: {
5084
- "Content-Type": "application/json"
5085
- }
5086
- }
5087
- );
5088
- },
5089
- [env2]
5090
- );
5091
- const getProviders = useCallback3(
5092
- async (db) => {
5093
- return env2?.requests?.get("/oauth/providers", { params: { db } });
5094
- },
5095
- [env2]
5096
- );
5097
- const getAccessByCode = useCallback3(
5098
- async (code) => {
5099
- const data = new URLSearchParams();
5100
- data.append("code", code);
5101
- data.append("grant_type", "authorization_code");
5102
- data.append("client_id", env2?.config?.clientId || "");
5103
- data.append("redirect_uri", env2?.config?.redirectUri || "");
5104
- return env2?.requests?.post(
5105
- `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
5106
- data,
5107
- {
5108
- headers: {
5109
- "Content-Type": "application/x-www-form-urlencoded"
5110
- }
5111
- }
5112
- );
5113
- },
5114
- [env2]
5115
- );
5116
- const logout = useCallback3(
5117
- async (data) => {
5118
- console.log(data);
5119
- return env2?.requests?.post(
5120
- "/logout" /* LOGOUT */,
5121
- {},
5122
- {
5123
- headers: {
5124
- "Content-Type": "application/json"
5125
- },
5126
- withCredentials: true,
5127
- useRefreshToken: true
5128
- }
5129
- );
5130
- },
5131
- [env2]
5132
- );
5133
- return {
5134
- login,
5135
- forgotPassword,
5136
- forgotPasswordSSO,
5137
- resetPassword,
5138
- resetPasswordSSO,
5139
- updatePassword,
5140
- isValidToken,
5141
- isValidActionToken,
5142
- loginSocial,
5143
- getProviders,
5144
- getAccessByCode,
5145
- logout
5146
- };
5147
- }
5148
4047
  export {
5149
4048
  action_service_default as ActionService,
5150
4049
  auth_service_default as AuthService,
@@ -5154,6 +4053,5 @@ export {
5154
4053
  kanban_service_default as KanbanService,
5155
4054
  model_service_default as ModelService,
5156
4055
  user_service_default as UserService,
5157
- view_service_default as ViewService,
5158
- useAuthService
4056
+ view_service_default as ViewService
5159
4057
  };