@erpsquad/common 1.11.29 → 1.11.30
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/chunks/DonutChart-BlzVwF9V.js +104 -0
- package/dist/chunks/DonutChart-BlzVwF9V.js.map +1 -0
- package/dist/chunks/DonutChart-CBaRNVKd.esm.js +88 -0
- package/dist/chunks/DonutChart-CBaRNVKd.esm.js.map +1 -0
- package/dist/chunks/DynamicDependentField-B1jkZzNW.js +127 -0
- package/dist/chunks/DynamicDependentField-B1jkZzNW.js.map +1 -0
- package/dist/chunks/DynamicDependentField-m4v2i_Ss.esm.js +128 -0
- package/dist/chunks/DynamicDependentField-m4v2i_Ss.esm.js.map +1 -0
- package/dist/chunks/ERPUIProvider-D1yQ1CmD.esm.js +130 -0
- package/dist/chunks/ERPUIProvider-D1yQ1CmD.esm.js.map +1 -0
- package/dist/chunks/ERPUIProvider-O6cQFkJq.js +129 -0
- package/dist/chunks/ERPUIProvider-O6cQFkJq.js.map +1 -0
- package/dist/chunks/FORMS-CP_bWKVd.js +295 -0
- package/dist/chunks/FORMS-CP_bWKVd.js.map +1 -0
- package/dist/chunks/FORMS-D1M0DgHQ.esm.js +296 -0
- package/dist/chunks/FORMS-D1M0DgHQ.esm.js.map +1 -0
- package/dist/chunks/FlexibleReduxExample-Ckz_L6d8.esm.js +149 -0
- package/dist/chunks/FlexibleReduxExample-Ckz_L6d8.esm.js.map +1 -0
- package/dist/chunks/FlexibleReduxExample-Df-bAX9S.js +148 -0
- package/dist/chunks/FlexibleReduxExample-Df-bAX9S.js.map +1 -0
- package/dist/chunks/GroupBarChart-BSLOA0iQ.js +102 -0
- package/dist/chunks/GroupBarChart-BSLOA0iQ.js.map +1 -0
- package/dist/chunks/GroupBarChart-lhrIpM1h.esm.js +86 -0
- package/dist/chunks/GroupBarChart-lhrIpM1h.esm.js.map +1 -0
- package/dist/chunks/SectionFlowEditor-D1v29JFf.esm.js +5479 -0
- package/dist/chunks/SectionFlowEditor-D1v29JFf.esm.js.map +1 -0
- package/dist/chunks/SectionFlowEditor-D58o14CY.js +5478 -0
- package/dist/chunks/SectionFlowEditor-D58o14CY.js.map +1 -0
- package/dist/chunks/action-bar-D4SYJgTT.js +660 -0
- package/dist/chunks/action-bar-D4SYJgTT.js.map +1 -0
- package/dist/chunks/action-bar-D4Siz93J.esm.js +661 -0
- package/dist/chunks/action-bar-D4Siz93J.esm.js.map +1 -0
- package/dist/chunks/actionCreator-0uQghTUt.esm.js +22 -0
- package/dist/chunks/actionCreator-0uQghTUt.esm.js.map +1 -0
- package/dist/chunks/actionCreator-BIur2_cF.esm.js +28 -0
- package/dist/chunks/actionCreator-BIur2_cF.esm.js.map +1 -0
- package/dist/chunks/actionCreator-BYzzSzcP.esm.js +14 -0
- package/dist/chunks/actionCreator-BYzzSzcP.esm.js.map +1 -0
- package/dist/chunks/actionCreator-Cddz6Hfa.js +27 -0
- package/dist/chunks/actionCreator-Cddz6Hfa.js.map +1 -0
- package/dist/chunks/actionCreator-D45ZRUYG.js +13 -0
- package/dist/chunks/actionCreator-D45ZRUYG.js.map +1 -0
- package/dist/chunks/actionCreator-DA134jFh.js +21 -0
- package/dist/chunks/actionCreator-DA134jFh.js.map +1 -0
- package/dist/chunks/actionCreator-DCvH3aya.esm.js +79 -0
- package/dist/chunks/actionCreator-DCvH3aya.esm.js.map +1 -0
- package/dist/chunks/actionCreator-P2el50Ij.js +93 -0
- package/dist/chunks/actionCreator-P2el50Ij.js.map +1 -0
- package/dist/chunks/actionCreator-Ux93gVSu.esm.js +94 -0
- package/dist/chunks/actionCreator-Ux93gVSu.esm.js.map +1 -0
- package/dist/chunks/actionCreator-tNh5lk4r.js +78 -0
- package/dist/chunks/actionCreator-tNh5lk4r.js.map +1 -0
- package/dist/chunks/activity-log-ByIo_G8q.esm.js +104 -0
- package/dist/chunks/activity-log-ByIo_G8q.esm.js.map +1 -0
- package/dist/chunks/activity-log-Cyne0qwm.js +103 -0
- package/dist/chunks/activity-log-Cyne0qwm.js.map +1 -0
- package/dist/chunks/add-template-BYyqpxVx.js +10 -0
- package/dist/chunks/add-template-BYyqpxVx.js.map +1 -0
- package/dist/chunks/add-template-D1Ro9dcG.esm.js +11 -0
- package/dist/chunks/add-template-D1Ro9dcG.esm.js.map +1 -0
- package/dist/chunks/address-modal-CfE5Ae8t.js +680 -0
- package/dist/chunks/address-modal-CfE5Ae8t.js.map +1 -0
- package/dist/chunks/address-modal-gRlouRj8.esm.js +664 -0
- package/dist/chunks/address-modal-gRlouRj8.esm.js.map +1 -0
- package/dist/chunks/ai-summary-BxB8Rnuk.js +350 -0
- package/dist/chunks/ai-summary-BxB8Rnuk.js.map +1 -0
- package/dist/chunks/ai-summary-CxAKUX2p.esm.js +351 -0
- package/dist/chunks/ai-summary-CxAKUX2p.esm.js.map +1 -0
- package/dist/chunks/api-DwmixHAO.js +5922 -0
- package/dist/chunks/api-DwmixHAO.js.map +1 -0
- package/dist/chunks/api-u1lKzJVv.esm.js +5923 -0
- package/dist/chunks/api-u1lKzJVv.esm.js.map +1 -0
- package/dist/chunks/appbar-B9EKR8QS.esm.js +57 -0
- package/dist/chunks/appbar-B9EKR8QS.esm.js.map +1 -0
- package/dist/chunks/appbar-Dt_exHJ3.js +56 -0
- package/dist/chunks/appbar-Dt_exHJ3.js.map +1 -0
- package/dist/chunks/approval-wrapper-C8iOUYeE.js +139 -0
- package/dist/chunks/approval-wrapper-C8iOUYeE.js.map +1 -0
- package/dist/chunks/approval-wrapper-OmXAoB9R.esm.js +140 -0
- package/dist/chunks/approval-wrapper-OmXAoB9R.esm.js.map +1 -0
- package/dist/chunks/areaLinerChart-BEiJvhIq.esm.js +104 -0
- package/dist/chunks/areaLinerChart-BEiJvhIq.esm.js.map +1 -0
- package/dist/chunks/areaLinerChart-DetB92LI.js +120 -0
- package/dist/chunks/areaLinerChart-DetB92LI.js.map +1 -0
- package/dist/chunks/bar-chart-BjAvgQJP.esm.js +87 -0
- package/dist/chunks/bar-chart-BjAvgQJP.esm.js.map +1 -0
- package/dist/chunks/bar-chart-HkOgepOg.js +103 -0
- package/dist/chunks/bar-chart-HkOgepOg.js.map +1 -0
- package/dist/chunks/barChart-B-WO75Ok.js +160 -0
- package/dist/chunks/barChart-B-WO75Ok.js.map +1 -0
- package/dist/chunks/barChart-BLhVsRwm.esm.js +144 -0
- package/dist/chunks/barChart-BLhVsRwm.esm.js.map +1 -0
- package/dist/chunks/barLinechart-D3G4VUJZ.esm.js +180 -0
- package/dist/chunks/barLinechart-D3G4VUJZ.esm.js.map +1 -0
- package/dist/chunks/barLinechart-DEfYJvJj.js +196 -0
- package/dist/chunks/barLinechart-DEfYJvJj.js.map +1 -0
- package/dist/chunks/calculation-summary-GdbtqnzK.esm.js +193 -0
- package/dist/chunks/calculation-summary-GdbtqnzK.esm.js.map +1 -0
- package/dist/chunks/calculation-summary-IGoIPXGL.js +192 -0
- package/dist/chunks/calculation-summary-IGoIPXGL.js.map +1 -0
- package/dist/chunks/chat-bot-BIXoGUj-.js +3609 -0
- package/dist/chunks/chat-bot-BIXoGUj-.js.map +1 -0
- package/dist/chunks/chat-bot-DURQfOqY.esm.js +3610 -0
- package/dist/chunks/chat-bot-DURQfOqY.esm.js.map +1 -0
- package/dist/chunks/common-utility-BLazlXzI.js +300 -0
- package/dist/chunks/common-utility-BLazlXzI.js.map +1 -0
- package/dist/chunks/common-utility-BQcU3rOh.esm.js +301 -0
- package/dist/chunks/common-utility-BQcU3rOh.esm.js.map +1 -0
- package/dist/chunks/custom-date-picker-BCcOhhvL.js +55 -0
- package/dist/chunks/custom-date-picker-BCcOhhvL.js.map +1 -0
- package/dist/chunks/custom-date-picker-qIdI_Mxe.esm.js +56 -0
- package/dist/chunks/custom-date-picker-qIdI_Mxe.esm.js.map +1 -0
- package/dist/chunks/custom-editor-CPTkZWIZ.js +1257 -0
- package/dist/chunks/custom-editor-CPTkZWIZ.js.map +1 -0
- package/dist/chunks/custom-editor-De9IWFLM.esm.js +1257 -0
- package/dist/chunks/custom-editor-De9IWFLM.esm.js.map +1 -0
- package/dist/chunks/custom-form-BoIrVoZW.esm.js +1146 -0
- package/dist/chunks/custom-form-BoIrVoZW.esm.js.map +1 -0
- package/dist/chunks/custom-form-DgnkFIZM.js +1145 -0
- package/dist/chunks/custom-form-DgnkFIZM.js.map +1 -0
- package/dist/chunks/custom-grid-card-DWv2PDQb.esm.js +128 -0
- package/dist/chunks/custom-grid-card-DWv2PDQb.esm.js.map +1 -0
- package/dist/chunks/custom-grid-card-H63FyqOk.js +127 -0
- package/dist/chunks/custom-grid-card-H63FyqOk.js.map +1 -0
- package/dist/chunks/dashboard-CVAH7i-8.esm.js +75 -0
- package/dist/chunks/dashboard-CVAH7i-8.esm.js.map +1 -0
- package/dist/chunks/dashboard-Drpz8zP5.js +74 -0
- package/dist/chunks/dashboard-Drpz8zP5.js.map +1 -0
- package/dist/chunks/date-BN5rVQeb.js +55 -0
- package/dist/chunks/date-BN5rVQeb.js.map +1 -0
- package/dist/chunks/date-CZNWJ8r7.esm.js +56 -0
- package/dist/chunks/date-CZNWJ8r7.esm.js.map +1 -0
- package/dist/chunks/date-format-settings-DohP3zvG.esm.js +117 -0
- package/dist/chunks/date-format-settings-DohP3zvG.esm.js.map +1 -0
- package/dist/chunks/date-format-settings-QiQTyiTn.js +116 -0
- package/dist/chunks/date-format-settings-QiQTyiTn.js.map +1 -0
- package/dist/chunks/date-picker-BAf8u-E9.esm.js +129 -0
- package/dist/chunks/date-picker-BAf8u-E9.esm.js.map +1 -0
- package/dist/chunks/date-picker-Dv_dfc9e.js +128 -0
- package/dist/chunks/date-picker-Dv_dfc9e.js.map +1 -0
- package/dist/chunks/date-range-picker-BHAVj3qf.js +62 -0
- package/dist/chunks/date-range-picker-BHAVj3qf.js.map +1 -0
- package/dist/chunks/date-range-picker-Ce01L3eF.esm.js +198 -0
- package/dist/chunks/date-range-picker-Ce01L3eF.esm.js.map +1 -0
- package/dist/chunks/date-range-picker-Dt6ODTKk.js +197 -0
- package/dist/chunks/date-range-picker-Dt6ODTKk.js.map +1 -0
- package/dist/chunks/date-range-picker-XrXYvhk6.esm.js +63 -0
- package/dist/chunks/date-range-picker-XrXYvhk6.esm.js.map +1 -0
- package/dist/chunks/date-time-Cscyu2JC.esm.js +55 -0
- package/dist/chunks/date-time-Cscyu2JC.esm.js.map +1 -0
- package/dist/chunks/date-time-DnEKq5ca.js +54 -0
- package/dist/chunks/date-time-DnEKq5ca.js.map +1 -0
- package/dist/chunks/date-time-picker-DOjxcYjT.js +115 -0
- package/dist/chunks/date-time-picker-DOjxcYjT.js.map +1 -0
- package/dist/chunks/date-time-picker-Dcs1e1Bc.esm.js +116 -0
- package/dist/chunks/date-time-picker-Dcs1e1Bc.esm.js.map +1 -0
- package/dist/chunks/dateFormat-BU9us1HO.esm.js +58 -0
- package/dist/chunks/dateFormat-BU9us1HO.esm.js.map +1 -0
- package/dist/chunks/dateFormat-MGjtBNwQ.js +57 -0
- package/dist/chunks/dateFormat-MGjtBNwQ.js.map +1 -0
- package/dist/chunks/discount-summary-C2L7GwJ5.esm.js +60 -0
- package/dist/chunks/discount-summary-C2L7GwJ5.esm.js.map +1 -0
- package/dist/chunks/discount-summary-CdrsdFbM.js +59 -0
- package/dist/chunks/discount-summary-CdrsdFbM.js.map +1 -0
- package/dist/chunks/dynamic-report-Bq614rL9.esm.js +589 -0
- package/dist/chunks/dynamic-report-Bq614rL9.esm.js.map +1 -0
- package/dist/chunks/dynamic-report-Dc2pd29H.js +588 -0
- package/dist/chunks/dynamic-report-Dc2pd29H.js.map +1 -0
- package/dist/chunks/dynamic-rows-BMj3evxl.js +249 -0
- package/dist/chunks/dynamic-rows-BMj3evxl.js.map +1 -0
- package/dist/chunks/dynamic-rows-Bi_L6K1Q.esm.js +250 -0
- package/dist/chunks/dynamic-rows-Bi_L6K1Q.esm.js.map +1 -0
- package/dist/chunks/dynamic-text-editor-BzyWihOp.js +44 -0
- package/dist/chunks/dynamic-text-editor-BzyWihOp.js.map +1 -0
- package/dist/chunks/dynamic-text-editor-FtzncH90.esm.js +45 -0
- package/dist/chunks/dynamic-text-editor-FtzncH90.esm.js.map +1 -0
- package/dist/chunks/edit-section-modal-By1pY8Kd.js +76 -0
- package/dist/chunks/edit-section-modal-By1pY8Kd.js.map +1 -0
- package/dist/chunks/edit-section-modal-lx44BKxM.esm.js +77 -0
- package/dist/chunks/edit-section-modal-lx44BKxM.esm.js.map +1 -0
- package/dist/chunks/filter-3x9UWii1.js +414 -0
- package/dist/chunks/filter-3x9UWii1.js.map +1 -0
- package/dist/chunks/filter-BnSYAact.esm.js +415 -0
- package/dist/chunks/filter-BnSYAact.esm.js.map +1 -0
- package/dist/chunks/footer-BDXx5kJG.esm.js +64 -0
- package/dist/chunks/footer-BDXx5kJG.esm.js.map +1 -0
- package/dist/chunks/footer-CNUL1un1.js +63 -0
- package/dist/chunks/footer-CNUL1un1.js.map +1 -0
- package/dist/chunks/form-fields-D7-_tDuw.esm.js +355 -0
- package/dist/chunks/form-fields-D7-_tDuw.esm.js.map +1 -0
- package/dist/chunks/form-fields-DYqWfI4L.js +354 -0
- package/dist/chunks/form-fields-DYqWfI4L.js.map +1 -0
- package/dist/chunks/form-parser-DgKyP2XE.esm.js +591 -0
- package/dist/chunks/form-parser-DgKyP2XE.esm.js.map +1 -0
- package/dist/chunks/form-parser-r9UB3j_l.js +607 -0
- package/dist/chunks/form-parser-r9UB3j_l.js.map +1 -0
- package/dist/chunks/form-section-B0UL95xN.esm.js +476 -0
- package/dist/chunks/form-section-B0UL95xN.esm.js.map +1 -0
- package/dist/chunks/form-section-Ra3TDNTJ.js +475 -0
- package/dist/chunks/form-section-Ra3TDNTJ.js.map +1 -0
- package/dist/chunks/format-chart-value-EdWQQL_n.esm.js +37 -0
- package/dist/chunks/format-chart-value-EdWQQL_n.esm.js.map +1 -0
- package/dist/chunks/format-chart-value-liFH0bwI.js +53 -0
- package/dist/chunks/format-chart-value-liFH0bwI.js.map +1 -0
- package/dist/chunks/fullScreen-CIO00GJA.js +20 -0
- package/dist/chunks/fullScreen-CIO00GJA.js.map +1 -0
- package/dist/chunks/fullScreen-Cf1lZpPP.esm.js +21 -0
- package/dist/chunks/fullScreen-Cf1lZpPP.esm.js.map +1 -0
- package/dist/chunks/global-search-BsF1AKA-.js +149 -0
- package/dist/chunks/global-search-BsF1AKA-.js.map +1 -0
- package/dist/chunks/global-search-DyHFvWRQ.esm.js +150 -0
- package/dist/chunks/global-search-DyHFvWRQ.esm.js.map +1 -0
- package/dist/chunks/grid-view-5_HV93Hf.esm.js +52 -0
- package/dist/chunks/grid-view-5_HV93Hf.esm.js.map +1 -0
- package/dist/chunks/grid-view-D0q_qMd2.js +51 -0
- package/dist/chunks/grid-view-D0q_qMd2.js.map +1 -0
- package/dist/chunks/header-DAad5p_7.js +90 -0
- package/dist/chunks/header-DAad5p_7.js.map +1 -0
- package/dist/chunks/header-S5MMcx4g.esm.js +91 -0
- package/dist/chunks/header-S5MMcx4g.esm.js.map +1 -0
- package/dist/chunks/header-enhanced-BPJQGGo7.js +400 -0
- package/dist/chunks/header-enhanced-BPJQGGo7.js.map +1 -0
- package/dist/chunks/header-enhanced-BtUsM1g3.esm.js +401 -0
- package/dist/chunks/header-enhanced-BtUsM1g3.esm.js.map +1 -0
- package/dist/chunks/inline-edit-fields-BXrrK0UT.esm.js +324 -0
- package/dist/chunks/inline-edit-fields-BXrrK0UT.esm.js.map +1 -0
- package/dist/chunks/inline-edit-fields-DeS-sx9_.js +340 -0
- package/dist/chunks/inline-edit-fields-DeS-sx9_.js.map +1 -0
- package/dist/chunks/inventory-reports-title-bar-CFqheEGb.js +733 -0
- package/dist/chunks/inventory-reports-title-bar-CFqheEGb.js.map +1 -0
- package/dist/chunks/inventory-reports-title-bar-CuPn69g7.esm.js +734 -0
- package/dist/chunks/inventory-reports-title-bar-CuPn69g7.esm.js.map +1 -0
- package/dist/chunks/item-response-details-BkE8ExKF.js +78 -0
- package/dist/chunks/item-response-details-BkE8ExKF.js.map +1 -0
- package/dist/chunks/item-response-details-FLk2xeBs.esm.js +79 -0
- package/dist/chunks/item-response-details-FLk2xeBs.esm.js.map +1 -0
- package/dist/chunks/listing-BlTk1lk7.js +275 -0
- package/dist/chunks/listing-BlTk1lk7.js.map +1 -0
- package/dist/chunks/listing-CBjRBr5T.esm.js +276 -0
- package/dist/chunks/listing-CBjRBr5T.esm.js.map +1 -0
- package/dist/chunks/location-select-BfXoscUj.esm.js +86 -0
- package/dist/chunks/location-select-BfXoscUj.esm.js.map +1 -0
- package/dist/chunks/location-select-C4r-bjZM.js +85 -0
- package/dist/chunks/location-select-C4r-bjZM.js.map +1 -0
- package/dist/chunks/material-editable-table-CUi1XChG.esm.js +1469 -0
- package/dist/chunks/material-editable-table-CUi1XChG.esm.js.map +1 -0
- package/dist/chunks/material-editable-table-DvOXRsag.js +1485 -0
- package/dist/chunks/material-editable-table-DvOXRsag.js.map +1 -0
- package/dist/chunks/module-reducer-1oIfrGzZ.js +91 -0
- package/dist/chunks/module-reducer-1oIfrGzZ.js.map +1 -0
- package/dist/chunks/module-reducer-Brv5y-yX.esm.js +92 -0
- package/dist/chunks/module-reducer-Brv5y-yX.esm.js.map +1 -0
- package/dist/chunks/multi-line-chart-CrQ7Hgm6.esm.js +96 -0
- package/dist/chunks/multi-line-chart-CrQ7Hgm6.esm.js.map +1 -0
- package/dist/chunks/multi-line-chart-DR6mEZ86.js +112 -0
- package/dist/chunks/multi-line-chart-DR6mEZ86.js.map +1 -0
- package/dist/chunks/notification-menu-B6DQbph4.js +600 -0
- package/dist/chunks/notification-menu-B6DQbph4.js.map +1 -0
- package/dist/chunks/notification-menu-BBEzqTvl.esm.js +601 -0
- package/dist/chunks/notification-menu-BBEzqTvl.esm.js.map +1 -0
- package/dist/chunks/page-action-BmdnKUie.js +324 -0
- package/dist/chunks/page-action-BmdnKUie.js.map +1 -0
- package/dist/chunks/page-action-DGnAycU4.esm.js +325 -0
- package/dist/chunks/page-action-DGnAycU4.esm.js.map +1 -0
- package/dist/chunks/page-navigator-BnJz0dir.esm.js +243 -0
- package/dist/chunks/page-navigator-BnJz0dir.esm.js.map +1 -0
- package/dist/chunks/page-navigator-qI4ptpIo.js +242 -0
- package/dist/chunks/page-navigator-qI4ptpIo.js.map +1 -0
- package/dist/chunks/page-view-BzUYT4aO.esm.js +324 -0
- package/dist/chunks/page-view-BzUYT4aO.esm.js.map +1 -0
- package/dist/chunks/page-view-CgKAg8Fs.js +323 -0
- package/dist/chunks/page-view-CgKAg8Fs.js.map +1 -0
- package/dist/chunks/quick-approval-modal--Uat95AK.js +272 -0
- package/dist/chunks/quick-approval-modal--Uat95AK.js.map +1 -0
- package/dist/chunks/quick-approval-modal-Cf5zDkO6.esm.js +256 -0
- package/dist/chunks/quick-approval-modal-Cf5zDkO6.esm.js.map +1 -0
- package/dist/chunks/reducer-5KSgWLUj.js +49 -0
- package/dist/chunks/reducer-5KSgWLUj.js.map +1 -0
- package/dist/chunks/reducer-BVEMC024.esm.js +33 -0
- package/dist/chunks/reducer-BVEMC024.esm.js.map +1 -0
- package/dist/chunks/reducer-Ba-Uxr0O.js +42 -0
- package/dist/chunks/reducer-Ba-Uxr0O.js.map +1 -0
- package/dist/chunks/reducer-C3gV86mN.esm.js +56 -0
- package/dist/chunks/reducer-C3gV86mN.esm.js.map +1 -0
- package/dist/chunks/reducer-C_1a_Ybe.js +32 -0
- package/dist/chunks/reducer-C_1a_Ybe.js.map +1 -0
- package/dist/chunks/reducer-DXCv8Ljo.esm.js +43 -0
- package/dist/chunks/reducer-DXCv8Ljo.esm.js.map +1 -0
- package/dist/chunks/reducer-DklAfYwo.js +55 -0
- package/dist/chunks/reducer-DklAfYwo.js.map +1 -0
- package/dist/chunks/reducer-DujEnCl-.js +147 -0
- package/dist/chunks/reducer-DujEnCl-.js.map +1 -0
- package/dist/chunks/reducer-PeqRGVlz.esm.js +148 -0
- package/dist/chunks/reducer-PeqRGVlz.esm.js.map +1 -0
- package/dist/chunks/reducer-e3sR-XbO.esm.js +50 -0
- package/dist/chunks/reducer-e3sR-XbO.esm.js.map +1 -0
- package/dist/chunks/reportFilter-DoD3vUsz.esm.js +396 -0
- package/dist/chunks/reportFilter-DoD3vUsz.esm.js.map +1 -0
- package/dist/chunks/reportFilter-DzgDlbu8.js +395 -0
- package/dist/chunks/reportFilter-DzgDlbu8.js.map +1 -0
- package/dist/chunks/reports-title-bar-BpeDKpyV.js +1027 -0
- package/dist/chunks/reports-title-bar-BpeDKpyV.js.map +1 -0
- package/dist/chunks/reports-title-bar-Bt9ogCT7.esm.js +1028 -0
- package/dist/chunks/reports-title-bar-Bt9ogCT7.esm.js.map +1 -0
- package/dist/chunks/route-page-map-LXxD_klV.js +8054 -0
- package/dist/chunks/route-page-map-LXxD_klV.js.map +1 -0
- package/dist/chunks/route-page-map-j4V1FsT3.esm.js +8055 -0
- package/dist/chunks/route-page-map-j4V1FsT3.esm.js.map +1 -0
- package/dist/chunks/routes-7yLS4Qxk.js +46 -0
- package/dist/chunks/routes-7yLS4Qxk.js.map +1 -0
- package/dist/chunks/routes-BE9OtJcV.esm.js +47 -0
- package/dist/chunks/routes-BE9OtJcV.esm.js.map +1 -0
- package/dist/chunks/schedule-report-B4hM1BQS.esm.js +236 -0
- package/dist/chunks/schedule-report-B4hM1BQS.esm.js.map +1 -0
- package/dist/chunks/schedule-report-D5Gtf9VF.js +235 -0
- package/dist/chunks/schedule-report-D5Gtf9VF.js.map +1 -0
- package/dist/chunks/schedule-report-modal-CFAdRSIO.esm.js +288 -0
- package/dist/chunks/schedule-report-modal-CFAdRSIO.esm.js.map +1 -0
- package/dist/chunks/schedule-report-modal-DDsrLqOm.js +287 -0
- package/dist/chunks/schedule-report-modal-DDsrLqOm.js.map +1 -0
- package/dist/chunks/searchable-select-5i6MO2Ys.esm.js +5431 -0
- package/dist/chunks/searchable-select-5i6MO2Ys.esm.js.map +1 -0
- package/dist/chunks/searchable-select-BsG-QlJk.js +5447 -0
- package/dist/chunks/searchable-select-BsG-QlJk.js.map +1 -0
- package/dist/chunks/share-modal-Bpa_0udn.esm.js +218 -0
- package/dist/chunks/share-modal-Bpa_0udn.esm.js.map +1 -0
- package/dist/chunks/share-modal-CaYg96t_.js +217 -0
- package/dist/chunks/share-modal-CaYg96t_.js.map +1 -0
- package/dist/chunks/share-modal-enhanced-B7JfgceP.esm.js +270 -0
- package/dist/chunks/share-modal-enhanced-B7JfgceP.esm.js.map +1 -0
- package/dist/chunks/share-modal-enhanced-BguLEFga.js +269 -0
- package/dist/chunks/share-modal-enhanced-BguLEFga.js.map +1 -0
- package/dist/chunks/sidebarScreen-DgpLalyG.js +200 -0
- package/dist/chunks/sidebarScreen-DgpLalyG.js.map +1 -0
- package/dist/chunks/sidebarScreen-Dp1e8Luz.esm.js +201 -0
- package/dist/chunks/sidebarScreen-Dp1e8Luz.esm.js.map +1 -0
- package/dist/chunks/store-CuKFQXI5.js +88 -0
- package/dist/chunks/store-CuKFQXI5.js.map +1 -0
- package/dist/chunks/store-KAx-wGcm.esm.js +89 -0
- package/dist/chunks/store-KAx-wGcm.esm.js.map +1 -0
- package/dist/chunks/table-CbV-bnb7.js +184 -0
- package/dist/chunks/table-CbV-bnb7.js.map +1 -0
- package/dist/chunks/table-Cdo7w_gv.esm.js +185 -0
- package/dist/chunks/table-Cdo7w_gv.esm.js.map +1 -0
- package/dist/chunks/table-form-CsxWI8HQ.esm.js +1537 -0
- package/dist/chunks/table-form-CsxWI8HQ.esm.js.map +1 -0
- package/dist/chunks/table-form-Dd2DNL6w.js +1536 -0
- package/dist/chunks/table-form-Dd2DNL6w.js.map +1 -0
- package/dist/chunks/template-editor-router-3FVvWm8W.js +8 -0
- package/dist/chunks/template-editor-router-3FVvWm8W.js.map +1 -0
- package/dist/chunks/template-editor-router-D0yZgK0u.esm.js +9 -0
- package/dist/chunks/template-editor-router-D0yZgK0u.esm.js.map +1 -0
- package/dist/chunks/template-modal-BHZbvEx9.esm.js +769 -0
- package/dist/chunks/template-modal-BHZbvEx9.esm.js.map +1 -0
- package/dist/chunks/template-modal-BuKxVaFw.js +768 -0
- package/dist/chunks/template-modal-BuKxVaFw.js.map +1 -0
- package/dist/chunks/templates-B_y-ywXc.esm.js +279 -0
- package/dist/chunks/templates-B_y-ywXc.esm.js.map +1 -0
- package/dist/chunks/templates-CtBwZgn9.js +278 -0
- package/dist/chunks/templates-CtBwZgn9.js.map +1 -0
- package/dist/chunks/text-measurement-BcBEexWP.js +251 -0
- package/dist/chunks/text-measurement-BcBEexWP.js.map +1 -0
- package/dist/chunks/text-measurement-w3Vk7SeS.esm.js +252 -0
- package/dist/chunks/text-measurement-w3Vk7SeS.esm.js.map +1 -0
- package/dist/chunks/total-summary-DPOMR8e4.esm.js +41 -0
- package/dist/chunks/total-summary-DPOMR8e4.esm.js.map +1 -0
- package/dist/chunks/total-summary-erUelIxr.js +40 -0
- package/dist/chunks/total-summary-erUelIxr.js.map +1 -0
- package/dist/chunks/translations-BnLuKxeJ.js +58 -0
- package/dist/chunks/translations-BnLuKxeJ.js.map +1 -0
- package/dist/chunks/translations-DQJAYm2A.esm.js +59 -0
- package/dist/chunks/translations-DQJAYm2A.esm.js.map +1 -0
- package/dist/chunks/uom-field-wrapper-BlwUeXmo.js +79 -0
- package/dist/chunks/uom-field-wrapper-BlwUeXmo.js.map +1 -0
- package/dist/chunks/uom-field-wrapper-D2QSsD7M.esm.js +80 -0
- package/dist/chunks/uom-field-wrapper-D2QSsD7M.esm.js.map +1 -0
- package/dist/chunks/upload-excel-DF6rPBeA.esm.js +361 -0
- package/dist/chunks/upload-excel-DF6rPBeA.esm.js.map +1 -0
- package/dist/chunks/upload-excel-vbTf63qn.js +360 -0
- package/dist/chunks/upload-excel-vbTf63qn.js.map +1 -0
- package/dist/chunks/use-translations-C_AFtNWf.esm.js +62 -0
- package/dist/chunks/use-translations-C_AFtNWf.esm.js.map +1 -0
- package/dist/chunks/use-translations-Dnm_y9o4.js +61 -0
- package/dist/chunks/use-translations-Dnm_y9o4.js.map +1 -0
- package/dist/chunks/useAccountSetting-BimM7OxP.js +172 -0
- package/dist/chunks/useAccountSetting-BimM7OxP.js.map +1 -0
- package/dist/chunks/useAccountSetting-BsIE2d1l.esm.js +173 -0
- package/dist/chunks/useAccountSetting-BsIE2d1l.esm.js.map +1 -0
- package/dist/chunks/useCheckSkuAndName-C0twPQja.esm.js +50 -0
- package/dist/chunks/useCheckSkuAndName-C0twPQja.esm.js.map +1 -0
- package/dist/chunks/useCheckSkuAndName-CQq8Le-_.js +49 -0
- package/dist/chunks/useCheckSkuAndName-CQq8Le-_.js.map +1 -0
- package/dist/chunks/useReduxIntegration-B5GrPUbT.js +38 -0
- package/dist/chunks/useReduxIntegration-B5GrPUbT.js.map +1 -0
- package/dist/chunks/useReduxIntegration-DzhcP34r.esm.js +39 -0
- package/dist/chunks/useReduxIntegration-DzhcP34r.esm.js.map +1 -0
- package/dist/chunks/useUniquenessCheck-BIT9TNYY.esm.js +39 -0
- package/dist/chunks/useUniquenessCheck-BIT9TNYY.esm.js.map +1 -0
- package/dist/chunks/useUniquenessCheck-VBBQqtYP.js +38 -0
- package/dist/chunks/useUniquenessCheck-VBBQqtYP.js.map +1 -0
- package/dist/chunks/useVendorAICompare-Bu4fjpby.esm.js +31 -0
- package/dist/chunks/useVendorAICompare-Bu4fjpby.esm.js.map +1 -0
- package/dist/chunks/useVendorAICompare-Cad1SOQx.js +30 -0
- package/dist/chunks/useVendorAICompare-Cad1SOQx.js.map +1 -0
- package/dist/chunks/value-editor-CtppXtUW.js +266 -0
- package/dist/chunks/value-editor-CtppXtUW.js.map +1 -0
- package/dist/chunks/value-editor-xwtdV2gn.esm.js +267 -0
- package/dist/chunks/value-editor-xwtdV2gn.esm.js.map +1 -0
- package/dist/chunks/vendor-ai-summary-Cf8yBCJC.js +227 -0
- package/dist/chunks/vendor-ai-summary-Cf8yBCJC.js.map +1 -0
- package/dist/chunks/vendor-ai-summary-w6_aC72U.esm.js +228 -0
- package/dist/chunks/vendor-ai-summary-w6_aC72U.esm.js.map +1 -0
- package/dist/components/action-bar/action-bar/index.esm.js +1 -1
- package/dist/components/action-bar/action-bar/index.js +1 -1
- package/dist/components/action-bar/index.esm.js +1 -1
- package/dist/components/action-bar/index.js +1 -1
- package/dist/components/activityLog/activity-log/index.esm.js +1 -1
- package/dist/components/activityLog/activity-log/index.js +1 -1
- package/dist/components/activityLog/index.esm.js +1 -1
- package/dist/components/activityLog/index.js +1 -1
- package/dist/components/address-modal/index.esm.js +1 -1
- package/dist/components/address-modal/index.js +1 -1
- package/dist/components/ai-summary/ai-summary/index.esm.js +1 -1
- package/dist/components/ai-summary/ai-summary/index.js +1 -1
- package/dist/components/ai-summary/index.esm.js +1 -1
- package/dist/components/ai-summary/index.js +1 -1
- package/dist/components/appbar/appbar/index.esm.js +1 -1
- package/dist/components/appbar/appbar/index.js +1 -1
- package/dist/components/appbar/index.esm.js +1 -1
- package/dist/components/appbar/index.js +1 -1
- package/dist/components/approval-wrapper/approval-wrapper/index.esm.js +1 -1
- package/dist/components/approval-wrapper/approval-wrapper/index.js +1 -1
- package/dist/components/approval-wrapper/index.esm.js +1 -1
- package/dist/components/approval-wrapper/index.js +1 -1
- package/dist/components/calculation-summary/calculation-summary/index.esm.js +1 -1
- package/dist/components/calculation-summary/calculation-summary/index.js +1 -1
- package/dist/components/calculation-summary/components/discount-summary/index.esm.js +1 -1
- package/dist/components/calculation-summary/components/discount-summary/index.js +1 -1
- package/dist/components/calculation-summary/components/index.esm.js +2 -2
- package/dist/components/calculation-summary/components/index.js +2 -2
- package/dist/components/calculation-summary/components/total-summary/index.esm.js +1 -1
- package/dist/components/calculation-summary/components/total-summary/index.js +1 -1
- package/dist/components/calculation-summary/index.esm.js +3 -3
- package/dist/components/calculation-summary/index.js +3 -3
- package/dist/components/charts/areaLinerChart/index.esm.js +1 -1
- package/dist/components/charts/areaLinerChart/index.js +1 -1
- package/dist/components/charts/bar-chart/bar-chart/index.esm.js +1 -1
- package/dist/components/charts/bar-chart/bar-chart/index.js +1 -1
- package/dist/components/charts/bar-chart/index.esm.js +1 -1
- package/dist/components/charts/bar-chart/index.js +1 -1
- package/dist/components/charts/barChart/barChart/index.esm.js +1 -1
- package/dist/components/charts/barChart/barChart/index.js +1 -1
- package/dist/components/charts/barChart/index.esm.js +1 -1
- package/dist/components/charts/barChart/index.js +1 -1
- package/dist/components/charts/barLineChart/barLinechart/index.esm.js +1 -1
- package/dist/components/charts/barLineChart/barLinechart/index.js +1 -1
- package/dist/components/charts/barLineChart/index.esm.js +1 -1
- package/dist/components/charts/barLineChart/index.js +1 -1
- package/dist/components/charts/donutChart/DonutChart/index.esm.js +1 -1
- package/dist/components/charts/donutChart/DonutChart/index.js +1 -1
- package/dist/components/charts/donutChart/index.esm.js +1 -1
- package/dist/components/charts/donutChart/index.js +1 -1
- package/dist/components/charts/groupBarChart/GroupBarChart/index.esm.js +1 -1
- package/dist/components/charts/groupBarChart/GroupBarChart/index.js +1 -1
- package/dist/components/charts/groupBarChart/index.esm.js +1 -1
- package/dist/components/charts/groupBarChart/index.js +1 -1
- package/dist/components/charts/index.esm.js +7 -7
- package/dist/components/charts/index.js +7 -7
- package/dist/components/charts/multiLineChart/index.esm.js +1 -1
- package/dist/components/charts/multiLineChart/index.js +1 -1
- package/dist/components/charts/multiLineChart/multi-line-chart/index.esm.js +1 -1
- package/dist/components/charts/multiLineChart/multi-line-chart/index.js +1 -1
- package/dist/components/chat-bot/index.esm.js +2 -1
- package/dist/components/chat-bot/index.js +2 -1
- package/dist/components/chat-bot/index.js.map +1 -1
- package/dist/components/custom-forms/FORMS/index.esm.js +1 -1
- package/dist/components/custom-forms/FORMS/index.js +1 -1
- package/dist/components/custom-forms/grid-view/grid-view/index.esm.js +1 -1
- package/dist/components/custom-forms/grid-view/grid-view/index.js +1 -1
- package/dist/components/custom-forms/grid-view/index.esm.js +1 -1
- package/dist/components/custom-forms/grid-view/index.js +1 -1
- package/dist/components/custom-forms/index.esm.js +2 -2
- package/dist/components/custom-forms/index.js +2 -2
- package/dist/components/customer-ai-summary/index.esm.js +1 -1
- package/dist/components/customer-ai-summary/index.js +1 -1
- package/dist/components/date-picker/date-picker/index.esm.js +1 -1
- package/dist/components/date-picker/date-picker/index.js +1 -1
- package/dist/components/date-picker/index.esm.js +2 -2
- package/dist/components/date-picker/index.js +2 -2
- package/dist/components/date-range-picker/date-range-picker/index.esm.js +1 -1
- package/dist/components/date-range-picker/date-range-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.esm.js +2 -2
- package/dist/components/date-range-picker/index.js +2 -2
- package/dist/components/date-time-picker/date-time-picker/index.esm.js +1 -1
- package/dist/components/date-time-picker/date-time-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.esm.js +2 -2
- package/dist/components/date-time-picker/index.js +2 -2
- package/dist/components/department-add-modal/index.esm.js +1 -1
- package/dist/components/department-add-modal/index.js +1 -1
- package/dist/components/designation-add-modal/index.esm.js +1 -1
- package/dist/components/designation-add-modal/index.js +1 -1
- package/dist/components/editor/custom-editor/index.esm.js +1 -1
- package/dist/components/editor/custom-editor/index.js +1 -1
- package/dist/components/editor/index.esm.js +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/examples/FlexibleReduxExample/index.esm.js +1 -1
- package/dist/components/examples/FlexibleReduxExample/index.js +1 -1
- package/dist/components/examples/index.esm.js +1 -1
- package/dist/components/examples/index.js +1 -1
- package/dist/components/filter/components/index.esm.js +1 -1
- package/dist/components/filter/components/index.js +1 -1
- package/dist/components/filter/components/value-editor/index.esm.js +1 -1
- package/dist/components/filter/components/value-editor/index.js +1 -1
- package/dist/components/filter/filter/index.esm.js +1 -1
- package/dist/components/filter/filter/index.js +1 -1
- package/dist/components/filter/index.esm.js +2 -2
- package/dist/components/filter/index.js +2 -2
- package/dist/components/footer/footer/index.esm.js +1 -1
- package/dist/components/footer/footer/index.js +1 -1
- package/dist/components/footer/index.esm.js +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/custom-date-picker/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/custom-date-picker/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date-range-picker/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date-range-picker/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date-time/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/date-time/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-dependent-field/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-dependent-field/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-text-editor/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-text-editor/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/fixed-asset-item-add-modal/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/fixed-asset-item-add-modal/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/index.esm.js +8 -8
- package/dist/components/form-control/form-builder/form-builder-element/index.js +8 -8
- package/dist/components/form-control/form-builder/form-builder-element/location-add-modal/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/location-add-modal/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/select-configuration/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/select-configuration/index.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/table/index.esm.js +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/table/index.js +1 -1
- package/dist/components/form-control/form-builder/index.esm.js +8 -8
- package/dist/components/form-control/form-builder/index.js +8 -8
- package/dist/components/form-control/form-parser/form-parser/index.esm.js +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.js +1 -1
- package/dist/components/form-control/form-parser/form-section/index.esm.js +1 -1
- package/dist/components/form-control/form-parser/form-section/index.js +1 -1
- package/dist/components/form-control/form-parser/index.esm.js +2 -2
- package/dist/components/form-control/form-parser/index.js +2 -2
- package/dist/components/form-control/index.esm.js +10 -10
- package/dist/components/form-control/index.js +10 -10
- package/dist/components/grid/custom-grid-card/custom-grid-card/index.esm.js +1 -1
- package/dist/components/grid/custom-grid-card/custom-grid-card/index.js +1 -1
- package/dist/components/grid/custom-grid-card/index.esm.js +1 -1
- package/dist/components/grid/custom-grid-card/index.js +1 -1
- package/dist/components/grid/index.esm.js +1 -1
- package/dist/components/grid/index.js +1 -1
- package/dist/components/header/components/global-search/index.esm.js +1 -1
- package/dist/components/header/components/global-search/index.js +1 -1
- package/dist/components/header/components/index.esm.js +1 -1
- package/dist/components/header/components/index.js +1 -1
- package/dist/components/header/components/notification-menu/index.esm.js +1 -1
- package/dist/components/header/components/notification-menu/index.js +1 -1
- package/dist/components/header/components/notification-menu/notification-menu/index.esm.js +1 -1
- package/dist/components/header/components/notification-menu/notification-menu/index.js +1 -1
- package/dist/components/header/header/index.esm.js +1 -1
- package/dist/components/header/header/index.js +1 -1
- package/dist/components/header/header-enhanced/index.esm.js +1 -1
- package/dist/components/header/header-enhanced/index.js +1 -1
- package/dist/components/header/index.esm.js +5 -5
- package/dist/components/header/index.js +5 -5
- package/dist/components/header/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/header/redux/actionCreator/index.js +1 -1
- package/dist/components/header/redux/index.esm.js +2 -2
- package/dist/components/header/redux/index.js +2 -2
- package/dist/components/header/redux/reducer/index.esm.js +1 -1
- package/dist/components/header/redux/reducer/index.js +1 -1
- package/dist/components/index.esm.js +53 -53
- package/dist/components/index.js +53 -53
- package/dist/components/inventory-reports-title-bar/component/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/component/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/component/reportFilter/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/component/reportFilter/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/index.esm.js +4 -4
- package/dist/components/inventory-reports-title-bar/index.js +4 -4
- package/dist/components/inventory-reports-title-bar/inventory-reports-title-bar/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/inventory-reports-title-bar/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/index.esm.js +2 -2
- package/dist/components/inventory-reports-title-bar/redux/index.js +2 -2
- package/dist/components/inventory-reports-title-bar/redux/reducer/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/reducer/index.js +1 -1
- package/dist/components/listing/index.esm.js +1 -1
- package/dist/components/listing/index.js +1 -1
- package/dist/components/listing/listing/index.esm.js +1 -1
- package/dist/components/listing/listing/index.js +1 -1
- package/dist/components/location-select/index.esm.js +1 -1
- package/dist/components/location-select/index.js +1 -1
- package/dist/components/material-editable-table/components/index.esm.js +1 -1
- package/dist/components/material-editable-table/components/index.js +1 -1
- package/dist/components/material-editable-table/components/inline-edit-fields/index.esm.js +1 -1
- package/dist/components/material-editable-table/components/inline-edit-fields/index.js +1 -1
- package/dist/components/material-editable-table/index.esm.js +2 -2
- package/dist/components/material-editable-table/index.js +2 -2
- package/dist/components/material-editable-table/material-editable-table/index.esm.js +1 -1
- package/dist/components/material-editable-table/material-editable-table/index.js +1 -1
- package/dist/components/material-table/components/index.esm.js +1 -1
- package/dist/components/material-table/components/index.js +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.esm.js +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.js +1 -1
- package/dist/components/material-table/index.esm.js +1 -1
- package/dist/components/material-table/index.js +1 -1
- package/dist/components/material-table/material-table/index.esm.js +1 -1
- package/dist/components/material-table/material-table/index.js +1 -1
- package/dist/components/page-navigator/components/index.esm.js +1 -1
- package/dist/components/page-navigator/components/index.js +1 -1
- package/dist/components/page-navigator/components/page-action/index.esm.js +1 -1
- package/dist/components/page-navigator/components/page-action/index.js +1 -1
- package/dist/components/page-navigator/index.esm.js +2 -2
- package/dist/components/page-navigator/index.js +2 -2
- package/dist/components/page-navigator/page-navigator/index.esm.js +1 -1
- package/dist/components/page-navigator/page-navigator/index.js +1 -1
- package/dist/components/parties-modal/index.esm.js +1 -1
- package/dist/components/parties-modal/index.js +1 -1
- package/dist/components/parties-modal/parties-modal/index.esm.js +1 -1
- package/dist/components/parties-modal/parties-modal/index.js +1 -1
- package/dist/components/providers/ERPUIProvider/index.esm.js +1 -1
- package/dist/components/providers/ERPUIProvider/index.js +1 -1
- package/dist/components/providers/index.esm.js +1 -1
- package/dist/components/providers/index.js +1 -1
- package/dist/components/quick-approval-modal/index.esm.js +1 -1
- package/dist/components/quick-approval-modal/index.js +1 -1
- package/dist/components/quick-approval-modal/quick-approval-modal/index.esm.js +1 -1
- package/dist/components/quick-approval-modal/quick-approval-modal/index.js +1 -1
- package/dist/components/reports/dynamic-report/dynamic-report/index.esm.js +1 -1
- package/dist/components/reports/dynamic-report/dynamic-report/index.js +1 -1
- package/dist/components/reports/dynamic-report/dynamic-rows/index.esm.js +1 -1
- package/dist/components/reports/dynamic-report/dynamic-rows/index.js +1 -1
- package/dist/components/reports/dynamic-report/index.esm.js +2 -2
- package/dist/components/reports/dynamic-report/index.js +2 -2
- package/dist/components/reports/index.esm.js +2 -2
- package/dist/components/reports/index.js +2 -2
- package/dist/components/reports-title-bar/index.esm.js +3 -3
- package/dist/components/reports-title-bar/index.js +3 -3
- package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/reports-title-bar/redux/index.esm.js +2 -2
- package/dist/components/reports-title-bar/redux/index.js +2 -2
- package/dist/components/reports-title-bar/redux/reducer/index.esm.js +1 -1
- package/dist/components/reports-title-bar/redux/reducer/index.js +1 -1
- package/dist/components/reports-title-bar/reports-title-bar/index.esm.js +1 -1
- package/dist/components/reports-title-bar/reports-title-bar/index.js +1 -1
- package/dist/components/rfq-response/index.esm.js +1 -1
- package/dist/components/rfq-response/index.js +1 -1
- package/dist/components/rfq-response/item-response-details/index.esm.js +1 -1
- package/dist/components/rfq-response/item-response-details/index.js +1 -1
- package/dist/components/schedule-report/index.esm.js +2 -2
- package/dist/components/schedule-report/index.js +2 -2
- package/dist/components/schedule-report/schedule-report/index.esm.js +1 -1
- package/dist/components/schedule-report/schedule-report/index.js +1 -1
- package/dist/components/schedule-report/schedule-report-modal/index.esm.js +1 -1
- package/dist/components/schedule-report/schedule-report-modal/index.js +1 -1
- package/dist/components/searchable-select/index.esm.js +1 -1
- package/dist/components/searchable-select/index.js +1 -1
- package/dist/components/share-modal/index.esm.js +4 -4
- package/dist/components/share-modal/index.js +4 -4
- package/dist/components/share-modal/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
- package/dist/components/share-modal/redux/index.esm.js +2 -2
- package/dist/components/share-modal/redux/index.js +2 -2
- package/dist/components/share-modal/redux/reducer/index.esm.js +1 -1
- package/dist/components/share-modal/redux/reducer/index.js +1 -1
- package/dist/components/share-modal/share-modal/index.esm.js +1 -1
- package/dist/components/share-modal/share-modal/index.js +1 -1
- package/dist/components/share-modal/share-modal-enhanced/index.esm.js +1 -1
- package/dist/components/share-modal/share-modal-enhanced/index.js +1 -1
- package/dist/components/team-add-modal/index.esm.js +1 -1
- package/dist/components/team-add-modal/index.js +1 -1
- package/dist/components/uom-field-wrapper/index.esm.js +1 -1
- package/dist/components/uom-field-wrapper/index.js +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js +1 -1
- package/dist/components/upload-excel/index.esm.js +1 -1
- package/dist/components/upload-excel/index.js +1 -1
- package/dist/components/upload-excel/upload-excel/index.esm.js +1 -1
- package/dist/components/upload-excel/upload-excel/index.js +1 -1
- package/dist/components/vendor-ai-summary/index.esm.js +1 -1
- package/dist/components/vendor-ai-summary/index.js +1 -1
- package/dist/constants/index.esm.js +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/hooks/index.esm.js +6 -6
- package/dist/hooks/index.js +6 -6
- package/dist/hooks/use-translations/index.esm.js +1 -1
- package/dist/hooks/use-translations/index.js +1 -1
- package/dist/hooks/useAccountSetting/index.esm.js +1 -1
- package/dist/hooks/useAccountSetting/index.js +1 -1
- package/dist/hooks/useCheckSkuAndName/index.esm.js +1 -1
- package/dist/hooks/useCheckSkuAndName/index.js +1 -1
- package/dist/hooks/useReduxIntegration/index.esm.js +1 -1
- package/dist/hooks/useReduxIntegration/index.js +1 -1
- package/dist/hooks/useUniquenessCheck/index.esm.js +1 -1
- package/dist/hooks/useUniquenessCheck/index.js +1 -1
- package/dist/index.esm.js +137 -119
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +100 -82
- package/dist/index.js.map +1 -1
- package/dist/layout/fullScreen/index.esm.js +1 -1
- package/dist/layout/fullScreen/index.js +1 -1
- package/dist/layout/index.esm.js +2 -2
- package/dist/layout/index.js +2 -2
- package/dist/layout/sidebarScreen/index.esm.js +1 -1
- package/dist/layout/sidebarScreen/index.js +1 -1
- package/dist/redux/index.esm.js +3 -3
- package/dist/redux/index.js +3 -3
- package/dist/runtime/index.esm.js +6 -2
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/runtime/index.js +6 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/src/components/calculation-summary/components/discount-summary.d.ts +1 -0
- package/dist/src/components/calculation-summary/components/total-summary.d.ts +1 -0
- package/dist/src/components/chat-bot/chat-bot-input.d.ts +2 -1
- package/dist/src/components/chat-bot/constants.d.ts +1 -0
- package/dist/src/components/reports-title-bar/reports-title-bar.d.ts +5 -0
- package/dist/src/utils/date-format-settings.d.ts +60 -0
- package/dist/src/utils/dateFormat.d.ts +1 -0
- package/dist/style.css +28 -1
- package/dist/utils/api/index.esm.js +1 -1
- package/dist/utils/api/index.js +1 -1
- package/dist/utils/common/index.esm.js +1 -1
- package/dist/utils/common/index.js +1 -1
- package/dist/utils/common-utility/index.esm.js +1 -1
- package/dist/utils/common-utility/index.js +1 -1
- package/dist/utils/dateFormat/index.esm.js +20 -2
- package/dist/utils/dateFormat/index.esm.js.map +1 -1
- package/dist/utils/dateFormat/index.js +19 -1
- package/dist/utils/dateFormat/index.js.map +1 -1
- package/dist/utils/form-builder-deconversion/index.esm.js +10 -4
- package/dist/utils/form-builder-deconversion/index.esm.js.map +1 -1
- package/dist/utils/form-builder-deconversion/index.js +10 -4
- package/dist/utils/form-builder-deconversion/index.js.map +1 -1
- package/dist/utils/index.esm.js +28 -10
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +23 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/text-measurement/index.esm.js +1 -1
- package/dist/utils/text-measurement/index.js +1 -1
- package/dist/views/afterAuth/dashboard/index.esm.js +1 -1
- package/dist/views/afterAuth/dashboard/index.js +1 -1
- package/dist/views/afterAuth/index.esm.js +2 -2
- package/dist/views/afterAuth/index.js +2 -2
- package/dist/views/afterAuth/page-view/index.esm.js +1 -1
- package/dist/views/afterAuth/page-view/index.js +1 -1
- package/dist/views/form-builder/custom-form/index.esm.js +1 -1
- package/dist/views/form-builder/custom-form/index.js +1 -1
- package/dist/views/form-builder/element-edit-forms/index.esm.js +1 -1
- package/dist/views/form-builder/element-edit-forms/index.js +1 -1
- package/dist/views/form-builder/form-fields/index.esm.js +1 -1
- package/dist/views/form-builder/form-fields/index.js +1 -1
- package/dist/views/form-builder/index.esm.js +4 -4
- package/dist/views/form-builder/index.js +4 -4
- package/dist/views/form-builder/redux/index.esm.js +1 -1
- package/dist/views/form-builder/redux/index.js +1 -1
- package/dist/views/index.esm.js +13 -13
- package/dist/views/index.js +13 -13
- package/dist/views/template-editor/add-template/index.esm.js +1 -1
- package/dist/views/template-editor/add-template/index.js +1 -1
- package/dist/views/template-editor/components/index.esm.js +1 -1
- package/dist/views/template-editor/components/index.js +1 -1
- package/dist/views/template-editor/edit-section-modal/index.esm.js +1 -1
- package/dist/views/template-editor/edit-section-modal/index.js +1 -1
- package/dist/views/template-editor/index.esm.js +7 -7
- package/dist/views/template-editor/index.js +7 -7
- package/dist/views/template-editor/routes/index.esm.js +1 -1
- package/dist/views/template-editor/routes/index.js +1 -1
- package/dist/views/template-editor/template-modal/index.esm.js +1 -1
- package/dist/views/template-editor/template-modal/index.js +1 -1
- package/dist/views/template-editor/templates/index.esm.js +1 -1
- package/dist/views/template-editor/templates/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/DonutChart-BSM45IZR.js +0 -104
- package/dist/chunks/DonutChart-BSM45IZR.js.map +0 -1
- package/dist/chunks/DonutChart-CwRZ69d2.esm.js +0 -88
- package/dist/chunks/DonutChart-CwRZ69d2.esm.js.map +0 -1
- package/dist/chunks/DynamicDependentField-CxvG77Nz.esm.js +0 -128
- package/dist/chunks/DynamicDependentField-CxvG77Nz.esm.js.map +0 -1
- package/dist/chunks/DynamicDependentField-s4kwIrGN.js +0 -127
- package/dist/chunks/DynamicDependentField-s4kwIrGN.js.map +0 -1
- package/dist/chunks/ERPUIProvider-BzseBepc.esm.js +0 -130
- package/dist/chunks/ERPUIProvider-BzseBepc.esm.js.map +0 -1
- package/dist/chunks/ERPUIProvider-iB39BUBd.js +0 -129
- package/dist/chunks/ERPUIProvider-iB39BUBd.js.map +0 -1
- package/dist/chunks/FORMS-0-6vG5vm.js +0 -295
- package/dist/chunks/FORMS-0-6vG5vm.js.map +0 -1
- package/dist/chunks/FORMS-QrgpyEK_.esm.js +0 -296
- package/dist/chunks/FORMS-QrgpyEK_.esm.js.map +0 -1
- package/dist/chunks/FlexibleReduxExample-BgpligMk.js +0 -148
- package/dist/chunks/FlexibleReduxExample-BgpligMk.js.map +0 -1
- package/dist/chunks/FlexibleReduxExample-Dwvx4wTb.esm.js +0 -149
- package/dist/chunks/FlexibleReduxExample-Dwvx4wTb.esm.js.map +0 -1
- package/dist/chunks/GroupBarChart-Bqvs5N3s.esm.js +0 -86
- package/dist/chunks/GroupBarChart-Bqvs5N3s.esm.js.map +0 -1
- package/dist/chunks/GroupBarChart-CQjr7Ow8.js +0 -102
- package/dist/chunks/GroupBarChart-CQjr7Ow8.js.map +0 -1
- package/dist/chunks/SectionFlowEditor-Blhdf4jD.esm.js +0 -5479
- package/dist/chunks/SectionFlowEditor-Blhdf4jD.esm.js.map +0 -1
- package/dist/chunks/SectionFlowEditor-CNchIJ-0.js +0 -5478
- package/dist/chunks/SectionFlowEditor-CNchIJ-0.js.map +0 -1
- package/dist/chunks/action-bar-BCAyZghg.esm.js +0 -660
- package/dist/chunks/action-bar-BCAyZghg.esm.js.map +0 -1
- package/dist/chunks/action-bar-D6G70JMr.js +0 -659
- package/dist/chunks/action-bar-D6G70JMr.js.map +0 -1
- package/dist/chunks/actionCreator-2cZZuVFH.js +0 -93
- package/dist/chunks/actionCreator-2cZZuVFH.js.map +0 -1
- package/dist/chunks/actionCreator-BxsSTjDD.esm.js +0 -28
- package/dist/chunks/actionCreator-BxsSTjDD.esm.js.map +0 -1
- package/dist/chunks/actionCreator-CCbS63RH.js +0 -21
- package/dist/chunks/actionCreator-CCbS63RH.js.map +0 -1
- package/dist/chunks/actionCreator-CmAgJzDP.esm.js +0 -94
- package/dist/chunks/actionCreator-CmAgJzDP.esm.js.map +0 -1
- package/dist/chunks/actionCreator-D5jnL5Pv.js +0 -78
- package/dist/chunks/actionCreator-D5jnL5Pv.js.map +0 -1
- package/dist/chunks/actionCreator-DaS-QGI4.esm.js +0 -79
- package/dist/chunks/actionCreator-DaS-QGI4.esm.js.map +0 -1
- package/dist/chunks/actionCreator-DkS_8UbT.esm.js +0 -22
- package/dist/chunks/actionCreator-DkS_8UbT.esm.js.map +0 -1
- package/dist/chunks/actionCreator-QCAcDFaI.js +0 -27
- package/dist/chunks/actionCreator-QCAcDFaI.js.map +0 -1
- package/dist/chunks/actionCreator-jriFS6rf.esm.js +0 -14
- package/dist/chunks/actionCreator-jriFS6rf.esm.js.map +0 -1
- package/dist/chunks/actionCreator-tRYKJL_l.js +0 -13
- package/dist/chunks/actionCreator-tRYKJL_l.js.map +0 -1
- package/dist/chunks/activity-log-3DTR9uiM.esm.js +0 -103
- package/dist/chunks/activity-log-3DTR9uiM.esm.js.map +0 -1
- package/dist/chunks/activity-log-Hw1K_cMJ.js +0 -102
- package/dist/chunks/activity-log-Hw1K_cMJ.js.map +0 -1
- package/dist/chunks/add-template-B8cAl6jP.esm.js +0 -11
- package/dist/chunks/add-template-B8cAl6jP.esm.js.map +0 -1
- package/dist/chunks/add-template-DXfjAhLS.js +0 -10
- package/dist/chunks/add-template-DXfjAhLS.js.map +0 -1
- package/dist/chunks/address-modal-DDs0_DwZ.esm.js +0 -664
- package/dist/chunks/address-modal-DDs0_DwZ.esm.js.map +0 -1
- package/dist/chunks/address-modal-eIuNxXg0.js +0 -680
- package/dist/chunks/address-modal-eIuNxXg0.js.map +0 -1
- package/dist/chunks/ai-summary-CAKlYLnt.js +0 -350
- package/dist/chunks/ai-summary-CAKlYLnt.js.map +0 -1
- package/dist/chunks/ai-summary-Dto8NzAC.esm.js +0 -351
- package/dist/chunks/ai-summary-Dto8NzAC.esm.js.map +0 -1
- package/dist/chunks/api-BSqZ2y7J.esm.js +0 -5922
- package/dist/chunks/api-BSqZ2y7J.esm.js.map +0 -1
- package/dist/chunks/api-Ce693XLe.js +0 -5921
- package/dist/chunks/api-Ce693XLe.js.map +0 -1
- package/dist/chunks/appbar-C35Euxp4.js +0 -56
- package/dist/chunks/appbar-C35Euxp4.js.map +0 -1
- package/dist/chunks/appbar-DCoI9W6A.esm.js +0 -57
- package/dist/chunks/appbar-DCoI9W6A.esm.js.map +0 -1
- package/dist/chunks/approval-wrapper-B-41mLZw.esm.js +0 -140
- package/dist/chunks/approval-wrapper-B-41mLZw.esm.js.map +0 -1
- package/dist/chunks/approval-wrapper-C6-tXwaf.js +0 -139
- package/dist/chunks/approval-wrapper-C6-tXwaf.js.map +0 -1
- package/dist/chunks/areaLinerChart-BSaqONGz.esm.js +0 -104
- package/dist/chunks/areaLinerChart-BSaqONGz.esm.js.map +0 -1
- package/dist/chunks/areaLinerChart-CV1NKCGz.js +0 -120
- package/dist/chunks/areaLinerChart-CV1NKCGz.js.map +0 -1
- package/dist/chunks/bar-chart-C0okUFJS.js +0 -103
- package/dist/chunks/bar-chart-C0okUFJS.js.map +0 -1
- package/dist/chunks/bar-chart-D4myXwbk.esm.js +0 -87
- package/dist/chunks/bar-chart-D4myXwbk.esm.js.map +0 -1
- package/dist/chunks/barChart-B6SjqFTi.esm.js +0 -144
- package/dist/chunks/barChart-B6SjqFTi.esm.js.map +0 -1
- package/dist/chunks/barChart-_v5HVNeD.js +0 -160
- package/dist/chunks/barChart-_v5HVNeD.js.map +0 -1
- package/dist/chunks/barLinechart-BGRDgzAX.esm.js +0 -180
- package/dist/chunks/barLinechart-BGRDgzAX.esm.js.map +0 -1
- package/dist/chunks/barLinechart-Cybr4t95.js +0 -196
- package/dist/chunks/barLinechart-Cybr4t95.js.map +0 -1
- package/dist/chunks/calculation-summary-BhWssEJP.esm.js +0 -182
- package/dist/chunks/calculation-summary-BhWssEJP.esm.js.map +0 -1
- package/dist/chunks/calculation-summary-DdAaSwoG.js +0 -181
- package/dist/chunks/calculation-summary-DdAaSwoG.js.map +0 -1
- package/dist/chunks/chat-bot-C0ohNCRY.js +0 -3546
- package/dist/chunks/chat-bot-C0ohNCRY.js.map +0 -1
- package/dist/chunks/chat-bot-CzRxCBcZ.esm.js +0 -3547
- package/dist/chunks/chat-bot-CzRxCBcZ.esm.js.map +0 -1
- package/dist/chunks/common-utility-DNOInB1J.esm.js +0 -299
- package/dist/chunks/common-utility-DNOInB1J.esm.js.map +0 -1
- package/dist/chunks/common-utility-DXlg6tQv.js +0 -298
- package/dist/chunks/common-utility-DXlg6tQv.js.map +0 -1
- package/dist/chunks/custom-date-picker-Bj_9n8p8.esm.js +0 -56
- package/dist/chunks/custom-date-picker-Bj_9n8p8.esm.js.map +0 -1
- package/dist/chunks/custom-date-picker-Dt54H6AR.js +0 -55
- package/dist/chunks/custom-date-picker-Dt54H6AR.js.map +0 -1
- package/dist/chunks/custom-editor-D99-i2rN.js +0 -1257
- package/dist/chunks/custom-editor-D99-i2rN.js.map +0 -1
- package/dist/chunks/custom-editor-DbaK32F2.esm.js +0 -1257
- package/dist/chunks/custom-editor-DbaK32F2.esm.js.map +0 -1
- package/dist/chunks/custom-form-CiSSDja3.esm.js +0 -1146
- package/dist/chunks/custom-form-CiSSDja3.esm.js.map +0 -1
- package/dist/chunks/custom-form-rhJ1xvOV.js +0 -1145
- package/dist/chunks/custom-form-rhJ1xvOV.js.map +0 -1
- package/dist/chunks/custom-grid-card-25R5RDYY.js +0 -126
- package/dist/chunks/custom-grid-card-25R5RDYY.js.map +0 -1
- package/dist/chunks/custom-grid-card-ChSQynhf.esm.js +0 -127
- package/dist/chunks/custom-grid-card-ChSQynhf.esm.js.map +0 -1
- package/dist/chunks/dashboard-D7cAtema.js +0 -74
- package/dist/chunks/dashboard-D7cAtema.js.map +0 -1
- package/dist/chunks/dashboard-uhHB0n9T.esm.js +0 -75
- package/dist/chunks/dashboard-uhHB0n9T.esm.js.map +0 -1
- package/dist/chunks/date-BEkOnPLg.js +0 -55
- package/dist/chunks/date-BEkOnPLg.js.map +0 -1
- package/dist/chunks/date-DWW33q1y.esm.js +0 -56
- package/dist/chunks/date-DWW33q1y.esm.js.map +0 -1
- package/dist/chunks/date-picker-C0qJ2Ceq.js +0 -127
- package/dist/chunks/date-picker-C0qJ2Ceq.js.map +0 -1
- package/dist/chunks/date-picker-CqiwV3fq.esm.js +0 -128
- package/dist/chunks/date-picker-CqiwV3fq.esm.js.map +0 -1
- package/dist/chunks/date-range-picker-Bt_heXbX.js +0 -196
- package/dist/chunks/date-range-picker-Bt_heXbX.js.map +0 -1
- package/dist/chunks/date-range-picker-CXYyecdN.js +0 -61
- package/dist/chunks/date-range-picker-CXYyecdN.js.map +0 -1
- package/dist/chunks/date-range-picker-CvkYXRaH.esm.js +0 -197
- package/dist/chunks/date-range-picker-CvkYXRaH.esm.js.map +0 -1
- package/dist/chunks/date-range-picker-DDI-vDlU.esm.js +0 -62
- package/dist/chunks/date-range-picker-DDI-vDlU.esm.js.map +0 -1
- package/dist/chunks/date-time-Bmf9tUWN.js +0 -54
- package/dist/chunks/date-time-Bmf9tUWN.js.map +0 -1
- package/dist/chunks/date-time-TwBpGcVi.esm.js +0 -55
- package/dist/chunks/date-time-TwBpGcVi.esm.js.map +0 -1
- package/dist/chunks/date-time-picker-BiVDvz7V.esm.js +0 -115
- package/dist/chunks/date-time-picker-BiVDvz7V.esm.js.map +0 -1
- package/dist/chunks/date-time-picker-HC1XkaJG.js +0 -114
- package/dist/chunks/date-time-picker-HC1XkaJG.js.map +0 -1
- package/dist/chunks/dateFormat-DruK2Qh9.js +0 -56
- package/dist/chunks/dateFormat-DruK2Qh9.js.map +0 -1
- package/dist/chunks/dateFormat-VzMEQghL.esm.js +0 -57
- package/dist/chunks/dateFormat-VzMEQghL.esm.js.map +0 -1
- package/dist/chunks/discount-summary-Cfxk2tZa.esm.js +0 -60
- package/dist/chunks/discount-summary-Cfxk2tZa.esm.js.map +0 -1
- package/dist/chunks/discount-summary-RCy2t_AM.js +0 -59
- package/dist/chunks/discount-summary-RCy2t_AM.js.map +0 -1
- package/dist/chunks/dynamic-report-BfnrD-zq.js +0 -588
- package/dist/chunks/dynamic-report-BfnrD-zq.js.map +0 -1
- package/dist/chunks/dynamic-report-CmL56Rs0.esm.js +0 -589
- package/dist/chunks/dynamic-report-CmL56Rs0.esm.js.map +0 -1
- package/dist/chunks/dynamic-rows-5iZHYEWp.js +0 -249
- package/dist/chunks/dynamic-rows-5iZHYEWp.js.map +0 -1
- package/dist/chunks/dynamic-rows-Db28dAgS.esm.js +0 -250
- package/dist/chunks/dynamic-rows-Db28dAgS.esm.js.map +0 -1
- package/dist/chunks/dynamic-text-editor-B2k2GRDf.js +0 -44
- package/dist/chunks/dynamic-text-editor-B2k2GRDf.js.map +0 -1
- package/dist/chunks/dynamic-text-editor-DSyNRqGU.esm.js +0 -45
- package/dist/chunks/dynamic-text-editor-DSyNRqGU.esm.js.map +0 -1
- package/dist/chunks/edit-section-modal-Bg_OubEc.js +0 -76
- package/dist/chunks/edit-section-modal-Bg_OubEc.js.map +0 -1
- package/dist/chunks/edit-section-modal-CqbrHCo2.esm.js +0 -77
- package/dist/chunks/edit-section-modal-CqbrHCo2.esm.js.map +0 -1
- package/dist/chunks/filter-Br7IBDbh.esm.js +0 -415
- package/dist/chunks/filter-Br7IBDbh.esm.js.map +0 -1
- package/dist/chunks/filter-DqL-Ey7H.js +0 -414
- package/dist/chunks/filter-DqL-Ey7H.js.map +0 -1
- package/dist/chunks/footer-BmDKMyLP.js +0 -63
- package/dist/chunks/footer-BmDKMyLP.js.map +0 -1
- package/dist/chunks/footer-BmKXTODa.esm.js +0 -64
- package/dist/chunks/footer-BmKXTODa.esm.js.map +0 -1
- package/dist/chunks/form-fields-BiRJ8Gyp.esm.js +0 -355
- package/dist/chunks/form-fields-BiRJ8Gyp.esm.js.map +0 -1
- package/dist/chunks/form-fields-mWRtoHVX.js +0 -354
- package/dist/chunks/form-fields-mWRtoHVX.js.map +0 -1
- package/dist/chunks/form-parser-6_MQHzfU.js +0 -607
- package/dist/chunks/form-parser-6_MQHzfU.js.map +0 -1
- package/dist/chunks/form-parser-D0ZqEsBx.esm.js +0 -591
- package/dist/chunks/form-parser-D0ZqEsBx.esm.js.map +0 -1
- package/dist/chunks/form-section-D0ipOYv3.esm.js +0 -476
- package/dist/chunks/form-section-D0ipOYv3.esm.js.map +0 -1
- package/dist/chunks/form-section-DJJ5O8QE.js +0 -475
- package/dist/chunks/form-section-DJJ5O8QE.js.map +0 -1
- package/dist/chunks/format-chart-value-B5ClGhlz.esm.js +0 -37
- package/dist/chunks/format-chart-value-B5ClGhlz.esm.js.map +0 -1
- package/dist/chunks/format-chart-value-Cy1P2lbF.js +0 -53
- package/dist/chunks/format-chart-value-Cy1P2lbF.js.map +0 -1
- package/dist/chunks/fullScreen-CV2gntC3.js +0 -20
- package/dist/chunks/fullScreen-CV2gntC3.js.map +0 -1
- package/dist/chunks/fullScreen-DwP10GLK.esm.js +0 -21
- package/dist/chunks/fullScreen-DwP10GLK.esm.js.map +0 -1
- package/dist/chunks/global-search-BUpAIn8K.js +0 -149
- package/dist/chunks/global-search-BUpAIn8K.js.map +0 -1
- package/dist/chunks/global-search-C_L-lmq1.esm.js +0 -150
- package/dist/chunks/global-search-C_L-lmq1.esm.js.map +0 -1
- package/dist/chunks/grid-view-7yv8BBGS.esm.js +0 -52
- package/dist/chunks/grid-view-7yv8BBGS.esm.js.map +0 -1
- package/dist/chunks/grid-view-LeS2Q6Zy.js +0 -51
- package/dist/chunks/grid-view-LeS2Q6Zy.js.map +0 -1
- package/dist/chunks/header-BfLMcRXF.js +0 -90
- package/dist/chunks/header-BfLMcRXF.js.map +0 -1
- package/dist/chunks/header-CgGEFjRD.esm.js +0 -91
- package/dist/chunks/header-CgGEFjRD.esm.js.map +0 -1
- package/dist/chunks/header-enhanced-CP0w1-Dn.js +0 -400
- package/dist/chunks/header-enhanced-CP0w1-Dn.js.map +0 -1
- package/dist/chunks/header-enhanced-Cd3gRkWV.esm.js +0 -401
- package/dist/chunks/header-enhanced-Cd3gRkWV.esm.js.map +0 -1
- package/dist/chunks/inline-edit-fields-C7sJKda2.js +0 -340
- package/dist/chunks/inline-edit-fields-C7sJKda2.js.map +0 -1
- package/dist/chunks/inline-edit-fields-D0gvI8T3.esm.js +0 -324
- package/dist/chunks/inline-edit-fields-D0gvI8T3.esm.js.map +0 -1
- package/dist/chunks/inventory-reports-title-bar-C8Qo7NEx.js +0 -732
- package/dist/chunks/inventory-reports-title-bar-C8Qo7NEx.js.map +0 -1
- package/dist/chunks/inventory-reports-title-bar-DpG06q1U.esm.js +0 -733
- package/dist/chunks/inventory-reports-title-bar-DpG06q1U.esm.js.map +0 -1
- package/dist/chunks/item-response-details-Q4dR3qmN.js +0 -78
- package/dist/chunks/item-response-details-Q4dR3qmN.js.map +0 -1
- package/dist/chunks/item-response-details-TEvdMqA7.esm.js +0 -79
- package/dist/chunks/item-response-details-TEvdMqA7.esm.js.map +0 -1
- package/dist/chunks/listing-B7oUf-ga.esm.js +0 -276
- package/dist/chunks/listing-B7oUf-ga.esm.js.map +0 -1
- package/dist/chunks/listing-DINZMGWq.js +0 -275
- package/dist/chunks/listing-DINZMGWq.js.map +0 -1
- package/dist/chunks/location-select-B91gVEZg.esm.js +0 -86
- package/dist/chunks/location-select-B91gVEZg.esm.js.map +0 -1
- package/dist/chunks/location-select-DJGf2z9B.js +0 -85
- package/dist/chunks/location-select-DJGf2z9B.js.map +0 -1
- package/dist/chunks/material-editable-table-Bsy2JLb6.esm.js +0 -1469
- package/dist/chunks/material-editable-table-Bsy2JLb6.esm.js.map +0 -1
- package/dist/chunks/material-editable-table-CzJhE63R.js +0 -1485
- package/dist/chunks/material-editable-table-CzJhE63R.js.map +0 -1
- package/dist/chunks/module-reducer-CCZD_gz4.js +0 -91
- package/dist/chunks/module-reducer-CCZD_gz4.js.map +0 -1
- package/dist/chunks/module-reducer-DNm9BZ0L.esm.js +0 -92
- package/dist/chunks/module-reducer-DNm9BZ0L.esm.js.map +0 -1
- package/dist/chunks/multi-line-chart-BYBYGBdy.esm.js +0 -96
- package/dist/chunks/multi-line-chart-BYBYGBdy.esm.js.map +0 -1
- package/dist/chunks/multi-line-chart-Bt3wdHU7.js +0 -112
- package/dist/chunks/multi-line-chart-Bt3wdHU7.js.map +0 -1
- package/dist/chunks/notification-menu-BCCLpwDZ.js +0 -600
- package/dist/chunks/notification-menu-BCCLpwDZ.js.map +0 -1
- package/dist/chunks/notification-menu-PJM37Tp2.esm.js +0 -601
- package/dist/chunks/notification-menu-PJM37Tp2.esm.js.map +0 -1
- package/dist/chunks/page-action-CUTFLYyt.esm.js +0 -325
- package/dist/chunks/page-action-CUTFLYyt.esm.js.map +0 -1
- package/dist/chunks/page-action-EfPBRwHo.js +0 -324
- package/dist/chunks/page-action-EfPBRwHo.js.map +0 -1
- package/dist/chunks/page-navigator-J9GdrKkm.js +0 -242
- package/dist/chunks/page-navigator-J9GdrKkm.js.map +0 -1
- package/dist/chunks/page-navigator-PBXn7Eh_.esm.js +0 -243
- package/dist/chunks/page-navigator-PBXn7Eh_.esm.js.map +0 -1
- package/dist/chunks/page-view-D_Erav8n.js +0 -323
- package/dist/chunks/page-view-D_Erav8n.js.map +0 -1
- package/dist/chunks/page-view-DsptSruT.esm.js +0 -324
- package/dist/chunks/page-view-DsptSruT.esm.js.map +0 -1
- package/dist/chunks/quick-approval-modal-Bi9f6kIj.esm.js +0 -256
- package/dist/chunks/quick-approval-modal-Bi9f6kIj.esm.js.map +0 -1
- package/dist/chunks/quick-approval-modal-CoFcxeD9.js +0 -272
- package/dist/chunks/quick-approval-modal-CoFcxeD9.js.map +0 -1
- package/dist/chunks/reducer-BSDSt8P5.js +0 -49
- package/dist/chunks/reducer-BSDSt8P5.js.map +0 -1
- package/dist/chunks/reducer-Btzbg-kC.js +0 -55
- package/dist/chunks/reducer-Btzbg-kC.js.map +0 -1
- package/dist/chunks/reducer-C0vp7c_5.esm.js +0 -43
- package/dist/chunks/reducer-C0vp7c_5.esm.js.map +0 -1
- package/dist/chunks/reducer-C5hytm3p.js +0 -42
- package/dist/chunks/reducer-C5hytm3p.js.map +0 -1
- package/dist/chunks/reducer-C_iAxDoX.js +0 -32
- package/dist/chunks/reducer-C_iAxDoX.js.map +0 -1
- package/dist/chunks/reducer-DlQPn2Yf.js +0 -147
- package/dist/chunks/reducer-DlQPn2Yf.js.map +0 -1
- package/dist/chunks/reducer-DpGhVrVl.esm.js +0 -50
- package/dist/chunks/reducer-DpGhVrVl.esm.js.map +0 -1
- package/dist/chunks/reducer-DvN85Zfx.esm.js +0 -33
- package/dist/chunks/reducer-DvN85Zfx.esm.js.map +0 -1
- package/dist/chunks/reducer-LfwRh77b.esm.js +0 -56
- package/dist/chunks/reducer-LfwRh77b.esm.js.map +0 -1
- package/dist/chunks/reducer-qhCDNTSp.esm.js +0 -148
- package/dist/chunks/reducer-qhCDNTSp.esm.js.map +0 -1
- package/dist/chunks/reportFilter-CqxvTM6T.js +0 -394
- package/dist/chunks/reportFilter-CqxvTM6T.js.map +0 -1
- package/dist/chunks/reportFilter-DTsM7pWt.esm.js +0 -395
- package/dist/chunks/reportFilter-DTsM7pWt.esm.js.map +0 -1
- package/dist/chunks/reports-title-bar-BPCvX-LI.esm.js +0 -1016
- package/dist/chunks/reports-title-bar-BPCvX-LI.esm.js.map +0 -1
- package/dist/chunks/reports-title-bar-L1k7t3uz.js +0 -1015
- package/dist/chunks/reports-title-bar-L1k7t3uz.js.map +0 -1
- package/dist/chunks/route-page-map-Bz7COHkD.esm.js +0 -7427
- package/dist/chunks/route-page-map-Bz7COHkD.esm.js.map +0 -1
- package/dist/chunks/route-page-map-DfVJnKQA.js +0 -7426
- package/dist/chunks/route-page-map-DfVJnKQA.js.map +0 -1
- package/dist/chunks/routes-BC185juT.esm.js +0 -47
- package/dist/chunks/routes-BC185juT.esm.js.map +0 -1
- package/dist/chunks/routes-PNRu_AV8.js +0 -46
- package/dist/chunks/routes-PNRu_AV8.js.map +0 -1
- package/dist/chunks/schedule-report-CkrAwjTf.js +0 -235
- package/dist/chunks/schedule-report-CkrAwjTf.js.map +0 -1
- package/dist/chunks/schedule-report-YXW8mqxX.esm.js +0 -236
- package/dist/chunks/schedule-report-YXW8mqxX.esm.js.map +0 -1
- package/dist/chunks/schedule-report-modal-CDieUlju.esm.js +0 -288
- package/dist/chunks/schedule-report-modal-CDieUlju.esm.js.map +0 -1
- package/dist/chunks/schedule-report-modal-DbDqxLtB.js +0 -287
- package/dist/chunks/schedule-report-modal-DbDqxLtB.js.map +0 -1
- package/dist/chunks/searchable-select-Kg6j3WHo.js +0 -5447
- package/dist/chunks/searchable-select-Kg6j3WHo.js.map +0 -1
- package/dist/chunks/searchable-select-UNDm_sU3.esm.js +0 -5431
- package/dist/chunks/searchable-select-UNDm_sU3.esm.js.map +0 -1
- package/dist/chunks/share-modal-BkfNmJ6Q.esm.js +0 -218
- package/dist/chunks/share-modal-BkfNmJ6Q.esm.js.map +0 -1
- package/dist/chunks/share-modal-CfxRsno1.js +0 -217
- package/dist/chunks/share-modal-CfxRsno1.js.map +0 -1
- package/dist/chunks/share-modal-enhanced-B7ROQZkD.esm.js +0 -270
- package/dist/chunks/share-modal-enhanced-B7ROQZkD.esm.js.map +0 -1
- package/dist/chunks/share-modal-enhanced-CdPdyiPt.js +0 -269
- package/dist/chunks/share-modal-enhanced-CdPdyiPt.js.map +0 -1
- package/dist/chunks/sidebarScreen-CUDpCssG.js +0 -200
- package/dist/chunks/sidebarScreen-CUDpCssG.js.map +0 -1
- package/dist/chunks/sidebarScreen-ES06jsUC.esm.js +0 -201
- package/dist/chunks/sidebarScreen-ES06jsUC.esm.js.map +0 -1
- package/dist/chunks/store-BhWKdIyL.esm.js +0 -89
- package/dist/chunks/store-BhWKdIyL.esm.js.map +0 -1
- package/dist/chunks/store-DED99V-p.js +0 -88
- package/dist/chunks/store-DED99V-p.js.map +0 -1
- package/dist/chunks/table-D60IIwv_.js +0 -184
- package/dist/chunks/table-D60IIwv_.js.map +0 -1
- package/dist/chunks/table-DqRPlxNW.esm.js +0 -185
- package/dist/chunks/table-DqRPlxNW.esm.js.map +0 -1
- package/dist/chunks/table-form-5eM4xAoE.js +0 -1536
- package/dist/chunks/table-form-5eM4xAoE.js.map +0 -1
- package/dist/chunks/table-form-lDShKPGv.esm.js +0 -1537
- package/dist/chunks/table-form-lDShKPGv.esm.js.map +0 -1
- package/dist/chunks/template-editor-router-BDTAwEPd.esm.js +0 -9
- package/dist/chunks/template-editor-router-BDTAwEPd.esm.js.map +0 -1
- package/dist/chunks/template-editor-router-DQU440rt.js +0 -8
- package/dist/chunks/template-editor-router-DQU440rt.js.map +0 -1
- package/dist/chunks/template-modal-BEbtkxK2.esm.js +0 -769
- package/dist/chunks/template-modal-BEbtkxK2.esm.js.map +0 -1
- package/dist/chunks/template-modal-DM8bWq5q.js +0 -768
- package/dist/chunks/template-modal-DM8bWq5q.js.map +0 -1
- package/dist/chunks/templates-CcbbOv90.js +0 -278
- package/dist/chunks/templates-CcbbOv90.js.map +0 -1
- package/dist/chunks/templates-DchjIAQf.esm.js +0 -279
- package/dist/chunks/templates-DchjIAQf.esm.js.map +0 -1
- package/dist/chunks/text-measurement-B2SY4MOI.js +0 -251
- package/dist/chunks/text-measurement-B2SY4MOI.js.map +0 -1
- package/dist/chunks/text-measurement-C4VHjrOM.esm.js +0 -252
- package/dist/chunks/text-measurement-C4VHjrOM.esm.js.map +0 -1
- package/dist/chunks/total-summary-BCNJd8iL.esm.js +0 -41
- package/dist/chunks/total-summary-BCNJd8iL.esm.js.map +0 -1
- package/dist/chunks/total-summary-BhLK6YOW.js +0 -40
- package/dist/chunks/total-summary-BhLK6YOW.js.map +0 -1
- package/dist/chunks/translations-CzTYlXLs.js +0 -58
- package/dist/chunks/translations-CzTYlXLs.js.map +0 -1
- package/dist/chunks/translations-s7kQoO4z.esm.js +0 -59
- package/dist/chunks/translations-s7kQoO4z.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-CftM69IH.esm.js +0 -80
- package/dist/chunks/uom-field-wrapper-CftM69IH.esm.js.map +0 -1
- package/dist/chunks/uom-field-wrapper-DGJXWRgH.js +0 -79
- package/dist/chunks/uom-field-wrapper-DGJXWRgH.js.map +0 -1
- package/dist/chunks/upload-excel-BzL5o4KR.esm.js +0 -361
- package/dist/chunks/upload-excel-BzL5o4KR.esm.js.map +0 -1
- package/dist/chunks/upload-excel-WxhTn3iL.js +0 -360
- package/dist/chunks/upload-excel-WxhTn3iL.js.map +0 -1
- package/dist/chunks/use-translations-DK7JAMUq.esm.js +0 -62
- package/dist/chunks/use-translations-DK7JAMUq.esm.js.map +0 -1
- package/dist/chunks/use-translations-fvRLagN8.js +0 -61
- package/dist/chunks/use-translations-fvRLagN8.js.map +0 -1
- package/dist/chunks/useAccountSetting-0o3CgYbA.esm.js +0 -173
- package/dist/chunks/useAccountSetting-0o3CgYbA.esm.js.map +0 -1
- package/dist/chunks/useAccountSetting-DP26D8yo.js +0 -172
- package/dist/chunks/useAccountSetting-DP26D8yo.js.map +0 -1
- package/dist/chunks/useCheckSkuAndName-CoCwHFgC.js +0 -49
- package/dist/chunks/useCheckSkuAndName-CoCwHFgC.js.map +0 -1
- package/dist/chunks/useCheckSkuAndName-rkZ4hHCO.esm.js +0 -50
- package/dist/chunks/useCheckSkuAndName-rkZ4hHCO.esm.js.map +0 -1
- package/dist/chunks/useReduxIntegration-Cd6hvE5r.js +0 -38
- package/dist/chunks/useReduxIntegration-Cd6hvE5r.js.map +0 -1
- package/dist/chunks/useReduxIntegration-DM__4RiP.esm.js +0 -39
- package/dist/chunks/useReduxIntegration-DM__4RiP.esm.js.map +0 -1
- package/dist/chunks/useUniquenessCheck-B2o3fIcX.esm.js +0 -39
- package/dist/chunks/useUniquenessCheck-B2o3fIcX.esm.js.map +0 -1
- package/dist/chunks/useUniquenessCheck-pXvzabHu.js +0 -38
- package/dist/chunks/useUniquenessCheck-pXvzabHu.js.map +0 -1
- package/dist/chunks/useVendorAICompare-BkBY0x5p.js +0 -30
- package/dist/chunks/useVendorAICompare-BkBY0x5p.js.map +0 -1
- package/dist/chunks/useVendorAICompare-fc4aJtj1.esm.js +0 -31
- package/dist/chunks/useVendorAICompare-fc4aJtj1.esm.js.map +0 -1
- package/dist/chunks/value-editor-BmMNObtT.js +0 -265
- package/dist/chunks/value-editor-BmMNObtT.js.map +0 -1
- package/dist/chunks/value-editor-Djz4sP71.esm.js +0 -266
- package/dist/chunks/value-editor-Djz4sP71.esm.js.map +0 -1
- package/dist/chunks/vendor-ai-summary-B_2B-IuL.js +0 -227
- package/dist/chunks/vendor-ai-summary-B_2B-IuL.js.map +0 -1
- package/dist/chunks/vendor-ai-summary-CXNxB7TQ.esm.js +0 -228
- package/dist/chunks/vendor-ai-summary-CXNxB7TQ.esm.js.map +0 -1
|
@@ -1,3547 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useState, useRef, useEffect, useMemo, useCallback, useId, Component, useLayoutEffect } from "react";
|
|
3
|
-
import { marked } from "marked";
|
|
4
|
-
import { Add, History, ChevronLeft, Close, Search, ChatBubbleOutline, DeleteOutline, OpenInFullRounded, UploadFileRounded, ArrowUpwardRounded, ImageRounded, ArticleRounded, DescriptionRounded, TableChartRounded, PictureAsPdfRounded, InsertDriveFileRounded, CloudUploadRounded, CheckCircleRounded, ErrorRounded, HourglassBottomRounded } from "@mui/icons-material";
|
|
5
|
-
import { useAuth } from "@erpsquad/common/runtime";
|
|
6
|
-
import { getApiConfigSafe } from "../utils/api-config/index.esm.js";
|
|
7
|
-
import { C as formatAmount, l as defaultCurrencyFormat, ab as getToken, V as getDefaultUserData, aJ as getV1DepartmentsId } from "./api-BSqZ2y7J.esm.js";
|
|
8
|
-
import { aL as getV1CopilotHistory, aM as getV1CopilotHistorySession, aN as deleteV1CopilotHistorySession, aB as setAiFeatureBaseUrl, aO as getV1CopilotQuestions, aP as uploadDocument, aQ as getDocumentStatus, aR as streamV1CopilotChat, aS as uploadDocuments, aT as streamV1CopilotSmart, aU as startV1CopilotAgent, aV as formAssistV1Copilot, aW as postV1CopilotSubmit, aX as postV1CopilotSaveDraft, aY as postV1CopilotDiscard, aZ as resetV1CopilotSession, a_ as getV1ChartOfAccountId, a$ as getV1TaxCodeId, b0 as getV1InventoryItemsId, aw as getV1Uom, A as getV1PartiesId, b1 as getV1PaymentTermsId, b2 as getV1CurrencyId, b3 as getV1WarehouseLocationId } from "./api-CuStx4qV.esm.js";
|
|
9
|
-
import { d as getV1CompanyId, i as getV1LocationsStates } from "./api-CZGorfuI.esm.js";
|
|
10
|
-
import { ChevronDown } from "lucide-react";
|
|
11
|
-
import { useTranslation } from "react-i18next";
|
|
12
|
-
import { createPortal } from "react-dom";
|
|
13
|
-
import { A as AIDisclaimer } from "./ai-disclaimer-kOtXrSve.esm.js";
|
|
14
|
-
import { B as Button } from "./button-BtdpXmjA.esm.js";
|
|
15
|
-
import { S as Save } from "./save-CgMN3zzT.esm.js";
|
|
16
|
-
import { T as Tick } from "./tick-qkKHtwAf.esm.js";
|
|
17
|
-
import { T as Trash } from "./trash-Zhhh3VNZ.esm.js";
|
|
18
|
-
import { C as ConfirmPopUp } from "./confirm-modal-PbguB4YV.esm.js";
|
|
19
|
-
import toast from "react-hot-toast";
|
|
20
|
-
import { a as useChatFocusListener, D as DOCK_LAYOUT_EVENT, s as setChatActive } from "./chat-dock-state-B9s_Dnrg.esm.js";
|
|
21
|
-
const FORM_TYPE_LABELS = {
|
|
22
|
-
sales_invoice: "Sales Invoice",
|
|
23
|
-
purchase_invoice: "Purchase Invoice"
|
|
24
|
-
};
|
|
25
|
-
const ACCEPTED_FILE_EXTENSIONS = {
|
|
26
|
-
pdf: [".pdf"],
|
|
27
|
-
excel: [".xls", ".xlsx"],
|
|
28
|
-
doc: [".doc", ".docx"],
|
|
29
|
-
md: [".md"],
|
|
30
|
-
image: [".png", ".jpg", ".jpeg"]
|
|
31
|
-
};
|
|
32
|
-
const ACCEPT_ATTR = Object.values(ACCEPTED_FILE_EXTENSIONS).flat().join(",");
|
|
33
|
-
const getFileCategory = (filename) => {
|
|
34
|
-
const lower = filename.toLowerCase();
|
|
35
|
-
return Object.keys(ACCEPTED_FILE_EXTENSIONS).find(
|
|
36
|
-
(category) => ACCEPTED_FILE_EXTENSIONS[category].some((ext) => lower.endsWith(ext))
|
|
37
|
-
) || null;
|
|
38
|
-
};
|
|
39
|
-
const getTime = () => (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
40
|
-
const getGreeting = () => {
|
|
41
|
-
const h = (/* @__PURE__ */ new Date()).getHours();
|
|
42
|
-
if (h < 12) return "Good morning";
|
|
43
|
-
if (h < 17) return "Good afternoon";
|
|
44
|
-
return "Good evening";
|
|
45
|
-
};
|
|
46
|
-
const formatDuration = (ms) => `${(ms / 1e3).toFixed(1)}s`;
|
|
47
|
-
const formatTokens = (n) => n >= 1e4 ? `${(n / 1e3).toFixed(1)}k` : n.toLocaleString();
|
|
48
|
-
const IcWarning = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
49
|
-
"svg",
|
|
50
|
-
{
|
|
51
|
-
viewBox: "0 0 24 24",
|
|
52
|
-
stroke: "currentColor",
|
|
53
|
-
fill: "none",
|
|
54
|
-
strokeWidth: "2",
|
|
55
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ jsx("path", { d: "M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" }),
|
|
58
|
-
/* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
59
|
-
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
const IcBox = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
64
|
-
"svg",
|
|
65
|
-
{
|
|
66
|
-
viewBox: "0 0 24 24",
|
|
67
|
-
stroke: "currentColor",
|
|
68
|
-
fill: "none",
|
|
69
|
-
strokeWidth: "2",
|
|
70
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ jsx("path", { d: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" }),
|
|
73
|
-
/* @__PURE__ */ jsx("polyline", { points: "3.3 7 12 12 20.7 7" }),
|
|
74
|
-
/* @__PURE__ */ jsx("line", { x1: "12", y1: "22", x2: "12", y2: "12" })
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
const IcCalendar = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
79
|
-
"svg",
|
|
80
|
-
{
|
|
81
|
-
viewBox: "0 0 24 24",
|
|
82
|
-
stroke: "currentColor",
|
|
83
|
-
fill: "none",
|
|
84
|
-
strokeWidth: "2",
|
|
85
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
86
|
-
children: [
|
|
87
|
-
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
88
|
-
/* @__PURE__ */ jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
89
|
-
/* @__PURE__ */ jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
90
|
-
/* @__PURE__ */ jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
const IcChevR = ({ size = 14 }) => /* @__PURE__ */ jsx(
|
|
95
|
-
"svg",
|
|
96
|
-
{
|
|
97
|
-
viewBox: "0 0 24 24",
|
|
98
|
-
stroke: "currentColor",
|
|
99
|
-
fill: "none",
|
|
100
|
-
strokeWidth: "2",
|
|
101
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
102
|
-
children: /* @__PURE__ */ jsx("polyline", { points: "9 6 15 12 9 18" })
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
const IcSearch = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
106
|
-
"svg",
|
|
107
|
-
{
|
|
108
|
-
viewBox: "0 0 24 24",
|
|
109
|
-
stroke: "currentColor",
|
|
110
|
-
fill: "none",
|
|
111
|
-
strokeWidth: "2",
|
|
112
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
113
|
-
children: [
|
|
114
|
-
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
|
|
115
|
-
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
const IcTarget = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
120
|
-
"svg",
|
|
121
|
-
{
|
|
122
|
-
viewBox: "0 0 24 24",
|
|
123
|
-
stroke: "currentColor",
|
|
124
|
-
fill: "none",
|
|
125
|
-
strokeWidth: "2",
|
|
126
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
127
|
-
children: [
|
|
128
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
|
|
129
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "5" }),
|
|
130
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.5", fill: "currentColor", stroke: "none" })
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
const IcBolt = ({ size = 14 }) => /* @__PURE__ */ jsx(
|
|
135
|
-
"svg",
|
|
136
|
-
{
|
|
137
|
-
viewBox: "0 0 24 24",
|
|
138
|
-
fill: "currentColor",
|
|
139
|
-
stroke: "none",
|
|
140
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
141
|
-
children: /* @__PURE__ */ jsx("polygon", { points: "13 2 3 14 12 14 11 22 21 10 12 10 13 2" })
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
const IcFlame = ({ size = 14 }) => /* @__PURE__ */ jsx(
|
|
145
|
-
"svg",
|
|
146
|
-
{
|
|
147
|
-
viewBox: "0 0 24 24",
|
|
148
|
-
stroke: "currentColor",
|
|
149
|
-
fill: "none",
|
|
150
|
-
strokeWidth: "1.8",
|
|
151
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
152
|
-
children: /* @__PURE__ */ jsx("path", { d: "M8.5 14.5A2.5 2.5 0 0 0 11 17c1.4 0 2-1 2-2 0-1-.6-2-2-2-1 0-1.5.5-1.5 1zM12 2c0 4-3 5-3 9a5 5 0 0 0 10 0c0-2-1-3-2-4 0-1 0-2-1-3-1.5-1.5-3-2-4-2z" })
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
const SparkMark = ({ size = 20 }) => /* @__PURE__ */ jsx(
|
|
156
|
-
"span",
|
|
157
|
-
{
|
|
158
|
-
className: "chatBot--spark-mark",
|
|
159
|
-
style: { width: size, height: size, borderRadius: Math.round(size * 0.3) },
|
|
160
|
-
children: /* @__PURE__ */ jsxs(
|
|
161
|
-
"svg",
|
|
162
|
-
{
|
|
163
|
-
viewBox: "0 0 24 24",
|
|
164
|
-
stroke: "currentColor",
|
|
165
|
-
fill: "none",
|
|
166
|
-
strokeWidth: "2",
|
|
167
|
-
style: { width: "58%", height: "58%" },
|
|
168
|
-
children: [
|
|
169
|
-
/* @__PURE__ */ jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
|
|
170
|
-
/* @__PURE__ */ jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
const IcInvoice = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
177
|
-
"svg",
|
|
178
|
-
{
|
|
179
|
-
viewBox: "0 0 24 24",
|
|
180
|
-
stroke: "currentColor",
|
|
181
|
-
fill: "none",
|
|
182
|
-
strokeWidth: "2",
|
|
183
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
184
|
-
children: [
|
|
185
|
-
/* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
186
|
-
/* @__PURE__ */ jsx("polyline", { points: "14 2 14 8 20 8" }),
|
|
187
|
-
/* @__PURE__ */ jsx("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
|
|
188
|
-
/* @__PURE__ */ jsx("line", { x1: "8", y1: "17", x2: "14", y2: "17" })
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
const SparkSvg = ({ size = 12 }) => /* @__PURE__ */ jsxs(
|
|
193
|
-
"svg",
|
|
194
|
-
{
|
|
195
|
-
viewBox: "0 0 24 24",
|
|
196
|
-
stroke: "currentColor",
|
|
197
|
-
fill: "none",
|
|
198
|
-
strokeWidth: "2",
|
|
199
|
-
style: { width: size, height: size, flexShrink: 0 },
|
|
200
|
-
children: [
|
|
201
|
-
/* @__PURE__ */ jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
|
|
202
|
-
/* @__PURE__ */ jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
const IcInfo = ({ size = 14 }) => /* @__PURE__ */ jsxs(
|
|
207
|
-
"svg",
|
|
208
|
-
{
|
|
209
|
-
viewBox: "0 0 24 24",
|
|
210
|
-
stroke: "currentColor",
|
|
211
|
-
fill: "none",
|
|
212
|
-
strokeWidth: "2",
|
|
213
|
-
strokeLinecap: "round",
|
|
214
|
-
strokeLinejoin: "round",
|
|
215
|
-
style: { width: size, height: size, flexShrink: 0, fill: "none" },
|
|
216
|
-
children: [
|
|
217
|
-
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
218
|
-
/* @__PURE__ */ jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
219
|
-
/* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
const SLASH_COMMANDS = [
|
|
224
|
-
// {
|
|
225
|
-
// id: 'conversation',
|
|
226
|
-
// label: 'Conversation',
|
|
227
|
-
// description: 'Chat with the ERP AI assistant'
|
|
228
|
-
// },
|
|
229
|
-
// {
|
|
230
|
-
// id: 'agent',
|
|
231
|
-
// label: 'Agent',
|
|
232
|
-
// description: 'Let AI take actions in your ERP'
|
|
233
|
-
// },
|
|
234
|
-
// {
|
|
235
|
-
// id: 'doc_qa',
|
|
236
|
-
// label: 'Document',
|
|
237
|
-
// description: 'Upload a document and ask questions about it'
|
|
238
|
-
// },
|
|
239
|
-
{
|
|
240
|
-
id: "smart",
|
|
241
|
-
label: "Smart",
|
|
242
|
-
description: "Automatically routes your query to the right service"
|
|
243
|
-
}
|
|
244
|
-
];
|
|
245
|
-
const INSIGHTS = [
|
|
246
|
-
{ icon: IcWarning, kind: "red", title: "Overdue invoices need attention", sub: "Review receivables aging for payment follow-up" },
|
|
247
|
-
{ icon: IcBox, kind: "amber", title: "Items below reorder level detected", sub: "Check inventory before the next purchase order cycle" },
|
|
248
|
-
{ icon: IcCalendar, kind: "blue", title: "Pending leave requests awaiting approval", sub: "Some requests are past the standard SLA" }
|
|
249
|
-
];
|
|
250
|
-
const SUGGEST_TILES = [
|
|
251
|
-
{ icon: IcSearch, kind: "", cat: "ASK", mode: "conversation", prompt: "List the 5 most recent purchase orders" },
|
|
252
|
-
{ icon: IcSearch, kind: "", cat: "ASK", mode: "conversation", prompt: "Show me journal entries from last month" },
|
|
253
|
-
{ icon: IcBolt, kind: "amber", cat: "AGENT", mode: "agent", formType: "sales_invoice", prompt: "Create a sales invoice" },
|
|
254
|
-
{ icon: IcBolt, kind: "amber", cat: "AGENT", mode: "agent", formType: "purchase_invoice", prompt: "Create a purchase invoice" },
|
|
255
|
-
{ icon: IcSearch, kind: "blue", cat: "DOC", mode: "doc_qa", prompt: "Upload a document to get started" },
|
|
256
|
-
{ icon: IcTarget, kind: "blue", cat: "DOC", mode: "doc_qa", prompt: "Ask questions about any uploaded document" }
|
|
257
|
-
];
|
|
258
|
-
const HISTORY_PAGE_SIZE = 20;
|
|
259
|
-
const historyServiceForMode = (mode) => {
|
|
260
|
-
if (mode === "smart") return "copilot_smart";
|
|
261
|
-
if (mode === "conversation" || mode === "doc_qa") return "copilot_chat";
|
|
262
|
-
return null;
|
|
263
|
-
};
|
|
264
|
-
const toTimestamp = (value) => value ? new Date(value).getTime() || 0 : 0;
|
|
265
|
-
const toChatSession = (session) => {
|
|
266
|
-
var _a, _b;
|
|
267
|
-
const createdAt = toTimestamp(session.created_at);
|
|
268
|
-
return {
|
|
269
|
-
id: session.session_id,
|
|
270
|
-
title: session.title || ((_a = session.metadata) == null ? void 0 : _a.title) || "New chat",
|
|
271
|
-
service: session.service,
|
|
272
|
-
totalMessages: session.total_messages ?? ((_b = session.metadata) == null ? void 0 : _b.total_messages) ?? 0,
|
|
273
|
-
createdAt,
|
|
274
|
-
updatedAt: toTimestamp(session.updated_at) || createdAt
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
const toChatMessages = (messages, mode) => {
|
|
278
|
-
const baseId = Date.now();
|
|
279
|
-
return messages.map((m, i) => ({
|
|
280
|
-
id: baseId + i,
|
|
281
|
-
role: m.role === "user" ? "user" : "ai",
|
|
282
|
-
text: m.content ?? "",
|
|
283
|
-
mode
|
|
284
|
-
}));
|
|
285
|
-
};
|
|
286
|
-
const groupChatSessions = (sessions) => {
|
|
287
|
-
const startOfToday = /* @__PURE__ */ new Date();
|
|
288
|
-
startOfToday.setHours(0, 0, 0, 0);
|
|
289
|
-
const today = startOfToday.getTime();
|
|
290
|
-
const yesterday = today - 24 * 60 * 60 * 1e3;
|
|
291
|
-
const weekAgo = today - 7 * 24 * 60 * 60 * 1e3;
|
|
292
|
-
const groups = [
|
|
293
|
-
{ label: "Today", sessions: [] },
|
|
294
|
-
{ label: "Yesterday", sessions: [] },
|
|
295
|
-
{ label: "Previous 7 days", sessions: [] },
|
|
296
|
-
{ label: "Older", sessions: [] }
|
|
297
|
-
];
|
|
298
|
-
[...sessions].sort((a, b) => b.updatedAt - a.updatedAt).forEach((s) => {
|
|
299
|
-
if (s.updatedAt >= today) groups[0].sessions.push(s);
|
|
300
|
-
else if (s.updatedAt >= yesterday) groups[1].sessions.push(s);
|
|
301
|
-
else if (s.updatedAt >= weekAgo) groups[2].sessions.push(s);
|
|
302
|
-
else groups[3].sessions.push(s);
|
|
303
|
-
});
|
|
304
|
-
return groups.filter((g) => g.sessions.length > 0);
|
|
305
|
-
};
|
|
306
|
-
const formatSessionTime = (ts) => {
|
|
307
|
-
const d = new Date(ts);
|
|
308
|
-
const startOfToday = /* @__PURE__ */ new Date();
|
|
309
|
-
startOfToday.setHours(0, 0, 0, 0);
|
|
310
|
-
if (ts >= startOfToday.getTime() - 24 * 60 * 60 * 1e3) {
|
|
311
|
-
return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
|
|
312
|
-
}
|
|
313
|
-
return d.toLocaleDateString([], { day: "numeric", month: "short" });
|
|
314
|
-
};
|
|
315
|
-
const ChatBotHistoryButton = ({ open, onClick }) => /* @__PURE__ */ jsxs(
|
|
316
|
-
"button",
|
|
317
|
-
{
|
|
318
|
-
type: "button",
|
|
319
|
-
className: `chatBot--history-btn ${open ? "chatBot--history-btn--active" : ""}`,
|
|
320
|
-
onClick,
|
|
321
|
-
"aria-pressed": open,
|
|
322
|
-
"aria-controls": "chatBot-history-panel",
|
|
323
|
-
children: [
|
|
324
|
-
/* @__PURE__ */ jsx(History, { style: { fontSize: 16 } }),
|
|
325
|
-
/* @__PURE__ */ jsx("span", { children: "History" })
|
|
326
|
-
]
|
|
327
|
-
}
|
|
328
|
-
);
|
|
329
|
-
const ChatBotHistoryIconButton = ({ open, onClick }) => /* @__PURE__ */ jsx(
|
|
330
|
-
"button",
|
|
331
|
-
{
|
|
332
|
-
type: "button",
|
|
333
|
-
className: `chatBot--hd-history-btn ${open ? "chatBot--hd-history-btn--active" : ""}`,
|
|
334
|
-
onClick,
|
|
335
|
-
"aria-label": "Chat history",
|
|
336
|
-
"aria-pressed": open,
|
|
337
|
-
title: "History",
|
|
338
|
-
children: /* @__PURE__ */ jsx(History, { style: { fontSize: 18 } })
|
|
339
|
-
}
|
|
340
|
-
);
|
|
341
|
-
const ChatBotNewChatButton = ({ onClick }) => /* @__PURE__ */ jsxs("button", { type: "button", className: "chatBot--history-btn", onClick, children: [
|
|
342
|
-
/* @__PURE__ */ jsx(Add, { style: { fontSize: 17 } }),
|
|
343
|
-
/* @__PURE__ */ jsx("span", { children: "New chat" })
|
|
344
|
-
] });
|
|
345
|
-
const ChatBotHistory = ({
|
|
346
|
-
open,
|
|
347
|
-
sessions,
|
|
348
|
-
activeId,
|
|
349
|
-
onClose,
|
|
350
|
-
onSelect,
|
|
351
|
-
onDelete,
|
|
352
|
-
loading = false,
|
|
353
|
-
error = null,
|
|
354
|
-
onRetry,
|
|
355
|
-
hasMore = false,
|
|
356
|
-
loadingMore = false,
|
|
357
|
-
onLoadMore,
|
|
358
|
-
unavailableMessage = null,
|
|
359
|
-
variant = "side"
|
|
360
|
-
}) => {
|
|
361
|
-
const { t } = useTranslation();
|
|
362
|
-
const [query, setQuery] = useState("");
|
|
363
|
-
const closeBtnRef = useRef(null);
|
|
364
|
-
const isEmbedded = variant === "embedded";
|
|
365
|
-
useEffect(() => {
|
|
366
|
-
if (open) setTimeout(() => {
|
|
367
|
-
var _a;
|
|
368
|
-
return (_a = closeBtnRef.current) == null ? void 0 : _a.focus();
|
|
369
|
-
}, 50);
|
|
370
|
-
else setQuery("");
|
|
371
|
-
}, [open]);
|
|
372
|
-
const groups = useMemo(() => {
|
|
373
|
-
if (unavailableMessage || loading || error) return [];
|
|
374
|
-
const q = query.trim().toLowerCase();
|
|
375
|
-
const filtered = q ? sessions.filter((s) => s.title.toLowerCase().includes(q)) : sessions;
|
|
376
|
-
return groupChatSessions(filtered);
|
|
377
|
-
}, [sessions, query, unavailableMessage, loading, error]);
|
|
378
|
-
if (!open) return null;
|
|
379
|
-
const Wrapper = isEmbedded ? "section" : "aside";
|
|
380
|
-
return /* @__PURE__ */ jsxs(
|
|
381
|
-
Wrapper,
|
|
382
|
-
{
|
|
383
|
-
id: "chatBot-history-panel",
|
|
384
|
-
className: isEmbedded ? "chatBot--history-embedded" : "chatBot--history-panel",
|
|
385
|
-
"aria-label": "Chat history",
|
|
386
|
-
onKeyDown: (e) => {
|
|
387
|
-
if (e.key === "Escape") onClose();
|
|
388
|
-
},
|
|
389
|
-
children: [
|
|
390
|
-
isEmbedded ? /* @__PURE__ */ jsxs("div", { className: "chatBot--history-head chatBot--history-head--embedded", children: [
|
|
391
|
-
/* @__PURE__ */ jsx("button", { ref: closeBtnRef, type: "button", className: "chatBot--history-icon-btn", onClick: onClose, "aria-label": "Back to chat", children: /* @__PURE__ */ jsx(ChevronLeft, { style: { fontSize: 22 } }) }),
|
|
392
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--history-head-title", children: [
|
|
393
|
-
/* @__PURE__ */ jsx("h2", { children: "History" }),
|
|
394
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--history-count", children: [
|
|
395
|
-
sessions.length,
|
|
396
|
-
hasMore ? "+" : "",
|
|
397
|
-
" ",
|
|
398
|
-
sessions.length === 1 && !hasMore ? "chat" : "chats"
|
|
399
|
-
] })
|
|
400
|
-
] })
|
|
401
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "chatBot--history-head", children: [
|
|
402
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--history-head-title", children: [
|
|
403
|
-
/* @__PURE__ */ jsx("h2", { children: "History" }),
|
|
404
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--history-count", children: [
|
|
405
|
-
sessions.length,
|
|
406
|
-
hasMore ? "+" : "",
|
|
407
|
-
" ",
|
|
408
|
-
sessions.length === 1 && !hasMore ? "chat" : "chats"
|
|
409
|
-
] })
|
|
410
|
-
] }),
|
|
411
|
-
/* @__PURE__ */ jsx("button", { ref: closeBtnRef, type: "button", className: "chatBot--history-icon-btn", onClick: onClose, "aria-label": "Close history", children: /* @__PURE__ */ jsx(Close, { style: { fontSize: 18 } }) })
|
|
412
|
-
] }),
|
|
413
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--history-search-wrap", children: /* @__PURE__ */ jsxs("label", { className: "chatBot--history-search", children: [
|
|
414
|
-
/* @__PURE__ */ jsx(Search, { style: { fontSize: 16 } }),
|
|
415
|
-
/* @__PURE__ */ jsx(
|
|
416
|
-
"input",
|
|
417
|
-
{
|
|
418
|
-
"aria-label": "Search chats",
|
|
419
|
-
placeholder: "Search chats",
|
|
420
|
-
value: query,
|
|
421
|
-
onChange: (e) => setQuery(e.target.value)
|
|
422
|
-
}
|
|
423
|
-
)
|
|
424
|
-
] }) }),
|
|
425
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--history-list", children: [
|
|
426
|
-
groups.map((group) => /* @__PURE__ */ jsxs("div", { className: "chatBot--history-group", children: [
|
|
427
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--history-group-lbl", children: group.label }),
|
|
428
|
-
group.sessions.map((s) => {
|
|
429
|
-
const isActive = s.id === activeId;
|
|
430
|
-
return /* @__PURE__ */ jsxs("div", { className: `chatBot--history-row ${isActive ? "chatBot--history-row--active" : ""}`, children: [
|
|
431
|
-
/* @__PURE__ */ jsxs(
|
|
432
|
-
"button",
|
|
433
|
-
{
|
|
434
|
-
type: "button",
|
|
435
|
-
className: "chatBot--history-open",
|
|
436
|
-
onClick: () => onSelect(s),
|
|
437
|
-
"aria-current": isActive ? "true" : void 0,
|
|
438
|
-
title: s.title,
|
|
439
|
-
children: [
|
|
440
|
-
/* @__PURE__ */ jsx(ChatBubbleOutline, { className: "chatBot--history-row-ic", style: { fontSize: 15 } }),
|
|
441
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--history-row-body", children: [
|
|
442
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--history-row-title", children: s.title }),
|
|
443
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--history-row-time", children: formatSessionTime(s.updatedAt) })
|
|
444
|
-
] })
|
|
445
|
-
]
|
|
446
|
-
}
|
|
447
|
-
),
|
|
448
|
-
/* @__PURE__ */ jsx(
|
|
449
|
-
"button",
|
|
450
|
-
{
|
|
451
|
-
type: "button",
|
|
452
|
-
className: "chatBot--history-del",
|
|
453
|
-
onClick: () => onDelete(s),
|
|
454
|
-
"aria-label": `Delete chat: ${s.title}`,
|
|
455
|
-
title: "Delete chat",
|
|
456
|
-
children: /* @__PURE__ */ jsx(DeleteOutline, { style: { fontSize: 17 } })
|
|
457
|
-
}
|
|
458
|
-
)
|
|
459
|
-
] }, s.id);
|
|
460
|
-
})
|
|
461
|
-
] }, group.label)),
|
|
462
|
-
unavailableMessage ? /* @__PURE__ */ jsx("div", { className: "chatBot--history-empty", children: unavailableMessage }) : loading ? /* @__PURE__ */ jsx("div", { className: "chatBot--history-empty", children: "Loading chats…" }) : error ? /* @__PURE__ */ jsxs("div", { className: "chatBot--history-empty", children: [
|
|
463
|
-
/* @__PURE__ */ jsx("div", { children: "Couldn't load your chats." }),
|
|
464
|
-
onRetry && /* @__PURE__ */ jsx("button", { type: "button", className: "chatBot--history-more", onClick: onRetry, children: "Try again" })
|
|
465
|
-
] }) : groups.length === 0 && /* @__PURE__ */ jsx("div", { className: "chatBot--history-empty", children: query ? "No chats found" : "No conversations yet. Your chats will appear here." }),
|
|
466
|
-
!unavailableMessage && !loading && !error && hasMore && onLoadMore && /* @__PURE__ */ jsx("div", { className: "chatBot--history-load-more", children: /* @__PURE__ */ jsxs("button", { type: "button", className: "chatBot--history-load-more-pill", onClick: onLoadMore, disabled: loadingMore, children: [
|
|
467
|
-
loadingMore ? "Loading…" : t("common.load_more"),
|
|
468
|
-
!loadingMore && /* @__PURE__ */ jsx(ChevronDown, { size: 13 })
|
|
469
|
-
] }) })
|
|
470
|
-
] })
|
|
471
|
-
]
|
|
472
|
-
}
|
|
473
|
-
);
|
|
474
|
-
};
|
|
475
|
-
const ChatBotHeader = ({ onClose, onNewChat, sessionTokens = 0, sessionMs = 0, onHistory, historyOpen = false }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
476
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--header", children: [
|
|
477
|
-
/* @__PURE__ */ jsx(SparkMark, { size: 34 }),
|
|
478
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--hd-info", children: [
|
|
479
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--hd-name", children: [
|
|
480
|
-
"NovaForce",
|
|
481
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--hd-beta", children: "Beta" })
|
|
482
|
-
] }),
|
|
483
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--hd-sub", children: "AI-powered ERP assistant" })
|
|
484
|
-
] }),
|
|
485
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--hd-actions", children: [
|
|
486
|
-
onHistory && /* @__PURE__ */ jsx(ChatBotHistoryIconButton, { open: historyOpen, onClick: onHistory }),
|
|
487
|
-
/* @__PURE__ */ jsx("button", { title: "New chat", onClick: onNewChat, children: /* @__PURE__ */ jsx(Add, { style: { fontSize: 18 } }) }),
|
|
488
|
-
/* @__PURE__ */ jsx("button", { title: "Expand", children: /* @__PURE__ */ jsx(OpenInFullRounded, { style: { fontSize: 16 } }) }),
|
|
489
|
-
/* @__PURE__ */ jsx("button", { title: "Close", onClick: onClose, children: /* @__PURE__ */ jsx(Close, { style: { fontSize: 18 } }) })
|
|
490
|
-
] })
|
|
491
|
-
] }),
|
|
492
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--ctx-bar", children: [
|
|
493
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--ctx-chip", children: [
|
|
494
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ctx-dot" }),
|
|
495
|
-
"ERP Data"
|
|
496
|
-
] }),
|
|
497
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ctx-label", children: "All modules · Live data" }),
|
|
498
|
-
sessionMs > 0 && /* @__PURE__ */ jsxs("span", { className: "chatBot--ctx-session", children: [
|
|
499
|
-
"Session ",
|
|
500
|
-
sessionTokens > 0 ? `${formatTokens(sessionTokens)} tok · ` : "",
|
|
501
|
-
formatDuration(sessionMs)
|
|
502
|
-
] })
|
|
503
|
-
] })
|
|
504
|
-
] });
|
|
505
|
-
const ChatBotWelcome = ({ firstName, onSuggestion, dynamicQuestions = [], mode, dashboardMode = false, inputSlot }) => {
|
|
506
|
-
const greeting = getGreeting();
|
|
507
|
-
const dynamicTiles = dynamicQuestions.map((dq) => ({
|
|
508
|
-
icon: IcSearch,
|
|
509
|
-
kind: dq.kind || "blue",
|
|
510
|
-
cat: dq.cat,
|
|
511
|
-
mode: dq.mode,
|
|
512
|
-
formType: dq.formType,
|
|
513
|
-
prompt: dq.prompt
|
|
514
|
-
}));
|
|
515
|
-
const askTiles = dynamicQuestions.length > 0 ? dynamicTiles : SUGGEST_TILES.filter((t) => t.cat === "ASK");
|
|
516
|
-
const agentTiles = SUGGEST_TILES.filter((t) => t.cat === "AGENT");
|
|
517
|
-
const docTiles = SUGGEST_TILES.filter((t) => t.cat === "DOC");
|
|
518
|
-
const displayTiles = mode === "smart" ? [...askTiles, ...agentTiles, ...docTiles] : mode === "conversation" ? askTiles : mode === "agent" ? agentTiles : docTiles;
|
|
519
|
-
return /* @__PURE__ */ jsxs("div", { className: `chatBot--welcome ${dashboardMode ? "chatBot--welcome--center" : ""}`, children: [
|
|
520
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--greeting", children: dashboardMode ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
521
|
-
"Hi ",
|
|
522
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--grad", children: firstName }),
|
|
523
|
-
", how's your day going?"
|
|
524
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
525
|
-
greeting,
|
|
526
|
-
firstName && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
527
|
-
", ",
|
|
528
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--grad", children: firstName })
|
|
529
|
-
] })
|
|
530
|
-
] }) }),
|
|
531
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--greeting-sub", children: dashboardMode ? "Shall we start with your action items, or with what's on your agenda today?" : "NovaForce is watching your ERP data. Here's what stands out today." }),
|
|
532
|
-
inputSlot && /* @__PURE__ */ jsx("div", { className: "chatBot--welcome-input", children: inputSlot }),
|
|
533
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--section-lbl", children: [
|
|
534
|
-
/* @__PURE__ */ jsx("span", { children: "Try asking" }),
|
|
535
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ln" })
|
|
536
|
-
] }),
|
|
537
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--suggest-grid", children: displayTiles.map((tile, i) => /* @__PURE__ */ jsxs(
|
|
538
|
-
"button",
|
|
539
|
-
{
|
|
540
|
-
className: "chatBot--suggest-tile",
|
|
541
|
-
onClick: () => onSuggestion(tile.prompt, tile.mode, tile.formType),
|
|
542
|
-
children: [
|
|
543
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--suggest-head", children: [
|
|
544
|
-
/* @__PURE__ */ jsx("span", { className: `chatBot--ic chatBot--ic--${tile.kind}`, children: /* @__PURE__ */ jsx(tile.icon, { size: 13 }) }),
|
|
545
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--suggest-cat", children: tile.cat })
|
|
546
|
-
] }),
|
|
547
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--suggest-prompt", children: tile.prompt })
|
|
548
|
-
]
|
|
549
|
-
},
|
|
550
|
-
i
|
|
551
|
-
)) })
|
|
552
|
-
] });
|
|
553
|
-
};
|
|
554
|
-
const DEFAULT_CURRENCY = "AED";
|
|
555
|
-
function formatDeltaAmount(delta) {
|
|
556
|
-
if (delta.unit === "new") return "New";
|
|
557
|
-
const amount = +Math.abs(delta.value).toFixed(1);
|
|
558
|
-
return delta.unit === "percent" ? `${amount}%` : `${amount}`;
|
|
559
|
-
}
|
|
560
|
-
function formatProvenance(provenance, { currency, rowCount } = {}) {
|
|
561
|
-
var _a, _b;
|
|
562
|
-
const rows = (provenance == null ? void 0 : provenance.row_count) ?? rowCount;
|
|
563
|
-
return [
|
|
564
|
-
(_a = provenance == null ? void 0 : provenance.source) == null ? void 0 : _a.trim(),
|
|
565
|
-
(_b = provenance == null ? void 0 : provenance.period) == null ? void 0 : _b.trim(),
|
|
566
|
-
typeof rows === "number" ? `${rows.toLocaleString("en-US")} ${rows === 1 ? "record" : "records"}` : void 0,
|
|
567
|
-
currency
|
|
568
|
-
].filter(Boolean).join(" · ");
|
|
569
|
-
}
|
|
570
|
-
function CardFooter({
|
|
571
|
-
provenance,
|
|
572
|
-
rowCount,
|
|
573
|
-
currency
|
|
574
|
-
}) {
|
|
575
|
-
const text = formatProvenance(provenance, { rowCount });
|
|
576
|
-
if (!text && !currency) return null;
|
|
577
|
-
return /* @__PURE__ */ jsxs("footer", { className: "card-footer", children: [
|
|
578
|
-
/* @__PURE__ */ jsx("span", { className: "card-footer__dot", "aria-hidden": "true" }),
|
|
579
|
-
text && /* @__PURE__ */ jsxs("span", { className: "card-footer__text", children: [
|
|
580
|
-
/* @__PURE__ */ jsx("span", { className: "card-footer__sr", children: "Source: " }),
|
|
581
|
-
text
|
|
582
|
-
] }),
|
|
583
|
-
currency && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
584
|
-
text && /* @__PURE__ */ jsx("span", { className: "card-footer__sep", children: "·" }),
|
|
585
|
-
/* @__PURE__ */ jsx("span", { className: "card-footer__chip", children: currency })
|
|
586
|
-
] })
|
|
587
|
-
] });
|
|
588
|
-
}
|
|
589
|
-
const HALF_WIDTH = 70;
|
|
590
|
-
const HEIGHT = 50;
|
|
591
|
-
const GAP = 8;
|
|
592
|
-
function exactValue(value, format, currency = DEFAULT_CURRENCY) {
|
|
593
|
-
const number = value.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
594
|
-
if (format === "percent") return `${number}%`;
|
|
595
|
-
return format === "currency" ? `${currency} ${number}` : number;
|
|
596
|
-
}
|
|
597
|
-
function useTip() {
|
|
598
|
-
const [tip, setTip] = useState(null);
|
|
599
|
-
const bind = useCallback(
|
|
600
|
-
(content) => ({
|
|
601
|
-
onMouseEnter: (e) => {
|
|
602
|
-
const r = e.currentTarget.getBoundingClientRect();
|
|
603
|
-
setTip({ ...content, x: r.left + r.width / 2, top: r.top, bottom: r.bottom });
|
|
604
|
-
},
|
|
605
|
-
onMouseLeave: () => setTip(null)
|
|
606
|
-
}),
|
|
607
|
-
[]
|
|
608
|
-
);
|
|
609
|
-
const below = tip ? tip.top < HEIGHT : false;
|
|
610
|
-
const tooltip = tip ? createPortal(
|
|
611
|
-
/* @__PURE__ */ jsxs(
|
|
612
|
-
"div",
|
|
613
|
-
{
|
|
614
|
-
className: "gen-tip",
|
|
615
|
-
style: {
|
|
616
|
-
left: Math.min(Math.max(tip.x, HALF_WIDTH), window.innerWidth - HALF_WIDTH),
|
|
617
|
-
top: below ? tip.bottom + GAP : tip.top - GAP,
|
|
618
|
-
transform: below ? "translateX(-50%)" : "translate(-50%, -100%)"
|
|
619
|
-
},
|
|
620
|
-
children: [
|
|
621
|
-
tip.title && /* @__PURE__ */ jsx("span", { className: "gen-tip__title", children: tip.title }),
|
|
622
|
-
/* @__PURE__ */ jsx("span", { className: "gen-tip__value", children: tip.value })
|
|
623
|
-
]
|
|
624
|
-
}
|
|
625
|
-
),
|
|
626
|
-
document.body
|
|
627
|
-
) : null;
|
|
628
|
-
return { bind, tooltip };
|
|
629
|
-
}
|
|
630
|
-
const MONTHS = {
|
|
631
|
-
jan: "January",
|
|
632
|
-
feb: "February",
|
|
633
|
-
mar: "March",
|
|
634
|
-
apr: "April",
|
|
635
|
-
may: "May",
|
|
636
|
-
jun: "June",
|
|
637
|
-
jul: "July",
|
|
638
|
-
aug: "August",
|
|
639
|
-
sep: "September",
|
|
640
|
-
oct: "October",
|
|
641
|
-
nov: "November",
|
|
642
|
-
dec: "December"
|
|
643
|
-
};
|
|
644
|
-
const fullMonth = (label) => MONTHS[label.slice(0, 3).toLowerCase()] ?? label;
|
|
645
|
-
function compact(value) {
|
|
646
|
-
const abs = Math.abs(value);
|
|
647
|
-
if (abs >= 1e9) return `${Math.round(value / 1e7) / 100}B`;
|
|
648
|
-
if (abs >= 1e6) return `${Math.round(value / 1e4) / 100}M`;
|
|
649
|
-
if (abs >= 1e3) return `${Math.round(value / 100) / 10}K`;
|
|
650
|
-
return `${value}`;
|
|
651
|
-
}
|
|
652
|
-
function formatValue(value, format, currency = DEFAULT_CURRENCY) {
|
|
653
|
-
if (format === "percent") return `${value}%`;
|
|
654
|
-
if (format === "currency") return `${currency} ${compact(value)}`;
|
|
655
|
-
return compact(value);
|
|
656
|
-
}
|
|
657
|
-
function buildHeadline$7(metric, series, currency) {
|
|
658
|
-
const subject = metric.label.split("·")[0].trim();
|
|
659
|
-
let text = `${subject} is sitting at ${formatValue(metric.value, metric.format, currency)}`;
|
|
660
|
-
const { delta } = metric;
|
|
661
|
-
if (delta && delta.direction !== "flat") {
|
|
662
|
-
const change = delta.unit === "new" ? "new this period" : `${delta.direction} ${formatDeltaAmount(delta)}`;
|
|
663
|
-
text += `, ${change}${delta.basis ? ` ${delta.basis}` : ""}`;
|
|
664
|
-
}
|
|
665
|
-
if (series == null ? void 0 : series.points.length) {
|
|
666
|
-
const peak = series.points.reduce((max, p) => p.value > max.value ? p : max);
|
|
667
|
-
text += `, with the peak in ${fullMonth(peak.label)}`;
|
|
668
|
-
}
|
|
669
|
-
return `${text}.`;
|
|
670
|
-
}
|
|
671
|
-
const SKEW_RATIO = 20;
|
|
672
|
-
function scaleValues(values) {
|
|
673
|
-
const positives = values.filter((v) => v > 0).sort((a, b) => a - b);
|
|
674
|
-
const median = positives[Math.floor(positives.length / 2)] ?? 0;
|
|
675
|
-
const skewed = positives.length > 1 && median > 0 && positives[positives.length - 1] / median > SKEW_RATIO;
|
|
676
|
-
return skewed ? (v) => Math.sign(v) * Math.log10(1 + Math.abs(v)) : (v) => v;
|
|
677
|
-
}
|
|
678
|
-
const BAR_MIN_WIDTH = 52;
|
|
679
|
-
const DELTA_ARROW = { up: "↑", down: "↓", flat: "→" };
|
|
680
|
-
function splitValue(value, format, currency) {
|
|
681
|
-
if (format === "currency") return { unit: currency, figure: compact(value) };
|
|
682
|
-
if (format === "percent") return { unit: void 0, figure: `${value}%` };
|
|
683
|
-
return { unit: void 0, figure: compact(value) };
|
|
684
|
-
}
|
|
685
|
-
const AREA_W = 160;
|
|
686
|
-
const AREA_H = 56;
|
|
687
|
-
const AREA_PAD = 6;
|
|
688
|
-
function smoothPath(coords) {
|
|
689
|
-
const clampY = (y, a, b) => Math.min(Math.max(y, Math.min(a, b)), Math.max(a, b));
|
|
690
|
-
let d = `M${coords[0][0].toFixed(1)},${coords[0][1].toFixed(1)}`;
|
|
691
|
-
for (let i = 0; i < coords.length - 1; i++) {
|
|
692
|
-
const p0 = coords[i - 1] ?? coords[i];
|
|
693
|
-
const p1 = coords[i];
|
|
694
|
-
const p2 = coords[i + 1];
|
|
695
|
-
const p3 = coords[i + 2] ?? p2;
|
|
696
|
-
const c1x = p1[0] + (p2[0] - p0[0]) / 6;
|
|
697
|
-
const c1y = clampY(p1[1] + (p2[1] - p0[1]) / 6, p1[1], p2[1]);
|
|
698
|
-
const c2x = p2[0] - (p3[0] - p1[0]) / 6;
|
|
699
|
-
const c2y = clampY(p2[1] - (p3[1] - p1[1]) / 6, p1[1], p2[1]);
|
|
700
|
-
d += ` C${c1x.toFixed(1)},${c1y.toFixed(1)} ${c2x.toFixed(1)},${c2y.toFixed(1)} ${p2[0].toFixed(1)},${p2[1].toFixed(1)}`;
|
|
701
|
-
}
|
|
702
|
-
return d;
|
|
703
|
-
}
|
|
704
|
-
function AreaTrend({ data, className = "metric-hero__trend", tone }) {
|
|
705
|
-
const gradientId = useId();
|
|
706
|
-
if (data.length < 2) return null;
|
|
707
|
-
const scale = scaleValues(data);
|
|
708
|
-
const scaled = data.map(scale);
|
|
709
|
-
const min = Math.min(...scaled);
|
|
710
|
-
const range = Math.max(...scaled) - min || 1;
|
|
711
|
-
const step = (AREA_W - AREA_PAD * 2) / (data.length - 1);
|
|
712
|
-
const baseY = AREA_H - AREA_PAD;
|
|
713
|
-
const coords = data.map((v, i) => [AREA_PAD + i * step, baseY - (scale(v) - min) / range * (AREA_H - AREA_PAD * 2)]);
|
|
714
|
-
const line = smoothPath(coords);
|
|
715
|
-
const first = coords[0];
|
|
716
|
-
const last = coords[coords.length - 1];
|
|
717
|
-
const area = `${line} L${last[0].toFixed(1)},${baseY} L${first[0].toFixed(1)},${baseY} Z`;
|
|
718
|
-
const peak = data.reduce((best, v, i) => v > data[best] ? i : best, 0);
|
|
719
|
-
const at = ([x, y]) => ({ left: `${x / AREA_W * 100}%`, top: `${y / AREA_H * 100}%` });
|
|
720
|
-
return /* @__PURE__ */ jsxs("div", { className: `area-trend ${className}${tone ? ` area-trend--${tone}` : ""}`, "aria-hidden": "true", children: [
|
|
721
|
-
/* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${AREA_W} ${AREA_H}`, preserveAspectRatio: "none", children: [
|
|
722
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
723
|
-
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: 0.22 }),
|
|
724
|
-
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: 0 })
|
|
725
|
-
] }) }),
|
|
726
|
-
/* @__PURE__ */ jsx("line", { className: "area-trend__baseline", x1: first[0], x2: last[0], y1: baseY, y2: baseY, vectorEffect: "non-scaling-stroke" }),
|
|
727
|
-
/* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gradientId})` }),
|
|
728
|
-
/* @__PURE__ */ jsx(
|
|
729
|
-
"path",
|
|
730
|
-
{
|
|
731
|
-
d: line,
|
|
732
|
-
fill: "none",
|
|
733
|
-
stroke: "currentColor",
|
|
734
|
-
strokeWidth: 2,
|
|
735
|
-
strokeLinejoin: "round",
|
|
736
|
-
strokeLinecap: "round",
|
|
737
|
-
vectorEffect: "non-scaling-stroke"
|
|
738
|
-
}
|
|
739
|
-
)
|
|
740
|
-
] }),
|
|
741
|
-
/* @__PURE__ */ jsx("span", { className: "area-trend__marker", style: at(coords[peak]) }),
|
|
742
|
-
peak !== coords.length - 1 && /* @__PURE__ */ jsx("span", { className: "area-trend__marker area-trend__marker--end", style: at(last) })
|
|
743
|
-
] });
|
|
744
|
-
}
|
|
745
|
-
function MetricHero({ label, value, format, delta, sparkline_data, currency = DEFAULT_CURRENCY }) {
|
|
746
|
-
const { unit, figure } = splitValue(value, format, currency);
|
|
747
|
-
const { bind, tooltip } = useTip();
|
|
748
|
-
return /* @__PURE__ */ jsxs("div", { className: "metric-hero", children: [
|
|
749
|
-
/* @__PURE__ */ jsxs("div", { className: "metric-hero__body", children: [
|
|
750
|
-
/* @__PURE__ */ jsx("h3", { className: "metric-hero__label", children: label }),
|
|
751
|
-
/* @__PURE__ */ jsxs("div", { className: "metric-hero__value", ...bind({ title: label, value: exactValue(value, format, currency) }), children: [
|
|
752
|
-
unit && /* @__PURE__ */ jsx("span", { className: "metric-hero__unit", children: unit }),
|
|
753
|
-
/* @__PURE__ */ jsx("span", { className: "metric-hero__figure", children: figure })
|
|
754
|
-
] }),
|
|
755
|
-
delta && /* @__PURE__ */ jsxs("div", { className: "metric-hero__delta", children: [
|
|
756
|
-
/* @__PURE__ */ jsxs("span", { className: `metric-hero__pill metric-hero__pill--${delta.polarity}`, children: [
|
|
757
|
-
/* @__PURE__ */ jsx("span", { className: "metric-hero__arrow", children: DELTA_ARROW[delta.direction] }),
|
|
758
|
-
formatDeltaAmount(delta)
|
|
759
|
-
] }),
|
|
760
|
-
delta.basis && /* @__PURE__ */ jsx("span", { className: "metric-hero__basis", children: delta.basis })
|
|
761
|
-
] })
|
|
762
|
-
] }),
|
|
763
|
-
sparkline_data && /* @__PURE__ */ jsx(AreaTrend, { data: sparkline_data, tone: delta == null ? void 0 : delta.polarity }),
|
|
764
|
-
tooltip
|
|
765
|
-
] });
|
|
766
|
-
}
|
|
767
|
-
function PillBars({ label, points, emphasis_index, format, currency = DEFAULT_CURRENCY }) {
|
|
768
|
-
const { bind, tooltip } = useTip();
|
|
769
|
-
const scale = scaleValues(points.map((p) => p.value));
|
|
770
|
-
const max = Math.max(...points.map((p) => scale(p.value)), 0);
|
|
771
|
-
return /* @__PURE__ */ jsxs("div", { className: "pill-bars", children: [
|
|
772
|
-
/* @__PURE__ */ jsx("h3", { className: "pill-bars__label", children: label }),
|
|
773
|
-
/* @__PURE__ */ jsx("div", { className: "pill-bars__plot", style: { gridTemplateColumns: `repeat(${points.length}, minmax(${BAR_MIN_WIDTH}px, 1fr))` }, children: points.map((p, i) => {
|
|
774
|
-
const active = i === emphasis_index;
|
|
775
|
-
const height = max > 0 && p.value > 0 ? `max(${scale(p.value) / max * 100}%, 8px)` : "0";
|
|
776
|
-
return /* @__PURE__ */ jsxs(
|
|
777
|
-
"div",
|
|
778
|
-
{
|
|
779
|
-
className: `pill-bars__col${active ? " is-active" : ""}`,
|
|
780
|
-
...bind({ title: p.label, value: exactValue(p.value, format, currency) }),
|
|
781
|
-
children: [
|
|
782
|
-
/* @__PURE__ */ jsx("span", { className: "pill-bars__value", children: format === "percent" ? `${p.value}%` : compact(p.value) }),
|
|
783
|
-
/* @__PURE__ */ jsx("div", { className: "pill-bars__track", children: /* @__PURE__ */ jsx("div", { className: "pill-bars__bar", style: { height } }) }),
|
|
784
|
-
/* @__PURE__ */ jsx("span", { className: "pill-bars__axis-label", children: p.label })
|
|
785
|
-
]
|
|
786
|
-
},
|
|
787
|
-
p.label
|
|
788
|
-
);
|
|
789
|
-
}) }),
|
|
790
|
-
tooltip
|
|
791
|
-
] });
|
|
792
|
-
}
|
|
793
|
-
function MetricCard({
|
|
794
|
-
payload = [],
|
|
795
|
-
currency = DEFAULT_CURRENCY
|
|
796
|
-
}) {
|
|
797
|
-
var _a, _b, _c;
|
|
798
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
799
|
-
const metric = (_a = blocks.find((b) => b.type === "metric")) == null ? void 0 : _a.props;
|
|
800
|
-
const series = (_b = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _b.props;
|
|
801
|
-
const provenance = (_c = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _c.props;
|
|
802
|
-
const headline = useMemo(
|
|
803
|
-
() => metric ? buildHeadline$7(metric, series, currency) : null,
|
|
804
|
-
[metric, series, currency]
|
|
805
|
-
);
|
|
806
|
-
return /* @__PURE__ */ jsx("div", { className: "metric-card", children: /* @__PURE__ */ jsxs("section", { className: "metric-card__panel", children: [
|
|
807
|
-
headline && /* @__PURE__ */ jsx("p", { className: "metric-card__headline", children: headline }),
|
|
808
|
-
metric && /* @__PURE__ */ jsx("div", { className: "metric-card__hero", children: /* @__PURE__ */ jsx(MetricHero, { ...metric, currency }) }),
|
|
809
|
-
series && /* @__PURE__ */ jsx("div", { className: "metric-card__section", children: /* @__PURE__ */ jsx(PillBars, { ...series, currency }) }),
|
|
810
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance, currency: (metric == null ? void 0 : metric.format) === "currency" ? currency : void 0 })
|
|
811
|
-
] }) });
|
|
812
|
-
}
|
|
813
|
-
const splitLabel = (label) => {
|
|
814
|
-
const [name, ...rest] = label.split("·").map((s) => s.trim());
|
|
815
|
-
return { name, period: rest.join(" · ") || void 0 };
|
|
816
|
-
};
|
|
817
|
-
function buildHeadline$6(metrics, currency) {
|
|
818
|
-
if (metrics.length === 0) return null;
|
|
819
|
-
const parts = metrics.map((m) => ({ ...splitLabel(m.label), m }));
|
|
820
|
-
const fmt = (m) => formatValue(m.value, m.format, currency);
|
|
821
|
-
const sameMetric = parts.every((p) => p.name === parts[0].name && p.period);
|
|
822
|
-
if (sameMetric && metrics.every((m) => m.format !== "percent")) {
|
|
823
|
-
const total = metrics.reduce((sum, m) => sum + m.value, 0);
|
|
824
|
-
const top = parts.reduce((a, b) => b.m.value > a.m.value ? b : a);
|
|
825
|
-
const first = parts[0].period;
|
|
826
|
-
const last = parts[parts.length - 1].period;
|
|
827
|
-
return `${parts[0].name} across ${first} to ${last} totals ${formatValue(total, metrics[0].format, currency)}, with ${top.period} the largest at ${fmt(top.m)}.`;
|
|
828
|
-
}
|
|
829
|
-
const items = parts.map((p, i) => i === 0 ? `${p.name} is ${fmt(p.m)}` : `${p.name} ${fmt(p.m)}`);
|
|
830
|
-
const sentence = items.length > 1 ? `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}` : items[0];
|
|
831
|
-
return `${sentence}.`;
|
|
832
|
-
}
|
|
833
|
-
function MetricTile({ metric, currency = DEFAULT_CURRENCY }) {
|
|
834
|
-
const { name, period } = splitLabel(metric.label);
|
|
835
|
-
const { delta } = metric;
|
|
836
|
-
const { unit, figure } = splitValue(metric.value, metric.format, currency);
|
|
837
|
-
const { bind, tooltip } = useTip();
|
|
838
|
-
return /* @__PURE__ */ jsxs("div", { className: "metric-tile", children: [
|
|
839
|
-
/* @__PURE__ */ jsxs("div", { className: "metric-tile__header", children: [
|
|
840
|
-
/* @__PURE__ */ jsx("span", { className: "metric-tile__name", children: name }),
|
|
841
|
-
period && /* @__PURE__ */ jsx("span", { className: "metric-tile__period", children: period })
|
|
842
|
-
] }),
|
|
843
|
-
/* @__PURE__ */ jsxs("div", { className: "metric-tile__value", ...bind({ title: metric.label, value: exactValue(metric.value, metric.format, currency) }), children: [
|
|
844
|
-
unit && /* @__PURE__ */ jsx("span", { className: "metric-tile__unit", children: unit }),
|
|
845
|
-
/* @__PURE__ */ jsx("span", { className: "metric-tile__figure", children: figure })
|
|
846
|
-
] }),
|
|
847
|
-
(delta || metric.sparkline_data) && /* @__PURE__ */ jsxs("div", { className: "metric-tile__footer", children: [
|
|
848
|
-
delta && /* @__PURE__ */ jsxs("span", { className: `metric-tile__badge metric-tile__badge--${delta.polarity}`, children: [
|
|
849
|
-
DELTA_ARROW[delta.direction],
|
|
850
|
-
" ",
|
|
851
|
-
formatDeltaAmount(delta)
|
|
852
|
-
] }),
|
|
853
|
-
(delta == null ? void 0 : delta.basis) && /* @__PURE__ */ jsx("span", { className: "metric-tile__basis", children: delta.basis }),
|
|
854
|
-
metric.sparkline_data && /* @__PURE__ */ jsx(AreaTrend, { data: metric.sparkline_data, className: "metric-tile__trend", tone: delta == null ? void 0 : delta.polarity })
|
|
855
|
-
] }),
|
|
856
|
-
tooltip
|
|
857
|
-
] });
|
|
858
|
-
}
|
|
859
|
-
const columnsFor = (count) => count <= 3 ? Math.max(count, 1) : 2;
|
|
860
|
-
function MetricRow({ metrics, currency = DEFAULT_CURRENCY }) {
|
|
861
|
-
const columns = columnsFor(metrics.length);
|
|
862
|
-
return /* @__PURE__ */ jsx("div", { className: "metric-row", "data-cols": columns, style: { ["--metric-row-cols"]: columns }, children: metrics.map((m, i) => /* @__PURE__ */ jsx(MetricTile, { metric: m, currency }, `${m.label}-${i}`)) });
|
|
863
|
-
}
|
|
864
|
-
function MetricRowCard({
|
|
865
|
-
payload = [],
|
|
866
|
-
currency = DEFAULT_CURRENCY
|
|
867
|
-
}) {
|
|
868
|
-
var _a, _b, _c;
|
|
869
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
870
|
-
const row = (_a = blocks.find((b) => b.type === "metric_row")) == null ? void 0 : _a.props;
|
|
871
|
-
const series = (_b = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _b.props;
|
|
872
|
-
const provenance = (_c = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _c.props;
|
|
873
|
-
const headline = useMemo(() => row ? buildHeadline$6(row.metrics, currency) : null, [row, currency]);
|
|
874
|
-
return /* @__PURE__ */ jsx("div", { className: "metric-row-card", children: /* @__PURE__ */ jsxs("section", { className: "metric-row-card__panel", children: [
|
|
875
|
-
headline && /* @__PURE__ */ jsx("p", { className: "metric-row-card__headline", children: headline }),
|
|
876
|
-
row && /* @__PURE__ */ jsx("div", { className: "metric-row-card__section", children: /* @__PURE__ */ jsx(MetricRow, { metrics: row.metrics, currency }) }),
|
|
877
|
-
series && /* @__PURE__ */ jsx("div", { className: "metric-row-card__section", children: /* @__PURE__ */ jsx(PillBars, { ...series, currency }) }),
|
|
878
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance, currency })
|
|
879
|
-
] }) });
|
|
880
|
-
}
|
|
881
|
-
function changeBetween(current, previous) {
|
|
882
|
-
if (!previous) return null;
|
|
883
|
-
if (current.value === previous.value) {
|
|
884
|
-
return { value: 0, unit: "percent", direction: "flat", polarity: "neutral" };
|
|
885
|
-
}
|
|
886
|
-
if (previous.value === 0) return null;
|
|
887
|
-
const change = (current.value - previous.value) / Math.abs(previous.value) * 100;
|
|
888
|
-
const up = change > 0;
|
|
889
|
-
return {
|
|
890
|
-
value: Math.round(Math.abs(change) * 10) / 10,
|
|
891
|
-
unit: "percent",
|
|
892
|
-
direction: up ? "up" : "down",
|
|
893
|
-
polarity: up ? "positive" : "negative"
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
function resolveDelta({ delta, entries }) {
|
|
897
|
-
return delta ?? changeBetween(entries[0], entries[1]);
|
|
898
|
-
}
|
|
899
|
-
const arrowFor = (delta) => DELTA_ARROW[delta.direction];
|
|
900
|
-
const hasChange = (delta) => !!delta && delta.direction !== "flat" && delta.value !== 0;
|
|
901
|
-
const periodText = (label) => /^(this|last|previous|current)\b/i.test(label) ? label.toLowerCase() : label;
|
|
902
|
-
const withPeriod = (name, entry) => /^(this|last|previous|current)\b/i.test(entry.label) ? `${name} ${periodText(entry.label)}` : `${name} in ${entry.label}`;
|
|
903
|
-
function buildHeadline$5(props, delta, currency) {
|
|
904
|
-
const { entries } = props;
|
|
905
|
-
const [current, previous] = entries;
|
|
906
|
-
if (!current) return null;
|
|
907
|
-
const fmt = (v) => formatValue(v, props.format, currency);
|
|
908
|
-
const subject = `${withPeriod(props.label, current)} are ${fmt(current.value)}`;
|
|
909
|
-
if (!previous) return `${subject}.`;
|
|
910
|
-
const prev = `${periodText(previous.label)}'s ${fmt(previous.value)}`;
|
|
911
|
-
let text;
|
|
912
|
-
if (!delta) text = `${subject}, compared with ${prev}`;
|
|
913
|
-
else if (!hasChange(delta)) text = `${subject}, identical to ${prev}, so there's no change`;
|
|
914
|
-
else text = `${subject}, ${delta.direction} ${formatDeltaAmount(delta)} from ${prev}`;
|
|
915
|
-
if (entries.length > 2) {
|
|
916
|
-
const values = entries.map((e) => e.value);
|
|
917
|
-
if (current.value === Math.max(...values) && current.value !== Math.min(...values)) {
|
|
918
|
-
text += ` — the highest of the ${entries.length} periods shown`;
|
|
919
|
-
} else if (current.value === Math.min(...values) && current.value !== Math.max(...values)) {
|
|
920
|
-
text += ` — the lowest of the ${entries.length} periods shown`;
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
return `${text}.`;
|
|
924
|
-
}
|
|
925
|
-
function Comparison({ props, currency = DEFAULT_CURRENCY }) {
|
|
926
|
-
const { entries } = props;
|
|
927
|
-
const [current, previous] = entries;
|
|
928
|
-
if (!current) return null;
|
|
929
|
-
const delta = resolveDelta(props);
|
|
930
|
-
const fmt = (v) => formatValue(v, props.format, currency);
|
|
931
|
-
const history = entries.slice(1);
|
|
932
|
-
const { bind, tooltip } = useTip();
|
|
933
|
-
const { unit, figure } = splitValue(current.value, props.format, currency);
|
|
934
|
-
return /* @__PURE__ */ jsxs("div", { className: "comparison", children: [
|
|
935
|
-
/* @__PURE__ */ jsxs("div", { className: "comparison__tile", children: [
|
|
936
|
-
/* @__PURE__ */ jsxs("div", { className: "comparison__header", children: [
|
|
937
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__name", children: props.label }),
|
|
938
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__period", children: current.label })
|
|
939
|
-
] }),
|
|
940
|
-
/* @__PURE__ */ jsxs("div", { className: "comparison__value", ...bind({ title: current.label, value: exactValue(current.value, props.format, currency) }), children: [
|
|
941
|
-
unit && /* @__PURE__ */ jsx("span", { className: "comparison__unit", children: unit }),
|
|
942
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__figure", children: figure })
|
|
943
|
-
] }),
|
|
944
|
-
hasChange(delta) && previous && /* @__PURE__ */ jsxs("div", { className: "comparison__delta", children: [
|
|
945
|
-
/* @__PURE__ */ jsxs("span", { className: `comparison__badge comparison__badge--${delta.polarity}`, children: [
|
|
946
|
-
arrowFor(delta),
|
|
947
|
-
" ",
|
|
948
|
-
formatDeltaAmount(delta)
|
|
949
|
-
] }),
|
|
950
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__basis", children: delta.basis ?? `vs. ${periodText(previous.label)}` })
|
|
951
|
-
] })
|
|
952
|
-
] }),
|
|
953
|
-
history.length > 0 && /* @__PURE__ */ jsx("div", { className: "comparison__history", children: history.map((entry, i) => {
|
|
954
|
-
const rowDelta = history.length > 1 ? changeBetween(entry, history[i + 1]) : null;
|
|
955
|
-
return /* @__PURE__ */ jsxs(
|
|
956
|
-
"div",
|
|
957
|
-
{
|
|
958
|
-
className: "comparison__previous",
|
|
959
|
-
...bind({ title: entry.label, value: exactValue(entry.value, props.format, currency) }),
|
|
960
|
-
children: [
|
|
961
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__previous-label", children: entry.label }),
|
|
962
|
-
hasChange(rowDelta) && /* @__PURE__ */ jsxs("span", { className: `comparison__row-badge comparison__badge--${rowDelta.polarity}`, children: [
|
|
963
|
-
arrowFor(rowDelta),
|
|
964
|
-
" ",
|
|
965
|
-
rowDelta.value,
|
|
966
|
-
"%"
|
|
967
|
-
] }),
|
|
968
|
-
/* @__PURE__ */ jsx("span", { className: "comparison__previous-value", children: fmt(entry.value) })
|
|
969
|
-
]
|
|
970
|
-
},
|
|
971
|
-
`${entry.label}-${i}`
|
|
972
|
-
);
|
|
973
|
-
}) }),
|
|
974
|
-
tooltip
|
|
975
|
-
] });
|
|
976
|
-
}
|
|
977
|
-
function ComparisonCard({
|
|
978
|
-
payload = [],
|
|
979
|
-
currency = DEFAULT_CURRENCY
|
|
980
|
-
}) {
|
|
981
|
-
var _a, _b;
|
|
982
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
983
|
-
const comparison = (_a = blocks.find((b) => b.type === "comparison")) == null ? void 0 : _a.props;
|
|
984
|
-
const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
|
|
985
|
-
const headline = useMemo(
|
|
986
|
-
() => comparison ? buildHeadline$5(comparison, resolveDelta(comparison), currency) : null,
|
|
987
|
-
[comparison, currency]
|
|
988
|
-
);
|
|
989
|
-
return /* @__PURE__ */ jsx("div", { className: "comparison-card", children: /* @__PURE__ */ jsxs("section", { className: "comparison-card__panel", children: [
|
|
990
|
-
headline && /* @__PURE__ */ jsx("p", { className: "comparison-card__headline", children: headline }),
|
|
991
|
-
comparison && /* @__PURE__ */ jsx(Comparison, { props: comparison, currency }),
|
|
992
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance, currency })
|
|
993
|
-
] }) });
|
|
994
|
-
}
|
|
995
|
-
const peakIndex = (points) => points.reduce((best, p, i) => p.value > points[best].value ? i : best, 0);
|
|
996
|
-
const isMonth = (label) => fullMonth(label) !== label;
|
|
997
|
-
function buildHeadline$4({ label, points, format }, currency) {
|
|
998
|
-
if (points.length === 0) return null;
|
|
999
|
-
const fmt = (v) => formatValue(v, format, currency);
|
|
1000
|
-
const unit = points.every((p) => isMonth(p.label)) ? "months" : "periods";
|
|
1001
|
-
const total = points.reduce((sum, p) => sum + p.value, 0);
|
|
1002
|
-
let text = `The past ${points.length} ${unit} delivered ${fmt(total)} in ${label.toLowerCase()}`;
|
|
1003
|
-
if (total > 0) {
|
|
1004
|
-
const peak = points[peakIndex(points)];
|
|
1005
|
-
text += `, driven primarily by the ${fullMonth(peak.label)} figure (${fmt(peak.value)})`;
|
|
1006
|
-
}
|
|
1007
|
-
return `${text}.`;
|
|
1008
|
-
}
|
|
1009
|
-
function SeriesSummary({ label, points, format, currency = DEFAULT_CURRENCY }) {
|
|
1010
|
-
if (points.length === 0) return null;
|
|
1011
|
-
const latest = points[points.length - 1];
|
|
1012
|
-
const peak = points[peakIndex(points)];
|
|
1013
|
-
const { unit, figure } = splitValue(latest.value, format, currency);
|
|
1014
|
-
const { bind, tooltip } = useTip();
|
|
1015
|
-
return /* @__PURE__ */ jsxs("div", { className: "series-summary", children: [
|
|
1016
|
-
/* @__PURE__ */ jsxs("div", { className: "series-summary__header", children: [
|
|
1017
|
-
/* @__PURE__ */ jsx("span", { className: "series-summary__name", children: label }),
|
|
1018
|
-
/* @__PURE__ */ jsx("span", { className: "series-summary__period", children: latest.label })
|
|
1019
|
-
] }),
|
|
1020
|
-
/* @__PURE__ */ jsxs("div", { className: "series-summary__main", children: [
|
|
1021
|
-
/* @__PURE__ */ jsxs("div", { className: "series-summary__body", children: [
|
|
1022
|
-
/* @__PURE__ */ jsxs("div", { className: "series-summary__value", ...bind({ title: latest.label, value: exactValue(latest.value, format, currency) }), children: [
|
|
1023
|
-
unit && /* @__PURE__ */ jsx("span", { className: "series-summary__unit", children: unit }),
|
|
1024
|
-
/* @__PURE__ */ jsx("span", { className: "series-summary__figure", children: figure })
|
|
1025
|
-
] }),
|
|
1026
|
-
/* @__PURE__ */ jsxs("div", { className: "series-summary__peak", children: [
|
|
1027
|
-
"Peak: ",
|
|
1028
|
-
peak.label,
|
|
1029
|
-
" · ",
|
|
1030
|
-
formatValue(peak.value, format, currency)
|
|
1031
|
-
] })
|
|
1032
|
-
] }),
|
|
1033
|
-
/* @__PURE__ */ jsx(AreaTrend, { data: points.map((p) => p.value), className: "series-summary__trend" })
|
|
1034
|
-
] }),
|
|
1035
|
-
tooltip
|
|
1036
|
-
] });
|
|
1037
|
-
}
|
|
1038
|
-
function BarSeriesCard({
|
|
1039
|
-
payload = [],
|
|
1040
|
-
currency = DEFAULT_CURRENCY
|
|
1041
|
-
}) {
|
|
1042
|
-
var _a, _b;
|
|
1043
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
1044
|
-
const series = (_a = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _a.props;
|
|
1045
|
-
const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
|
|
1046
|
-
const headline = useMemo(() => series ? buildHeadline$4(series, currency) : null, [series, currency]);
|
|
1047
|
-
const emphasis = series ? series.emphasis_index ?? peakIndex(series.points) : void 0;
|
|
1048
|
-
return /* @__PURE__ */ jsx("div", { className: "bar-series-card", children: /* @__PURE__ */ jsxs("section", { className: "bar-series-card__panel", children: [
|
|
1049
|
-
headline && /* @__PURE__ */ jsx("p", { className: "bar-series-card__headline", children: headline }),
|
|
1050
|
-
series && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1051
|
-
/* @__PURE__ */ jsx("div", { className: "bar-series-card__section bar-series-card__section--hero", children: /* @__PURE__ */ jsx(SeriesSummary, { ...series, currency }) }),
|
|
1052
|
-
/* @__PURE__ */ jsx("div", { className: "bar-series-card__section", children: /* @__PURE__ */ jsx(PillBars, { ...series, label: `${series.label} by period`, emphasis_index: emphasis, currency }) })
|
|
1053
|
-
] }),
|
|
1054
|
-
/* @__PURE__ */ jsx(CardFooter, { provenance, rowCount: (series == null ? void 0 : series.points.length) ?? 0, currency })
|
|
1055
|
-
] }) });
|
|
1056
|
-
}
|
|
1057
|
-
function formatFull(value, format, currency = DEFAULT_CURRENCY) {
|
|
1058
|
-
if (format === "percent") return `${value}%`;
|
|
1059
|
-
const number = value.toLocaleString("en-US", {
|
|
1060
|
-
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
1061
|
-
maximumFractionDigits: 2
|
|
1062
|
-
});
|
|
1063
|
-
return format === "currency" ? `${currency} ${number}` : number;
|
|
1064
|
-
}
|
|
1065
|
-
const subjectOf = (label) => label.replace(/^top\s+/i, "").trim();
|
|
1066
|
-
const joinList = (items) => items.length > 1 ? `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}` : items[0];
|
|
1067
|
-
function buildHeadline$3({ label, entries, format }, currency) {
|
|
1068
|
-
if (entries.length === 0) return null;
|
|
1069
|
-
const list = entries.map((e) => `${e.label} (${formatFull(e.value, format, currency)})`);
|
|
1070
|
-
return `Our top ${entries.length} ${subjectOf(label)} are ${joinList(list)}.`;
|
|
1071
|
-
}
|
|
1072
|
-
function RankedBars({ label, entries, format, total_row_count, currency = DEFAULT_CURRENCY }) {
|
|
1073
|
-
const max = Math.max(...entries.map((e) => e.value), 0);
|
|
1074
|
-
const truncated = total_row_count !== void 0 && total_row_count > entries.length;
|
|
1075
|
-
const { bind, tooltip } = useTip();
|
|
1076
|
-
return /* @__PURE__ */ jsxs("div", { className: "ranked-bars", children: [
|
|
1077
|
-
/* @__PURE__ */ jsxs("div", { className: "ranked-bars__heading", children: [
|
|
1078
|
-
/* @__PURE__ */ jsx("h3", { className: "ranked-bars__label", children: label }),
|
|
1079
|
-
truncated && /* @__PURE__ */ jsxs("span", { className: "ranked-bars__count", children: [
|
|
1080
|
-
"Top ",
|
|
1081
|
-
entries.length,
|
|
1082
|
-
" of ",
|
|
1083
|
-
total_row_count
|
|
1084
|
-
] })
|
|
1085
|
-
] }),
|
|
1086
|
-
/* @__PURE__ */ jsx("ol", { className: "ranked-bars__list", children: entries.map((e, i) => /* @__PURE__ */ jsxs(
|
|
1087
|
-
"li",
|
|
1088
|
-
{
|
|
1089
|
-
className: `ranked-bars__row${i === 0 ? " is-top" : ""}`,
|
|
1090
|
-
...bind({ title: e.label, value: exactValue(e.value, format, currency) }),
|
|
1091
|
-
children: [
|
|
1092
|
-
/* @__PURE__ */ jsxs("div", { className: "ranked-bars__line", children: [
|
|
1093
|
-
/* @__PURE__ */ jsx("span", { className: "ranked-bars__name", children: e.label }),
|
|
1094
|
-
/* @__PURE__ */ jsx("span", { className: "ranked-bars__value", children: formatFull(e.value, format, currency) })
|
|
1095
|
-
] }),
|
|
1096
|
-
/* @__PURE__ */ jsx("div", { className: "ranked-bars__track", children: /* @__PURE__ */ jsx("div", { className: "ranked-bars__bar", style: { width: `${max > 0 ? Math.max(e.value / max * 100, 0) : 0}%` } }) })
|
|
1097
|
-
]
|
|
1098
|
-
},
|
|
1099
|
-
`${e.label}-${i}`
|
|
1100
|
-
)) }),
|
|
1101
|
-
tooltip
|
|
1102
|
-
] });
|
|
1103
|
-
}
|
|
1104
|
-
function RankedBarsCard({
|
|
1105
|
-
payload = [],
|
|
1106
|
-
currency = DEFAULT_CURRENCY
|
|
1107
|
-
}) {
|
|
1108
|
-
var _a, _b;
|
|
1109
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
1110
|
-
const ranked = (_a = blocks.find((b) => b.type === "ranked_bars")) == null ? void 0 : _a.props;
|
|
1111
|
-
const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
|
|
1112
|
-
const headline = useMemo(() => ranked ? buildHeadline$3(ranked, currency) : null, [ranked, currency]);
|
|
1113
|
-
return /* @__PURE__ */ jsx("div", { className: "ranked-bars-card", children: /* @__PURE__ */ jsxs("section", { className: "ranked-bars-card__panel", children: [
|
|
1114
|
-
headline && /* @__PURE__ */ jsx("p", { className: "ranked-bars-card__headline", children: headline }),
|
|
1115
|
-
ranked && /* @__PURE__ */ jsx("div", { className: "ranked-bars-card__section", children: /* @__PURE__ */ jsx(RankedBars, { ...ranked, currency }) }),
|
|
1116
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance, currency: (ranked == null ? void 0 : ranked.format) === "currency" ? currency : void 0 })
|
|
1117
|
-
] }) });
|
|
1118
|
-
}
|
|
1119
|
-
const STATUS_COLOR_RULES = [
|
|
1120
|
-
{ color: "#9f2f24", keywords: ["rejected", "cancelled", "canceled", "void", "refunded", "returned", "written off", "terminated", "declined"] },
|
|
1121
|
-
{ color: "#c9402f", keywords: ["overdue", "failed", "late", "disputed", "expired", "blocked", "inactive", "deactive", "error"] },
|
|
1122
|
-
{ color: "#b5690f", keywords: ["pending", "unpaid", "partially", "partial", "draft", "open", "submitted", "awaiting", "in progress", "on hold"] },
|
|
1123
|
-
{ color: "#1f8a55", keywords: ["paid", "settled", "approved", "active", "completed", "complete", "closed", "delivered", "received", "posted"] }
|
|
1124
|
-
];
|
|
1125
|
-
const NEUTRAL_COLOR = "#8a9099";
|
|
1126
|
-
const RULE_PATTERNS = STATUS_COLOR_RULES.map(({ color, keywords }) => ({
|
|
1127
|
-
color,
|
|
1128
|
-
match: new RegExp(`\\b(?:${keywords.join("|")})\\b`, "i")
|
|
1129
|
-
}));
|
|
1130
|
-
const colorForStatus = (label) => {
|
|
1131
|
-
var _a;
|
|
1132
|
-
return ((_a = RULE_PATTERNS.find((rule) => rule.match.test(label))) == null ? void 0 : _a.color) ?? NEUTRAL_COLOR;
|
|
1133
|
-
};
|
|
1134
|
-
const pct = (value, total) => total > 0 ? Math.round(value / total * 100) : 0;
|
|
1135
|
-
const resolveTotal = ({ total, segments }) => total ?? segments.reduce((sum, s) => sum + s.value, 0);
|
|
1136
|
-
function nounOf(label) {
|
|
1137
|
-
const base = label.split("·")[0].replace(/\s+by\s+.*$/i, "").replace(/\s+status$/i, "").trim().toLowerCase();
|
|
1138
|
-
return base.endsWith("s") ? base : `${base}s`;
|
|
1139
|
-
}
|
|
1140
|
-
function buildHeadline$2(props) {
|
|
1141
|
-
var _a;
|
|
1142
|
-
const { label, segments } = props;
|
|
1143
|
-
if (segments.length === 0) return null;
|
|
1144
|
-
const total = resolveTotal(props);
|
|
1145
|
-
const year = (_a = label.match(/\b(19|20)\d{2}\b/)) == null ? void 0 : _a[0];
|
|
1146
|
-
const [first] = segments;
|
|
1147
|
-
const overdue = segments.find((s) => s !== first && /overdue/i.test(s.label));
|
|
1148
|
-
const second = overdue ?? segments[1];
|
|
1149
|
-
let text = `Of ${total} ${nounOf(label)}${year ? ` in ${year}` : ""}, ${first.value} are ${first.label.toLowerCase()}`;
|
|
1150
|
-
if (second) text += ` and ${second.value} are ${second.label.toLowerCase()}`;
|
|
1151
|
-
return `${text}.`;
|
|
1152
|
-
}
|
|
1153
|
-
function Donut({ segments, total, size = 148, stroke = 20 }) {
|
|
1154
|
-
const radius = (size - stroke) / 2;
|
|
1155
|
-
const circumference = 2 * Math.PI * radius;
|
|
1156
|
-
const { bind, tooltip } = useTip();
|
|
1157
|
-
const gap = segments.filter((s) => s.value > 0).length > 1 ? 2 : 0;
|
|
1158
|
-
let offset = 0;
|
|
1159
|
-
const arcs = segments.map((seg) => {
|
|
1160
|
-
const length = total > 0 ? seg.value / total * circumference : 0;
|
|
1161
|
-
const visible = Math.max(length - gap, 0);
|
|
1162
|
-
const arc = /* @__PURE__ */ jsx(
|
|
1163
|
-
"circle",
|
|
1164
|
-
{
|
|
1165
|
-
cx: size / 2,
|
|
1166
|
-
cy: size / 2,
|
|
1167
|
-
r: radius,
|
|
1168
|
-
fill: "none",
|
|
1169
|
-
stroke: colorForStatus(seg.label),
|
|
1170
|
-
strokeWidth: stroke,
|
|
1171
|
-
strokeDasharray: `${visible} ${circumference - visible}`,
|
|
1172
|
-
strokeDashoffset: -offset,
|
|
1173
|
-
...bind({ title: seg.label, value: `${seg.value.toLocaleString("en-US")} (${pct(seg.value, total)}%)` })
|
|
1174
|
-
},
|
|
1175
|
-
seg.label
|
|
1176
|
-
);
|
|
1177
|
-
offset += length;
|
|
1178
|
-
return arc;
|
|
1179
|
-
});
|
|
1180
|
-
return /* @__PURE__ */ jsxs("div", { className: "status-donut__chart", style: { width: size, height: size }, children: [
|
|
1181
|
-
/* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, role: "img", "aria-hidden": "true", children: /* @__PURE__ */ jsx("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: arcs }) }),
|
|
1182
|
-
/* @__PURE__ */ jsxs("div", { className: "status-donut__center", children: [
|
|
1183
|
-
/* @__PURE__ */ jsx("span", { className: "status-donut__total", children: total }),
|
|
1184
|
-
/* @__PURE__ */ jsx("span", { className: "status-donut__total-label", children: "Total" })
|
|
1185
|
-
] }),
|
|
1186
|
-
tooltip
|
|
1187
|
-
] });
|
|
1188
|
-
}
|
|
1189
|
-
function Legend({ segments, total }) {
|
|
1190
|
-
return /* @__PURE__ */ jsx("ul", { className: "status-donut__legend", children: segments.map((seg) => /* @__PURE__ */ jsxs("li", { className: "status-donut__legend-row", children: [
|
|
1191
|
-
/* @__PURE__ */ jsx("span", { className: "status-donut__dot", style: { background: colorForStatus(seg.label) } }),
|
|
1192
|
-
/* @__PURE__ */ jsx("span", { className: "status-donut__legend-label", children: seg.label }),
|
|
1193
|
-
/* @__PURE__ */ jsx("span", { className: "status-donut__legend-value", children: seg.value }),
|
|
1194
|
-
/* @__PURE__ */ jsxs("span", { className: "status-donut__legend-pct", children: [
|
|
1195
|
-
pct(seg.value, total),
|
|
1196
|
-
"%"
|
|
1197
|
-
] })
|
|
1198
|
-
] }, seg.label)) });
|
|
1199
|
-
}
|
|
1200
|
-
function StatusDonut({ donut, provenance }) {
|
|
1201
|
-
const headline = useMemo(() => buildHeadline$2(donut), [donut]);
|
|
1202
|
-
const total = resolveTotal(donut);
|
|
1203
|
-
return /* @__PURE__ */ jsxs("section", { className: "status-donut", children: [
|
|
1204
|
-
headline && /* @__PURE__ */ jsx("p", { className: "status-donut__headline", children: headline }),
|
|
1205
|
-
/* @__PURE__ */ jsxs("div", { className: "status-donut__body", children: [
|
|
1206
|
-
/* @__PURE__ */ jsx("h3", { className: "status-donut__label", children: donut.label }),
|
|
1207
|
-
/* @__PURE__ */ jsxs("div", { className: "status-donut__content", children: [
|
|
1208
|
-
/* @__PURE__ */ jsx(Donut, { segments: donut.segments, total }),
|
|
1209
|
-
/* @__PURE__ */ jsx(Legend, { segments: donut.segments, total })
|
|
1210
|
-
] })
|
|
1211
|
-
] }),
|
|
1212
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance })
|
|
1213
|
-
] });
|
|
1214
|
-
}
|
|
1215
|
-
function StatusDonutCard({ payload = [] }) {
|
|
1216
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
1217
|
-
const donut = blocks.find((b) => b.type === "status_donut");
|
|
1218
|
-
const provenance = blocks.find((b) => b.type === "provenance");
|
|
1219
|
-
return /* @__PURE__ */ jsx("div", { className: "status-donut-card", children: (donut == null ? void 0 : donut.type) === "status_donut" && /* @__PURE__ */ jsx(
|
|
1220
|
-
StatusDonut,
|
|
1221
|
-
{
|
|
1222
|
-
donut: donut.props,
|
|
1223
|
-
provenance: (provenance == null ? void 0 : provenance.type) === "provenance" ? provenance.props : void 0
|
|
1224
|
-
}
|
|
1225
|
-
) });
|
|
1226
|
-
}
|
|
1227
|
-
const NUMBER_WORDS = [
|
|
1228
|
-
"zero",
|
|
1229
|
-
"one",
|
|
1230
|
-
"two",
|
|
1231
|
-
"three",
|
|
1232
|
-
"four",
|
|
1233
|
-
"five",
|
|
1234
|
-
"six",
|
|
1235
|
-
"seven",
|
|
1236
|
-
"eight",
|
|
1237
|
-
"nine",
|
|
1238
|
-
"ten",
|
|
1239
|
-
"eleven",
|
|
1240
|
-
"twelve",
|
|
1241
|
-
"thirteen",
|
|
1242
|
-
"fourteen",
|
|
1243
|
-
"fifteen",
|
|
1244
|
-
"sixteen",
|
|
1245
|
-
"seventeen",
|
|
1246
|
-
"eighteen",
|
|
1247
|
-
"nineteen",
|
|
1248
|
-
"twenty"
|
|
1249
|
-
];
|
|
1250
|
-
const inWords = (n) => NUMBER_WORDS[n] ?? `${n}`;
|
|
1251
|
-
const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
1252
|
-
function formatCell(value) {
|
|
1253
|
-
if (value === null || value === void 0 || value === "") return "—";
|
|
1254
|
-
if (typeof value === "number") {
|
|
1255
|
-
return value.toLocaleString("en-US", {
|
|
1256
|
-
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
1257
|
-
maximumFractionDigits: 2
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
return value;
|
|
1261
|
-
}
|
|
1262
|
-
function buildHeadline$1({ label, rows, total_row_count }) {
|
|
1263
|
-
const noun = label.toLowerCase();
|
|
1264
|
-
const total = total_row_count ?? rows.length;
|
|
1265
|
-
if (total === 0) return `No ${noun} found.`;
|
|
1266
|
-
if (total > rows.length) {
|
|
1267
|
-
const verb = rows.length === 1 ? "is" : "are";
|
|
1268
|
-
return `${capitalize(inWords(total))} ${noun} in total. Here ${verb} the first ${inWords(rows.length)}.`;
|
|
1269
|
-
}
|
|
1270
|
-
return `${capitalize(inWords(total))} ${noun}.`;
|
|
1271
|
-
}
|
|
1272
|
-
function StatusPill({ value }) {
|
|
1273
|
-
if (value === null || value === "") return /* @__PURE__ */ jsx("span", { className: "data-table__empty", children: "—" });
|
|
1274
|
-
const color = colorForStatus(String(value));
|
|
1275
|
-
return /* @__PURE__ */ jsx("span", { className: "data-table__pill", style: { color, background: `${color}1a` }, children: value });
|
|
1276
|
-
}
|
|
1277
|
-
function Cell({ column, value, first }) {
|
|
1278
|
-
const classes = [
|
|
1279
|
-
"data-table__cell",
|
|
1280
|
-
`data-table__cell--${column.align ?? "left"}`,
|
|
1281
|
-
typeof value === "number" ? "data-table__cell--number" : "",
|
|
1282
|
-
first ? "data-table__cell--key" : ""
|
|
1283
|
-
].filter(Boolean).join(" ");
|
|
1284
|
-
return /* @__PURE__ */ jsx("td", { className: classes, children: column.role === "status" ? /* @__PURE__ */ jsx(StatusPill, { value }) : formatCell(value) });
|
|
1285
|
-
}
|
|
1286
|
-
function DataTable({ label, columns, rows, total_row_count }) {
|
|
1287
|
-
const truncated = total_row_count !== void 0 && total_row_count > rows.length;
|
|
1288
|
-
return /* @__PURE__ */ jsxs("div", { className: "data-table", children: [
|
|
1289
|
-
/* @__PURE__ */ jsx("h3", { className: "data-table__label", children: label }),
|
|
1290
|
-
/* @__PURE__ */ jsx("div", { className: "data-table__scroll", children: /* @__PURE__ */ jsxs("table", { className: "data-table__table", children: [
|
|
1291
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((c) => /* @__PURE__ */ jsx("th", { scope: "col", className: `data-table__head data-table__cell--${c.align ?? "left"}`, children: c.label }, c.key)) }) }),
|
|
1292
|
-
/* @__PURE__ */ jsx("tbody", { children: rows.map((row, r) => /* @__PURE__ */ jsx("tr", { className: "data-table__row", children: columns.map((c, i) => /* @__PURE__ */ jsx(Cell, { column: c, value: row[c.key] ?? null, first: i === 0 }, c.key)) }, r)) })
|
|
1293
|
-
] }) }),
|
|
1294
|
-
/* @__PURE__ */ jsxs("div", { className: "data-table__count", children: [
|
|
1295
|
-
"Showing ",
|
|
1296
|
-
rows.length,
|
|
1297
|
-
" of ",
|
|
1298
|
-
truncated ? total_row_count : rows.length
|
|
1299
|
-
] })
|
|
1300
|
-
] });
|
|
1301
|
-
}
|
|
1302
|
-
function TableCard({ payload = [] }) {
|
|
1303
|
-
var _a, _b;
|
|
1304
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
1305
|
-
const table = (_a = blocks.find((b) => b.type === "table")) == null ? void 0 : _a.props;
|
|
1306
|
-
const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
|
|
1307
|
-
const headline = useMemo(() => table ? buildHeadline$1(table) : null, [table]);
|
|
1308
|
-
return /* @__PURE__ */ jsx("div", { className: "table-card", children: /* @__PURE__ */ jsxs("section", { className: "table-card__panel", children: [
|
|
1309
|
-
headline && /* @__PURE__ */ jsx("p", { className: "table-card__headline", children: headline }),
|
|
1310
|
-
table && /* @__PURE__ */ jsx("div", { className: "table-card__section", children: /* @__PURE__ */ jsx(DataTable, { ...table }) }),
|
|
1311
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance })
|
|
1312
|
-
] }) });
|
|
1313
|
-
}
|
|
1314
|
-
function formatField(value) {
|
|
1315
|
-
if (value === null || value === void 0 || value === "") return "—";
|
|
1316
|
-
if (typeof value === "number") {
|
|
1317
|
-
return value.toLocaleString("en-US", {
|
|
1318
|
-
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
1319
|
-
maximumFractionDigits: 2
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
return value;
|
|
1323
|
-
}
|
|
1324
|
-
function recordName(fields) {
|
|
1325
|
-
var _a;
|
|
1326
|
-
const named = fields.find((f) => /\bname\b/i.test(f.label) && f.value !== null && f.value !== "");
|
|
1327
|
-
const value = (_a = named ?? fields[0]) == null ? void 0 : _a.value;
|
|
1328
|
-
return value === null || value === void 0 || value === "" ? null : String(value);
|
|
1329
|
-
}
|
|
1330
|
-
function buildHeadline({ label, fields }) {
|
|
1331
|
-
const name = recordName(fields);
|
|
1332
|
-
return `Here's what we have on file for ${name ?? `this ${label.toLowerCase()}`}.`;
|
|
1333
|
-
}
|
|
1334
|
-
function RecordList({ label, fields }) {
|
|
1335
|
-
return /* @__PURE__ */ jsxs("div", { className: "record-list", children: [
|
|
1336
|
-
/* @__PURE__ */ jsx("h3", { className: "record-list__label", children: label }),
|
|
1337
|
-
/* @__PURE__ */ jsx("dl", { className: "record-list__fields", children: fields.map((f, i) => /* @__PURE__ */ jsxs("div", { className: "record-list__row", children: [
|
|
1338
|
-
/* @__PURE__ */ jsx("dt", { className: "record-list__key", children: f.label }),
|
|
1339
|
-
/* @__PURE__ */ jsx("dd", { className: `record-list__value${f.value === null || f.value === "" ? " is-empty" : ""}`, children: formatField(f.value) })
|
|
1340
|
-
] }, `${f.label}-${i}`)) })
|
|
1341
|
-
] });
|
|
1342
|
-
}
|
|
1343
|
-
function RecordListCard({ payload = [] }) {
|
|
1344
|
-
var _a, _b;
|
|
1345
|
-
const blocks = payload.flatMap((item) => item.data);
|
|
1346
|
-
const record = (_a = blocks.find((b) => b.type === "record_list")) == null ? void 0 : _a.props;
|
|
1347
|
-
const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
|
|
1348
|
-
const headline = useMemo(() => record ? buildHeadline(record) : null, [record]);
|
|
1349
|
-
return /* @__PURE__ */ jsx("div", { className: "record-list-card", children: /* @__PURE__ */ jsxs("section", { className: "record-list-card__panel", children: [
|
|
1350
|
-
headline && /* @__PURE__ */ jsx("p", { className: "record-list-card__headline", children: headline }),
|
|
1351
|
-
record && /* @__PURE__ */ jsx("div", { className: "record-list-card__section", children: /* @__PURE__ */ jsx(RecordList, { ...record }) }),
|
|
1352
|
-
provenance && /* @__PURE__ */ jsx(CardFooter, { provenance })
|
|
1353
|
-
] }) });
|
|
1354
|
-
}
|
|
1355
|
-
const SEVERITY_LABEL = {
|
|
1356
|
-
info: "Note",
|
|
1357
|
-
warning: "Warning",
|
|
1358
|
-
critical: "Critical",
|
|
1359
|
-
positive: "Good news"
|
|
1360
|
-
};
|
|
1361
|
-
function Callout({ severity, text }) {
|
|
1362
|
-
const level = SEVERITY_LABEL[severity] ? severity : "info";
|
|
1363
|
-
return /* @__PURE__ */ jsxs("div", { className: `callout callout--${level}`, role: level === "critical" ? "alert" : "note", children: [
|
|
1364
|
-
/* @__PURE__ */ jsxs("span", { className: "callout__sr", children: [
|
|
1365
|
-
SEVERITY_LABEL[level],
|
|
1366
|
-
": "
|
|
1367
|
-
] }),
|
|
1368
|
-
text
|
|
1369
|
-
] });
|
|
1370
|
-
}
|
|
1371
|
-
function CalloutCard({
|
|
1372
|
-
payload = [],
|
|
1373
|
-
answer
|
|
1374
|
-
}) {
|
|
1375
|
-
const callouts = payload.flatMap((item) => item.data).filter((b) => b.type === "callout");
|
|
1376
|
-
return /* @__PURE__ */ jsx("div", { className: "callout-card", children: /* @__PURE__ */ jsxs("section", { className: "callout-card__panel", children: [
|
|
1377
|
-
answer && /* @__PURE__ */ jsx("p", { className: "callout-card__answer", children: answer }),
|
|
1378
|
-
callouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "callout-card__callouts", children: callouts.map((b) => /* @__PURE__ */ jsx(Callout, { ...b.props }, b.id)) })
|
|
1379
|
-
] }) });
|
|
1380
|
-
}
|
|
1381
|
-
const CARDS = {
|
|
1382
|
-
metric: MetricCard,
|
|
1383
|
-
metric_row: MetricRowCard,
|
|
1384
|
-
comparison: ComparisonCard,
|
|
1385
|
-
bar_series: BarSeriesCard,
|
|
1386
|
-
ranked_bars: RankedBarsCard,
|
|
1387
|
-
status_donut: StatusDonutCard,
|
|
1388
|
-
table: TableCard,
|
|
1389
|
-
record_list: RecordListCard,
|
|
1390
|
-
callout: CalloutCard
|
|
1391
|
-
};
|
|
1392
|
-
const HOSTS_BAR_SERIES = /* @__PURE__ */ new Set(["metric", "metric_row"]);
|
|
1393
|
-
class CardBoundary extends Component {
|
|
1394
|
-
constructor() {
|
|
1395
|
-
super(...arguments);
|
|
1396
|
-
this.state = { failed: false };
|
|
1397
|
-
}
|
|
1398
|
-
static getDerivedStateFromError() {
|
|
1399
|
-
return { failed: true };
|
|
1400
|
-
}
|
|
1401
|
-
componentDidCatch(error) {
|
|
1402
|
-
console.error(`GenUI card "${this.props.type}" failed to render`, error);
|
|
1403
|
-
}
|
|
1404
|
-
render() {
|
|
1405
|
-
return this.state.failed ? null : this.props.children;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
function BlockRenderer({ blocks }) {
|
|
1409
|
-
if (!(blocks == null ? void 0 : blocks.length)) return null;
|
|
1410
|
-
const provenance = blocks.find((b) => b.type === "provenance");
|
|
1411
|
-
const hasHost = blocks.some((b) => HOSTS_BAR_SERIES.has(b.type));
|
|
1412
|
-
const hostedSeries = hasHost ? blocks.filter((b) => b.type === "bar_series") : [];
|
|
1413
|
-
const primary = blocks.filter(
|
|
1414
|
-
(b) => CARDS[b.type] && !hostedSeries.includes(b)
|
|
1415
|
-
);
|
|
1416
|
-
const lastData = [...primary].reverse().find((b) => b.type !== "callout");
|
|
1417
|
-
return /* @__PURE__ */ jsx("div", { className: "chatBot--blocks", children: primary.map((block, i) => {
|
|
1418
|
-
const Card = CARDS[block.type];
|
|
1419
|
-
const data = [block];
|
|
1420
|
-
if (HOSTS_BAR_SERIES.has(block.type)) data.push(...hostedSeries);
|
|
1421
|
-
if (provenance && block === lastData) data.push(provenance);
|
|
1422
|
-
return /* @__PURE__ */ jsx(CardBoundary, { type: block.type, children: /* @__PURE__ */ jsx(Card, { payload: [{ type: "blocks", data }] }) }, block.id || `${block.type}-${i}`);
|
|
1423
|
-
}) });
|
|
1424
|
-
}
|
|
1425
|
-
const ChatBotMessages = ({ messages, isTyping, bodyRef, footer }) => /* @__PURE__ */ jsxs("div", { ref: bodyRef, className: "chatBot--body", children: [
|
|
1426
|
-
messages.map((msg) => /* @__PURE__ */ jsxs("div", { className: `chatBot--msg-row chatBot--msg-row--${msg.role}`, children: [
|
|
1427
|
-
msg.role === "user" && /* @__PURE__ */ jsx("div", { className: "chatBot--user-bubble", children: msg.text }),
|
|
1428
|
-
msg.role === "ai" && /* @__PURE__ */ jsxs("div", { className: "chatBot--ai-msg", children: [
|
|
1429
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--ai-sender", children: [
|
|
1430
|
-
/* @__PURE__ */ jsx(SparkMark, { size: 22 }),
|
|
1431
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ai-name", children: "NovaForce" }),
|
|
1432
|
-
(msg.durationMs !== void 0 || msg.time) && /* @__PURE__ */ jsxs("span", { className: "chatBot--ai-time", children: [
|
|
1433
|
-
"· ",
|
|
1434
|
-
msg.durationMs !== void 0 ? formatDuration(msg.durationMs) : msg.time
|
|
1435
|
-
] }),
|
|
1436
|
-
msg.inputTokens !== void 0 && /* @__PURE__ */ jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.inputTokens.toLocaleString()} input tokens`, children: [
|
|
1437
|
-
"↓ ",
|
|
1438
|
-
/* @__PURE__ */ jsx("b", { children: formatTokens(msg.inputTokens) }),
|
|
1439
|
-
" in"
|
|
1440
|
-
] }),
|
|
1441
|
-
msg.outputTokens !== void 0 && /* @__PURE__ */ jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.outputTokens.toLocaleString()} output tokens`, children: [
|
|
1442
|
-
"↑ ",
|
|
1443
|
-
/* @__PURE__ */ jsx("b", { children: formatTokens(msg.outputTokens) }),
|
|
1444
|
-
" out"
|
|
1445
|
-
] }),
|
|
1446
|
-
!!msg.tokens && /* @__PURE__ */ jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.tokens.toLocaleString()} total tokens`, children: [
|
|
1447
|
-
/* @__PURE__ */ jsx("b", { children: formatTokens(msg.tokens) }),
|
|
1448
|
-
" tokens"
|
|
1449
|
-
] })
|
|
1450
|
-
] }),
|
|
1451
|
-
/* @__PURE__ */ jsx(
|
|
1452
|
-
"div",
|
|
1453
|
-
{
|
|
1454
|
-
className: "chatBot--ai-text",
|
|
1455
|
-
dangerouslySetInnerHTML: { __html: marked.parse(msg.text) }
|
|
1456
|
-
}
|
|
1457
|
-
),
|
|
1458
|
-
msg.blocks && /* @__PURE__ */ jsx(BlockRenderer, { blocks: msg.blocks })
|
|
1459
|
-
] })
|
|
1460
|
-
] }, msg.id)),
|
|
1461
|
-
isTyping && /* @__PURE__ */ jsxs("div", { className: "chatBot--ai-msg", children: [
|
|
1462
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--ai-sender", children: [
|
|
1463
|
-
/* @__PURE__ */ jsx(SparkMark, { size: 22 }),
|
|
1464
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ai-name", children: "NovaForce" })
|
|
1465
|
-
] }),
|
|
1466
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--typing-dots", children: [
|
|
1467
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
1468
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
1469
|
-
/* @__PURE__ */ jsx("span", {})
|
|
1470
|
-
] })
|
|
1471
|
-
] }),
|
|
1472
|
-
footer
|
|
1473
|
-
] });
|
|
1474
|
-
const FORM_TYPES = ["sales_invoice", "purchase_invoice"];
|
|
1475
|
-
const ChatBotInput = ({
|
|
1476
|
-
inputValue,
|
|
1477
|
-
isTyping,
|
|
1478
|
-
mode,
|
|
1479
|
-
formType,
|
|
1480
|
-
showSlashMenu,
|
|
1481
|
-
filteredCommands,
|
|
1482
|
-
slashIndex,
|
|
1483
|
-
textareaRef,
|
|
1484
|
-
onChange,
|
|
1485
|
-
onKeyDown,
|
|
1486
|
-
onSend,
|
|
1487
|
-
onSlashHover,
|
|
1488
|
-
onSlashSelect,
|
|
1489
|
-
onModeChange,
|
|
1490
|
-
onFormTypeChange,
|
|
1491
|
-
activeDocument,
|
|
1492
|
-
activeDocuments,
|
|
1493
|
-
onDocDelete,
|
|
1494
|
-
onDocUpload,
|
|
1495
|
-
onMultiDocDelete
|
|
1496
|
-
}) => {
|
|
1497
|
-
const canSend = mode === "agent" ? formType !== null && !isTyping : mode === "doc_qa" ? activeDocuments && activeDocuments.length > 0 ? activeDocuments.every((d) => d.status === "ready") && !!inputValue.trim() && !isTyping : (activeDocument == null ? void 0 : activeDocument.status) === "ready" && !!inputValue.trim() && !isTyping : !!inputValue.trim() && !isTyping;
|
|
1498
|
-
return /* @__PURE__ */ jsxs("div", { className: "chatBot--input-area", children: [
|
|
1499
|
-
showSlashMenu && filteredCommands.length > 0 && /* @__PURE__ */ jsxs("div", { className: "chatBot--slash-menu", children: [
|
|
1500
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--slash-menu-label", children: "Commands" }),
|
|
1501
|
-
filteredCommands.map((cmd, idx) => /* @__PURE__ */ jsxs(
|
|
1502
|
-
"button",
|
|
1503
|
-
{
|
|
1504
|
-
className: `chatBot--slash-item${idx === slashIndex ? " chatBot--slash-item--active" : ""}`,
|
|
1505
|
-
onMouseEnter: () => onSlashHover(idx),
|
|
1506
|
-
onClick: () => onSlashSelect(cmd.id),
|
|
1507
|
-
children: [
|
|
1508
|
-
/* @__PURE__ */ jsx(SparkMark, { size: 28 }),
|
|
1509
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1510
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--slash-item-label", children: cmd.label }),
|
|
1511
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--slash-item-desc", children: cmd.description })
|
|
1512
|
-
] })
|
|
1513
|
-
]
|
|
1514
|
-
},
|
|
1515
|
-
cmd.id
|
|
1516
|
-
))
|
|
1517
|
-
] }),
|
|
1518
|
-
mode === "agent" && /* @__PURE__ */ jsxs("div", { className: "chatBot--form-type-bar", children: [
|
|
1519
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--form-type-label", children: "Form type" }),
|
|
1520
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--form-type-options", children: FORM_TYPES.map((ft) => /* @__PURE__ */ jsx(
|
|
1521
|
-
"button",
|
|
1522
|
-
{
|
|
1523
|
-
className: `chatBot--form-type-btn${formType === ft ? " chatBot--form-type-btn--active" : ""}`,
|
|
1524
|
-
onClick: () => onFormTypeChange(ft),
|
|
1525
|
-
children: FORM_TYPE_LABELS[ft]
|
|
1526
|
-
},
|
|
1527
|
-
ft
|
|
1528
|
-
)) })
|
|
1529
|
-
] }),
|
|
1530
|
-
(mode === "doc_qa" || mode === "smart") && activeDocument && (!activeDocuments || activeDocuments.length === 0) && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-chip-bar", children: /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-chip", children: [
|
|
1531
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-dot", style: {
|
|
1532
|
-
background: activeDocument.status === "ready" ? "#2EB273" : activeDocument.status === "failed" ? "#C62828" : "#2EB273"
|
|
1533
|
-
} }),
|
|
1534
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-name", children: activeDocument.filename }),
|
|
1535
|
-
activeDocument.status === "ready" && /* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-badge", children: "Ready" })
|
|
1536
|
-
] }) }),
|
|
1537
|
-
(mode === "doc_qa" || mode === "smart") && activeDocuments && activeDocuments.length > 0 && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-chip-bar", children: activeDocuments.map((doc) => /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-chip", children: [
|
|
1538
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-dot", style: {
|
|
1539
|
-
background: doc.status === "ready" ? "#2EB273" : doc.status === "failed" ? "#C62828" : "#2EB273"
|
|
1540
|
-
} }),
|
|
1541
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-name", title: doc.filename, children: doc.filename }),
|
|
1542
|
-
doc.status === "ready" && /* @__PURE__ */ jsx("span", { className: "chatBot--doc-chip-badge", children: "Ready" })
|
|
1543
|
-
] }, doc.doc_id)) }),
|
|
1544
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--input-wrap", children: [
|
|
1545
|
-
/* @__PURE__ */ jsx(
|
|
1546
|
-
"textarea",
|
|
1547
|
-
{
|
|
1548
|
-
ref: textareaRef,
|
|
1549
|
-
className: "chatBot--textarea",
|
|
1550
|
-
rows: 2,
|
|
1551
|
-
placeholder: (mode === "doc_qa" || mode === "smart") && (activeDocument || activeDocuments && activeDocuments.length > 0) ? activeDocuments && activeDocuments.length > 0 ? activeDocuments.every((d) => d.status === "ready") ? "Ask a question about the document(s)…" : "Documents are processing…" : (activeDocument == null ? void 0 : activeDocument.status) === "ready" ? "Ask a question about this document…" : activeDocument ? "Document is still processing…" : "Upload PDF(s) above, then ask questions…" : mode === "agent" ? "Add any context for the agent…" : "Ask anything, or describe an action…",
|
|
1552
|
-
value: inputValue,
|
|
1553
|
-
onChange,
|
|
1554
|
-
onKeyDown,
|
|
1555
|
-
disabled: isTyping || (mode === "doc_qa" || mode === "smart") && !!activeDocument && activeDocument.status !== "ready" || (mode === "doc_qa" || mode === "smart") && !!activeDocuments && activeDocuments.length > 0 && activeDocuments.some((d) => d.status !== "ready")
|
|
1556
|
-
}
|
|
1557
|
-
),
|
|
1558
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--ctrls", children: [
|
|
1559
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--ctrls-grow" }),
|
|
1560
|
-
mode === "smart" && !activeDocument && (!activeDocuments || activeDocuments.length === 0) && /* @__PURE__ */ jsx(
|
|
1561
|
-
"button",
|
|
1562
|
-
{
|
|
1563
|
-
className: "chatBot--attach-btn",
|
|
1564
|
-
onClick: onDocUpload,
|
|
1565
|
-
disabled: isTyping,
|
|
1566
|
-
title: "Attach Document",
|
|
1567
|
-
children: /* @__PURE__ */ jsx(UploadFileRounded, { style: { fontSize: 15 } })
|
|
1568
|
-
}
|
|
1569
|
-
),
|
|
1570
|
-
/* @__PURE__ */ jsx(
|
|
1571
|
-
"button",
|
|
1572
|
-
{
|
|
1573
|
-
className: `chatBot--send-btn${canSend ? " active" : ""}`,
|
|
1574
|
-
onClick: onSend,
|
|
1575
|
-
disabled: !canSend,
|
|
1576
|
-
title: "Send",
|
|
1577
|
-
children: /* @__PURE__ */ jsx(ArrowUpwardRounded, { style: { fontSize: 15 } })
|
|
1578
|
-
}
|
|
1579
|
-
)
|
|
1580
|
-
] })
|
|
1581
|
-
] }),
|
|
1582
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--hints", style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "6px", overflow: "hidden" }, children: [
|
|
1583
|
-
/* @__PURE__ */ jsx("div", { style: { color: "#9ca3af", fontSize: "10px", whiteSpace: "nowrap" }, children: mode === "doc_qa" ? "Document Q&A mode" : "Replies use ERP data only" }),
|
|
1584
|
-
/* @__PURE__ */ jsx("div", { style: { width: "1px", height: "10px", background: "#d1d5db", flexShrink: 0 } }),
|
|
1585
|
-
/* @__PURE__ */ jsx("div", { style: { marginTop: "-16px", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: /* @__PURE__ */ jsx(AIDisclaimer, { showIcon: false, justifyContent: "flex-start" }) })
|
|
1586
|
-
] })
|
|
1587
|
-
] });
|
|
1588
|
-
};
|
|
1589
|
-
const ChatBotLauncher = ({ onOpen }) => /* @__PURE__ */ jsxs("button", { className: "chatBot--launcher", onClick: onOpen, children: [
|
|
1590
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--launcher-icon", children: /* @__PURE__ */ jsxs(
|
|
1591
|
-
"svg",
|
|
1592
|
-
{
|
|
1593
|
-
viewBox: "0 0 24 24",
|
|
1594
|
-
stroke: "currentColor",
|
|
1595
|
-
fill: "none",
|
|
1596
|
-
strokeWidth: "2",
|
|
1597
|
-
style: { width: 22, height: 22, flexShrink: 0 },
|
|
1598
|
-
children: [
|
|
1599
|
-
/* @__PURE__ */ jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
|
|
1600
|
-
/* @__PURE__ */ jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
|
|
1601
|
-
]
|
|
1602
|
-
}
|
|
1603
|
-
) }),
|
|
1604
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--launcher-label", children: "Ask NovaForce" })
|
|
1605
|
-
] });
|
|
1606
|
-
const ItemEntryTable = ({ fieldUpdates, resolvedLabels }) => {
|
|
1607
|
-
const prefix = fieldUpdates["sales_item_entries.items.name"] ? "sales_item_entries" : fieldUpdates["purchase_item_entries.items.name"] ? "purchase_item_entries" : null;
|
|
1608
|
-
if (!prefix) return null;
|
|
1609
|
-
const names = fieldUpdates[`${prefix}.items.name`];
|
|
1610
|
-
const quantities = fieldUpdates[`${prefix}.quantity`];
|
|
1611
|
-
const rates = fieldUpdates[`${prefix}.rate`];
|
|
1612
|
-
const discountAmounts = fieldUpdates[`${prefix}.discount_amount`];
|
|
1613
|
-
const taxAmounts = fieldUpdates[`${prefix}.tax_amount`];
|
|
1614
|
-
const totalAmounts = fieldUpdates[`${prefix}.total_amount`];
|
|
1615
|
-
if (!Array.isArray(names) || names.length === 0) return null;
|
|
1616
|
-
const rows = names.map((_, i) => {
|
|
1617
|
-
const itemId = names[i];
|
|
1618
|
-
const qty = parseFloat(quantities == null ? void 0 : quantities[i]) || 0;
|
|
1619
|
-
const rate = parseFloat(rates == null ? void 0 : rates[i]) || 0;
|
|
1620
|
-
const gross = qty * rate;
|
|
1621
|
-
const discount = parseFloat(discountAmounts == null ? void 0 : discountAmounts[i]) || 0;
|
|
1622
|
-
const tax = parseFloat(taxAmounts == null ? void 0 : taxAmounts[i]) || 0;
|
|
1623
|
-
const total = parseFloat(totalAmounts == null ? void 0 : totalAmounts[i]) || 0;
|
|
1624
|
-
const resolvedKey = `${prefix}.items.name:${itemId}`;
|
|
1625
|
-
const itemName = resolvedLabels[resolvedKey] || `Item #${itemId}`;
|
|
1626
|
-
return { itemName, qty, rate, gross, discount, tax, total };
|
|
1627
|
-
});
|
|
1628
|
-
const subtotal = rows.reduce((sum, r) => sum + r.gross, 0);
|
|
1629
|
-
const totalDiscount = rows.reduce((sum, r) => sum + r.discount, 0);
|
|
1630
|
-
rows.reduce((sum, r) => sum + r.tax, 0);
|
|
1631
|
-
const totalDue = rows.reduce((sum, r) => sum + r.total, 0);
|
|
1632
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1633
|
-
/* @__PURE__ */ jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-li", style: { gridTemplateColumns: "1fr repeat(6, 85px)" }, children: [
|
|
1634
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h", children: "Item" }),
|
|
1635
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Qty" }),
|
|
1636
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Rate" }),
|
|
1637
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Gross" }),
|
|
1638
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Discount" }),
|
|
1639
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Tax" }),
|
|
1640
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Total" }),
|
|
1641
|
-
rows.map((r, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
1642
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c", children: r.itemName }),
|
|
1643
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: r.qty }),
|
|
1644
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.rate, defaultCurrencyFormat()) }),
|
|
1645
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.gross, defaultCurrencyFormat()) }),
|
|
1646
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.discount, defaultCurrencyFormat()) }),
|
|
1647
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.tax, defaultCurrencyFormat()) }),
|
|
1648
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.total, defaultCurrencyFormat()) })
|
|
1649
|
-
] }, i))
|
|
1650
|
-
] }) }),
|
|
1651
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot", children: [
|
|
1652
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1653
|
-
/* @__PURE__ */ jsx("span", { children: "Subtotal" }),
|
|
1654
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(subtotal, defaultCurrencyFormat()) })
|
|
1655
|
-
] }),
|
|
1656
|
-
totalDiscount > 0 && /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1657
|
-
/* @__PURE__ */ jsx("span", { children: "Discount" }),
|
|
1658
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--preview-tot-row-val", children: [
|
|
1659
|
-
"-",
|
|
1660
|
-
formatAmount(totalDiscount, defaultCurrencyFormat())
|
|
1661
|
-
] })
|
|
1662
|
-
] }),
|
|
1663
|
-
rows.filter((r) => r.tax).map((r, i) => /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1664
|
-
/* @__PURE__ */ jsx("span", { children: "Tax" }),
|
|
1665
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(r.tax, defaultCurrencyFormat()) })
|
|
1666
|
-
] }, i)),
|
|
1667
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row total", children: [
|
|
1668
|
-
/* @__PURE__ */ jsx("span", { children: "Total due (items)" }),
|
|
1669
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(totalDue, defaultCurrencyFormat()) })
|
|
1670
|
-
] })
|
|
1671
|
-
] })
|
|
1672
|
-
] });
|
|
1673
|
-
};
|
|
1674
|
-
const ExpenseEntryTable = ({ fieldUpdates, resolvedLabels }) => {
|
|
1675
|
-
const accountIds = fieldUpdates["purchase_expense_entries.accounts.account_name"];
|
|
1676
|
-
const rates = fieldUpdates["purchase_expense_entries.rate"];
|
|
1677
|
-
const discountAmounts = fieldUpdates["purchase_expense_entries.discount_amount"];
|
|
1678
|
-
const taxAmounts = fieldUpdates["purchase_expense_entries.tax_amount"];
|
|
1679
|
-
const totalAmounts = fieldUpdates["purchase_expense_entries.total_amount"];
|
|
1680
|
-
if (!Array.isArray(accountIds) || accountIds.length === 0) return null;
|
|
1681
|
-
const rows = accountIds.map((_, i) => {
|
|
1682
|
-
const accountId = accountIds[i];
|
|
1683
|
-
const rate = parseFloat(rates == null ? void 0 : rates[i]) || 0;
|
|
1684
|
-
const gross = rate;
|
|
1685
|
-
const discount = parseFloat(discountAmounts == null ? void 0 : discountAmounts[i]) || 0;
|
|
1686
|
-
const tax = parseFloat(taxAmounts == null ? void 0 : taxAmounts[i]) || 0;
|
|
1687
|
-
const total = parseFloat(totalAmounts == null ? void 0 : totalAmounts[i]) || 0;
|
|
1688
|
-
const resolvedKey = `purchase_expense_entries.accounts.account_name:${accountId}`;
|
|
1689
|
-
const accountName = resolvedLabels[resolvedKey] || `Account #${accountId}`;
|
|
1690
|
-
return { accountName, rate, gross, discount, tax, total };
|
|
1691
|
-
});
|
|
1692
|
-
const subtotal = rows.reduce((sum, r) => sum + r.gross, 0);
|
|
1693
|
-
const totalDiscount = rows.reduce((sum, r) => sum + r.discount, 0);
|
|
1694
|
-
const totalTax = rows.reduce((sum, r) => sum + r.tax, 0);
|
|
1695
|
-
const totalDue = rows.reduce((sum, r) => sum + r.total, 0);
|
|
1696
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1697
|
-
/* @__PURE__ */ jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-li", style: { gridTemplateColumns: "1fr repeat(5, 85px)" }, children: [
|
|
1698
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h", children: "Account" }),
|
|
1699
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Rate" }),
|
|
1700
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Gross" }),
|
|
1701
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Discount" }),
|
|
1702
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Tax" }),
|
|
1703
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-h right", children: "Total" }),
|
|
1704
|
-
rows.map((r, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
1705
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c", children: r.accountName }),
|
|
1706
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.rate, defaultCurrencyFormat()) }),
|
|
1707
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.gross, defaultCurrencyFormat()) }),
|
|
1708
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.discount, defaultCurrencyFormat()) }),
|
|
1709
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.tax, defaultCurrencyFormat()) }),
|
|
1710
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--preview-li-c right", children: formatAmount(r.total, defaultCurrencyFormat()) })
|
|
1711
|
-
] }, i))
|
|
1712
|
-
] }) }),
|
|
1713
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot", children: [
|
|
1714
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1715
|
-
/* @__PURE__ */ jsx("span", { children: "Subtotal" }),
|
|
1716
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(subtotal, defaultCurrencyFormat()) })
|
|
1717
|
-
] }),
|
|
1718
|
-
totalDiscount > 0 && /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1719
|
-
/* @__PURE__ */ jsx("span", { children: "Discount" }),
|
|
1720
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--preview-tot-row-val", children: [
|
|
1721
|
-
"-",
|
|
1722
|
-
formatAmount(totalDiscount, defaultCurrencyFormat())
|
|
1723
|
-
] })
|
|
1724
|
-
] }),
|
|
1725
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row", children: [
|
|
1726
|
-
/* @__PURE__ */ jsx("span", { children: "Total Tax" }),
|
|
1727
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(totalTax, defaultCurrencyFormat()) })
|
|
1728
|
-
] }),
|
|
1729
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row total", children: [
|
|
1730
|
-
/* @__PURE__ */ jsx("span", { children: "Total due (expenses)" }),
|
|
1731
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(totalDue, defaultCurrencyFormat()) })
|
|
1732
|
-
] })
|
|
1733
|
-
] })
|
|
1734
|
-
] });
|
|
1735
|
-
};
|
|
1736
|
-
const sumField = (updates, key) => (updates[key] || []).reduce((s, v) => s + (parseFloat(v) || 0), 0);
|
|
1737
|
-
const FIELD_LABELS = {
|
|
1738
|
-
customer_id: "Customer",
|
|
1739
|
-
vendor_id: "Vendor",
|
|
1740
|
-
date: "Date",
|
|
1741
|
-
bill_date: "Bill Date",
|
|
1742
|
-
invoice_date: "Invoice Date",
|
|
1743
|
-
due_date: "Due Date",
|
|
1744
|
-
posting_time: "Posting Time",
|
|
1745
|
-
payment_term_id: "Payment Term",
|
|
1746
|
-
company_id: "Company",
|
|
1747
|
-
exchange_rate: "Exchange Rate",
|
|
1748
|
-
account_payable_id: "Account Payable",
|
|
1749
|
-
account_receivable_id: "Account Receivable",
|
|
1750
|
-
currency_id: "Currency",
|
|
1751
|
-
supplier_currency_id: "Supplier Currency",
|
|
1752
|
-
supplier_invoice_number: "Supplier Invoice #",
|
|
1753
|
-
supplier_invoice_date: "Supplier Invoice Date",
|
|
1754
|
-
transaction_type: "Transaction Type",
|
|
1755
|
-
narration: "Narration",
|
|
1756
|
-
department: "Department",
|
|
1757
|
-
department_id: "Department",
|
|
1758
|
-
location: "Location",
|
|
1759
|
-
incoterm_id: "Incoterm",
|
|
1760
|
-
region_id: "Region",
|
|
1761
|
-
series_number: "Series Number",
|
|
1762
|
-
attachment_url: "Attachment",
|
|
1763
|
-
additional_discount_on: "Discount On",
|
|
1764
|
-
additional_discount_percentage: "Discount Percentage",
|
|
1765
|
-
additional_discount_amount: "Discount Amount",
|
|
1766
|
-
round_off: "Round Off",
|
|
1767
|
-
round_off_option: "Round Off Option",
|
|
1768
|
-
is_cash: "Cash Transaction",
|
|
1769
|
-
discount_amount: "Discount Amount",
|
|
1770
|
-
total_invoice_amount: "Total Amount",
|
|
1771
|
-
supplier_address: "Supplier Address",
|
|
1772
|
-
contact_person: "Contact Person",
|
|
1773
|
-
shipping_address: "Shipping Address",
|
|
1774
|
-
billing_address: "Billing Address",
|
|
1775
|
-
place_of_supply: "Place of Supply"
|
|
1776
|
-
};
|
|
1777
|
-
const InvoicePreview = ({ fieldUpdates, resolvedLabels, formStatus, useActionGating, pendingFormAction, onSave, onSubmit, onDiscard }) => {
|
|
1778
|
-
const itemTotalKey = fieldUpdates["purchase_item_entries.total_amount"] ? "purchase_item_entries.total_amount" : fieldUpdates["sales_item_entries.total_amount"] ? "sales_item_entries.total_amount" : null;
|
|
1779
|
-
const itemTotal = itemTotalKey ? sumField(fieldUpdates, itemTotalKey) : 0;
|
|
1780
|
-
const expenseTotal = sumField(fieldUpdates, "purchase_expense_entries.total_amount");
|
|
1781
|
-
const grandTotal = itemTotal + expenseTotal;
|
|
1782
|
-
const displayKey = (key) => {
|
|
1783
|
-
const shortKey = key.startsWith("invoice_addresses.") ? key.slice("invoice_addresses.".length) : key;
|
|
1784
|
-
return FIELD_LABELS[shortKey] || FIELD_LABELS[key] || key;
|
|
1785
|
-
};
|
|
1786
|
-
const entries = Object.entries(fieldUpdates).filter(([key]) => {
|
|
1787
|
-
if (key.startsWith("sales_item_entries.") || key.startsWith("purchase_item_entries.") || key.startsWith("purchase_expense_entries.")) return false;
|
|
1788
|
-
return true;
|
|
1789
|
-
});
|
|
1790
|
-
if (Object.keys(fieldUpdates).length === 0) return null;
|
|
1791
|
-
return /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-card", children: [
|
|
1792
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-head", children: [
|
|
1793
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-head-ic", children: /* @__PURE__ */ jsx(IcInvoice, { size: 14 }) }),
|
|
1794
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-head-ttl", children: [
|
|
1795
|
-
"Draft Invoice",
|
|
1796
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--preview-head-sub", children: [
|
|
1797
|
-
"AI-prepared · ",
|
|
1798
|
-
entries.length,
|
|
1799
|
-
" fields locked"
|
|
1800
|
-
] })
|
|
1801
|
-
] }),
|
|
1802
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-badge", children: "DRAFT" })
|
|
1803
|
-
] }),
|
|
1804
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-body", children: [
|
|
1805
|
-
entries.map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-row", children: [
|
|
1806
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-row-key", children: displayKey(key) }),
|
|
1807
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-row-val", children: resolvedLabels[key] || String(value ?? "") })
|
|
1808
|
-
] }, key)),
|
|
1809
|
-
/* @__PURE__ */ jsx(ItemEntryTable, { fieldUpdates, resolvedLabels }),
|
|
1810
|
-
/* @__PURE__ */ jsx(ExpenseEntryTable, { fieldUpdates, resolvedLabels }),
|
|
1811
|
-
(itemTotal > 0 || expenseTotal > 0) && /* @__PURE__ */ jsxs("div", { className: "chatBot--preview-tot-row total", style: { marginTop: 8 }, children: [
|
|
1812
|
-
/* @__PURE__ */ jsx("span", { children: "Grand Total" }),
|
|
1813
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-tot-row-val", children: formatAmount(grandTotal, defaultCurrencyFormat()) })
|
|
1814
|
-
] })
|
|
1815
|
-
] }),
|
|
1816
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--preview-foot", children: [
|
|
1817
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--preview-foot-grow" }),
|
|
1818
|
-
useActionGating ? (
|
|
1819
|
-
// Smart mode: each button only appears when the AI's last action explicitly signalled
|
|
1820
|
-
// it — status is fill-completeness only and never gates these (Copilot Smart API contract).
|
|
1821
|
-
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1822
|
-
pendingFormAction === "discard_form" && onDiscard && /* @__PURE__ */ jsx(Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsx(Trash, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onDiscard, sx: { mr: 1 }, children: "Discard" }),
|
|
1823
|
-
pendingFormAction === "save_draft" && /* @__PURE__ */ jsx(Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsx(Save, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSave, sx: { mr: 1 }, children: "Save Draft" }),
|
|
1824
|
-
pendingFormAction === "submit_form" && onSubmit && /* @__PURE__ */ jsx(Button, { variant: "contained", startIcon: /* @__PURE__ */ jsx(Tick, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSubmit, children: "Submit" })
|
|
1825
|
-
] })
|
|
1826
|
-
) : formStatus === "ready_to_submit" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1827
|
-
onDiscard && /* @__PURE__ */ jsx(Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsx(Trash, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onDiscard, sx: { mr: 1 }, children: "Discard" }),
|
|
1828
|
-
/* @__PURE__ */ jsx(Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsx(Save, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSave, sx: { mr: 1 }, children: "Save Draft" }),
|
|
1829
|
-
onSubmit && /* @__PURE__ */ jsx(Button, { variant: "contained", startIcon: /* @__PURE__ */ jsx(Tick, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSubmit, children: "Submit" })
|
|
1830
|
-
] })
|
|
1831
|
-
] })
|
|
1832
|
-
] });
|
|
1833
|
-
};
|
|
1834
|
-
const ICON_BY_CATEGORY = {
|
|
1835
|
-
pdf: { Icon: PictureAsPdfRounded, color: "#C62828" },
|
|
1836
|
-
excel: { Icon: TableChartRounded, color: "#1E7E34" },
|
|
1837
|
-
doc: { Icon: DescriptionRounded, color: "#1B5FBD" },
|
|
1838
|
-
md: { Icon: ArticleRounded, color: "#5C5C5C" },
|
|
1839
|
-
image: { Icon: ImageRounded, color: "#8E24AA" }
|
|
1840
|
-
};
|
|
1841
|
-
const DocFileIcon = ({ filename, fontSize = 16 }) => {
|
|
1842
|
-
const category = getFileCategory(filename);
|
|
1843
|
-
const { Icon, color } = category ? ICON_BY_CATEGORY[category] : { Icon: InsertDriveFileRounded, color: "#9E9E9E" };
|
|
1844
|
-
return /* @__PURE__ */ jsx(Icon, { sx: { fontSize, color } });
|
|
1845
|
-
};
|
|
1846
|
-
const DocUpload = ({ onUploadComplete, onUploadError, uploadDocument: uploadDocument2, uploadDocuments: uploadDocuments2 }) => {
|
|
1847
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
1848
|
-
const [progress, setProgress] = useState(null);
|
|
1849
|
-
const [fileNames, setFileNames] = useState([]);
|
|
1850
|
-
const fileInputRef = useRef(null);
|
|
1851
|
-
const handleFiles = useCallback(async (files) => {
|
|
1852
|
-
if (files.length === 0) return;
|
|
1853
|
-
if (files.length > 10) {
|
|
1854
|
-
onUploadError("Maximum 10 files allowed per request.");
|
|
1855
|
-
return;
|
|
1856
|
-
}
|
|
1857
|
-
for (const file of files) {
|
|
1858
|
-
if (!getFileCategory(file.name)) {
|
|
1859
|
-
onUploadError("Unsupported file type. Accepted: PDF, Word, Excel, Markdown, image.");
|
|
1860
|
-
return;
|
|
1861
|
-
}
|
|
1862
|
-
if (file.size > 50 * 1024 * 1024) {
|
|
1863
|
-
onUploadError(`File too large (${file.name}). Maximum 50MB.`);
|
|
1864
|
-
return;
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
setFileNames(files.map((f) => f.name));
|
|
1868
|
-
setProgress(0);
|
|
1869
|
-
try {
|
|
1870
|
-
if (files.length === 1) {
|
|
1871
|
-
const doc = await uploadDocument2(files[0], (pct2) => setProgress(pct2));
|
|
1872
|
-
onUploadComplete([doc]);
|
|
1873
|
-
} else {
|
|
1874
|
-
const docs = await uploadDocuments2(files, (pct2) => setProgress(pct2));
|
|
1875
|
-
onUploadComplete(docs);
|
|
1876
|
-
}
|
|
1877
|
-
} catch (err) {
|
|
1878
|
-
onUploadError(err.message || "Upload failed");
|
|
1879
|
-
} finally {
|
|
1880
|
-
setProgress(null);
|
|
1881
|
-
setFileNames([]);
|
|
1882
|
-
}
|
|
1883
|
-
}, [uploadDocument2, uploadDocuments2, onUploadComplete, onUploadError]);
|
|
1884
|
-
const handleDrop = useCallback((e) => {
|
|
1885
|
-
e.preventDefault();
|
|
1886
|
-
setIsDragging(false);
|
|
1887
|
-
const files = Array.from(e.dataTransfer.files);
|
|
1888
|
-
if (files.length) handleFiles(files);
|
|
1889
|
-
}, [handleFiles]);
|
|
1890
|
-
const handleDragOver = useCallback((e) => {
|
|
1891
|
-
e.preventDefault();
|
|
1892
|
-
setIsDragging(true);
|
|
1893
|
-
}, []);
|
|
1894
|
-
const handleDragLeave = useCallback(() => setIsDragging(false), []);
|
|
1895
|
-
const handleClick = () => {
|
|
1896
|
-
var _a;
|
|
1897
|
-
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
1898
|
-
};
|
|
1899
|
-
const handleChange = (e) => {
|
|
1900
|
-
const files = Array.from(e.target.files || []);
|
|
1901
|
-
if (files.length) handleFiles(files);
|
|
1902
|
-
e.target.value = "";
|
|
1903
|
-
};
|
|
1904
|
-
if (progress !== null) {
|
|
1905
|
-
return /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-progress-wrap", children: [
|
|
1906
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--doc-progress-info", children: [
|
|
1907
|
-
/* @__PURE__ */ jsx(DocFileIcon, { filename: fileNames[0] || "", fontSize: 16 }),
|
|
1908
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-progress-name", children: fileNames.length === 1 ? fileNames[0] : `${fileNames.length} files uploading...` }),
|
|
1909
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--doc-progress-pct", children: [
|
|
1910
|
-
progress,
|
|
1911
|
-
"%"
|
|
1912
|
-
] })
|
|
1913
|
-
] }),
|
|
1914
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--doc-progress-bar", children: /* @__PURE__ */ jsx("div", { className: "chatBot--doc-progress-fill", style: { width: `${progress}%` } }) })
|
|
1915
|
-
] });
|
|
1916
|
-
}
|
|
1917
|
-
return /* @__PURE__ */ jsxs(
|
|
1918
|
-
"div",
|
|
1919
|
-
{
|
|
1920
|
-
className: `chatBot--doc-dropzone${isDragging ? " chatBot--doc-dropzone--active" : ""}`,
|
|
1921
|
-
onDrop: handleDrop,
|
|
1922
|
-
onDragOver: handleDragOver,
|
|
1923
|
-
onDragLeave: handleDragLeave,
|
|
1924
|
-
onClick: handleClick,
|
|
1925
|
-
children: [
|
|
1926
|
-
/* @__PURE__ */ jsx(
|
|
1927
|
-
"input",
|
|
1928
|
-
{
|
|
1929
|
-
ref: fileInputRef,
|
|
1930
|
-
type: "file",
|
|
1931
|
-
accept: ACCEPT_ATTR,
|
|
1932
|
-
multiple: true,
|
|
1933
|
-
style: { display: "none" },
|
|
1934
|
-
onChange: handleChange
|
|
1935
|
-
}
|
|
1936
|
-
),
|
|
1937
|
-
/* @__PURE__ */ jsx(CloudUploadRounded, { sx: { fontSize: 28, color: "#2EB273", mb: 0.5 } }),
|
|
1938
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--doc-drop-label", children: "Drop files here or click to browse" }),
|
|
1939
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--doc-drop-sub", children: "Max 50MB per file · PDF, Word, Excel, Markdown, image · Up to 10 files" })
|
|
1940
|
-
]
|
|
1941
|
-
}
|
|
1942
|
-
);
|
|
1943
|
-
};
|
|
1944
|
-
const STATUS_LABELS = {
|
|
1945
|
-
uploading: "Uploading…",
|
|
1946
|
-
pending: "Queued",
|
|
1947
|
-
processing: "Processing",
|
|
1948
|
-
parsing: "Extracting text",
|
|
1949
|
-
embedding: "Generating embeddings",
|
|
1950
|
-
indexing: "Indexing",
|
|
1951
|
-
ready: "Ready",
|
|
1952
|
-
failed: "Failed"
|
|
1953
|
-
};
|
|
1954
|
-
const ACTIVE_STATUSES = ["pending", "processing", "parsing", "embedding", "indexing"];
|
|
1955
|
-
const DocStatus = ({ document: document2, onReady, onError, getStatus }) => {
|
|
1956
|
-
const [doc, setDoc] = useState(document2);
|
|
1957
|
-
const [pollCount, setPollCount] = useState(0);
|
|
1958
|
-
const mountedRef = useRef(true);
|
|
1959
|
-
const pollDocIdRef = useRef(doc.doc_id);
|
|
1960
|
-
pollDocIdRef.current = doc.doc_id;
|
|
1961
|
-
useEffect(() => {
|
|
1962
|
-
mountedRef.current = true;
|
|
1963
|
-
return () => {
|
|
1964
|
-
mountedRef.current = false;
|
|
1965
|
-
};
|
|
1966
|
-
}, []);
|
|
1967
|
-
useEffect(() => {
|
|
1968
|
-
if (!ACTIVE_STATUSES.includes(doc.status)) return;
|
|
1969
|
-
const interval = setInterval(async () => {
|
|
1970
|
-
try {
|
|
1971
|
-
const updated = await getStatus(doc.doc_id);
|
|
1972
|
-
if (!mountedRef.current || updated.doc_id !== pollDocIdRef.current) return;
|
|
1973
|
-
setDoc(updated);
|
|
1974
|
-
setPollCount((c) => c + 1);
|
|
1975
|
-
if (updated.status === "ready") {
|
|
1976
|
-
clearInterval(interval);
|
|
1977
|
-
onReady(updated);
|
|
1978
|
-
} else if (updated.status === "failed") {
|
|
1979
|
-
clearInterval(interval);
|
|
1980
|
-
onError(updated);
|
|
1981
|
-
}
|
|
1982
|
-
} catch {
|
|
1983
|
-
setPollCount((c) => c + 1);
|
|
1984
|
-
}
|
|
1985
|
-
}, 3e3);
|
|
1986
|
-
return () => clearInterval(interval);
|
|
1987
|
-
}, [doc.doc_id, doc.status]);
|
|
1988
|
-
const isActive = ACTIVE_STATUSES.includes(doc.status);
|
|
1989
|
-
const isReady = doc.status === "ready";
|
|
1990
|
-
const isFailed = doc.status === "failed";
|
|
1991
|
-
return /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-status-card", children: [
|
|
1992
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--doc-status-head", children: [
|
|
1993
|
-
isReady && /* @__PURE__ */ jsx(CheckCircleRounded, { sx: { fontSize: 18, color: "#2EB273" } }),
|
|
1994
|
-
isFailed && /* @__PURE__ */ jsx(ErrorRounded, { sx: { fontSize: 18, color: "#C62828" } }),
|
|
1995
|
-
isActive && /* @__PURE__ */ jsx(HourglassBottomRounded, { sx: { fontSize: 18, color: "#2EB273" }, className: "chatBot--doc-status-spin" }),
|
|
1996
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--doc-status-info", children: [
|
|
1997
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-status-name", children: doc.filename }),
|
|
1998
|
-
/* @__PURE__ */ jsxs("span", { className: "chatBot--doc-status-label", children: [
|
|
1999
|
-
STATUS_LABELS[doc.status],
|
|
2000
|
-
doc.pages ? ` · ${doc.pages} pages` : "",
|
|
2001
|
-
doc.category ? ` · ${doc.category}` : ""
|
|
2002
|
-
] })
|
|
2003
|
-
] })
|
|
2004
|
-
] }),
|
|
2005
|
-
isActive && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-progress-bar", children: /* @__PURE__ */ jsx("div", { className: "chatBot--doc-progress-fill chatBot--doc-progress-fill--indeterminate" }) }),
|
|
2006
|
-
isFailed && /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-status-error", children: [
|
|
2007
|
-
doc.error || "Document processing failed",
|
|
2008
|
-
doc.error_code && /* @__PURE__ */ jsx("span", { className: "chatBot--doc-status-error-code", children: doc.error_code })
|
|
2009
|
-
] }),
|
|
2010
|
-
isReady && /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-status-ready", children: [
|
|
2011
|
-
doc.chunk_count,
|
|
2012
|
-
" chunks indexed · Ready to chat"
|
|
2013
|
-
] })
|
|
2014
|
-
] });
|
|
2015
|
-
};
|
|
2016
|
-
const DocIntro = ({ document: document2, documents, suggestedQuestions, onSuggestion }) => {
|
|
2017
|
-
const docsToRender = documents && documents.length > 0 ? documents : document2 ? [document2] : [];
|
|
2018
|
-
const questionsToRender = suggestedQuestions && suggestedQuestions.length > 0 ? suggestedQuestions : document2 == null ? void 0 : document2.suggested_questions;
|
|
2019
|
-
if (docsToRender.length === 0) return null;
|
|
2020
|
-
if (!docsToRender.some((d) => d.summary) && !(questionsToRender == null ? void 0 : questionsToRender.length)) return null;
|
|
2021
|
-
return /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-intro-card", children: [
|
|
2022
|
-
docsToRender.map((doc, idx) => /* @__PURE__ */ jsxs("div", { style: { borderBottom: idx < docsToRender.length - 1 && docsToRender.length > 1 ? "1px solid #F2F3F4" : "none" }, children: [
|
|
2023
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--doc-intro-head", children: [
|
|
2024
|
-
/* @__PURE__ */ jsx(DocFileIcon, { filename: doc.filename, fontSize: 16 }),
|
|
2025
|
-
/* @__PURE__ */ jsxs("div", { className: "chatBot--doc-intro-head-info", children: [
|
|
2026
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-intro-filename", children: doc.filename }),
|
|
2027
|
-
/* @__PURE__ */ jsx("span", { className: "chatBot--doc-intro-meta", children: doc.category && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2028
|
-
doc.category,
|
|
2029
|
-
doc.sub_category ? ` · ${doc.sub_category}` : ""
|
|
2030
|
-
] }) })
|
|
2031
|
-
] })
|
|
2032
|
-
] }),
|
|
2033
|
-
doc.summary && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-intro-summary", children: doc.summary })
|
|
2034
|
-
] }, doc.doc_id || idx)),
|
|
2035
|
-
questionsToRender && questionsToRender.length > 0 && /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-intro-questions", children: [
|
|
2036
|
-
/* @__PURE__ */ jsx("div", { className: "chatBot--doc-intro-q-label", children: "Suggested questions" }),
|
|
2037
|
-
questionsToRender.map((q, i) => /* @__PURE__ */ jsx("button", { className: "chatBot--doc-intro-q-btn", onClick: () => onSuggestion(q), children: q }, i))
|
|
2038
|
-
] })
|
|
2039
|
-
] });
|
|
2040
|
-
};
|
|
2041
|
-
const mergeById = (first, rest) => {
|
|
2042
|
-
const ids = new Set(first.map((s) => s.id));
|
|
2043
|
-
return [...first, ...rest.filter((s) => !ids.has(s.id))];
|
|
2044
|
-
};
|
|
2045
|
-
const useChatHistory = (service, enabled) => {
|
|
2046
|
-
const [sessions, setSessions] = useState([]);
|
|
2047
|
-
const [nextCursor, setNextCursor] = useState(null);
|
|
2048
|
-
const [loading, setLoading] = useState(false);
|
|
2049
|
-
const [loadingMore, setLoadingMore] = useState(false);
|
|
2050
|
-
const [error, setError] = useState(null);
|
|
2051
|
-
const sessionsRef = useRef([]);
|
|
2052
|
-
const requestIdRef = useRef(0);
|
|
2053
|
-
useEffect(() => {
|
|
2054
|
-
sessionsRef.current = sessions;
|
|
2055
|
-
}, [sessions]);
|
|
2056
|
-
const refresh = useCallback(async (keepLoaded = false) => {
|
|
2057
|
-
const requestId = ++requestIdRef.current;
|
|
2058
|
-
if (!service) {
|
|
2059
|
-
setSessions([]);
|
|
2060
|
-
setNextCursor(null);
|
|
2061
|
-
setError(null);
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
2064
|
-
const merge = keepLoaded && sessionsRef.current.length > 0;
|
|
2065
|
-
if (!merge) setLoading(true);
|
|
2066
|
-
setError(null);
|
|
2067
|
-
try {
|
|
2068
|
-
const page = await getV1CopilotHistory({ service, limit: HISTORY_PAGE_SIZE }, getToken()["x-token"]);
|
|
2069
|
-
if (requestId !== requestIdRef.current) return;
|
|
2070
|
-
const firstPage = page.sessions.map(toChatSession);
|
|
2071
|
-
if (merge) {
|
|
2072
|
-
setSessions((prev) => mergeById(firstPage, prev));
|
|
2073
|
-
} else {
|
|
2074
|
-
setSessions(firstPage);
|
|
2075
|
-
setNextCursor(page.next_cursor);
|
|
2076
|
-
}
|
|
2077
|
-
} catch (e) {
|
|
2078
|
-
if (requestId === requestIdRef.current) setError((e == null ? void 0 : e.message) || "Failed to load chat history");
|
|
2079
|
-
} finally {
|
|
2080
|
-
if (requestId === requestIdRef.current) setLoading(false);
|
|
2081
|
-
}
|
|
2082
|
-
}, [service]);
|
|
2083
|
-
const loadMore = useCallback(async () => {
|
|
2084
|
-
if (!service || !nextCursor || loadingMore) return;
|
|
2085
|
-
const requestId = requestIdRef.current;
|
|
2086
|
-
setLoadingMore(true);
|
|
2087
|
-
try {
|
|
2088
|
-
const page = await getV1CopilotHistory({ service, limit: HISTORY_PAGE_SIZE, cursor: nextCursor }, getToken()["x-token"]);
|
|
2089
|
-
if (requestId !== requestIdRef.current) return;
|
|
2090
|
-
setSessions((prev) => mergeById(prev, page.sessions.map(toChatSession)));
|
|
2091
|
-
setNextCursor(page.next_cursor);
|
|
2092
|
-
} catch {
|
|
2093
|
-
if (requestId === requestIdRef.current) await refresh();
|
|
2094
|
-
} finally {
|
|
2095
|
-
setLoadingMore(false);
|
|
2096
|
-
}
|
|
2097
|
-
}, [service, nextCursor, loadingMore, refresh]);
|
|
2098
|
-
const openSession = useCallback(
|
|
2099
|
-
(session) => getV1CopilotHistorySession(session.id, session.service, getToken()["x-token"]),
|
|
2100
|
-
[]
|
|
2101
|
-
);
|
|
2102
|
-
const removeSession = useCallback(async (session) => {
|
|
2103
|
-
await deleteV1CopilotHistorySession(session.id, session.service, getToken()["x-token"]);
|
|
2104
|
-
setSessions((prev) => prev.filter((s) => s.id !== session.id));
|
|
2105
|
-
}, []);
|
|
2106
|
-
useEffect(() => {
|
|
2107
|
-
if (!enabled) return;
|
|
2108
|
-
setSessions([]);
|
|
2109
|
-
setNextCursor(null);
|
|
2110
|
-
refresh();
|
|
2111
|
-
}, [enabled, refresh]);
|
|
2112
|
-
return {
|
|
2113
|
-
sessions,
|
|
2114
|
-
loading,
|
|
2115
|
-
loadingMore,
|
|
2116
|
-
error,
|
|
2117
|
-
hasMore: !!nextCursor,
|
|
2118
|
-
refresh,
|
|
2119
|
-
loadMore,
|
|
2120
|
-
openSession,
|
|
2121
|
-
removeSession
|
|
2122
|
-
};
|
|
2123
|
-
};
|
|
2124
|
-
marked.use({ breaks: true, gfm: true });
|
|
2125
|
-
const ChatBot = ({ inline = false, dashboardMode = false } = {}) => {
|
|
2126
|
-
var _a;
|
|
2127
|
-
const isAiEnabled = ((_a = getApiConfigSafe()) == null ? void 0 : _a.aiFeatureEnabled) === "true";
|
|
2128
|
-
if (!isAiEnabled) return null;
|
|
2129
|
-
const uData = JSON.parse(localStorage.getItem("_u_data") || "{}");
|
|
2130
|
-
if (uData.role_type !== "Admin") return null;
|
|
2131
|
-
const { user } = useAuth();
|
|
2132
|
-
const [isOpen, setIsOpen] = useState(inline ? true : false);
|
|
2133
|
-
const [messages, setMessages] = useState([]);
|
|
2134
|
-
const [isTyping, setIsTyping] = useState(false);
|
|
2135
|
-
const [inputValue, setInputValue] = useState("");
|
|
2136
|
-
const [mode, setMode] = useState("smart");
|
|
2137
|
-
const [formType, setFormType] = useState(null);
|
|
2138
|
-
const [formStatus, setFormStatus] = useState("in_progress");
|
|
2139
|
-
const [currentFieldUpdates, setCurrentFieldUpdates] = useState(null);
|
|
2140
|
-
const [pendingFormAction, setPendingFormAction] = useState(null);
|
|
2141
|
-
const [resolvedLabels, setResolvedLabels] = useState({});
|
|
2142
|
-
const [dynamicQuestions, setDynamicQuestions] = useState([]);
|
|
2143
|
-
const [showSlashMenu, setShowSlashMenu] = useState(false);
|
|
2144
|
-
const [slashIndex, setSlashIndex] = useState(0);
|
|
2145
|
-
const labelCacheRef = useRef({});
|
|
2146
|
-
const bodyRef = useRef(null);
|
|
2147
|
-
const textareaRef = useRef(null);
|
|
2148
|
-
const userScrolledUp = useRef(false);
|
|
2149
|
-
const agentStarted = useRef(false);
|
|
2150
|
-
const smartSessionIdRef = useRef(null);
|
|
2151
|
-
const formSessionIdRef = useRef(null);
|
|
2152
|
-
const [activeDocument, setActiveDocument] = useState(null);
|
|
2153
|
-
const [docIntroSent, setDocIntroSent] = useState(false);
|
|
2154
|
-
const [docError, setDocError] = useState(null);
|
|
2155
|
-
const [showUploadArea, setShowUploadArea] = useState(false);
|
|
2156
|
-
const [activeDocuments, setActiveDocuments] = useState([]);
|
|
2157
|
-
const [suggestedQuestions, setSuggestedQuestions] = useState([]);
|
|
2158
|
-
const fetchedMultiDocIntroIds = useRef("");
|
|
2159
|
-
const tabStateRef = useRef({});
|
|
2160
|
-
const [historyOpen, setHistoryOpen] = useState(false);
|
|
2161
|
-
const historyService = historyServiceForMode(mode);
|
|
2162
|
-
const chatHistory = useChatHistory(historyService, historyOpen);
|
|
2163
|
-
const [activeSessionId, setActiveSessionId] = useState(null);
|
|
2164
|
-
const activeSessionIdRef = useRef(null);
|
|
2165
|
-
const chatSessionIdRef = useRef(null);
|
|
2166
|
-
const conversationRef = useRef(0);
|
|
2167
|
-
const [pendingDeleteSession, setPendingDeleteSession] = useState(null);
|
|
2168
|
-
const [deletingSession, setDeletingSession] = useState(false);
|
|
2169
|
-
const markActiveSession = (sessionId) => {
|
|
2170
|
-
activeSessionIdRef.current = sessionId;
|
|
2171
|
-
setActiveSessionId(sessionId);
|
|
2172
|
-
};
|
|
2173
|
-
const firstName = (user == null ? void 0 : user.first_name) || "";
|
|
2174
|
-
const filteredMessages = useMemo(
|
|
2175
|
-
() => messages.filter((m) => {
|
|
2176
|
-
if (!m.mode) return true;
|
|
2177
|
-
if (m.mode === mode) return true;
|
|
2178
|
-
return false;
|
|
2179
|
-
}),
|
|
2180
|
-
[messages, mode]
|
|
2181
|
-
);
|
|
2182
|
-
useEffect(() => {
|
|
2183
|
-
const config = getApiConfigSafe();
|
|
2184
|
-
if (config == null ? void 0 : config.backendBaseUrl) {
|
|
2185
|
-
setAiFeatureBaseUrl(`${config.backendBaseUrl}/ai-feature`);
|
|
2186
|
-
}
|
|
2187
|
-
}, []);
|
|
2188
|
-
const slashQuery = inputValue.startsWith("/") ? inputValue.slice(1).toLowerCase() : "";
|
|
2189
|
-
const filteredCommands = SLASH_COMMANDS.filter(
|
|
2190
|
-
(cmd) => cmd.label.toLowerCase().startsWith(slashQuery)
|
|
2191
|
-
);
|
|
2192
|
-
const fetchQuestions = useCallback(async () => {
|
|
2193
|
-
try {
|
|
2194
|
-
const { "x-token": token } = getToken();
|
|
2195
|
-
const uData2 = getDefaultUserData();
|
|
2196
|
-
const mapLocalToApiModule = (localName) => {
|
|
2197
|
-
switch (localName) {
|
|
2198
|
-
case "accounts-and-finance":
|
|
2199
|
-
return "Accounting";
|
|
2200
|
-
case "inventory":
|
|
2201
|
-
return "Inventory";
|
|
2202
|
-
case "manufacturing":
|
|
2203
|
-
return "Manufacturing";
|
|
2204
|
-
case "purchase":
|
|
2205
|
-
return "Procurement";
|
|
2206
|
-
case "sales":
|
|
2207
|
-
return "CRM";
|
|
2208
|
-
case "hrms":
|
|
2209
|
-
return "HRMS";
|
|
2210
|
-
case "rental":
|
|
2211
|
-
return "Rental";
|
|
2212
|
-
case "rbac":
|
|
2213
|
-
case "user":
|
|
2214
|
-
return "Users";
|
|
2215
|
-
default:
|
|
2216
|
-
return null;
|
|
2217
|
-
}
|
|
2218
|
-
};
|
|
2219
|
-
const mappedModules = ((uData2 == null ? void 0 : uData2.module_access) || []).map((m) => mapLocalToApiModule(m.module_name)).filter(Boolean);
|
|
2220
|
-
const uniqueModules = Array.from(new Set(mappedModules));
|
|
2221
|
-
if (uniqueModules.length === 0) {
|
|
2222
|
-
setDynamicQuestions([]);
|
|
2223
|
-
return;
|
|
2224
|
-
}
|
|
2225
|
-
const modules = [...uniqueModules].sort(() => Math.random() - 0.5).slice(0, 4);
|
|
2226
|
-
const res = await getV1CopilotQuestions(modules, token);
|
|
2227
|
-
if (res && res.modules) {
|
|
2228
|
-
const questions = [];
|
|
2229
|
-
res.modules.forEach((mod) => {
|
|
2230
|
-
if (mod.questions) {
|
|
2231
|
-
mod.questions.forEach((q) => {
|
|
2232
|
-
questions.push({
|
|
2233
|
-
prompt: q,
|
|
2234
|
-
cat: mod.module.toUpperCase(),
|
|
2235
|
-
mode: "conversation",
|
|
2236
|
-
kind: "blue"
|
|
2237
|
-
});
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
});
|
|
2241
|
-
setDynamicQuestions(questions);
|
|
2242
|
-
}
|
|
2243
|
-
} catch (e) {
|
|
2244
|
-
console.error("Failed to fetch copilot questions", e);
|
|
2245
|
-
}
|
|
2246
|
-
}, []);
|
|
2247
|
-
useEffect(() => {
|
|
2248
|
-
if (isOpen) {
|
|
2249
|
-
setTimeout(() => {
|
|
2250
|
-
var _a2;
|
|
2251
|
-
return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2252
|
-
}, 100);
|
|
2253
|
-
if (dynamicQuestions.length === 0) {
|
|
2254
|
-
fetchQuestions();
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
}, [isOpen, dynamicQuestions.length, fetchQuestions]);
|
|
2258
|
-
useEffect(() => {
|
|
2259
|
-
if (!isTyping && isOpen) {
|
|
2260
|
-
setTimeout(() => {
|
|
2261
|
-
var _a2;
|
|
2262
|
-
return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2263
|
-
}, 100);
|
|
2264
|
-
}
|
|
2265
|
-
}, [isTyping, isOpen]);
|
|
2266
|
-
const handleDockAsk = useCallback(({ prefill }) => {
|
|
2267
|
-
setIsOpen(true);
|
|
2268
|
-
if (prefill) setInputValue(prefill);
|
|
2269
|
-
setTimeout(() => {
|
|
2270
|
-
const ta = textareaRef.current;
|
|
2271
|
-
if (!ta) return;
|
|
2272
|
-
ta.focus();
|
|
2273
|
-
ta.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
2274
|
-
if (prefill) ta.selectionStart = ta.selectionEnd = prefill.length;
|
|
2275
|
-
}, 120);
|
|
2276
|
-
}, []);
|
|
2277
|
-
useChatFocusListener(handleDockAsk);
|
|
2278
|
-
const panelRef = useRef(null);
|
|
2279
|
-
const [panelHeight, setPanelHeight] = useState(null);
|
|
2280
|
-
useLayoutEffect(() => {
|
|
2281
|
-
if (!(inline && dashboardMode)) return;
|
|
2282
|
-
const GAP2 = 16;
|
|
2283
|
-
const restTop = (el) => window.innerHeight - parseFloat(getComputedStyle(el).bottom || "0") - el.offsetHeight;
|
|
2284
|
-
const calc = () => {
|
|
2285
|
-
const el = panelRef.current;
|
|
2286
|
-
if (!el) return;
|
|
2287
|
-
const top = el.getBoundingClientRect().top + window.scrollY;
|
|
2288
|
-
const dock2 = document.querySelector(".fmd");
|
|
2289
|
-
const pill = document.querySelector(".fmd-pill");
|
|
2290
|
-
let limit = window.innerHeight - GAP2;
|
|
2291
|
-
if (dock2) {
|
|
2292
|
-
const collapsed = dock2.dataset.collapsed === "true";
|
|
2293
|
-
limit = collapsed && pill ? restTop(pill) - 14 : restTop(dock2) - GAP2;
|
|
2294
|
-
}
|
|
2295
|
-
setPanelHeight(Math.max(320, Math.floor(limit - top)));
|
|
2296
|
-
};
|
|
2297
|
-
calc();
|
|
2298
|
-
window.addEventListener("resize", calc);
|
|
2299
|
-
window.addEventListener(DOCK_LAYOUT_EVENT, calc);
|
|
2300
|
-
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(calc) : null;
|
|
2301
|
-
const dock = document.querySelector(".fmd");
|
|
2302
|
-
if (ro && dock) ro.observe(dock);
|
|
2303
|
-
return () => {
|
|
2304
|
-
window.removeEventListener("resize", calc);
|
|
2305
|
-
window.removeEventListener(DOCK_LAYOUT_EVENT, calc);
|
|
2306
|
-
ro == null ? void 0 : ro.disconnect();
|
|
2307
|
-
};
|
|
2308
|
-
}, [inline, dashboardMode]);
|
|
2309
|
-
useEffect(() => {
|
|
2310
|
-
const container = bodyRef.current;
|
|
2311
|
-
if (!container) return;
|
|
2312
|
-
const onScroll = () => {
|
|
2313
|
-
const atBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 40;
|
|
2314
|
-
userScrolledUp.current = !atBottom;
|
|
2315
|
-
};
|
|
2316
|
-
container.addEventListener("scroll", onScroll);
|
|
2317
|
-
return () => container.removeEventListener("scroll", onScroll);
|
|
2318
|
-
}, []);
|
|
2319
|
-
useEffect(() => {
|
|
2320
|
-
if (!userScrolledUp.current && bodyRef.current) {
|
|
2321
|
-
bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
|
|
2322
|
-
}
|
|
2323
|
-
}, [messages, isTyping, currentFieldUpdates, resolvedLabels, activeDocument, activeDocuments, suggestedQuestions]);
|
|
2324
|
-
const selectCommand = (id) => {
|
|
2325
|
-
if (id !== mode) {
|
|
2326
|
-
tabStateRef.current[mode] = {
|
|
2327
|
-
doc: activeDocument,
|
|
2328
|
-
docs: activeDocuments,
|
|
2329
|
-
suggested: suggestedQuestions,
|
|
2330
|
-
introSent: docIntroSent,
|
|
2331
|
-
error: docError,
|
|
2332
|
-
multiDocIds: fetchedMultiDocIntroIds.current
|
|
2333
|
-
};
|
|
2334
|
-
const nextState = tabStateRef.current[id] || { doc: null, docs: [], suggested: [], introSent: false, error: null, multiDocIds: "" };
|
|
2335
|
-
setActiveDocument(nextState.doc);
|
|
2336
|
-
setActiveDocuments(nextState.docs);
|
|
2337
|
-
setSuggestedQuestions(nextState.suggested);
|
|
2338
|
-
setDocIntroSent(nextState.introSent);
|
|
2339
|
-
setDocError(nextState.error);
|
|
2340
|
-
fetchedMultiDocIntroIds.current = nextState.multiDocIds;
|
|
2341
|
-
}
|
|
2342
|
-
setMode(id);
|
|
2343
|
-
setShowSlashMenu(false);
|
|
2344
|
-
setSlashIndex(0);
|
|
2345
|
-
if (id === "conversation") {
|
|
2346
|
-
setFormType(null);
|
|
2347
|
-
setFormStatus("in_progress");
|
|
2348
|
-
setPendingFormAction(null);
|
|
2349
|
-
agentStarted.current = false;
|
|
2350
|
-
} else if (id === "agent" && !formType) {
|
|
2351
|
-
setFormType("sales_invoice");
|
|
2352
|
-
}
|
|
2353
|
-
setTimeout(() => {
|
|
2354
|
-
var _a2;
|
|
2355
|
-
return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2356
|
-
}, 0);
|
|
2357
|
-
};
|
|
2358
|
-
const handleModeChange = (id) => {
|
|
2359
|
-
selectCommand(id);
|
|
2360
|
-
};
|
|
2361
|
-
const handleInputChange = (e) => {
|
|
2362
|
-
const val = e.target.value;
|
|
2363
|
-
setInputValue(val);
|
|
2364
|
-
if (val.startsWith("/")) {
|
|
2365
|
-
setShowSlashMenu(true);
|
|
2366
|
-
setSlashIndex(0);
|
|
2367
|
-
} else {
|
|
2368
|
-
setShowSlashMenu(false);
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
|
-
const handleSuggestion = (prompt, suggestionMode, suggestionFormType) => {
|
|
2372
|
-
if (mode !== "smart") {
|
|
2373
|
-
setMode(suggestionMode);
|
|
2374
|
-
}
|
|
2375
|
-
if (suggestionFormType) setFormType(suggestionFormType);
|
|
2376
|
-
setInputValue(prompt);
|
|
2377
|
-
setTimeout(() => {
|
|
2378
|
-
const ta = textareaRef.current;
|
|
2379
|
-
if (ta) {
|
|
2380
|
-
ta.focus();
|
|
2381
|
-
ta.selectionStart = ta.selectionEnd = prompt.length;
|
|
2382
|
-
}
|
|
2383
|
-
}, 0);
|
|
2384
|
-
};
|
|
2385
|
-
const handleDocUpload = useCallback(async (file, onProgress) => {
|
|
2386
|
-
const { "x-token": token } = getToken();
|
|
2387
|
-
setDocError(null);
|
|
2388
|
-
const result = await uploadDocument(file, token, void 0, onProgress);
|
|
2389
|
-
const doc = {
|
|
2390
|
-
doc_id: result.doc_id,
|
|
2391
|
-
filename: result.filename,
|
|
2392
|
-
status: result.status,
|
|
2393
|
-
pages: result.pages
|
|
2394
|
-
};
|
|
2395
|
-
setActiveDocument(doc);
|
|
2396
|
-
if (result.deduplicated && result.status === "ready") {
|
|
2397
|
-
const fullStatus = await getDocumentStatus(result.doc_id, token);
|
|
2398
|
-
const fullDoc = {
|
|
2399
|
-
doc_id: fullStatus.doc_id,
|
|
2400
|
-
filename: fullStatus.filename || result.filename,
|
|
2401
|
-
status: fullStatus.status,
|
|
2402
|
-
pages: fullStatus.pages || result.pages,
|
|
2403
|
-
category: fullStatus.category || void 0,
|
|
2404
|
-
sub_category: fullStatus.sub_category || void 0,
|
|
2405
|
-
chunk_count: fullStatus.chunk_count || void 0
|
|
2406
|
-
};
|
|
2407
|
-
setActiveDocument(fullDoc);
|
|
2408
|
-
setDocIntroSent(false);
|
|
2409
|
-
const onDocIntro = (data) => {
|
|
2410
|
-
if (data == null ? void 0 : data.found) {
|
|
2411
|
-
setActiveDocument((prev) => prev && prev.doc_id === fullDoc.doc_id ? {
|
|
2412
|
-
...prev,
|
|
2413
|
-
summary: data.summary,
|
|
2414
|
-
suggested_questions: data.suggested_questions,
|
|
2415
|
-
category: data.category || prev.category,
|
|
2416
|
-
sub_category: data.sub_category || prev.sub_category
|
|
2417
|
-
} : prev);
|
|
2418
|
-
}
|
|
2419
|
-
};
|
|
2420
|
-
if (mode === "smart") {
|
|
2421
|
-
smartSessionIdRef.current = null;
|
|
2422
|
-
formSessionIdRef.current = null;
|
|
2423
|
-
agentStarted.current = false;
|
|
2424
|
-
setFormType(null);
|
|
2425
|
-
setFormStatus("in_progress");
|
|
2426
|
-
setPendingFormAction(null);
|
|
2427
|
-
setCurrentFieldUpdates(null);
|
|
2428
|
-
setResolvedLabels({});
|
|
2429
|
-
}
|
|
2430
|
-
streamV1CopilotChat(
|
|
2431
|
-
{ ...getToken(), query: "", doc_id: fullDoc.doc_id, doc_intro: true },
|
|
2432
|
-
() => {
|
|
2433
|
-
},
|
|
2434
|
-
() => {
|
|
2435
|
-
},
|
|
2436
|
-
() => {
|
|
2437
|
-
},
|
|
2438
|
-
() => {
|
|
2439
|
-
},
|
|
2440
|
-
onDocIntro
|
|
2441
|
-
).catch(() => {
|
|
2442
|
-
});
|
|
2443
|
-
return fullDoc;
|
|
2444
|
-
}
|
|
2445
|
-
return doc;
|
|
2446
|
-
}, []);
|
|
2447
|
-
const handleDocUploadComplete = useCallback((doc) => {
|
|
2448
|
-
setDocIntroSent(false);
|
|
2449
|
-
}, []);
|
|
2450
|
-
const handleDocUploadError = useCallback((msg) => {
|
|
2451
|
-
setDocError(msg);
|
|
2452
|
-
}, []);
|
|
2453
|
-
const handleDocReady = useCallback((doc) => {
|
|
2454
|
-
setActiveDocument(doc);
|
|
2455
|
-
setDocIntroSent(false);
|
|
2456
|
-
const onDocIntro = (data) => {
|
|
2457
|
-
if (data == null ? void 0 : data.found) {
|
|
2458
|
-
setActiveDocument((prev) => prev && prev.doc_id === doc.doc_id ? {
|
|
2459
|
-
...prev,
|
|
2460
|
-
summary: data.summary,
|
|
2461
|
-
suggested_questions: data.suggested_questions,
|
|
2462
|
-
category: data.category || prev.category,
|
|
2463
|
-
sub_category: data.sub_category || prev.sub_category
|
|
2464
|
-
} : prev);
|
|
2465
|
-
}
|
|
2466
|
-
};
|
|
2467
|
-
if (mode === "smart") {
|
|
2468
|
-
smartSessionIdRef.current = null;
|
|
2469
|
-
formSessionIdRef.current = null;
|
|
2470
|
-
agentStarted.current = false;
|
|
2471
|
-
setFormType(null);
|
|
2472
|
-
setFormStatus("in_progress");
|
|
2473
|
-
setPendingFormAction(null);
|
|
2474
|
-
setCurrentFieldUpdates(null);
|
|
2475
|
-
setResolvedLabels({});
|
|
2476
|
-
}
|
|
2477
|
-
streamV1CopilotChat(
|
|
2478
|
-
{ ...getToken(), query: "", doc_id: doc.doc_id, doc_intro: true },
|
|
2479
|
-
() => {
|
|
2480
|
-
},
|
|
2481
|
-
() => {
|
|
2482
|
-
},
|
|
2483
|
-
() => {
|
|
2484
|
-
},
|
|
2485
|
-
() => {
|
|
2486
|
-
},
|
|
2487
|
-
onDocIntro
|
|
2488
|
-
).catch(() => {
|
|
2489
|
-
});
|
|
2490
|
-
}, []);
|
|
2491
|
-
const handleDocError = useCallback((doc) => {
|
|
2492
|
-
setActiveDocument(null);
|
|
2493
|
-
setDocError(doc.error || "Document processing failed");
|
|
2494
|
-
}, []);
|
|
2495
|
-
const handleDocDelete = useCallback(async () => {
|
|
2496
|
-
if (!activeDocument) return;
|
|
2497
|
-
const docId = activeDocument.doc_id;
|
|
2498
|
-
try {
|
|
2499
|
-
const { "x-token": token } = getToken();
|
|
2500
|
-
const { deleteDocument } = await import("./api-CuStx4qV.esm.js").then((n) => n.b);
|
|
2501
|
-
await deleteDocument(docId, token);
|
|
2502
|
-
setActiveDocument(
|
|
2503
|
-
(current) => (current == null ? void 0 : current.doc_id) === docId ? null : current
|
|
2504
|
-
);
|
|
2505
|
-
setDocIntroSent(false);
|
|
2506
|
-
setDocError(null);
|
|
2507
|
-
} catch {
|
|
2508
|
-
setDocError("Failed to delete document. Please try again.");
|
|
2509
|
-
}
|
|
2510
|
-
}, [activeDocument]);
|
|
2511
|
-
const checkAndSendMultiDocIntro = useCallback((docs) => {
|
|
2512
|
-
if (docs.length === 0) return;
|
|
2513
|
-
if (docs.some((d) => d.status !== "ready")) return;
|
|
2514
|
-
const currentIds = docs.map((d) => d.doc_id).sort().join(",");
|
|
2515
|
-
if (fetchedMultiDocIntroIds.current === currentIds) return;
|
|
2516
|
-
fetchedMultiDocIntroIds.current = currentIds;
|
|
2517
|
-
const onDocIntro = (data) => {
|
|
2518
|
-
if (data == null ? void 0 : data.found) {
|
|
2519
|
-
if (data.suggested_questions) {
|
|
2520
|
-
setSuggestedQuestions(data.suggested_questions);
|
|
2521
|
-
}
|
|
2522
|
-
setActiveDocuments((prev) => prev.map((p) => {
|
|
2523
|
-
if (docs.length === 1) {
|
|
2524
|
-
return {
|
|
2525
|
-
...p,
|
|
2526
|
-
summary: data.summary,
|
|
2527
|
-
category: data.category || p.category,
|
|
2528
|
-
sub_category: data.sub_category || p.sub_category
|
|
2529
|
-
};
|
|
2530
|
-
} else if (data.docs && Array.isArray(data.docs)) {
|
|
2531
|
-
const dData = data.docs.find((d) => d.doc_id === p.doc_id);
|
|
2532
|
-
if (dData) {
|
|
2533
|
-
return {
|
|
2534
|
-
...p,
|
|
2535
|
-
summary: dData.summary,
|
|
2536
|
-
category: dData.category || p.category,
|
|
2537
|
-
sub_category: dData.sub_category || p.sub_category
|
|
2538
|
-
};
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
return p;
|
|
2542
|
-
}));
|
|
2543
|
-
}
|
|
2544
|
-
};
|
|
2545
|
-
if (mode === "smart") {
|
|
2546
|
-
smartSessionIdRef.current = null;
|
|
2547
|
-
formSessionIdRef.current = null;
|
|
2548
|
-
agentStarted.current = false;
|
|
2549
|
-
setFormType(null);
|
|
2550
|
-
setFormStatus("in_progress");
|
|
2551
|
-
setPendingFormAction(null);
|
|
2552
|
-
setCurrentFieldUpdates(null);
|
|
2553
|
-
setResolvedLabels({});
|
|
2554
|
-
}
|
|
2555
|
-
streamV1CopilotChat(
|
|
2556
|
-
{ ...getToken(), query: "", doc_ids: docs.map((d) => d.doc_id), doc_intro: true },
|
|
2557
|
-
() => {
|
|
2558
|
-
},
|
|
2559
|
-
() => {
|
|
2560
|
-
},
|
|
2561
|
-
() => {
|
|
2562
|
-
},
|
|
2563
|
-
() => {
|
|
2564
|
-
},
|
|
2565
|
-
onDocIntro
|
|
2566
|
-
).catch(() => {
|
|
2567
|
-
});
|
|
2568
|
-
}, [docIntroSent, mode]);
|
|
2569
|
-
const handleMultiDocUpload = useCallback(async (files, onProgress) => {
|
|
2570
|
-
const { "x-token": token } = getToken();
|
|
2571
|
-
setDocError(null);
|
|
2572
|
-
const result = await uploadDocuments(files, token, void 0, onProgress);
|
|
2573
|
-
const items = Array.isArray(result) ? result : result.items || [];
|
|
2574
|
-
const docs = items.map((r) => ({
|
|
2575
|
-
doc_id: r.doc_id,
|
|
2576
|
-
filename: r.filename,
|
|
2577
|
-
status: r.status,
|
|
2578
|
-
pages: r.pages,
|
|
2579
|
-
error: r.error
|
|
2580
|
-
}));
|
|
2581
|
-
setActiveDocuments((prev) => {
|
|
2582
|
-
const newDocs = [...prev];
|
|
2583
|
-
docs.forEach((d) => {
|
|
2584
|
-
if (!newDocs.find((x) => x.doc_id === d.doc_id)) newDocs.push(d);
|
|
2585
|
-
});
|
|
2586
|
-
return newDocs;
|
|
2587
|
-
});
|
|
2588
|
-
setDocIntroSent(false);
|
|
2589
|
-
const readyDocs = items.filter((r) => r.deduplicated && r.status === "ready");
|
|
2590
|
-
if (readyDocs.length > 0) {
|
|
2591
|
-
const fullStatuses = await Promise.all(readyDocs.map((r) => getDocumentStatus(r.doc_id, token)));
|
|
2592
|
-
setActiveDocuments((prev) => {
|
|
2593
|
-
const updated = prev.map((p) => {
|
|
2594
|
-
const full = fullStatuses.find((fs) => fs.doc_id === p.doc_id);
|
|
2595
|
-
if (full) {
|
|
2596
|
-
return {
|
|
2597
|
-
...p,
|
|
2598
|
-
filename: full.filename || p.filename,
|
|
2599
|
-
status: full.status,
|
|
2600
|
-
pages: full.pages || p.pages,
|
|
2601
|
-
category: full.category || p.category,
|
|
2602
|
-
sub_category: full.sub_category || p.sub_category,
|
|
2603
|
-
chunk_count: full.chunk_count || p.chunk_count
|
|
2604
|
-
};
|
|
2605
|
-
}
|
|
2606
|
-
return p;
|
|
2607
|
-
});
|
|
2608
|
-
setTimeout(() => checkAndSendMultiDocIntro(updated), 0);
|
|
2609
|
-
return updated;
|
|
2610
|
-
});
|
|
2611
|
-
}
|
|
2612
|
-
return docs;
|
|
2613
|
-
}, [checkAndSendMultiDocIntro]);
|
|
2614
|
-
const handleMultiDocUploadComplete = useCallback((docs) => {
|
|
2615
|
-
setDocIntroSent(false);
|
|
2616
|
-
}, []);
|
|
2617
|
-
useCallback((msg) => {
|
|
2618
|
-
setDocError(msg);
|
|
2619
|
-
}, []);
|
|
2620
|
-
const handleMultiDocReady = useCallback((doc) => {
|
|
2621
|
-
setActiveDocuments((prev) => {
|
|
2622
|
-
const updated = prev.map((p) => p.doc_id === doc.doc_id ? doc : p);
|
|
2623
|
-
setTimeout(() => checkAndSendMultiDocIntro(updated), 0);
|
|
2624
|
-
return updated;
|
|
2625
|
-
});
|
|
2626
|
-
}, [checkAndSendMultiDocIntro]);
|
|
2627
|
-
const handleMultiDocError = useCallback((doc) => {
|
|
2628
|
-
setActiveDocuments((prev) => prev.filter((p) => p.doc_id !== doc.doc_id));
|
|
2629
|
-
setDocError(doc.error || "Document processing failed");
|
|
2630
|
-
}, []);
|
|
2631
|
-
const handleMultiDocDelete = useCallback(async (docId) => {
|
|
2632
|
-
if (activeDocuments.length === 0) return;
|
|
2633
|
-
const docsToDelete = docId ? activeDocuments.filter((d) => d.doc_id === docId) : activeDocuments;
|
|
2634
|
-
try {
|
|
2635
|
-
const { "x-token": token } = getToken();
|
|
2636
|
-
const { deleteDocument } = await import("./api-CuStx4qV.esm.js").then((n) => n.b);
|
|
2637
|
-
await Promise.all(docsToDelete.map((d) => deleteDocument(d.doc_id, token)));
|
|
2638
|
-
setActiveDocuments((current) => docId ? current.filter((c) => c.doc_id !== docId) : []);
|
|
2639
|
-
setDocIntroSent(false);
|
|
2640
|
-
setDocError(null);
|
|
2641
|
-
setSuggestedQuestions([]);
|
|
2642
|
-
fetchedMultiDocIntroIds.current = "";
|
|
2643
|
-
} catch {
|
|
2644
|
-
setDocError("Failed to delete document(s). Please try again.");
|
|
2645
|
-
}
|
|
2646
|
-
}, [activeDocuments]);
|
|
2647
|
-
const sendMessage = useCallback(
|
|
2648
|
-
async (text) => {
|
|
2649
|
-
if (isTyping) return;
|
|
2650
|
-
if (mode === "conversation" && !text.trim()) return;
|
|
2651
|
-
if (mode === "agent" && !formType) return;
|
|
2652
|
-
if (mode === "doc_qa" && !activeDocument && activeDocuments.length === 0) return;
|
|
2653
|
-
if (mode === "smart" && !text.trim()) return;
|
|
2654
|
-
const userText = text;
|
|
2655
|
-
setMessages((prev) => [
|
|
2656
|
-
...prev,
|
|
2657
|
-
{ id: Date.now(), role: "user", text: userText, mode }
|
|
2658
|
-
]);
|
|
2659
|
-
setInputValue("");
|
|
2660
|
-
setIsTyping(true);
|
|
2661
|
-
let aiMsgId = null;
|
|
2662
|
-
const startTime = Date.now();
|
|
2663
|
-
const conversation = conversationRef.current;
|
|
2664
|
-
const isCurrentConversation = () => conversationRef.current === conversation;
|
|
2665
|
-
const setTurnMessages = (value) => {
|
|
2666
|
-
if (isCurrentConversation()) setMessages(value);
|
|
2667
|
-
};
|
|
2668
|
-
const appendToken = (chunk) => {
|
|
2669
|
-
if (aiMsgId === null) {
|
|
2670
|
-
aiMsgId = Date.now() + 1;
|
|
2671
|
-
const responseTime = `${((Date.now() - startTime) / 1e3).toFixed(1)}s`;
|
|
2672
|
-
setIsTyping(false);
|
|
2673
|
-
setTurnMessages((prev) => [
|
|
2674
|
-
...prev,
|
|
2675
|
-
{ id: aiMsgId, role: "ai", text: chunk, time: responseTime, mode }
|
|
2676
|
-
]);
|
|
2677
|
-
} else {
|
|
2678
|
-
setTurnMessages(
|
|
2679
|
-
(prev) => prev.map((m) => m.id === aiMsgId ? { ...m, text: m.text + chunk } : m)
|
|
2680
|
-
);
|
|
2681
|
-
}
|
|
2682
|
-
};
|
|
2683
|
-
const onBlocks = (blocks) => {
|
|
2684
|
-
if (blocks.length === 0) return;
|
|
2685
|
-
if (aiMsgId === null) {
|
|
2686
|
-
aiMsgId = Date.now() + 1;
|
|
2687
|
-
const responseTime = `${((Date.now() - startTime) / 1e3).toFixed(1)}s`;
|
|
2688
|
-
setIsTyping(false);
|
|
2689
|
-
setTurnMessages((prev) => [
|
|
2690
|
-
...prev,
|
|
2691
|
-
{ id: aiMsgId, role: "ai", text: "", time: responseTime, mode, blocks }
|
|
2692
|
-
]);
|
|
2693
|
-
} else {
|
|
2694
|
-
setTurnMessages((prev) => prev.map((m) => m.id === aiMsgId ? { ...m, blocks } : m));
|
|
2695
|
-
}
|
|
2696
|
-
};
|
|
2697
|
-
const onDone = (usage) => {
|
|
2698
|
-
setIsTyping(false);
|
|
2699
|
-
if (aiMsgId === null) return;
|
|
2700
|
-
const durationMs = Date.now() - startTime;
|
|
2701
|
-
const inputTokens = (usage == null ? void 0 : usage.input_tokens) ?? (usage == null ? void 0 : usage.prompt_tokens);
|
|
2702
|
-
const outputTokens = (usage == null ? void 0 : usage.output_tokens) ?? (usage == null ? void 0 : usage.completion_tokens);
|
|
2703
|
-
const tokens = (usage == null ? void 0 : usage.total_tokens) ?? (inputTokens !== void 0 || outputTokens !== void 0 ? (inputTokens ?? 0) + (outputTokens ?? 0) : void 0);
|
|
2704
|
-
setTurnMessages((prev) => prev.map((m) => m.id === aiMsgId ? { ...m, durationMs, tokens, inputTokens, outputTokens } : m));
|
|
2705
|
-
};
|
|
2706
|
-
const onError = (message) => {
|
|
2707
|
-
setIsTyping(false);
|
|
2708
|
-
const errorText = message || "Sorry, something went wrong. Please try again.";
|
|
2709
|
-
if (aiMsgId !== null) {
|
|
2710
|
-
setTurnMessages((prev) => prev.map(
|
|
2711
|
-
(m) => m.id === aiMsgId ? { ...m, text: m.text + "\n\n⚠️ " + errorText } : m
|
|
2712
|
-
));
|
|
2713
|
-
} else {
|
|
2714
|
-
setTurnMessages((prev) => [
|
|
2715
|
-
...prev,
|
|
2716
|
-
{ id: Date.now() + 1, role: "ai", text: errorText, time: getTime(), mode }
|
|
2717
|
-
]);
|
|
2718
|
-
}
|
|
2719
|
-
};
|
|
2720
|
-
const onOffTopic = () => {
|
|
2721
|
-
setIsTyping(false);
|
|
2722
|
-
if (aiMsgId === null) {
|
|
2723
|
-
setTurnMessages((prev) => [
|
|
2724
|
-
...prev,
|
|
2725
|
-
{ id: Date.now() + 1, role: "ai", text: "That question is outside the scope of ERP data.", time: getTime(), mode }
|
|
2726
|
-
]);
|
|
2727
|
-
}
|
|
2728
|
-
};
|
|
2729
|
-
const resolveFieldLabel = async (key, value) => {
|
|
2730
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
2731
|
-
const cacheKey = `${key}:${value}`;
|
|
2732
|
-
if (labelCacheRef.current[cacheKey]) return labelCacheRef.current[cacheKey];
|
|
2733
|
-
let label = String(value ?? "");
|
|
2734
|
-
try {
|
|
2735
|
-
if (key === "customer_id" || key === "vendor_id") {
|
|
2736
|
-
const res = await getV1PartiesId({ ...getToken(), id: value });
|
|
2737
|
-
const p = ((_c = (_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.parties) == null ? void 0 : _b.party) == null ? void 0 : _c.data) || ((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.parties) == null ? void 0 : _e.party) || {};
|
|
2738
|
-
label = p.company_name || `${p.first_name || ""} ${p.last_name || ""}`.trim() || label;
|
|
2739
|
-
} else if (key === "payment_term_id") {
|
|
2740
|
-
const res = await getV1PaymentTermsId({ ...getToken(), id: value });
|
|
2741
|
-
const pt = ((_h = (_g = (_f = res == null ? void 0 : res.data) == null ? void 0 : _f.payment_term) == null ? void 0 : _g.payment_term) == null ? void 0 : _h.data) || {};
|
|
2742
|
-
label = pt.name || label;
|
|
2743
|
-
} else if (key === "account_payable_id" || key === "account_receivable_id") {
|
|
2744
|
-
const res = await getV1ChartOfAccountId({ ...getToken(), id: value });
|
|
2745
|
-
const c = ((_k = (_j = (_i = res == null ? void 0 : res.data) == null ? void 0 : _i.chart_of_account) == null ? void 0 : _j.account) == null ? void 0 : _k.data) || {};
|
|
2746
|
-
label = c.account_name || label;
|
|
2747
|
-
} else if (key === "company_id") {
|
|
2748
|
-
const res = await getV1CompanyId({ ...getToken(), id: value });
|
|
2749
|
-
const c = ((_m = (_l = res == null ? void 0 : res.data) == null ? void 0 : _l.company) == null ? void 0 : _m.data) || {};
|
|
2750
|
-
label = c.company_name || label;
|
|
2751
|
-
} else if (key === "currency_id" || key === "supplier_currency_id") {
|
|
2752
|
-
const res = await getV1CurrencyId({ ...getToken(), id: value });
|
|
2753
|
-
const c = ((_o = (_n = res == null ? void 0 : res.data) == null ? void 0 : _n.currency) == null ? void 0 : _o.data) || {};
|
|
2754
|
-
label = c.currency_name || label;
|
|
2755
|
-
} else if (key === "region_id") {
|
|
2756
|
-
const res = await getV1LocationsStates({ ...getToken(), id: Number(value) });
|
|
2757
|
-
const r = ((_p = res == null ? void 0 : res.data) == null ? void 0 : _p.state) || (res == null ? void 0 : res.data) || {};
|
|
2758
|
-
label = r.name || r.state_name || label;
|
|
2759
|
-
} else if (key === "location" || key.startsWith("invoice_addresses.shipping_address") || key.startsWith("invoice_addresses.billing_address") || key.startsWith("invoice_addresses.place_of_supply")) {
|
|
2760
|
-
const res = await getV1WarehouseLocationId({ ...getToken(), id: value });
|
|
2761
|
-
const wl = ((_s = (_r = (_q = res == null ? void 0 : res.data) == null ? void 0 : _q.warehouse_location) == null ? void 0 : _r.warehouse_location) == null ? void 0 : _s.data) || {};
|
|
2762
|
-
label = wl.name || label;
|
|
2763
|
-
} else if (key === "department" || key === "department_id") {
|
|
2764
|
-
const res = await getV1DepartmentsId({ ...getToken(), id: value });
|
|
2765
|
-
const d = ((_v = (_u = (_t = res == null ? void 0 : res.data) == null ? void 0 : _t.department) == null ? void 0 : _u.department) == null ? void 0 : _v.data) || {};
|
|
2766
|
-
label = d.name || label;
|
|
2767
|
-
} else if (key.startsWith("invoice_addresses.supplier_address") || key.startsWith("invoice_addresses.contact_person")) {
|
|
2768
|
-
const res = await getV1PartiesId({ ...getToken(), id: value });
|
|
2769
|
-
const p = ((_y = (_x = (_w = res == null ? void 0 : res.data) == null ? void 0 : _w.parties) == null ? void 0 : _x.party) == null ? void 0 : _y.data) || ((_A = (_z = res == null ? void 0 : res.data) == null ? void 0 : _z.parties) == null ? void 0 : _A.party) || {};
|
|
2770
|
-
label = p.company_name || `${p.first_name || ""} ${p.last_name || ""}`.trim() || label;
|
|
2771
|
-
}
|
|
2772
|
-
} catch {
|
|
2773
|
-
}
|
|
2774
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2775
|
-
return label;
|
|
2776
|
-
};
|
|
2777
|
-
const onFieldUpdates = async (updates) => {
|
|
2778
|
-
if (Object.keys(updates).length === 0) return;
|
|
2779
|
-
setCurrentFieldUpdates((prev) => ({ ...prev || {}, ...updates }));
|
|
2780
|
-
const newLabels = {};
|
|
2781
|
-
const expenseAccountIds = updates["purchase_expense_entries.accounts.account_name"];
|
|
2782
|
-
if (Array.isArray(expenseAccountIds)) {
|
|
2783
|
-
const accountPromises = expenseAccountIds.map(async (accountId) => {
|
|
2784
|
-
var _a2, _b, _c;
|
|
2785
|
-
const cacheKey = `purchase_expense_entries.accounts.account_name:${accountId}`;
|
|
2786
|
-
if (labelCacheRef.current[cacheKey]) {
|
|
2787
|
-
newLabels[cacheKey] = labelCacheRef.current[cacheKey];
|
|
2788
|
-
return;
|
|
2789
|
-
}
|
|
2790
|
-
try {
|
|
2791
|
-
const res = await getV1ChartOfAccountId({ ...getToken(), id: accountId });
|
|
2792
|
-
const c = ((_c = (_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.chart_of_account) == null ? void 0 : _b.account) == null ? void 0 : _c.data) || {};
|
|
2793
|
-
const label = c.account_name || `Account #${accountId}`;
|
|
2794
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2795
|
-
newLabels[cacheKey] = label;
|
|
2796
|
-
} catch {
|
|
2797
|
-
newLabels[cacheKey] = `Account #${accountId}`;
|
|
2798
|
-
}
|
|
2799
|
-
});
|
|
2800
|
-
await Promise.all(accountPromises);
|
|
2801
|
-
}
|
|
2802
|
-
const expenseTaxCodes = updates["purchase_expense_entries.tax_codes"];
|
|
2803
|
-
if (Array.isArray(expenseTaxCodes)) {
|
|
2804
|
-
const uniqueTaxIds = [...new Set(expenseTaxCodes.filter(Boolean))];
|
|
2805
|
-
const taxPromises = uniqueTaxIds.map(async (taxId) => {
|
|
2806
|
-
var _a2, _b;
|
|
2807
|
-
const cacheKey = `tax_code_data:${taxId}`;
|
|
2808
|
-
if (labelCacheRef.current[cacheKey]) {
|
|
2809
|
-
newLabels[cacheKey] = labelCacheRef.current[cacheKey];
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2812
|
-
try {
|
|
2813
|
-
const res = await getV1TaxCodeId({ ...getToken(), id: taxId });
|
|
2814
|
-
const taxCode = ((_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.taxCode) == null ? void 0 : _b.data) || {};
|
|
2815
|
-
const taxRate = Number(taxCode.rate) || 0;
|
|
2816
|
-
const taxName = taxCode.name || `Tax #${taxId}`;
|
|
2817
|
-
const label = JSON.stringify({ name: `${taxName} (${taxRate}%)`, rate: taxRate });
|
|
2818
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2819
|
-
newLabels[cacheKey] = label;
|
|
2820
|
-
} catch {
|
|
2821
|
-
newLabels[cacheKey] = JSON.stringify({ name: `Tax #${taxId}`, rate: 0 });
|
|
2822
|
-
}
|
|
2823
|
-
});
|
|
2824
|
-
await Promise.all(taxPromises);
|
|
2825
|
-
}
|
|
2826
|
-
const itemNames = updates["sales_item_entries.items.name"] || updates["purchase_item_entries.items.name"];
|
|
2827
|
-
const itemPrefix = updates["sales_item_entries.items.name"] ? "sales_item_entries" : "purchase_item_entries";
|
|
2828
|
-
if (Array.isArray(itemNames)) {
|
|
2829
|
-
const itemPromises = itemNames.map(async (itemId) => {
|
|
2830
|
-
var _a2;
|
|
2831
|
-
const cacheKey = `${itemPrefix}.items.name:${itemId}`;
|
|
2832
|
-
if (labelCacheRef.current[cacheKey]) {
|
|
2833
|
-
newLabels[cacheKey] = labelCacheRef.current[cacheKey];
|
|
2834
|
-
return;
|
|
2835
|
-
}
|
|
2836
|
-
try {
|
|
2837
|
-
const res = await getV1InventoryItemsId({ ...getToken(), id: itemId });
|
|
2838
|
-
const item = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) || {};
|
|
2839
|
-
const label = item.name || `Item #${itemId}`;
|
|
2840
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2841
|
-
newLabels[cacheKey] = label;
|
|
2842
|
-
} catch {
|
|
2843
|
-
newLabels[cacheKey] = `Item #${itemId}`;
|
|
2844
|
-
}
|
|
2845
|
-
});
|
|
2846
|
-
await Promise.all(itemPromises);
|
|
2847
|
-
}
|
|
2848
|
-
const taxCodes = updates["sales_item_entries.tax_codes"] || updates["purchase_item_entries.tax_codes"];
|
|
2849
|
-
if (Array.isArray(taxCodes)) {
|
|
2850
|
-
const uniqueTaxIds = [...new Set(taxCodes.filter(Boolean))];
|
|
2851
|
-
const taxPromises = uniqueTaxIds.map(async (taxId) => {
|
|
2852
|
-
var _a2, _b;
|
|
2853
|
-
const cacheKey = `tax_code_data:${taxId}`;
|
|
2854
|
-
if (labelCacheRef.current[cacheKey]) {
|
|
2855
|
-
newLabels[cacheKey] = labelCacheRef.current[cacheKey];
|
|
2856
|
-
return;
|
|
2857
|
-
}
|
|
2858
|
-
try {
|
|
2859
|
-
const res = await getV1TaxCodeId({ ...getToken(), id: taxId });
|
|
2860
|
-
const taxCode = ((_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.taxCode) == null ? void 0 : _b.data) || {};
|
|
2861
|
-
const taxRate = Number(taxCode.rate) || 0;
|
|
2862
|
-
const taxName = taxCode.name || `Tax #${taxId}`;
|
|
2863
|
-
const label = JSON.stringify({ name: `${taxName} (${taxRate}%)`, rate: taxRate });
|
|
2864
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2865
|
-
newLabels[cacheKey] = label;
|
|
2866
|
-
} catch {
|
|
2867
|
-
newLabels[cacheKey] = JSON.stringify({ name: `Tax #${taxId}`, rate: 0 });
|
|
2868
|
-
}
|
|
2869
|
-
});
|
|
2870
|
-
await Promise.all(taxPromises);
|
|
2871
|
-
}
|
|
2872
|
-
const uomKeys = ["sales_item_entries.units_of_measurement.uom_name", "sales_item_entries.units_of_measurement.name", "purchase_item_entries.units_of_measurement.uom_name"];
|
|
2873
|
-
const uomIdsForKey = uomKeys.find((k) => Array.isArray(updates[k]));
|
|
2874
|
-
if (uomIdsForKey) {
|
|
2875
|
-
const uomIds = updates[uomIdsForKey];
|
|
2876
|
-
const uomPrefix = uomIdsForKey.startsWith("sales") ? "sales_item_entries" : "purchase_item_entries";
|
|
2877
|
-
const uomPromises = uomIds.map(async (uomId) => {
|
|
2878
|
-
var _a2, _b;
|
|
2879
|
-
const cacheKey = `${uomPrefix}.units_of_measurement:${uomId}`;
|
|
2880
|
-
if (labelCacheRef.current[cacheKey]) {
|
|
2881
|
-
newLabels[cacheKey] = labelCacheRef.current[cacheKey];
|
|
2882
|
-
return;
|
|
2883
|
-
}
|
|
2884
|
-
try {
|
|
2885
|
-
const res = await getV1Uom({ ...getToken(), filters: JSON.stringify({ id: uomId }) });
|
|
2886
|
-
const uomList = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2["uom"]) || ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data) || [];
|
|
2887
|
-
const uom = Array.isArray(uomList) ? uomList[0] : uomList;
|
|
2888
|
-
const label = (uom == null ? void 0 : uom.name) || (uom == null ? void 0 : uom.uom_name) || `UOM #${uomId}`;
|
|
2889
|
-
labelCacheRef.current[cacheKey] = label;
|
|
2890
|
-
newLabels[cacheKey] = label;
|
|
2891
|
-
} catch {
|
|
2892
|
-
newLabels[cacheKey] = `UOM #${uomId}`;
|
|
2893
|
-
}
|
|
2894
|
-
});
|
|
2895
|
-
await Promise.all(uomPromises);
|
|
2896
|
-
}
|
|
2897
|
-
const promises = Object.entries(updates).map(async ([key, value]) => {
|
|
2898
|
-
if (value !== void 0 && value !== null && value !== "") {
|
|
2899
|
-
if (key === "sales_item_entries.items.name" || key === "purchase_item_entries.items.name" || key === "purchase_expense_entries.accounts.account_name") return;
|
|
2900
|
-
if (uomKeys.includes(key)) return;
|
|
2901
|
-
newLabels[key] = await resolveFieldLabel(key, value);
|
|
2902
|
-
}
|
|
2903
|
-
});
|
|
2904
|
-
await Promise.all(promises);
|
|
2905
|
-
setResolvedLabels((prev) => ({ ...prev, ...newLabels }));
|
|
2906
|
-
};
|
|
2907
|
-
const onChatSessionId = (sessionId) => {
|
|
2908
|
-
if (!isCurrentConversation()) return;
|
|
2909
|
-
chatSessionIdRef.current = sessionId;
|
|
2910
|
-
markActiveSession(sessionId);
|
|
2911
|
-
};
|
|
2912
|
-
try {
|
|
2913
|
-
if (mode === "smart") {
|
|
2914
|
-
const docsToPass = activeDocuments.length > 0 ? activeDocuments.map((d) => ({ doc_id: d.doc_id, filename: d.filename, sub_category: d.sub_category || "General" })) : activeDocument ? [{ doc_id: activeDocument.doc_id, filename: activeDocument.filename, sub_category: activeDocument.sub_category || "General" }] : void 0;
|
|
2915
|
-
await streamV1CopilotSmart(
|
|
2916
|
-
{ ...getToken(), query: text, docs: docsToPass, "x-timezone": (/* @__PURE__ */ new Date()).getTimezoneOffset(), session_id: smartSessionIdRef.current || void 0 },
|
|
2917
|
-
appendToken,
|
|
2918
|
-
onDone,
|
|
2919
|
-
onError,
|
|
2920
|
-
onOffTopic,
|
|
2921
|
-
void 0,
|
|
2922
|
-
(planData) => {
|
|
2923
|
-
},
|
|
2924
|
-
onFieldUpdates,
|
|
2925
|
-
(citationsData) => {
|
|
2926
|
-
if (citationsData && citationsData.length > 0) {
|
|
2927
|
-
const docGroups = {};
|
|
2928
|
-
citationsData.forEach((c) => {
|
|
2929
|
-
const key = c.doc_id || c.filename;
|
|
2930
|
-
if (!docGroups[key]) {
|
|
2931
|
-
docGroups[key] = { filename: c.filename, chunks: [] };
|
|
2932
|
-
}
|
|
2933
|
-
docGroups[key].chunks.push(c);
|
|
2934
|
-
});
|
|
2935
|
-
let citationText = "\n\n**Sources:**\n\n";
|
|
2936
|
-
Object.values(docGroups).forEach((group) => {
|
|
2937
|
-
citationText += `📄 **${group.filename}**
|
|
2938
|
-
`;
|
|
2939
|
-
const pages = [...new Set(group.chunks.map((c) => c.page_num).filter((p) => p !== void 0 && p !== null))].sort((a, b) => a - b);
|
|
2940
|
-
if (pages.length > 0) {
|
|
2941
|
-
if (pages.length === 1) {
|
|
2942
|
-
citationText += ` Page ${pages[0]}
|
|
2943
|
-
|
|
2944
|
-
`;
|
|
2945
|
-
} else {
|
|
2946
|
-
citationText += ` Pages ${pages[0]}–${pages[pages.length - 1]}
|
|
2947
|
-
|
|
2948
|
-
`;
|
|
2949
|
-
}
|
|
2950
|
-
} else {
|
|
2951
|
-
citationText += "\n";
|
|
2952
|
-
}
|
|
2953
|
-
});
|
|
2954
|
-
appendToken(citationText);
|
|
2955
|
-
}
|
|
2956
|
-
},
|
|
2957
|
-
async (action) => {
|
|
2958
|
-
if (["save_draft", "submit_form", "discard_form"].includes(action)) {
|
|
2959
|
-
setPendingFormAction(action);
|
|
2960
|
-
}
|
|
2961
|
-
},
|
|
2962
|
-
(status) => {
|
|
2963
|
-
setFormStatus(status);
|
|
2964
|
-
},
|
|
2965
|
-
(newFormType) => {
|
|
2966
|
-
setFormType(newFormType);
|
|
2967
|
-
},
|
|
2968
|
-
(sessionId) => {
|
|
2969
|
-
if (!isCurrentConversation()) return;
|
|
2970
|
-
smartSessionIdRef.current = sessionId;
|
|
2971
|
-
markActiveSession(sessionId);
|
|
2972
|
-
},
|
|
2973
|
-
(formSessionId) => {
|
|
2974
|
-
formSessionIdRef.current = formSessionId;
|
|
2975
|
-
},
|
|
2976
|
-
onBlocks
|
|
2977
|
-
);
|
|
2978
|
-
} else if (mode === "doc_qa") {
|
|
2979
|
-
if (activeDocuments && activeDocuments.length > 0) {
|
|
2980
|
-
await streamV1CopilotChat(
|
|
2981
|
-
{ ...getToken(), query: text, doc_ids: activeDocuments.map((d) => d.doc_id), session_id: chatSessionIdRef.current || void 0 },
|
|
2982
|
-
appendToken,
|
|
2983
|
-
onDone,
|
|
2984
|
-
onError,
|
|
2985
|
-
onOffTopic,
|
|
2986
|
-
void 0,
|
|
2987
|
-
onChatSessionId
|
|
2988
|
-
);
|
|
2989
|
-
} else if (activeDocument) {
|
|
2990
|
-
await streamV1CopilotChat(
|
|
2991
|
-
{ ...getToken(), query: text, doc_id: activeDocument.doc_id, session_id: chatSessionIdRef.current || void 0 },
|
|
2992
|
-
appendToken,
|
|
2993
|
-
onDone,
|
|
2994
|
-
onError,
|
|
2995
|
-
onOffTopic,
|
|
2996
|
-
void 0,
|
|
2997
|
-
onChatSessionId
|
|
2998
|
-
);
|
|
2999
|
-
}
|
|
3000
|
-
} else if (mode === "agent" && formType) {
|
|
3001
|
-
if (!agentStarted.current) {
|
|
3002
|
-
await startV1CopilotAgent(
|
|
3003
|
-
{ ...getToken(), form_type: formType },
|
|
3004
|
-
appendToken,
|
|
3005
|
-
() => {
|
|
3006
|
-
agentStarted.current = true;
|
|
3007
|
-
},
|
|
3008
|
-
onError,
|
|
3009
|
-
onOffTopic
|
|
3010
|
-
);
|
|
3011
|
-
}
|
|
3012
|
-
await formAssistV1Copilot(
|
|
3013
|
-
{ ...getToken(), message: text },
|
|
3014
|
-
appendToken,
|
|
3015
|
-
onDone,
|
|
3016
|
-
onError,
|
|
3017
|
-
onFieldUpdates,
|
|
3018
|
-
async (action) => {
|
|
3019
|
-
if (["save_draft", "submit_form", "discard_form"].includes(action)) {
|
|
3020
|
-
try {
|
|
3021
|
-
const token = getToken()["x-token"];
|
|
3022
|
-
const sessionId = "current_session";
|
|
3023
|
-
if (action === "submit_form") {
|
|
3024
|
-
await postV1CopilotSubmit(sessionId, token, formType, currentFieldUpdates);
|
|
3025
|
-
toast.success("Form submitted successfully!");
|
|
3026
|
-
} else if (action === "save_draft") {
|
|
3027
|
-
await postV1CopilotSaveDraft(sessionId, token, formType, currentFieldUpdates);
|
|
3028
|
-
toast.success("Draft saved successfully!");
|
|
3029
|
-
} else if (action === "discard_form") {
|
|
3030
|
-
await postV1CopilotDiscard(sessionId, token, formType, currentFieldUpdates);
|
|
3031
|
-
toast.success("Form discarded");
|
|
3032
|
-
}
|
|
3033
|
-
agentStarted.current = false;
|
|
3034
|
-
setCurrentFieldUpdates(null);
|
|
3035
|
-
setResolvedLabels({});
|
|
3036
|
-
labelCacheRef.current = {};
|
|
3037
|
-
setFormStatus("in_progress");
|
|
3038
|
-
} catch (e) {
|
|
3039
|
-
console.error("Failed to perform copilot action", e);
|
|
3040
|
-
let errMsg = "Action failed. Please try again.";
|
|
3041
|
-
try {
|
|
3042
|
-
const parsed = JSON.parse(e.message);
|
|
3043
|
-
if (parsed.message) errMsg = parsed.message;
|
|
3044
|
-
} catch (err) {
|
|
3045
|
-
if (e.message) errMsg = e.message;
|
|
3046
|
-
}
|
|
3047
|
-
toast.error(errMsg);
|
|
3048
|
-
setMessages((prev) => [
|
|
3049
|
-
...prev,
|
|
3050
|
-
{
|
|
3051
|
-
id: Date.now(),
|
|
3052
|
-
role: "ai",
|
|
3053
|
-
text: `Validation Error: ${errMsg}
|
|
3054
|
-
|
|
3055
|
-
Please correct the details and try again.`,
|
|
3056
|
-
time: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
|
|
3057
|
-
mode: "agent"
|
|
3058
|
-
}
|
|
3059
|
-
]);
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
},
|
|
3063
|
-
(status) => {
|
|
3064
|
-
console.log("Copilot Form Status:", status);
|
|
3065
|
-
setFormStatus(status);
|
|
3066
|
-
}
|
|
3067
|
-
);
|
|
3068
|
-
} else {
|
|
3069
|
-
await streamV1CopilotChat(
|
|
3070
|
-
{ ...getToken(), query: text, "x-timezone": (/* @__PURE__ */ new Date()).getTimezoneOffset(), session_id: chatSessionIdRef.current || void 0 },
|
|
3071
|
-
appendToken,
|
|
3072
|
-
onDone,
|
|
3073
|
-
onError,
|
|
3074
|
-
onOffTopic,
|
|
3075
|
-
void 0,
|
|
3076
|
-
onChatSessionId
|
|
3077
|
-
);
|
|
3078
|
-
}
|
|
3079
|
-
} catch {
|
|
3080
|
-
setIsTyping(false);
|
|
3081
|
-
if (aiMsgId === null) {
|
|
3082
|
-
setTurnMessages((prev) => [
|
|
3083
|
-
...prev,
|
|
3084
|
-
{ id: Date.now() + 1, role: "ai", text: "Connection error. Please try again.", time: getTime(), mode }
|
|
3085
|
-
]);
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
|
-
},
|
|
3089
|
-
[isTyping, mode, formType, activeDocument, activeDocuments]
|
|
3090
|
-
);
|
|
3091
|
-
const handleKeyDown = (e) => {
|
|
3092
|
-
if (showSlashMenu && filteredCommands.length > 0) {
|
|
3093
|
-
if (e.key === "ArrowDown") {
|
|
3094
|
-
e.preventDefault();
|
|
3095
|
-
setSlashIndex((i) => (i + 1) % filteredCommands.length);
|
|
3096
|
-
return;
|
|
3097
|
-
}
|
|
3098
|
-
if (e.key === "ArrowUp") {
|
|
3099
|
-
e.preventDefault();
|
|
3100
|
-
setSlashIndex((i) => (i - 1 + filteredCommands.length) % filteredCommands.length);
|
|
3101
|
-
return;
|
|
3102
|
-
}
|
|
3103
|
-
if (e.key === "Enter" || e.key === "Tab") {
|
|
3104
|
-
e.preventDefault();
|
|
3105
|
-
const cmdId = filteredCommands[slashIndex].id;
|
|
3106
|
-
setInputValue("");
|
|
3107
|
-
selectCommand(cmdId);
|
|
3108
|
-
return;
|
|
3109
|
-
}
|
|
3110
|
-
if (e.key === "Escape") {
|
|
3111
|
-
setShowSlashMenu(false);
|
|
3112
|
-
setInputValue("");
|
|
3113
|
-
return;
|
|
3114
|
-
}
|
|
3115
|
-
}
|
|
3116
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
3117
|
-
e.preventDefault();
|
|
3118
|
-
sendMessage(inputValue);
|
|
3119
|
-
}
|
|
3120
|
-
};
|
|
3121
|
-
const executeSmartFormAction = useCallback(async (action) => {
|
|
3122
|
-
const sessionId = formSessionIdRef.current;
|
|
3123
|
-
if (!sessionId) {
|
|
3124
|
-
toast.error("No active form session to act on.");
|
|
3125
|
-
return;
|
|
3126
|
-
}
|
|
3127
|
-
try {
|
|
3128
|
-
const token = getToken()["x-token"];
|
|
3129
|
-
if (action === "submit_form") {
|
|
3130
|
-
await postV1CopilotSubmit(sessionId, token, formType, currentFieldUpdates);
|
|
3131
|
-
toast.success("Form submitted successfully!");
|
|
3132
|
-
} else if (action === "save_draft") {
|
|
3133
|
-
await postV1CopilotSaveDraft(sessionId, token, formType, currentFieldUpdates);
|
|
3134
|
-
toast.success("Draft saved successfully!");
|
|
3135
|
-
} else {
|
|
3136
|
-
await postV1CopilotDiscard(sessionId, token, formType, currentFieldUpdates);
|
|
3137
|
-
toast.success("Form discarded");
|
|
3138
|
-
}
|
|
3139
|
-
agentStarted.current = false;
|
|
3140
|
-
setCurrentFieldUpdates(null);
|
|
3141
|
-
setResolvedLabels({});
|
|
3142
|
-
labelCacheRef.current = {};
|
|
3143
|
-
setFormStatus("in_progress");
|
|
3144
|
-
setFormType(null);
|
|
3145
|
-
setPendingFormAction(null);
|
|
3146
|
-
smartSessionIdRef.current = null;
|
|
3147
|
-
formSessionIdRef.current = null;
|
|
3148
|
-
} catch (e) {
|
|
3149
|
-
console.error("Failed to perform copilot action", e);
|
|
3150
|
-
let errMsg = "Action failed. Please try again.";
|
|
3151
|
-
try {
|
|
3152
|
-
const parsed = JSON.parse(e.message);
|
|
3153
|
-
if (parsed.message) errMsg = parsed.message;
|
|
3154
|
-
} catch {
|
|
3155
|
-
if (e.message) errMsg = e.message;
|
|
3156
|
-
}
|
|
3157
|
-
toast.error(errMsg);
|
|
3158
|
-
setMessages((prev) => [
|
|
3159
|
-
...prev,
|
|
3160
|
-
{
|
|
3161
|
-
id: Date.now(),
|
|
3162
|
-
role: "ai",
|
|
3163
|
-
text: `Validation Error: ${errMsg}
|
|
3164
|
-
|
|
3165
|
-
Please correct the details and try again.`,
|
|
3166
|
-
time: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
|
|
3167
|
-
mode: "smart"
|
|
3168
|
-
}
|
|
3169
|
-
]);
|
|
3170
|
-
}
|
|
3171
|
-
}, [formType, currentFieldUpdates]);
|
|
3172
|
-
const handleSave = useCallback(async () => {
|
|
3173
|
-
if (mode === "smart") return executeSmartFormAction("save_draft");
|
|
3174
|
-
await sendMessage("Save the draft");
|
|
3175
|
-
}, [mode, executeSmartFormAction, sendMessage]);
|
|
3176
|
-
const handleDiscard = useCallback(async () => {
|
|
3177
|
-
if (mode === "smart") return executeSmartFormAction("discard_form");
|
|
3178
|
-
await sendMessage("Discard this form");
|
|
3179
|
-
}, [mode, executeSmartFormAction, sendMessage]);
|
|
3180
|
-
const handleSubmit = useCallback(async () => {
|
|
3181
|
-
if (mode === "smart") return executeSmartFormAction("submit_form");
|
|
3182
|
-
await sendMessage("Submit this form");
|
|
3183
|
-
}, [mode, executeSmartFormAction, sendMessage]);
|
|
3184
|
-
const handleNewChat = useCallback(async () => {
|
|
3185
|
-
conversationRef.current += 1;
|
|
3186
|
-
const { "x-token": token } = getToken();
|
|
3187
|
-
await resetV1CopilotSession(token);
|
|
3188
|
-
setIsTyping(false);
|
|
3189
|
-
setFormType(null);
|
|
3190
|
-
setFormStatus("in_progress");
|
|
3191
|
-
setPendingFormAction(null);
|
|
3192
|
-
agentStarted.current = false;
|
|
3193
|
-
smartSessionIdRef.current = null;
|
|
3194
|
-
chatSessionIdRef.current = null;
|
|
3195
|
-
formSessionIdRef.current = null;
|
|
3196
|
-
setCurrentFieldUpdates(null);
|
|
3197
|
-
setResolvedLabels({});
|
|
3198
|
-
labelCacheRef.current = {};
|
|
3199
|
-
setActiveDocument(null);
|
|
3200
|
-
setDocIntroSent(false);
|
|
3201
|
-
setDocError(null);
|
|
3202
|
-
setActiveDocuments([]);
|
|
3203
|
-
setSuggestedQuestions([]);
|
|
3204
|
-
setMessages([]);
|
|
3205
|
-
fetchedMultiDocIntroIds.current = "";
|
|
3206
|
-
tabStateRef.current = {};
|
|
3207
|
-
fetchQuestions();
|
|
3208
|
-
}, [fetchQuestions]);
|
|
3209
|
-
useEffect(() => {
|
|
3210
|
-
activeSessionIdRef.current = activeSessionId;
|
|
3211
|
-
}, [activeSessionId]);
|
|
3212
|
-
useEffect(() => {
|
|
3213
|
-
if (messages.length === 0) {
|
|
3214
|
-
activeSessionIdRef.current = null;
|
|
3215
|
-
setActiveSessionId(null);
|
|
3216
|
-
}
|
|
3217
|
-
}, [messages.length]);
|
|
3218
|
-
const wasTypingRef = useRef(false);
|
|
3219
|
-
const refreshHistory = chatHistory.refresh;
|
|
3220
|
-
useEffect(() => {
|
|
3221
|
-
if (wasTypingRef.current && !isTyping && historyOpen) refreshHistory(true);
|
|
3222
|
-
wasTypingRef.current = isTyping;
|
|
3223
|
-
}, [isTyping, historyOpen, refreshHistory]);
|
|
3224
|
-
const handleOpenSession = useCallback(async (session) => {
|
|
3225
|
-
if (session.id === activeSessionIdRef.current) return;
|
|
3226
|
-
const conversation = ++conversationRef.current;
|
|
3227
|
-
let detail;
|
|
3228
|
-
try {
|
|
3229
|
-
detail = await chatHistory.openSession(session);
|
|
3230
|
-
} catch (e) {
|
|
3231
|
-
if (conversation !== conversationRef.current) return;
|
|
3232
|
-
toast.error((e == null ? void 0 : e.message) || "Failed to open chat");
|
|
3233
|
-
refreshHistory();
|
|
3234
|
-
return;
|
|
3235
|
-
}
|
|
3236
|
-
if (conversation !== conversationRef.current) return;
|
|
3237
|
-
try {
|
|
3238
|
-
await resetV1CopilotSession(getToken()["x-token"]);
|
|
3239
|
-
} catch {
|
|
3240
|
-
}
|
|
3241
|
-
if (conversation !== conversationRef.current) return;
|
|
3242
|
-
const sessionMode = session.service === "copilot_smart" ? "smart" : "conversation";
|
|
3243
|
-
setIsTyping(false);
|
|
3244
|
-
setFormType(null);
|
|
3245
|
-
setFormStatus("in_progress");
|
|
3246
|
-
setPendingFormAction(null);
|
|
3247
|
-
agentStarted.current = false;
|
|
3248
|
-
smartSessionIdRef.current = null;
|
|
3249
|
-
formSessionIdRef.current = null;
|
|
3250
|
-
setCurrentFieldUpdates(null);
|
|
3251
|
-
setResolvedLabels({});
|
|
3252
|
-
labelCacheRef.current = {};
|
|
3253
|
-
setActiveDocument(null);
|
|
3254
|
-
setDocIntroSent(false);
|
|
3255
|
-
setDocError(null);
|
|
3256
|
-
setActiveDocuments([]);
|
|
3257
|
-
setSuggestedQuestions([]);
|
|
3258
|
-
fetchedMultiDocIntroIds.current = "";
|
|
3259
|
-
tabStateRef.current = {};
|
|
3260
|
-
userScrolledUp.current = false;
|
|
3261
|
-
smartSessionIdRef.current = session.service === "copilot_smart" ? session.id : null;
|
|
3262
|
-
chatSessionIdRef.current = session.service === "copilot_chat" ? session.id : null;
|
|
3263
|
-
markActiveSession(session.id);
|
|
3264
|
-
setMode(sessionMode);
|
|
3265
|
-
setMessages(toChatMessages(detail.messages || [], sessionMode));
|
|
3266
|
-
}, [chatHistory.openSession, refreshHistory]);
|
|
3267
|
-
const handleConfirmDeleteSession = useCallback(async () => {
|
|
3268
|
-
const session = pendingDeleteSession;
|
|
3269
|
-
if (!session) return;
|
|
3270
|
-
setDeletingSession(true);
|
|
3271
|
-
try {
|
|
3272
|
-
await chatHistory.removeSession(session);
|
|
3273
|
-
if (session.id === activeSessionIdRef.current) handleNewChat();
|
|
3274
|
-
setPendingDeleteSession(null);
|
|
3275
|
-
} catch (e) {
|
|
3276
|
-
toast.error((e == null ? void 0 : e.message) || "Failed to delete chat");
|
|
3277
|
-
setPendingDeleteSession(null);
|
|
3278
|
-
refreshHistory();
|
|
3279
|
-
} finally {
|
|
3280
|
-
setDeletingSession(false);
|
|
3281
|
-
}
|
|
3282
|
-
}, [pendingDeleteSession, chatHistory.removeSession, handleNewChat, refreshHistory]);
|
|
3283
|
-
const historyPanelProps = {
|
|
3284
|
-
sessions: chatHistory.sessions,
|
|
3285
|
-
activeId: activeSessionId,
|
|
3286
|
-
onClose: () => setHistoryOpen(false),
|
|
3287
|
-
onDelete: setPendingDeleteSession,
|
|
3288
|
-
loading: chatHistory.loading,
|
|
3289
|
-
error: chatHistory.error,
|
|
3290
|
-
onRetry: () => refreshHistory(),
|
|
3291
|
-
hasMore: chatHistory.hasMore,
|
|
3292
|
-
loadingMore: chatHistory.loadingMore,
|
|
3293
|
-
onLoadMore: chatHistory.loadMore,
|
|
3294
|
-
unavailableMessage: historyService ? null : "History isn't available for Agent mode."
|
|
3295
|
-
};
|
|
3296
|
-
const isEmptyChat = filteredMessages.length === 0 && !activeDocument && activeDocuments.length === 0;
|
|
3297
|
-
const centerInput = inline && dashboardMode && isEmptyChat;
|
|
3298
|
-
const dashboardChatActive = inline && dashboardMode && !isEmptyChat;
|
|
3299
|
-
useEffect(() => {
|
|
3300
|
-
if (inline && dashboardMode) setChatActive(dashboardChatActive);
|
|
3301
|
-
}, [inline, dashboardMode, dashboardChatActive]);
|
|
3302
|
-
useEffect(() => () => {
|
|
3303
|
-
if (inline && dashboardMode) setChatActive(false);
|
|
3304
|
-
}, [inline, dashboardMode]);
|
|
3305
|
-
const chatInput = /* @__PURE__ */ jsx(
|
|
3306
|
-
ChatBotInput,
|
|
3307
|
-
{
|
|
3308
|
-
inputValue,
|
|
3309
|
-
isTyping,
|
|
3310
|
-
mode,
|
|
3311
|
-
formType,
|
|
3312
|
-
showSlashMenu,
|
|
3313
|
-
filteredCommands,
|
|
3314
|
-
slashIndex,
|
|
3315
|
-
textareaRef,
|
|
3316
|
-
onChange: handleInputChange,
|
|
3317
|
-
onKeyDown: handleKeyDown,
|
|
3318
|
-
onSend: () => sendMessage(inputValue),
|
|
3319
|
-
onSlashHover: setSlashIndex,
|
|
3320
|
-
onSlashSelect: selectCommand,
|
|
3321
|
-
onModeChange: handleModeChange,
|
|
3322
|
-
onFormTypeChange: setFormType,
|
|
3323
|
-
activeDocument,
|
|
3324
|
-
activeDocuments,
|
|
3325
|
-
onDocDelete: handleDocDelete,
|
|
3326
|
-
onDocUpload: () => setShowUploadArea(!showUploadArea),
|
|
3327
|
-
onMultiDocDelete: handleMultiDocDelete
|
|
3328
|
-
}
|
|
3329
|
-
);
|
|
3330
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3331
|
-
(isOpen || inline) && /* @__PURE__ */ jsxs(
|
|
3332
|
-
"div",
|
|
3333
|
-
{
|
|
3334
|
-
ref: panelRef,
|
|
3335
|
-
className: `chatBot--panel ${inline ? "chatBot--panel--inline" : ""} ${inline && dashboardMode ? "chatBot--panel--dashboard" : ""}`,
|
|
3336
|
-
style: panelHeight ? { height: panelHeight, minHeight: 0 } : void 0,
|
|
3337
|
-
children: [
|
|
3338
|
-
inline && /* @__PURE__ */ jsxs("div", { className: "chatBot--history-bar", children: [
|
|
3339
|
-
(filteredMessages.length > 0 || activeDocument || activeDocuments.length > 0) && /* @__PURE__ */ jsx(ChatBotNewChatButton, { onClick: handleNewChat }),
|
|
3340
|
-
/* @__PURE__ */ jsx(ChatBotHistoryButton, { open: historyOpen, onClick: () => setHistoryOpen((o) => !o) })
|
|
3341
|
-
] }),
|
|
3342
|
-
inline && (filteredMessages.length > 0 || activeDocument || activeDocuments.length > 0) && /* @__PURE__ */ jsx("div", { className: "chatBot--inline-actions", children: /* @__PURE__ */ jsx("button", { className: "chatBot--new-chat-btn", onClick: handleNewChat, title: "New Chat", children: /* @__PURE__ */ jsx(Add, { style: { fontSize: 20 } }) }) }),
|
|
3343
|
-
!inline && /* @__PURE__ */ jsx(
|
|
3344
|
-
ChatBotHeader,
|
|
3345
|
-
{
|
|
3346
|
-
onClose: () => setIsOpen(false),
|
|
3347
|
-
onNewChat: () => {
|
|
3348
|
-
setHistoryOpen(false);
|
|
3349
|
-
handleNewChat();
|
|
3350
|
-
},
|
|
3351
|
-
sessionTokens: messages.reduce((sum, m) => sum + (m.tokens ?? 0), 0),
|
|
3352
|
-
sessionMs: messages.reduce((sum, m) => sum + (m.durationMs ?? 0), 0),
|
|
3353
|
-
onHistory: () => setHistoryOpen((o) => !o),
|
|
3354
|
-
historyOpen
|
|
3355
|
-
}
|
|
3356
|
-
),
|
|
3357
|
-
!inline && /* @__PURE__ */ jsx(
|
|
3358
|
-
ChatBotHistory,
|
|
3359
|
-
{
|
|
3360
|
-
...historyPanelProps,
|
|
3361
|
-
variant: "embedded",
|
|
3362
|
-
open: historyOpen,
|
|
3363
|
-
onSelect: (session) => {
|
|
3364
|
-
setHistoryOpen(false);
|
|
3365
|
-
handleOpenSession(session);
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
|
-
),
|
|
3369
|
-
/* @__PURE__ */ jsxs("div", { className: `chatBot--main-view ${!inline && historyOpen ? "chatBot--main-view--hidden" : ""}`, children: [
|
|
3370
|
-
filteredMessages.length === 0 && !activeDocument && activeDocuments.length === 0 ? /* @__PURE__ */ jsx("div", { ref: bodyRef, className: "chatBot--body", children: /* @__PURE__ */ jsx(ChatBotWelcome, { firstName, onSuggestion: handleSuggestion, dynamicQuestions, mode, dashboardMode, inputSlot: centerInput ? chatInput : void 0 }) }) : /* @__PURE__ */ jsx(
|
|
3371
|
-
ChatBotMessages,
|
|
3372
|
-
{
|
|
3373
|
-
messages: filteredMessages,
|
|
3374
|
-
isTyping,
|
|
3375
|
-
bodyRef,
|
|
3376
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3377
|
-
activeDocument && activeDocuments.length === 0 && (mode === "doc_qa" || mode === "smart") && activeDocument.status === "ready" && !docIntroSent && /* @__PURE__ */ jsx(
|
|
3378
|
-
DocIntro,
|
|
3379
|
-
{
|
|
3380
|
-
document: activeDocument,
|
|
3381
|
-
onSuggestion: (q) => {
|
|
3382
|
-
setDocIntroSent(true);
|
|
3383
|
-
setInputValue(q);
|
|
3384
|
-
setTimeout(() => sendMessage(q), 0);
|
|
3385
|
-
}
|
|
3386
|
-
}
|
|
3387
|
-
),
|
|
3388
|
-
activeDocuments.length > 0 && (mode === "doc_qa" || mode === "smart") && activeDocuments.every((d) => d.status === "ready") && !docIntroSent && /* @__PURE__ */ jsx(
|
|
3389
|
-
DocIntro,
|
|
3390
|
-
{
|
|
3391
|
-
documents: activeDocuments,
|
|
3392
|
-
suggestedQuestions: suggestedQuestions.length > 0 ? suggestedQuestions : activeDocuments[0].suggested_questions,
|
|
3393
|
-
onSuggestion: (q) => {
|
|
3394
|
-
setDocIntroSent(true);
|
|
3395
|
-
setInputValue(q);
|
|
3396
|
-
setTimeout(() => sendMessage(q), 0);
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
),
|
|
3400
|
-
currentFieldUpdates && (mode === "agent" || mode === "smart") && /* @__PURE__ */ jsx(
|
|
3401
|
-
InvoicePreview,
|
|
3402
|
-
{
|
|
3403
|
-
fieldUpdates: currentFieldUpdates,
|
|
3404
|
-
resolvedLabels,
|
|
3405
|
-
formStatus,
|
|
3406
|
-
useActionGating: mode === "smart",
|
|
3407
|
-
pendingFormAction,
|
|
3408
|
-
onSave: handleSave,
|
|
3409
|
-
onDiscard: handleDiscard,
|
|
3410
|
-
onSubmit: handleSubmit
|
|
3411
|
-
}
|
|
3412
|
-
)
|
|
3413
|
-
] })
|
|
3414
|
-
}
|
|
3415
|
-
),
|
|
3416
|
-
(mode === "doc_qa" || mode === "smart" && showUploadArea) && !activeDocument && activeDocuments.length === 0 && /* @__PURE__ */ jsxs("div", { className: "chatBot--doc-upload-area", children: [
|
|
3417
|
-
/* @__PURE__ */ jsx(
|
|
3418
|
-
DocUpload,
|
|
3419
|
-
{
|
|
3420
|
-
onUploadComplete: (docs) => {
|
|
3421
|
-
if (docs.length === 1 && (!activeDocuments || activeDocuments.length === 0)) {
|
|
3422
|
-
handleDocUploadComplete(docs[0]);
|
|
3423
|
-
} else {
|
|
3424
|
-
handleMultiDocUploadComplete(docs);
|
|
3425
|
-
}
|
|
3426
|
-
},
|
|
3427
|
-
onUploadError: handleDocUploadError,
|
|
3428
|
-
uploadDocument: handleDocUpload,
|
|
3429
|
-
uploadDocuments: handleMultiDocUpload
|
|
3430
|
-
}
|
|
3431
|
-
),
|
|
3432
|
-
docError && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-error", children: docError })
|
|
3433
|
-
] }),
|
|
3434
|
-
activeDocument && activeDocuments.length === 0 && (mode === "doc_qa" || mode === "smart") && ["pending", "processing", "parsing", "embedding", "indexing"].includes(activeDocument.status) && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-status-area", children: /* @__PURE__ */ jsx(
|
|
3435
|
-
DocStatus,
|
|
3436
|
-
{
|
|
3437
|
-
document: activeDocument,
|
|
3438
|
-
onReady: handleDocReady,
|
|
3439
|
-
onError: handleDocError,
|
|
3440
|
-
getStatus: async (docId) => {
|
|
3441
|
-
const { "x-token": token } = getToken();
|
|
3442
|
-
const res = await getDocumentStatus(docId, token);
|
|
3443
|
-
return {
|
|
3444
|
-
doc_id: res.doc_id,
|
|
3445
|
-
filename: res.filename || activeDocument.filename,
|
|
3446
|
-
status: res.status,
|
|
3447
|
-
pages: res.pages || activeDocument.pages,
|
|
3448
|
-
category: res.category || void 0,
|
|
3449
|
-
sub_category: res.sub_category || void 0,
|
|
3450
|
-
chunk_count: res.chunk_count || void 0,
|
|
3451
|
-
error: res.error || void 0,
|
|
3452
|
-
error_code: res.error_code || void 0
|
|
3453
|
-
};
|
|
3454
|
-
}
|
|
3455
|
-
},
|
|
3456
|
-
activeDocument.doc_id
|
|
3457
|
-
) }),
|
|
3458
|
-
(mode === "doc_qa" || mode === "smart") && activeDocuments.length > 0 && activeDocuments.some((d) => ["pending", "processing", "parsing", "embedding", "indexing"].includes(d.status)) && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-status-area chatBot--doc-status-area--multiple", children: activeDocuments.filter((d) => ["pending", "processing", "parsing", "embedding", "indexing"].includes(d.status)).map((doc) => /* @__PURE__ */ jsx(
|
|
3459
|
-
DocStatus,
|
|
3460
|
-
{
|
|
3461
|
-
document: doc,
|
|
3462
|
-
onReady: handleMultiDocReady,
|
|
3463
|
-
onError: handleMultiDocError,
|
|
3464
|
-
getStatus: async (docId) => {
|
|
3465
|
-
const { "x-token": token } = getToken();
|
|
3466
|
-
const res = await getDocumentStatus(docId, token);
|
|
3467
|
-
return {
|
|
3468
|
-
doc_id: res.doc_id,
|
|
3469
|
-
filename: res.filename || doc.filename,
|
|
3470
|
-
status: res.status,
|
|
3471
|
-
pages: res.pages || doc.pages,
|
|
3472
|
-
category: res.category || void 0,
|
|
3473
|
-
sub_category: res.sub_category || void 0,
|
|
3474
|
-
chunk_count: res.chunk_count || void 0,
|
|
3475
|
-
error: res.error || void 0,
|
|
3476
|
-
error_code: res.error_code || void 0
|
|
3477
|
-
};
|
|
3478
|
-
}
|
|
3479
|
-
},
|
|
3480
|
-
doc.doc_id
|
|
3481
|
-
)) }),
|
|
3482
|
-
docError && (mode === "doc_qa" || mode === "smart") && !!(activeDocument || activeDocuments.length > 0) && /* @__PURE__ */ jsx("div", { className: "chatBot--doc-error-floating", onClick: () => setDocError(null), children: docError }),
|
|
3483
|
-
!centerInput && chatInput
|
|
3484
|
-
] })
|
|
3485
|
-
]
|
|
3486
|
-
}
|
|
3487
|
-
),
|
|
3488
|
-
inline && /* @__PURE__ */ jsx(
|
|
3489
|
-
ChatBotHistory,
|
|
3490
|
-
{
|
|
3491
|
-
...historyPanelProps,
|
|
3492
|
-
open: historyOpen,
|
|
3493
|
-
onSelect: handleOpenSession
|
|
3494
|
-
}
|
|
3495
|
-
),
|
|
3496
|
-
/* @__PURE__ */ jsx(
|
|
3497
|
-
ConfirmPopUp,
|
|
3498
|
-
{
|
|
3499
|
-
open: !!pendingDeleteSession,
|
|
3500
|
-
title: "Delete chat",
|
|
3501
|
-
description: `"${(pendingDeleteSession == null ? void 0 : pendingDeleteSession.title) ?? ""}" will be permanently deleted. This cannot be undone.`,
|
|
3502
|
-
loading: deletingSession,
|
|
3503
|
-
onClose: () => !deletingSession && setPendingDeleteSession(null),
|
|
3504
|
-
onConfirm: handleConfirmDeleteSession
|
|
3505
|
-
}
|
|
3506
|
-
),
|
|
3507
|
-
!isOpen && !inline && /* @__PURE__ */ jsx(ChatBotLauncher, { onOpen: () => setIsOpen(true) })
|
|
3508
|
-
] });
|
|
3509
|
-
};
|
|
3510
|
-
export {
|
|
3511
|
-
ACCEPTED_FILE_EXTENSIONS as A,
|
|
3512
|
-
getGreeting as B,
|
|
3513
|
-
ChatBot as C,
|
|
3514
|
-
DocIntro as D,
|
|
3515
|
-
ExpenseEntryTable as E,
|
|
3516
|
-
FORM_TYPE_LABELS as F,
|
|
3517
|
-
getTime as G,
|
|
3518
|
-
INSIGHTS as I,
|
|
3519
|
-
SLASH_COMMANDS as S,
|
|
3520
|
-
ACCEPT_ATTR as a,
|
|
3521
|
-
ChatBotHeader as b,
|
|
3522
|
-
ChatBotInput as c,
|
|
3523
|
-
ChatBotLauncher as d,
|
|
3524
|
-
ChatBotMessages as e,
|
|
3525
|
-
ChatBotWelcome as f,
|
|
3526
|
-
DocStatus as g,
|
|
3527
|
-
DocUpload as h,
|
|
3528
|
-
IcBolt as i,
|
|
3529
|
-
IcBox as j,
|
|
3530
|
-
IcCalendar as k,
|
|
3531
|
-
IcChevR as l,
|
|
3532
|
-
IcFlame as m,
|
|
3533
|
-
IcInfo as n,
|
|
3534
|
-
IcInvoice as o,
|
|
3535
|
-
IcSearch as p,
|
|
3536
|
-
IcTarget as q,
|
|
3537
|
-
IcWarning as r,
|
|
3538
|
-
InvoicePreview as s,
|
|
3539
|
-
ItemEntryTable as t,
|
|
3540
|
-
SUGGEST_TILES as u,
|
|
3541
|
-
SparkMark as v,
|
|
3542
|
-
SparkSvg as w,
|
|
3543
|
-
formatDuration as x,
|
|
3544
|
-
formatTokens as y,
|
|
3545
|
-
getFileCategory as z
|
|
3546
|
-
};
|
|
3547
|
-
//# sourceMappingURL=chat-bot-CzRxCBcZ.esm.js.map
|