@erpsquad/common 1.10.1-test → 1.10.2-test

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.
Files changed (118) hide show
  1. package/dist/{Tooltip-0Msd6gJs.js → Tooltip-BWIywPIG.js} +2 -2
  2. package/dist/{Tooltip-0Msd6gJs.js.map → Tooltip-BWIywPIG.js.map} +1 -1
  3. package/dist/{Tooltip-DBg9E0nY.esm.js → Tooltip-BuKMQR27.esm.js} +5 -5
  4. package/dist/{Tooltip-DBg9E0nY.esm.js.map → Tooltip-BuKMQR27.esm.js.map} +1 -1
  5. package/dist/{android-12-switch-C2yR_ny0.js → android-12-switch-Cwoy0lqC.js} +2 -2
  6. package/dist/{android-12-switch-C2yR_ny0.js.map → android-12-switch-Cwoy0lqC.js.map} +1 -1
  7. package/dist/{android-12-switch-CFHHRoXl.esm.js → android-12-switch-DIRd6Hz1.esm.js} +10 -10
  8. package/dist/{android-12-switch-CFHHRoXl.esm.js.map → android-12-switch-DIRd6Hz1.esm.js.map} +1 -1
  9. package/dist/{apiHelper-C7xLzw2l.esm.js → apiHelper-BLkPhudw.esm.js} +5 -5
  10. package/dist/{apiHelper-C7xLzw2l.esm.js.map → apiHelper-BLkPhudw.esm.js.map} +1 -1
  11. package/dist/{apiHelper-uNnzNGPt.js → apiHelper-DurABKEn.js} +2 -2
  12. package/dist/{apiHelper-uNnzNGPt.js.map → apiHelper-DurABKEn.js.map} +1 -1
  13. package/dist/{arrow-up-RDVMEaNg.esm.js → arrow-up-BYufujcs.esm.js} +47 -48
  14. package/dist/arrow-up-BYufujcs.esm.js.map +1 -0
  15. package/dist/{arrow-up-CZCTjL2a.js → arrow-up-u2i6ArLB.js} +47 -47
  16. package/dist/arrow-up-u2i6ArLB.js.map +1 -0
  17. package/dist/components/icons/create-custom-icon.d.ts +16 -0
  18. package/dist/components/index.esm.js +14 -14
  19. package/dist/components/index.js +1 -1
  20. package/dist/contexts/index.esm.js +3 -3
  21. package/dist/contexts/index.js +1 -1
  22. package/dist/{dashboard-BU3Ivh-m.esm.js → dashboard-BHs900IA.esm.js} +3 -3
  23. package/dist/dashboard-BHs900IA.esm.js.map +1 -0
  24. package/dist/{dashboard-DC1wsH2n.js → dashboard-ecHBMV8C.js} +3 -3
  25. package/dist/dashboard-ecHBMV8C.js.map +1 -0
  26. package/dist/{default-data-DMRyIpbS.js → default-data-kq9UR-LT.js} +2 -2
  27. package/dist/{default-data-DMRyIpbS.js.map → default-data-kq9UR-LT.js.map} +1 -1
  28. package/dist/{default-data-DZ7_2K9V.esm.js → default-data-rqQOC7ed.esm.js} +10 -10
  29. package/dist/{default-data-DZ7_2K9V.esm.js.map → default-data-rqQOC7ed.esm.js.map} +1 -1
  30. package/dist/{document-MTw-RQlt.js → document-Dat2mYKY.js} +7 -7
  31. package/dist/document-Dat2mYKY.js.map +1 -0
  32. package/dist/{document-jQDTo49w.esm.js → document-Dc0e4Wgt.esm.js} +3 -4
  33. package/dist/document-Dc0e4Wgt.esm.js.map +1 -0
  34. package/dist/{form-builder-deconversion-DUwJpbWi.js → form-builder-deconversion-Bt6_FHty.js} +2 -2
  35. package/dist/{form-builder-deconversion-DUwJpbWi.js.map → form-builder-deconversion-Bt6_FHty.js.map} +1 -1
  36. package/dist/{form-builder-deconversion-BmnMG6UA.esm.js → form-builder-deconversion-CjCls618.esm.js} +3 -3
  37. package/dist/{form-builder-deconversion-BmnMG6UA.esm.js.map → form-builder-deconversion-CjCls618.esm.js.map} +1 -1
  38. package/dist/{fullScreen-bLbPf_Sx.esm.js → fullScreen-B7NBNLnc.esm.js} +2 -2
  39. package/dist/{fullScreen-bLbPf_Sx.esm.js.map → fullScreen-B7NBNLnc.esm.js.map} +1 -1
  40. package/dist/{fullScreen-z8Ci7IBM.js → fullScreen-Bk29OQHQ.js} +2 -2
  41. package/dist/{fullScreen-z8Ci7IBM.js.map → fullScreen-Bk29OQHQ.js.map} +1 -1
  42. package/dist/hooks/index.esm.js +5 -5
  43. package/dist/hooks/index.js +1 -1
  44. package/dist/icons/index.esm.js +7 -7
  45. package/dist/icons/index.js +1 -1
  46. package/dist/{index-abVANnYO.esm.js → index-CasNCevI.esm.js} +3 -3
  47. package/dist/{index-abVANnYO.esm.js.map → index-CasNCevI.esm.js.map} +1 -1
  48. package/dist/{index-C2m4EKMw.js → index-D6O6Gc88.js} +2 -2
  49. package/dist/{index-C2m4EKMw.js.map → index-D6O6Gc88.js.map} +1 -1
  50. package/dist/index.esm.js +19 -19
  51. package/dist/index.js +1 -1
  52. package/dist/{languageContext-z0EIAM7m.esm.js → languageContext-BqGnL8Sv.esm.js} +2 -2
  53. package/dist/{languageContext-z0EIAM7m.esm.js.map → languageContext-BqGnL8Sv.esm.js.map} +1 -1
  54. package/dist/{languageContext-7DprjT6b.js → languageContext-hAPMY56Y.js} +2 -2
  55. package/dist/{languageContext-7DprjT6b.js.map → languageContext-hAPMY56Y.js.map} +1 -1
  56. package/dist/layout/index.esm.js +4 -4
  57. package/dist/layout/index.js +1 -1
  58. package/dist/{migration-utils-DRGPH-n4.js → migration-utils-Bh98qTkC.js} +2 -2
  59. package/dist/{migration-utils-DRGPH-n4.js.map → migration-utils-Bh98qTkC.js.map} +1 -1
  60. package/dist/{migration-utils-BzRKOUW0.esm.js → migration-utils-byCdwgkF.esm.js} +2 -2
  61. package/dist/{migration-utils-BzRKOUW0.esm.js.map → migration-utils-byCdwgkF.esm.js.map} +1 -1
  62. package/dist/notification-BsWK2s3n.js +7 -0
  63. package/dist/notification-BsWK2s3n.js.map +1 -0
  64. package/dist/{notification-BNeR5Dyl.esm.js → notification-Dbo3l5Vw.esm.js} +27 -5
  65. package/dist/notification-Dbo3l5Vw.esm.js.map +1 -0
  66. package/dist/{sidebar-C6-wzTTF.esm.js → sidebar-DTv1DxTn.esm.js} +5 -5
  67. package/dist/{sidebar-C6-wzTTF.esm.js.map → sidebar-DTv1DxTn.esm.js.map} +1 -1
  68. package/dist/{sidebar-BT_zTOCc.js → sidebar-U2vsFarM.js} +2 -2
  69. package/dist/{sidebar-BT_zTOCc.js.map → sidebar-U2vsFarM.js.map} +1 -1
  70. package/dist/src/components/icons/create-custom-icon.d.ts +16 -0
  71. package/dist/{tick-CcyPwRXL.esm.js → tick-Cogsd5aG.esm.js} +8 -9
  72. package/dist/tick-Cogsd5aG.esm.js.map +1 -0
  73. package/dist/{tick-Ct-Ir-1S.js → tick-XKXM5oTD.js} +22 -22
  74. package/dist/tick-XKXM5oTD.js.map +1 -0
  75. package/dist/{toggle-switch-FMTO6609.esm.js → toggle-switch-Day9cZg5.esm.js} +3 -4
  76. package/dist/toggle-switch-Day9cZg5.esm.js.map +1 -0
  77. package/dist/{toggle-switch-BghzgMG8.js → toggle-switch-P3dX3iMp.js} +5 -5
  78. package/dist/toggle-switch-P3dX3iMp.js.map +1 -0
  79. package/dist/{trash-BTwzTBYO.esm.js → trash-cWyby5W5.esm.js} +36 -37
  80. package/dist/trash-cWyby5W5.esm.js.map +1 -0
  81. package/dist/{trash-5CZCQE4a.js → trash-iM5WzuPQ.js} +124 -124
  82. package/dist/trash-iM5WzuPQ.js.map +1 -0
  83. package/dist/{uom-field-wrapper-6F9MCc0-.js → uom-field-wrapper-D4vafbb3.js} +2 -2
  84. package/dist/{uom-field-wrapper-6F9MCc0-.js.map → uom-field-wrapper-D4vafbb3.js.map} +1 -1
  85. package/dist/{uom-field-wrapper-3usHZZm1.esm.js → uom-field-wrapper-DHzy94__.esm.js} +12 -12
  86. package/dist/{uom-field-wrapper-3usHZZm1.esm.js.map → uom-field-wrapper-DHzy94__.esm.js.map} +1 -1
  87. package/dist/{useAccountSetting-ChWt7JwC.js → useAccountSetting-CNoWakIN.js} +2 -2
  88. package/dist/{useAccountSetting-ChWt7JwC.js.map → useAccountSetting-CNoWakIN.js.map} +1 -1
  89. package/dist/{useAccountSetting-BEKGFdbo.esm.js → useAccountSetting-D2gUGGca.esm.js} +2 -2
  90. package/dist/{useAccountSetting-BEKGFdbo.esm.js.map → useAccountSetting-D2gUGGca.esm.js.map} +1 -1
  91. package/dist/{useAuth-C18aZa1n.esm.js → useAuth-Bvid1bpz.esm.js} +2 -2
  92. package/dist/{useAuth-C18aZa1n.esm.js.map → useAuth-Bvid1bpz.esm.js.map} +1 -1
  93. package/dist/{useAuth-Dpe5kDa6.js → useAuth-CVokk6Ra.js} +2 -2
  94. package/dist/{useAuth-Dpe5kDa6.js.map → useAuth-CVokk6Ra.js.map} +1 -1
  95. package/dist/{useLangauge-DKPl4qKr.esm.js → useLangauge-BQjH-l_B.esm.js} +2 -2
  96. package/dist/{useLangauge-DKPl4qKr.esm.js.map → useLangauge-BQjH-l_B.esm.js.map} +1 -1
  97. package/dist/{useLangauge-DaCaybJt.js → useLangauge-ySJIB0GV.js} +2 -2
  98. package/dist/{useLangauge-DaCaybJt.js.map → useLangauge-ySJIB0GV.js.map} +1 -1
  99. package/dist/utils/index.esm.js +3 -3
  100. package/dist/utils/index.js +1 -1
  101. package/dist/views/index.esm.js +5 -5
  102. package/dist/views/index.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/arrow-up-CZCTjL2a.js.map +0 -1
  105. package/dist/arrow-up-RDVMEaNg.esm.js.map +0 -1
  106. package/dist/dashboard-BU3Ivh-m.esm.js.map +0 -1
  107. package/dist/dashboard-DC1wsH2n.js.map +0 -1
  108. package/dist/document-MTw-RQlt.js.map +0 -1
  109. package/dist/document-jQDTo49w.esm.js.map +0 -1
  110. package/dist/notification-BNeR5Dyl.esm.js.map +0 -1
  111. package/dist/notification-BmKHaKZF.js +0 -6
  112. package/dist/notification-BmKHaKZF.js.map +0 -1
  113. package/dist/tick-CcyPwRXL.esm.js.map +0 -1
  114. package/dist/tick-Ct-Ir-1S.js.map +0 -1
  115. package/dist/toggle-switch-BghzgMG8.js.map +0 -1
  116. package/dist/toggle-switch-FMTO6609.esm.js.map +0 -1
  117. package/dist/trash-5CZCQE4a.js.map +0 -1
  118. package/dist/trash-BTwzTBYO.esm.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("lodash"),n=require("react"),t=require("./index-C2m4EKMw.js"),r=require("notistack"),o=require("./common-8gzbBoY1.js"),i=require("./api-config-C9BF5LFu.js");function l(e){return e&&e.__esModule?e.default:e}const s=/* @__PURE__ */l(e);function a(){const[e,t]=n.useState(!1),[o,i]=n.useState(null);return{callApi:n.useCallback(async({apiFunc:e,onSuccess:n,onError:l,successMessage:s,errorMessage:a,loadingState:u,enableLoading:c=!0,showError:d=!0})=>{c&&t(!0),null==u||u(!0);const f=await e();return c&&t(!1),null==u||u(!1),function({res:e,callBack:n,showError:t=!0,errorCallback:o,succsessMessage:i=null}){var l,s;if("rejected"===(null==(l=null==e?void 0:e.meta)?void 0:l.requestStatus)){const n=(()=>{var n,t,r;try{return(null==(n=e.error)?void 0:n.message)||(null==(t=null==e?void 0:e.payload)?void 0:t.message)?JSON.parse((null==(r=null==e?void 0:e.payload)?void 0:r.message)||e.error.message):null}catch{return{message:"Something went wrong"}}})(),i=(null==(s=null==n?void 0:n.message)?void 0:s.replace("Error:","").trim())||"Something went wrong";return t&&r.enqueueSnackbar(i,{variant:"error"}),void(o&&"function"==typeof o&&o(i))}i&&r.enqueueSnackbar(i),n&&"function"==typeof n&&n()}({res:f,callBack:()=>{null==n||n(f)},errorCallback:e=>{null==l||l(f),i(a||e)},succsessMessage:s,showError:d}),{response:f,error:o}},[]),loading:e,error:o}}let u="",c={};const d=e=>{var n;u=(n=e).endsWith("/")?n.slice(0,-1):n},f=async e=>await(async(e,n)=>{const t=new URLSearchParams;["skip","limit","order","filters","search","select"].forEach(e=>{var r;n[e]&&(Array.isArray(n[e])?n[e].forEach(n=>{t.append(e,n)}):t.append(e,(null==(r=n[e])?void 0:r.toString())||"")),delete n[e]});const r={...c};void 0!==n["x-token"]&&(r["x-token"]=n["x-token"],delete n["x-token"]),void 0!==n["x-timezone"]&&(r["x-timezone"]=n["x-timezone"],delete n["x-timezone"]);const o=await fetch(`${e}/v1/settings/configurations?${t.toString()}`,{headers:r});if(!o.ok)throw new Error(await o.text());return await o.json()})(u,e);i.onApiConfigReady(e=>{const n=e.backendBaseUrl;d(`${n}/accounting`)});const p=({control:e,setValue:t,fieldToUpdate:r,transformResponse:i,watch:l,fieldArrayName:s,companyField:u="company_id",locationField:c="location_id",departmentField:d="department_id",customDependencies:p=[],getFieldState:m,isUpdateAccount:v=!1})=>{var y,g,h;const{callApi:$}=a(),[x,w]=n.useState(null),k=s?`${s}.${u}`:u,b=s?`${s}.${c}`:c,A=s?`${s}.${d}`:d,F=(null==l?void 0:l(`${s}`))||{},E=null==(y=null==m?void 0:m(k))?void 0:y.isDirty,S=null==(g=null==m?void 0:m(b))?void 0:g.isDirty,_=null==(h=null==m?void 0:m(A))?void 0:h.isDirty,C=(null==F?void 0:F[u])||null,j=(null==F?void 0:F[c])||null,q=(null==F?void 0:F[d])||null;n.useEffect(()=>{if(l&&!x){const e={[u]:C,[c]:j,[d]:q},n={};Object.keys(r).forEach(e=>{const t=s?`${s}.${e}`:e;n[e]=l(t)}),w({filters:e,values:n})}},[l,C,j,q,x,k,b,A,E,S,_]);const P=n.useCallback((e,n=!1)=>{if(!t||!e)return;const o=i?i(e):e;o&&Object.entries(r).forEach(([e,r])=>{const i=null==o?void 0:o.find(e=>(null==e?void 0:e.config_key)==("object"==typeof r?r.key:r));if(null!=i){const o=s?`${s}.${e}`:e;if(!n){const e=null==l?void 0:l(o);if(null!=e&&""!==e)return}"object"==typeof r?r.value((null==i?void 0:i.reference_id)||(null==i?void 0:i.reference_text)):t(o,(null==i?void 0:i.reference_id)||(null==i?void 0:i.reference_text))}})},[t,r,i,s,l,...p]),M=n.useCallback(async()=>{if(!C||!x)return;const e=e=>{if(Array.isArray(e)){if(0===e.length)return null;const n=e[0];return n&&"object"==typeof n?n.id||n.value||null:n||null}return e&&"object"==typeof e?e.id||e.value||null:e||null},n=e(C),i=e(j),a=e(q);if(!n||!x)return;const p=e(x.filters[u]),m=e(x.filters[c]),y=e(x.filters[d]),g=p!==n||m!==i||y!==a,h=Object.keys(r).every(e=>{const n=null==l?void 0:l(s?`${s}.${e}`:e);return null==n||""===n});if(!g&&!v&&!h)return void Object.entries(x.values).forEach(([e,n])=>{null==t||t(s?`${s}.${e}`:e,n)});const w=`(company_id.eq=${n||1}&location_id.eq=${i||null}&department_id.eq=${a||null})`,k=v?g&&(E||S||_):g;$({apiFunc:()=>f({...o.getToken(),filters:w}),onSuccess:e=>{var n;P(null==(n=null==e?void 0:e.data)?void 0:n.configuration_list,k)},onError:e=>{}})},[C,j,q,x,$,t,E,S,_,v]);return n.useEffect(()=>{M()},[M]),{selectedCompany:C,selectedLocation:j,selectedDepartment:q}};exports.initializeApiBaseUrls=function(){if(!i.isApiConfigInitialized())return;const e=i.getApiConfig().backendBaseUrl;d(`${e}/accounting`)},exports.useAccountingSetting=({fieldToUpdate:e,fieldArrayName:n,companyField:t="company_id",locationField:r="location_id",departmentField:o="department_id",formMethods:i,customDependencies:l=[],...s})=>{const{setValue:a,control:u,watch:c,getFieldState:d}=i||{};return p({control:u,setValue:a,watch:c,companyField:t,locationField:r,departmentField:o,fieldToUpdate:e,fieldArrayName:n,customDependencies:l,getFieldState:d,...s})},exports.useApi=a,exports.useDeepMemo=function(e){const t=n.useRef();return s.isEqual(t.current,e)||(t.current=e),t.current},exports.useFormFieldUpdater=p,exports.useLocationFilter=({selectedCompany:e,setValue:t,fieldArrayName:r,locationFieldName:o,resetValue:i=null,filterKey:l="&company_id.in",isDirty:s=!1})=>{n.useEffect(()=>{t&&r&&o&&s&&t(`${r}.${o}`,i)},[s,t,r,o,i]);return n.useMemo(()=>{const n=Array.isArray(e)?(null==e?void 0:e.length)?e:null:e||null;return null===n?{}:{[l]:n}},[e,l])},exports.useMultipleLocationFilters=({selectedCompany:e,setValue:t,fieldConfigs:r,resetValue:o,filterKey:i="&company_id.in"})=>n.useMemo(()=>{const n=(null==e?void 0:e.length)>0?e:0;return r.forEach(({fieldArrayName:e,locationFieldName:n})=>{t&&e&&n&&t(`${e}.${n}`,o)}),{[i]:n}},[e,t,r,o,i]),exports.usePages=(e=[])=>{const r=n.useContext(t.PageContext);if(!r)throw new Error("usePages must be used within a PageProvider");return r.initializeColumns&&r.initializeColumns(e),r},exports.usePermissions=()=>{const e=n.useContext(t.PermissionsContext);if(!e)throw new Error("usePermissions must be used within a PermissionsProvider");return e};
2
- //# sourceMappingURL=useAccountSetting-ChWt7JwC.js.map
1
+ "use strict";const e=require("lodash"),n=require("react"),t=require("./index-D6O6Gc88.js"),r=require("notistack"),o=require("./common-8gzbBoY1.js"),i=require("./api-config-C9BF5LFu.js");function l(e){return e&&e.__esModule?e.default:e}const s=/* @__PURE__ */l(e);function a(){const[e,t]=n.useState(!1),[o,i]=n.useState(null);return{callApi:n.useCallback(async({apiFunc:e,onSuccess:n,onError:l,successMessage:s,errorMessage:a,loadingState:u,enableLoading:c=!0,showError:d=!0})=>{c&&t(!0),null==u||u(!0);const f=await e();return c&&t(!1),null==u||u(!1),function({res:e,callBack:n,showError:t=!0,errorCallback:o,succsessMessage:i=null}){var l,s;if("rejected"===(null==(l=null==e?void 0:e.meta)?void 0:l.requestStatus)){const n=(()=>{var n,t,r;try{return(null==(n=e.error)?void 0:n.message)||(null==(t=null==e?void 0:e.payload)?void 0:t.message)?JSON.parse((null==(r=null==e?void 0:e.payload)?void 0:r.message)||e.error.message):null}catch{return{message:"Something went wrong"}}})(),i=(null==(s=null==n?void 0:n.message)?void 0:s.replace("Error:","").trim())||"Something went wrong";return t&&r.enqueueSnackbar(i,{variant:"error"}),void(o&&"function"==typeof o&&o(i))}i&&r.enqueueSnackbar(i),n&&"function"==typeof n&&n()}({res:f,callBack:()=>{null==n||n(f)},errorCallback:e=>{null==l||l(f),i(a||e)},succsessMessage:s,showError:d}),{response:f,error:o}},[]),loading:e,error:o}}let u="",c={};const d=e=>{var n;u=(n=e).endsWith("/")?n.slice(0,-1):n},f=async e=>await(async(e,n)=>{const t=new URLSearchParams;["skip","limit","order","filters","search","select"].forEach(e=>{var r;n[e]&&(Array.isArray(n[e])?n[e].forEach(n=>{t.append(e,n)}):t.append(e,(null==(r=n[e])?void 0:r.toString())||"")),delete n[e]});const r={...c};void 0!==n["x-token"]&&(r["x-token"]=n["x-token"],delete n["x-token"]),void 0!==n["x-timezone"]&&(r["x-timezone"]=n["x-timezone"],delete n["x-timezone"]);const o=await fetch(`${e}/v1/settings/configurations?${t.toString()}`,{headers:r});if(!o.ok)throw new Error(await o.text());return await o.json()})(u,e);i.onApiConfigReady(e=>{const n=e.backendBaseUrl;d(`${n}/accounting`)});const p=({control:e,setValue:t,fieldToUpdate:r,transformResponse:i,watch:l,fieldArrayName:s,companyField:u="company_id",locationField:c="location_id",departmentField:d="department_id",customDependencies:p=[],getFieldState:m,isUpdateAccount:v=!1})=>{var y,g,h;const{callApi:$}=a(),[x,w]=n.useState(null),k=s?`${s}.${u}`:u,b=s?`${s}.${c}`:c,A=s?`${s}.${d}`:d,F=(null==l?void 0:l(`${s}`))||{},E=null==(y=null==m?void 0:m(k))?void 0:y.isDirty,S=null==(g=null==m?void 0:m(b))?void 0:g.isDirty,_=null==(h=null==m?void 0:m(A))?void 0:h.isDirty,C=(null==F?void 0:F[u])||null,j=(null==F?void 0:F[c])||null,q=(null==F?void 0:F[d])||null;n.useEffect(()=>{if(l&&!x){const e={[u]:C,[c]:j,[d]:q},n={};Object.keys(r).forEach(e=>{const t=s?`${s}.${e}`:e;n[e]=l(t)}),w({filters:e,values:n})}},[l,C,j,q,x,k,b,A,E,S,_]);const P=n.useCallback((e,n=!1)=>{if(!t||!e)return;const o=i?i(e):e;o&&Object.entries(r).forEach(([e,r])=>{const i=null==o?void 0:o.find(e=>(null==e?void 0:e.config_key)==("object"==typeof r?r.key:r));if(null!=i){const o=s?`${s}.${e}`:e;if(!n){const e=null==l?void 0:l(o);if(null!=e&&""!==e)return}"object"==typeof r?r.value((null==i?void 0:i.reference_id)||(null==i?void 0:i.reference_text)):t(o,(null==i?void 0:i.reference_id)||(null==i?void 0:i.reference_text))}})},[t,r,i,s,l,...p]),M=n.useCallback(async()=>{if(!C||!x)return;const e=e=>{if(Array.isArray(e)){if(0===e.length)return null;const n=e[0];return n&&"object"==typeof n?n.id||n.value||null:n||null}return e&&"object"==typeof e?e.id||e.value||null:e||null},n=e(C),i=e(j),a=e(q);if(!n||!x)return;const p=e(x.filters[u]),m=e(x.filters[c]),y=e(x.filters[d]),g=p!==n||m!==i||y!==a,h=Object.keys(r).every(e=>{const n=null==l?void 0:l(s?`${s}.${e}`:e);return null==n||""===n});if(!g&&!v&&!h)return void Object.entries(x.values).forEach(([e,n])=>{null==t||t(s?`${s}.${e}`:e,n)});const w=`(company_id.eq=${n||1}&location_id.eq=${i||null}&department_id.eq=${a||null})`,k=v?g&&(E||S||_):g;$({apiFunc:()=>f({...o.getToken(),filters:w}),onSuccess:e=>{var n;P(null==(n=null==e?void 0:e.data)?void 0:n.configuration_list,k)},onError:e=>{}})},[C,j,q,x,$,t,E,S,_,v]);return n.useEffect(()=>{M()},[M]),{selectedCompany:C,selectedLocation:j,selectedDepartment:q}};exports.initializeApiBaseUrls=function(){if(!i.isApiConfigInitialized())return;const e=i.getApiConfig().backendBaseUrl;d(`${e}/accounting`)},exports.useAccountingSetting=({fieldToUpdate:e,fieldArrayName:n,companyField:t="company_id",locationField:r="location_id",departmentField:o="department_id",formMethods:i,customDependencies:l=[],...s})=>{const{setValue:a,control:u,watch:c,getFieldState:d}=i||{};return p({control:u,setValue:a,watch:c,companyField:t,locationField:r,departmentField:o,fieldToUpdate:e,fieldArrayName:n,customDependencies:l,getFieldState:d,...s})},exports.useApi=a,exports.useDeepMemo=function(e){const t=n.useRef();return s.isEqual(t.current,e)||(t.current=e),t.current},exports.useFormFieldUpdater=p,exports.useLocationFilter=({selectedCompany:e,setValue:t,fieldArrayName:r,locationFieldName:o,resetValue:i=null,filterKey:l="&company_id.in",isDirty:s=!1})=>{n.useEffect(()=>{t&&r&&o&&s&&t(`${r}.${o}`,i)},[s,t,r,o,i]);return n.useMemo(()=>{const n=Array.isArray(e)?(null==e?void 0:e.length)?e:null:e||null;return null===n?{}:{[l]:n}},[e,l])},exports.useMultipleLocationFilters=({selectedCompany:e,setValue:t,fieldConfigs:r,resetValue:o,filterKey:i="&company_id.in"})=>n.useMemo(()=>{const n=(null==e?void 0:e.length)>0?e:0;return r.forEach(({fieldArrayName:e,locationFieldName:n})=>{t&&e&&n&&t(`${e}.${n}`,o)}),{[i]:n}},[e,t,r,o,i]),exports.usePages=(e=[])=>{const r=n.useContext(t.PageContext);if(!r)throw new Error("usePages must be used within a PageProvider");return r.initializeColumns&&r.initializeColumns(e),r},exports.usePermissions=()=>{const e=n.useContext(t.PermissionsContext);if(!e)throw new Error("usePermissions must be used within a PermissionsProvider");return e};
2
+ //# sourceMappingURL=useAccountSetting-CNoWakIN.js.map