@fctc/interface-logic 4.2.4 → 4.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/provider.mjs CHANGED
@@ -5149,32 +5149,6 @@ function useViewService() {
5149
5149
  },
5150
5150
  [env]
5151
5151
  );
5152
- const addEntity = useCallback9(
5153
- ({
5154
- model,
5155
- values,
5156
- xNode,
5157
- service,
5158
- isCreateEndpoint = false
5159
- }) => {
5160
- const jsonData = {
5161
- model,
5162
- values
5163
- };
5164
- return env?.requests.post(
5165
- isCreateEndpoint ? "/create" /* CREATE_PATH */ : "/call" /* CALL_PATH */,
5166
- jsonData,
5167
- {
5168
- headers: {
5169
- "Content-Type": "application/json",
5170
- ...xNode ? { "X-Node": xNode } : {}
5171
- }
5172
- },
5173
- service
5174
- );
5175
- },
5176
- [env]
5177
- );
5178
5152
  const getList = useCallback9(
5179
5153
  ({
5180
5154
  model,
@@ -5929,7 +5903,6 @@ function useViewService() {
5929
5903
  manageOnChange,
5930
5904
  getOrderLine,
5931
5905
  getProductImage,
5932
- addEntity,
5933
5906
  checkPayment,
5934
5907
  handleCloseSession,
5935
5908
  handleClosingDetailSession,
@@ -6008,6 +5981,48 @@ function useDashboardService() {
6008
5981
  return { readGroup, getDataChart };
6009
5982
  }
6010
5983
 
5984
+ // src/services/pos-service/add-entity.ts
5985
+ import { useCallback as useCallback11 } from "react";
5986
+ var addEntityService = (env) => {
5987
+ const addEntity = useCallback11(
5988
+ ({
5989
+ model,
5990
+ values,
5991
+ xNode,
5992
+ service,
5993
+ isCreateEndpoint = false
5994
+ }) => {
5995
+ const jsonData = {
5996
+ model,
5997
+ values
5998
+ };
5999
+ return env?.requests.post(
6000
+ isCreateEndpoint ? "/create" /* CREATE_PATH */ : "/call" /* CALL_PATH */,
6001
+ jsonData,
6002
+ {
6003
+ headers: {
6004
+ "Content-Type": "application/json",
6005
+ ...xNode ? { "X-Node": xNode } : {}
6006
+ }
6007
+ },
6008
+ service
6009
+ );
6010
+ },
6011
+ [env]
6012
+ );
6013
+ return {
6014
+ addEntity
6015
+ };
6016
+ };
6017
+
6018
+ // src/services/pos-service/index.ts
6019
+ var usePosService = () => {
6020
+ const { env } = useEnv();
6021
+ return {
6022
+ addEntity: addEntityService(env).addEntity
6023
+ };
6024
+ };
6025
+
6011
6026
  // src/provider/version-gate-provider.tsx
6012
6027
  import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
6013
6028
  var VersionGate = ({ children }) => {
@@ -6045,7 +6060,7 @@ var VersionGate = ({ children }) => {
6045
6060
  };
6046
6061
 
6047
6062
  // src/provider/env-provider.tsx
6048
- import { createContext, useContext, useState as useState4, useCallback as useCallback11 } from "react";
6063
+ import { createContext, useContext, useState as useState4, useCallback as useCallback12 } from "react";
6049
6064
 
6050
6065
  // src/configs/axios-client.ts
6051
6066
  import axios from "axios";
@@ -6408,7 +6423,7 @@ function EnvProvider({
6408
6423
  localStorageUtils: localStorageUtil,
6409
6424
  sessionStorageUtils: sessionStorageUtil
6410
6425
  });
6411
- const setupEnv = useCallback11(
6426
+ const setupEnv = useCallback12(
6412
6427
  (envConfig) => {
6413
6428
  const updatedEnv = {
6414
6429
  ...env,
@@ -6422,31 +6437,31 @@ function EnvProvider({
6422
6437
  },
6423
6438
  [env, localStorageUtil, sessionStorageUtil]
6424
6439
  );
6425
- const setUid2 = useCallback11((uid) => {
6440
+ const setUid2 = useCallback12((uid) => {
6426
6441
  setEnvState((prev) => ({
6427
6442
  ...prev,
6428
6443
  context: { ...prev.context, uid }
6429
6444
  }));
6430
6445
  }, []);
6431
- const setLang2 = useCallback11((lang) => {
6446
+ const setLang2 = useCallback12((lang) => {
6432
6447
  setEnvState((prev) => ({
6433
6448
  ...prev,
6434
6449
  context: { ...prev.context, lang }
6435
6450
  }));
6436
6451
  }, []);
6437
- const setAllowCompanies2 = useCallback11((allowed_company_ids) => {
6452
+ const setAllowCompanies2 = useCallback12((allowed_company_ids) => {
6438
6453
  setEnvState((prev) => ({
6439
6454
  ...prev,
6440
6455
  context: { ...prev.context, allowed_company_ids }
6441
6456
  }));
6442
6457
  }, []);
6443
- const setCompanies2 = useCallback11((companies) => {
6458
+ const setCompanies2 = useCallback12((companies) => {
6444
6459
  setEnvState((prev) => ({
6445
6460
  ...prev,
6446
6461
  companies
6447
6462
  }));
6448
6463
  }, []);
6449
- const setDefaultCompany2 = useCallback11(
6464
+ const setDefaultCompany2 = useCallback12(
6450
6465
  (defaultCompany) => {
6451
6466
  setEnvState((prev) => ({
6452
6467
  ...prev,
@@ -6455,19 +6470,19 @@ function EnvProvider({
6455
6470
  },
6456
6471
  []
6457
6472
  );
6458
- const setUserInfo = useCallback11((user) => {
6473
+ const setUserInfo = useCallback12((user) => {
6459
6474
  setEnvState((prev) => ({
6460
6475
  ...prev,
6461
6476
  user
6462
6477
  }));
6463
6478
  }, []);
6464
- const setConfig2 = useCallback11((config) => {
6479
+ const setConfig2 = useCallback12((config) => {
6465
6480
  setEnvState((prev) => ({
6466
6481
  ...prev,
6467
6482
  config
6468
6483
  }));
6469
6484
  }, []);
6470
- const setEnvFile2 = useCallback11((envFile) => {
6485
+ const setEnvFile2 = useCallback12((envFile) => {
6471
6486
  setEnvState((prev) => ({
6472
6487
  ...prev,
6473
6488
  envFile
@@ -7373,9 +7388,9 @@ var BaseModel = class {
7373
7388
  };
7374
7389
 
7375
7390
  // src/hooks/model/use-model.ts
7376
- import { useCallback as useCallback12 } from "react";
7391
+ import { useCallback as useCallback13 } from "react";
7377
7392
  var useModel = () => {
7378
- const initModel = useCallback12((modelData) => {
7393
+ const initModel = useCallback13((modelData) => {
7379
7394
  switch (modelData?.name) {
7380
7395
  default:
7381
7396
  return new BaseModel(modelData);
@@ -8385,35 +8400,11 @@ var useGetProductImage = () => {
8385
8400
  };
8386
8401
  var use_get_product_image_default = useGetProductImage;
8387
8402
 
8388
- // src/hooks/view/use-add-entity.ts
8389
- import { useMutation as useMutation66 } from "@tanstack/react-query";
8390
- var useAddEntity = () => {
8391
- const { addEntity } = useViewService();
8392
- return useMutation66({
8393
- mutationFn: ({
8394
- model,
8395
- values,
8396
- xNode,
8397
- service,
8398
- isCreateEndpoint = false
8399
- }) => {
8400
- return addEntity({
8401
- model,
8402
- values,
8403
- xNode,
8404
- service,
8405
- isCreateEndpoint
8406
- });
8407
- }
8408
- });
8409
- };
8410
- var use_add_entity_default = useAddEntity;
8411
-
8412
8403
  // src/hooks/view/use-check-payment.ts
8413
- import { useMutation as useMutation67 } from "@tanstack/react-query";
8404
+ import { useMutation as useMutation66 } from "@tanstack/react-query";
8414
8405
  var useCheckPayment = () => {
8415
8406
  const { checkPayment } = useViewService();
8416
- return useMutation67({
8407
+ return useMutation66({
8417
8408
  mutationFn: ({
8418
8409
  model,
8419
8410
  ids,
@@ -8434,10 +8425,10 @@ var useCheckPayment = () => {
8434
8425
  var use_check_payment_default = useCheckPayment;
8435
8426
 
8436
8427
  // src/hooks/view/use-handle-close-session.ts
8437
- import { useMutation as useMutation68 } from "@tanstack/react-query";
8428
+ import { useMutation as useMutation67 } from "@tanstack/react-query";
8438
8429
  var useHandleCloseSession = () => {
8439
8430
  const { handleCloseSession } = useViewService();
8440
- return useMutation68({
8431
+ return useMutation67({
8441
8432
  mutationFn: ({
8442
8433
  model,
8443
8434
  ids,
@@ -8458,10 +8449,10 @@ var useHandleCloseSession = () => {
8458
8449
  var use_handle_close_session_default = useHandleCloseSession;
8459
8450
 
8460
8451
  // src/hooks/view/use-handle-closing-detail-session.ts
8461
- import { useMutation as useMutation69 } from "@tanstack/react-query";
8452
+ import { useMutation as useMutation68 } from "@tanstack/react-query";
8462
8453
  var useHandleClosingDetailSession = () => {
8463
8454
  const { handleClosingDetailSession } = useViewService();
8464
- return useMutation69({
8455
+ return useMutation68({
8465
8456
  mutationFn: ({
8466
8457
  model,
8467
8458
  ids,
@@ -8484,10 +8475,10 @@ var useHandleClosingDetailSession = () => {
8484
8475
  var use_handle_closing_detail_session_default = useHandleClosingDetailSession;
8485
8476
 
8486
8477
  // src/hooks/view/use-create-pos-config.ts
8487
- import { useMutation as useMutation70 } from "@tanstack/react-query";
8478
+ import { useMutation as useMutation69 } from "@tanstack/react-query";
8488
8479
  var useCreatePosConfig = () => {
8489
8480
  const { createPosConfig } = useViewService();
8490
- return useMutation70({
8481
+ return useMutation69({
8491
8482
  mutationFn: ({
8492
8483
  model,
8493
8484
  name,
@@ -8508,10 +8499,10 @@ var useCreatePosConfig = () => {
8508
8499
  var use_create_pos_config_default = useCreatePosConfig;
8509
8500
 
8510
8501
  // src/hooks/view/use-search-journal.ts
8511
- import { useMutation as useMutation71 } from "@tanstack/react-query";
8502
+ import { useMutation as useMutation70 } from "@tanstack/react-query";
8512
8503
  var useSearchJournal = () => {
8513
8504
  const { searchJournal } = useViewService();
8514
- return useMutation71({
8505
+ return useMutation70({
8515
8506
  mutationFn: ({
8516
8507
  model,
8517
8508
  method,
@@ -8534,10 +8525,10 @@ var useSearchJournal = () => {
8534
8525
  var use_search_journal_default = useSearchJournal;
8535
8526
 
8536
8527
  // src/hooks/view/useGetPreparaionDisplayData.ts
8537
- import { useMutation as useMutation72 } from "@tanstack/react-query";
8528
+ import { useMutation as useMutation71 } from "@tanstack/react-query";
8538
8529
  var useGetPreparationDisplayData = () => {
8539
8530
  const { getPreparationDisplayData } = useViewService();
8540
- return useMutation72({
8531
+ return useMutation71({
8541
8532
  mutationFn: ({
8542
8533
  ids,
8543
8534
  service,
@@ -8556,10 +8547,10 @@ var useGetPreparationDisplayData = () => {
8556
8547
  var useGetPreparaionDisplayData_default = useGetPreparationDisplayData;
8557
8548
 
8558
8549
  // src/hooks/view/useChangeOrderPreparaionState.ts
8559
- import { useMutation as useMutation73 } from "@tanstack/react-query";
8550
+ import { useMutation as useMutation72 } from "@tanstack/react-query";
8560
8551
  var useChangeOrderPreparationState = () => {
8561
8552
  const { changeOrderPreparaionState } = useViewService();
8562
- return useMutation73({
8553
+ return useMutation72({
8563
8554
  mutationFn: ({
8564
8555
  orderId,
8565
8556
  stageId,
@@ -8580,10 +8571,10 @@ var useChangeOrderPreparationState = () => {
8580
8571
  var useChangeOrderPreparaionState_default = useChangeOrderPreparationState;
8581
8572
 
8582
8573
  // src/hooks/view/use-update-order-status.ts
8583
- import { useMutation as useMutation74 } from "@tanstack/react-query";
8574
+ import { useMutation as useMutation73 } from "@tanstack/react-query";
8584
8575
  var useUpdateOrderStatus = () => {
8585
8576
  const { updateOrderStatus } = useViewService();
8586
- return useMutation74({
8577
+ return useMutation73({
8587
8578
  mutationFn: ({
8588
8579
  orderId,
8589
8580
  state,
@@ -8602,10 +8593,10 @@ var useUpdateOrderStatus = () => {
8602
8593
  var use_update_order_status_default = useUpdateOrderStatus;
8603
8594
 
8604
8595
  // src/hooks/view/use-process-order.ts
8605
- import { useMutation as useMutation75 } from "@tanstack/react-query";
8596
+ import { useMutation as useMutation74 } from "@tanstack/react-query";
8606
8597
  var useProcessOrder = () => {
8607
8598
  const { processOrder } = useViewService();
8608
- return useMutation75({
8599
+ return useMutation74({
8609
8600
  mutationFn: ({
8610
8601
  orderId,
8611
8602
  xNode,
@@ -8620,10 +8611,10 @@ var useProcessOrder = () => {
8620
8611
  var use_process_order_default = useProcessOrder;
8621
8612
 
8622
8613
  // src/hooks/view/use-generate-payment-qr-info.ts
8623
- import { useMutation as useMutation76 } from "@tanstack/react-query";
8614
+ import { useMutation as useMutation75 } from "@tanstack/react-query";
8624
8615
  var useGeneratePaymentQrInfo = () => {
8625
8616
  const { generatePaymentQRInfo } = useViewService();
8626
- return useMutation76({
8617
+ return useMutation75({
8627
8618
  mutationFn: ({
8628
8619
  orderId,
8629
8620
  amount,
@@ -8644,10 +8635,10 @@ var useGeneratePaymentQrInfo = () => {
8644
8635
  var use_generate_payment_qr_info_default = useGeneratePaymentQrInfo;
8645
8636
 
8646
8637
  // src/hooks/view/use-save-pin-code.ts
8647
- import { useMutation as useMutation77 } from "@tanstack/react-query";
8638
+ import { useMutation as useMutation76 } from "@tanstack/react-query";
8648
8639
  var useSavePinCode = () => {
8649
8640
  const { savePinCode } = useViewService();
8650
- return useMutation77({
8641
+ return useMutation76({
8651
8642
  mutationFn: ({
8652
8643
  serialNumber,
8653
8644
  pinCode,
@@ -8666,10 +8657,10 @@ var useSavePinCode = () => {
8666
8657
  var use_save_pin_code_default = useSavePinCode;
8667
8658
 
8668
8659
  // src/hooks/view/use-get-pin-code.ts
8669
- import { useMutation as useMutation78 } from "@tanstack/react-query";
8660
+ import { useMutation as useMutation77 } from "@tanstack/react-query";
8670
8661
  var useGetPinCode = () => {
8671
8662
  const { getPinCode } = useViewService();
8672
- return useMutation78({
8663
+ return useMutation77({
8673
8664
  mutationFn: ({
8674
8665
  serialNumber,
8675
8666
  xNode,
@@ -8707,10 +8698,10 @@ var useGetNotifications = ({
8707
8698
  var use_get_notifications_default = useGetNotifications;
8708
8699
 
8709
8700
  // src/hooks/view/use-get-version.ts
8710
- import { useMutation as useMutation79 } from "@tanstack/react-query";
8701
+ import { useMutation as useMutation78 } from "@tanstack/react-query";
8711
8702
  var useGetVersion = () => {
8712
8703
  const { getVersion } = useViewService();
8713
- return useMutation79({
8704
+ return useMutation78({
8714
8705
  mutationFn: () => {
8715
8706
  return getVersion();
8716
8707
  }
@@ -8719,10 +8710,10 @@ var useGetVersion = () => {
8719
8710
  var use_get_version_default = useGetVersion;
8720
8711
 
8721
8712
  // src/hooks/view/use-create-e-invoice.ts
8722
- import { useMutation as useMutation80 } from "@tanstack/react-query";
8713
+ import { useMutation as useMutation79 } from "@tanstack/react-query";
8723
8714
  var useCreateEInvoice = () => {
8724
8715
  const { createEInvoice } = useViewService();
8725
- return useMutation80({
8716
+ return useMutation79({
8726
8717
  mutationFn: ({
8727
8718
  service,
8728
8719
  xNode,
@@ -8743,10 +8734,10 @@ var useCreateEInvoice = () => {
8743
8734
  var use_create_e_invoice_default = useCreateEInvoice;
8744
8735
 
8745
8736
  // src/hooks/view/use-get-current-user.ts
8746
- import { useMutation as useMutation81 } from "@tanstack/react-query";
8737
+ import { useMutation as useMutation80 } from "@tanstack/react-query";
8747
8738
  var useGetCurrentUser = () => {
8748
8739
  const { getCurrentUser } = useViewService();
8749
- return useMutation81({
8740
+ return useMutation80({
8750
8741
  mutationFn: ({
8751
8742
  service,
8752
8743
  xNode,
@@ -8760,10 +8751,10 @@ var useGetCurrentUser = () => {
8760
8751
  var use_get_current_user_default = useGetCurrentUser;
8761
8752
 
8762
8753
  // src/hooks/view/use-get-ward.ts
8763
- import { useMutation as useMutation82 } from "@tanstack/react-query";
8754
+ import { useMutation as useMutation81 } from "@tanstack/react-query";
8764
8755
  var useGetWard = () => {
8765
8756
  const { getWard } = useViewService();
8766
- return useMutation82({
8757
+ return useMutation81({
8767
8758
  mutationFn: ({
8768
8759
  service,
8769
8760
  xNode,
@@ -8780,10 +8771,10 @@ var useGetWard = () => {
8780
8771
  var use_get_ward_default = useGetWard;
8781
8772
 
8782
8773
  // src/hooks/view/use-get-city.ts
8783
- import { useMutation as useMutation83 } from "@tanstack/react-query";
8774
+ import { useMutation as useMutation82 } from "@tanstack/react-query";
8784
8775
  var useGetCity = () => {
8785
8776
  const { getCity } = useViewService();
8786
- return useMutation83({
8777
+ return useMutation82({
8787
8778
  mutationFn: ({
8788
8779
  service,
8789
8780
  xNode,
@@ -8802,10 +8793,10 @@ var useGetCity = () => {
8802
8793
  var use_get_city_default = useGetCity;
8803
8794
 
8804
8795
  // src/hooks/view/use-get-country.ts
8805
- import { useMutation as useMutation84 } from "@tanstack/react-query";
8796
+ import { useMutation as useMutation83 } from "@tanstack/react-query";
8806
8797
  var useGetCountry = () => {
8807
8798
  const { getCountry } = useViewService();
8808
- return useMutation84({
8799
+ return useMutation83({
8809
8800
  mutationFn: ({
8810
8801
  service,
8811
8802
  xNode,
@@ -8824,10 +8815,10 @@ var useGetCountry = () => {
8824
8815
  var use_get_country_default = useGetCountry;
8825
8816
 
8826
8817
  // src/hooks/view/use-get-partner-title.ts
8827
- import { useMutation as useMutation85 } from "@tanstack/react-query";
8818
+ import { useMutation as useMutation84 } from "@tanstack/react-query";
8828
8819
  var useGetPartnerTitle = () => {
8829
8820
  const { getPartnerTitle } = useViewService();
8830
- return useMutation85({
8821
+ return useMutation84({
8831
8822
  mutationFn: ({
8832
8823
  service,
8833
8824
  xNode,
@@ -8881,6 +8872,16 @@ var useGetDataChart = (services, xNode, body, enabled, path, method, queryKey) =
8881
8872
  };
8882
8873
  var use_get_data_chart_default = useGetDataChart;
8883
8874
 
8875
+ // src/hooks/pos/use-add-entity.ts
8876
+ import { useMutation as useMutation85 } from "@tanstack/react-query";
8877
+ var useAddEntity = () => {
8878
+ const { addEntity } = usePosService();
8879
+ return useMutation85({
8880
+ mutationFn: addEntity
8881
+ });
8882
+ };
8883
+ var use_add_entity_default = useAddEntity;
8884
+
8884
8885
  // src/provider/service-provider.tsx
8885
8886
  import { jsx as jsx6 } from "react/jsx-runtime";
8886
8887
  var ServiceContext = createContext2(null);
@@ -431,13 +431,6 @@ declare function useViewService(): {
431
431
  xNode?: string;
432
432
  searchParams?: Record<string, string | number | boolean>;
433
433
  }) => any;
434
- addEntity: ({ model, values, xNode, service, isCreateEndpoint, }: {
435
- model: string;
436
- values: any;
437
- service?: string;
438
- xNode?: string;
439
- isCreateEndpoint?: boolean;
440
- }) => any;
441
434
  checkPayment: ({ model, ids, withContext, xNode, service, }: {
442
435
  model: string;
443
436
  ids: any;
@@ -431,13 +431,6 @@ declare function useViewService(): {
431
431
  xNode?: string;
432
432
  searchParams?: Record<string, string | number | boolean>;
433
433
  }) => any;
434
- addEntity: ({ model, values, xNode, service, isCreateEndpoint, }: {
435
- model: string;
436
- values: any;
437
- service?: string;
438
- xNode?: string;
439
- isCreateEndpoint?: boolean;
440
- }) => any;
441
434
  checkPayment: ({ model, ids, withContext, xNode, service, }: {
442
435
  model: string;
443
436
  ids: any;