@fctc/interface-logic 3.0.2 → 3.0.4

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.
@@ -1,11 +1,11 @@
1
1
  declare const axiosClient: {
2
2
  init(config: any): {
3
- get: (url: string, headers?: any) => Promise<any>;
4
- post: (url: string, body: any, headers?: any) => Promise<any>;
3
+ get: (url: string, headers?: any, hardService?: string) => Promise<any>;
4
+ post: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
5
5
  post_excel: (url: string, body: any, headers?: any) => Promise<any>;
6
- put: (url: string, body: any, headers?: any) => Promise<any>;
7
- patch: (url: string, body: any, headers?: any) => Promise<any>;
8
- delete: (url: string, headers?: any) => Promise<any>;
6
+ put: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
7
+ patch: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
8
+ delete: (url: string, headers?: any, hardService?: string) => Promise<any>;
9
9
  };
10
10
  };
11
11
 
package/dist/configs.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  declare const axiosClient: {
2
2
  init(config: any): {
3
- get: (url: string, headers?: any) => Promise<any>;
4
- post: (url: string, body: any, headers?: any) => Promise<any>;
3
+ get: (url: string, headers?: any, hardService?: string) => Promise<any>;
4
+ post: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
5
5
  post_excel: (url: string, body: any, headers?: any) => Promise<any>;
6
- put: (url: string, body: any, headers?: any) => Promise<any>;
7
- patch: (url: string, body: any, headers?: any) => Promise<any>;
8
- delete: (url: string, headers?: any) => Promise<any>;
6
+ put: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
7
+ patch: (url: string, body: any, headers?: any, hardService?: string) => Promise<any>;
8
+ delete: (url: string, headers?: any, hardService?: string) => Promise<any>;
9
9
  };
10
10
  };
11
11
 
package/dist/configs.js CHANGED
@@ -2402,8 +2402,8 @@ var axiosClient = {
2402
2402
  function formatUrl(url, db2) {
2403
2403
  return url + (db2 ? "?db=" + db2 : "");
2404
2404
  }
2405
- const getBaseUrl = (baseUrl) => {
2406
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
2405
+ const getBaseUrl = (baseUrl, hardService) => {
2406
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
2407
2407
  };
2408
2408
  const getHeaders = (header) => {
2409
2409
  const headers = {
@@ -2414,12 +2414,12 @@ var axiosClient = {
2414
2414
  };
2415
2415
  const responseBody = (response) => response;
2416
2416
  const requests = {
2417
- get: (url, headers) => instance.get(
2418
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2417
+ get: (url, headers, hardService) => instance.get(
2418
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2419
2419
  getHeaders(headers)
2420
2420
  ).then(responseBody),
2421
- post: async (url, body, headers) => instance.post(
2422
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2421
+ post: async (url, body, headers, hardService) => instance.post(
2422
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2423
2423
  body,
2424
2424
  getHeaders(headers)
2425
2425
  ).then(responseBody),
@@ -2431,18 +2431,18 @@ var axiosClient = {
2431
2431
  ...headers
2432
2432
  }
2433
2433
  }).then(responseBody),
2434
- put: (url, body, headers) => instance.put(
2435
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2434
+ put: (url, body, headers, hardService) => instance.put(
2435
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2436
2436
  body,
2437
2437
  getHeaders(headers)
2438
2438
  ).then(responseBody),
2439
- patch: (url, body, headers) => instance.patch(
2440
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2439
+ patch: (url, body, headers, hardService) => instance.patch(
2440
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2441
2441
  body,
2442
2442
  getHeaders(headers)
2443
2443
  ).then(responseBody),
2444
- delete: (url, headers) => instance.delete(
2445
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2444
+ delete: (url, headers, hardService) => instance.delete(
2445
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2446
2446
  getHeaders(headers)
2447
2447
  ).then(responseBody)
2448
2448
  };
package/dist/configs.mjs CHANGED
@@ -2366,8 +2366,8 @@ var axiosClient = {
2366
2366
  function formatUrl(url, db2) {
2367
2367
  return url + (db2 ? "?db=" + db2 : "");
2368
2368
  }
2369
- const getBaseUrl = (baseUrl) => {
2370
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
2369
+ const getBaseUrl = (baseUrl, hardService) => {
2370
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
2371
2371
  };
2372
2372
  const getHeaders = (header) => {
2373
2373
  const headers = {
@@ -2378,12 +2378,12 @@ var axiosClient = {
2378
2378
  };
2379
2379
  const responseBody = (response) => response;
2380
2380
  const requests = {
2381
- get: (url, headers) => instance.get(
2382
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2381
+ get: (url, headers, hardService) => instance.get(
2382
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2383
2383
  getHeaders(headers)
2384
2384
  ).then(responseBody),
2385
- post: async (url, body, headers) => instance.post(
2386
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2385
+ post: async (url, body, headers, hardService) => instance.post(
2386
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2387
2387
  body,
2388
2388
  getHeaders(headers)
2389
2389
  ).then(responseBody),
@@ -2395,18 +2395,18 @@ var axiosClient = {
2395
2395
  ...headers
2396
2396
  }
2397
2397
  }).then(responseBody),
2398
- put: (url, body, headers) => instance.put(
2399
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2398
+ put: (url, body, headers, hardService) => instance.put(
2399
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2400
2400
  body,
2401
2401
  getHeaders(headers)
2402
2402
  ).then(responseBody),
2403
- patch: (url, body, headers) => instance.patch(
2404
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2403
+ patch: (url, body, headers, hardService) => instance.patch(
2404
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2405
2405
  body,
2406
2406
  getHeaders(headers)
2407
2407
  ).then(responseBody),
2408
- delete: (url, headers) => instance.delete(
2409
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2408
+ delete: (url, headers, hardService) => instance.delete(
2409
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2410
2410
  getHeaders(headers)
2411
2411
  ).then(responseBody)
2412
2412
  };
@@ -2404,8 +2404,8 @@ var axiosClient = {
2404
2404
  function formatUrl(url, db2) {
2405
2405
  return url + (db2 ? "?db=" + db2 : "");
2406
2406
  }
2407
- const getBaseUrl = (baseUrl) => {
2408
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
2407
+ const getBaseUrl = (baseUrl, hardService) => {
2408
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
2409
2409
  };
2410
2410
  const getHeaders = (header) => {
2411
2411
  const headers = {
@@ -2416,12 +2416,12 @@ var axiosClient = {
2416
2416
  };
2417
2417
  const responseBody = (response) => response;
2418
2418
  const requests = {
2419
- get: (url, headers) => instance.get(
2420
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2419
+ get: (url, headers, hardService) => instance.get(
2420
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2421
2421
  getHeaders(headers)
2422
2422
  ).then(responseBody),
2423
- post: async (url, body, headers) => instance.post(
2424
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2423
+ post: async (url, body, headers, hardService) => instance.post(
2424
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2425
2425
  body,
2426
2426
  getHeaders(headers)
2427
2427
  ).then(responseBody),
@@ -2433,18 +2433,18 @@ var axiosClient = {
2433
2433
  ...headers
2434
2434
  }
2435
2435
  }).then(responseBody),
2436
- put: (url, body, headers) => instance.put(
2437
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2436
+ put: (url, body, headers, hardService) => instance.put(
2437
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2438
2438
  body,
2439
2439
  getHeaders(headers)
2440
2440
  ).then(responseBody),
2441
- patch: (url, body, headers) => instance.patch(
2442
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2441
+ patch: (url, body, headers, hardService) => instance.patch(
2442
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2443
2443
  body,
2444
2444
  getHeaders(headers)
2445
2445
  ).then(responseBody),
2446
- delete: (url, headers) => instance.delete(
2447
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2446
+ delete: (url, headers, hardService) => instance.delete(
2447
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2448
2448
  getHeaders(headers)
2449
2449
  ).then(responseBody)
2450
2450
  };
@@ -2366,8 +2366,8 @@ var axiosClient = {
2366
2366
  function formatUrl(url, db2) {
2367
2367
  return url + (db2 ? "?db=" + db2 : "");
2368
2368
  }
2369
- const getBaseUrl = (baseUrl) => {
2370
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
2369
+ const getBaseUrl = (baseUrl, hardService) => {
2370
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
2371
2371
  };
2372
2372
  const getHeaders = (header) => {
2373
2373
  const headers = {
@@ -2378,12 +2378,12 @@ var axiosClient = {
2378
2378
  };
2379
2379
  const responseBody = (response) => response;
2380
2380
  const requests = {
2381
- get: (url, headers) => instance.get(
2382
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2381
+ get: (url, headers, hardService) => instance.get(
2382
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2383
2383
  getHeaders(headers)
2384
2384
  ).then(responseBody),
2385
- post: async (url, body, headers) => instance.post(
2386
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2385
+ post: async (url, body, headers, hardService) => instance.post(
2386
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2387
2387
  body,
2388
2388
  getHeaders(headers)
2389
2389
  ).then(responseBody),
@@ -2395,18 +2395,18 @@ var axiosClient = {
2395
2395
  ...headers
2396
2396
  }
2397
2397
  }).then(responseBody),
2398
- put: (url, body, headers) => instance.put(
2399
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2398
+ put: (url, body, headers, hardService) => instance.put(
2399
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2400
2400
  body,
2401
2401
  getHeaders(headers)
2402
2402
  ).then(responseBody),
2403
- patch: (url, body, headers) => instance.patch(
2404
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2403
+ patch: (url, body, headers, hardService) => instance.patch(
2404
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2405
2405
  body,
2406
2406
  getHeaders(headers)
2407
2407
  ).then(responseBody),
2408
- delete: (url, headers) => instance.delete(
2409
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
2408
+ delete: (url, headers, hardService) => instance.delete(
2409
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
2410
2410
  getHeaders(headers)
2411
2411
  ).then(responseBody)
2412
2412
  };
package/dist/hooks.d.mts CHANGED
@@ -44,7 +44,9 @@ declare const useValidateActionToken: () => _tanstack_react_query.UseMutationRes
44
44
 
45
45
  declare const useGetCompanyInfo: () => _tanstack_react_query.UseMutationResult<any, Error, number, unknown>;
46
46
 
47
- declare const useGetCurrentCompany: () => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
47
+ declare const useGetCurrentCompany: ({ service }: {
48
+ service?: string;
49
+ }) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
48
50
 
49
51
  declare const useGetListCompany: (companyIDs?: number[]) => _tanstack_react_query.UseQueryResult<any, Error>;
50
52
 
@@ -224,7 +226,7 @@ declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error,
224
226
  xNode?: string;
225
227
  }, unknown>;
226
228
 
227
- declare const useGetProfile: (path?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
229
+ declare const useGetProfile: (path?: string, service?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
228
230
 
229
231
  declare const useGetUser: () => _tanstack_react_query.UseMutationResult<any, Error, {
230
232
  id: any;
package/dist/hooks.d.ts CHANGED
@@ -44,7 +44,9 @@ declare const useValidateActionToken: () => _tanstack_react_query.UseMutationRes
44
44
 
45
45
  declare const useGetCompanyInfo: () => _tanstack_react_query.UseMutationResult<any, Error, number, unknown>;
46
46
 
47
- declare const useGetCurrentCompany: () => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
47
+ declare const useGetCurrentCompany: ({ service }: {
48
+ service?: string;
49
+ }) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
48
50
 
49
51
  declare const useGetListCompany: (companyIDs?: number[]) => _tanstack_react_query.UseQueryResult<any, Error>;
50
52
 
@@ -224,7 +226,7 @@ declare const useSave: () => _tanstack_react_query.UseMutationResult<any, Error,
224
226
  xNode?: string;
225
227
  }, unknown>;
226
228
 
227
- declare const useGetProfile: (path?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
229
+ declare const useGetProfile: (path?: string, service?: string) => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
228
230
 
229
231
  declare const useGetUser: () => _tanstack_react_query.UseMutationResult<any, Error, {
230
232
  id: any;
package/dist/hooks.js CHANGED
@@ -3387,13 +3387,20 @@ function useAuthService() {
3387
3387
  var import_react8 = require("react");
3388
3388
  function useCompanyService() {
3389
3389
  const { env } = useEnv();
3390
- const getCurrentCompany = (0, import_react8.useCallback)(async () => {
3391
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3392
- headers: {
3393
- "Content-Type": "application/json"
3394
- }
3395
- });
3396
- }, [env]);
3390
+ const getCurrentCompany = (0, import_react8.useCallback)(
3391
+ async (service) => {
3392
+ return await env.requests.get(
3393
+ "/company" /* COMPANY_PATH */,
3394
+ {
3395
+ headers: {
3396
+ "Content-Type": "application/json"
3397
+ }
3398
+ },
3399
+ service
3400
+ );
3401
+ },
3402
+ [env]
3403
+ );
3397
3404
  const getInfoCompany = (0, import_react8.useCallback)(
3398
3405
  async (id) => {
3399
3406
  const jsonData = {
@@ -4254,12 +4261,16 @@ var import_react13 = require("react");
4254
4261
  function useUserService() {
4255
4262
  const { env } = useEnv();
4256
4263
  const getProfile = (0, import_react13.useCallback)(
4257
- async (path) => {
4258
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4259
- headers: {
4260
- "Content-Type": "application/x-www-form-urlencoded"
4261
- }
4262
- });
4264
+ async (path, service) => {
4265
+ return env?.requests?.get(
4266
+ path ?? "/userinfo" /* PROFILE_PATH */,
4267
+ {
4268
+ headers: {
4269
+ "Content-Type": "application/x-www-form-urlencoded"
4270
+ }
4271
+ },
4272
+ service
4273
+ );
4263
4274
  },
4264
4275
  [env]
4265
4276
  );
@@ -5415,10 +5426,10 @@ var use_get_company_info_default = useGetCompanyInfo;
5415
5426
 
5416
5427
  // src/hooks/company/use-get-current-company.ts
5417
5428
  var import_react_query16 = require("@tanstack/react-query");
5418
- var useGetCurrentCompany = () => {
5429
+ var useGetCurrentCompany = ({ service }) => {
5419
5430
  const { getCurrentCompany } = useCompanyService();
5420
5431
  return (0, import_react_query16.useMutation)({
5421
- mutationFn: () => getCurrentCompany()
5432
+ mutationFn: () => getCurrentCompany(service)
5422
5433
  });
5423
5434
  };
5424
5435
  var use_get_current_company_default = useGetCurrentCompany;
@@ -6061,10 +6072,10 @@ var use_save_default = useSave;
6061
6072
 
6062
6073
  // src/hooks/user/use-get-profile.ts
6063
6074
  var import_react_query42 = require("@tanstack/react-query");
6064
- var useGetProfile = (path) => {
6075
+ var useGetProfile = (path, service) => {
6065
6076
  const { getProfile } = useUserService();
6066
6077
  return (0, import_react_query42.useMutation)({
6067
- mutationFn: () => getProfile(path)
6078
+ mutationFn: () => getProfile(path, service)
6068
6079
  });
6069
6080
  };
6070
6081
  var use_get_profile_default = useGetProfile;
package/dist/hooks.mjs CHANGED
@@ -3266,13 +3266,20 @@ function useAuthService() {
3266
3266
  import { useCallback as useCallback4 } from "react";
3267
3267
  function useCompanyService() {
3268
3268
  const { env } = useEnv();
3269
- const getCurrentCompany = useCallback4(async () => {
3270
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3271
- headers: {
3272
- "Content-Type": "application/json"
3273
- }
3274
- });
3275
- }, [env]);
3269
+ const getCurrentCompany = useCallback4(
3270
+ async (service) => {
3271
+ return await env.requests.get(
3272
+ "/company" /* COMPANY_PATH */,
3273
+ {
3274
+ headers: {
3275
+ "Content-Type": "application/json"
3276
+ }
3277
+ },
3278
+ service
3279
+ );
3280
+ },
3281
+ [env]
3282
+ );
3276
3283
  const getInfoCompany = useCallback4(
3277
3284
  async (id) => {
3278
3285
  const jsonData = {
@@ -4133,12 +4140,16 @@ import { useCallback as useCallback9 } from "react";
4133
4140
  function useUserService() {
4134
4141
  const { env } = useEnv();
4135
4142
  const getProfile = useCallback9(
4136
- async (path) => {
4137
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4138
- headers: {
4139
- "Content-Type": "application/x-www-form-urlencoded"
4140
- }
4141
- });
4143
+ async (path, service) => {
4144
+ return env?.requests?.get(
4145
+ path ?? "/userinfo" /* PROFILE_PATH */,
4146
+ {
4147
+ headers: {
4148
+ "Content-Type": "application/x-www-form-urlencoded"
4149
+ }
4150
+ },
4151
+ service
4152
+ );
4142
4153
  },
4143
4154
  [env]
4144
4155
  );
@@ -5294,10 +5305,10 @@ var use_get_company_info_default = useGetCompanyInfo;
5294
5305
 
5295
5306
  // src/hooks/company/use-get-current-company.ts
5296
5307
  import { useMutation as useMutation14 } from "@tanstack/react-query";
5297
- var useGetCurrentCompany = () => {
5308
+ var useGetCurrentCompany = ({ service }) => {
5298
5309
  const { getCurrentCompany } = useCompanyService();
5299
5310
  return useMutation14({
5300
- mutationFn: () => getCurrentCompany()
5311
+ mutationFn: () => getCurrentCompany(service)
5301
5312
  });
5302
5313
  };
5303
5314
  var use_get_current_company_default = useGetCurrentCompany;
@@ -5940,10 +5951,10 @@ var use_save_default = useSave;
5940
5951
 
5941
5952
  // src/hooks/user/use-get-profile.ts
5942
5953
  import { useMutation as useMutation30 } from "@tanstack/react-query";
5943
- var useGetProfile = (path) => {
5954
+ var useGetProfile = (path, service) => {
5944
5955
  const { getProfile } = useUserService();
5945
5956
  return useMutation30({
5946
- mutationFn: () => getProfile(path)
5957
+ mutationFn: () => getProfile(path, service)
5947
5958
  });
5948
5959
  };
5949
5960
  var use_get_profile_default = useGetProfile;
package/dist/provider.js CHANGED
@@ -3386,13 +3386,20 @@ function useAuthService() {
3386
3386
  var import_react4 = require("react");
3387
3387
  function useCompanyService() {
3388
3388
  const { env } = useEnv();
3389
- const getCurrentCompany = (0, import_react4.useCallback)(async () => {
3390
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3391
- headers: {
3392
- "Content-Type": "application/json"
3393
- }
3394
- });
3395
- }, [env]);
3389
+ const getCurrentCompany = (0, import_react4.useCallback)(
3390
+ async (service) => {
3391
+ return await env.requests.get(
3392
+ "/company" /* COMPANY_PATH */,
3393
+ {
3394
+ headers: {
3395
+ "Content-Type": "application/json"
3396
+ }
3397
+ },
3398
+ service
3399
+ );
3400
+ },
3401
+ [env]
3402
+ );
3396
3403
  const getInfoCompany = (0, import_react4.useCallback)(
3397
3404
  async (id) => {
3398
3405
  const jsonData = {
@@ -4253,12 +4260,16 @@ var import_react9 = require("react");
4253
4260
  function useUserService() {
4254
4261
  const { env } = useEnv();
4255
4262
  const getProfile = (0, import_react9.useCallback)(
4256
- async (path) => {
4257
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4258
- headers: {
4259
- "Content-Type": "application/x-www-form-urlencoded"
4260
- }
4261
- });
4263
+ async (path, service) => {
4264
+ return env?.requests?.get(
4265
+ path ?? "/userinfo" /* PROFILE_PATH */,
4266
+ {
4267
+ headers: {
4268
+ "Content-Type": "application/x-www-form-urlencoded"
4269
+ }
4270
+ },
4271
+ service
4272
+ );
4262
4273
  },
4263
4274
  [env]
4264
4275
  );
@@ -5451,8 +5462,8 @@ var axiosClient = {
5451
5462
  function formatUrl(url, db2) {
5452
5463
  return url + (db2 ? "?db=" + db2 : "");
5453
5464
  }
5454
- const getBaseUrl = (baseUrl) => {
5455
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
5465
+ const getBaseUrl = (baseUrl, hardService) => {
5466
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
5456
5467
  };
5457
5468
  const getHeaders = (header) => {
5458
5469
  const headers = {
@@ -5463,12 +5474,12 @@ var axiosClient = {
5463
5474
  };
5464
5475
  const responseBody = (response) => response;
5465
5476
  const requests = {
5466
- get: (url, headers) => instance.get(
5467
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5477
+ get: (url, headers, hardService) => instance.get(
5478
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5468
5479
  getHeaders(headers)
5469
5480
  ).then(responseBody),
5470
- post: async (url, body, headers) => instance.post(
5471
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5481
+ post: async (url, body, headers, hardService) => instance.post(
5482
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5472
5483
  body,
5473
5484
  getHeaders(headers)
5474
5485
  ).then(responseBody),
@@ -5480,18 +5491,18 @@ var axiosClient = {
5480
5491
  ...headers
5481
5492
  }
5482
5493
  }).then(responseBody),
5483
- put: (url, body, headers) => instance.put(
5484
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5494
+ put: (url, body, headers, hardService) => instance.put(
5495
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5485
5496
  body,
5486
5497
  getHeaders(headers)
5487
5498
  ).then(responseBody),
5488
- patch: (url, body, headers) => instance.patch(
5489
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5499
+ patch: (url, body, headers, hardService) => instance.patch(
5500
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5490
5501
  body,
5491
5502
  getHeaders(headers)
5492
5503
  ).then(responseBody),
5493
- delete: (url, headers) => instance.delete(
5494
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5504
+ delete: (url, headers, hardService) => instance.delete(
5505
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5495
5506
  getHeaders(headers)
5496
5507
  ).then(responseBody)
5497
5508
  };
@@ -5796,10 +5807,10 @@ var use_get_company_info_default = useGetCompanyInfo;
5796
5807
 
5797
5808
  // src/hooks/company/use-get-current-company.ts
5798
5809
  var import_react_query16 = require("@tanstack/react-query");
5799
- var useGetCurrentCompany = () => {
5810
+ var useGetCurrentCompany = ({ service }) => {
5800
5811
  const { getCurrentCompany } = useCompanyService();
5801
5812
  return (0, import_react_query16.useMutation)({
5802
- mutationFn: () => getCurrentCompany()
5813
+ mutationFn: () => getCurrentCompany(service)
5803
5814
  });
5804
5815
  };
5805
5816
  var use_get_current_company_default = useGetCurrentCompany;
@@ -6442,10 +6453,10 @@ var use_save_default = useSave;
6442
6453
 
6443
6454
  // src/hooks/user/use-get-profile.ts
6444
6455
  var import_react_query42 = require("@tanstack/react-query");
6445
- var useGetProfile = (path) => {
6456
+ var useGetProfile = (path, service) => {
6446
6457
  const { getProfile } = useUserService();
6447
6458
  return (0, import_react_query42.useMutation)({
6448
- mutationFn: () => getProfile(path)
6459
+ mutationFn: () => getProfile(path, service)
6449
6460
  });
6450
6461
  };
6451
6462
  var use_get_profile_default = useGetProfile;
package/dist/provider.mjs CHANGED
@@ -3343,13 +3343,20 @@ function useAuthService() {
3343
3343
  import { useCallback as useCallback3 } from "react";
3344
3344
  function useCompanyService() {
3345
3345
  const { env } = useEnv();
3346
- const getCurrentCompany = useCallback3(async () => {
3347
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3348
- headers: {
3349
- "Content-Type": "application/json"
3350
- }
3351
- });
3352
- }, [env]);
3346
+ const getCurrentCompany = useCallback3(
3347
+ async (service) => {
3348
+ return await env.requests.get(
3349
+ "/company" /* COMPANY_PATH */,
3350
+ {
3351
+ headers: {
3352
+ "Content-Type": "application/json"
3353
+ }
3354
+ },
3355
+ service
3356
+ );
3357
+ },
3358
+ [env]
3359
+ );
3353
3360
  const getInfoCompany = useCallback3(
3354
3361
  async (id) => {
3355
3362
  const jsonData = {
@@ -4210,12 +4217,16 @@ import { useCallback as useCallback8 } from "react";
4210
4217
  function useUserService() {
4211
4218
  const { env } = useEnv();
4212
4219
  const getProfile = useCallback8(
4213
- async (path) => {
4214
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4215
- headers: {
4216
- "Content-Type": "application/x-www-form-urlencoded"
4217
- }
4218
- });
4220
+ async (path, service) => {
4221
+ return env?.requests?.get(
4222
+ path ?? "/userinfo" /* PROFILE_PATH */,
4223
+ {
4224
+ headers: {
4225
+ "Content-Type": "application/x-www-form-urlencoded"
4226
+ }
4227
+ },
4228
+ service
4229
+ );
4219
4230
  },
4220
4231
  [env]
4221
4232
  );
@@ -5408,8 +5419,8 @@ var axiosClient = {
5408
5419
  function formatUrl(url, db2) {
5409
5420
  return url + (db2 ? "?db=" + db2 : "");
5410
5421
  }
5411
- const getBaseUrl = (baseUrl) => {
5412
- return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${sessionStorage2.getMenuFocus().service || config?.default_service}/api/v2`;
5422
+ const getBaseUrl = (baseUrl, hardService) => {
5423
+ return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
5413
5424
  };
5414
5425
  const getHeaders = (header) => {
5415
5426
  const headers = {
@@ -5420,12 +5431,12 @@ var axiosClient = {
5420
5431
  };
5421
5432
  const responseBody = (response) => response;
5422
5433
  const requests = {
5423
- get: (url, headers) => instance.get(
5424
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5434
+ get: (url, headers, hardService) => instance.get(
5435
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5425
5436
  getHeaders(headers)
5426
5437
  ).then(responseBody),
5427
- post: async (url, body, headers) => instance.post(
5428
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5438
+ post: async (url, body, headers, hardService) => instance.post(
5439
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5429
5440
  body,
5430
5441
  getHeaders(headers)
5431
5442
  ).then(responseBody),
@@ -5437,18 +5448,18 @@ var axiosClient = {
5437
5448
  ...headers
5438
5449
  }
5439
5450
  }).then(responseBody),
5440
- put: (url, body, headers) => instance.put(
5441
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5451
+ put: (url, body, headers, hardService) => instance.put(
5452
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5442
5453
  body,
5443
5454
  getHeaders(headers)
5444
5455
  ).then(responseBody),
5445
- patch: (url, body, headers) => instance.patch(
5446
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5456
+ patch: (url, body, headers, hardService) => instance.patch(
5457
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5447
5458
  body,
5448
5459
  getHeaders(headers)
5449
5460
  ).then(responseBody),
5450
- delete: (url, headers) => instance.delete(
5451
- formatUrl(getBaseUrl(config?.baseUrl) + url, db),
5461
+ delete: (url, headers, hardService) => instance.delete(
5462
+ formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
5452
5463
  getHeaders(headers)
5453
5464
  ).then(responseBody)
5454
5465
  };
@@ -5753,10 +5764,10 @@ var use_get_company_info_default = useGetCompanyInfo;
5753
5764
 
5754
5765
  // src/hooks/company/use-get-current-company.ts
5755
5766
  import { useMutation as useMutation14 } from "@tanstack/react-query";
5756
- var useGetCurrentCompany = () => {
5767
+ var useGetCurrentCompany = ({ service }) => {
5757
5768
  const { getCurrentCompany } = useCompanyService();
5758
5769
  return useMutation14({
5759
- mutationFn: () => getCurrentCompany()
5770
+ mutationFn: () => getCurrentCompany(service)
5760
5771
  });
5761
5772
  };
5762
5773
  var use_get_current_company_default = useGetCurrentCompany;
@@ -6399,10 +6410,10 @@ var use_save_default = useSave;
6399
6410
 
6400
6411
  // src/hooks/user/use-get-profile.ts
6401
6412
  import { useMutation as useMutation30 } from "@tanstack/react-query";
6402
- var useGetProfile = (path) => {
6413
+ var useGetProfile = (path, service) => {
6403
6414
  const { getProfile } = useUserService();
6404
6415
  return useMutation30({
6405
- mutationFn: () => getProfile(path)
6416
+ mutationFn: () => getProfile(path, service)
6406
6417
  });
6407
6418
  };
6408
6419
  var use_get_profile_default = useGetProfile;
@@ -79,7 +79,7 @@ declare function useAuthService(): {
79
79
  };
80
80
 
81
81
  declare function useCompanyService(): {
82
- getCurrentCompany: () => Promise<any>;
82
+ getCurrentCompany: (service?: string) => Promise<any>;
83
83
  getInfoCompany: (id: number) => Promise<any>;
84
84
  };
85
85
 
@@ -223,7 +223,7 @@ declare function useModelService(): {
223
223
  };
224
224
 
225
225
  declare function useUserService(): {
226
- getProfile: (path?: string) => Promise<any>;
226
+ getProfile: (path?: string, service?: string) => Promise<any>;
227
227
  getUser: ({ context, id }: {
228
228
  context: any;
229
229
  id: any;
@@ -79,7 +79,7 @@ declare function useAuthService(): {
79
79
  };
80
80
 
81
81
  declare function useCompanyService(): {
82
- getCurrentCompany: () => Promise<any>;
82
+ getCurrentCompany: (service?: string) => Promise<any>;
83
83
  getInfoCompany: (id: number) => Promise<any>;
84
84
  };
85
85
 
@@ -223,7 +223,7 @@ declare function useModelService(): {
223
223
  };
224
224
 
225
225
  declare function useUserService(): {
226
- getProfile: (path?: string) => Promise<any>;
226
+ getProfile: (path?: string, service?: string) => Promise<any>;
227
227
  getUser: ({ context, id }: {
228
228
  context: any;
229
229
  id: any;
package/dist/services.js CHANGED
@@ -3539,13 +3539,20 @@ function useAuthService() {
3539
3539
  var import_react8 = require("react");
3540
3540
  function useCompanyService() {
3541
3541
  const { env } = useEnv();
3542
- const getCurrentCompany = (0, import_react8.useCallback)(async () => {
3543
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3544
- headers: {
3545
- "Content-Type": "application/json"
3546
- }
3547
- });
3548
- }, [env]);
3542
+ const getCurrentCompany = (0, import_react8.useCallback)(
3543
+ async (service) => {
3544
+ return await env.requests.get(
3545
+ "/company" /* COMPANY_PATH */,
3546
+ {
3547
+ headers: {
3548
+ "Content-Type": "application/json"
3549
+ }
3550
+ },
3551
+ service
3552
+ );
3553
+ },
3554
+ [env]
3555
+ );
3549
3556
  const getInfoCompany = (0, import_react8.useCallback)(
3550
3557
  async (id) => {
3551
3558
  const jsonData = {
@@ -4406,12 +4413,16 @@ var import_react13 = require("react");
4406
4413
  function useUserService() {
4407
4414
  const { env } = useEnv();
4408
4415
  const getProfile = (0, import_react13.useCallback)(
4409
- async (path) => {
4410
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4411
- headers: {
4412
- "Content-Type": "application/x-www-form-urlencoded"
4413
- }
4414
- });
4416
+ async (path, service) => {
4417
+ return env?.requests?.get(
4418
+ path ?? "/userinfo" /* PROFILE_PATH */,
4419
+ {
4420
+ headers: {
4421
+ "Content-Type": "application/x-www-form-urlencoded"
4422
+ }
4423
+ },
4424
+ service
4425
+ );
4415
4426
  },
4416
4427
  [env]
4417
4428
  );
package/dist/services.mjs CHANGED
@@ -3495,13 +3495,20 @@ function useAuthService() {
3495
3495
  import { useCallback as useCallback4 } from "react";
3496
3496
  function useCompanyService() {
3497
3497
  const { env } = useEnv();
3498
- const getCurrentCompany = useCallback4(async () => {
3499
- return await env.requests.get("/company" /* COMPANY_PATH */, {
3500
- headers: {
3501
- "Content-Type": "application/json"
3502
- }
3503
- });
3504
- }, [env]);
3498
+ const getCurrentCompany = useCallback4(
3499
+ async (service) => {
3500
+ return await env.requests.get(
3501
+ "/company" /* COMPANY_PATH */,
3502
+ {
3503
+ headers: {
3504
+ "Content-Type": "application/json"
3505
+ }
3506
+ },
3507
+ service
3508
+ );
3509
+ },
3510
+ [env]
3511
+ );
3505
3512
  const getInfoCompany = useCallback4(
3506
3513
  async (id) => {
3507
3514
  const jsonData = {
@@ -4362,12 +4369,16 @@ import { useCallback as useCallback9 } from "react";
4362
4369
  function useUserService() {
4363
4370
  const { env } = useEnv();
4364
4371
  const getProfile = useCallback9(
4365
- async (path) => {
4366
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4367
- headers: {
4368
- "Content-Type": "application/x-www-form-urlencoded"
4369
- }
4370
- });
4372
+ async (path, service) => {
4373
+ return env?.requests?.get(
4374
+ path ?? "/userinfo" /* PROFILE_PATH */,
4375
+ {
4376
+ headers: {
4377
+ "Content-Type": "application/x-www-form-urlencoded"
4378
+ }
4379
+ },
4380
+ service
4381
+ );
4371
4382
  },
4372
4383
  [env]
4373
4384
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/interface-logic",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",