@kelpie/ui 0.11.0 → 0.13.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/resources/attendances.d.ts +13 -0
- package/dist/api/resources/attendances.d.ts.map +1 -0
- package/dist/api/resources/attendances.js +34 -0
- package/dist/api/resources/attendances.js.map +1 -0
- package/dist/api/resources/eventAssociations.d.ts +12 -0
- package/dist/api/resources/eventAssociations.d.ts.map +1 -0
- package/dist/api/resources/eventAssociations.js +25 -0
- package/dist/api/resources/eventAssociations.js.map +1 -0
- package/dist/api/resources/events.d.ts +17 -0
- package/dist/api/resources/events.d.ts.map +1 -0
- package/dist/api/resources/events.js +40 -0
- package/dist/api/resources/events.js.map +1 -0
- package/dist/api/resources/handbookSeed.d.ts +11 -0
- package/dist/api/resources/handbookSeed.d.ts.map +1 -0
- package/dist/api/resources/handbookSeed.js +43 -0
- package/dist/api/resources/handbookSeed.js.map +1 -0
- package/dist/api/resources/moduleSettings.d.ts +10 -0
- package/dist/api/resources/moduleSettings.d.ts.map +1 -1
- package/dist/api/resources/moduleSettings.js +21 -0
- package/dist/api/resources/moduleSettings.js.map +1 -1
- package/dist/api/resources/planItems.d.ts +4 -4
- package/dist/api/resources/planItems.d.ts.map +1 -1
- package/dist/api/resources/planItems.js +1 -1
- package/dist/api/resources/planItems.js.map +1 -1
- package/dist/api/resources/publicConfig.js +3 -3
- package/dist/api/resources/sampleData.d.ts.map +1 -1
- package/dist/api/resources/sampleData.js +2 -0
- package/dist/api/resources/sampleData.js.map +1 -1
- package/dist/api/resources/session.d.ts +22 -1
- package/dist/api/resources/session.d.ts.map +1 -1
- package/dist/api/resources/session.js +43 -1
- package/dist/api/resources/session.js.map +1 -1
- package/dist/api/resources/workspace.d.ts.map +1 -1
- package/dist/api/resources/workspace.js +2 -3
- package/dist/api/resources/workspace.js.map +1 -1
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +5 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ActivitiesPanel.d.ts.map +1 -1
- package/dist/components/ActivitiesPanel.js +2 -0
- package/dist/components/ActivitiesPanel.js.map +1 -1
- package/dist/components/AddressesField.d.ts +23 -0
- package/dist/components/AddressesField.d.ts.map +1 -0
- package/dist/components/AddressesField.js +215 -0
- package/dist/components/AddressesField.js.map +1 -0
- package/dist/components/CountrySearch.d.ts +16 -0
- package/dist/components/CountrySearch.d.ts.map +1 -0
- package/dist/components/CountrySearch.js +30 -0
- package/dist/components/CountrySearch.js.map +1 -0
- package/dist/components/EnvironmentBanner.d.ts +0 -12
- package/dist/components/EnvironmentBanner.d.ts.map +1 -1
- package/dist/components/EnvironmentBanner.js +21 -6
- package/dist/components/EnvironmentBanner.js.map +1 -1
- package/dist/components/InlineEdit.d.ts +7 -1
- package/dist/components/InlineEdit.d.ts.map +1 -1
- package/dist/components/InlineEdit.js +8 -1
- package/dist/components/InlineEdit.js.map +1 -1
- package/dist/components/LinkedEventsPanel.d.ts +11 -0
- package/dist/components/LinkedEventsPanel.d.ts.map +1 -0
- package/dist/components/LinkedEventsPanel.js +18 -0
- package/dist/components/LinkedEventsPanel.js.map +1 -0
- package/dist/components/NotesPanel.d.ts +4 -6
- package/dist/components/NotesPanel.d.ts.map +1 -1
- package/dist/components/NotesPanel.js +39 -3
- package/dist/components/NotesPanel.js.map +1 -1
- package/dist/components/PlanAttention.d.ts.map +1 -1
- package/dist/components/PlanAttention.js +3 -2
- package/dist/components/PlanAttention.js.map +1 -1
- package/dist/components/PlanPanel.d.ts +3 -3
- package/dist/components/PlanPanel.d.ts.map +1 -1
- package/dist/components/Shell.d.ts.map +1 -1
- package/dist/components/Shell.js +8 -2
- package/dist/components/Shell.js.map +1 -1
- package/dist/components/SocialNetworkIcon.d.ts +17 -0
- package/dist/components/SocialNetworkIcon.d.ts.map +1 -0
- package/dist/components/SocialNetworkIcon.js +39 -0
- package/dist/components/SocialNetworkIcon.js.map +1 -0
- package/dist/components/SocialProfilesField.d.ts +8 -0
- package/dist/components/SocialProfilesField.d.ts.map +1 -1
- package/dist/components/SocialProfilesField.js +19 -5
- package/dist/components/SocialProfilesField.js.map +1 -1
- package/dist/components/TimezoneSearch.d.ts +21 -0
- package/dist/components/TimezoneSearch.d.ts.map +1 -0
- package/dist/components/TimezoneSearch.js +27 -0
- package/dist/components/TimezoneSearch.js.map +1 -0
- package/dist/components/WorkspaceSwitcher.d.ts +8 -0
- package/dist/components/WorkspaceSwitcher.d.ts.map +1 -0
- package/dist/components/WorkspaceSwitcher.js +67 -0
- package/dist/components/WorkspaceSwitcher.js.map +1 -0
- package/dist/components/environmentTone.d.ts +10 -0
- package/dist/components/environmentTone.d.ts.map +1 -0
- package/dist/components/environmentTone.js +35 -0
- package/dist/components/environmentTone.js.map +1 -0
- package/dist/index.d.ts +25 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/timezones.d.ts +17 -0
- package/dist/lib/timezones.d.ts.map +1 -0
- package/dist/lib/timezones.js +39 -0
- package/dist/lib/timezones.js.map +1 -0
- package/dist/pages/CompaniesPage.d.ts.map +1 -1
- package/dist/pages/CompaniesPage.js +12 -11
- package/dist/pages/CompaniesPage.js.map +1 -1
- package/dist/pages/CompanyDetail.d.ts.map +1 -1
- package/dist/pages/CompanyDetail.js +23 -12
- package/dist/pages/CompanyDetail.js.map +1 -1
- package/dist/pages/DealDetail.d.ts.map +1 -1
- package/dist/pages/DealDetail.js +5 -1
- package/dist/pages/DealDetail.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +7 -0
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/EnquiryDetail.d.ts.map +1 -1
- package/dist/pages/EnquiryDetail.js +5 -1
- package/dist/pages/EnquiryDetail.js.map +1 -1
- package/dist/pages/EventDetail.d.ts +2 -0
- package/dist/pages/EventDetail.d.ts.map +1 -0
- package/dist/pages/EventDetail.js +332 -0
- package/dist/pages/EventDetail.js.map +1 -0
- package/dist/pages/EventsPage.d.ts +2 -0
- package/dist/pages/EventsPage.d.ts.map +1 -0
- package/dist/pages/EventsPage.js +176 -0
- package/dist/pages/EventsPage.js.map +1 -0
- package/dist/pages/ListDetail.d.ts.map +1 -1
- package/dist/pages/ListDetail.js +17 -0
- package/dist/pages/ListDetail.js.map +1 -1
- package/dist/pages/OpportunityDetail.d.ts.map +1 -1
- package/dist/pages/OpportunityDetail.js +5 -1
- package/dist/pages/OpportunityDetail.js.map +1 -1
- package/dist/pages/PartnershipDetail.d.ts.map +1 -1
- package/dist/pages/PartnershipDetail.js +5 -1
- package/dist/pages/PartnershipDetail.js.map +1 -1
- package/dist/pages/PeoplePage.d.ts.map +1 -1
- package/dist/pages/PeoplePage.js +13 -5
- package/dist/pages/PeoplePage.js.map +1 -1
- package/dist/pages/PersonDetail.d.ts.map +1 -1
- package/dist/pages/PersonDetail.js +94 -28
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/PlanningPage.d.ts.map +1 -1
- package/dist/pages/PlanningPage.js +6 -3
- package/dist/pages/PlanningPage.js.map +1 -1
- package/dist/pages/RaiseDetail.d.ts.map +1 -1
- package/dist/pages/RaiseDetail.js +5 -1
- package/dist/pages/RaiseDetail.js.map +1 -1
- package/dist/pages/RoleDetail.d.ts.map +1 -1
- package/dist/pages/RoleDetail.js +4 -1
- package/dist/pages/RoleDetail.js.map +1 -1
- package/dist/pages/SearchPage.d.ts.map +1 -1
- package/dist/pages/SearchPage.js +2 -1
- package/dist/pages/SearchPage.js.map +1 -1
- package/dist/pages/account/PreferencesPage.d.ts.map +1 -1
- package/dist/pages/account/PreferencesPage.js +2 -28
- package/dist/pages/account/PreferencesPage.js.map +1 -1
- package/dist/pages/account/SecurityPage.js +2 -2
- package/dist/pages/account/SecurityPage.js.map +1 -1
- package/dist/pages/admin/DataPage.js +10 -9
- package/dist/pages/admin/DataPage.js.map +1 -1
- package/dist/pages/admin/FieldsPage.js +1 -1
- package/dist/pages/admin/FieldsPage.js.map +1 -1
- package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
- package/dist/pages/admin/ModulesPage.js +1 -0
- package/dist/pages/admin/ModulesPage.js.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts +12 -0
- package/dist/pages/admin/WorkspaceSettingsPage.d.ts.map +1 -1
- package/dist/pages/admin/WorkspaceSettingsPage.js +2 -21
- package/dist/pages/admin/WorkspaceSettingsPage.js.map +1 -1
- package/dist/pages/auth/AuthForm.d.ts +18 -0
- package/dist/pages/auth/AuthForm.d.ts.map +1 -1
- package/dist/pages/auth/AuthForm.js +17 -0
- package/dist/pages/auth/AuthForm.js.map +1 -1
- package/dist/pages/auth/AuthLayout.d.ts +5 -4
- package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
- package/dist/pages/auth/AuthLayout.js +7 -5
- package/dist/pages/auth/AuthLayout.js.map +1 -1
- package/dist/pages/auth/AuthMethods.d.ts +12 -0
- package/dist/pages/auth/AuthMethods.d.ts.map +1 -0
- package/dist/pages/auth/AuthMethods.js +20 -0
- package/dist/pages/auth/AuthMethods.js.map +1 -0
- package/dist/pages/auth/RegionSwitcher.d.ts +10 -0
- package/dist/pages/auth/RegionSwitcher.d.ts.map +1 -0
- package/dist/pages/auth/RegionSwitcher.js +28 -0
- package/dist/pages/auth/RegionSwitcher.js.map +1 -0
- package/dist/pages/auth/SignInPage.d.ts +7 -0
- package/dist/pages/auth/SignInPage.d.ts.map +1 -1
- package/dist/pages/auth/SignInPage.js +5 -8
- package/dist/pages/auth/SignInPage.js.map +1 -1
- package/dist/pages/auth/SignUpPage.d.ts.map +1 -1
- package/dist/pages/auth/SignUpPage.js +9 -1
- package/dist/pages/auth/SignUpPage.js.map +1 -1
- package/dist/pages/auth/nextPath.d.ts +15 -0
- package/dist/pages/auth/nextPath.d.ts.map +1 -0
- package/dist/pages/auth/nextPath.js +17 -0
- package/dist/pages/auth/nextPath.js.map +1 -0
- package/dist/pages/auth/regionHref.d.ts +6 -0
- package/dist/pages/auth/regionHref.d.ts.map +1 -0
- package/dist/pages/auth/regionHref.js +8 -0
- package/dist/pages/auth/regionHref.js.map +1 -0
- package/dist/pages/dashboard/DashboardPage.d.ts +8 -0
- package/dist/pages/dashboard/DashboardPage.d.ts.map +1 -1
- package/dist/pages/dashboard/DashboardPage.js +5 -13
- package/dist/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/pages/dashboard/attention.d.ts +1 -8
- package/dist/pages/dashboard/attention.d.ts.map +1 -1
- package/dist/pages/dashboard/attention.js +21 -54
- 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 +3 -2
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/FormActions.d.ts.map +1 -1
- package/dist/pages/forms/FormActions.js +7 -3
- package/dist/pages/forms/FormActions.js.map +1 -1
- package/dist/pages/onboarding/HandbookStepPage.d.ts +4 -8
- package/dist/pages/onboarding/HandbookStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/HandbookStepPage.js +13 -13
- package/dist/pages/onboarding/HandbookStepPage.js.map +1 -1
- package/dist/pages/onboarding/InvitesStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/InvitesStepPage.js +13 -7
- package/dist/pages/onboarding/InvitesStepPage.js.map +1 -1
- package/dist/pages/onboarding/ModulesStepPage.d.ts +11 -0
- package/dist/pages/onboarding/ModulesStepPage.d.ts.map +1 -0
- package/dist/pages/onboarding/ModulesStepPage.js +80 -0
- package/dist/pages/onboarding/ModulesStepPage.js.map +1 -0
- package/dist/pages/onboarding/OnboardingNav.d.ts +17 -0
- package/dist/pages/onboarding/OnboardingNav.d.ts.map +1 -0
- package/dist/pages/onboarding/OnboardingNav.js +37 -0
- package/dist/pages/onboarding/OnboardingNav.js.map +1 -0
- package/dist/pages/onboarding/OrganisationStepPage.d.ts +13 -0
- package/dist/pages/onboarding/OrganisationStepPage.d.ts.map +1 -0
- package/dist/pages/onboarding/OrganisationStepPage.js +59 -0
- package/dist/pages/onboarding/OrganisationStepPage.js.map +1 -0
- package/dist/pages/onboarding/WorkspaceStepPage.d.ts.map +1 -1
- package/dist/pages/onboarding/WorkspaceStepPage.js +25 -20
- package/dist/pages/onboarding/WorkspaceStepPage.js.map +1 -1
- package/dist/pages/onboarding/handbookTemplates.d.ts +19 -0
- package/dist/pages/onboarding/handbookTemplates.d.ts.map +1 -0
- package/dist/pages/onboarding/handbookTemplates.js +57 -0
- package/dist/pages/onboarding/handbookTemplates.js.map +1 -0
- package/dist/pages/onboarding/onboardingModules.d.ts +23 -0
- package/dist/pages/onboarding/onboardingModules.d.ts.map +1 -0
- package/dist/pages/onboarding/onboardingModules.js +153 -0
- package/dist/pages/onboarding/onboardingModules.js.map +1 -0
- package/dist/pages/onboarding/onboardingRerun.d.ts +21 -0
- package/dist/pages/onboarding/onboardingRerun.d.ts.map +1 -0
- package/dist/pages/onboarding/onboardingRerun.js +33 -0
- package/dist/pages/onboarding/onboardingRerun.js.map +1 -0
- package/dist/registry/context.d.ts +3 -1
- package/dist/registry/context.d.ts.map +1 -1
- package/dist/registry/context.js +4 -0
- package/dist/registry/context.js.map +1 -1
- package/dist/registry/contributions.d.ts +24 -0
- package/dist/registry/contributions.d.ts.map +1 -1
- package/dist/registry/contributions.js.map +1 -1
- package/dist/registry/registry.d.ts +4 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +6 -0
- package/dist/registry/registry.js.map +1 -1
- package/package.json +4 -3
- package/src/api/resources/attendances.ts +54 -0
- package/src/api/resources/eventAssociations.ts +43 -0
- package/src/api/resources/events.ts +70 -0
- package/src/api/resources/handbookSeed.ts +63 -0
- package/src/api/resources/moduleSettings.ts +25 -0
- package/src/api/resources/planItems.ts +5 -5
- package/src/api/resources/publicConfig.ts +3 -3
- package/src/api/resources/sampleData.ts +2 -0
- package/src/api/resources/session.ts +59 -0
- package/src/api/resources/workspace.ts +2 -3
- package/src/app/KelpieApp.tsx +11 -3
- package/src/components/ActivitiesPanel.tsx +2 -0
- package/src/components/AddressesField.tsx +502 -0
- package/src/components/CountrySearch.tsx +71 -0
- package/src/components/EnvironmentBanner.tsx +23 -6
- package/src/components/InlineEdit.tsx +35 -1
- package/src/components/LinkedEventsPanel.tsx +50 -0
- package/src/components/NotesPanel.tsx +132 -15
- package/src/components/PlanAttention.tsx +5 -4
- package/src/components/PlanPanel.tsx +3 -3
- package/src/components/Shell.tsx +16 -1
- package/src/components/SocialNetworkIcon.tsx +88 -0
- package/src/components/SocialProfilesField.tsx +57 -10
- package/src/components/TimezoneSearch.tsx +67 -0
- package/src/components/WorkspaceSwitcher.tsx +136 -0
- package/src/components/environmentTone.ts +40 -0
- package/src/index.ts +49 -3
- package/src/lib/timezones.ts +43 -0
- package/src/pages/CompaniesPage.tsx +14 -13
- package/src/pages/CompanyDetail.tsx +59 -27
- package/src/pages/DealDetail.tsx +5 -0
- package/src/pages/DecisionsPage.tsx +7 -0
- package/src/pages/EnquiryDetail.tsx +7 -0
- package/src/pages/EventDetail.tsx +794 -0
- package/src/pages/EventsPage.tsx +382 -0
- package/src/pages/ListDetail.tsx +24 -0
- package/src/pages/OpportunityDetail.tsx +7 -0
- package/src/pages/PartnershipDetail.tsx +7 -0
- package/src/pages/PeoplePage.tsx +18 -5
- package/src/pages/PersonDetail.tsx +300 -100
- package/src/pages/PlanningPage.tsx +17 -14
- package/src/pages/RaiseDetail.tsx +5 -0
- package/src/pages/RoleDetail.tsx +8 -0
- package/src/pages/SearchPage.tsx +2 -1
- package/src/pages/account/PreferencesPage.tsx +2 -37
- package/src/pages/account/SecurityPage.tsx +6 -1
- package/src/pages/admin/DataPage.tsx +63 -21
- package/src/pages/admin/FieldsPage.tsx +1 -1
- package/src/pages/admin/ModulesPage.tsx +1 -0
- package/src/pages/admin/WorkspaceSettingsPage.tsx +10 -33
- package/src/pages/auth/AuthForm.tsx +38 -0
- package/src/pages/auth/AuthLayout.tsx +8 -4
- package/src/pages/auth/AuthMethods.tsx +29 -0
- package/src/pages/auth/RegionSwitcher.tsx +56 -0
- package/src/pages/auth/SignInPage.tsx +13 -14
- package/src/pages/auth/SignUpPage.tsx +32 -0
- package/src/pages/auth/nextPath.ts +17 -0
- package/src/pages/auth/regionHref.ts +10 -0
- package/src/pages/dashboard/DashboardPage.tsx +16 -48
- package/src/pages/dashboard/attention.ts +24 -78
- package/src/pages/dashboard/sections.tsx +8 -2
- package/src/pages/forms/FormActions.tsx +14 -8
- package/src/pages/onboarding/HandbookStepPage.tsx +21 -24
- package/src/pages/onboarding/InvitesStepPage.tsx +27 -19
- package/src/pages/onboarding/ModulesStepPage.tsx +145 -0
- package/src/pages/onboarding/OnboardingNav.tsx +97 -0
- package/src/pages/onboarding/OrganisationStepPage.tsx +130 -0
- package/src/pages/onboarding/WorkspaceStepPage.tsx +53 -38
- package/src/pages/onboarding/handbookTemplates.ts +77 -0
- package/src/pages/onboarding/onboardingModules.ts +202 -0
- package/src/pages/onboarding/onboardingRerun.ts +41 -0
- package/src/registry/context.ts +6 -0
- package/src/registry/contributions.ts +26 -0
- package/src/registry/registry.ts +12 -0
- package/src/styles.css +30 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { seedHandbookBody, seedHandbookResultSchema } from '@kelpie/schemas'
|
|
2
|
+
import type { SeedHandbookInput, SeedHandbookResult } from '@kelpie/schemas'
|
|
3
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|
4
|
+
|
|
5
|
+
import { useApiClient } from '../context.ts'
|
|
6
|
+
import type { MutationResult } from '../resource.ts'
|
|
7
|
+
import { asMutationResult } from './mutation.ts'
|
|
8
|
+
import { useSession } from './session.ts'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `POST /v1/workspaces/:id/handbook/seed` — onboarding step 4 seeds the starter
|
|
12
|
+
* handbook once the reader has picked an organisation type.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export function useSeedHandbook(): MutationResult<
|
|
16
|
+
SeedHandbookInput & { readonly workspaceId: string },
|
|
17
|
+
SeedHandbookResult
|
|
18
|
+
> {
|
|
19
|
+
const client = useApiClient()
|
|
20
|
+
const queryClient = useQueryClient()
|
|
21
|
+
|
|
22
|
+
const mutation = useMutation({
|
|
23
|
+
mutationFn: ({ workspaceId, ...input }: SeedHandbookInput & { readonly workspaceId: string }) =>
|
|
24
|
+
client.post(
|
|
25
|
+
`/workspaces/${workspaceId}/handbook/seed`,
|
|
26
|
+
seedHandbookBody(input),
|
|
27
|
+
seedHandbookResultSchema.parse,
|
|
28
|
+
),
|
|
29
|
+
onSuccess: async () => {
|
|
30
|
+
await queryClient.invalidateQueries({ queryKey: ['handbook_pages'] })
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return asMutationResult(mutation)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useSeedHandbookForWorkspace(): MutationResult<SeedHandbookInput, SeedHandbookResult> {
|
|
38
|
+
const { session } = useSession()
|
|
39
|
+
const seedHandbook = useSeedHandbook()
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
run: (input: SeedHandbookInput) => {
|
|
43
|
+
const workspaceId = session?.workspaceId
|
|
44
|
+
|
|
45
|
+
if (workspaceId === null || workspaceId === undefined) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
seedHandbook.run({ ...input, workspaceId })
|
|
50
|
+
},
|
|
51
|
+
runAsync: async (input: SeedHandbookInput) => {
|
|
52
|
+
const workspaceId = session?.workspaceId
|
|
53
|
+
|
|
54
|
+
if (workspaceId === null || workspaceId === undefined) {
|
|
55
|
+
throw new Error('No workspace is active')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return seedHandbook.runAsync({ ...input, workspaceId })
|
|
59
|
+
},
|
|
60
|
+
isPending: seedHandbook.isPending,
|
|
61
|
+
error: seedHandbook.error,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -41,6 +41,31 @@ export function useModuleSettings(): ModuleSettingsState {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Whether this workspace currently has a toggleable module on.
|
|
46
|
+
*
|
|
47
|
+
* Record tabs that belong to a module (Events on a Person) must not render
|
|
48
|
+
* while that module is off: the page answers 403. Loading counts as off so the
|
|
49
|
+
* tab cannot flash on a workspace that has switched it off. A module missing
|
|
50
|
+
* from the list after load is treated as on, matching the sidebar: core
|
|
51
|
+
* surfaces that are not toggleable stay visible.
|
|
52
|
+
*/
|
|
53
|
+
export function useModuleEnabled(moduleId: string): boolean {
|
|
54
|
+
const { session } = useSession()
|
|
55
|
+
const { settings, isLoading } = useModuleSettings()
|
|
56
|
+
|
|
57
|
+
// No workspace yet (session still loading) is the same as settings still
|
|
58
|
+
// loading: treating a missing list as "on" would fetch attendances, then
|
|
59
|
+
// 403, on a workspace that has Events off.
|
|
60
|
+
if (session?.workspaceId === undefined || isLoading) {
|
|
61
|
+
return false
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const setting = settings.find((entry) => entry.moduleId === moduleId)
|
|
65
|
+
|
|
66
|
+
return setting === undefined || setting.enabled
|
|
67
|
+
}
|
|
68
|
+
|
|
44
69
|
export interface SetModuleEnabledArguments {
|
|
45
70
|
readonly moduleId: string
|
|
46
71
|
readonly enabled: boolean
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createPlanItemBody, planItemBody, planItemSchema } from '@kelpie/schemas'
|
|
2
2
|
import type {
|
|
3
3
|
CreatePlanItemInput,
|
|
4
|
-
PipelineKind,
|
|
5
4
|
PlanItem,
|
|
6
5
|
PlanItemInput,
|
|
7
6
|
PlanItemStatus,
|
|
7
|
+
PlanItemTargetType,
|
|
8
8
|
} from '@kelpie/schemas'
|
|
9
9
|
|
|
10
10
|
import type { QueryParameters } from '../client.ts'
|
|
@@ -12,7 +12,7 @@ import { createResourceHooks } from '../resource.ts'
|
|
|
12
12
|
import type { ListOptions, MutationResult, RecordListResult, UpdateArguments } from '../resource.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* `/v1/plan_items`: the dated next steps on
|
|
15
|
+
* `/v1/plan_items`: the dated next steps on pipeline records and Events.
|
|
16
16
|
*
|
|
17
17
|
* Unlike notes, this list is answerable workspace-wide, because the Planning
|
|
18
18
|
* page is exactly that question. `useRecordPlanItems` narrows it to one record's
|
|
@@ -35,7 +35,7 @@ const planItems = createResourceHooks<PlanItem, CreatePlanItemInput, PlanItemInp
|
|
|
35
35
|
export const MAX_PAGE_SIZE = 200
|
|
36
36
|
|
|
37
37
|
export interface PlanItemFilters {
|
|
38
|
-
readonly targetType?:
|
|
38
|
+
readonly targetType?: PlanItemTargetType | undefined
|
|
39
39
|
/** The records to read steps for. Repeats on the wire: `?target_id=a&target_id=b`. */
|
|
40
40
|
readonly targetIds?: readonly string[] | undefined
|
|
41
41
|
readonly statuses?: readonly PlanItemStatus[] | undefined
|
|
@@ -66,7 +66,7 @@ export function usePlanItems(
|
|
|
66
66
|
|
|
67
67
|
/** One record's plan, in date order: what the panel on a detail page shows. */
|
|
68
68
|
export function useRecordPlanItems(
|
|
69
|
-
targetType:
|
|
69
|
+
targetType: PlanItemTargetType,
|
|
70
70
|
targetId: string,
|
|
71
71
|
): RecordListResult<PlanItem> {
|
|
72
72
|
return usePlanItems({ targetType, targetIds: [targetId] })
|
|
@@ -81,7 +81,7 @@ export function useRecordPlanItems(
|
|
|
81
81
|
* dropped rather than sent, because the request would be a 422 in full.
|
|
82
82
|
*/
|
|
83
83
|
export function usePlanItemsForRecords(
|
|
84
|
-
targetType:
|
|
84
|
+
targetType: PlanItemTargetType,
|
|
85
85
|
targetIds: readonly string[],
|
|
86
86
|
): RecordListResult<PlanItem> {
|
|
87
87
|
return usePlanItems(
|
|
@@ -8,9 +8,9 @@ import { toError } from '../errors.ts'
|
|
|
8
8
|
/**
|
|
9
9
|
* The deployment metadata `GET /v1/public/config` reports.
|
|
10
10
|
*
|
|
11
|
-
* Read once, cached forever: neither `runtimeMode` nor `siteName`
|
|
12
|
-
* while the app is open. The endpoint is public, so this
|
|
13
|
-
* session exists (the sign-in page reads it too).
|
|
11
|
+
* Read once, cached forever: neither `runtimeMode` nor `siteName` nor
|
|
12
|
+
* `regions` changes while the app is open. The endpoint is public, so this
|
|
13
|
+
* hook works before a session exists (the sign-in page reads it too).
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
const PUBLIC_CONFIG_KEY = ['public-config'] as const
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
accountWorkspaceSchema,
|
|
2
3
|
confirmEmailVerificationBody,
|
|
3
4
|
confirmPasswordResetBody,
|
|
4
5
|
createWorkspaceBody,
|
|
@@ -7,9 +8,11 @@ import {
|
|
|
7
8
|
sessionSchema,
|
|
8
9
|
signUpBody,
|
|
9
10
|
signedInAccountSchema,
|
|
11
|
+
switchWorkspaceBody,
|
|
10
12
|
workspaceSchema,
|
|
11
13
|
} from '@kelpie/schemas'
|
|
12
14
|
import type {
|
|
15
|
+
AccountWorkspace,
|
|
13
16
|
ConfirmEmailVerificationInput,
|
|
14
17
|
ConfirmPasswordResetInput,
|
|
15
18
|
CreateWorkspaceInput,
|
|
@@ -18,6 +21,7 @@ import type {
|
|
|
18
21
|
Session,
|
|
19
22
|
SignUpInput,
|
|
20
23
|
SignedInAccount,
|
|
24
|
+
SwitchWorkspaceInput,
|
|
21
25
|
Workspace,
|
|
22
26
|
} from '@kelpie/schemas'
|
|
23
27
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
@@ -254,3 +258,58 @@ export function useCreateWorkspace(): MutationResult<CreateWorkspaceInput, Works
|
|
|
254
258
|
return asMutationResult(mutation)
|
|
255
259
|
}
|
|
256
260
|
|
|
261
|
+
const ACCOUNT_WORKSPACES_KEY = ['account', 'workspaces'] as const
|
|
262
|
+
|
|
263
|
+
export interface AccountWorkspacesState {
|
|
264
|
+
readonly workspaces: readonly AccountWorkspace[]
|
|
265
|
+
readonly isLoading: boolean
|
|
266
|
+
readonly error: Error | null
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Workspaces this account belongs to.
|
|
271
|
+
*
|
|
272
|
+
* Lives under `/auth` rather than `/workspaces/:id` so a session whose current
|
|
273
|
+
* workspace is suspended can still list the others and switch. The shell reads
|
|
274
|
+
* this for the header switcher.
|
|
275
|
+
*/
|
|
276
|
+
export function useAccountWorkspaces(): AccountWorkspacesState {
|
|
277
|
+
const client = useApiClient()
|
|
278
|
+
const result = useQuery({
|
|
279
|
+
queryKey: ACCOUNT_WORKSPACES_KEY,
|
|
280
|
+
queryFn: async () => {
|
|
281
|
+
const page = await client.list('/auth/workspaces', accountWorkspaceSchema.parse)
|
|
282
|
+
|
|
283
|
+
return page.items
|
|
284
|
+
},
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
return {
|
|
288
|
+
workspaces: result.data ?? [],
|
|
289
|
+
isLoading: result.isPending,
|
|
290
|
+
error: toError(result.error),
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Moves this session into another membership.
|
|
296
|
+
*
|
|
297
|
+
* Every cached CRM list belongs to the workspace that is being left, so the
|
|
298
|
+
* whole cache is dropped. Leaving Acme's people in the cache for Globex would
|
|
299
|
+
* mix two tenants, not just show stale names.
|
|
300
|
+
*/
|
|
301
|
+
export function useSwitchWorkspace(): MutationResult<SwitchWorkspaceInput, Session> {
|
|
302
|
+
const client = useApiClient()
|
|
303
|
+
const queryClient = useQueryClient()
|
|
304
|
+
const mutation = useMutation({
|
|
305
|
+
mutationFn: (input: SwitchWorkspaceInput) =>
|
|
306
|
+
client.post('/auth/workspace', switchWorkspaceBody(input), sessionSchema.parse),
|
|
307
|
+
onSuccess: async () => {
|
|
308
|
+
queryClient.clear()
|
|
309
|
+
await queryClient.fetchQuery(sessionQuery(client))
|
|
310
|
+
},
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
return asMutationResult(mutation)
|
|
314
|
+
}
|
|
315
|
+
|
|
@@ -11,9 +11,8 @@ import { useSession } from './session.ts'
|
|
|
11
11
|
/**
|
|
12
12
|
* The workspace the session is in.
|
|
13
13
|
*
|
|
14
|
-
* Not a CRM resource:
|
|
15
|
-
*
|
|
16
|
-
* to configure.
|
|
14
|
+
* Not a CRM resource: the id comes from the session rather than a route.
|
|
15
|
+
* The account's memberships are a different list (`GET /v1/auth/workspaces`).
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
18
|
const WORKSPACE_KEY = 'workspace'
|
package/src/app/KelpieApp.tsx
CHANGED
|
@@ -21,6 +21,8 @@ import { NotFoundPage } from '../pages/NotFoundPage.tsx'
|
|
|
21
21
|
import { EnquiriesPage } from '../pages/EnquiriesPage.tsx'
|
|
22
22
|
import { EnquiryDetail } from '../pages/EnquiryDetail.tsx'
|
|
23
23
|
import { EnquiryStageSettingsPage } from '../pages/EnquiryStageSettingsPage.tsx'
|
|
24
|
+
import { EventDetail } from '../pages/EventDetail.tsx'
|
|
25
|
+
import { EventsPage } from '../pages/EventsPage.tsx'
|
|
24
26
|
import { OpportunitiesPage } from '../pages/OpportunitiesPage.tsx'
|
|
25
27
|
import { OpportunityDetail } from '../pages/OpportunityDetail.tsx'
|
|
26
28
|
import { OpportunityStageSettingsPage } from '../pages/OpportunityStageSettingsPage.tsx'
|
|
@@ -58,6 +60,8 @@ import { DashboardPage } from '../pages/dashboard/DashboardPage.tsx'
|
|
|
58
60
|
import { HandbookLayout } from '../pages/handbook/HandbookPage.tsx'
|
|
59
61
|
import { HandbookStepPage } from '../pages/onboarding/HandbookStepPage.tsx'
|
|
60
62
|
import { InvitesStepPage } from '../pages/onboarding/InvitesStepPage.tsx'
|
|
63
|
+
import { ModulesStepPage } from '../pages/onboarding/ModulesStepPage.tsx'
|
|
64
|
+
import { OrganisationStepPage } from '../pages/onboarding/OrganisationStepPage.tsx'
|
|
61
65
|
import { WorkspaceStepPage } from '../pages/onboarding/WorkspaceStepPage.tsx'
|
|
62
66
|
import { UiExtensionProvider } from '../registry/UiExtensionProvider.tsx'
|
|
63
67
|
import type { RouteContribution } from '../registry/contributions.ts'
|
|
@@ -138,9 +142,11 @@ function AppRoutes(): React.JSX.Element {
|
|
|
138
142
|
<Route path="/verify-email/pending" element={<VerifyEmailPendingPage />} />
|
|
139
143
|
|
|
140
144
|
<Route element={<SessionGate />}>
|
|
141
|
-
{/* Inside the gate and outside the Shell:
|
|
142
|
-
that step 1 created, and
|
|
143
|
-
app from. */}
|
|
145
|
+
{/* Inside the gate and outside the Shell: these steps need the workspace
|
|
146
|
+
that step 1 created, and none of them is a place to start navigating
|
|
147
|
+
the app from. */}
|
|
148
|
+
<Route path="/onboarding/organisation" element={<OrganisationStepPage />} />
|
|
149
|
+
<Route path="/onboarding/modules" element={<ModulesStepPage />} />
|
|
144
150
|
<Route path="/onboarding/invites" element={<InvitesStepPage />} />
|
|
145
151
|
<Route path="/onboarding/handbook" element={<HandbookStepPage />} />
|
|
146
152
|
|
|
@@ -167,6 +173,8 @@ function AppRoutes(): React.JSX.Element {
|
|
|
167
173
|
<Route path="fundraising" element={<FundraisingPage />} />
|
|
168
174
|
<Route path="fundraising/settings" element={<RaiseStageSettingsPage />} />
|
|
169
175
|
<Route path="fundraising/:id" element={<RaiseDetail />} />
|
|
176
|
+
<Route path="events" element={<EventsPage />} />
|
|
177
|
+
<Route path="events/:id" element={<EventDetail />} />
|
|
170
178
|
<Route path="partnerships" element={<PartnershipsPage />} />
|
|
171
179
|
<Route path="partnerships/settings" element={<PartnershipStageSettingsPage />} />
|
|
172
180
|
<Route path="partnerships/:id" element={<PartnershipDetail />} />
|