hazo_collab_forms 3.0.19 → 3.1.1
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 +66 -0
- package/README.md +15 -0
- package/dist/components/clarification/clarification_card.d.ts.map +1 -1
- package/dist/components/clarification/clarification_card.js +5 -4
- package/dist/components/clarification/clarification_card.js.map +1 -1
- package/dist/components/clarification/clarification_doc_reference.d.ts +7 -0
- package/dist/components/clarification/clarification_doc_reference.d.ts.map +1 -1
- package/dist/components/clarification/clarification_doc_reference.js +2 -2
- package/dist/components/clarification/clarification_doc_reference.js.map +1 -1
- package/dist/components/clarification/clarification_group_card.js +2 -2
- package/dist/components/clarification/clarification_group_card.js.map +1 -1
- package/dist/components/clarification/clarification_item_body.d.ts +1 -7
- package/dist/components/clarification/clarification_item_body.d.ts.map +1 -1
- package/dist/components/clarification/clarification_item_body.js +6 -8
- package/dist/components/clarification/clarification_item_body.js.map +1 -1
- package/dist/components/clarification/clarification_response_form.d.ts +1 -3
- package/dist/components/clarification/clarification_response_form.d.ts.map +1 -1
- package/dist/components/clarification/clarification_response_form.js +31 -95
- package/dist/components/clarification/clarification_response_form.js.map +1 -1
- package/dist/components/clarification/clarification_status_config.d.ts.map +1 -1
- package/dist/components/clarification/clarification_status_config.js +12 -8
- package/dist/components/clarification/clarification_status_config.js.map +1 -1
- package/dist/components/clarification/clarification_thread.d.ts +3 -1
- package/dist/components/clarification/clarification_thread.d.ts.map +1 -1
- package/dist/components/clarification/clarification_thread.js +7 -7
- package/dist/components/clarification/clarification_thread.js.map +1 -1
- package/dist/components/clarification/use_response_files.d.ts +27 -0
- package/dist/components/clarification/use_response_files.d.ts.map +1 -0
- package/dist/components/clarification/use_response_files.js +98 -0
- package/dist/components/clarification/use_response_files.js.map +1 -0
- package/dist/components/hazo_collab_form_file_textbox/file_textbox_panel.js +1 -1
- package/dist/components/hazo_collab_form_file_textbox/file_textbox_panel.js.map +1 -1
- package/dist/components/hazo_fb_form/context.d.ts +5 -0
- package/dist/components/hazo_fb_form/context.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/context.js.map +1 -1
- package/dist/components/hazo_fb_form/hazo_fb_form.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/hazo_fb_form.js +188 -17
- package/dist/components/hazo_fb_form/hazo_fb_form.js.map +1 -1
- package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts +8 -1
- package/dist/components/hazo_fb_form/shared/send_back_item_card.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/shared/send_back_item_card.js +38 -2
- package/dist/components/hazo_fb_form/shared/send_back_item_card.js.map +1 -1
- package/dist/components/hazo_fb_form/types.d.ts +12 -0
- package/dist/components/hazo_fb_form/types.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/views/front_office_view.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/views/front_office_view.js +163 -34
- package/dist/components/hazo_fb_form/views/front_office_view.js.map +1 -1
- package/dist/components/hazo_fb_form/views/review_queue_view.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/views/review_queue_view.js +69 -18
- package/dist/components/hazo_fb_form/views/review_queue_view.js.map +1 -1
- package/dist/components/hazo_fb_form/views/send_back_view.d.ts.map +1 -1
- package/dist/components/hazo_fb_form/views/send_back_view.js +58 -3
- package/dist/components/hazo_fb_form/views/send_back_view.js.map +1 -1
- package/dist/components/hazo_rfi_box/hazo_rfi_box.d.ts +55 -0
- package/dist/components/hazo_rfi_box/hazo_rfi_box.d.ts.map +1 -0
- package/dist/components/hazo_rfi_box/hazo_rfi_box.js +54 -0
- package/dist/components/hazo_rfi_box/hazo_rfi_box.js.map +1 -0
- package/dist/components/hazo_rfi_box/index.d.ts +9 -0
- package/dist/components/hazo_rfi_box/index.d.ts.map +1 -0
- package/dist/components/hazo_rfi_box/index.js +5 -0
- package/dist/components/hazo_rfi_box/index.js.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_option_tag_selector.d.ts +21 -0
- package/dist/components/hazo_rfi_box/rfi_option_tag_selector.d.ts.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_option_tag_selector.js +47 -0
- package/dist/components/hazo_rfi_box/rfi_option_tag_selector.js.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_review_actions.d.ts +11 -0
- package/dist/components/hazo_rfi_box/rfi_review_actions.d.ts.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_review_actions.js +10 -0
- package/dist/components/hazo_rfi_box/rfi_review_actions.js.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_send_back_form.d.ts +23 -0
- package/dist/components/hazo_rfi_box/rfi_send_back_form.d.ts.map +1 -0
- package/dist/components/hazo_rfi_box/rfi_send_back_form.js +22 -0
- package/dist/components/hazo_rfi_box/rfi_send_back_form.js.map +1 -0
- package/dist/components/hazo_validation_rule_editor/components/clarification_settings.d.ts +4 -1
- package/dist/components/hazo_validation_rule_editor/components/clarification_settings.d.ts.map +1 -1
- package/dist/components/hazo_validation_rule_editor/components/clarification_settings.js +15 -3
- package/dist/components/hazo_validation_rule_editor/components/clarification_settings.js.map +1 -1
- package/dist/components/hazo_validation_rule_editor/components/rule_editor.d.ts.map +1 -1
- package/dist/components/hazo_validation_rule_editor/components/rule_editor.js +2 -2
- package/dist/components/hazo_validation_rule_editor/components/rule_editor.js.map +1 -1
- package/dist/components/hazo_validation_rule_editor/context.d.ts +3 -1
- package/dist/components/hazo_validation_rule_editor/context.d.ts.map +1 -1
- package/dist/components/hazo_validation_rule_editor/context.js +5 -2
- package/dist/components/hazo_validation_rule_editor/context.js.map +1 -1
- package/dist/components/hazo_validation_rule_editor/types.d.ts +5 -0
- package/dist/components/hazo_validation_rule_editor/types.d.ts.map +1 -1
- package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts +1 -1
- package/dist/components/hazo_validation_rule_editor/validation_rule_editor.d.ts.map +1 -1
- package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js +2 -2
- package/dist/components/hazo_validation_rule_editor/validation_rule_editor.js.map +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/shared/json_data_panel/index.d.ts +3 -0
- package/dist/components/shared/json_data_panel/index.d.ts.map +1 -0
- package/dist/components/shared/json_data_panel/index.js +2 -0
- package/dist/components/shared/json_data_panel/index.js.map +1 -0
- package/dist/components/shared/json_data_panel/json_data_panel.d.ts +28 -0
- package/dist/components/shared/json_data_panel/json_data_panel.d.ts.map +1 -0
- package/dist/components/shared/json_data_panel/json_data_panel.js +131 -0
- package/dist/components/shared/json_data_panel/json_data_panel.js.map +1 -0
- package/dist/lib/fb_form_handler.d.ts.map +1 -1
- package/dist/lib/fb_form_handler.js +148 -0
- package/dist/lib/fb_form_handler.js.map +1 -1
- package/dist/types/clarification.d.ts +11 -1
- package/dist/types/clarification.d.ts.map +1 -1
- package/dist/types/fb_form_data.d.ts +216 -0
- package/dist/types/fb_form_data.d.ts.map +1 -0
- package/dist/types/fb_form_data.js +117 -0
- package/dist/types/fb_form_data.js.map +1 -0
- package/dist/types/fb_form_instance.d.ts +9 -4
- package/dist/types/fb_form_instance.d.ts.map +1 -1
- package/dist/types/fb_form_instance.js.map +1 -1
- package/dist/types/fb_response_types.d.ts +23 -0
- package/dist/types/fb_response_types.d.ts.map +1 -0
- package/dist/types/fb_response_types.js +5 -0
- package/dist/types/fb_response_types.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/validation.d.ts +2 -0
- package/dist/types/validation.d.ts.map +1 -1
- package/dist/utils/fb_data_adapter.d.ts +28 -0
- package/dist/utils/fb_data_adapter.d.ts.map +1 -0
- package/dist/utils/fb_data_adapter.js +385 -0
- package/dist/utils/fb_data_adapter.js.map +1 -0
- package/dist/utils/fb_data_helpers.d.ts +86 -0
- package/dist/utils/fb_data_helpers.d.ts.map +1 -0
- package/dist/utils/fb_data_helpers.js +269 -0
- package/dist/utils/fb_data_helpers.js.map +1 -0
- package/dist/utils/fb_data_mutations.d.ts +43 -0
- package/dist/utils/fb_data_mutations.d.ts.map +1 -0
- package/dist/utils/fb_data_mutations.js +379 -0
- package/dist/utils/fb_data_mutations.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/resolve_response_set.d.ts +8 -0
- package/dist/utils/resolve_response_set.d.ts.map +1 -0
- package/dist/utils/resolve_response_set.js +37 -0
- package/dist/utils/resolve_response_set.js.map +1 -0
- package/package.json +1 -1
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type React from 'react';
|
|
5
5
|
import type { ViewSection } from '../hazo_collab_form_view/types.js';
|
|
6
|
+
import type { FbResponseType, FbResponseSet } from '../../types/fb_response_types.js';
|
|
6
7
|
import type { FileManagerConfig } from '../../types/file_manager.js';
|
|
7
8
|
import type { NewFieldDefinition } from '../hazo_add_field_dialog/types.js';
|
|
8
9
|
import type { ClarificationItem } from '../../types/clarification.js';
|
|
9
10
|
import type { ValidationRule, ValidationRuleResult } from '../../types/validation.js';
|
|
11
|
+
import type { FbDataEntry } from '../../types/fb_form_data.js';
|
|
10
12
|
/** Tab identifiers for HazoFbForm. 'agent_stepper' activates the guided workflow. */
|
|
11
13
|
export type FbTabId = 'front' | 'client_data' | 'back' | 'clarifications' | 'agent_stepper';
|
|
12
14
|
/** Agent workflow step identifiers */
|
|
@@ -223,6 +225,12 @@ export interface HazoFbFormProps {
|
|
|
223
225
|
on_instance_create?: () => Promise<FbFormInstance>;
|
|
224
226
|
/** Callback when an instance is updated */
|
|
225
227
|
on_instance_update?: (instance_id: string, updates: Partial<FbFormInstance>) => void;
|
|
228
|
+
/** Unified hierarchical data array — the single source of truth for all processing
|
|
229
|
+
* results, validations, clarifications, and review decisions across all instances.
|
|
230
|
+
* When provided, this is used alongside (and eventually replaces) the flat model. */
|
|
231
|
+
data?: FbDataEntry[];
|
|
232
|
+
/** Callback when the hierarchical data array changes */
|
|
233
|
+
on_data_change?: (data: FbDataEntry[]) => void;
|
|
226
234
|
/** Callback when user clicks "Send to Client" button to send instance to client.
|
|
227
235
|
* Only shown for non-first instances in multi-instance mode. */
|
|
228
236
|
on_send_to_client?: (instance_id: string) => void;
|
|
@@ -248,6 +256,10 @@ export interface HazoFbFormProps {
|
|
|
248
256
|
available_document_types?: FbDocumentType[];
|
|
249
257
|
/** Callback when user confirms adding new document types suggested by LLM */
|
|
250
258
|
on_document_types_change?: (types: FbDocumentType[]) => void;
|
|
259
|
+
/** Configured response types for clarification workflows */
|
|
260
|
+
available_response_types?: FbResponseType[];
|
|
261
|
+
/** Configured response sets (named groups of response types) */
|
|
262
|
+
available_response_sets?: FbResponseSet[];
|
|
251
263
|
/** File manager for uploads */
|
|
252
264
|
file_manager?: FileManagerConfig;
|
|
253
265
|
/** PDF viewer component — pass to bypass dynamic import of hazo_pdf.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/hazo_fb_form/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/hazo_fb_form/types.ts"],"names":[],"mappings":"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E,MAAM,CAAC;IACzB,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uBAAuB;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAGlC;;gEAE4D;IAC5D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B,yEAAyE;IACzE,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,6DAA6D;IAC7D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,sEAAsE;IACtE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,gHAAgH;IAChH,qBAAqB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExC;wFACoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtD,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front_office_view.d.ts","sourceRoot":"","sources":["../../../../src/components/hazo_fb_form/views/front_office_view.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAwCH,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"front_office_view.d.ts","sourceRoot":"","sources":["../../../../src/components/hazo_fb_form/views/front_office_view.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAwCH,wBAAgB,eAAe,4CA69D9B"}
|
|
@@ -26,7 +26,7 @@ import { infer_mime_type } from '../shared/format.js';
|
|
|
26
26
|
const LazyAddFieldDialog = React.lazy(() => import('../../hazo_add_field_dialog/hazo_add_field_dialog.js').then(mod => ({ default: mod.HazoAddFieldDialog })));
|
|
27
27
|
const LazyAddGroupDialog = React.lazy(() => import('../../hazo_add_group_dialog/hazo_add_group_dialog.js').then(mod => ({ default: mod.HazoAddGroupDialog })));
|
|
28
28
|
export function FrontOfficeView() {
|
|
29
|
-
const { props, classification_results, trigger_classify_file, classifying_file_ids, queued_file_ids, autofilling_file_ids, sent_clarifications, active_instance, is_multi_instance, all_clarifications, pending_clarification_responses, set_pending_clarification_responses, file_validation_results, set_file_validation_results, validating_file_ids, set_validating_file_ids, draft_clarifications, update_clarification_response, } = useFbFormContext();
|
|
29
|
+
const { props, classification_results, trigger_classify_file, classifying_file_ids, queued_file_ids, autofilling_file_ids, sent_clarifications, active_instance, is_multi_instance, all_clarifications, pending_clarification_responses, set_pending_clarification_responses, file_validation_results, set_file_validation_results, validating_file_ids, set_validating_file_ids, draft_clarifications, update_clarification_response, form_data_entries, } = useFbFormContext();
|
|
30
30
|
const { front_sections, front_form_data, on_front_change, field_textbox_configs, file_manager } = props;
|
|
31
31
|
const { on_add_front_field, on_add_front_group } = props;
|
|
32
32
|
const show_tags = props.show_classification_tags !== false; // default true
|
|
@@ -45,10 +45,11 @@ export function FrontOfficeView() {
|
|
|
45
45
|
// Stepper state — active_front_step lives in context so it persists across tab switches
|
|
46
46
|
const use_stepper = props.front_office_stepper !== false;
|
|
47
47
|
const is_past_instance = active_instance ? is_fb_terminal_status(active_instance.status) : false;
|
|
48
|
+
const is_submitted = active_instance?.status === 'client_submitted' || active_instance?.status === 'client_submitted_auto_review';
|
|
48
49
|
const { active_front_step, set_active_front_step } = useFbFormContext();
|
|
49
50
|
const [completed_steps, set_completed_steps] = useState(new Set());
|
|
50
51
|
const [front_submitted, set_front_submitted] = useState(false);
|
|
51
|
-
const is_front_read_only = front_submitted || is_past_instance;
|
|
52
|
+
const is_front_read_only = front_submitted || is_past_instance || is_submitted;
|
|
52
53
|
// Response validation state keyed by clarification_id
|
|
53
54
|
const [response_validations, set_response_validations] = useState({});
|
|
54
55
|
// Pipeline step tracking per file_id (for 3-step response validation flow)
|
|
@@ -726,35 +727,126 @@ export function FrontOfficeView() {
|
|
|
726
727
|
// Immediate validation clarifications enriched with any pending responses + sent responses
|
|
727
728
|
// so ClarificationSection cards reflect selections made in the inline file dialog (and vice versa)
|
|
728
729
|
// Excludes drafts from backoffice-only rules (those only appear in the Back Office tab)
|
|
730
|
+
// Track which clarification responses have been explicitly confirmed by the user
|
|
731
|
+
const [confirmed_response_ids, set_confirmed_response_ids] = useState(new Set());
|
|
729
732
|
const immediate_clarifications = useMemo(() => {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
// Build lookup: sent clarifications by ID (authoritative for response data)
|
|
734
|
+
const sent_map = new Map(sent_clarifications.map(c => [c.id, c]));
|
|
735
|
+
const seen_ids = new Set();
|
|
736
|
+
// Merge drafts and sent — sent version always wins when it has response data
|
|
737
|
+
const merged = [];
|
|
738
|
+
// 1. Process drafts, enriching with sent/pending response data
|
|
739
|
+
for (const item of draft_clarifications) {
|
|
740
|
+
if (item.rule_id && backoffice_rule_ids.has(item.rule_id))
|
|
741
|
+
continue;
|
|
742
|
+
seen_ids.add(item.id);
|
|
743
|
+
// Sent version with response takes absolute priority
|
|
744
|
+
const sent = sent_map.get(item.id);
|
|
745
|
+
if (sent && (sent.status === 'responded' || sent.status === 'resolved')) {
|
|
746
|
+
merged.push(sent);
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
// Check pending responses (user selected + confirmed but not yet in sent)
|
|
734
750
|
const pending = pending_clarification_responses.get(item.id);
|
|
735
751
|
if (pending) {
|
|
736
|
-
|
|
752
|
+
const is_confirmed = confirmed_response_ids.has(item.id);
|
|
753
|
+
merged.push({
|
|
737
754
|
...item,
|
|
738
|
-
status:
|
|
755
|
+
status: is_confirmed ? 'responded' : item.status,
|
|
739
756
|
response_choice: pending.response_choice ?? item.response_choice,
|
|
740
757
|
user_comment: pending.user_comment ?? item.user_comment,
|
|
741
758
|
response_files: pending.response_files ?? item.response_files,
|
|
742
|
-
};
|
|
759
|
+
});
|
|
760
|
+
continue;
|
|
743
761
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
762
|
+
merged.push(item);
|
|
763
|
+
}
|
|
764
|
+
// 2. Include responded/resolved sent items not in drafts (removed by dedup)
|
|
765
|
+
for (const sent of sent_clarifications) {
|
|
766
|
+
if (seen_ids.has(sent.id))
|
|
767
|
+
continue;
|
|
768
|
+
if (sent.rule_id && backoffice_rule_ids.has(sent.rule_id))
|
|
769
|
+
continue;
|
|
770
|
+
if (sent.status === 'responded' || sent.status === 'resolved') {
|
|
771
|
+
merged.push(sent);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
// Read input_status from the data model to determine resolved state.
|
|
775
|
+
// When a clarification response has input_status: 'complete' in the data model,
|
|
776
|
+
// the card should be resolved/read-only. This is the single source of truth.
|
|
777
|
+
const complete_ids = new Set();
|
|
778
|
+
for (const entry of form_data_entries) {
|
|
779
|
+
// Check nested clarification activities
|
|
780
|
+
const walk_cd = (cd) => {
|
|
781
|
+
if (!cd)
|
|
782
|
+
return;
|
|
783
|
+
for (const cdi of cd) {
|
|
784
|
+
const inputs = Array.isArray(cdi.client_input) ? cdi.client_input : [cdi.client_input];
|
|
785
|
+
for (const inp of inputs) {
|
|
786
|
+
if (inp.input_status === 'complete' && inp.data_option) {
|
|
787
|
+
// Find the clarification ID this client_data belongs to
|
|
788
|
+
// by checking the parent clarification's question_field_id
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
// Walk all activities for client_question types with complete client_data
|
|
794
|
+
if (entry.client_data) {
|
|
795
|
+
for (const cdi of entry.client_data) {
|
|
796
|
+
const inputs = Array.isArray(cdi.client_input) ? cdi.client_input : [cdi.client_input];
|
|
797
|
+
for (const inp of inputs) {
|
|
798
|
+
if (inp.processed_data) {
|
|
799
|
+
for (const pd of inp.processed_data) {
|
|
800
|
+
if (pd.activities) {
|
|
801
|
+
for (const act of pd.activities) {
|
|
802
|
+
if (act.activity_info.activity_type === 'client_question' && act.clarification?.client_data) {
|
|
803
|
+
for (const clr_cdi of act.clarification.client_data) {
|
|
804
|
+
const clr_inputs = Array.isArray(clr_cdi.client_input) ? clr_cdi.client_input : [clr_cdi.client_input];
|
|
805
|
+
for (const clr_inp of clr_inputs) {
|
|
806
|
+
if (clr_inp.input_status === 'complete') {
|
|
807
|
+
complete_ids.add(act.clarification.question.question_field_id);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
// Also check top-level clarification entries
|
|
820
|
+
if (entry.clarification?.client_data) {
|
|
821
|
+
for (const cdi of entry.clarification.client_data) {
|
|
822
|
+
const inputs = Array.isArray(cdi.client_input) ? cdi.client_input : [cdi.client_input];
|
|
823
|
+
for (const inp of inputs) {
|
|
824
|
+
if (inp.input_status === 'complete') {
|
|
825
|
+
complete_ids.add(entry.clarification.question.question_field_id);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return merged.map(item => {
|
|
832
|
+
if (item.status !== 'resolved' && item.status !== 'dismissed') {
|
|
833
|
+
// Check data model input_status OR confirmed_response_ids (for same-session before sync)
|
|
834
|
+
const is_complete_in_data = complete_ids.has(item.id);
|
|
835
|
+
const is_confirmed = confirmed_response_ids.has(item.id);
|
|
836
|
+
const sent_version = sent_map.get(item.id);
|
|
837
|
+
const sent_has_response = !!(sent_version?.response_choice);
|
|
838
|
+
if (is_complete_in_data || is_confirmed || sent_has_response) {
|
|
839
|
+
return {
|
|
840
|
+
...item,
|
|
841
|
+
status: 'resolved',
|
|
842
|
+
response_choice: item.response_choice || sent_version?.response_choice || pending_clarification_responses.get(item.id)?.response_choice,
|
|
843
|
+
user_comment: item.user_comment || sent_version?.user_comment || pending_clarification_responses.get(item.id)?.user_comment,
|
|
844
|
+
};
|
|
845
|
+
}
|
|
754
846
|
}
|
|
755
847
|
return item;
|
|
756
848
|
});
|
|
757
|
-
}, [draft_clarifications, pending_clarification_responses, sent_clarifications, backoffice_rule_ids]);
|
|
849
|
+
}, [draft_clarifications, pending_clarification_responses, sent_clarifications, backoffice_rule_ids, confirmed_response_ids, form_data_entries]);
|
|
758
850
|
const immediate_clarification_counts = useMemo(() => {
|
|
759
851
|
const counts = { pending: 0, responded: 0, resolved: 0, dismissed: 0, total: 0 };
|
|
760
852
|
for (const item of immediate_clarifications) {
|
|
@@ -935,7 +1027,8 @@ export function FrontOfficeView() {
|
|
|
935
1027
|
const updated = current.map(c => {
|
|
936
1028
|
if (c.id !== id)
|
|
937
1029
|
return c;
|
|
938
|
-
// Append client response to thread
|
|
1030
|
+
// Append client response to thread so the back-office review can see it.
|
|
1031
|
+
// The client view filters out the last client entry (shown in RESPONSE SUBMITTED instead).
|
|
939
1032
|
const new_thread_entry = {
|
|
940
1033
|
role: 'client',
|
|
941
1034
|
action: 'responded',
|
|
@@ -994,20 +1087,30 @@ export function FrontOfficeView() {
|
|
|
994
1087
|
], [front_sections, pending_validation_count]);
|
|
995
1088
|
// Collect clarification responses locally (not flushed to back_form_data until submit)
|
|
996
1089
|
// Also immediately inject response files into the file_textbox field so they appear in the form.
|
|
1090
|
+
// Confirm a clarification response — called when user clicks OK after selecting option + adding comment/files
|
|
1091
|
+
const handle_response_confirm = useCallback((id, direct_response) => {
|
|
1092
|
+
const response = direct_response ?? pending_clarification_responses.get(id);
|
|
1093
|
+
if (!response?.response_choice)
|
|
1094
|
+
return;
|
|
1095
|
+
// Mark as confirmed locally
|
|
1096
|
+
set_confirmed_response_ids(prev => { const s = new Set(prev); s.add(id); return s; });
|
|
1097
|
+
// Persist to storage
|
|
1098
|
+
const is_sourced = active_instance?.sourced_clarification_ids?.includes(id);
|
|
1099
|
+
if (is_sourced) {
|
|
1100
|
+
handle_sourced_respond(id, response);
|
|
1101
|
+
}
|
|
1102
|
+
else {
|
|
1103
|
+
update_clarification_response(id, response);
|
|
1104
|
+
}
|
|
1105
|
+
}, [pending_clarification_responses, active_instance, update_clarification_response, handle_sourced_respond]);
|
|
997
1106
|
const handle_response_change = useCallback(async (id, response) => {
|
|
998
1107
|
set_pending_clarification_responses(prev => {
|
|
999
1108
|
const next = new Map(prev);
|
|
1000
1109
|
next.set(id, response);
|
|
1001
1110
|
return next;
|
|
1002
1111
|
});
|
|
1003
|
-
//
|
|
1004
|
-
//
|
|
1005
|
-
// only persist on explicit submit (OK button), not on selection change,
|
|
1006
|
-
// because the user may still be adding files or editing their response.
|
|
1007
|
-
const is_sourced = active_instance?.sourced_clarification_ids?.includes(id);
|
|
1008
|
-
if (response.response_choice && !is_sourced) {
|
|
1009
|
-
update_clarification_response(id, response);
|
|
1010
|
-
}
|
|
1112
|
+
// Don't persist on selection change — wait for explicit confirm (OK button).
|
|
1113
|
+
// Response is tracked in pending_clarification_responses until confirmed.
|
|
1011
1114
|
// Reset response validation when files change
|
|
1012
1115
|
const prev_response = pending_clarification_responses.get(id);
|
|
1013
1116
|
const prev_file_count = prev_response?.response_files?.length ?? 0;
|
|
@@ -1087,7 +1190,20 @@ export function FrontOfficeView() {
|
|
|
1087
1190
|
return file_manager.callbacks.get_download_url(viewed_file.file_id, viewed_file.visibility);
|
|
1088
1191
|
}, [viewed_file, file_manager]);
|
|
1089
1192
|
// ── Step 0: Form fields content ──
|
|
1090
|
-
const step_0_content = (_jsxs("div", { className: "space-y-6", children: [!is_multi_instance && pending_clarifications.length > 0 && (_jsx(ClarificationSection, { items: pending_clarifications, counts: pending_counts, callbacks: {
|
|
1193
|
+
const step_0_content = (_jsxs("div", { className: "space-y-6", children: [!is_multi_instance && pending_clarifications.length > 0 && (_jsx(ClarificationSection, { items: pending_clarifications, counts: pending_counts, callbacks: { on_respond: is_front_read_only ? undefined : (id, response) => {
|
|
1194
|
+
set_pending_clarification_responses(prev => { const next = new Map(prev); next.set(id, response); return next; });
|
|
1195
|
+
handle_response_confirm(id, response);
|
|
1196
|
+
} }, hide_submit: false, submit_label: "OK", compact: true, collapsible: true, card_label: "Action Required", preserve_order: true, on_response_change: handle_response_change, on_doc_click: file_manager ? handle_clarification_doc_click : undefined, on_doc_view: file_manager ? handle_clarification_doc_view : undefined, file_validation: file_validation_badges, response_validations: response_validations, on_validation_click: set_validation_detail_file_id, file_validation_details: per_file_validation_details, file_pipeline_status: per_file_pipeline_status })), sourced_clarifications.length > 0 && (_jsx(ClarificationSection, { items: sourced_clarifications.map(item => {
|
|
1197
|
+
// For responded items, strip the last client response from the thread
|
|
1198
|
+
// since it's already shown in the RESPONSE SUBMITTED section below
|
|
1199
|
+
if (item.status === 'responded' && item.thread?.length) {
|
|
1200
|
+
const last = item.thread[item.thread.length - 1];
|
|
1201
|
+
if (last.role === 'client' && last.action === 'responded') {
|
|
1202
|
+
return { ...item, thread: item.thread.slice(0, -1) };
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return item;
|
|
1206
|
+
}), counts: {
|
|
1091
1207
|
pending: sourced_clarifications.filter(c => c.status === 'pending').length,
|
|
1092
1208
|
responded: sourced_clarifications.filter(c => c.status === 'responded').length,
|
|
1093
1209
|
resolved: sourced_clarifications.filter(c => c.status === 'resolved').length,
|
|
@@ -1111,7 +1227,11 @@ export function FrontOfficeView() {
|
|
|
1111
1227
|
// Check if any file has failed rule_results without corresponding clarification items
|
|
1112
1228
|
const has_unclarified_rule_failures = useMemo(() => Object.values(file_validation_results).some(vr => vr.rule_results?.some(r => r.has_issue)), [file_validation_results]);
|
|
1113
1229
|
// ── Step 1: Validation Issues content ──
|
|
1114
|
-
const step_1_content = (_jsx("div", { className: "space-y-6", children: immediate_clarifications.length > 0 ? (_jsx(ClarificationSection, { items: immediate_clarifications, counts: immediate_clarification_counts, callbacks: {
|
|
1230
|
+
const step_1_content = (_jsx("div", { className: "space-y-6", children: immediate_clarifications.length > 0 ? (_jsx(ClarificationSection, { items: immediate_clarifications, counts: immediate_clarification_counts, callbacks: { on_respond: is_front_read_only ? undefined : (id, response) => {
|
|
1231
|
+
// Store the response in pending state, then confirm it
|
|
1232
|
+
set_pending_clarification_responses(prev => { const next = new Map(prev); next.set(id, response); return next; });
|
|
1233
|
+
handle_response_confirm(id, response);
|
|
1234
|
+
} }, hide_submit: false, submit_label: "OK", hide_header: true, on_response_change: is_front_read_only ? undefined : handle_response_change, on_doc_click: file_manager ? handle_clarification_doc_click : undefined, on_doc_view: file_manager ? handle_clarification_doc_view : undefined, file_manager: file_manager?.callbacks, read_only: is_front_read_only, file_validation: file_validation_badges, response_validations: response_validations, on_validation_click: set_validation_detail_file_id, file_validation_details: per_file_validation_details, file_pipeline_status: per_file_pipeline_status })) : (classifying_file_ids.size > 0 || queued_file_ids.size > 0 || validating_file_ids.size > 0 || autofilling_file_ids.size > 0) ? (_jsx("div", { className: "border rounded-lg bg-card shadow-sm overflow-hidden", children: _jsxs("div", { className: "flex items-center justify-center gap-3 px-5 py-12", children: [_jsx(LuLoader, { className: "h-8 w-8 text-amber-500 animate-spin flex-shrink-0" }), _jsxs("div", { children: [_jsx("h3", { className: "text-base font-semibold text-amber-700", children: "Files are being processed" }), _jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: "Please wait for processing to complete." })] })] }) })) : has_unclarified_rule_failures ? (_jsx("div", { className: "border rounded-lg bg-card shadow-sm overflow-hidden", children: _jsxs("div", { className: "flex items-center justify-center gap-3 px-5 py-12", children: [_jsx(HiExclamationCircle, { className: "h-8 w-8 text-amber-500 flex-shrink-0" }), _jsxs("div", { children: [_jsx("h3", { className: "text-base font-semibold text-amber-700", children: "Validation issues found" }), _jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: "Some checks failed. Click the validation icon on file(s) for details." })] })] }) })) : (_jsx("div", { className: "border rounded-lg bg-card shadow-sm overflow-hidden", children: _jsxs("div", { className: "flex items-center justify-center gap-3 px-5 py-12", children: [_jsx(HiCheckCircle, { className: "h-8 w-8 text-green-500 flex-shrink-0" }), _jsxs("div", { children: [_jsx("h3", { className: "text-base font-semibold text-green-700", children: "All checks passed" }), _jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: "No validation issues found." })] })] }) })) }));
|
|
1115
1235
|
// ── Step 2: Summary & Review content ──
|
|
1116
1236
|
const step_2_content = (_jsx(SummaryReviewView, { on_file_view: file_manager ? handle_file_view : undefined, on_submitted: () => set_front_submitted(true), on_go_to_clarifications: () => set_active_front_step(1) }));
|
|
1117
1237
|
// ── Next / OK button ──
|
|
@@ -1137,7 +1257,10 @@ export function FrontOfficeView() {
|
|
|
1137
1257
|
file_counts.total++;
|
|
1138
1258
|
}
|
|
1139
1259
|
return (_jsx(HazoUiDialog, { open: true, onOpenChange: (open) => { if (!open)
|
|
1140
|
-
set_validation_detail_file_id(null); }, title: "Validation Issues", description: `${file_clarifications.length} issue${file_clarifications.length !== 1 ? 's' : ''} found in ${vr.file_name}`, sizeWidth: "48rem", headerBar: true, showCancelButton: false, cancelButtonText: "", actionButtonText: "Close", onConfirm: () => set_validation_detail_file_id(null), headerClassName: "[&_*]:break-all", children: _jsx(ClarificationSection, { items: file_clarifications, counts: file_counts, callbacks: {
|
|
1260
|
+
set_validation_detail_file_id(null); }, title: "Validation Issues", description: `${file_clarifications.length} issue${file_clarifications.length !== 1 ? 's' : ''} found in ${vr.file_name}`, sizeWidth: "48rem", headerBar: true, showCancelButton: false, cancelButtonText: "", actionButtonText: "Close", onConfirm: () => set_validation_detail_file_id(null), headerClassName: "[&_*]:break-all", children: _jsx(ClarificationSection, { items: file_clarifications, counts: file_counts, callbacks: { on_respond: is_front_read_only ? undefined : (id, response) => {
|
|
1261
|
+
set_pending_clarification_responses(prev => { const next = new Map(prev); next.set(id, response); return next; });
|
|
1262
|
+
handle_response_confirm(id, response);
|
|
1263
|
+
} }, hide_submit: false, submit_label: "Submit Response", hide_header: true, on_response_change: is_front_read_only ? undefined : handle_response_change, on_doc_click: file_manager ? handle_clarification_doc_click : undefined, on_doc_view: file_manager ? handle_clarification_doc_view : undefined, file_manager: file_manager?.callbacks, read_only: is_front_read_only, file_validation: file_validation_badges, response_validations: response_validations, on_validation_click: set_validation_detail_file_id, file_validation_details: per_file_validation_details, file_pipeline_status: per_file_pipeline_status }) }));
|
|
1141
1264
|
}
|
|
1142
1265
|
const status_label = vr.status === 'passed' ? 'Passed' : vr.status === 'skipped' ? 'Skipped' : vr.status === 'failed' ? 'Failed' : vr.status;
|
|
1143
1266
|
return (_jsx(HazoUiDialog, { open: true, onOpenChange: (open) => { if (!open)
|
|
@@ -1156,7 +1279,10 @@ export function FrontOfficeView() {
|
|
|
1156
1279
|
}) })] })), vr.status === 'validating' && (_jsxs("div", { className: "flex items-center gap-2 rounded-md p-2 border border-blue-200 bg-blue-50/50", children: [_jsx("span", { className: "h-4 w-4 border-2 border-blue-300 border-t-blue-600 rounded-full animate-spin flex-shrink-0" }), _jsx("span", { className: "text-sm text-blue-700", children: "Running additional checks..." })] }))] })) : (_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 validation rules matched this file."] })) }) }));
|
|
1157
1280
|
})()] })) : (
|
|
1158
1281
|
/* Legacy scrollable layout (front_office_stepper={false}) */
|
|
1159
|
-
_jsxs("div", { className: "space-y-6", children: [step_0_content, immediate_clarifications.length > 0 && (_jsxs("div", { className: "border border-red-200/60 rounded-xl bg-card overflow-hidden", children: [_jsxs("div", { className: "flex items-center gap-2 px-5 py-3 border-b border-red-100/80", children: [_jsx("h3", { className: "text-sm font-semibold text-red-700", children: "Clarifications" }), _jsx("span", { className: "text-[10px] text-red-600 bg-red-100 px-1.5 py-px rounded font-medium", children: immediate_clarifications.length })] }), _jsx("div", { className: "p-5", children: _jsx(ClarificationSection, { items: immediate_clarifications, counts: immediate_clarification_counts, callbacks: {
|
|
1282
|
+
_jsxs("div", { className: "space-y-6", children: [step_0_content, immediate_clarifications.length > 0 && (_jsxs("div", { className: "border border-red-200/60 rounded-xl bg-card overflow-hidden", children: [_jsxs("div", { className: "flex items-center gap-2 px-5 py-3 border-b border-red-100/80", children: [_jsx("h3", { className: "text-sm font-semibold text-red-700", children: "Clarifications" }), _jsx("span", { className: "text-[10px] text-red-600 bg-red-100 px-1.5 py-px rounded font-medium", children: immediate_clarifications.length })] }), _jsx("div", { className: "p-5", children: _jsx(ClarificationSection, { items: immediate_clarifications, counts: immediate_clarification_counts, callbacks: { on_respond: is_front_read_only ? undefined : (id, response) => {
|
|
1283
|
+
set_pending_clarification_responses(prev => { const next = new Map(prev); next.set(id, response); return next; });
|
|
1284
|
+
handle_response_confirm(id, response);
|
|
1285
|
+
} }, hide_submit: false, submit_label: "Submit Response", hide_header: true, on_response_change: is_front_read_only ? undefined : handle_response_change, on_doc_click: file_manager ? handle_clarification_doc_click : undefined, on_doc_view: file_manager ? handle_clarification_doc_view : undefined, file_manager: file_manager?.callbacks, read_only: is_front_read_only, file_validation: file_validation_badges, response_validations: response_validations, on_validation_click: set_validation_detail_file_id, file_validation_details: per_file_validation_details, file_pipeline_status: per_file_pipeline_status }) })] })), _jsx(SummaryReviewView, { on_file_view: file_manager ? handle_file_view : undefined, on_submitted: () => set_front_submitted(true) }), validation_detail_file_id && (() => {
|
|
1160
1286
|
const vr = file_validation_results[validation_detail_file_id];
|
|
1161
1287
|
if (!vr)
|
|
1162
1288
|
return null;
|
|
@@ -1172,7 +1298,10 @@ export function FrontOfficeView() {
|
|
|
1172
1298
|
file_counts.total++;
|
|
1173
1299
|
}
|
|
1174
1300
|
return (_jsx(HazoUiDialog, { open: true, onOpenChange: (open) => { if (!open)
|
|
1175
|
-
set_validation_detail_file_id(null); }, title: "Validation Issues", description: `${file_clarifications.length} issue${file_clarifications.length !== 1 ? 's' : ''} found in ${vr.file_name}`, sizeWidth: "48rem", headerBar: true, showCancelButton: false, cancelButtonText: "", actionButtonText: "Close", onConfirm: () => set_validation_detail_file_id(null), headerClassName: "[&_*]:break-all", children: _jsx(ClarificationSection, { items: file_clarifications, counts: file_counts, callbacks: {
|
|
1301
|
+
set_validation_detail_file_id(null); }, title: "Validation Issues", description: `${file_clarifications.length} issue${file_clarifications.length !== 1 ? 's' : ''} found in ${vr.file_name}`, sizeWidth: "48rem", headerBar: true, showCancelButton: false, cancelButtonText: "", actionButtonText: "Close", onConfirm: () => set_validation_detail_file_id(null), headerClassName: "[&_*]:break-all", children: _jsx(ClarificationSection, { items: file_clarifications, counts: file_counts, callbacks: { on_respond: is_front_read_only ? undefined : (id, response) => {
|
|
1302
|
+
set_pending_clarification_responses(prev => { const next = new Map(prev); next.set(id, response); return next; });
|
|
1303
|
+
handle_response_confirm(id, response);
|
|
1304
|
+
} }, hide_submit: false, submit_label: "Submit Response", hide_header: true, on_response_change: is_front_read_only ? undefined : handle_response_change, on_doc_click: file_manager ? handle_clarification_doc_click : undefined, on_doc_view: file_manager ? handle_clarification_doc_view : undefined, file_manager: file_manager?.callbacks, read_only: is_front_read_only, file_validation: file_validation_badges, response_validations: response_validations, on_validation_click: set_validation_detail_file_id, file_validation_details: per_file_validation_details, file_pipeline_status: per_file_pipeline_status }) }));
|
|
1176
1305
|
}
|
|
1177
1306
|
const status_label = vr.status === 'passed' ? 'Passed' : vr.status === 'skipped' ? 'Skipped' : vr.status === 'failed' ? 'Failed' : vr.status;
|
|
1178
1307
|
return (_jsx(HazoUiDialog, { open: true, onOpenChange: (open) => { if (!open)
|