hazo_collab_forms 5.7.0 → 6.0.0
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/CHANGE_LOG.md +115 -0
- package/README.md +203 -111
- package/dist/audit/built_in_actions.d.ts +6 -0
- package/dist/audit/built_in_actions.d.ts.map +1 -0
- package/dist/audit/built_in_actions.js +23 -0
- package/dist/audit/built_in_actions.js.map +1 -0
- package/dist/audit/intent_emitter.d.ts +4 -0
- package/dist/audit/intent_emitter.d.ts.map +1 -0
- package/dist/audit/intent_emitter.js +25 -0
- package/dist/audit/intent_emitter.js.map +1 -0
- package/dist/audit/lazy_audit_icon.d.ts +8 -0
- package/dist/audit/lazy_audit_icon.d.ts.map +1 -0
- package/dist/audit/lazy_audit_icon.js +20 -0
- package/dist/audit/lazy_audit_icon.js.map +1 -0
- package/dist/components/_internal_form_set.d.ts +6 -0
- package/dist/components/_internal_form_set.d.ts.map +1 -1
- package/dist/components/_internal_form_set.js +48 -51
- package/dist/components/_internal_form_set.js.map +1 -1
- package/dist/components/clarification/clarification_item_body.d.ts +1 -1
- package/dist/components/clarification/clarification_item_body.d.ts.map +1 -1
- package/dist/components/clarification/resolution_status_strip.d.ts +1 -1
- package/dist/components/clarification/resolution_status_strip.d.ts.map +1 -1
- package/dist/components/field_audit/auditor.d.ts +30 -0
- package/dist/components/field_audit/auditor.d.ts.map +1 -0
- package/dist/components/field_audit/auditor.js +91 -0
- package/dist/components/field_audit/auditor.js.map +1 -0
- package/dist/components/field_audit/context.d.ts +29 -0
- package/dist/components/field_audit/context.d.ts.map +1 -0
- package/dist/components/field_audit/context.js +123 -0
- package/dist/components/field_audit/context.js.map +1 -0
- package/dist/components/field_audit/field_audit_icon.d.ts +12 -0
- package/dist/components/field_audit/field_audit_icon.d.ts.map +1 -0
- package/dist/components/field_audit/field_audit_icon.js +23 -0
- package/dist/components/field_audit/field_audit_icon.js.map +1 -0
- package/dist/components/field_audit/field_audit_panel.d.ts +9 -0
- package/dist/components/field_audit/field_audit_panel.d.ts.map +1 -0
- package/dist/components/field_audit/field_audit_panel.js +54 -0
- package/dist/components/field_audit/field_audit_panel.js.map +1 -0
- package/dist/components/field_audit/index.d.ts +33 -0
- package/dist/components/field_audit/index.d.ts.map +1 -0
- package/dist/components/field_audit/index.js +29 -0
- package/dist/components/field_audit/index.js.map +1 -0
- package/dist/components/field_audit/types.d.ts +75 -0
- package/dist/components/field_audit/types.d.ts.map +1 -0
- package/dist/components/field_audit/types.js +10 -0
- package/dist/components/field_audit/types.js.map +1 -0
- package/dist/components/field_audit/with_field_audit.d.ts +32 -0
- package/dist/components/field_audit/with_field_audit.d.ts.map +1 -0
- package/dist/components/field_audit/with_field_audit.js +42 -0
- package/dist/components/field_audit/with_field_audit.js.map +1 -0
- package/dist/components/hazo_collab_form_checkbox.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_checkbox.js +3 -1
- package/dist/components/hazo_collab_form_checkbox.js.map +1 -1
- package/dist/components/hazo_collab_form_doc.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_doc.js +4 -1
- package/dist/components/hazo_collab_form_doc.js.map +1 -1
- package/dist/components/hazo_collab_form_radio.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_radio.js +4 -2
- package/dist/components/hazo_collab_form_radio.js.map +1 -1
- package/dist/components/hazo_collab_form_view/context.d.ts +7 -0
- package/dist/components/hazo_collab_form_view/context.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/context.js +46 -0
- package/dist/components/hazo_collab_form_view/context.js.map +1 -1
- package/dist/components/hazo_collab_form_view/hooks/use_view_callbacks.d.ts +8 -1
- package/dist/components/hazo_collab_form_view/hooks/use_view_callbacks.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/hooks/use_view_callbacks.js +4 -2
- package/dist/components/hazo_collab_form_view/hooks/use_view_callbacks.js.map +1 -1
- package/dist/components/hazo_collab_form_view/index.d.ts +1 -1
- package/dist/components/hazo_collab_form_view/index.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/index.js +59 -3
- package/dist/components/hazo_collab_form_view/index.js.map +1 -1
- package/dist/components/hazo_collab_form_view/types.d.ts +134 -0
- package/dist/components/hazo_collab_form_view/types.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/views/approval_view.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/views/approval_view.js +3 -1
- package/dist/components/hazo_collab_form_view/views/approval_view.js.map +1 -1
- package/dist/components/hazo_collab_form_view/views/edit_view.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/views/edit_view.js +8 -3
- package/dist/components/hazo_collab_form_view/views/edit_view.js.map +1 -1
- package/dist/components/hazo_collab_form_view/views/print_view.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/views/print_view.js +3 -1
- package/dist/components/hazo_collab_form_view/views/print_view.js.map +1 -1
- package/dist/components/hazo_collab_form_view/views/summary_view.d.ts.map +1 -1
- package/dist/components/hazo_collab_form_view/views/summary_view.js +4 -2
- package/dist/components/hazo_collab_form_view/views/summary_view.js.map +1 -1
- package/dist/components/hazo_data_form/group_renderer.d.ts +8 -2
- package/dist/components/hazo_data_form/group_renderer.d.ts.map +1 -1
- package/dist/components/hazo_data_form/group_renderer.js +3 -3
- package/dist/components/hazo_data_form/group_renderer.js.map +1 -1
- package/dist/components/hazo_data_form/hazo_data_form.d.ts +2 -1
- package/dist/components/hazo_data_form/hazo_data_form.d.ts.map +1 -1
- package/dist/components/hazo_data_form/hazo_data_form.js +47 -6
- package/dist/components/hazo_data_form/hazo_data_form.js.map +1 -1
- package/dist/components/hazo_data_form/section_renderer.d.ts +4 -2
- package/dist/components/hazo_data_form/section_renderer.d.ts.map +1 -1
- package/dist/components/hazo_data_form/section_renderer.js +2 -2
- package/dist/components/hazo_data_form/section_renderer.js.map +1 -1
- package/dist/components/hazo_data_form/shared/data_form_field_layout.d.ts +4 -1
- package/dist/components/hazo_data_form/shared/data_form_field_layout.d.ts.map +1 -1
- package/dist/components/hazo_data_form/shared/data_form_field_layout.js +34 -8
- package/dist/components/hazo_data_form/shared/data_form_field_layout.js.map +1 -1
- package/dist/components/hazo_data_form/types.d.ts +56 -1
- package/dist/components/hazo_data_form/types.d.ts.map +1 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/shared/base_field_layout.d.ts.map +1 -1
- package/dist/components/shared/base_field_layout.js +5 -1
- package/dist/components/shared/base_field_layout.js.map +1 -1
- package/dist/components/shared/field_action_array_slot.d.ts +10 -0
- package/dist/components/shared/field_action_array_slot.d.ts.map +1 -0
- package/dist/components/shared/field_action_array_slot.js +33 -0
- package/dist/components/shared/field_action_array_slot.js.map +1 -0
- package/dist/components/shared/field_action_slot.d.ts +22 -0
- package/dist/components/shared/field_action_slot.d.ts.map +1 -0
- package/dist/components/shared/field_action_slot.js +20 -0
- package/dist/components/shared/field_action_slot.js.map +1 -0
- package/dist/components/shared/ihelp_icon.d.ts +1 -1
- package/dist/components/shared/ihelp_icon.js +1 -1
- package/dist/components/shared/rule_result_card.js +1 -1
- package/dist/components/shared/rule_result_card.js.map +1 -1
- package/dist/components/shared/use_field_action_slot.d.ts +37 -0
- package/dist/components/shared/use_field_action_slot.d.ts.map +1 -0
- package/dist/components/shared/use_field_action_slot.js +77 -0
- package/dist/components/shared/use_field_action_slot.js.map +1 -0
- package/dist/components/thread_form/components/key_info_drawer.d.ts +7 -1
- package/dist/components/thread_form/components/key_info_drawer.d.ts.map +1 -1
- package/dist/components/thread_form/components/key_info_drawer.js +2 -2
- package/dist/components/thread_form/components/key_info_drawer.js.map +1 -1
- package/dist/components/thread_form/components/send_back_message.d.ts +1 -1
- package/dist/components/thread_form/components/send_back_message.d.ts.map +1 -1
- package/dist/components/thread_form/hooks/use_file_pipeline.d.ts +1 -1
- package/dist/components/thread_form/hooks/use_file_pipeline.d.ts.map +1 -1
- package/dist/components/thread_form/hooks/use_file_pipeline.js +1 -1
- package/dist/components/thread_form/hooks/use_file_pipeline.js.map +1 -1
- package/dist/components/thread_form/index.d.ts +1 -1
- package/dist/components/thread_form/index.d.ts.map +1 -1
- package/dist/components/thread_form/index.js.map +1 -1
- package/dist/components/thread_form/thread_form.d.ts.map +1 -1
- package/dist/components/thread_form/thread_form.js +3 -3
- package/dist/components/thread_form/thread_form.js.map +1 -1
- package/dist/components/thread_form/types.d.ts +32 -4
- package/dist/components/thread_form/types.d.ts.map +1 -1
- package/dist/components/thread_form/types.js.map +1 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +0 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/resolution_handler.d.ts +1 -1
- package/dist/lib/resolution_handler.d.ts.map +1 -1
- package/dist/lib/resolve_variable.d.ts +1 -1
- package/dist/lib/resolve_variable.d.ts.map +1 -1
- package/dist/types/clarification.d.ts +1 -1
- package/dist/types/clarification.d.ts.map +1 -1
- package/dist/types/field_action.d.ts +25 -0
- package/dist/types/field_action.d.ts.map +1 -0
- package/dist/types/field_action.js +8 -0
- package/dist/types/field_action.js.map +1 -0
- package/dist/types/index.d.ts +3 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/{fb_form_data.d.ts → shared_data.d.ts} +1 -3
- package/dist/types/shared_data.d.ts.map +1 -0
- package/dist/types/{fb_form_data.js → shared_data.js} +1 -2
- package/dist/types/shared_data.js.map +1 -0
- package/dist/utils/dev_file_manager.d.ts +1 -1
- package/dist/utils/dev_file_manager.js +1 -1
- package/dist/{components/hazo_fb_form/shared → utils}/format.d.ts +2 -2
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/{components/hazo_fb_form/shared → utils}/format.js +1 -1
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/index.d.ts +1 -9
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -15
- package/dist/utils/index.js.map +1 -1
- package/package.json +6 -1
- package/dist/components/hazo_fb_form/components/backoffice_run_button.d.ts +0 -18
- package/dist/components/hazo_fb_form/components/backoffice_run_button.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/backoffice_run_button.js +0 -23
- package/dist/components/hazo_fb_form/components/backoffice_run_button.js.map +0 -1
- package/dist/components/hazo_fb_form/components/draft_clarification_card.d.ts +0 -39
- package/dist/components/hazo_fb_form/components/draft_clarification_card.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/draft_clarification_card.js +0 -94
- package/dist/components/hazo_fb_form/components/draft_clarification_card.js.map +0 -1
- package/dist/components/hazo_fb_form/components/fb_document_type_editor.d.ts +0 -11
- package/dist/components/hazo_fb_form/components/fb_document_type_editor.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/fb_document_type_editor.js +0 -82
- package/dist/components/hazo_fb_form/components/fb_document_type_editor.js.map +0 -1
- package/dist/components/hazo_fb_form/components/fb_tag_editor.d.ts +0 -11
- package/dist/components/hazo_fb_form/components/fb_tag_editor.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/fb_tag_editor.js +0 -107
- package/dist/components/hazo_fb_form/components/fb_tag_editor.js.map +0 -1
- package/dist/components/hazo_fb_form/components/front_office_stepper.d.ts +0 -15
- package/dist/components/hazo_fb_form/components/front_office_stepper.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/front_office_stepper.js +0 -21
- package/dist/components/hazo_fb_form/components/front_office_stepper.js.map +0 -1
- package/dist/components/hazo_fb_form/components/instance_sidebar.d.ts +0 -21
- package/dist/components/hazo_fb_form/components/instance_sidebar.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/instance_sidebar.js +0 -58
- package/dist/components/hazo_fb_form/components/instance_sidebar.js.map +0 -1
- package/dist/components/hazo_fb_form/components/reject_clarification_dialog.d.ts +0 -15
- package/dist/components/hazo_fb_form/components/reject_clarification_dialog.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/reject_clarification_dialog.js +0 -26
- package/dist/components/hazo_fb_form/components/reject_clarification_dialog.js.map +0 -1
- package/dist/components/hazo_fb_form/components/run_button.d.ts +0 -19
- package/dist/components/hazo_fb_form/components/run_button.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/run_button.js +0 -38
- package/dist/components/hazo_fb_form/components/run_button.js.map +0 -1
- package/dist/components/hazo_fb_form/components/run_details_dialog.d.ts +0 -17
- package/dist/components/hazo_fb_form/components/run_details_dialog.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/run_details_dialog.js +0 -35
- package/dist/components/hazo_fb_form/components/run_details_dialog.js.map +0 -1
- package/dist/components/hazo_fb_form/components/sent_clarification_group.d.ts +0 -30
- package/dist/components/hazo_fb_form/components/sent_clarification_group.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/sent_clarification_group.js +0 -76
- package/dist/components/hazo_fb_form/components/sent_clarification_group.js.map +0 -1
- package/dist/components/hazo_fb_form/components/tag_pill.d.ts +0 -15
- package/dist/components/hazo_fb_form/components/tag_pill.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/components/tag_pill.js +0 -15
- package/dist/components/hazo_fb_form/components/tag_pill.js.map +0 -1
- package/dist/components/hazo_fb_form/context.d.ts +0 -135
- package/dist/components/hazo_fb_form/context.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/context.js +0 -13
- package/dist/components/hazo_fb_form/context.js.map +0 -1
- package/dist/components/hazo_fb_form/hazo_fb_form.d.ts +0 -13
- package/dist/components/hazo_fb_form/hazo_fb_form.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/hazo_fb_form.js +0 -1188
- package/dist/components/hazo_fb_form/hazo_fb_form.js.map +0 -1
- package/dist/components/hazo_fb_form/hooks/use_fb_form_state.d.ts +0 -58
- package/dist/components/hazo_fb_form/hooks/use_fb_form_state.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/hooks/use_fb_form_state.js +0 -919
- package/dist/components/hazo_fb_form/hooks/use_fb_form_state.js.map +0 -1
- package/dist/components/hazo_fb_form/hooks/use_llm_run.d.ts +0 -52
- package/dist/components/hazo_fb_form/hooks/use_llm_run.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/hooks/use_llm_run.js +0 -1863
- package/dist/components/hazo_fb_form/hooks/use_llm_run.js.map +0 -1
- package/dist/components/hazo_fb_form/index.d.ts +0 -29
- package/dist/components/hazo_fb_form/index.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/index.js +0 -19
- package/dist/components/hazo_fb_form/index.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/agent_stepper.d.ts +0 -9
- package/dist/components/hazo_fb_form/shared/agent_stepper.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/agent_stepper.js +0 -17
- package/dist/components/hazo_fb_form/shared/agent_stepper.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/clarification_helpers.d.ts +0 -15
- package/dist/components/hazo_fb_form/shared/clarification_helpers.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/clarification_helpers.js +0 -23
- package/dist/components/hazo_fb_form/shared/clarification_helpers.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/file_status_accordion.d.ts +0 -9
- package/dist/components/hazo_fb_form/shared/file_status_accordion.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/file_status_accordion.js +0 -39
- package/dist/components/hazo_fb_form/shared/file_status_accordion.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/file_utils.d.ts +0 -9
- package/dist/components/hazo_fb_form/shared/file_utils.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/file_utils.js +0 -31
- package/dist/components/hazo_fb_form/shared/file_utils.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/format.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/format.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/group_debug_icon.d.ts +0 -15
- package/dist/components/hazo_fb_form/shared/group_debug_icon.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/group_debug_icon.js +0 -48
- package/dist/components/hazo_fb_form/shared/group_debug_icon.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/index.d.ts +0 -10
- package/dist/components/hazo_fb_form/shared/index.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/index.js +0 -9
- package/dist/components/hazo_fb_form/shared/index.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/pdf_side_panel.d.ts +0 -22
- package/dist/components/hazo_fb_form/shared/pdf_side_panel.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/pdf_side_panel.js +0 -10
- package/dist/components/hazo_fb_form/shared/pdf_side_panel.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts +0 -44
- package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/send_back_item_card.js +0 -80
- package/dist/components/hazo_fb_form/shared/send_back_item_card.js.map +0 -1
- package/dist/components/hazo_fb_form/shared/use_pdf_viewer.d.ts +0 -28
- package/dist/components/hazo_fb_form/shared/use_pdf_viewer.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/shared/use_pdf_viewer.js +0 -46
- package/dist/components/hazo_fb_form/shared/use_pdf_viewer.js.map +0 -1
- package/dist/components/hazo_fb_form/types.d.ts +0 -372
- package/dist/components/hazo_fb_form/types.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/types.js +0 -5
- package/dist/components/hazo_fb_form/types.js.map +0 -1
- package/dist/components/hazo_fb_form/views/back_office_view.d.ts +0 -7
- package/dist/components/hazo_fb_form/views/back_office_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/back_office_view.js +0 -425
- package/dist/components/hazo_fb_form/views/back_office_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/clarifications_view.d.ts +0 -16
- package/dist/components/hazo_fb_form/views/clarifications_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/clarifications_view.js +0 -291
- package/dist/components/hazo_fb_form/views/clarifications_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/client_data_view.d.ts +0 -6
- package/dist/components/hazo_fb_form/views/client_data_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/client_data_view.js +0 -39
- package/dist/components/hazo_fb_form/views/client_data_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/front_office_view.d.ts +0 -6
- package/dist/components/hazo_fb_form/views/front_office_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/front_office_view.js +0 -1351
- package/dist/components/hazo_fb_form/views/front_office_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/interim_view.d.ts +0 -8
- package/dist/components/hazo_fb_form/views/interim_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/interim_view.js +0 -535
- package/dist/components/hazo_fb_form/views/interim_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/review_queue_view.d.ts +0 -14
- package/dist/components/hazo_fb_form/views/review_queue_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/review_queue_view.js +0 -230
- package/dist/components/hazo_fb_form/views/review_queue_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/send_back_view.d.ts +0 -13
- package/dist/components/hazo_fb_form/views/send_back_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/send_back_view.js +0 -258
- package/dist/components/hazo_fb_form/views/send_back_view.js.map +0 -1
- package/dist/components/hazo_fb_form/views/summary_review_view.d.ts +0 -17
- package/dist/components/hazo_fb_form/views/summary_review_view.d.ts.map +0 -1
- package/dist/components/hazo_fb_form/views/summary_review_view.js +0 -258
- package/dist/components/hazo_fb_form/views/summary_review_view.js.map +0 -1
- package/dist/components/shared/json_data_panel/index.d.ts +0 -3
- package/dist/components/shared/json_data_panel/index.d.ts.map +0 -1
- package/dist/components/shared/json_data_panel/index.js +0 -2
- package/dist/components/shared/json_data_panel/index.js.map +0 -1
- package/dist/components/shared/json_data_panel/json_data_panel.d.ts +0 -28
- package/dist/components/shared/json_data_panel/json_data_panel.d.ts.map +0 -1
- package/dist/components/shared/json_data_panel/json_data_panel.js +0 -156
- package/dist/components/shared/json_data_panel/json_data_panel.js.map +0 -1
- package/dist/lib/fb_form_handler.d.ts +0 -63
- package/dist/lib/fb_form_handler.d.ts.map +0 -1
- package/dist/lib/fb_form_handler.js +0 -425
- package/dist/lib/fb_form_handler.js.map +0 -1
- package/dist/types/fb_form_data.d.ts.map +0 -1
- package/dist/types/fb_form_data.js.map +0 -1
- package/dist/types/fb_form_data_v1.d.ts +0 -250
- package/dist/types/fb_form_data_v1.d.ts.map +0 -1
- package/dist/types/fb_form_data_v1.js +0 -117
- package/dist/types/fb_form_data_v1.js.map +0 -1
- package/dist/types/fb_form_instance.d.ts +0 -49
- package/dist/types/fb_form_instance.d.ts.map +0 -1
- package/dist/types/fb_form_instance.js +0 -10
- package/dist/types/fb_form_instance.js.map +0 -1
- package/dist/utils/fb_data_adapter.d.ts +0 -33
- package/dist/utils/fb_data_adapter.d.ts.map +0 -1
- package/dist/utils/fb_data_adapter.js +0 -436
- package/dist/utils/fb_data_adapter.js.map +0 -1
- package/dist/utils/fb_data_adapter_v2.d.ts +0 -17
- package/dist/utils/fb_data_adapter_v2.d.ts.map +0 -1
- package/dist/utils/fb_data_adapter_v2.js +0 -483
- package/dist/utils/fb_data_adapter_v2.js.map +0 -1
- package/dist/utils/fb_data_helpers.d.ts +0 -86
- package/dist/utils/fb_data_helpers.d.ts.map +0 -1
- package/dist/utils/fb_data_helpers.js +0 -269
- package/dist/utils/fb_data_helpers.js.map +0 -1
- package/dist/utils/fb_data_mutations.d.ts +0 -43
- package/dist/utils/fb_data_mutations.d.ts.map +0 -1
- package/dist/utils/fb_data_mutations.js +0 -379
- package/dist/utils/fb_data_mutations.js.map +0 -1
- package/dist/utils/fb_data_mutations_v2.d.ts +0 -46
- package/dist/utils/fb_data_mutations_v2.d.ts.map +0 -1
- package/dist/utils/fb_data_mutations_v2.js +0 -341
- package/dist/utils/fb_data_mutations_v2.js.map +0 -1
- package/dist/utils/fb_data_queries.d.ts +0 -81
- package/dist/utils/fb_data_queries.d.ts.map +0 -1
- package/dist/utils/fb_data_queries.js +0 -354
- package/dist/utils/fb_data_queries.js.map +0 -1
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interim View - Readonly display of front-office data with classification tags.
|
|
3
|
-
* Shown at the top of the back-office tab.
|
|
4
|
-
*/
|
|
5
|
-
'use client';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { useState, useMemo } from 'react';
|
|
8
|
-
import { cn } from '../../../utils/cn.js';
|
|
9
|
-
import { useFbFormContext } from '../context.js';
|
|
10
|
-
import { normalize_file_textbox_value } from '../../../types/file_textbox.js';
|
|
11
|
-
import { TagPill } from '../components/tag_pill.js';
|
|
12
|
-
import { HiChevronDown, HiChevronRight, HiDocument, HiDocumentText, HiPhotograph, HiExclamationCircle, HiCheckCircle, HiPlus, HiX, HiEye, HiUserCircle } from 'react-icons/hi';
|
|
13
|
-
import { FaSpinner } from 'react-icons/fa';
|
|
14
|
-
import { HazoUiDialog } from 'hazo_ui';
|
|
15
|
-
import { RejectClarificationDialog } from '../components/reject_clarification_dialog.js';
|
|
16
|
-
import { infer_mime_type } from '../shared/format.js';
|
|
17
|
-
import { FileBar } from '../../shared/file_bar/file_bar.js';
|
|
18
|
-
import { RuleResultCard } from '../../shared/rule_result_card.js';
|
|
19
|
-
function get_file_icon(mime_type) {
|
|
20
|
-
if (mime_type.startsWith('image/'))
|
|
21
|
-
return HiPhotograph;
|
|
22
|
-
if (mime_type === 'application/pdf' || mime_type.startsWith('text/'))
|
|
23
|
-
return HiDocumentText;
|
|
24
|
-
return HiDocument;
|
|
25
|
-
}
|
|
26
|
-
function ValidationDetailDialog({ validation, open, on_open_change, on_view_file, responded_map }) {
|
|
27
|
-
const { reject_clarification: ctx_reject, create_validation_clarification, accept_validation_rule, accept_all_validation_rules } = useFbFormContext();
|
|
28
|
-
const [local_reject_target, set_local_reject_target] = useState(null);
|
|
29
|
-
const [show_accept_all_confirm, set_show_accept_all_confirm] = useState(false);
|
|
30
|
-
const on_reject = (item) => set_local_reject_target(item);
|
|
31
|
-
const rule_results = validation.rule_results ?? [];
|
|
32
|
-
const handle_send_back = (rule, message) => {
|
|
33
|
-
create_validation_clarification(rule, {
|
|
34
|
-
file_id: validation.file_id,
|
|
35
|
-
file_name: validation.file_name,
|
|
36
|
-
}, message);
|
|
37
|
-
on_open_change(false);
|
|
38
|
-
};
|
|
39
|
-
const handle_accept = (rule) => {
|
|
40
|
-
accept_validation_rule(rule, validation.file_id);
|
|
41
|
-
};
|
|
42
|
-
const handle_accept_all = (rules) => {
|
|
43
|
-
accept_all_validation_rules(rules, validation.file_id);
|
|
44
|
-
};
|
|
45
|
-
// Check if all failed rules have been resolved (via user_resolved or responded_map)
|
|
46
|
-
const failed_rules = rule_results.filter(rr => rr.issues.length > 0);
|
|
47
|
-
const all_failures_resolved = failed_rules.length > 0 && failed_rules.every(rr => {
|
|
48
|
-
if (rr.user_resolved)
|
|
49
|
-
return true;
|
|
50
|
-
if (responded_map) {
|
|
51
|
-
return [...responded_map.values()].some(c => c.rule_id === rr.rule_id && (c.status === 'responded' || c.status === 'resolved'));
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
});
|
|
55
|
-
const all_resolved_accepted = failed_rules.length > 0 && failed_rules.every(rr => rr.accepted);
|
|
56
|
-
const has_sent_back = rule_results.some(rr => rr.sent_back);
|
|
57
|
-
const has_unreviewed = failed_rules.some(rr => {
|
|
58
|
-
const is_resolved_rule = rr.user_resolved || (responded_map && [...responded_map.values()].some(c => c.rule_id === rr.rule_id && (c.status === 'responded' || c.status === 'resolved')));
|
|
59
|
-
return is_resolved_rule && !rr.accepted && !rr.sent_back;
|
|
60
|
-
});
|
|
61
|
-
const effective_status = all_resolved_accepted ? 'accepted'
|
|
62
|
-
: has_sent_back ? 'sent_back'
|
|
63
|
-
: has_unreviewed || (validation.status === 'failed' && all_failures_resolved) ? 'pending_review'
|
|
64
|
-
: validation.status;
|
|
65
|
-
const status_label = effective_status === 'passed' ? 'Passed'
|
|
66
|
-
: effective_status === 'skipped' ? 'Skipped'
|
|
67
|
-
: effective_status === 'accepted' ? 'Accepted'
|
|
68
|
-
: effective_status === 'sent_back' ? 'Sent Back'
|
|
69
|
-
: effective_status === 'pending_review' ? 'Pending Review'
|
|
70
|
-
: effective_status === 'failed' ? 'Failed'
|
|
71
|
-
: effective_status === 'manual_review' ? 'Client Requested Manual Review'
|
|
72
|
-
: 'Validating';
|
|
73
|
-
const status_color = effective_status === 'passed' || effective_status === 'accepted' ? 'text-green-600'
|
|
74
|
-
: effective_status === 'skipped' ? 'text-muted-foreground'
|
|
75
|
-
: effective_status === 'sent_back' ? 'text-blue-600'
|
|
76
|
-
: effective_status === 'pending_review' ? 'text-amber-600'
|
|
77
|
-
: effective_status === 'failed' ? 'text-destructive'
|
|
78
|
-
: effective_status === 'manual_review' ? 'text-amber-600'
|
|
79
|
-
: 'text-muted-foreground';
|
|
80
|
-
return (_jsxs(_Fragment, { children: [_jsx(HazoUiDialog, { open: open, onOpenChange: on_open_change, title: "Validation Result", description: validation.file_name, sizeWidth: "56rem", headerBar: true, showCancelButton: false, actionButtonText: "OK", onConfirm: () => on_open_change(false), headerClassName: "[&_*]:break-all", children: _jsxs("div", { className: "space-y-3 text-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Status:" }), _jsx("span", { className: cn('font-medium', status_color), children: status_label }), on_view_file && (_jsxs("button", { type: "button", onClick: () => { on_view_file(validation.file_id, validation.file_name); on_open_change(false); }, className: "ml-auto inline-flex items-center gap-1 text-xs text-primary hover:underline", title: "View file", children: [_jsx(HiEye, { className: "h-3.5 w-3.5" }), "View"] }))] }), validation.document_types.length > 0 && (_jsxs("div", { children: [_jsx("span", { className: "text-muted-foreground", children: "Document Types:" }), _jsx("div", { className: "flex flex-wrap gap-1 mt-1", children: validation.document_types.map((dt) => (_jsx("span", { className: "text-xs px-1.5 py-0.5 rounded bg-muted font-mono", children: dt }, dt))) })] })), rule_results.length > 0 ? (_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: ["Rules Executed (", rule_results.length, "):"] }), _jsx("div", { className: "mt-1.5 space-y-1.5", children: rule_results.map((rr, i) => (_jsx(RuleResultCard, { rr: rr, responded_map: responded_map, on_reject: on_reject, on_send_back: handle_send_back, on_accept: handle_accept, file_info: {
|
|
81
|
-
file_id: validation.file_id,
|
|
82
|
-
file_name: validation.file_name,
|
|
83
|
-
}, on_view_file: on_view_file ? (fid) => { on_view_file(fid, validation.file_name); on_open_change(false); } : undefined }, rr.rule_id + '-' + i))) })] })) : validation.status === 'manual_review' ? (_jsxs("div", { className: "flex items-center gap-2 text-amber-700", children: [_jsx(HiUserCircle, { className: "h-4 w-4 text-amber-600 flex-shrink-0" }), "Client requested manual review. Automated validation was skipped."] })) : validation.status === 'skipped' ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(HiCheckCircle, { className: "h-4 w-4 text-green-600 flex-shrink-0" }), "No matching validation rules for this file."] })) : validation.errors.length > 0 ? (
|
|
84
|
-
/* Fallback: show clarification errors if no rule_results (backward compat) */
|
|
85
|
-
_jsxs("div", { children: [_jsxs("span", { className: "text-muted-foreground", children: ["Issues (", validation.errors.length, "):"] }), _jsx("div", { className: "mt-1 space-y-2", children: validation.errors.map((err, i) => {
|
|
86
|
-
const responded = responded_map?.get(err.id);
|
|
87
|
-
const is_resolved = !!responded;
|
|
88
|
-
return (_jsx("div", { className: cn('rounded-md p-2', is_resolved
|
|
89
|
-
? 'border border-amber-200 bg-amber-50/50'
|
|
90
|
-
: 'border border-destructive/30'), children: _jsxs("div", { className: "flex items-start gap-1.5", children: [is_resolved ? (_jsx(HiCheckCircle, { className: "h-4 w-4 text-amber-500 flex-shrink-0 mt-0.5" })) : (_jsx(HiExclamationCircle, { className: "h-4 w-4 text-destructive flex-shrink-0 mt-0.5" })), _jsxs("div", { children: [_jsx("span", { className: "font-medium", children: err.rule_name ?? err.type }), is_resolved && responded ? (_jsxs("div", { className: "mt-1 text-xs", children: [_jsx("span", { className: "text-amber-600 font-medium", children: "Client resolved: " }), _jsx("span", { className: "text-muted-foreground", children: responded.response_choice }), responded.user_comment && (_jsxs("p", { className: "text-muted-foreground mt-0.5 italic", children: ["\u201C", responded.user_comment, "\u201D"] }))] })) : (err.issue_description && _jsx("p", { className: "text-muted-foreground text-xs mt-0.5", children: err.issue_description }))] })] }) }, i));
|
|
91
|
-
}) })] })) : (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(HiCheckCircle, { className: "h-4 w-4 text-green-600 flex-shrink-0" }), "No issues found."] })), rule_results.length > 0 && (() => {
|
|
92
|
-
const unreviewed_resolved = rule_results.filter(rr => {
|
|
93
|
-
if (rr.issues.length === 0 || rr.accepted || rr.sent_back)
|
|
94
|
-
return false;
|
|
95
|
-
if (rr.user_resolved)
|
|
96
|
-
return true;
|
|
97
|
-
return responded_map ? [...responded_map.values()].some(c => c.rule_id === rr.rule_id && (c.status === 'responded' || c.status === 'resolved')) : false;
|
|
98
|
-
});
|
|
99
|
-
if (unreviewed_resolved.length < 1)
|
|
100
|
-
return null;
|
|
101
|
-
return (_jsx("div", { className: "pt-2 border-t border-border/40", children: !show_accept_all_confirm ? (_jsxs("button", { type: "button", onClick: () => set_show_accept_all_confirm(true), className: "w-full py-2 text-sm font-medium rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors", children: ["Accept All (", unreviewed_resolved.length, " rule", unreviewed_resolved.length !== 1 ? 's' : '', ")"] })) : (_jsxs("div", { className: "rounded-md border border-green-200 bg-green-50 p-3 space-y-2", children: [_jsxs("p", { className: "text-sm font-medium text-green-800", children: ["Accept ", unreviewed_resolved.length, " resolved rule", unreviewed_resolved.length !== 1 ? 's' : '', "?"] }), _jsx("ul", { className: "text-xs text-green-700 space-y-0.5 pl-4 list-disc", children: unreviewed_resolved.map((rr) => (_jsx("li", { children: rr.rule_name ?? rr.rule_id }, rr.rule_id))) }), _jsxs("div", { className: "flex gap-2 justify-end pt-1", children: [_jsx("button", { type: "button", onClick: () => set_show_accept_all_confirm(false), className: "px-3 py-1.5 text-xs rounded-md border border-green-200 text-green-700 hover:bg-green-100 transition-colors", children: "Cancel" }), _jsx("button", { type: "button", onClick: () => {
|
|
102
|
-
handle_accept_all(unreviewed_resolved);
|
|
103
|
-
set_show_accept_all_confirm(false);
|
|
104
|
-
}, className: "px-3 py-1.5 text-xs font-semibold rounded-md bg-green-600 text-white hover:bg-green-700 transition-colors", children: "Confirm" })] })] })) }));
|
|
105
|
-
})()] }) }), local_reject_target && (_jsx(RejectClarificationDialog, { open: !!local_reject_target, on_open_change: (o) => { if (!o)
|
|
106
|
-
set_local_reject_target(null); }, item: local_reject_target, on_confirm: (reason) => {
|
|
107
|
-
ctx_reject(local_reject_target.id, reason);
|
|
108
|
-
set_local_reject_target(null);
|
|
109
|
-
} }))] }));
|
|
110
|
-
}
|
|
111
|
-
function ValidationBadge({ validation, on_view_file, show_debug_dialogs = true, responded_map }) {
|
|
112
|
-
const [show_detail, set_show_detail] = useState(false);
|
|
113
|
-
if (!validation)
|
|
114
|
-
return null;
|
|
115
|
-
if (validation.status === 'validating') {
|
|
116
|
-
return _jsx(FaSpinner, { className: "h-3 w-3 animate-spin text-muted-foreground flex-shrink-0" });
|
|
117
|
-
}
|
|
118
|
-
if (validation.status === 'manual_review') {
|
|
119
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { role: "button", tabIndex: 0, onClick: (e) => { e.stopPropagation(); set_show_detail(true); }, onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') {
|
|
120
|
-
e.stopPropagation();
|
|
121
|
-
set_show_detail(true);
|
|
122
|
-
} }, className: "inline-flex items-center gap-0.5 text-amber-600 cursor-pointer hover:opacity-70", title: "Client Requested Manual Review", children: _jsx(HiUserCircle, { className: "h-3.5 w-3.5 flex-shrink-0" }) }), _jsx(ValidationDetailDialog, { validation: validation, open: show_detail, on_open_change: set_show_detail, on_view_file: on_view_file, responded_map: responded_map })] }));
|
|
123
|
-
}
|
|
124
|
-
if (validation.status === 'passed' || validation.status === 'skipped') {
|
|
125
|
-
if (!show_debug_dialogs) {
|
|
126
|
-
return _jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-green-600 flex-shrink-0" });
|
|
127
|
-
}
|
|
128
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { role: "button", tabIndex: 0, onClick: (e) => { e.stopPropagation(); set_show_detail(true); }, onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') {
|
|
129
|
-
e.stopPropagation();
|
|
130
|
-
set_show_detail(true);
|
|
131
|
-
} }, className: "inline-flex cursor-pointer hover:opacity-70", title: "Click to view validation details", children: _jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-green-600 flex-shrink-0" }) }), _jsx(ValidationDetailDialog, { validation: validation, open: show_detail, on_open_change: set_show_detail, on_view_file: on_view_file, responded_map: responded_map })] }));
|
|
132
|
-
}
|
|
133
|
-
if (validation.status === 'failed') {
|
|
134
|
-
const total = validation.errors.length;
|
|
135
|
-
const responded_count = responded_map ? validation.errors.filter((e) => responded_map.has(e.id)).length : 0;
|
|
136
|
-
const unresolved_count = total - responded_count;
|
|
137
|
-
const all_resolved = total > 0 && unresolved_count === 0;
|
|
138
|
-
if (all_resolved) {
|
|
139
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { role: "button", tabIndex: 0, onClick: (e) => { e.stopPropagation(); set_show_detail(true); }, onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') {
|
|
140
|
-
e.stopPropagation();
|
|
141
|
-
set_show_detail(true);
|
|
142
|
-
} }, className: "inline-flex items-center gap-0.5 text-amber-600 cursor-pointer hover:opacity-70", title: "All issues resolved by client \u2014 click for details", children: _jsx(HiCheckCircle, { className: "h-3.5 w-3.5 flex-shrink-0" }) }), _jsx(ValidationDetailDialog, { validation: validation, open: show_detail, on_open_change: set_show_detail, on_view_file: on_view_file, responded_map: responded_map })] }));
|
|
143
|
-
}
|
|
144
|
-
return (_jsxs(_Fragment, { children: [_jsxs("span", { role: "button", tabIndex: 0, onClick: (e) => { e.stopPropagation(); set_show_detail(true); }, onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') {
|
|
145
|
-
e.stopPropagation();
|
|
146
|
-
set_show_detail(true);
|
|
147
|
-
} }, className: "inline-flex items-center gap-0.5 text-destructive cursor-pointer hover:opacity-70", title: `${unresolved_count} unresolved issue(s)${responded_count > 0 ? `, ${responded_count} resolved` : ''} — click for details`, children: [_jsx(HiExclamationCircle, { className: "h-3.5 w-3.5 flex-shrink-0" }), unresolved_count > 0 && _jsx("span", { className: "text-[10px] font-bold", children: unresolved_count })] }), _jsx(ValidationDetailDialog, { validation: validation, open: show_detail, on_open_change: set_show_detail, on_view_file: on_view_file, responded_map: responded_map })] }));
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
function BlockDisplay({ block, validation, on_view_file, is_processing, status_icon, responded_map, file_classification }) {
|
|
152
|
-
const [show_validation_detail, set_show_validation_detail] = useState(false);
|
|
153
|
-
if (block.type === 'text') {
|
|
154
|
-
if (!block.content.trim())
|
|
155
|
-
return null;
|
|
156
|
-
return _jsx("p", { className: "text-sm whitespace-pre-wrap", children: block.content });
|
|
157
|
-
}
|
|
158
|
-
const is_failed = validation?.status === 'failed';
|
|
159
|
-
const is_validating = validation?.status === 'validating';
|
|
160
|
-
// Check if file is ignored or replaced → muted style
|
|
161
|
-
const is_replaced = block.type === 'file' && !!block.replaced_by;
|
|
162
|
-
const is_ignored = is_failed && responded_map && validation.errors.length > 0 && validation.errors.some((e) => {
|
|
163
|
-
const item = responded_map.get(e.id);
|
|
164
|
-
return item && item.response_choice === 'ignore';
|
|
165
|
-
});
|
|
166
|
-
const is_struck = is_replaced || is_ignored;
|
|
167
|
-
// Build classification tags from file_classification
|
|
168
|
-
const fc = file_classification;
|
|
169
|
-
const classification_tags = fc?.tags?.length
|
|
170
|
-
? fc.tags.map((tag) => ({ id: tag, label: tag, tooltip: fc.tag_reasons?.[tag] }))
|
|
171
|
-
: undefined;
|
|
172
|
-
const classification_meta = fc
|
|
173
|
-
? { document_type: fc.document_type, document_date: fc.document_date, document_nature: fc.document_nature }
|
|
174
|
-
: undefined;
|
|
175
|
-
// Map FbFileValidationResult to FileBar validation prop
|
|
176
|
-
// When file is queued/processing, suppress validation badge to avoid confusing "passed" + "queued" overlap
|
|
177
|
-
const all_errors_resolved = is_failed && responded_map && validation.errors.length > 0 && validation.errors.every((e) => responded_map.has(e.id));
|
|
178
|
-
// Derive resolved rule states for back-office badge
|
|
179
|
-
const resolved_rules_list = validation?.rule_results?.filter(rr => {
|
|
180
|
-
if (rr.issues.length === 0)
|
|
181
|
-
return false;
|
|
182
|
-
if (rr.user_resolved)
|
|
183
|
-
return true;
|
|
184
|
-
return responded_map ? [...responded_map.values()].some(c => c.rule_id === rr.rule_id && (c.status === 'responded' || c.status === 'resolved')) : false;
|
|
185
|
-
}) ?? [];
|
|
186
|
-
const has_sent_back_rules = validation?.rule_results?.some(rr => rr.sent_back);
|
|
187
|
-
const all_resolved_accepted = resolved_rules_list.length > 0 && resolved_rules_list.every(rr => rr.accepted);
|
|
188
|
-
const has_unreviewed_resolved = resolved_rules_list.some(rr => !rr.accepted && !rr.sent_back);
|
|
189
|
-
const bar_validation = status_icon
|
|
190
|
-
? null
|
|
191
|
-
: is_validating
|
|
192
|
-
? { state: 'validating' }
|
|
193
|
-
: has_sent_back_rules
|
|
194
|
-
? { state: 'sent_back' }
|
|
195
|
-
: has_unreviewed_resolved
|
|
196
|
-
? { state: 'pending_review' }
|
|
197
|
-
: all_resolved_accepted
|
|
198
|
-
? { state: 'accepted' }
|
|
199
|
-
: validation?.status === 'failed'
|
|
200
|
-
? all_errors_resolved
|
|
201
|
-
? { state: 'pending_review' }
|
|
202
|
-
: { state: 'issues', issue_count: validation.errors.length }
|
|
203
|
-
: (validation?.status === 'passed' || validation?.status === 'skipped')
|
|
204
|
-
? { state: 'passed' }
|
|
205
|
-
: null;
|
|
206
|
-
return (_jsxs(_Fragment, { children: [_jsx(FileBar, { attachment: block.attachment, muted: is_struck, status_icon: status_icon ?? (is_processing ? 'classifying' : undefined), validation: bar_validation, on_validation_click: validation ? () => set_show_validation_detail(true) : undefined, classification_tags: classification_tags, classification_meta: classification_meta, on_view: on_view_file ? () => on_view_file(block.attachment.file_id, block.attachment.file_name) : undefined }), validation && (_jsx(ValidationDetailDialog, { validation: validation, open: show_validation_detail, on_open_change: set_show_validation_detail, on_view_file: on_view_file, responded_map: responded_map }))] }));
|
|
207
|
-
}
|
|
208
|
-
/** Build a map of tag_id → files belonging to that tag, plus an untagged group */
|
|
209
|
-
function group_files_by_tag(front_sections, front_form_data, classification_results, available_tags) {
|
|
210
|
-
const tag_groups = new Map();
|
|
211
|
-
const untagged = [];
|
|
212
|
-
const seen_file_ids = new Set();
|
|
213
|
-
/** Process a single file block and add to the appropriate group */
|
|
214
|
-
function process_block(block, classification) {
|
|
215
|
-
if (block.type === 'text')
|
|
216
|
-
return;
|
|
217
|
-
if (seen_file_ids.has(block.attachment.file_id))
|
|
218
|
-
return;
|
|
219
|
-
seen_file_ids.add(block.attachment.file_id);
|
|
220
|
-
const file_class = classification?.file_classifications.find((fc) => fc.file_id === block.attachment.file_id);
|
|
221
|
-
const tagged_file = { block, file_classification: file_class };
|
|
222
|
-
const file_tags = file_class?.tags ?? [];
|
|
223
|
-
if (file_tags.length === 0) {
|
|
224
|
-
untagged.push(tagged_file);
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
// Route to the first (primary) tag only — prevents the same file
|
|
228
|
-
// from appearing under every tag it was classified with.
|
|
229
|
-
const primary_tag = file_tags[0];
|
|
230
|
-
if (!tag_groups.has(primary_tag))
|
|
231
|
-
tag_groups.set(primary_tag, []);
|
|
232
|
-
tag_groups.get(primary_tag).push(tagged_file);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// Collect file blocks from front-office fields (via sections schema)
|
|
236
|
-
for (const section of front_sections) {
|
|
237
|
-
for (const group of section.groups || []) {
|
|
238
|
-
for (const field of group.fields || []) {
|
|
239
|
-
const blocks = normalize_file_textbox_value(front_form_data[field.id]);
|
|
240
|
-
const classification = classification_results.find((c) => c.field_id === field.id);
|
|
241
|
-
for (const block of blocks)
|
|
242
|
-
process_block(block, classification);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
// Fallback: scan front_form_data directly for file blocks not covered by sections
|
|
247
|
-
// (e.g., when a follow-up instance inherits file data but not the full sections schema)
|
|
248
|
-
for (const [key, value] of Object.entries(front_form_data)) {
|
|
249
|
-
if (key.startsWith('__'))
|
|
250
|
-
continue; // skip internal keys
|
|
251
|
-
const blocks = normalize_file_textbox_value(value);
|
|
252
|
-
const classification = classification_results.find((c) => c.field_id === key);
|
|
253
|
-
for (const block of blocks)
|
|
254
|
-
process_block(block, classification);
|
|
255
|
-
}
|
|
256
|
-
return { tag_groups, untagged };
|
|
257
|
-
}
|
|
258
|
-
function ValidationIssuesSection({ validation_results, responded_map, on_view_file, on_reject }) {
|
|
259
|
-
const failed = Object.values(validation_results).filter((r) => r.status === 'failed' && r.errors.length > 0);
|
|
260
|
-
const [is_open, set_is_open] = useState(true);
|
|
261
|
-
const [is_resolved_open, set_is_resolved_open] = useState(true);
|
|
262
|
-
const [is_accepted_open, set_is_accepted_open] = useState(true);
|
|
263
|
-
if (failed.length === 0)
|
|
264
|
-
return null;
|
|
265
|
-
// Split files into unresolved vs resolved vs sent-back
|
|
266
|
-
const unresolved_files = [];
|
|
267
|
-
const resolved_files = [];
|
|
268
|
-
const sent_back_files = [];
|
|
269
|
-
for (const file_result of failed) {
|
|
270
|
-
const resolved_errors = [];
|
|
271
|
-
const unresolved_errors = [];
|
|
272
|
-
for (const err of file_result.errors) {
|
|
273
|
-
const response = responded_map?.get(err.id);
|
|
274
|
-
if (response) {
|
|
275
|
-
resolved_errors.push({ error: err, response });
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
unresolved_errors.push(err);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
// Check if any rules on this file have been sent back
|
|
282
|
-
const file_sent_back_rules = file_result.rule_results?.filter(rr => rr.sent_back) ?? [];
|
|
283
|
-
if (file_sent_back_rules.length > 0) {
|
|
284
|
-
sent_back_files.push({ result: file_result, sent_back_rules: file_sent_back_rules, resolved_errors });
|
|
285
|
-
}
|
|
286
|
-
else if (resolved_errors.length > 0) {
|
|
287
|
-
resolved_files.push({ result: file_result, resolved_errors, unresolved_errors });
|
|
288
|
-
}
|
|
289
|
-
if (unresolved_errors.length > 0 && file_sent_back_rules.length === 0) {
|
|
290
|
-
unresolved_files.push({ result: file_result, errors: unresolved_errors });
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
const pending_review_files = [];
|
|
294
|
-
const accepted_files = [];
|
|
295
|
-
for (const rf of resolved_files) {
|
|
296
|
-
const all_accepted = rf.resolved_errors.every(({ error: err }) => {
|
|
297
|
-
const matching_rule = rf.result.rule_results?.find(rr => rr.rule_id === err.rule_id);
|
|
298
|
-
return matching_rule?.accepted;
|
|
299
|
-
});
|
|
300
|
-
if (all_accepted) {
|
|
301
|
-
accepted_files.push(rf);
|
|
302
|
-
}
|
|
303
|
-
else {
|
|
304
|
-
pending_review_files.push(rf);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return (_jsxs(_Fragment, { children: [unresolved_files.length > 0 && (_jsxs("div", { className: "border border-destructive/30 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_open(!is_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-destructive/5 hover:bg-destructive/10 transition-colors", children: [is_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsx(HiExclamationCircle, { className: "h-4 w-4 text-destructive" }), _jsx("span", { className: "text-destructive", children: "Clarifications" }), _jsxs("span", { className: "text-xs text-muted-foreground", children: ["(", unresolved_files.length, " file", unresolved_files.length !== 1 ? 's' : '', ")"] })] }), is_open && (_jsx("div", { className: "px-3 pb-3 space-y-3 pt-2", children: unresolved_files.map(({ result: file_result, errors }) => {
|
|
308
|
-
const source_attachment = {
|
|
309
|
-
file_id: file_result.file_id,
|
|
310
|
-
ref_id: '',
|
|
311
|
-
file_name: file_result.file_name,
|
|
312
|
-
file_size: 0,
|
|
313
|
-
mime_type: infer_mime_type(file_result.file_name),
|
|
314
|
-
visibility: 'public',
|
|
315
|
-
attached_at: '',
|
|
316
|
-
};
|
|
317
|
-
return (_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center gap-2 max-w-[50%]", children: [_jsx("div", { className: "flex-1 min-w-0", children: _jsx(FileBar, { attachment: source_attachment, validation: { state: 'issues', issue_count: errors.length }, on_view: on_view_file ? () => on_view_file(file_result.file_id, file_result.file_name) : undefined }) }), file_result.document_types.length > 0 && (_jsxs("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: ["(", file_result.document_types.join(', '), ")"] }))] }), _jsx("div", { className: "pl-3 border-l-2 border-destructive/30 space-y-1", children: errors.map((err, i) => (_jsxs("div", { className: "text-xs text-muted-foreground flex gap-1.5", children: [_jsx(HiExclamationCircle, { className: "h-3.5 w-3.5 text-destructive flex-shrink-0 mt-0.5" }), _jsxs("div", { children: [_jsx("span", { className: "font-medium text-foreground", children: err.rule_name ?? err.type }), err.issue_description && _jsxs("span", { children: [" \u2014 ", err.issue_description] })] })] }, i))) })] }, file_result.file_id));
|
|
318
|
-
}) }))] })), sent_back_files.length > 0 && (_jsxs("div", { className: "border border-blue-200 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_resolved_open(!is_resolved_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-blue-50/50 hover:bg-blue-50 transition-colors", children: [is_resolved_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsx(HiCheckCircle, { className: "h-4 w-4 text-blue-500" }), _jsx("span", { className: "text-blue-800", children: "Sent Back" }), _jsxs("span", { className: "text-xs text-blue-600", children: ["(", sent_back_files.length, " file", sent_back_files.length !== 1 ? 's' : '', ")"] })] }), is_resolved_open && (_jsx("div", { className: "px-3 pb-3 space-y-3 pt-2", children: sent_back_files.map(({ result: file_result, sent_back_rules, resolved_errors }) => {
|
|
319
|
-
const source_attachment = {
|
|
320
|
-
file_id: file_result.file_id,
|
|
321
|
-
ref_id: '',
|
|
322
|
-
file_name: file_result.file_name,
|
|
323
|
-
file_size: 0,
|
|
324
|
-
mime_type: infer_mime_type(file_result.file_name),
|
|
325
|
-
visibility: 'public',
|
|
326
|
-
attached_at: '',
|
|
327
|
-
};
|
|
328
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-2 max-w-[50%]", children: [_jsx("div", { className: "flex-1 min-w-0", children: _jsx(FileBar, { attachment: source_attachment, on_view: on_view_file ? () => on_view_file(file_result.file_id, file_result.file_name) : undefined }) }), file_result.document_types.length > 0 && (_jsxs("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: ["(", file_result.document_types.join(', '), ")"] }))] }), _jsx("div", { className: "pl-3 border-l-2 border-blue-200 space-y-2", children: sent_back_rules.map((rr, i) => {
|
|
329
|
-
// Find the matching resolved error for lineage
|
|
330
|
-
const matching_resolved = resolved_errors.find(re => re.error.rule_id === rr.rule_id);
|
|
331
|
-
return (_jsxs("div", { className: "text-xs space-y-1", children: [_jsxs("div", { className: "flex gap-1.5", children: [_jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-amber-500 flex-shrink-0 mt-0.5" }), _jsxs("div", { className: "min-w-0", children: [_jsx("span", { className: "font-medium text-foreground", children: rr.rule_name ?? rr.rule_id }), matching_resolved && (_jsxs("div", { className: "mt-0.5", children: [_jsx("span", { className: "text-amber-600 font-medium", children: "Client resolved: " }), _jsx("span", { className: "text-muted-foreground", children: matching_resolved.response.response_choice }), matching_resolved.response.user_comment && (_jsxs("p", { className: "text-muted-foreground mt-0.5 italic", children: ["\u201C", matching_resolved.response.user_comment, "\u201D"] }))] }))] })] }), _jsxs("div", { className: "flex gap-1.5 ml-4", children: [_jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-blue-500 flex-shrink-0 mt-0.5" }), _jsxs("div", { className: "min-w-0", children: [_jsx("span", { className: "font-medium text-blue-700", children: "Sent back to client" }), rr.sent_back_message && (_jsx("p", { className: "text-muted-foreground mt-0.5 leading-relaxed", children: rr.sent_back_message }))] })] })] }, i));
|
|
332
|
-
}) })] }, file_result.file_id));
|
|
333
|
-
}) }))] })), pending_review_files.length > 0 && (_jsxs("div", { className: "border border-amber-200 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_resolved_open(!is_resolved_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-amber-50/50 hover:bg-amber-50 transition-colors", children: [is_resolved_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsx(HiCheckCircle, { className: "h-4 w-4 text-amber-500" }), _jsx("span", { className: "text-amber-800", children: "Pending Review" }), _jsxs("span", { className: "text-xs text-amber-600", children: ["(", pending_review_files.length, " file", pending_review_files.length !== 1 ? 's' : '', ")"] })] }), is_resolved_open && (_jsx("div", { className: "px-3 pb-3 space-y-3 pt-2", children: pending_review_files.map(({ result: file_result, resolved_errors, unresolved_errors }) => {
|
|
334
|
-
const source_attachment = {
|
|
335
|
-
file_id: file_result.file_id,
|
|
336
|
-
ref_id: '',
|
|
337
|
-
file_name: file_result.file_name,
|
|
338
|
-
file_size: 0,
|
|
339
|
-
mime_type: infer_mime_type(file_result.file_name),
|
|
340
|
-
visibility: 'public',
|
|
341
|
-
attached_at: '',
|
|
342
|
-
};
|
|
343
|
-
// Check if all resolved errors indicate file should be struck through (ignored or replaced)
|
|
344
|
-
const is_file_struck = resolved_errors.length > 0 && resolved_errors.every(({ response }) => response.response_choice === 'ignore' || response.response_choice === 'replace_document');
|
|
345
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-2 max-w-[50%]", children: [_jsx("div", { className: "flex-1 min-w-0", children: _jsx(FileBar, { attachment: source_attachment, muted: is_file_struck, on_view: on_view_file ? () => on_view_file(file_result.file_id, file_result.file_name) : undefined }) }), file_result.document_types.length > 0 && (_jsxs("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: ["(", file_result.document_types.join(', '), ")"] }))] }), _jsxs("div", { className: "pl-3 border-l-2 border-amber-200 space-y-1", children: [resolved_errors.map(({ error: err, response }, i) => (_jsxs("div", { className: "text-xs flex gap-1.5", children: [_jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-amber-500 flex-shrink-0 mt-0.5" }), _jsxs("div", { className: "min-w-0", children: [_jsx("span", { className: "font-medium text-foreground", children: err.rule_name ?? err.type }), _jsxs("div", { className: "mt-0.5", children: [_jsx("span", { className: "text-amber-600 font-medium", children: "Client resolved: " }), _jsx("span", { className: "text-muted-foreground", children: response.response_choice }), response.user_comment && (_jsxs("p", { className: "text-muted-foreground mt-0.5 italic", children: ["\u201C", response.user_comment, "\u201D"] })), response.response_files && response.response_files.length > 0 && (_jsx("div", { className: "mt-1.5 space-y-1", children: response.response_files.map((file) => (_jsx(FileBar, { attachment: file, on_view: on_view_file ? () => on_view_file(file.file_id, file.file_name) : undefined }, file.file_id))) }))] })] })] }, i))), unresolved_errors.length > 0 && unresolved_errors.map((err, i) => (_jsxs("div", { className: "text-xs text-muted-foreground flex gap-1.5", children: [_jsx(HiExclamationCircle, { className: "h-3.5 w-3.5 text-destructive flex-shrink-0 mt-0.5" }), _jsxs("div", { children: [_jsx("span", { className: "font-medium text-foreground", children: err.rule_name ?? err.type }), err.issue_description && _jsxs("span", { children: [" \u2014 ", err.issue_description] })] })] }, `unresolved-${i}`)))] })] }, file_result.file_id));
|
|
346
|
-
}) }))] })), accepted_files.length > 0 && (_jsxs("div", { className: "border border-green-200 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_accepted_open(!is_accepted_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-green-50/50 hover:bg-green-50 transition-colors", children: [is_accepted_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsxs("span", { className: "inline-flex items-center", children: [_jsx(HiCheckCircle, { className: "h-4 w-4 text-green-500" }), _jsx(HiCheckCircle, { className: "h-4 w-4 text-green-500 -ml-1.5" })] }), _jsx("span", { className: "text-green-800", children: "Accepted" }), _jsxs("span", { className: "text-xs text-green-600", children: ["(", accepted_files.length, " file", accepted_files.length !== 1 ? 's' : '', ")"] })] }), is_accepted_open && (_jsx("div", { className: "px-3 pb-3 space-y-3 pt-2", children: accepted_files.map(({ result: file_result, resolved_errors }) => {
|
|
347
|
-
const source_attachment = {
|
|
348
|
-
file_id: file_result.file_id,
|
|
349
|
-
ref_id: '',
|
|
350
|
-
file_name: file_result.file_name,
|
|
351
|
-
file_size: 0,
|
|
352
|
-
mime_type: infer_mime_type(file_result.file_name),
|
|
353
|
-
visibility: 'public',
|
|
354
|
-
attached_at: '',
|
|
355
|
-
};
|
|
356
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-2 max-w-[50%]", children: [_jsx("div", { className: "flex-1 min-w-0", children: _jsx(FileBar, { attachment: source_attachment, on_view: on_view_file ? () => on_view_file(file_result.file_id, file_result.file_name) : undefined }) }), file_result.document_types.length > 0 && (_jsxs("span", { className: "text-xs text-muted-foreground flex-shrink-0", children: ["(", file_result.document_types.join(', '), ")"] }))] }), _jsx("div", { className: "pl-3 border-l-2 border-green-200 space-y-1", children: resolved_errors.map(({ error: err, response }, i) => (_jsxs("div", { className: "text-xs flex gap-1.5", children: [_jsxs("span", { className: "inline-flex items-center flex-shrink-0 mt-0.5", children: [_jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-green-500" }), _jsx(HiCheckCircle, { className: "h-3.5 w-3.5 text-green-500 -ml-2" })] }), _jsxs("div", { className: "min-w-0", children: [_jsx("span", { className: "font-medium text-foreground", children: err.rule_name ?? err.type }), _jsxs("div", { className: "mt-0.5", children: [_jsx("span", { className: "text-green-600 font-medium", children: "Accepted: " }), _jsx("span", { className: "text-muted-foreground", children: response.response_choice }), response.user_comment && (_jsxs("p", { className: "text-muted-foreground mt-0.5 italic", children: ["\u201C", response.user_comment, "\u201D"] }))] })] })] }, i))) })] }, file_result.file_id));
|
|
357
|
-
}) }))] }))] }));
|
|
358
|
-
}
|
|
359
|
-
function SuggestedDocumentTypes() {
|
|
360
|
-
const { suggested_document_types, add_document_type, dismiss_suggested_type } = useFbFormContext();
|
|
361
|
-
if (suggested_document_types.length === 0)
|
|
362
|
-
return null;
|
|
363
|
-
return (_jsxs("div", { className: "border border-amber-200 rounded-md bg-amber-50/50 p-3 space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-semibold text-amber-800 uppercase tracking-wide", children: "New Document Types Detected" }), _jsxs("span", { className: "text-xs text-amber-600", children: ["(", suggested_document_types.length, " new)"] })] }), _jsx("p", { className: "text-xs text-amber-700", children: "The AI classified files with document types not in your current list. Add them to improve future validation." }), _jsx("div", { className: "flex flex-wrap gap-2", children: suggested_document_types.map((type_id) => (_jsxs("div", { className: "inline-flex items-center gap-1 px-2 py-1 rounded-md border border-amber-300 bg-white text-sm", children: [_jsx("span", { className: "font-mono text-xs", children: type_id }), _jsx("button", { type: "button", onClick: () => add_document_type(type_id), className: "p-0.5 rounded hover:bg-green-100 text-green-700", title: `Add "${type_id}" to document types`, children: _jsx(HiPlus, { className: "h-3.5 w-3.5" }) }), _jsx("button", { type: "button", onClick: () => dismiss_suggested_type(type_id), className: "p-0.5 rounded hover:bg-muted text-muted-foreground", title: "Dismiss", children: _jsx(HiX, { className: "h-3.5 w-3.5" }) })] }, type_id))) })] }));
|
|
364
|
-
}
|
|
365
|
-
function IgnoredFilesSection({ file_ids, all_blocks, on_view_file }) {
|
|
366
|
-
const [is_open, set_is_open] = useState(false);
|
|
367
|
-
if (file_ids.size === 0)
|
|
368
|
-
return null;
|
|
369
|
-
const blocks = [...file_ids].map((id) => all_blocks.get(id)).filter(Boolean);
|
|
370
|
-
if (blocks.length === 0)
|
|
371
|
-
return null;
|
|
372
|
-
return (_jsxs("div", { className: "border border-gray-200 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_open(!is_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-gray-50 hover:bg-gray-100 transition-colors", children: [is_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsx("span", { className: "text-muted-foreground", children: "Ignored Files" }), _jsxs("span", { className: "text-xs text-muted-foreground", children: ["(", blocks.length, ")"] })] }), is_open && (_jsx("div", { className: "px-3 pb-3 pt-2 flex flex-wrap gap-1.5", children: blocks.map((block, i) => (_jsx(BlockDisplay, { block: block, on_view_file: on_view_file }, i))) }))] }));
|
|
373
|
-
}
|
|
374
|
-
function SkippedValidationSection({ file_ids, all_blocks, on_view_file }) {
|
|
375
|
-
const [is_open, set_is_open] = useState(false);
|
|
376
|
-
if (file_ids.size === 0)
|
|
377
|
-
return null;
|
|
378
|
-
const blocks = [...file_ids].map((id) => all_blocks.get(id)).filter(Boolean);
|
|
379
|
-
if (blocks.length === 0)
|
|
380
|
-
return null;
|
|
381
|
-
return (_jsxs("div", { className: "border border-amber-200 rounded-md overflow-hidden", children: [_jsxs("button", { type: "button", onClick: () => set_is_open(!is_open), className: "flex items-center gap-2 w-full px-3 py-2 text-sm font-medium text-left bg-amber-50/50 hover:bg-amber-50 transition-colors", children: [is_open ? _jsx(HiChevronDown, { className: "h-4 w-4" }) : _jsx(HiChevronRight, { className: "h-4 w-4" }), _jsx("span", { className: "text-amber-800", children: "Skipped Validation" }), _jsxs("span", { className: "text-xs text-amber-600", children: ["(", blocks.length, ")"] })] }), is_open && (_jsx("div", { className: "px-3 pb-3 pt-2 flex flex-wrap gap-1.5", children: blocks.map((block, i) => (_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx(BlockDisplay, { block: block, on_view_file: on_view_file }), _jsx("span", { className: "text-[10px] font-medium text-amber-600 bg-amber-100 px-1.5 py-0.5 rounded", children: "Skipped" })] }, i))) }))] }));
|
|
382
|
-
}
|
|
383
|
-
/** Render tagged + untagged file groups */
|
|
384
|
-
function FileTagGroups({ tag_groups, untagged, available_tags, file_validation_results, classifying_file_ids, queued_file_ids, on_view_file, responded_map, }) {
|
|
385
|
-
const tag_lookup = new Map(available_tags.map((t) => [t.tag_id, t]));
|
|
386
|
-
const ordered_tag_ids = available_tags
|
|
387
|
-
.map((t) => t.tag_id)
|
|
388
|
-
.filter((id) => tag_groups.has(id));
|
|
389
|
-
for (const tag_id of tag_groups.keys()) {
|
|
390
|
-
if (!ordered_tag_ids.includes(tag_id))
|
|
391
|
-
ordered_tag_ids.push(tag_id);
|
|
392
|
-
}
|
|
393
|
-
return (_jsxs(_Fragment, { children: [ordered_tag_ids.map((tag_id) => {
|
|
394
|
-
const tag = tag_lookup.get(tag_id);
|
|
395
|
-
const files = tag_groups.get(tag_id);
|
|
396
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [tag ? (_jsx(TagPill, { tag: tag })) : (_jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: tag_id })), _jsxs("span", { className: "text-xs text-muted-foreground", children: [files.length, " file", files.length !== 1 ? 's' : ''] })] }), _jsx("div", { className: "space-y-1.5 pl-2 border-l-2 border-muted max-w-[600px]", children: files.map((f, i) => {
|
|
397
|
-
const fid = f.block.type === 'file' ? f.block.attachment.file_id : '';
|
|
398
|
-
const file_status = fid ? (classifying_file_ids.has(fid) ? 'classifying' : queued_file_ids.has(fid) ? 'queued' : null) : null;
|
|
399
|
-
return (_jsx(BlockDisplay, { block: f.block, validation: fid ? file_validation_results[fid] : undefined, on_view_file: on_view_file, is_processing: !!file_status, status_icon: file_status, responded_map: responded_map, file_classification: f.file_classification }, i));
|
|
400
|
-
}) })] }, tag_id));
|
|
401
|
-
}), untagged.length > 0 && (_jsxs("div", { className: "space-y-1.5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: "Unclassified" }), _jsxs("span", { className: "text-xs text-muted-foreground", children: [untagged.length, " file", untagged.length !== 1 ? 's' : ''] })] }), _jsx("div", { className: "space-y-1.5 pl-2 border-l-2 border-muted max-w-[600px]", children: untagged.map((f, i) => {
|
|
402
|
-
const fid = f.block.type === 'file' ? f.block.attachment.file_id : '';
|
|
403
|
-
const file_status = fid ? (classifying_file_ids.has(fid) ? 'classifying' : queued_file_ids.has(fid) ? 'queued' : null) : null;
|
|
404
|
-
return (_jsx(BlockDisplay, { block: f.block, validation: fid ? file_validation_results[fid] : undefined, is_processing: !!file_status, status_icon: file_status, responded_map: responded_map, file_classification: f.file_classification }, i));
|
|
405
|
-
}) })] }))] }));
|
|
406
|
-
}
|
|
407
|
-
/** Check if form_data has file blocks (ignoring __ internal keys) */
|
|
408
|
-
function has_file_data(form_data) {
|
|
409
|
-
return Object.entries(form_data).some(([key, v]) => {
|
|
410
|
-
if (key.startsWith('__'))
|
|
411
|
-
return false;
|
|
412
|
-
const blocks = normalize_file_textbox_value(v);
|
|
413
|
-
return blocks.some((b) => b.type === 'file' || (b.type === 'text' && b.content.trim()));
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
/** Collect all file blocks from sections + form_data into a map */
|
|
417
|
-
function collect_file_blocks(front_sections, front_form_data) {
|
|
418
|
-
const map = new Map();
|
|
419
|
-
for (const section of front_sections) {
|
|
420
|
-
for (const group of section.groups || []) {
|
|
421
|
-
for (const field of group.fields || []) {
|
|
422
|
-
const blocks = normalize_file_textbox_value(front_form_data[field.id]);
|
|
423
|
-
for (const block of blocks) {
|
|
424
|
-
if (block.type === 'file')
|
|
425
|
-
map.set(block.attachment.file_id, block);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
for (const [key, value] of Object.entries(front_form_data)) {
|
|
431
|
-
if (key.startsWith('__'))
|
|
432
|
-
continue;
|
|
433
|
-
const blocks = normalize_file_textbox_value(value);
|
|
434
|
-
for (const block of blocks) {
|
|
435
|
-
if (block.type === 'file' && !map.has(block.attachment.file_id)) {
|
|
436
|
-
map.set(block.attachment.file_id, block);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return map;
|
|
441
|
-
}
|
|
442
|
-
/** Status badge styling */
|
|
443
|
-
const INSTANCE_STATUS_STYLES = {
|
|
444
|
-
active: 'bg-blue-100 text-blue-700',
|
|
445
|
-
completed: 'bg-green-100 text-green-700',
|
|
446
|
-
draft: 'bg-gray-100 text-gray-600',
|
|
447
|
-
archived: 'bg-gray-100 text-gray-500',
|
|
448
|
-
};
|
|
449
|
-
export function InterimView({ on_view_file } = {}) {
|
|
450
|
-
const { props, instances, is_multi_instance, classification_results, file_validation_results, ignored_file_ids, skipped_file_ids, classifying_file_ids, queued_file_ids, sent_clarifications, pending_clarification_responses, draft_clarifications, reject_clarification } = useFbFormContext();
|
|
451
|
-
const { front_sections, front_form_data } = props;
|
|
452
|
-
const [is_collapsed, set_is_collapsed] = useState(false);
|
|
453
|
-
const [reject_target, set_reject_target] = useState(null);
|
|
454
|
-
const available_tags = props.available_tags ?? [];
|
|
455
|
-
// Build lookup of responded/resolved clarification IDs → ClarificationItem
|
|
456
|
-
// Includes both flushed (sent) and pending (not yet submitted) responses
|
|
457
|
-
const responded_map = useMemo(() => {
|
|
458
|
-
const map = new Map();
|
|
459
|
-
// Already-flushed responses from sent_clarifications
|
|
460
|
-
for (const item of sent_clarifications) {
|
|
461
|
-
if (item.status === 'responded' || item.status === 'resolved') {
|
|
462
|
-
map.set(item.id, item);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
// Pending responses from front office (not yet flushed via submit)
|
|
466
|
-
for (const [clar_id, response] of pending_clarification_responses) {
|
|
467
|
-
if (response.response_choice && !map.has(clar_id)) {
|
|
468
|
-
// Find the original clarification item from drafts or sent to build a synthetic responded item
|
|
469
|
-
const original = draft_clarifications.find(c => c.id === clar_id)
|
|
470
|
-
?? sent_clarifications.find(c => c.id === clar_id);
|
|
471
|
-
if (original) {
|
|
472
|
-
map.set(clar_id, {
|
|
473
|
-
...original,
|
|
474
|
-
status: 'responded',
|
|
475
|
-
response_choice: response.response_choice,
|
|
476
|
-
user_comment: response.user_comment,
|
|
477
|
-
response_files: response.response_files ?? [],
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
return map;
|
|
483
|
-
}, [sent_clarifications, pending_clarification_responses, draft_clarifications]);
|
|
484
|
-
// Build file_id → block lookup across all instances for ignored/skipped sections
|
|
485
|
-
const all_file_blocks = useMemo(() => {
|
|
486
|
-
if (is_multi_instance) {
|
|
487
|
-
const map = new Map();
|
|
488
|
-
for (const inst of instances) {
|
|
489
|
-
const inst_blocks = collect_file_blocks(inst.front_sections, inst.front_form_data);
|
|
490
|
-
for (const [id, block] of inst_blocks) {
|
|
491
|
-
if (!map.has(id))
|
|
492
|
-
map.set(id, block);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
return map;
|
|
496
|
-
}
|
|
497
|
-
return collect_file_blocks(front_sections, front_form_data);
|
|
498
|
-
}, [is_multi_instance, instances, front_sections, front_form_data]);
|
|
499
|
-
// In multi-instance mode, check if ANY instance has file data
|
|
500
|
-
const has_data = useMemo(() => {
|
|
501
|
-
if (is_multi_instance) {
|
|
502
|
-
return instances.some((inst) => has_file_data(inst.front_form_data));
|
|
503
|
-
}
|
|
504
|
-
return has_file_data(front_form_data);
|
|
505
|
-
}, [is_multi_instance, instances, front_form_data]);
|
|
506
|
-
if (!has_data)
|
|
507
|
-
return null;
|
|
508
|
-
// ── Multi-instance: per-instance file sections ──
|
|
509
|
-
if (is_multi_instance) {
|
|
510
|
-
// Build per-instance grouped files
|
|
511
|
-
const instance_file_groups = instances
|
|
512
|
-
.filter((inst) => has_file_data(inst.front_form_data))
|
|
513
|
-
.map((inst) => {
|
|
514
|
-
const inst_classification = inst.classification_results ?? classification_results;
|
|
515
|
-
const { tag_groups, untagged } = group_files_by_tag(inst.front_sections, inst.front_form_data, inst_classification, available_tags);
|
|
516
|
-
const file_count = [...tag_groups.values()].reduce((sum, files) => sum + files.length, 0) + untagged.length;
|
|
517
|
-
return { instance: inst, tag_groups, untagged, file_count };
|
|
518
|
-
})
|
|
519
|
-
.filter((g) => g.file_count > 0);
|
|
520
|
-
if (instance_file_groups.length === 0)
|
|
521
|
-
return null;
|
|
522
|
-
return (_jsxs("div", { className: "border rounded-lg bg-card shadow-sm overflow-hidden mb-4", children: [_jsxs("button", { type: "button", onClick: () => set_is_collapsed(!is_collapsed), className: "flex items-center gap-2 w-full px-4 py-3 text-sm font-medium text-left bg-muted/30 border-b hover:bg-muted/40 transition-colors", children: [is_collapsed ? _jsx(HiChevronRight, { className: "h-4 w-4" }) : _jsx(HiChevronDown, { className: "h-4 w-4" }), "Client Submissions"] }), !is_collapsed && (_jsxs("div", { className: "pb-4 space-y-1", children: [instance_file_groups.map(({ instance: inst, tag_groups, untagged, file_count }) => {
|
|
523
|
-
const status_cls = INSTANCE_STATUS_STYLES[inst.status] ?? INSTANCE_STATUS_STYLES.draft;
|
|
524
|
-
return (_jsxs("div", { className: "border-b last:border-b-0", children: [_jsxs("div", { className: "flex items-center gap-2 px-4 py-2 bg-muted/15", children: [_jsx("span", { className: cn('inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide', status_cls), children: inst.status }), _jsx("span", { className: "text-sm font-medium text-foreground", children: inst.label }), _jsxs("span", { className: "text-xs text-muted-foreground", children: [file_count, " file", file_count !== 1 ? 's' : ''] })] }), _jsx("div", { className: "px-4 py-3 space-y-3", children: _jsx(FileTagGroups, { tag_groups: tag_groups, untagged: untagged, available_tags: available_tags, file_validation_results: inst.file_validation_results ?? file_validation_results, classifying_file_ids: classifying_file_ids, queued_file_ids: queued_file_ids, on_view_file: on_view_file, responded_map: responded_map }) })] }, inst.instance_id));
|
|
525
|
-
}), _jsxs("div", { className: "px-4 pt-2 space-y-4", children: [_jsx(IgnoredFilesSection, { file_ids: ignored_file_ids, all_blocks: all_file_blocks, on_view_file: on_view_file }), _jsx(SkippedValidationSection, { file_ids: skipped_file_ids, all_blocks: all_file_blocks, on_view_file: on_view_file }), _jsx(ValidationIssuesSection, { validation_results: file_validation_results, responded_map: responded_map, on_view_file: on_view_file, on_reject: set_reject_target }), _jsx(SuggestedDocumentTypes, {})] })] }))] }));
|
|
526
|
-
}
|
|
527
|
-
// ── Single-instance: flat file display (original behavior) ──
|
|
528
|
-
const { tag_groups, untagged } = group_files_by_tag(front_sections, front_form_data, classification_results, available_tags);
|
|
529
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border rounded-lg bg-card shadow-sm overflow-hidden mb-4", children: [_jsxs("button", { type: "button", onClick: () => set_is_collapsed(!is_collapsed), className: "flex items-center gap-2 w-full px-4 py-3 text-sm font-medium text-left bg-muted/30 border-b hover:bg-muted/40 transition-colors", children: [is_collapsed ? _jsx(HiChevronRight, { className: "h-4 w-4" }) : _jsx(HiChevronDown, { className: "h-4 w-4" }), "Client Submissions"] }), !is_collapsed && (_jsxs("div", { className: "px-4 pb-4 space-y-4", children: [_jsx(FileTagGroups, { tag_groups: tag_groups, untagged: untagged, available_tags: available_tags, file_validation_results: file_validation_results, classifying_file_ids: classifying_file_ids, queued_file_ids: queued_file_ids, on_view_file: on_view_file, responded_map: responded_map }), _jsx(IgnoredFilesSection, { file_ids: ignored_file_ids, all_blocks: all_file_blocks, on_view_file: on_view_file }), _jsx(SkippedValidationSection, { file_ids: skipped_file_ids, all_blocks: all_file_blocks, on_view_file: on_view_file }), _jsx(ValidationIssuesSection, { validation_results: file_validation_results, responded_map: responded_map, on_view_file: on_view_file, on_reject: set_reject_target }), _jsx(SuggestedDocumentTypes, {})] }))] }), reject_target && (_jsx(RejectClarificationDialog, { open: !!reject_target, on_open_change: (open) => { if (!open)
|
|
530
|
-
set_reject_target(null); }, item: reject_target, on_confirm: (reason) => {
|
|
531
|
-
reject_clarification(reject_target.id, reason);
|
|
532
|
-
set_reject_target(null);
|
|
533
|
-
} }))] }));
|
|
534
|
-
}
|
|
535
|
-
//# sourceMappingURL=interim_view.js.map
|