@fctc/interface-logic 1.10.7 → 1.10.8

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/provider.mjs CHANGED
@@ -3058,6 +3058,11 @@ function matchDomain(record, domain) {
3058
3058
 
3059
3059
  // src/utils/function.ts
3060
3060
  import { useEffect, useState } from "react";
3061
+ var toQueryString = (params) => {
3062
+ return Object.keys(params).map(
3063
+ (key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
3064
+ ).join("&");
3065
+ };
3061
3066
  var isBase64File = (str) => {
3062
3067
  try {
3063
3068
  const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
@@ -3426,6 +3431,157 @@ function getEnv() {
3426
3431
  return env?.getEnv();
3427
3432
  }
3428
3433
 
3434
+ // src/services/action-service/index.ts
3435
+ var ActionService = {
3436
+ // Load Action
3437
+ async loadAction({
3438
+ idAction,
3439
+ context
3440
+ }) {
3441
+ const env2 = getEnv();
3442
+ const jsonData = {
3443
+ action_id: idAction,
3444
+ with_context: {
3445
+ ...context
3446
+ }
3447
+ };
3448
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3449
+ headers: {
3450
+ "Content-Type": "application/json"
3451
+ }
3452
+ });
3453
+ },
3454
+ // Call Button
3455
+ async callButton({
3456
+ model,
3457
+ ids = [],
3458
+ context,
3459
+ method
3460
+ }) {
3461
+ try {
3462
+ const env2 = getEnv();
3463
+ const jsonData = {
3464
+ model,
3465
+ method,
3466
+ ids,
3467
+ with_context: context
3468
+ };
3469
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3470
+ headers: {
3471
+ "Content-Type": "application/json"
3472
+ }
3473
+ });
3474
+ } catch (error) {
3475
+ console.error("Error when calling button action:", error);
3476
+ throw error;
3477
+ }
3478
+ },
3479
+ // remove Row
3480
+ async removeRows({
3481
+ model,
3482
+ ids,
3483
+ context
3484
+ }) {
3485
+ const env2 = getEnv();
3486
+ const jsonData = {
3487
+ model,
3488
+ method: "unlink",
3489
+ ids,
3490
+ with_context: context
3491
+ };
3492
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3493
+ headers: {
3494
+ "Content-Type": "application/json"
3495
+ }
3496
+ });
3497
+ },
3498
+ // Duplicate Model
3499
+ async duplicateRecord({
3500
+ model,
3501
+ id,
3502
+ context
3503
+ }) {
3504
+ const env2 = getEnv();
3505
+ const jsonData = {
3506
+ model,
3507
+ method: "copy",
3508
+ ids: id,
3509
+ with_context: context
3510
+ };
3511
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3512
+ headers: {
3513
+ "Content-Type": "application/json"
3514
+ }
3515
+ });
3516
+ },
3517
+ // Get Print Report
3518
+ async getPrintReportName({ id }) {
3519
+ const env2 = getEnv();
3520
+ const jsonData = {
3521
+ model: "ir.actions.report",
3522
+ method: "web_read",
3523
+ id,
3524
+ kwargs: {
3525
+ specification: {
3526
+ report_name: {}
3527
+ }
3528
+ }
3529
+ };
3530
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3531
+ headers: {
3532
+ "Content-Type": "application/json"
3533
+ }
3534
+ });
3535
+ },
3536
+ //Save Print Invoice
3537
+ async print({ id, report, db }) {
3538
+ const env2 = getEnv();
3539
+ const jsonData = {
3540
+ report,
3541
+ id,
3542
+ type: "pdf",
3543
+ file_response: true,
3544
+ db
3545
+ };
3546
+ const queryString = toQueryString(jsonData);
3547
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3548
+ return env2.requests.get(urlWithParams, {
3549
+ headers: {
3550
+ "Content-Type": "application/json"
3551
+ },
3552
+ responseType: "arraybuffer"
3553
+ });
3554
+ },
3555
+ //Run Action
3556
+ async runAction({
3557
+ idAction,
3558
+ context
3559
+ }) {
3560
+ const env2 = getEnv();
3561
+ const jsonData = {
3562
+ action_id: idAction,
3563
+ with_context: {
3564
+ ...context
3565
+ }
3566
+ // context: {
3567
+ // lang: 'en_US',
3568
+ // tz: 'Asia/Saigon',
3569
+ // uid: 2,
3570
+ // allowed_company_ids: [1],
3571
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3572
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3573
+ // active_model: model,
3574
+ // },
3575
+ };
3576
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3577
+ headers: {
3578
+ "Content-Type": "application/json"
3579
+ }
3580
+ });
3581
+ }
3582
+ };
3583
+ var action_service_default = ActionService;
3584
+
3429
3585
  // src/services/auth-service/index.ts
3430
3586
  var AuthService = {
3431
3587
  async login(body) {
@@ -3942,6 +4098,58 @@ var FormService = {
3942
4098
  };
3943
4099
  var form_service_default = FormService;
3944
4100
 
4101
+ // src/services/kanban-service/index.ts
4102
+ var KanbanServices = {
4103
+ async getGroups({
4104
+ model,
4105
+ width_context
4106
+ }) {
4107
+ const env2 = getEnv();
4108
+ const jsonDataView = {
4109
+ model,
4110
+ method: "web_read_group",
4111
+ kwargs: {
4112
+ domain: [["stage_id.fold", "=", false]],
4113
+ fields: ["color:sum"],
4114
+ groupby: ["stage_id"]
4115
+ },
4116
+ width_context
4117
+ };
4118
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
4119
+ headers: {
4120
+ "Content-Type": "application/json"
4121
+ }
4122
+ });
4123
+ },
4124
+ async getProgressBar({
4125
+ field,
4126
+ color,
4127
+ model,
4128
+ width_context
4129
+ }) {
4130
+ const env2 = getEnv();
4131
+ const jsonDataView = {
4132
+ model,
4133
+ method: "read_progress_bar",
4134
+ kwargs: {
4135
+ domain: [],
4136
+ group_by: "stage_id",
4137
+ progress_bar: {
4138
+ colors: color,
4139
+ field
4140
+ }
4141
+ },
4142
+ width_context
4143
+ };
4144
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
4145
+ headers: {
4146
+ "Content-Type": "application/json"
4147
+ }
4148
+ });
4149
+ }
4150
+ };
4151
+ var kanban_service_default = KanbanServices;
4152
+
3945
4153
  // src/services/model-service/index.ts
3946
4154
  var OBJECT_POSITION = 2;
3947
4155
  var ModelService = {
@@ -4321,131 +4529,578 @@ var UserService = {
4321
4529
  };
4322
4530
  var user_service_default = UserService;
4323
4531
 
4324
- // src/hooks/auth/use-forgot-password.ts
4325
- var useForgotPassword = () => {
4326
- return useMutation({
4327
- mutationFn: (email) => {
4328
- return auth_service_default.forgotPassword(email);
4329
- }
4330
- });
4331
- };
4332
- var use_forgot_password_default = useForgotPassword;
4333
-
4334
- // src/hooks/auth/use-forgotpassword-sso.ts
4335
- import { useMutation as useMutation2 } from "@tanstack/react-query";
4336
- var useForgotPasswordSSO = () => {
4337
- return useMutation2({
4338
- mutationFn: ({
4339
- email,
4340
- with_context,
4341
- method
4342
- }) => {
4343
- return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4344
- }
4345
- });
4346
- };
4347
- var use_forgotpassword_sso_default = useForgotPasswordSSO;
4348
-
4349
- // src/hooks/auth/use-get-provider.ts
4350
- import { useMutation as useMutation3 } from "@tanstack/react-query";
4351
- var useGetProvider = () => {
4352
- return useMutation3({
4353
- mutationFn: (data) => {
4354
- return auth_service_default.getProviders(data?.db);
4355
- }
4356
- });
4357
- };
4358
- var use_get_provider_default = useGetProvider;
4359
-
4360
- // src/hooks/auth/use-isvalid-token.ts
4361
- import { useMutation as useMutation4 } from "@tanstack/react-query";
4362
- var useIsValidToken = () => {
4363
- return useMutation4({
4364
- mutationFn: (token) => {
4365
- return auth_service_default.isValidToken(token);
4366
- }
4367
- });
4368
- };
4369
- var use_isvalid_token_default = useIsValidToken;
4370
-
4371
- // src/hooks/auth/use-login-credential.tsx
4372
- import { useMutation as useMutation5 } from "@tanstack/react-query";
4373
-
4374
- // src/services/auth-service/backup.ts
4375
- import { useCallback as useCallback2 } from "react";
4376
- function useAuthService() {
4377
- const { env: env2 } = useEnv();
4378
- const login = useCallback2(
4379
- async (body) => {
4380
- const payload = Object.fromEntries(
4381
- Object.entries({
4382
- username: body.email,
4383
- password: body.password,
4384
- grant_type: env2?.config?.grantType || "",
4385
- client_id: env2?.config?.clientId || "",
4386
- client_secret: env2?.config?.clientSecret || ""
4387
- }).filter(([_, value]) => !!value)
4388
- );
4389
- const encodedData = new URLSearchParams(payload).toString();
4390
- return env2?.requests?.post(body.path, encodedData, {
4391
- headers: {
4392
- "Content-Type": "application/x-www-form-urlencoded"
4393
- }
4394
- });
4395
- },
4396
- [env2]
4397
- );
4398
- const forgotPassword = useCallback2(
4399
- async (email) => {
4400
- const bodyData = {
4401
- login: email,
4402
- url: `${window.location.origin}/reset-password`
4403
- };
4404
- return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
4405
- headers: {
4406
- "Content-Type": "application/json"
4407
- }
4408
- });
4409
- },
4410
- [env2]
4411
- );
4412
- const forgotPasswordSSO = useCallback2(
4413
- async ({
4414
- email,
4415
- with_context,
4416
- method
4417
- }) => {
4418
- const body = {
4419
- method,
4420
- kwargs: {
4421
- vals: {
4422
- email
4423
- }
4424
- },
4425
- with_context
4426
- };
4427
- return env2?.requests?.post("/call" /* CALL_PATH */, body, {
4428
- headers: {
4429
- "Content-Type": "application/json"
4430
- }
4431
- });
4432
- },
4433
- [env2]
4434
- );
4435
- const resetPassword = useCallback2(
4436
- async (data, token) => {
4437
- const bodyData = {
4438
- token,
4439
- password: data.password,
4440
- new_password: data.confirmPassword
4441
- };
4442
- return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
4443
- headers: {
4444
- "Content-Type": "application/json"
4445
- }
4446
- });
4447
- },
4448
- [env2]
4532
+ // src/services/view-service/index.ts
4533
+ var ViewService = {
4534
+ async getView({
4535
+ model,
4536
+ views,
4537
+ context = {},
4538
+ options = {},
4539
+ aid
4540
+ }) {
4541
+ const env2 = getEnv();
4542
+ const defaultOptions = {
4543
+ load_filters: true,
4544
+ toolbar: true,
4545
+ action_id: aid
4546
+ };
4547
+ const jsonDataView = {
4548
+ model,
4549
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4550
+ kwargs: {
4551
+ views,
4552
+ options: { ...options, ...defaultOptions }
4553
+ },
4554
+ with_context: context
4555
+ };
4556
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4557
+ headers: {
4558
+ "Content-Type": "application/json"
4559
+ }
4560
+ });
4561
+ },
4562
+ async getMenu(context) {
4563
+ const env2 = getEnv();
4564
+ const jsonData = {
4565
+ model: "ir.ui.menu" /* MENU */,
4566
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4567
+ ids: [],
4568
+ with_context: context,
4569
+ kwargs: {
4570
+ specification: {
4571
+ active: {},
4572
+ name: {},
4573
+ is_display: {},
4574
+ sequence: {},
4575
+ complete_name: {},
4576
+ action: {
4577
+ fields: {
4578
+ display_name: {},
4579
+ type: {},
4580
+ binding_view_types: {}
4581
+ // res_model: {},
4582
+ }
4583
+ },
4584
+ url_icon: {},
4585
+ web_icon: {},
4586
+ web_icon_data: {},
4587
+ groups_id: {
4588
+ fields: {
4589
+ full_name: {}
4590
+ },
4591
+ limit: 40,
4592
+ order: ""
4593
+ },
4594
+ display_name: {},
4595
+ child_id: {
4596
+ fields: {
4597
+ active: {},
4598
+ name: {},
4599
+ is_display: {},
4600
+ sequence: {},
4601
+ complete_name: {},
4602
+ action: {
4603
+ fields: {
4604
+ display_name: {},
4605
+ type: {},
4606
+ binding_view_types: {}
4607
+ // res_model: {},
4608
+ }
4609
+ },
4610
+ url_icon: {},
4611
+ web_icon: {},
4612
+ web_icon_data: {},
4613
+ groups_id: {
4614
+ fields: {
4615
+ full_name: {}
4616
+ },
4617
+ limit: 40,
4618
+ order: ""
4619
+ },
4620
+ display_name: {},
4621
+ child_id: {
4622
+ fields: {
4623
+ active: {},
4624
+ name: {},
4625
+ is_display: {},
4626
+ sequence: {},
4627
+ complete_name: {},
4628
+ action: {
4629
+ fields: {
4630
+ display_name: {},
4631
+ type: {},
4632
+ binding_view_types: {}
4633
+ // res_model: {},
4634
+ }
4635
+ },
4636
+ url_icon: {},
4637
+ web_icon: {},
4638
+ web_icon_data: {},
4639
+ groups_id: {
4640
+ fields: {
4641
+ full_name: {}
4642
+ },
4643
+ limit: 40,
4644
+ order: ""
4645
+ },
4646
+ display_name: {},
4647
+ child_id: {
4648
+ fields: {
4649
+ active: {},
4650
+ name: {},
4651
+ is_display: {},
4652
+ sequence: {},
4653
+ complete_name: {},
4654
+ action: {
4655
+ fields: {
4656
+ display_name: {},
4657
+ type: {},
4658
+ binding_view_types: {}
4659
+ // res_model: {},
4660
+ }
4661
+ },
4662
+ url_icon: {},
4663
+ web_icon: {},
4664
+ web_icon_data: {},
4665
+ groups_id: {
4666
+ fields: {
4667
+ full_name: {}
4668
+ },
4669
+ limit: 40,
4670
+ order: ""
4671
+ },
4672
+ display_name: {},
4673
+ child_id: {
4674
+ fields: {},
4675
+ limit: 40,
4676
+ order: ""
4677
+ }
4678
+ },
4679
+ limit: 40,
4680
+ order: ""
4681
+ }
4682
+ },
4683
+ limit: 40,
4684
+ order: ""
4685
+ }
4686
+ },
4687
+ limit: 40,
4688
+ order: ""
4689
+ }
4690
+ },
4691
+ domain: [
4692
+ "&",
4693
+ ["is_display", "=", true],
4694
+ "&",
4695
+ ["active", "=", true],
4696
+ ["parent_id", "=", false]
4697
+ ]
4698
+ }
4699
+ };
4700
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4701
+ headers: {
4702
+ "Content-Type": "application/json"
4703
+ }
4704
+ });
4705
+ },
4706
+ async getActionDetail(aid, context) {
4707
+ const env2 = getEnv();
4708
+ const jsonData = {
4709
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4710
+ method: "web_read" /* WEB_READ */,
4711
+ ids: [aid],
4712
+ with_context: context,
4713
+ kwargs: {
4714
+ specification: {
4715
+ id: {},
4716
+ name: {},
4717
+ res_model: {},
4718
+ views: {},
4719
+ view_mode: {},
4720
+ mobile_view_mode: {},
4721
+ domain: {},
4722
+ context: {},
4723
+ groups_id: {},
4724
+ search_view_id: {}
4725
+ }
4726
+ }
4727
+ };
4728
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4729
+ headers: {
4730
+ "Content-Type": "application/json"
4731
+ }
4732
+ });
4733
+ },
4734
+ async getResequence({
4735
+ model,
4736
+ ids,
4737
+ context,
4738
+ offset
4739
+ }) {
4740
+ const env2 = getEnv();
4741
+ const jsonData = {
4742
+ model,
4743
+ with_context: context,
4744
+ ids,
4745
+ field: "sequence",
4746
+ ...offset > 0 ? { offset } : {}
4747
+ };
4748
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4749
+ headers: {
4750
+ "Content-Type": "application/json"
4751
+ }
4752
+ });
4753
+ },
4754
+ async getSelectionItem({ data }) {
4755
+ const env2 = getEnv();
4756
+ const jsonData = {
4757
+ model: data.model,
4758
+ ids: [],
4759
+ method: "get_data_select",
4760
+ with_context: data.context,
4761
+ kwargs: {
4762
+ count_limit: 10001,
4763
+ domain: data.domain ? data.domain : [],
4764
+ offset: 0,
4765
+ order: "",
4766
+ specification: data?.specification ?? {
4767
+ id: {},
4768
+ name: {},
4769
+ display_name: {}
4770
+ }
4771
+ }
4772
+ };
4773
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4774
+ headers: {
4775
+ "Content-Type": "application/json"
4776
+ }
4777
+ });
4778
+ },
4779
+ async loadMessages() {
4780
+ const env2 = getEnv();
4781
+ return env2.requests.post(
4782
+ "/load_message_failures" /* LOAD_MESSAGE */,
4783
+ {},
4784
+ {
4785
+ headers: {
4786
+ "Content-Type": "application/json"
4787
+ }
4788
+ }
4789
+ );
4790
+ },
4791
+ async getVersion() {
4792
+ const env2 = getEnv();
4793
+ console.log("env?.requests", env2, env2?.requests);
4794
+ return env2?.requests?.get("", {
4795
+ headers: {
4796
+ "Content-Type": "application/json"
4797
+ }
4798
+ });
4799
+ },
4800
+ async get2FAMethods({
4801
+ method,
4802
+ with_context
4803
+ }) {
4804
+ const env2 = getEnv();
4805
+ const jsonData = {
4806
+ method,
4807
+ with_context
4808
+ };
4809
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4810
+ headers: {
4811
+ "Content-Type": "application/json"
4812
+ }
4813
+ });
4814
+ },
4815
+ async verify2FA({
4816
+ method,
4817
+ with_context,
4818
+ code,
4819
+ device,
4820
+ location
4821
+ }) {
4822
+ const env2 = getEnv();
4823
+ const jsonData = {
4824
+ method,
4825
+ kwargs: {
4826
+ vals: {
4827
+ code,
4828
+ device,
4829
+ location
4830
+ }
4831
+ },
4832
+ with_context
4833
+ };
4834
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4835
+ headers: {
4836
+ "Content-Type": "application/json"
4837
+ },
4838
+ withCredentials: true
4839
+ });
4840
+ },
4841
+ async signInSSO({
4842
+ redirect_uri,
4843
+ state,
4844
+ client_id,
4845
+ response_type,
4846
+ path
4847
+ }) {
4848
+ const env2 = getEnv();
4849
+ const params = new URLSearchParams({
4850
+ response_type,
4851
+ client_id,
4852
+ redirect_uri,
4853
+ state
4854
+ });
4855
+ const url = `${path}?${params.toString()}`;
4856
+ return env2?.requests.get(url, {
4857
+ headers: {
4858
+ "Content-Type": "application/json"
4859
+ },
4860
+ withCredentials: true
4861
+ });
4862
+ },
4863
+ async grantAccess({
4864
+ redirect_uri,
4865
+ state,
4866
+ client_id,
4867
+ scopes
4868
+ }) {
4869
+ const env2 = getEnv();
4870
+ const jsonData = {
4871
+ redirect_uri,
4872
+ state,
4873
+ client_id,
4874
+ scopes
4875
+ };
4876
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4877
+ headers: {
4878
+ "Content-Type": "application/json"
4879
+ },
4880
+ withCredentials: true
4881
+ });
4882
+ },
4883
+ async getFieldsViewSecurity({
4884
+ method,
4885
+ token,
4886
+ views
4887
+ }) {
4888
+ const env2 = getEnv();
4889
+ const jsonData = {
4890
+ method,
4891
+ kwargs: {
4892
+ views
4893
+ },
4894
+ with_context: {
4895
+ token
4896
+ }
4897
+ };
4898
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4899
+ headers: {
4900
+ "Content-Type": "application/json"
4901
+ }
4902
+ });
4903
+ },
4904
+ async settingsWebRead2fa({
4905
+ method,
4906
+ model,
4907
+ kwargs,
4908
+ token
4909
+ }) {
4910
+ const env2 = getEnv();
4911
+ const jsonData = {
4912
+ method,
4913
+ model,
4914
+ kwargs,
4915
+ with_context: {
4916
+ token
4917
+ }
4918
+ };
4919
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4920
+ headers: {
4921
+ "Content-Type": "application/json"
4922
+ }
4923
+ });
4924
+ },
4925
+ async requestSetupTotp({ method, token }) {
4926
+ const env2 = getEnv();
4927
+ const jsonData = {
4928
+ method,
4929
+ with_context: {
4930
+ token
4931
+ }
4932
+ };
4933
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4934
+ headers: {
4935
+ "Content-Type": "application/json"
4936
+ }
4937
+ });
4938
+ },
4939
+ async verifyTotp({
4940
+ method,
4941
+ action_token,
4942
+ code
4943
+ }) {
4944
+ const env2 = getEnv();
4945
+ const jsonData = {
4946
+ method,
4947
+ kwargs: {
4948
+ vals: {
4949
+ code
4950
+ }
4951
+ },
4952
+ with_context: {
4953
+ action_token
4954
+ }
4955
+ };
4956
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4957
+ headers: {
4958
+ "Content-Type": "application/json"
4959
+ }
4960
+ });
4961
+ },
4962
+ async removeTotpSetUp({ method, token }) {
4963
+ const env2 = getEnv();
4964
+ const jsonData = {
4965
+ method,
4966
+ with_context: {
4967
+ token
4968
+ }
4969
+ };
4970
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4971
+ headers: {
4972
+ "Content-Type": "application/json"
4973
+ }
4974
+ });
4975
+ }
4976
+ };
4977
+ var view_service_default = ViewService;
4978
+
4979
+ // src/hooks/auth/use-forgot-password.ts
4980
+ var useForgotPassword = () => {
4981
+ return useMutation({
4982
+ mutationFn: (email) => {
4983
+ return auth_service_default.forgotPassword(email);
4984
+ }
4985
+ });
4986
+ };
4987
+ var use_forgot_password_default = useForgotPassword;
4988
+
4989
+ // src/hooks/auth/use-forgotpassword-sso.ts
4990
+ import { useMutation as useMutation2 } from "@tanstack/react-query";
4991
+ var useForgotPasswordSSO = () => {
4992
+ return useMutation2({
4993
+ mutationFn: ({
4994
+ email,
4995
+ with_context,
4996
+ method
4997
+ }) => {
4998
+ return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4999
+ }
5000
+ });
5001
+ };
5002
+ var use_forgotpassword_sso_default = useForgotPasswordSSO;
5003
+
5004
+ // src/hooks/auth/use-get-provider.ts
5005
+ import { useMutation as useMutation3 } from "@tanstack/react-query";
5006
+ var useGetProvider = () => {
5007
+ return useMutation3({
5008
+ mutationFn: (data) => {
5009
+ return auth_service_default.getProviders(data?.db);
5010
+ }
5011
+ });
5012
+ };
5013
+ var use_get_provider_default = useGetProvider;
5014
+
5015
+ // src/hooks/auth/use-isvalid-token.ts
5016
+ import { useMutation as useMutation4 } from "@tanstack/react-query";
5017
+ var useIsValidToken = () => {
5018
+ return useMutation4({
5019
+ mutationFn: (token) => {
5020
+ return auth_service_default.isValidToken(token);
5021
+ }
5022
+ });
5023
+ };
5024
+ var use_isvalid_token_default = useIsValidToken;
5025
+
5026
+ // src/hooks/auth/use-login-credential.tsx
5027
+ import { useMutation as useMutation5 } from "@tanstack/react-query";
5028
+
5029
+ // src/services/auth-service/backup.ts
5030
+ import { useCallback as useCallback2 } from "react";
5031
+ function useAuthService() {
5032
+ const { env: env2 } = useEnv();
5033
+ const login = useCallback2(
5034
+ async (body) => {
5035
+ const payload = Object.fromEntries(
5036
+ Object.entries({
5037
+ username: body.email,
5038
+ password: body.password,
5039
+ grant_type: env2?.config?.grantType || "",
5040
+ client_id: env2?.config?.clientId || "",
5041
+ client_secret: env2?.config?.clientSecret || ""
5042
+ }).filter(([_, value]) => !!value)
5043
+ );
5044
+ const encodedData = new URLSearchParams(payload).toString();
5045
+ return env2?.requests?.post(body.path, encodedData, {
5046
+ headers: {
5047
+ "Content-Type": "application/x-www-form-urlencoded"
5048
+ }
5049
+ });
5050
+ },
5051
+ [env2]
5052
+ );
5053
+ const forgotPassword = useCallback2(
5054
+ async (email) => {
5055
+ const bodyData = {
5056
+ login: email,
5057
+ url: `${window.location.origin}/reset-password`
5058
+ };
5059
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
5060
+ headers: {
5061
+ "Content-Type": "application/json"
5062
+ }
5063
+ });
5064
+ },
5065
+ [env2]
5066
+ );
5067
+ const forgotPasswordSSO = useCallback2(
5068
+ async ({
5069
+ email,
5070
+ with_context,
5071
+ method
5072
+ }) => {
5073
+ const body = {
5074
+ method,
5075
+ kwargs: {
5076
+ vals: {
5077
+ email
5078
+ }
5079
+ },
5080
+ with_context
5081
+ };
5082
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
5083
+ headers: {
5084
+ "Content-Type": "application/json"
5085
+ }
5086
+ });
5087
+ },
5088
+ [env2]
5089
+ );
5090
+ const resetPassword = useCallback2(
5091
+ async (data, token) => {
5092
+ const bodyData = {
5093
+ token,
5094
+ password: data.password,
5095
+ new_password: data.confirmPassword
5096
+ };
5097
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
5098
+ headers: {
5099
+ "Content-Type": "application/json"
5100
+ }
5101
+ });
5102
+ },
5103
+ [env2]
4449
5104
  );
4450
5105
  const resetPasswordSSO = useCallback2(
4451
5106
  async ({
@@ -5425,81 +6080,480 @@ var use_switch_locale_default = useSwitchLocale;
5425
6080
 
5426
6081
  // src/hooks/view/use-button.ts
5427
6082
  import { useMutation as useMutation32 } from "@tanstack/react-query";
6083
+ var useButton = () => {
6084
+ return useMutation32({
6085
+ mutationFn: ({
6086
+ model,
6087
+ ids,
6088
+ context,
6089
+ method
6090
+ }) => action_service_default.callButton({
6091
+ model,
6092
+ ids,
6093
+ context,
6094
+ method
6095
+ }),
6096
+ onSuccess: (response) => {
6097
+ return response;
6098
+ }
6099
+ });
6100
+ };
6101
+ var use_button_default = useButton;
5428
6102
 
5429
6103
  // src/hooks/view/use-duplicate-record.ts
5430
6104
  import { useMutation as useMutation33 } from "@tanstack/react-query";
6105
+ var useDuplicateRecord = () => {
6106
+ return useMutation33({
6107
+ mutationFn: ({
6108
+ id,
6109
+ model,
6110
+ context
6111
+ }) => action_service_default.duplicateRecord({
6112
+ id,
6113
+ model,
6114
+ context
6115
+ })
6116
+ });
6117
+ };
6118
+ var use_duplicate_record_default = useDuplicateRecord;
5431
6119
 
5432
6120
  // src/hooks/view/use-get-action-detail.ts
5433
6121
  import { useQuery as useQuery11 } from "@tanstack/react-query";
6122
+ var useGetActionDetail = ({
6123
+ aid,
6124
+ context,
6125
+ enabled,
6126
+ id,
6127
+ model,
6128
+ queryKey
6129
+ }) => {
6130
+ const data = {
6131
+ id,
6132
+ model: model ?? "",
6133
+ context
6134
+ };
6135
+ return useQuery11({
6136
+ queryKey,
6137
+ queryFn: async () => {
6138
+ if (aid) {
6139
+ const res = await view_service_default.getActionDetail(aid, context);
6140
+ if (res && res.length > 0) {
6141
+ return res[0];
6142
+ }
6143
+ } else {
6144
+ const res = await form_service_default.getFormView({ data });
6145
+ return res;
6146
+ }
6147
+ },
6148
+ enabled,
6149
+ refetchOnWindowFocus: false,
6150
+ staleTime: Infinity
6151
+ });
6152
+ };
6153
+ var use_get_action_detail_default = useGetActionDetail;
5434
6154
 
5435
6155
  // src/hooks/view/use-get-calendar.ts
5436
6156
  import { useQuery as useQuery12 } from "@tanstack/react-query";
6157
+ var useGetCalendar = (listDataProps, queryKey, enabled) => {
6158
+ return useQuery12({
6159
+ queryKey,
6160
+ queryFn: () => model_service_default.getListCalendar({ data: listDataProps }).then((res) => {
6161
+ if (res) {
6162
+ return res;
6163
+ }
6164
+ return [];
6165
+ }),
6166
+ enabled,
6167
+ refetchOnWindowFocus: false,
6168
+ staleTime: 0
6169
+ });
6170
+ };
6171
+ var use_get_calendar_default = useGetCalendar;
5437
6172
 
5438
6173
  // src/hooks/view/use-get-groups.ts
5439
6174
  import { useQuery as useQuery13 } from "@tanstack/react-query";
6175
+ var useGetGroups = ({
6176
+ model,
6177
+ width_context
6178
+ }) => {
6179
+ return useQuery13({
6180
+ queryKey: [model, width_context],
6181
+ queryFn: () => kanban_service_default.getGroups({
6182
+ model,
6183
+ width_context
6184
+ }).then((res) => {
6185
+ if (res) {
6186
+ return res;
6187
+ }
6188
+ return [];
6189
+ }),
6190
+ refetchOnWindowFocus: false
6191
+ });
6192
+ };
6193
+ var use_get_groups_default = useGetGroups;
5440
6194
 
5441
6195
  // src/hooks/view/use-get-list-data.ts
5442
6196
  import { useQuery as useQuery14 } from "@tanstack/react-query";
6197
+ var useGetListData = (listDataProps, queryKey, enabled) => {
6198
+ return useQuery14({
6199
+ queryKey,
6200
+ queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
6201
+ if (res) {
6202
+ return res;
6203
+ }
6204
+ return [];
6205
+ }),
6206
+ enabled,
6207
+ refetchOnWindowFocus: false,
6208
+ staleTime: 0
6209
+ });
6210
+ };
6211
+ var use_get_list_data_default = useGetListData;
5443
6212
 
5444
6213
  // src/hooks/view/use-get-menu.ts
5445
6214
  import { useQuery as useQuery15 } from "@tanstack/react-query";
6215
+ var useGetMenu = (context, enabled) => {
6216
+ return useQuery15({
6217
+ queryKey: ["menus" /* MENU */, context],
6218
+ queryFn: () => view_service_default.getMenu(context).then((res) => {
6219
+ if (res && res?.records && res?.records?.length > 0) {
6220
+ return res?.records;
6221
+ }
6222
+ return [];
6223
+ }),
6224
+ refetchOnWindowFocus: false,
6225
+ staleTime: Infinity,
6226
+ enabled
6227
+ });
6228
+ };
6229
+ var use_get_menu_default = useGetMenu;
5446
6230
 
5447
6231
  // src/hooks/view/use-get-print-report.ts
5448
6232
  import { useMutation as useMutation34 } from "@tanstack/react-query";
6233
+ var useGetPrintReport = () => {
6234
+ return useMutation34({
6235
+ mutationFn: ({ id }) => action_service_default.getPrintReportName({
6236
+ id
6237
+ })
6238
+ });
6239
+ };
6240
+ var use_get_print_report_default = useGetPrintReport;
5449
6241
 
5450
6242
  // src/hooks/view/use-get-progress-bar.ts
5451
6243
  import { useQuery as useQuery16 } from "@tanstack/react-query";
6244
+ var useGetProGressBar = ({
6245
+ field,
6246
+ color,
6247
+ model,
6248
+ width_context
6249
+ }) => {
6250
+ return useQuery16({
6251
+ queryKey: [],
6252
+ queryFn: () => kanban_service_default.getProgressBar({
6253
+ field,
6254
+ color,
6255
+ model,
6256
+ width_context
6257
+ }).then((res) => {
6258
+ if (res) {
6259
+ return res;
6260
+ }
6261
+ return [];
6262
+ }),
6263
+ refetchOnWindowFocus: false
6264
+ });
6265
+ };
6266
+ var use_get_progress_bar_default = useGetProGressBar;
5452
6267
 
5453
6268
  // src/hooks/view/use-get-selection.ts
5454
6269
  import { useQuery as useQuery17 } from "@tanstack/react-query";
6270
+ var useGetSelection = ({
6271
+ data,
6272
+ queryKey,
6273
+ enabled
6274
+ }) => {
6275
+ return useQuery17({
6276
+ queryKey,
6277
+ queryFn: () => view_service_default.getSelectionItem({ data }),
6278
+ enabled,
6279
+ refetchOnWindowFocus: false
6280
+ });
6281
+ };
6282
+ var use_get_selection_default = useGetSelection;
5455
6283
 
5456
6284
  // src/hooks/view/use-get-view.ts
5457
6285
  import { useQuery as useQuery18 } from "@tanstack/react-query";
6286
+ var useGetView = (viewParams, actData) => {
6287
+ return useQuery18({
6288
+ queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
6289
+ queryFn: () => view_service_default.getView(viewParams),
6290
+ enabled: !!actData,
6291
+ refetchOnWindowFocus: false,
6292
+ staleTime: Infinity
6293
+ });
6294
+ };
6295
+ var use_get_view_default = useGetView;
5458
6296
 
5459
6297
  // src/hooks/view/use-load-action.ts
5460
6298
  import { useMutation as useMutation35 } from "@tanstack/react-query";
6299
+ var useLoadAction = () => {
6300
+ return useMutation35({
6301
+ mutationFn: ({
6302
+ idAction,
6303
+ context
6304
+ }) => {
6305
+ return action_service_default.loadAction({
6306
+ idAction,
6307
+ context
6308
+ });
6309
+ }
6310
+ });
6311
+ };
6312
+ var use_load_action_default = useLoadAction;
5461
6313
 
5462
6314
  // src/hooks/view/use-load-message.ts
5463
6315
  import { useQuery as useQuery19 } from "@tanstack/react-query";
6316
+ var useLoadMessage = () => {
6317
+ return useQuery19({
6318
+ queryKey: [`load-message-failure`],
6319
+ queryFn: () => view_service_default.loadMessages(),
6320
+ refetchOnWindowFocus: false
6321
+ });
6322
+ };
6323
+ var use_load_message_default = useLoadMessage;
5464
6324
 
5465
6325
  // src/hooks/view/use-print.ts
5466
6326
  import { useMutation as useMutation36 } from "@tanstack/react-query";
6327
+ var usePrint = () => {
6328
+ return useMutation36({
6329
+ mutationFn: ({ id, report, db }) => action_service_default.print({
6330
+ id,
6331
+ report,
6332
+ db
6333
+ })
6334
+ });
6335
+ };
6336
+ var use_print_default = usePrint;
5467
6337
 
5468
6338
  // src/hooks/view/use-remove-row.ts
5469
6339
  import { useMutation as useMutation37 } from "@tanstack/react-query";
6340
+ var useRemoveRow = () => {
6341
+ return useMutation37({
6342
+ mutationFn: ({
6343
+ model,
6344
+ ids,
6345
+ context
6346
+ }) => action_service_default.removeRows({
6347
+ model,
6348
+ ids,
6349
+ context
6350
+ })
6351
+ });
6352
+ };
6353
+ var use_remove_row_default = useRemoveRow;
5470
6354
 
5471
6355
  // src/hooks/view/use-resequence.ts
5472
6356
  import { useQuery as useQuery20 } from "@tanstack/react-query";
6357
+ var useGetResequence = (model, resIds, context, offset) => {
6358
+ return useQuery20({
6359
+ queryKey: [],
6360
+ queryFn: () => view_service_default.getResequence({
6361
+ model,
6362
+ ids: resIds,
6363
+ context,
6364
+ offset
6365
+ }),
6366
+ enabled: false,
6367
+ refetchOnWindowFocus: false
6368
+ });
6369
+ };
6370
+ var use_resequence_default = useGetResequence;
5473
6371
 
5474
6372
  // src/hooks/view/use-run-action.ts
5475
6373
  import { useMutation as useMutation38 } from "@tanstack/react-query";
6374
+ var useRunAction = () => {
6375
+ return useMutation38({
6376
+ mutationFn: ({
6377
+ idAction,
6378
+ context
6379
+ }) => action_service_default.runAction({
6380
+ idAction,
6381
+ context
6382
+ })
6383
+ });
6384
+ };
6385
+ var use_run_action_default = useRunAction;
5476
6386
 
5477
6387
  // src/hooks/view/use-signin-sso.ts
5478
6388
  import { useMutation as useMutation39 } from "@tanstack/react-query";
6389
+ var useSignInSSO = () => {
6390
+ return useMutation39({
6391
+ mutationFn: ({
6392
+ redirect_uri,
6393
+ state,
6394
+ client_id,
6395
+ response_type,
6396
+ path
6397
+ }) => {
6398
+ return view_service_default.signInSSO({
6399
+ redirect_uri,
6400
+ state,
6401
+ client_id,
6402
+ response_type,
6403
+ path
6404
+ });
6405
+ }
6406
+ });
6407
+ };
6408
+ var use_signin_sso_default = useSignInSSO;
5479
6409
 
5480
6410
  // src/hooks/view/use-verify-2FA.ts
5481
6411
  import { useMutation as useMutation40 } from "@tanstack/react-query";
6412
+ var useVerify2FA = () => {
6413
+ return useMutation40({
6414
+ mutationFn: ({
6415
+ method,
6416
+ with_context,
6417
+ code,
6418
+ device,
6419
+ location
6420
+ }) => {
6421
+ return view_service_default.verify2FA({
6422
+ method,
6423
+ with_context,
6424
+ code,
6425
+ device,
6426
+ location
6427
+ });
6428
+ }
6429
+ });
6430
+ };
6431
+ var use_verify_2FA_default = useVerify2FA;
5482
6432
 
5483
6433
  // src/hooks/view/uset-get-2FA-method.ts
5484
6434
  import { useMutation as useMutation41 } from "@tanstack/react-query";
6435
+ var useGet2FAMethods = () => {
6436
+ return useMutation41({
6437
+ mutationFn: ({
6438
+ method,
6439
+ with_context
6440
+ }) => {
6441
+ return view_service_default.get2FAMethods({
6442
+ method,
6443
+ with_context
6444
+ });
6445
+ }
6446
+ });
6447
+ };
6448
+ var uset_get_2FA_method_default = useGet2FAMethods;
5485
6449
 
5486
6450
  // src/hooks/view/use-get-fields-view-security.ts
5487
6451
  import { useMutation as useMutation42 } from "@tanstack/react-query";
6452
+ var useGetFieldsViewSecurity = () => {
6453
+ return useMutation42({
6454
+ mutationFn: ({
6455
+ method,
6456
+ token,
6457
+ views
6458
+ }) => {
6459
+ return view_service_default.getFieldsViewSecurity({
6460
+ method,
6461
+ token,
6462
+ views
6463
+ });
6464
+ }
6465
+ });
6466
+ };
6467
+ var use_get_fields_view_security_default = useGetFieldsViewSecurity;
5488
6468
 
5489
6469
  // src/hooks/view/use-grant-access.ts
5490
6470
  import { useMutation as useMutation43 } from "@tanstack/react-query";
6471
+ var useGrantAccess = () => {
6472
+ return useMutation43({
6473
+ mutationFn: ({
6474
+ redirect_uri,
6475
+ state,
6476
+ client_id,
6477
+ scopes
6478
+ }) => {
6479
+ return view_service_default.grantAccess({
6480
+ redirect_uri,
6481
+ state,
6482
+ client_id,
6483
+ scopes
6484
+ });
6485
+ }
6486
+ });
6487
+ };
6488
+ var use_grant_access_default = useGrantAccess;
5491
6489
 
5492
6490
  // src/hooks/view/use-remove-totp-setup.ts
5493
6491
  import { useMutation as useMutation44 } from "@tanstack/react-query";
6492
+ var useRemoveTotpSetup = () => {
6493
+ return useMutation44({
6494
+ mutationFn: ({ method, token }) => {
6495
+ return view_service_default.removeTotpSetUp({
6496
+ method,
6497
+ token
6498
+ });
6499
+ }
6500
+ });
6501
+ };
6502
+ var use_remove_totp_setup_default = useRemoveTotpSetup;
5494
6503
 
5495
6504
  // src/hooks/view/use-request-setup-totp.ts
5496
6505
  import { useMutation as useMutation45 } from "@tanstack/react-query";
6506
+ var useRequestSetupTotp = () => {
6507
+ return useMutation45({
6508
+ mutationFn: ({ method, token }) => {
6509
+ return view_service_default.requestSetupTotp({
6510
+ method,
6511
+ token
6512
+ });
6513
+ }
6514
+ });
6515
+ };
6516
+ var use_request_setup_totp_default = useRequestSetupTotp;
5497
6517
 
5498
6518
  // src/hooks/view/use-settings-web-read-2fa.ts
5499
6519
  import { useMutation as useMutation46 } from "@tanstack/react-query";
6520
+ var useSettingsWebRead2fa = () => {
6521
+ return useMutation46({
6522
+ mutationFn: ({
6523
+ method,
6524
+ token,
6525
+ kwargs,
6526
+ model
6527
+ }) => {
6528
+ return view_service_default.settingsWebRead2fa({
6529
+ method,
6530
+ model,
6531
+ kwargs,
6532
+ token
6533
+ });
6534
+ }
6535
+ });
6536
+ };
6537
+ var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
5500
6538
 
5501
6539
  // src/hooks/view/use-verify-totp.ts
5502
6540
  import { useMutation as useMutation47 } from "@tanstack/react-query";
6541
+ var useVerifyTotp = () => {
6542
+ return useMutation47({
6543
+ mutationFn: ({
6544
+ method,
6545
+ action_token,
6546
+ code
6547
+ }) => {
6548
+ return view_service_default.verifyTotp({
6549
+ method,
6550
+ action_token,
6551
+ code
6552
+ });
6553
+ }
6554
+ });
6555
+ };
6556
+ var use_verify_totp_default = useVerifyTotp;
5503
6557
 
5504
6558
  // src/provider/version-gate-provider.tsx
5505
6559
  import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
@@ -5588,7 +6642,33 @@ var ServiceProvider = ({
5588
6642
  useSave: use_save_default,
5589
6643
  useGetProfile: use_get_profile_default,
5590
6644
  useGetUser: use_get_user_default,
5591
- useSwitchLocale: use_switch_locale_default
6645
+ useSwitchLocale: use_switch_locale_default,
6646
+ useButton: use_button_default,
6647
+ useDuplicateRecord: use_duplicate_record_default,
6648
+ useGet2FAMethods: uset_get_2FA_method_default,
6649
+ useGetActionDetail: use_get_action_detail_default,
6650
+ useGetCalendar: use_get_calendar_default,
6651
+ useGetGroups: use_get_groups_default,
6652
+ useGetListData: use_get_list_data_default,
6653
+ useGetMenu: use_get_menu_default,
6654
+ useGetPrintReport: use_get_print_report_default,
6655
+ useGetProGressBar: use_get_progress_bar_default,
6656
+ useGetResequence: use_resequence_default,
6657
+ useGetSelection: use_get_selection_default,
6658
+ useGetView: use_get_view_default,
6659
+ useLoadAction: use_load_action_default,
6660
+ useLoadMessage: use_load_message_default,
6661
+ usePrint: use_print_default,
6662
+ useRemoveRow: use_remove_row_default,
6663
+ useRunAction: use_run_action_default,
6664
+ useSignInSSO: use_signin_sso_default,
6665
+ useVerify2FA: use_verify_2FA_default,
6666
+ useGetFieldsViewSecurity: use_get_fields_view_security_default,
6667
+ useGrantAccess: use_grant_access_default,
6668
+ useRemoveTotpSetup: use_remove_totp_setup_default,
6669
+ useRequestSetupTotp: use_request_setup_totp_default,
6670
+ useSettingsWebRead2fa: use_settings_web_read_2fa_default,
6671
+ useVerifyTotp: use_verify_totp_default
5592
6672
  };
5593
6673
  return /* @__PURE__ */ jsx6(ServiceContext.Provider, { value: services, children });
5594
6674
  };