@kelpie/ui 0.16.0 → 0.18.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/dist/api/client.d.ts +1 -1
- package/dist/api/resources/ai.d.ts +21 -0
- package/dist/api/resources/ai.d.ts.map +1 -0
- package/dist/api/resources/ai.js +101 -0
- package/dist/api/resources/ai.js.map +1 -0
- package/dist/api/resources/conversions.js +1 -1
- package/dist/api/resources/conversions.js.map +1 -1
- package/dist/api/resources/forms.d.ts +8 -0
- package/dist/api/resources/forms.d.ts.map +1 -1
- package/dist/api/resources/forms.js +39 -0
- package/dist/api/resources/forms.js.map +1 -1
- package/dist/api/resources/personIntake.d.ts +12 -0
- package/dist/api/resources/personIntake.d.ts.map +1 -0
- package/dist/api/resources/personIntake.js +54 -0
- package/dist/api/resources/personIntake.js.map +1 -0
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +3 -1
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/workspace.d.ts +2 -2
- package/dist/api/resources/workspace.js +2 -2
- package/dist/app/KelpieApp.js +2 -2
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ActivitiesPanel.d.ts +7 -4
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +12 -2
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/ActivityAction.d.ts +15 -0
- package/dist/components/ActivityAction.d.ts.map +1 -0
- package/dist/components/ActivityAction.js +20 -0
- package/dist/components/ActivityAction.js.map +1 -0
- package/dist/components/AgentTasks.d.ts +5 -0
- package/dist/components/AgentTasks.d.ts.map +1 -1
- package/dist/components/AgentTasks.js +88 -10
- package/dist/components/AgentTasks.js.map +1 -1
- package/dist/components/DecisionsPanel.d.ts.map +1 -1
- package/dist/components/DecisionsPanel.js +3 -1
- package/dist/components/DecisionsPanel.js.map +1 -1
- package/dist/components/LinkedText.d.ts +12 -0
- package/dist/components/LinkedText.d.ts.map +1 -0
- package/dist/components/LinkedText.js +25 -0
- package/dist/components/LinkedText.js.map +1 -0
- package/dist/components/MarkdownView.d.ts +3 -1
- package/dist/components/MarkdownView.d.ts.map +1 -1
- package/dist/components/MarkdownView.js +17 -3
- package/dist/components/MarkdownView.js.map +1 -1
- package/dist/components/NotesPanel.d.ts +2 -1
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +6 -7
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/PersonIntakeDialog.d.ts +19 -0
- package/dist/components/PersonIntakeDialog.d.ts.map +1 -0
- package/dist/components/PersonIntakeDialog.js +87 -0
- package/dist/components/PersonIntakeDialog.js.map +1 -0
- package/dist/components/PlanPanel.d.ts.map +1 -1
- package/dist/components/PlanPanel.js +3 -1
- package/dist/components/PlanPanel.js.map +1 -1
- package/dist/components/RecordLinkTextarea.d.ts +12 -0
- package/dist/components/RecordLinkTextarea.d.ts.map +1 -0
- package/dist/components/RecordLinkTextarea.js +142 -0
- package/dist/components/RecordLinkTextarea.js.map +1 -0
- package/dist/components/Shell.js +1 -1
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/WorkspaceSwitcher.d.ts +2 -1
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -1
- package/dist/components/WorkspaceSwitcher.js +7 -2
- package/dist/components/WorkspaceSwitcher.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/fragmentTarget.d.ts +18 -0
- package/dist/lib/fragmentTarget.d.ts.map +1 -0
- package/dist/lib/fragmentTarget.js +73 -0
- package/dist/lib/fragmentTarget.js.map +1 -0
- package/dist/lib/recordLinks.d.ts +17 -0
- package/dist/lib/recordLinks.d.ts.map +1 -0
- package/dist/lib/recordLinks.js +48 -0
- package/dist/lib/recordLinks.js.map +1 -0
- package/dist/lib/recordReferences.d.ts +41 -0
- package/dist/lib/recordReferences.d.ts.map +1 -0
- package/dist/lib/recordReferences.js +92 -0
- package/dist/lib/recordReferences.js.map +1 -0
- package/dist/modules/PersonIntakeWizard.d.ts +3 -0
- package/dist/modules/PersonIntakeWizard.d.ts.map +1 -0
- package/dist/modules/PersonIntakeWizard.js +223 -0
- package/dist/modules/PersonIntakeWizard.js.map +1 -0
- package/dist/modules/ai.d.ts +14 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +26 -0
- package/dist/modules/ai.js.map +1 -0
- package/dist/modules/aiRunner.d.ts +3 -0
- package/dist/modules/aiRunner.d.ts.map +1 -0
- package/dist/modules/aiRunner.js +68 -0
- package/dist/modules/aiRunner.js.map +1 -0
- package/dist/modules/personIntakeSelection.d.ts +7 -0
- package/dist/modules/personIntakeSelection.d.ts.map +1 -0
- package/dist/modules/personIntakeSelection.js +21 -0
- package/dist/modules/personIntakeSelection.js.map +1 -0
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +2 -1
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +2 -1
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/EnquiryDetail.d.ts.map +1 -1
- package/dist/pages/EnquiryDetail.js +2 -1
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.d.ts.map +1 -1
- package/dist/pages/EventDetail.js +2 -1
- package/dist/pages/EventDetail.js.map +1 -1
- package/dist/pages/FormsPage.js +4 -4
- package/dist/pages/FormsPage.js.map +1 -1
- package/dist/pages/OpportunityDetail.d.ts.map +1 -1
- package/dist/pages/OpportunityDetail.js +2 -1
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.d.ts.map +1 -1
- package/dist/pages/PartnershipDetail.js +2 -1
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +7 -1
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +2 -1
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/RaiseDetail.d.ts.map +1 -1
- package/dist/pages/RaiseDetail.js +2 -1
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +26 -14
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/admin/AiAdminPage.d.ts +2 -0
- package/dist/pages/admin/AiAdminPage.d.ts.map +1 -0
- package/dist/pages/admin/AiAdminPage.js +19 -0
- package/dist/pages/admin/AiAdminPage.js.map +1 -0
- package/dist/pages/admin/AiPage.d.ts +5 -0
- package/dist/pages/admin/AiPage.d.ts.map +1 -0
- package/dist/pages/admin/AiPage.js +196 -0
- package/dist/pages/admin/AiPage.js.map +1 -0
- package/dist/pages/admin/McpPage.js +2 -2
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/McpPanel.d.ts +3 -0
- package/dist/pages/admin/McpPanel.d.ts.map +1 -0
- package/dist/pages/admin/McpPanel.js +123 -0
- package/dist/pages/admin/McpPanel.js.map +1 -0
- package/dist/pages/admin/PrivacyPage.js +19 -3
- package/dist/pages/admin/PrivacyPage.js.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts +5 -6
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.js +12 -17
- package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
- package/dist/pages/dashboard/attention.d.ts +0 -5
- package/dist/pages/dashboard/attention.d.ts.map +1 -1
- package/dist/pages/dashboard/attention.js +1 -21
- package/dist/pages/dashboard/attention.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +6 -3
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/EmbedPanel.js +5 -2
- package/dist/pages/forms/EmbedPanel.js.map +1 -1
- package/dist/pages/forms/FieldsEditor.d.ts.map +1 -1
- package/dist/pages/forms/FieldsEditor.js +90 -8
- package/dist/pages/forms/FieldsEditor.js.map +1 -1
- package/dist/pages/forms/FormSettings.d.ts.map +1 -1
- package/dist/pages/forms/FormSettings.js +73 -6
- package/dist/pages/forms/FormSettings.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +2 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +2 -1
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/forms/fieldList.d.ts +2 -2
- package/dist/pages/forms/fieldList.d.ts.map +1 -1
- package/dist/pages/forms/fieldList.js +38 -10
- package/dist/pages/forms/fieldList.js.map +1 -1
- package/dist/pages/forms/template.d.ts.map +1 -1
- package/dist/pages/forms/template.js +13 -0
- package/dist/pages/forms/template.js.map +1 -1
- package/dist/pages/handbook/HandbookPage.d.ts.map +1 -1
- package/dist/pages/handbook/HandbookPage.js +2 -3
- package/dist/pages/handbook/HandbookPage.js.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.js +9 -27
- package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +9 -0
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +11 -0
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -1
- package/dist/registry/context.d.ts +7 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +12 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +70 -1
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/registry.d.ts +12 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +21 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +1 -1
- package/src/api/resources/ai.ts +120 -0
- package/src/api/resources/conversions.ts +1 -1
- package/src/api/resources/forms.ts +56 -0
- package/src/api/resources/personIntake.ts +95 -0
- package/src/api/resources/session.ts +3 -1
- package/src/api/resources/workspace.ts +4 -4
- package/src/app/KelpieApp.tsx +4 -2
- package/src/components/ActivitiesPanel.tsx +39 -10
- package/src/components/ActivityAction.tsx +33 -0
- package/src/components/AgentTasks.tsx +138 -10
- package/src/components/DecisionsPanel.tsx +9 -1
- package/src/components/LinkedText.tsx +51 -0
- package/src/components/MarkdownView.tsx +37 -7
- package/src/components/NotesPanel.tsx +18 -12
- package/src/components/PersonIntakeDialog.tsx +226 -0
- package/src/components/PlanPanel.tsx +9 -1
- package/src/components/RecordLinkTextarea.tsx +257 -0
- package/src/components/Shell.tsx +1 -1
- package/src/components/WorkspaceSwitcher.tsx +15 -1
- package/src/index.ts +16 -0
- package/src/lib/fragmentTarget.ts +96 -0
- package/src/lib/recordLinks.ts +57 -0
- package/src/lib/recordReferences.ts +139 -0
- package/src/modules/PersonIntakeWizard.tsx +633 -0
- package/src/modules/ai.tsx +27 -0
- package/src/modules/aiRunner.ts +83 -0
- package/src/modules/personIntakeSelection.ts +24 -0
- package/src/pages/CompanyDetail.tsx +2 -1
- package/src/pages/DealDetail.tsx +2 -1
- package/src/pages/EnquiryDetail.tsx +2 -1
- package/src/pages/EventDetail.tsx +2 -1
- package/src/pages/FormsPage.tsx +4 -4
- package/src/pages/OpportunityDetail.tsx +2 -1
- package/src/pages/PartnershipDetail.tsx +2 -1
- package/src/pages/PeoplePage.tsx +21 -5
- package/src/pages/PersonDetail.tsx +2 -1
- package/src/pages/RaiseDetail.tsx +2 -1
- package/src/pages/SearchPage.tsx +30 -15
- package/src/pages/admin/AiAdminPage.tsx +52 -0
- package/src/pages/admin/AiPage.tsx +457 -0
- package/src/pages/admin/{McpPage.tsx → McpPanel.tsx} +15 -11
- package/src/pages/admin/PrivacyPage.tsx +42 -0
- package/src/pages/admin/WorkspaceSettingsPage.tsx +13 -28
- package/src/pages/dashboard/attention.ts +1 -24
- package/src/pages/dashboard/sections.tsx +9 -4
- package/src/pages/forms/EmbedPanel.tsx +5 -1
- package/src/pages/forms/FieldsEditor.tsx +204 -15
- package/src/pages/forms/FormSettings.tsx +156 -9
- package/src/pages/forms/SubmissionDetail.tsx +2 -1
- package/src/pages/forms/SubmissionsTable.tsx +2 -1
- package/src/pages/forms/fieldList.ts +39 -10
- package/src/pages/forms/template.ts +13 -0
- package/src/pages/handbook/HandbookPage.tsx +5 -6
- package/src/pages/onboarding/WorkspaceStepPage.tsx +19 -43
- package/src/pages/onboarding/onboardingRerun.ts +14 -0
- package/src/registry/context.ts +19 -0
- package/src/registry/contributions.ts +64 -1
- package/src/registry/registry.ts +48 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAqB,CAAA;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAuB,CAAA;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAaxF,OAAO,EACL,YAAY,EACZ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
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export interface FragmentTarget<T extends HTMLElement> {
|
|
3
|
+
readonly ref: RefObject<T | null>;
|
|
4
|
+
readonly highlighted: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useFragmentTarget<T extends HTMLElement>(id: string): FragmentTarget<T>;
|
|
7
|
+
/**
|
|
8
|
+
* A detail page's active tab, opened on the tab a fragment points into.
|
|
9
|
+
*
|
|
10
|
+
* `/companies/com_1#note_1` must land on Notes, or the row it names is not on
|
|
11
|
+
* screen to scroll to. The fragment picks the tab on the first render and again
|
|
12
|
+
* whenever it changes, so a link to another note on the same page switches too.
|
|
13
|
+
* Anything else starts on Overview, and a click on a tab still wins.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRecordTab(): readonly [string, (tab: string) => void];
|
|
16
|
+
/** The classes a highlighted row adds. */
|
|
17
|
+
export declare const FRAGMENT_HIGHLIGHT = "bg-accent-soft/40 ring-2 ring-accent/40";
|
|
18
|
+
//# sourceMappingURL=fragmentTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragmentTarget.d.ts","sourceRoot":"","sources":["../../src/lib/fragmentTarget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAiBtC,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,WAAW;IACnD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IACjC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAA;CAC9B;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CA8BtF;AAkBD;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,CAavE;AAED,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,4CAA4C,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useLocation } from 'react-router';
|
|
3
|
+
/**
|
|
4
|
+
* A row a link can point at: `/companies/com_1#note_1` opens the company and
|
|
5
|
+
* brings note `note_1` into view.
|
|
6
|
+
*
|
|
7
|
+
* Notes, Decisions and Plan items have no page of their own, so a link to one
|
|
8
|
+
* opens the record it is on with the item's id as the fragment. The row whose id
|
|
9
|
+
* matches scrolls to the middle of the screen and is highlighted for a moment, so
|
|
10
|
+
* the reader sees which one was meant. A row on a later page of its panel is not
|
|
11
|
+
* on screen, and nothing happens.
|
|
12
|
+
*/
|
|
13
|
+
/** How long the highlight stays, in milliseconds. */
|
|
14
|
+
const HIGHLIGHT_MS = 2000;
|
|
15
|
+
export function useFragmentTarget(id) {
|
|
16
|
+
const { hash } = useLocation();
|
|
17
|
+
const ref = useRef(null);
|
|
18
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
19
|
+
const targeted = hash === `#${id}`;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!targeted) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const element = ref.current;
|
|
25
|
+
// jsdom has no layout, and so no `scrollIntoView`.
|
|
26
|
+
if (element !== null && typeof element.scrollIntoView === 'function') {
|
|
27
|
+
element.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
28
|
+
}
|
|
29
|
+
setHighlighted(true);
|
|
30
|
+
const timer = window.setTimeout(() => {
|
|
31
|
+
setHighlighted(false);
|
|
32
|
+
}, HIGHLIGHT_MS);
|
|
33
|
+
return () => {
|
|
34
|
+
window.clearTimeout(timer);
|
|
35
|
+
};
|
|
36
|
+
}, [targeted]);
|
|
37
|
+
return { ref, highlighted };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The detail-page tab that holds a row with this id prefix. Every record page
|
|
41
|
+
* names these three tabs the same.
|
|
42
|
+
*/
|
|
43
|
+
const TAB_BY_PREFIX = [
|
|
44
|
+
['note_', 'notes'],
|
|
45
|
+
['dec_', 'decisions'],
|
|
46
|
+
['plan_', 'plan'],
|
|
47
|
+
];
|
|
48
|
+
function tabForHash(hash) {
|
|
49
|
+
const id = hash.startsWith('#') ? hash.slice(1) : hash;
|
|
50
|
+
return TAB_BY_PREFIX.find(([prefix]) => id.startsWith(prefix))?.[1];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A detail page's active tab, opened on the tab a fragment points into.
|
|
54
|
+
*
|
|
55
|
+
* `/companies/com_1#note_1` must land on Notes, or the row it names is not on
|
|
56
|
+
* screen to scroll to. The fragment picks the tab on the first render and again
|
|
57
|
+
* whenever it changes, so a link to another note on the same page switches too.
|
|
58
|
+
* Anything else starts on Overview, and a click on a tab still wins.
|
|
59
|
+
*/
|
|
60
|
+
export function useRecordTab() {
|
|
61
|
+
const { hash } = useLocation();
|
|
62
|
+
const [tab, setTab] = useState(() => tabForHash(hash) ?? 'overview');
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const fromHash = tabForHash(hash);
|
|
65
|
+
if (fromHash !== undefined) {
|
|
66
|
+
setTab(fromHash);
|
|
67
|
+
}
|
|
68
|
+
}, [hash]);
|
|
69
|
+
return [tab, setTab];
|
|
70
|
+
}
|
|
71
|
+
/** The classes a highlighted row adds. */
|
|
72
|
+
export const FRAGMENT_HIGHLIGHT = 'bg-accent-soft/40 ring-2 ring-accent/40';
|
|
73
|
+
//# sourceMappingURL=fragmentTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fragmentTarget.js","sourceRoot":"","sources":["../../src/lib/fragmentTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;;;;;GASG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AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAEtD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACrE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAA;IAEpE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAEjC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,QAAQ,CAAC,CAAA;QAClB,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AACtB,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,yCAAyC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RecordReference, RecordReferenceType, RecordTargetType } from '@kelpie/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* @returns The record's page, or undefined when it has none. A row without a
|
|
4
|
+
* link renders as plain text rather than as a link to nowhere.
|
|
5
|
+
*/
|
|
6
|
+
export declare function targetHref(targetType: RecordReferenceType, targetId: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* A Note, Decision or Plan item: the page of the record it is on, with its own
|
|
9
|
+
* id as the fragment, which the panel on that page scrolls to and highlights.
|
|
10
|
+
*/
|
|
11
|
+
export declare function attachedHref(id: string, parent: {
|
|
12
|
+
readonly type: RecordTargetType;
|
|
13
|
+
readonly id: string;
|
|
14
|
+
}): string | undefined;
|
|
15
|
+
/** Where a cited record opens, or undefined when it has nowhere to open. */
|
|
16
|
+
export declare function referenceHref(reference: RecordReference): string | undefined;
|
|
17
|
+
//# sourceMappingURL=recordLinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordLinks.d.ts","sourceRoot":"","sources":["../../src/lib/recordLinks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AA4B7F;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIhG;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,EACV,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC/D,MAAM,GAAG,SAAS,CAIpB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAI5E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each kind of record lives. A Candidate has no page of its own: it is
|
|
3
|
+
* reached through its Role. An Attendance is reached through its Event. A Note,
|
|
4
|
+
* Decision or Plan item is reached on the page of the record it is on; see
|
|
5
|
+
* `attachedHref`.
|
|
6
|
+
*/
|
|
7
|
+
const ROUTES = {
|
|
8
|
+
person: '/people',
|
|
9
|
+
company: '/companies',
|
|
10
|
+
deal: '/deals',
|
|
11
|
+
opportunity: '/opportunities',
|
|
12
|
+
partnership: '/partnerships',
|
|
13
|
+
raise: '/fundraising',
|
|
14
|
+
enquiry: '/enquiries',
|
|
15
|
+
candidate: undefined,
|
|
16
|
+
event: '/events',
|
|
17
|
+
attendance: undefined,
|
|
18
|
+
role: '/hiring',
|
|
19
|
+
handbook_page: '/handbook',
|
|
20
|
+
list: '/lists',
|
|
21
|
+
form: '/forms',
|
|
22
|
+
note: undefined,
|
|
23
|
+
decision: undefined,
|
|
24
|
+
plan_item: undefined,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @returns The record's page, or undefined when it has none. A row without a
|
|
28
|
+
* link renders as plain text rather than as a link to nowhere.
|
|
29
|
+
*/
|
|
30
|
+
export function targetHref(targetType, targetId) {
|
|
31
|
+
const route = ROUTES[targetType];
|
|
32
|
+
return route === undefined ? undefined : `${route}/${targetId}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A Note, Decision or Plan item: the page of the record it is on, with its own
|
|
36
|
+
* id as the fragment, which the panel on that page scrolls to and highlights.
|
|
37
|
+
*/
|
|
38
|
+
export function attachedHref(id, parent) {
|
|
39
|
+
const page = targetHref(parent.type, parent.id);
|
|
40
|
+
return page === undefined ? undefined : `${page}#${id}`;
|
|
41
|
+
}
|
|
42
|
+
/** Where a cited record opens, or undefined when it has nowhere to open. */
|
|
43
|
+
export function referenceHref(reference) {
|
|
44
|
+
return reference.parent === null
|
|
45
|
+
? targetHref(reference.targetType, reference.targetId)
|
|
46
|
+
: attachedHref(reference.targetId, reference.parent);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=recordLinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordLinks.js","sourceRoot":"","sources":["../../src/lib/recordLinks.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,GAA8D;IACxE,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,WAAW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dast';
|
|
3
|
+
/**
|
|
4
|
+
* Turning the record ids a text cites into something a person can follow.
|
|
5
|
+
*
|
|
6
|
+
* The server already found the ids and named them (`references` on an activity
|
|
7
|
+
* or a note). This side only finds each named id in the text by string match.
|
|
8
|
+
* An id the server did not name stays as it is: it is not a record in this
|
|
9
|
+
* workspace, and a link to it would go nowhere.
|
|
10
|
+
*
|
|
11
|
+
* Text cites a record in two ways, and one pass reads both. A `[[type:id|Label]]`
|
|
12
|
+
* link token is read first, so the id inside it is never matched a second time as
|
|
13
|
+
* a bare id. The text between tokens is then searched for bare ids. A token the
|
|
14
|
+
* server named shows the record's current name; one it did not name shows the
|
|
15
|
+
* token's label as plain text, because the record is gone.
|
|
16
|
+
*/
|
|
17
|
+
export type TextSegment = {
|
|
18
|
+
readonly kind: 'text';
|
|
19
|
+
readonly text: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'reference';
|
|
22
|
+
readonly reference: RecordReference;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'unresolved';
|
|
25
|
+
readonly token: RecordLinkToken;
|
|
26
|
+
};
|
|
27
|
+
/** What an unresolved token shows: its label, or its id when it has none. */
|
|
28
|
+
export declare function unresolvedLabel(token: RecordLinkToken): string;
|
|
29
|
+
/**
|
|
30
|
+
* `text` cut into plain runs and cited records, in order.
|
|
31
|
+
*
|
|
32
|
+
* @returns One text segment holding all of `text` when nothing is cited.
|
|
33
|
+
*/
|
|
34
|
+
export declare function splitOnReferences(text: string, references: readonly RecordReference[]): readonly TextSegment[];
|
|
35
|
+
/**
|
|
36
|
+
* A remark plugin: every cited record in the Markdown's text, bare id or link
|
|
37
|
+
* token, becomes a link to the record, labelled with its name. The source string
|
|
38
|
+
* is not touched, so what the author wrote is still what is stored and edited.
|
|
39
|
+
*/
|
|
40
|
+
export declare function remarkRecordReferences(references: readonly RecordReference[]): () => (tree: Root) => void;
|
|
41
|
+
//# sourceMappingURL=recordReferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordReferences.d.ts","sourceRoot":"","sources":["../../src/lib/recordReferences.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,KAAK,EAAiC,IAAI,EAAQ,MAAM,OAAO,CAAA;AAItE;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;CAAE,GACnE;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAA;AAEpE,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAE9D;AAMD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,eAAe,EAAE,GACrC,SAAS,WAAW,EAAE,CAcxB;AAqED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,eAAe,EAAE,GACrC,MAAM,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAK5B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { splitRecordLinkTokens } from '@kelpie/schemas';
|
|
2
|
+
import { referenceHref } from './recordLinks.js';
|
|
3
|
+
/** What an unresolved token shows: its label, or its id when it has none. */
|
|
4
|
+
export function unresolvedLabel(token) {
|
|
5
|
+
return token.label ?? token.targetId;
|
|
6
|
+
}
|
|
7
|
+
function escapeForPattern(value) {
|
|
8
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `text` cut into plain runs and cited records, in order.
|
|
12
|
+
*
|
|
13
|
+
* @returns One text segment holding all of `text` when nothing is cited.
|
|
14
|
+
*/
|
|
15
|
+
export function splitOnReferences(text, references) {
|
|
16
|
+
const byTokenId = new Map(references.map((reference) => [reference.targetId, reference]));
|
|
17
|
+
return splitRecordLinkTokens(text).flatMap((segment) => {
|
|
18
|
+
if (segment.kind === 'text') {
|
|
19
|
+
return splitOnBareIds(segment.text, references);
|
|
20
|
+
}
|
|
21
|
+
const reference = byTokenId.get(segment.token.targetId);
|
|
22
|
+
return reference === undefined
|
|
23
|
+
? [{ kind: 'unresolved', token: segment.token }]
|
|
24
|
+
: [{ kind: 'reference', reference }];
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Bare ids only. Every segment it returns is `text` or `reference`. */
|
|
28
|
+
function splitOnBareIds(text, references) {
|
|
29
|
+
if (references.length === 0) {
|
|
30
|
+
return text.length === 0 ? [] : [{ kind: 'text', text }];
|
|
31
|
+
}
|
|
32
|
+
const byId = new Map(references.map((reference) => [reference.targetId, reference]));
|
|
33
|
+
// Longest first, so an id can never lose to a shorter one it starts with.
|
|
34
|
+
const ids = [...byId.keys()].sort((left, right) => right.length - left.length);
|
|
35
|
+
const pattern = new RegExp(`(${ids.map(escapeForPattern).join('|')})`);
|
|
36
|
+
const segments = [];
|
|
37
|
+
// `split` with one capture group puts each match at an odd index.
|
|
38
|
+
text.split(pattern).forEach((part, index) => {
|
|
39
|
+
const reference = index % 2 === 1 ? byId.get(part) : undefined;
|
|
40
|
+
if (reference !== undefined) {
|
|
41
|
+
segments.push({ kind: 'reference', reference });
|
|
42
|
+
}
|
|
43
|
+
else if (part.length > 0) {
|
|
44
|
+
segments.push({ kind: 'text', text: part });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return segments;
|
|
48
|
+
}
|
|
49
|
+
/** A cited record as a Markdown node: a link to its page, or its name when it has none. */
|
|
50
|
+
function referenceNode(reference) {
|
|
51
|
+
const href = referenceHref(reference);
|
|
52
|
+
const name = { type: 'text', value: reference.name };
|
|
53
|
+
return href === undefined ? name : { type: 'link', url: href, title: null, children: [name] };
|
|
54
|
+
}
|
|
55
|
+
/** Node types whose text must stay as written: a link cannot hold a link, and code is literal. */
|
|
56
|
+
const LEAVE_ALONE = new Set(['link', 'linkReference', 'code', 'inlineCode']);
|
|
57
|
+
function isParent(node) {
|
|
58
|
+
return 'children' in node && Array.isArray(node.children);
|
|
59
|
+
}
|
|
60
|
+
function rewriteChildren(parent, references) {
|
|
61
|
+
const rewritten = [];
|
|
62
|
+
for (const child of parent.children) {
|
|
63
|
+
if (child.type === 'text') {
|
|
64
|
+
for (const segment of splitOnReferences(child.value, references)) {
|
|
65
|
+
rewritten.push(segment.kind === 'text'
|
|
66
|
+
? { type: 'text', value: segment.text }
|
|
67
|
+
: segment.kind === 'reference'
|
|
68
|
+
? referenceNode(segment.reference)
|
|
69
|
+
: { type: 'text', value: unresolvedLabel(segment.token) });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (isParent(child) && !LEAVE_ALONE.has(child.type)) {
|
|
74
|
+
rewriteChildren(child, references);
|
|
75
|
+
}
|
|
76
|
+
rewritten.push(child);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
parent.children = rewritten;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A remark plugin: every cited record in the Markdown's text, bare id or link
|
|
83
|
+
* token, becomes a link to the record, labelled with its name. The source string
|
|
84
|
+
* is not touched, so what the author wrote is still what is stored and edited.
|
|
85
|
+
*/
|
|
86
|
+
export function remarkRecordReferences(references) {
|
|
87
|
+
// Runs even with no references: a token must still lose its brackets.
|
|
88
|
+
return () => (tree) => {
|
|
89
|
+
rewriteChildren(tree, references);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=recordReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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CAAC,IAAI,EAA6B;oBACnE,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW;wBAC5B,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC;wBAClC,CAAC,CAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EAA6B,CAC1F,CAAA;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpD,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YACpC,CAAC;YAED,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC;IACH,CAAC;IAED,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAA;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAsC;IAEtC,sEAAsE;IACtE,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE;QACpB,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACnC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PersonIntakeWizard.d.ts","sourceRoot":"","sources":["../../src/modules/PersonIntakeWizard.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AA8B3E,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiE1F"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PERSON_INTAKE_KIND_LABELS, PERSON_INTAKE_KINDS, PERSON_INTAKE_PERSON_KEY, personIntakeDependencies, } from '@kelpie/schemas';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Link } from 'react-router';
|
|
5
|
+
import { useAiServiceLabel } from '../api/resources/ai.js';
|
|
6
|
+
import { useApplyPersonIntake, useIdentifyPerson, useResearchPerson } from '../api/resources/personIntake.js';
|
|
7
|
+
import { Chip } from '../components/Chip.js';
|
|
8
|
+
import { IntakeFrame, NotesField } from '../components/PersonIntakeDialog.js';
|
|
9
|
+
import { ErrorPanel } from '../components/QueryState.js';
|
|
10
|
+
import { effectiveSelection } from './personIntakeSelection.js';
|
|
11
|
+
const STEP_LABELS = ['Notes', 'Confirm', 'Choose', 'Done'];
|
|
12
|
+
const STEP_INDEX = { notes: 0, confirm: 1, choose: 2, done: 3 };
|
|
13
|
+
/** Pipeline records start unticked: the model suggests them, the user decides. */
|
|
14
|
+
const OFF_BY_DEFAULT = new Set(['partnership', 'deal', 'enquiry']);
|
|
15
|
+
const primaryButton = 'rounded-md bg-accent px-3 py-1.5 text-[12px] font-semibold text-accent-fg hover:bg-accent-hover disabled:opacity-50';
|
|
16
|
+
const secondaryButton = 'rounded-md px-2.5 py-1.5 text-[12px] font-medium text-ink-muted hover:text-ink disabled:opacity-50';
|
|
17
|
+
export function PersonIntakeWizard({ onClose }) {
|
|
18
|
+
const [step, setStep] = useState({ kind: 'notes' });
|
|
19
|
+
const [text, setText] = useState('');
|
|
20
|
+
const identify = useIdentifyPerson();
|
|
21
|
+
const research = useResearchPerson();
|
|
22
|
+
const apply = useApplyPersonIntake();
|
|
23
|
+
async function runIdentify() {
|
|
24
|
+
const identified = await identify.runAsync(text.trim());
|
|
25
|
+
setStep({ kind: 'confirm', identified });
|
|
26
|
+
}
|
|
27
|
+
async function runResearch(candidate, existingPersonId) {
|
|
28
|
+
const researched = await research.runAsync({ text: text.trim(), candidate, existingPersonId });
|
|
29
|
+
setStep({ kind: 'choose', research: researched });
|
|
30
|
+
}
|
|
31
|
+
async function runApply(items) {
|
|
32
|
+
const applied = await apply.runAsync(items);
|
|
33
|
+
setStep({ kind: 'done', results: applied.results });
|
|
34
|
+
}
|
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsx(StepBar, { current: STEP_INDEX[step.kind] }), step.kind === 'notes' && (_jsx(NotesStep, { text: text, onChange: setText, pending: identify.isPending, error: identify.error, onNext: () => {
|
|
36
|
+
void runIdentify().catch(() => undefined);
|
|
37
|
+
} })), step.kind === 'confirm' && (_jsx(ConfirmStep, { identified: step.identified, pending: research.isPending, error: research.error, onBack: () => {
|
|
38
|
+
setStep({ kind: 'notes' });
|
|
39
|
+
}, onNext: (candidate, existingPersonId) => {
|
|
40
|
+
void runResearch(candidate, existingPersonId).catch(() => undefined);
|
|
41
|
+
} })), step.kind === 'choose' && (_jsx(ChooseStep, { research: step.research, pending: apply.isPending, error: apply.error, onBack: () => {
|
|
42
|
+
setStep({ kind: 'notes' });
|
|
43
|
+
}, onNext: (items) => {
|
|
44
|
+
void runApply(items).catch(() => undefined);
|
|
45
|
+
} })), step.kind === 'done' && _jsx(DoneStep, { results: step.results, onClose: onClose })] }));
|
|
46
|
+
}
|
|
47
|
+
function StepBar({ current }) {
|
|
48
|
+
return (_jsx("ol", { className: "flex gap-4 border-b border-border px-4 py-2 text-[11px]", children: STEP_LABELS.map((label, index) => (_jsxs("li", { "aria-current": index === current ? 'step' : undefined, className: index === current ? 'font-semibold text-ink' : index < current ? 'text-ink-muted' : 'text-ink-faint', children: [String(index + 1), ". ", label] }, label))) }));
|
|
49
|
+
}
|
|
50
|
+
function NotesStep({ text, onChange, pending, error, onNext, }) {
|
|
51
|
+
const serviceLabel = useAiServiceLabel();
|
|
52
|
+
return (_jsxs(IntakeFrame, { footer: _jsx("button", { type: "button", className: primaryButton, disabled: pending || text.trim().length === 0, onClick: onNext, children: pending ? 'Looking them up…' : 'Find this person' }), children: [_jsx(NotesField, { value: text, onChange: onChange, disabled: pending }), pending && (_jsxs("p", { className: "mt-2 text-[12px] text-ink-muted", children: [serviceLabel, " is looking this person up. With web search on, this can take a minute."] })), error !== null && (_jsx("div", { className: "mt-3", children: _jsx(ErrorPanel, { error: error }) }))] }));
|
|
53
|
+
}
|
|
54
|
+
const CONFIDENCE_TONES = {
|
|
55
|
+
high: 'success',
|
|
56
|
+
medium: 'warning',
|
|
57
|
+
low: 'neutral',
|
|
58
|
+
};
|
|
59
|
+
function ConfirmStep({ identified, pending, error, onBack, onNext, }) {
|
|
60
|
+
const serviceLabel = useAiServiceLabel();
|
|
61
|
+
const first = identified.candidates[0];
|
|
62
|
+
const [candidateKey, setCandidateKey] = useState(first?.key ?? '');
|
|
63
|
+
const [target, setTarget] = useState(first?.existingPeople[0]?.id ?? 'new');
|
|
64
|
+
const candidate = identified.candidates.find((entry) => entry.key === candidateKey);
|
|
65
|
+
if (identified.candidates.length === 0) {
|
|
66
|
+
return (_jsxs(IntakeFrame, { footer: _jsx("button", { type: "button", className: primaryButton, onClick: onBack, children: "Add more detail" }), children: [_jsxs("p", { className: "text-[13px] font-medium text-ink", children: [serviceLabel, " could not tell who this is."] }), identified.question !== null && _jsx("p", { className: "mt-1 text-[13px] text-ink-muted", children: identified.question })] }));
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs(IntakeFrame, { footer: _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: secondaryButton, disabled: pending, onClick: onBack, children: "Back" }), _jsx("button", { type: "button", className: primaryButton, disabled: pending || candidate === undefined, onClick: () => {
|
|
69
|
+
if (candidate !== undefined)
|
|
70
|
+
onNext(candidate, target === 'new' ? null : target);
|
|
71
|
+
}, children: pending ? 'Researching…' : 'This is them: research' })] }), children: [_jsxs("fieldset", { disabled: pending, children: [_jsx("legend", { className: "mb-2 text-[12px] font-medium text-ink-muted", children: identified.candidates.length === 1 ? 'Is this the right person?' : 'Which of these is the right person?' }), _jsx("div", { className: "space-y-2", children: identified.candidates.map((entry) => (_jsx("label", { className: [
|
|
72
|
+
'block cursor-pointer rounded-md border px-3 py-2',
|
|
73
|
+
entry.key === candidateKey ? 'border-accent bg-accent-soft/40' : 'border-border hover:border-border-strong',
|
|
74
|
+
].join(' '), children: _jsxs("span", { className: "flex items-start gap-2", children: [_jsx("input", { type: "radio", name: "candidate", className: "mt-1", checked: entry.key === candidateKey, onChange: () => {
|
|
75
|
+
setCandidateKey(entry.key);
|
|
76
|
+
setTarget(entry.existingPeople[0]?.id ?? 'new');
|
|
77
|
+
} }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-[13px] font-semibold text-ink", children: entry.name }), _jsxs(Chip, { tone: CONFIDENCE_TONES[entry.confidence], children: [entry.confidence, " confidence"] })] }), entry.headline !== '' && _jsx("span", { className: "block text-[12px] text-ink", children: entry.headline }), _jsx("span", { className: "block text-[12px] text-ink-muted", children: [entry.location, entry.email].filter((part) => part !== null && part !== '').join(' · ') }), entry.profileUrls.length > 0 && (_jsx("span", { className: "mt-0.5 flex flex-wrap gap-x-3 text-[12px]", children: entry.profileUrls.map((url) => (_jsx("a", { href: url, target: "_blank", rel: "noreferrer noopener", className: "text-accent hover:underline", children: hostOf(url) }, url))) })), entry.evidence !== '' && _jsx("span", { className: "mt-1 block text-[12px] text-ink-muted", children: entry.evidence })] })] }) }, entry.key))) }), candidate !== undefined && candidate.existingPeople.length > 0 && (_jsxs("div", { className: "mt-4 rounded-md border border-warning/40 bg-warning-soft px-3 py-2", children: [_jsx("p", { className: "text-[12px] font-medium text-ink", children: "This may already be in Kelpie." }), _jsxs("div", { className: "mt-1 space-y-1", children: [candidate.existingPeople.map((person) => (_jsxs("label", { className: "flex items-center gap-2 text-[12px] text-ink", children: [_jsx("input", { type: "radio", name: "target", checked: target === person.id, onChange: () => {
|
|
78
|
+
setTarget(person.id);
|
|
79
|
+
} }), "Update", ' ', _jsx(Link, { to: `/people/${person.id}`, target: "_blank", className: "font-medium text-accent hover:underline", children: person.name }), person.email !== null && _jsx("span", { className: "text-ink-muted", children: person.email })] }, person.id))), _jsxs("label", { className: "flex items-center gap-2 text-[12px] text-ink", children: [_jsx("input", { type: "radio", name: "target", checked: target === 'new', onChange: () => {
|
|
80
|
+
setTarget('new');
|
|
81
|
+
} }), "Create a new person"] })] })] }))] }), pending && (_jsxs("p", { className: "mt-3 text-[12px] text-ink-muted", children: [serviceLabel, " is researching this person. With web search on, this can take a minute."] })), _jsx(Sources, { sources: identified.sources }), error !== null && (_jsx("div", { className: "mt-3", children: _jsx(ErrorPanel, { error: error }) }))] }));
|
|
82
|
+
}
|
|
83
|
+
function ChooseStep({ research, pending, error, onBack, onNext, }) {
|
|
84
|
+
const [ticked, setTicked] = useState(() => new Set(research.items.filter((item) => !OFF_BY_DEFAULT.has(item.kind)).map((item) => item.key)));
|
|
85
|
+
const effective = effectiveSelection(research.items, ticked);
|
|
86
|
+
const chosen = research.items.filter((item) => effective.has(item.key));
|
|
87
|
+
const companyNames = new Map(research.items.flatMap((item) => (item.kind === 'company' ? [[item.key, item.fields.name]] : [])));
|
|
88
|
+
const ordered = [...research.items].sort((left, right) => PERSON_INTAKE_KINDS.indexOf(left.kind) - PERSON_INTAKE_KINDS.indexOf(right.kind));
|
|
89
|
+
function toggle(key) {
|
|
90
|
+
setTicked((current) => {
|
|
91
|
+
const next = new Set(current);
|
|
92
|
+
if (next.has(key))
|
|
93
|
+
next.delete(key);
|
|
94
|
+
else
|
|
95
|
+
next.add(key);
|
|
96
|
+
return next;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return (_jsxs(IntakeFrame, { footer: _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: secondaryButton, disabled: pending, onClick: onBack, children: "Start again" }), _jsx("button", { type: "button", className: primaryButton, disabled: pending || chosen.length === 0, onClick: () => {
|
|
100
|
+
onNext(chosen);
|
|
101
|
+
}, children: pending ? 'Creating…' : `Create ${String(chosen.length)} ${chosen.length === 1 ? 'item' : 'items'}` })] }), children: [research.summary !== '' && _jsx("p", { className: "mb-3 text-[13px] text-ink", children: research.summary }), _jsx("p", { className: "mb-2 text-[12px] font-medium text-ink-muted", children: "Kelpie will create what you tick." }), _jsx("ul", { className: "space-y-1.5", children: ordered.map((item) => {
|
|
102
|
+
const blocked = ticked.has(item.key) && !effective.has(item.key);
|
|
103
|
+
const missing = personIntakeDependencies(item).filter((key) => !effective.has(key));
|
|
104
|
+
return (_jsx("li", { children: _jsxs("label", { className: [
|
|
105
|
+
'flex cursor-pointer items-start gap-2 rounded-md border px-3 py-2',
|
|
106
|
+
effective.has(item.key) ? 'border-border-strong' : 'border-border',
|
|
107
|
+
missing.length > 0 ? 'opacity-60' : '',
|
|
108
|
+
].join(' '), children: [_jsx("input", { type: "checkbox", className: "mt-0.5", checked: effective.has(item.key), disabled: pending || missing.length > 0, onChange: () => {
|
|
109
|
+
toggle(item.key);
|
|
110
|
+
} }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Chip, { tone: item.kind === 'person' ? 'accent' : 'neutral', children: PERSON_INTAKE_KIND_LABELS[item.kind] }), _jsx("span", { className: "text-[13px] font-medium text-ink", children: itemTitle(item, companyNames) }), actionNote(item) !== null && _jsx("span", { className: "text-[11px] text-ink-muted", children: actionNote(item) })] }), _jsx(ItemDetail, { item: item }), (missing.length > 0 || blocked) && (_jsxs("span", { className: "mt-0.5 block text-[11px] text-ink-muted", children: ["Needs the ", missing.map((key) => describeKey(key, research.items)).join(' and '), " ticked."] }))] })] }) }, item.key));
|
|
111
|
+
}) }), _jsx(Sources, { sources: research.sources }), error !== null && (_jsx("div", { className: "mt-3", children: _jsx(ErrorPanel, { error: error }) }))] }));
|
|
112
|
+
}
|
|
113
|
+
function describeKey(key, items) {
|
|
114
|
+
const item = items.find((entry) => entry.key === key);
|
|
115
|
+
if (item === undefined)
|
|
116
|
+
return key === PERSON_INTAKE_PERSON_KEY ? 'person' : 'company';
|
|
117
|
+
return item.kind === 'company' || item.kind === 'person' ? `${item.kind} ${item.fields.name}` : item.kind;
|
|
118
|
+
}
|
|
119
|
+
function itemTitle(item, companyNames) {
|
|
120
|
+
switch (item.kind) {
|
|
121
|
+
case 'person':
|
|
122
|
+
case 'company':
|
|
123
|
+
case 'partnership':
|
|
124
|
+
case 'deal':
|
|
125
|
+
case 'enquiry':
|
|
126
|
+
return item.fields.name;
|
|
127
|
+
case 'position': {
|
|
128
|
+
const company = companyNames.get(item.companyKey) ?? 'the company';
|
|
129
|
+
return item.title === '' ? `At ${company}` : `${item.title} at ${company}`;
|
|
130
|
+
}
|
|
131
|
+
case 'note':
|
|
132
|
+
return 'Pinned research note';
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function actionNote(item) {
|
|
136
|
+
if (item.kind === 'person' && item.action === 'update')
|
|
137
|
+
return 'Adds to the existing record';
|
|
138
|
+
if (item.kind === 'company' && item.action === 'existing')
|
|
139
|
+
return 'Already in Kelpie; links to it';
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
function ItemDetail({ item }) {
|
|
143
|
+
const muted = 'mt-0.5 block text-[12px] text-ink-muted';
|
|
144
|
+
switch (item.kind) {
|
|
145
|
+
case 'person': {
|
|
146
|
+
const fields = item.fields;
|
|
147
|
+
const facts = [
|
|
148
|
+
fields.email ?? null,
|
|
149
|
+
fields.phones !== undefined && fields.phones.length > 0 ? fields.phones.join(', ') : null,
|
|
150
|
+
fields.socialProfiles !== undefined && fields.socialProfiles.length > 0
|
|
151
|
+
? fields.socialProfiles.map((profile) => profile.network).join(', ')
|
|
152
|
+
: null,
|
|
153
|
+
fields.tags !== undefined && fields.tags.length > 0 ? `Tags: ${fields.tags.join(', ')}` : null,
|
|
154
|
+
].filter((fact) => fact !== null && fact !== '');
|
|
155
|
+
return (_jsxs(_Fragment, { children: [facts.length > 0 && _jsx("span", { className: muted, children: facts.join(' · ') }), fields.summary !== undefined && fields.summary !== '' && _jsx("span", { className: muted, children: fields.summary })] }));
|
|
156
|
+
}
|
|
157
|
+
case 'company': {
|
|
158
|
+
if (item.action === 'existing')
|
|
159
|
+
return null;
|
|
160
|
+
const fields = item.fields;
|
|
161
|
+
const facts = [fields.domain ?? null, fields.industry ?? null, fields.sizeBand ?? null].filter((fact) => fact !== null && fact !== '');
|
|
162
|
+
return (_jsxs(_Fragment, { children: [facts.length > 0 && _jsx("span", { className: muted, children: facts.join(' · ') }), fields.description !== undefined && fields.description !== '' && (_jsx("span", { className: muted, children: fields.description }))] }));
|
|
163
|
+
}
|
|
164
|
+
case 'position':
|
|
165
|
+
return null;
|
|
166
|
+
case 'note':
|
|
167
|
+
return _jsx("span", { className: `${muted} line-clamp-4 whitespace-pre-wrap`, children: item.body });
|
|
168
|
+
case 'partnership':
|
|
169
|
+
case 'deal':
|
|
170
|
+
case 'enquiry':
|
|
171
|
+
return item.reason === '' ? null : _jsxs("span", { className: `${muted} italic`, children: ["Why: ", item.reason] });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function Sources({ sources }) {
|
|
175
|
+
if (sources.length === 0)
|
|
176
|
+
return null;
|
|
177
|
+
return (_jsxs("div", { className: "mt-4", children: [_jsx("p", { className: "text-[11px] font-medium uppercase tracking-wide text-ink-faint", children: "Sources" }), _jsx("ul", { className: "mt-1 space-y-0.5", children: sources.map((source) => (_jsxs("li", { className: "truncate text-[12px]", children: [_jsx("a", { href: source.url, target: "_blank", rel: "noreferrer noopener", className: "text-accent hover:underline", children: source.title === source.url ? hostOf(source.url) : source.title }), ' ', _jsx("span", { className: "text-ink-faint", children: hostOf(source.url) })] }, source.url))) })] }));
|
|
178
|
+
}
|
|
179
|
+
const STATUS_TONES = {
|
|
180
|
+
created: 'success',
|
|
181
|
+
updated: 'success',
|
|
182
|
+
linked: 'neutral',
|
|
183
|
+
skipped: 'warning',
|
|
184
|
+
failed: 'danger',
|
|
185
|
+
};
|
|
186
|
+
/** Where a written item lives. Positions and notes show on their Person. */
|
|
187
|
+
function pathFor(result, personId) {
|
|
188
|
+
if (result.id === null)
|
|
189
|
+
return null;
|
|
190
|
+
switch (result.kind) {
|
|
191
|
+
case 'person':
|
|
192
|
+
return `/people/${result.id}`;
|
|
193
|
+
case 'company':
|
|
194
|
+
return `/companies/${result.id}`;
|
|
195
|
+
case 'position':
|
|
196
|
+
case 'note':
|
|
197
|
+
return personId === null ? null : `/people/${personId}`;
|
|
198
|
+
case 'partnership':
|
|
199
|
+
return `/partnerships/${result.id}`;
|
|
200
|
+
case 'deal':
|
|
201
|
+
return `/deals/${result.id}`;
|
|
202
|
+
case 'enquiry':
|
|
203
|
+
return `/enquiries/${result.id}`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function DoneStep({ results, onClose, }) {
|
|
207
|
+
const person = results.find((result) => result.kind === 'person' && result.id !== null);
|
|
208
|
+
const personId = person?.id ?? null;
|
|
209
|
+
const problems = results.filter((result) => result.status === 'failed' || result.status === 'skipped').length;
|
|
210
|
+
return (_jsxs(IntakeFrame, { footer: _jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: secondaryButton, onClick: onClose, children: "Close" }), person !== undefined && personId !== null && (_jsxs(Link, { to: `/people/${personId}`, className: primaryButton, children: ["Open ", person.label] }))] }), children: [_jsx("p", { className: "mb-2 text-[13px] text-ink", children: problems === 0 ? 'Done. Kelpie wrote these records.' : 'Done, with problems. Check the items marked below.' }), _jsx("ul", { className: "space-y-1.5", children: results.map((result) => {
|
|
211
|
+
const path = pathFor(result, personId);
|
|
212
|
+
return (_jsxs("li", { className: "flex flex-wrap items-center gap-2 text-[13px]", children: [_jsx(Chip, { tone: STATUS_TONES[result.status], children: result.status }), _jsx("span", { className: "text-[11px] text-ink-muted", children: PERSON_INTAKE_KIND_LABELS[result.kind] }), path === null ? (_jsx("span", { className: "text-ink", children: result.label })) : (_jsx(Link, { to: path, className: "font-medium text-accent hover:underline", children: result.label })), result.detail !== null && _jsx("span", { className: "w-full pl-1 text-[12px] text-ink-muted", children: result.detail })] }, result.key));
|
|
213
|
+
}) })] }));
|
|
214
|
+
}
|
|
215
|
+
function hostOf(url) {
|
|
216
|
+
try {
|
|
217
|
+
return new URL(url).hostname.replace(/^www\./u, '');
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return url;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=PersonIntakeWizard.js.map
|