@burdenoff/microfe-export 2026.1125.1 → 2026.1125.2
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/export/hooks/useExportQueries.d.ts +12 -12
- package/dist/export/hooks/useExportQueries.js +149 -155
- package/dist/export/hooks/useExportQueries.js.map +1 -1
- package/dist/export/workspace-v2/NewDownloadDialog.js +1 -1
- package/dist/export/workspace-v2/NewDownloadDialog.js.map +1 -1
- package/dist/export/workspace-v2/useExportAccess.d.ts +2 -2
- package/dist/export/workspace-v2/useExportAccess.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +0 -42
- package/dist/generated/wspace-operations.js +6 -16
- package/dist/generated/wspace-operations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportQueries.js","names":["GqlExportFormat","GqlExportJobStatus","GqlExportScope","optionalString","value","optionalNumber","parsed","numberOrZero","optionalRecord","mapPageInfo","pageInfo","mapPart","part","mapJob","job","mapTemplate","template","mapAvailableEntity","entity","toGqlFormat","format","ExportFormat","toGqlStatus","status","ExportJobStatus","toGqlScope","scope","ExportScope","useExportJobs","useExport","backendFilter","filter","workspaceId","useQuery","ListExportJobsDocument","data","loading","error","useExportJob","GetExportJobDocument","jobId","useExportJobProgress","useSubscription","ExportJobProgressDocument","uniqueByEntityType","seen","rows","row","appendEntityPage","fetchMoreResult","previous","useAvailableEntities","ctxWorkspaceId","options","overrideWorkspaceId","GetAvailableExportEntitiesDocument","connection","entities","edge","loadMore","fetchMore","hasNextPage","endCursor","pageKey","requestedPage","useRef","moreFailure","setMoreFailure","useState","reason","retryAll","useCallback","refetch","useExportTemplates","ListExportTemplatesDocument","useExportTemplate","GetExportTemplateDocument","templateId","useCreateExportJob","exportContext","client","useApolloClient","tr","useTr","loadingSystem","useLoadingSystem","mutate","useMutation","CreateExportJobDocument","createJob","restInput","input","gqlInput","filters","result","emitExportEvent","navigate","joinPath","basePath","useCancelExportJob","CancelExportJobDocument","cancelJob","id","useDeleteExportJob","DeleteExportJobDocument","deleteJob","useRetryExportJob","RetryExportJobDocument","useCreateExportTemplate","CreateExportTemplateDocument","useUpdateExportTemplate","UpdateExportTemplateDocument","useDeleteExportTemplate","DeleteExportTemplateDocument","useOrganizationExportPermission","ExportOrganizationPermissionDocument","organizationId","permission"],"sources":["../../../src/export/hooks/useExportQueries.ts"],"sourcesContent":["/**\n * Export Query Hooks\n *\n * Real Apollo Client hooks for all export operations.\n * Keep these documents in sync with src/operations/wspace/export/*.graphql.\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n useApolloClient,\n useMutation,\n useQuery,\n useSubscription,\n} from \"@apollo/client/react\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport {\n CancelExportJobDocument,\n CreateExportJobDocument,\n CreateExportTemplateDocument,\n DeleteExportJobDocument,\n DeleteExportTemplateDocument,\n ExportJobProgressDocument,\n ExportOrganizationPermissionDocument,\n GetAvailableExportEntitiesDocument,\n GetExportJobDocument,\n GetExportTemplateDocument,\n ListExportJobsDocument,\n ListExportTemplatesDocument,\n RetryExportJobDocument,\n UpdateExportTemplateDocument,\n type CancelExportJobMutation,\n type CancelExportJobMutationVariables,\n type CreateExportJobMutation,\n type CreateExportJobMutationVariables,\n type CreateExportTemplateMutation,\n type CreateExportTemplateMutationVariables,\n type DeleteExportJobMutation,\n type DeleteExportJobMutationVariables,\n type DeleteExportTemplateMutation,\n type DeleteExportTemplateMutationVariables,\n type ExportJobProgressSubscription,\n type ExportOrganizationPermissionQuery,\n type ExportOrganizationPermissionQueryVariables,\n type ExportJobProgressSubscriptionVariables,\n type GetAvailableExportEntitiesQuery,\n type GetAvailableExportEntitiesQueryVariables,\n type GetExportJobQuery,\n type GetExportJobQueryVariables,\n type GetExportTemplateQuery,\n type GetExportTemplateQueryVariables,\n type ListExportJobsQuery,\n type ListExportJobsQueryVariables,\n type ListExportTemplatesQuery,\n type ListExportTemplatesQueryVariables,\n type RetryExportJobMutation,\n type RetryExportJobMutationVariables,\n type UpdateExportTemplateMutation,\n type UpdateExportTemplateMutationVariables,\n} from \"../../generated/wspace-operations\";\nimport {\n ExportFormat as GqlExportFormat,\n ExportJobStatus as GqlExportJobStatus,\n ExportScope as GqlExportScope,\n type CreateExportJobInput as GqlCreateExportJobInput,\n type CreateExportTemplateInput as GqlCreateExportTemplateInput,\n type ExportJobFilterInput as GqlExportJobFilterInput,\n type ExportPaginationInput as GqlExportPaginationInput,\n} from \"../../generated/wspace-types\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport { joinPath } from \"../utils/paths\";\nimport { followExportInBackground } from \"./exportBackgroundTask\";\nimport { useTr } from \"./useTr\";\nimport { emitExportEvent } from \"../utils/events\";\nimport type {\n ExportArchiveFormat,\n ExportFormat,\n ExportJob,\n ExportJobStatus,\n ExportScope,\n ExportTemplate,\n ExportAvailableEntity,\n ExportPart,\n ExportFilter,\n PageInfo,\n} from \"../types\";\n\n// ---------------------------------------------------------------------------\n// Mapping helpers\n// ---------------------------------------------------------------------------\n\ntype Nullable<T> = T | null | undefined;\n\ninterface ExportPartLike {\n id: string;\n jobId?: Nullable<string>;\n partNumber: number;\n fileName: string;\n sizeBytes: number | string;\n entityTypes: string[];\n downloadUrl?: Nullable<string>;\n downloadExpiresAt?: Nullable<string>;\n checksum?: Nullable<string>;\n createdAt?: Nullable<string>;\n}\n\nexport interface ExportJobLike {\n id: string;\n name: string;\n description?: Nullable<string>;\n status: string;\n progress: number;\n exportScope?: Nullable<string>;\n organizationId?: Nullable<string>;\n targetWorkspaceIds?: Nullable<string[]>;\n entityTypes: string[];\n format: string;\n archiveFormat?: Nullable<string>;\n totalEntities?: Nullable<number>;\n processedEntities?: Nullable<number>;\n totalSizeBytes?: Nullable<number | string>;\n parts?: Nullable<ExportPartLike[]>;\n archiveFileId?: Nullable<string>;\n downloadUrl?: Nullable<string>;\n downloadExpiresAt?: Nullable<string>;\n templateId?: Nullable<string>;\n entityFilters?: Nullable<Record<string, unknown>>;\n errorMessage?: Nullable<string>;\n startedAt?: Nullable<string>;\n completedAt?: Nullable<string>;\n expiresAt?: Nullable<string>;\n createdBy: string;\n temporalWorkflowId?: Nullable<string>;\n workspaceId?: Nullable<string>;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ExportTemplateLike {\n id: string;\n name: string;\n description?: Nullable<string>;\n entityTypes: string[];\n format: string;\n entityFilters?: Nullable<Record<string, unknown>>;\n isDefault: boolean;\n workspaceId?: Nullable<string>;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ExportAvailableEntityLike {\n entityType: string;\n displayName: string;\n description?: Nullable<string>;\n estimatedSize?: Nullable<string>;\n supportsDateRange: boolean;\n supportsMediaExport: boolean;\n enabled: boolean;\n}\n\nfunction optionalString(value: Nullable<string>): string | undefined {\n return value ?? undefined;\n}\n\nfunction optionalNumber(value: Nullable<number | string>): number | undefined {\n if (value == null) return undefined;\n const parsed = typeof value === \"number\" ? value : Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\n\nfunction numberOrZero(value: Nullable<number | string>): number {\n return optionalNumber(value) ?? 0;\n}\n\nfunction optionalRecord(\n value: Nullable<Record<string, unknown>>,\n): Record<string, unknown> | undefined {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? value\n : undefined;\n}\n\nfunction mapPageInfo(pageInfo: {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n startCursor?: Nullable<string>;\n endCursor?: Nullable<string>;\n}): PageInfo {\n return {\n hasNextPage: pageInfo.hasNextPage,\n hasPreviousPage: pageInfo.hasPreviousPage,\n startCursor: optionalString(pageInfo.startCursor),\n endCursor: optionalString(pageInfo.endCursor),\n };\n}\n\nfunction mapPart(part: ExportPartLike): ExportPart {\n return {\n id: part.id,\n jobId: optionalString(part.jobId),\n partNumber: part.partNumber,\n fileName: part.fileName,\n sizeBytes: numberOrZero(part.sizeBytes),\n entityTypes: part.entityTypes,\n downloadUrl: optionalString(part.downloadUrl),\n downloadExpiresAt: optionalString(part.downloadExpiresAt),\n checksum: optionalString(part.checksum),\n createdAt: optionalString(part.createdAt),\n };\n}\n\n/** A service export job as the module's `ExportJob` (also used by the v2 Downloads list). */\nexport function mapJob(job: ExportJobLike): ExportJob {\n return {\n id: job.id,\n name: job.name,\n description: optionalString(job.description),\n status: job.status as ExportJobStatus,\n progress: job.progress,\n exportScope: job.exportScope ? (job.exportScope as ExportScope) : undefined,\n organizationId: optionalString(job.organizationId),\n targetWorkspaceIds: job.targetWorkspaceIds ?? undefined,\n entityTypes: job.entityTypes,\n format: job.format as ExportFormat,\n archiveFormat: (job.archiveFormat ?? \"ZIP\") as ExportArchiveFormat,\n totalEntities: optionalNumber(job.totalEntities),\n processedEntities: optionalNumber(job.processedEntities),\n totalSizeBytes: optionalNumber(job.totalSizeBytes),\n parts: job.parts?.map(mapPart) ?? [],\n archiveFileId: optionalString(job.archiveFileId),\n downloadUrl: optionalString(job.downloadUrl),\n downloadExpiresAt: optionalString(job.downloadExpiresAt),\n templateId: optionalString(job.templateId),\n filters: optionalRecord(job.entityFilters),\n errorMessage: optionalString(job.errorMessage),\n startedAt: optionalString(job.startedAt),\n completedAt: optionalString(job.completedAt),\n expiresAt: optionalString(job.expiresAt),\n createdBy: job.createdBy,\n temporalWorkflowId: optionalString(job.temporalWorkflowId),\n workspaceId: optionalString(job.workspaceId),\n createdAt: job.createdAt,\n updatedAt: job.updatedAt,\n };\n}\n\n/** A service export template as the module's `ExportTemplate` (also used by the v2 Saved setups). */\nexport function mapTemplate(template: ExportTemplateLike): ExportTemplate {\n return {\n id: template.id,\n name: template.name,\n description: optionalString(template.description),\n entityTypes: template.entityTypes,\n format: template.format as ExportFormat,\n filters: optionalRecord(template.entityFilters),\n isDefault: template.isDefault,\n createdBy: template.createdBy,\n workspaceId: optionalString(template.workspaceId),\n createdAt: template.createdAt,\n updatedAt: template.updatedAt,\n };\n}\n\nfunction mapAvailableEntity(\n entity: ExportAvailableEntityLike,\n): ExportAvailableEntity {\n return {\n entityType: entity.entityType,\n displayName: entity.displayName,\n description: optionalString(entity.description),\n estimatedSize: optionalString(entity.estimatedSize),\n supportsDateRange: entity.supportsDateRange,\n supportsMediaExport: entity.supportsMediaExport,\n enabled: entity.enabled,\n };\n}\n\nfunction toGqlFormat(format: ExportFormat | string): GqlExportFormat {\n if (format === \"CSV\") return GqlExportFormat.Csv;\n if (format === \"JSON\") return GqlExportFormat.Json;\n throw new Error(`Unsupported export format: ${format}`);\n}\n\nfunction toGqlStatus(status: ExportJobStatus | string): GqlExportJobStatus {\n switch (status) {\n case \"CANCELLED\":\n return GqlExportJobStatus.Cancelled;\n case \"COMPLETED\":\n return GqlExportJobStatus.Completed;\n case \"CREATED\":\n return GqlExportJobStatus.Created;\n case \"DELETED\":\n return GqlExportJobStatus.Deleted;\n case \"EXPIRED\":\n return GqlExportJobStatus.Expired;\n case \"FAILED\":\n return GqlExportJobStatus.Failed;\n case \"QUEUED\":\n return GqlExportJobStatus.Queued;\n case \"RUNNING\":\n return GqlExportJobStatus.Running;\n default:\n throw new Error(`Unsupported export status: ${status}`);\n }\n}\n\nfunction toGqlScope(scope: ExportScope | string): GqlExportScope {\n switch (scope) {\n case \"INDIVIDUAL\":\n return GqlExportScope.Individual;\n case \"WORKSPACE_ADMIN\":\n return GqlExportScope.WorkspaceAdmin;\n case \"ORG_ADMIN\":\n return GqlExportScope.OrgAdmin;\n default:\n throw new Error(`Unsupported export scope: ${scope}`);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Query Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Input for creating an export job\n */\nexport interface CreateExportJobInput {\n name: string;\n description?: string;\n exportScope?: ExportScope;\n organizationId?: string;\n entityTypes: string[];\n format: ExportFormat;\n filters?: Record<string, unknown>;\n templateId?: string;\n dateRangeStart?: string | null;\n dateRangeEnd?: string | null;\n}\n\n/**\n * Input for creating an export template\n */\nexport interface CreateExportTemplateInput {\n name: string;\n description?: string;\n entityTypes: string[];\n format: ExportFormat;\n}\n\n/**\n * Filter input for listing export jobs\n */\nexport interface ExportJobFilterInput {\n status?: ExportJobStatus[];\n format?: ExportFormat;\n entityTypes?: string[];\n search?: string;\n dateFrom?: string;\n dateTo?: string;\n}\n\n/**\n * Pagination input for export job list\n */\nexport interface ExportPaginationInput {\n first?: number;\n after?: string;\n last?: number;\n before?: string;\n}\n\n/**\n * Hook to fetch a paginated list of export jobs\n */\nexport function useExportJobs(\n filter?: Partial<ExportFilter>,\n pagination?: ExportPaginationInput,\n) {\n const { workspaceId } = useExport();\n\n // Build the backend filter from the UI filter shape\n const backendFilter: GqlExportJobFilterInput | undefined =\n filter && workspaceId\n ? {\n status:\n filter.status && filter.status !== \"all\"\n ? [toGqlStatus(filter.status)]\n : undefined,\n format:\n filter.format && filter.format !== \"all\"\n ? toGqlFormat(filter.format)\n : undefined,\n search: filter.search ?? undefined,\n }\n : undefined;\n\n const { data, loading, error, refetch } = useQuery<\n ListExportJobsQuery,\n ListExportJobsQueryVariables\n >(ListExportJobsDocument, {\n variables: {\n filter: backendFilter,\n pagination: pagination as GqlExportPaginationInput | undefined,\n context: { workspaceId },\n },\n skip: !workspaceId,\n });\n\n const jobs = data?.listExportJobs.edges.map((e) => mapJob(e.node)) ?? [];\n const totalCount = data?.listExportJobs.totalCount ?? 0;\n const pageInfo = data?.listExportJobs.pageInfo\n ? mapPageInfo(data.listExportJobs.pageInfo)\n : null;\n\n return {\n data: jobs,\n totalCount,\n pageInfo,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a single export job by ID.\n */\nexport function useExportJob(jobId: string | undefined) {\n const { workspaceId } = useExport();\n\n const { data, loading, error, refetch } = useQuery<\n GetExportJobQuery,\n GetExportJobQueryVariables\n >(GetExportJobDocument, {\n variables: { id: jobId ?? \"\", context: { workspaceId } },\n skip: !jobId || !workspaceId,\n });\n\n const job = data?.getExportJob ? mapJob(data.getExportJob) : null;\n\n return {\n data: job,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to subscribe to live progress updates for an export job.\n */\nexport function useExportJobProgress(jobId: string | undefined) {\n const { data, loading, error } = useSubscription<\n ExportJobProgressSubscription,\n ExportJobProgressSubscriptionVariables\n >(ExportJobProgressDocument, {\n variables: { jobId: jobId ?? \"\" },\n skip: !jobId,\n });\n\n return {\n data: data?.exportJobProgress ? mapJob(data.exportJobProgress) : null,\n isLoading: loading,\n error: error ?? null,\n };\n}\n\n/** Keep the first row for each entity type, in order. */\nexport function uniqueByEntityType<T extends { entityType: string }>(\n rows: readonly T[],\n): T[] {\n const seen = new Set<string>();\n return rows.filter((row) => {\n if (seen.has(row.entityType)) return false;\n seen.add(row.entityType);\n return true;\n });\n}\n\n/** Apollo `updateQuery` for the catalog: append a fetched page's edges. */\nfunction appendEntityPage(\n previous: GetAvailableExportEntitiesQuery,\n { fetchMoreResult }: { fetchMoreResult?: GetAvailableExportEntitiesQuery },\n): GetAvailableExportEntitiesQuery {\n if (!fetchMoreResult) return previous;\n return {\n getAvailableExportEntities: {\n ...fetchMoreResult.getAvailableExportEntities,\n edges: [\n ...previous.getAvailableExportEntities.edges,\n ...fetchMoreResult.getAvailableExportEntities.edges,\n ],\n },\n };\n}\n\n/**\n * Hook to fetch available entity types for export in a workspace\n */\nexport function useAvailableEntities(\n overrideWorkspaceId?: string,\n options: { skip?: boolean } = {},\n) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = options.skip\n ? undefined\n : (overrideWorkspaceId ?? ctxWorkspaceId);\n\n const { data, loading, error, refetch, fetchMore } = useQuery<\n GetAvailableExportEntitiesQuery,\n GetAvailableExportEntitiesQueryVariables\n >(GetAvailableExportEntitiesDocument, {\n variables: {\n context: { workspaceId },\n pagination: { first: 100 },\n },\n skip: !workspaceId,\n });\n\n const connection = data?.getAvailableExportEntities;\n // One row per entity type: the catalog's pages can overlap (the first page\n // is refetched while later pages are appended), which listed every entity\n // type after the first page twice.\n const entities = uniqueByEntityType(\n connection?.edges.map((edge) => mapAvailableEntity(edge.node)) ?? [],\n );\n\n const loadMore = async () => {\n if (!workspaceId || !connection?.pageInfo.hasNextPage) return;\n await fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: connection.pageInfo.endCursor },\n },\n updateQuery: appendEntityPage,\n });\n };\n\n // The entity picker and the template editor need the whole catalog (well\n // over one 100-entry page: entities are sorted by display name, so products\n // late in the alphabet, e.g. VibeControls, were never shown). Fetch the\n // remaining pages, once per cursor.\n const hasNextPage = connection?.pageInfo.hasNextPage ?? false;\n const endCursor = connection?.pageInfo.endCursor ?? null;\n // The page asked for next, per workspace: cursors can be bare offsets, so\n // another workspace's catalog can end its first page on the same cursor.\n const pageKey = `${workspaceId ?? \"\"}|${endCursor ?? \"\"}`;\n const requestedPage = useRef<string | null>(null);\n // A later page that failed (the first page's failure is `error`).\n const [moreFailure, setMoreFailure] = useState<{\n page: string;\n error: Error;\n } | null>(null);\n useEffect(() => {\n if (loading || !workspaceId || !hasNextPage || !endCursor) return;\n if (requestedPage.current === pageKey) return;\n requestedPage.current = pageKey;\n void fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: endCursor },\n },\n updateQuery: appendEntityPage,\n }).catch((reason: unknown) => {\n setMoreFailure({\n page: pageKey,\n error: reason instanceof Error ? reason : new Error(String(reason)),\n });\n });\n }, [loading, workspaceId, hasNextPage, endCursor, fetchMore, pageKey]);\n\n // Workspace pages v2 (BOFF-15822): asks for the whole catalog again, from\n // its first page, after either failure.\n const retryAll = useCallback(() => {\n requestedPage.current = null;\n setMoreFailure(null);\n void refetch().catch(() => undefined);\n }, [refetch]);\n\n return {\n data: entities,\n totalCount: connection?.totalCount ?? 0,\n pageInfo: connection?.pageInfo ? mapPageInfo(connection.pageInfo) : null,\n loadMore,\n error: error ?? null,\n isLoading: loading,\n refetch,\n /** Every page of the catalog has loaded. */\n complete: Boolean(connection) && !hasNextPage,\n /** A later page failed to load; `retryAll` asks again. */\n moreError: moreFailure?.page === pageKey ? moreFailure.error : null,\n retryAll,\n };\n}\n\n/**\n * Hook to fetch all export templates for the current workspace\n */\nexport function useExportTemplates(overrideWorkspaceId?: string) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = overrideWorkspaceId ?? ctxWorkspaceId;\n\n const { data, loading, error, refetch, fetchMore } = useQuery<\n ListExportTemplatesQuery,\n ListExportTemplatesQueryVariables\n >(ListExportTemplatesDocument, {\n variables: {\n context: { workspaceId },\n pagination: { first: 50 },\n },\n skip: !workspaceId,\n });\n\n const connection = data?.listExportTemplates;\n const templates =\n connection?.edges.map((edge) => mapTemplate(edge.node)) ?? [];\n\n const loadMore = async () => {\n if (!workspaceId || !connection?.pageInfo.hasNextPage) return;\n await fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 50, after: connection.pageInfo.endCursor },\n },\n updateQuery: (previous, { fetchMoreResult }) => {\n if (!fetchMoreResult) return previous;\n return {\n listExportTemplates: {\n ...fetchMoreResult.listExportTemplates,\n edges: [\n ...previous.listExportTemplates.edges,\n ...fetchMoreResult.listExportTemplates.edges,\n ],\n },\n };\n },\n });\n };\n\n return {\n data: templates,\n totalCount: connection?.totalCount ?? 0,\n pageInfo: connection?.pageInfo ? mapPageInfo(connection.pageInfo) : null,\n loadMore,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a single export template by ID\n */\nexport function useExportTemplate(templateId: string | undefined) {\n const { workspaceId } = useExport();\n\n const { data, loading, error } = useQuery<\n GetExportTemplateQuery,\n GetExportTemplateQueryVariables\n >(GetExportTemplateDocument, {\n variables: { id: templateId ?? \"\", context: { workspaceId } },\n skip: !templateId || !workspaceId,\n });\n\n return {\n data: data?.getExportTemplate ? mapTemplate(data.getExportTemplate) : null,\n isLoading: loading,\n error: error ?? null,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Mutation Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Hook to create a new export job\n */\nexport function useCreateExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const client = useApolloClient();\n const tr = useTr();\n // BOFF-16259: under the loading system's opt-in, a download just started is followed in the\n // top bar's task chip until it is ready (a toast to open it). Without it, nothing changes.\n const loadingSystem = useLoadingSystem();\n const [mutate, { loading, error }] = useMutation<\n CreateExportJobMutation,\n CreateExportJobMutationVariables\n >(CreateExportJobDocument);\n\n const createJob = async (input: CreateExportJobInput): Promise<ExportJob> => {\n const { filters, ...restInput } = input;\n const gqlInput: GqlCreateExportJobInput = {\n ...restInput,\n exportScope: restInput.exportScope\n ? toGqlScope(restInput.exportScope)\n : undefined,\n format: toGqlFormat(restInput.format),\n entityFilters: filters,\n };\n\n const result = await mutate({\n variables: {\n context: { workspaceId },\n input: gqlInput,\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"createExportJob\",\n });\n throw new Error(\"Failed to create export job\");\n }\n emitExportEvent(exportContext, \"export.job.created\", {\n jobId: result.data.createExportJob.id,\n });\n const job = mapJob(result.data.createExportJob);\n if (loadingSystem) {\n const { basePath = \"/\", navigate } = exportContext;\n followExportInBackground({\n client,\n job,\n readyMessage: `${job.name} · ${tr(\"export.v2.state.ready\", \"Ready\")}`,\n openLabel: tr(\"export.v2.row.open\", \"Open\"),\n onOpen: () => navigate?.(joinPath(basePath, job.id)),\n });\n }\n return job;\n };\n\n return {\n createJob,\n // Keep legacy names for existing callers\n mutate: createJob,\n mutateAsync: createJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to cancel an export job\n */\nexport function useCancelExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n CancelExportJobMutation,\n CancelExportJobMutationVariables\n >(CancelExportJobDocument);\n\n const cancelJob = async (id: string) => {\n const result = await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"cancelExportJob\",\n jobId: id,\n });\n throw new Error(\"Failed to cancel export job\");\n }\n emitExportEvent(exportContext, \"export.job.cancelled\", { jobId: id });\n return result.data.cancelExportJob;\n };\n\n return {\n cancelJob,\n mutate: cancelJob,\n mutateAsync: cancelJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to delete an export job\n */\nexport function useDeleteExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n DeleteExportJobMutation,\n DeleteExportJobMutationVariables\n >(DeleteExportJobDocument);\n\n const deleteJob = async (id: string): Promise<boolean> => {\n await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n emitExportEvent(exportContext, \"export.job.deleted\", { jobId: id });\n return true;\n };\n\n return {\n deleteJob,\n mutate: deleteJob,\n mutateAsync: deleteJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to retry a failed export job\n */\nexport function useRetryExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n RetryExportJobMutation,\n RetryExportJobMutationVariables\n >(RetryExportJobDocument);\n\n const retryJob = async (id: string): Promise<ExportJob> => {\n const result = await mutate({\n variables: { id, context: { workspaceId } },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"retryExportJob\",\n jobId: id,\n });\n throw new Error(\"Failed to retry export job\");\n }\n emitExportEvent(exportContext, \"export.job.retried\", {\n originalJobId: id,\n jobId: result.data.retryExportJob.id,\n });\n return mapJob(result.data.retryExportJob);\n };\n\n return {\n retryJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to create a new export template\n */\nexport function useCreateExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n CreateExportTemplateMutation,\n CreateExportTemplateMutationVariables\n >(CreateExportTemplateDocument);\n\n const createTemplate = async (\n input: CreateExportTemplateInput,\n ): Promise<ExportTemplate> => {\n const gqlInput: GqlCreateExportTemplateInput = {\n ...input,\n format: toGqlFormat(input.format),\n };\n\n const result = await mutate({\n variables: {\n context: { workspaceId },\n input: gqlInput,\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"createExportTemplate\",\n });\n throw new Error(\"Failed to create export template\");\n }\n emitExportEvent(exportContext, \"export.template.created\", {\n templateId: result.data.createExportTemplate.id,\n });\n return mapTemplate(result.data.createExportTemplate);\n };\n\n return {\n createTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to change an export template's name, kinds of data and file type\n * (Workspace pages v2, BOFF-15822: New download keeps a setup it saved in step\n * with the choices when a start is tried again).\n */\nexport function useUpdateExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n UpdateExportTemplateMutation,\n UpdateExportTemplateMutationVariables\n >(UpdateExportTemplateDocument);\n\n const updateTemplate = async (\n id: string,\n input: CreateExportTemplateInput,\n ): Promise<ExportTemplate> => {\n const result = await mutate({\n variables: {\n context: { workspaceId },\n id,\n input: { ...input, format: toGqlFormat(input.format) },\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"updateExportTemplate\",\n });\n throw new Error(\"Failed to update export template\");\n }\n return mapTemplate(result.data.updateExportTemplate);\n };\n\n return {\n updateTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to delete an export template\n */\nexport function useDeleteExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n DeleteExportTemplateMutation,\n DeleteExportTemplateMutationVariables\n >(DeleteExportTemplateDocument);\n\n const deleteTemplate = async (id: string): Promise<boolean> => {\n await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n emitExportEvent(exportContext, \"export.template.deleted\", {\n templateId: id,\n });\n return true;\n };\n\n return {\n deleteTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\nexport interface OrganizationExportPermissionOptions {\n /**\n * Keep a refusal out of the app's backend-error toast. The access service\n * answers `myPermissions` only for the person's own workspace scope (super\n * admins and services excepted), so asking about the organization is\n * refused for most people: that refusal is the expected \"no\", not a failure\n * to show them.\n */\n quiet?: boolean;\n}\n\n/** Organization scope is independent of workspace grants; this is a UX hint only. */\nexport function useOrganizationExportPermission(\n organizationId: string | undefined,\n options: OrganizationExportPermissionOptions = {},\n): boolean {\n const { data, loading, error } = useQuery<\n ExportOrganizationPermissionQuery,\n ExportOrganizationPermissionQueryVariables\n >(ExportOrganizationPermissionDocument, {\n variables: { scopeId: organizationId ?? \"\" },\n skip: !organizationId,\n fetchPolicy: \"network-only\",\n // The shell's Apollo client reads this from the operation's context.\n context: options.quiet ? { suppressGlobalErrorEvent: true } : undefined,\n });\n return (\n !!organizationId &&\n !!data &&\n !loading &&\n !error &&\n data?.myPermissions.scopeId === organizationId &&\n data.myPermissions.permissions.some(\n (permission) =>\n permission.resourceType === \"export\" &&\n permission.allowedActions.includes(\"organization_admin\"),\n )\n );\n}\n"],"mappings":";;;;;;;;;;;AAiKA,SAASG,EAAe,GA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F,CAAC,CAACjF,KACF,CAACC,KACD,CAACC,KACDF,GAAM,cAAc,YAAYiF,KAChCjF,EAAK,cAAc,YAAY,MAC5B,MACCkF,EAAW,iBAAiB,YAC5BA,EAAW,eAAe,SAAS,oBAAoB,CAC3D;AAEJ"}
|
|
1
|
+
{"version":3,"file":"useExportQueries.js","names":["GqlExportFormat","GqlExportJobStatus","GqlExportScope","optionalString","value","optionalNumber","parsed","numberOrZero","optionalRecord","mapPageInfo","pageInfo","mapPart","part","mapJob","job","mapTemplate","template","mapAvailableEntity","entity","toGqlFormat","format","ExportFormat","toGqlStatus","status","ExportJobStatus","toGqlScope","scope","ExportScope","useExportJobs","useExport","backendFilter","filter","workspaceId","useQuery","ListExportJobsDocument","data","loading","error","useExportJob","GetExportJobDocument","jobId","useExportJobProgress","useSubscription","ExportJobProgressDocument","uniqueByEntityType","seen","rows","row","appendEntityPage","fetchMoreResult","previous","useAvailableEntities","ctxWorkspaceId","options","overrideWorkspaceId","GetAvailableExportEntitiesDocument","connection","entities","edge","loadMore","fetchMore","hasNextPage","endCursor","pageKey","requestedPage","useRef","moreFailure","setMoreFailure","useState","reason","retryAll","useCallback","refetch","useExportTemplates","ListExportTemplatesDocument","useExportTemplate","GetExportTemplateDocument","templateId","useCreateExportJob","exportContext","client","useApolloClient","tr","useTr","loadingSystem","useLoadingSystem","mutate","useMutation","CreateExportJobDocument","createJob","restInput","input","gqlInput","filters","result","emitExportEvent","navigate","joinPath","basePath","useCancelExportJob","CancelExportJobDocument","cancelJob","id","useDeleteExportJob","DeleteExportJobDocument","deleteJob","useRetryExportJob","RetryExportJobDocument","useCreateExportTemplate","CreateExportTemplateDocument","useUpdateExportTemplate","UpdateExportTemplateDocument","useDeleteExportTemplate","DeleteExportTemplateDocument","useOrganizationExportPermission"],"sources":["../../../src/export/hooks/useExportQueries.ts"],"sourcesContent":["/**\n * Export Query Hooks\n *\n * Real Apollo Client hooks for all export operations.\n * Keep these documents in sync with src/operations/wspace/export/*.graphql.\n */\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n useApolloClient,\n useMutation,\n useQuery,\n useSubscription,\n} from \"@apollo/client/react\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport {\n CancelExportJobDocument,\n CreateExportJobDocument,\n CreateExportTemplateDocument,\n DeleteExportJobDocument,\n DeleteExportTemplateDocument,\n ExportJobProgressDocument,\n GetAvailableExportEntitiesDocument,\n GetExportJobDocument,\n GetExportTemplateDocument,\n ListExportJobsDocument,\n ListExportTemplatesDocument,\n RetryExportJobDocument,\n UpdateExportTemplateDocument,\n type CancelExportJobMutation,\n type CancelExportJobMutationVariables,\n type CreateExportJobMutation,\n type CreateExportJobMutationVariables,\n type CreateExportTemplateMutation,\n type CreateExportTemplateMutationVariables,\n type DeleteExportJobMutation,\n type DeleteExportJobMutationVariables,\n type DeleteExportTemplateMutation,\n type DeleteExportTemplateMutationVariables,\n type ExportJobProgressSubscription,\n type ExportJobProgressSubscriptionVariables,\n type GetAvailableExportEntitiesQuery,\n type GetAvailableExportEntitiesQueryVariables,\n type GetExportJobQuery,\n type GetExportJobQueryVariables,\n type GetExportTemplateQuery,\n type GetExportTemplateQueryVariables,\n type ListExportJobsQuery,\n type ListExportJobsQueryVariables,\n type ListExportTemplatesQuery,\n type ListExportTemplatesQueryVariables,\n type RetryExportJobMutation,\n type RetryExportJobMutationVariables,\n type UpdateExportTemplateMutation,\n type UpdateExportTemplateMutationVariables,\n} from \"../../generated/wspace-operations\";\nimport {\n ExportFormat as GqlExportFormat,\n ExportJobStatus as GqlExportJobStatus,\n ExportScope as GqlExportScope,\n type CreateExportJobInput as GqlCreateExportJobInput,\n type CreateExportTemplateInput as GqlCreateExportTemplateInput,\n type ExportJobFilterInput as GqlExportJobFilterInput,\n type ExportPaginationInput as GqlExportPaginationInput,\n} from \"../../generated/wspace-types\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport { joinPath } from \"../utils/paths\";\nimport { followExportInBackground } from \"./exportBackgroundTask\";\nimport { useTr } from \"./useTr\";\nimport { emitExportEvent } from \"../utils/events\";\nimport type {\n ExportArchiveFormat,\n ExportFormat,\n ExportJob,\n ExportJobStatus,\n ExportScope,\n ExportTemplate,\n ExportAvailableEntity,\n ExportPart,\n ExportFilter,\n PageInfo,\n} from \"../types\";\n\n// ---------------------------------------------------------------------------\n// Mapping helpers\n// ---------------------------------------------------------------------------\n\ntype Nullable<T> = T | null | undefined;\n\ninterface ExportPartLike {\n id: string;\n jobId?: Nullable<string>;\n partNumber: number;\n fileName: string;\n sizeBytes: number | string;\n entityTypes: string[];\n downloadUrl?: Nullable<string>;\n downloadExpiresAt?: Nullable<string>;\n checksum?: Nullable<string>;\n createdAt?: Nullable<string>;\n}\n\nexport interface ExportJobLike {\n id: string;\n name: string;\n description?: Nullable<string>;\n status: string;\n progress: number;\n exportScope?: Nullable<string>;\n organizationId?: Nullable<string>;\n targetWorkspaceIds?: Nullable<string[]>;\n entityTypes: string[];\n format: string;\n archiveFormat?: Nullable<string>;\n totalEntities?: Nullable<number>;\n processedEntities?: Nullable<number>;\n totalSizeBytes?: Nullable<number | string>;\n parts?: Nullable<ExportPartLike[]>;\n archiveFileId?: Nullable<string>;\n downloadUrl?: Nullable<string>;\n downloadExpiresAt?: Nullable<string>;\n templateId?: Nullable<string>;\n entityFilters?: Nullable<Record<string, unknown>>;\n errorMessage?: Nullable<string>;\n startedAt?: Nullable<string>;\n completedAt?: Nullable<string>;\n expiresAt?: Nullable<string>;\n createdBy: string;\n temporalWorkflowId?: Nullable<string>;\n workspaceId?: Nullable<string>;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface ExportTemplateLike {\n id: string;\n name: string;\n description?: Nullable<string>;\n entityTypes: string[];\n format: string;\n entityFilters?: Nullable<Record<string, unknown>>;\n isDefault: boolean;\n workspaceId?: Nullable<string>;\n createdBy: string;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ExportAvailableEntityLike {\n entityType: string;\n displayName: string;\n description?: Nullable<string>;\n estimatedSize?: Nullable<string>;\n supportsDateRange: boolean;\n supportsMediaExport: boolean;\n enabled: boolean;\n}\n\nfunction optionalString(value: Nullable<string>): string | undefined {\n return value ?? undefined;\n}\n\nfunction optionalNumber(value: Nullable<number | string>): number | undefined {\n if (value == null) return undefined;\n const parsed = typeof value === \"number\" ? value : Number(value);\n return Number.isFinite(parsed) ? parsed : undefined;\n}\n\nfunction numberOrZero(value: Nullable<number | string>): number {\n return optionalNumber(value) ?? 0;\n}\n\nfunction optionalRecord(\n value: Nullable<Record<string, unknown>>,\n): Record<string, unknown> | undefined {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? value\n : undefined;\n}\n\nfunction mapPageInfo(pageInfo: {\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n startCursor?: Nullable<string>;\n endCursor?: Nullable<string>;\n}): PageInfo {\n return {\n hasNextPage: pageInfo.hasNextPage,\n hasPreviousPage: pageInfo.hasPreviousPage,\n startCursor: optionalString(pageInfo.startCursor),\n endCursor: optionalString(pageInfo.endCursor),\n };\n}\n\nfunction mapPart(part: ExportPartLike): ExportPart {\n return {\n id: part.id,\n jobId: optionalString(part.jobId),\n partNumber: part.partNumber,\n fileName: part.fileName,\n sizeBytes: numberOrZero(part.sizeBytes),\n entityTypes: part.entityTypes,\n downloadUrl: optionalString(part.downloadUrl),\n downloadExpiresAt: optionalString(part.downloadExpiresAt),\n checksum: optionalString(part.checksum),\n createdAt: optionalString(part.createdAt),\n };\n}\n\n/** A service export job as the module's `ExportJob` (also used by the v2 Downloads list). */\nexport function mapJob(job: ExportJobLike): ExportJob {\n return {\n id: job.id,\n name: job.name,\n description: optionalString(job.description),\n status: job.status as ExportJobStatus,\n progress: job.progress,\n exportScope: job.exportScope ? (job.exportScope as ExportScope) : undefined,\n organizationId: optionalString(job.organizationId),\n targetWorkspaceIds: job.targetWorkspaceIds ?? undefined,\n entityTypes: job.entityTypes,\n format: job.format as ExportFormat,\n archiveFormat: (job.archiveFormat ?? \"ZIP\") as ExportArchiveFormat,\n totalEntities: optionalNumber(job.totalEntities),\n processedEntities: optionalNumber(job.processedEntities),\n totalSizeBytes: optionalNumber(job.totalSizeBytes),\n parts: job.parts?.map(mapPart) ?? [],\n archiveFileId: optionalString(job.archiveFileId),\n downloadUrl: optionalString(job.downloadUrl),\n downloadExpiresAt: optionalString(job.downloadExpiresAt),\n templateId: optionalString(job.templateId),\n filters: optionalRecord(job.entityFilters),\n errorMessage: optionalString(job.errorMessage),\n startedAt: optionalString(job.startedAt),\n completedAt: optionalString(job.completedAt),\n expiresAt: optionalString(job.expiresAt),\n createdBy: job.createdBy,\n temporalWorkflowId: optionalString(job.temporalWorkflowId),\n workspaceId: optionalString(job.workspaceId),\n createdAt: job.createdAt,\n updatedAt: job.updatedAt,\n };\n}\n\n/** A service export template as the module's `ExportTemplate` (also used by the v2 Saved setups). */\nexport function mapTemplate(template: ExportTemplateLike): ExportTemplate {\n return {\n id: template.id,\n name: template.name,\n description: optionalString(template.description),\n entityTypes: template.entityTypes,\n format: template.format as ExportFormat,\n filters: optionalRecord(template.entityFilters),\n isDefault: template.isDefault,\n createdBy: template.createdBy,\n workspaceId: optionalString(template.workspaceId),\n createdAt: template.createdAt,\n updatedAt: template.updatedAt,\n };\n}\n\nfunction mapAvailableEntity(\n entity: ExportAvailableEntityLike,\n): ExportAvailableEntity {\n return {\n entityType: entity.entityType,\n displayName: entity.displayName,\n description: optionalString(entity.description),\n estimatedSize: optionalString(entity.estimatedSize),\n supportsDateRange: entity.supportsDateRange,\n supportsMediaExport: entity.supportsMediaExport,\n enabled: entity.enabled,\n };\n}\n\nfunction toGqlFormat(format: ExportFormat | string): GqlExportFormat {\n if (format === \"CSV\") return GqlExportFormat.Csv;\n if (format === \"JSON\") return GqlExportFormat.Json;\n throw new Error(`Unsupported export format: ${format}`);\n}\n\nfunction toGqlStatus(status: ExportJobStatus | string): GqlExportJobStatus {\n switch (status) {\n case \"CANCELLED\":\n return GqlExportJobStatus.Cancelled;\n case \"COMPLETED\":\n return GqlExportJobStatus.Completed;\n case \"CREATED\":\n return GqlExportJobStatus.Created;\n case \"DELETED\":\n return GqlExportJobStatus.Deleted;\n case \"EXPIRED\":\n return GqlExportJobStatus.Expired;\n case \"FAILED\":\n return GqlExportJobStatus.Failed;\n case \"QUEUED\":\n return GqlExportJobStatus.Queued;\n case \"RUNNING\":\n return GqlExportJobStatus.Running;\n default:\n throw new Error(`Unsupported export status: ${status}`);\n }\n}\n\nfunction toGqlScope(scope: ExportScope | string): GqlExportScope {\n switch (scope) {\n case \"INDIVIDUAL\":\n return GqlExportScope.Individual;\n case \"WORKSPACE_ADMIN\":\n return GqlExportScope.WorkspaceAdmin;\n case \"ORG_ADMIN\":\n return GqlExportScope.OrgAdmin;\n default:\n throw new Error(`Unsupported export scope: ${scope}`);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Query Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Input for creating an export job\n */\nexport interface CreateExportJobInput {\n name: string;\n description?: string;\n exportScope?: ExportScope;\n organizationId?: string;\n entityTypes: string[];\n format: ExportFormat;\n filters?: Record<string, unknown>;\n templateId?: string;\n dateRangeStart?: string | null;\n dateRangeEnd?: string | null;\n}\n\n/**\n * Input for creating an export template\n */\nexport interface CreateExportTemplateInput {\n name: string;\n description?: string;\n entityTypes: string[];\n format: ExportFormat;\n}\n\n/**\n * Filter input for listing export jobs\n */\nexport interface ExportJobFilterInput {\n status?: ExportJobStatus[];\n format?: ExportFormat;\n entityTypes?: string[];\n search?: string;\n dateFrom?: string;\n dateTo?: string;\n}\n\n/**\n * Pagination input for export job list\n */\nexport interface ExportPaginationInput {\n first?: number;\n after?: string;\n last?: number;\n before?: string;\n}\n\n/**\n * Hook to fetch a paginated list of export jobs\n */\nexport function useExportJobs(\n filter?: Partial<ExportFilter>,\n pagination?: ExportPaginationInput,\n) {\n const { workspaceId } = useExport();\n\n // Build the backend filter from the UI filter shape\n const backendFilter: GqlExportJobFilterInput | undefined =\n filter && workspaceId\n ? {\n status:\n filter.status && filter.status !== \"all\"\n ? [toGqlStatus(filter.status)]\n : undefined,\n format:\n filter.format && filter.format !== \"all\"\n ? toGqlFormat(filter.format)\n : undefined,\n search: filter.search ?? undefined,\n }\n : undefined;\n\n const { data, loading, error, refetch } = useQuery<\n ListExportJobsQuery,\n ListExportJobsQueryVariables\n >(ListExportJobsDocument, {\n variables: {\n filter: backendFilter,\n pagination: pagination as GqlExportPaginationInput | undefined,\n context: { workspaceId },\n },\n skip: !workspaceId,\n });\n\n const jobs = data?.listExportJobs.edges.map((e) => mapJob(e.node)) ?? [];\n const totalCount = data?.listExportJobs.totalCount ?? 0;\n const pageInfo = data?.listExportJobs.pageInfo\n ? mapPageInfo(data.listExportJobs.pageInfo)\n : null;\n\n return {\n data: jobs,\n totalCount,\n pageInfo,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a single export job by ID.\n */\nexport function useExportJob(jobId: string | undefined) {\n const { workspaceId } = useExport();\n\n const { data, loading, error, refetch } = useQuery<\n GetExportJobQuery,\n GetExportJobQueryVariables\n >(GetExportJobDocument, {\n variables: { id: jobId ?? \"\", context: { workspaceId } },\n skip: !jobId || !workspaceId,\n });\n\n const job = data?.getExportJob ? mapJob(data.getExportJob) : null;\n\n return {\n data: job,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to subscribe to live progress updates for an export job.\n */\nexport function useExportJobProgress(jobId: string | undefined) {\n const { data, loading, error } = useSubscription<\n ExportJobProgressSubscription,\n ExportJobProgressSubscriptionVariables\n >(ExportJobProgressDocument, {\n variables: { jobId: jobId ?? \"\" },\n skip: !jobId,\n });\n\n return {\n data: data?.exportJobProgress ? mapJob(data.exportJobProgress) : null,\n isLoading: loading,\n error: error ?? null,\n };\n}\n\n/** Keep the first row for each entity type, in order. */\nexport function uniqueByEntityType<T extends { entityType: string }>(\n rows: readonly T[],\n): T[] {\n const seen = new Set<string>();\n return rows.filter((row) => {\n if (seen.has(row.entityType)) return false;\n seen.add(row.entityType);\n return true;\n });\n}\n\n/** Apollo `updateQuery` for the catalog: append a fetched page's edges. */\nfunction appendEntityPage(\n previous: GetAvailableExportEntitiesQuery,\n { fetchMoreResult }: { fetchMoreResult?: GetAvailableExportEntitiesQuery },\n): GetAvailableExportEntitiesQuery {\n if (!fetchMoreResult) return previous;\n return {\n getAvailableExportEntities: {\n ...fetchMoreResult.getAvailableExportEntities,\n edges: [\n ...previous.getAvailableExportEntities.edges,\n ...fetchMoreResult.getAvailableExportEntities.edges,\n ],\n },\n };\n}\n\n/**\n * Hook to fetch available entity types for export in a workspace\n */\nexport function useAvailableEntities(\n overrideWorkspaceId?: string,\n options: { skip?: boolean } = {},\n) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = options.skip\n ? undefined\n : (overrideWorkspaceId ?? ctxWorkspaceId);\n\n const { data, loading, error, refetch, fetchMore } = useQuery<\n GetAvailableExportEntitiesQuery,\n GetAvailableExportEntitiesQueryVariables\n >(GetAvailableExportEntitiesDocument, {\n variables: {\n context: { workspaceId },\n pagination: { first: 100 },\n },\n skip: !workspaceId,\n });\n\n const connection = data?.getAvailableExportEntities;\n // One row per entity type: the catalog's pages can overlap (the first page\n // is refetched while later pages are appended), which listed every entity\n // type after the first page twice.\n const entities = uniqueByEntityType(\n connection?.edges.map((edge) => mapAvailableEntity(edge.node)) ?? [],\n );\n\n const loadMore = async () => {\n if (!workspaceId || !connection?.pageInfo.hasNextPage) return;\n await fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: connection.pageInfo.endCursor },\n },\n updateQuery: appendEntityPage,\n });\n };\n\n // The entity picker and the template editor need the whole catalog (well\n // over one 100-entry page: entities are sorted by display name, so products\n // late in the alphabet, e.g. VibeControls, were never shown). Fetch the\n // remaining pages, once per cursor.\n const hasNextPage = connection?.pageInfo.hasNextPage ?? false;\n const endCursor = connection?.pageInfo.endCursor ?? null;\n // The page asked for next, per workspace: cursors can be bare offsets, so\n // another workspace's catalog can end its first page on the same cursor.\n const pageKey = `${workspaceId ?? \"\"}|${endCursor ?? \"\"}`;\n const requestedPage = useRef<string | null>(null);\n // A later page that failed (the first page's failure is `error`).\n const [moreFailure, setMoreFailure] = useState<{\n page: string;\n error: Error;\n } | null>(null);\n useEffect(() => {\n if (loading || !workspaceId || !hasNextPage || !endCursor) return;\n if (requestedPage.current === pageKey) return;\n requestedPage.current = pageKey;\n void fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: endCursor },\n },\n updateQuery: appendEntityPage,\n }).catch((reason: unknown) => {\n setMoreFailure({\n page: pageKey,\n error: reason instanceof Error ? reason : new Error(String(reason)),\n });\n });\n }, [loading, workspaceId, hasNextPage, endCursor, fetchMore, pageKey]);\n\n // Workspace pages v2 (BOFF-15822): asks for the whole catalog again, from\n // its first page, after either failure.\n const retryAll = useCallback(() => {\n requestedPage.current = null;\n setMoreFailure(null);\n void refetch().catch(() => undefined);\n }, [refetch]);\n\n return {\n data: entities,\n totalCount: connection?.totalCount ?? 0,\n pageInfo: connection?.pageInfo ? mapPageInfo(connection.pageInfo) : null,\n loadMore,\n error: error ?? null,\n isLoading: loading,\n refetch,\n /** Every page of the catalog has loaded. */\n complete: Boolean(connection) && !hasNextPage,\n /** A later page failed to load; `retryAll` asks again. */\n moreError: moreFailure?.page === pageKey ? moreFailure.error : null,\n retryAll,\n };\n}\n\n/**\n * Hook to fetch all export templates for the current workspace\n */\nexport function useExportTemplates(overrideWorkspaceId?: string) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = overrideWorkspaceId ?? ctxWorkspaceId;\n\n const { data, loading, error, refetch, fetchMore } = useQuery<\n ListExportTemplatesQuery,\n ListExportTemplatesQueryVariables\n >(ListExportTemplatesDocument, {\n variables: {\n context: { workspaceId },\n pagination: { first: 50 },\n },\n skip: !workspaceId,\n });\n\n const connection = data?.listExportTemplates;\n const templates =\n connection?.edges.map((edge) => mapTemplate(edge.node)) ?? [];\n\n const loadMore = async () => {\n if (!workspaceId || !connection?.pageInfo.hasNextPage) return;\n await fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 50, after: connection.pageInfo.endCursor },\n },\n updateQuery: (previous, { fetchMoreResult }) => {\n if (!fetchMoreResult) return previous;\n return {\n listExportTemplates: {\n ...fetchMoreResult.listExportTemplates,\n edges: [\n ...previous.listExportTemplates.edges,\n ...fetchMoreResult.listExportTemplates.edges,\n ],\n },\n };\n },\n });\n };\n\n return {\n data: templates,\n totalCount: connection?.totalCount ?? 0,\n pageInfo: connection?.pageInfo ? mapPageInfo(connection.pageInfo) : null,\n loadMore,\n isLoading: loading,\n error: error ?? null,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a single export template by ID\n */\nexport function useExportTemplate(templateId: string | undefined) {\n const { workspaceId } = useExport();\n\n const { data, loading, error } = useQuery<\n GetExportTemplateQuery,\n GetExportTemplateQueryVariables\n >(GetExportTemplateDocument, {\n variables: { id: templateId ?? \"\", context: { workspaceId } },\n skip: !templateId || !workspaceId,\n });\n\n return {\n data: data?.getExportTemplate ? mapTemplate(data.getExportTemplate) : null,\n isLoading: loading,\n error: error ?? null,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Mutation Hooks\n// ---------------------------------------------------------------------------\n\n/**\n * Hook to create a new export job\n */\nexport function useCreateExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const client = useApolloClient();\n const tr = useTr();\n // BOFF-16259: under the loading system's opt-in, a download just started is followed in the\n // top bar's task chip until it is ready (a toast to open it). Without it, nothing changes.\n const loadingSystem = useLoadingSystem();\n const [mutate, { loading, error }] = useMutation<\n CreateExportJobMutation,\n CreateExportJobMutationVariables\n >(CreateExportJobDocument);\n\n const createJob = async (input: CreateExportJobInput): Promise<ExportJob> => {\n const { filters, ...restInput } = input;\n const gqlInput: GqlCreateExportJobInput = {\n ...restInput,\n exportScope: restInput.exportScope\n ? toGqlScope(restInput.exportScope)\n : undefined,\n format: toGqlFormat(restInput.format),\n entityFilters: filters,\n };\n\n const result = await mutate({\n variables: {\n context: { workspaceId },\n input: gqlInput,\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"createExportJob\",\n });\n throw new Error(\"Failed to create export job\");\n }\n emitExportEvent(exportContext, \"export.job.created\", {\n jobId: result.data.createExportJob.id,\n });\n const job = mapJob(result.data.createExportJob);\n if (loadingSystem) {\n const { basePath = \"/\", navigate } = exportContext;\n followExportInBackground({\n client,\n job,\n readyMessage: `${job.name} · ${tr(\"export.v2.state.ready\", \"Ready\")}`,\n openLabel: tr(\"export.v2.row.open\", \"Open\"),\n onOpen: () => navigate?.(joinPath(basePath, job.id)),\n });\n }\n return job;\n };\n\n return {\n createJob,\n // Keep legacy names for existing callers\n mutate: createJob,\n mutateAsync: createJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to cancel an export job\n */\nexport function useCancelExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n CancelExportJobMutation,\n CancelExportJobMutationVariables\n >(CancelExportJobDocument);\n\n const cancelJob = async (id: string) => {\n const result = await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"cancelExportJob\",\n jobId: id,\n });\n throw new Error(\"Failed to cancel export job\");\n }\n emitExportEvent(exportContext, \"export.job.cancelled\", { jobId: id });\n return result.data.cancelExportJob;\n };\n\n return {\n cancelJob,\n mutate: cancelJob,\n mutateAsync: cancelJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to delete an export job\n */\nexport function useDeleteExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n DeleteExportJobMutation,\n DeleteExportJobMutationVariables\n >(DeleteExportJobDocument);\n\n const deleteJob = async (id: string): Promise<boolean> => {\n await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n emitExportEvent(exportContext, \"export.job.deleted\", { jobId: id });\n return true;\n };\n\n return {\n deleteJob,\n mutate: deleteJob,\n mutateAsync: deleteJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to retry a failed export job\n */\nexport function useRetryExportJob() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n RetryExportJobMutation,\n RetryExportJobMutationVariables\n >(RetryExportJobDocument);\n\n const retryJob = async (id: string): Promise<ExportJob> => {\n const result = await mutate({\n variables: { id, context: { workspaceId } },\n refetchQueries: [\n {\n query: ListExportJobsDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"retryExportJob\",\n jobId: id,\n });\n throw new Error(\"Failed to retry export job\");\n }\n emitExportEvent(exportContext, \"export.job.retried\", {\n originalJobId: id,\n jobId: result.data.retryExportJob.id,\n });\n return mapJob(result.data.retryExportJob);\n };\n\n return {\n retryJob,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to create a new export template\n */\nexport function useCreateExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n CreateExportTemplateMutation,\n CreateExportTemplateMutationVariables\n >(CreateExportTemplateDocument);\n\n const createTemplate = async (\n input: CreateExportTemplateInput,\n ): Promise<ExportTemplate> => {\n const gqlInput: GqlCreateExportTemplateInput = {\n ...input,\n format: toGqlFormat(input.format),\n };\n\n const result = await mutate({\n variables: {\n context: { workspaceId },\n input: gqlInput,\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"createExportTemplate\",\n });\n throw new Error(\"Failed to create export template\");\n }\n emitExportEvent(exportContext, \"export.template.created\", {\n templateId: result.data.createExportTemplate.id,\n });\n return mapTemplate(result.data.createExportTemplate);\n };\n\n return {\n createTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to change an export template's name, kinds of data and file type\n * (Workspace pages v2, BOFF-15822: New download keeps a setup it saved in step\n * with the choices when a start is tried again).\n */\nexport function useUpdateExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n UpdateExportTemplateMutation,\n UpdateExportTemplateMutationVariables\n >(UpdateExportTemplateDocument);\n\n const updateTemplate = async (\n id: string,\n input: CreateExportTemplateInput,\n ): Promise<ExportTemplate> => {\n const result = await mutate({\n variables: {\n context: { workspaceId },\n id,\n input: { ...input, format: toGqlFormat(input.format) },\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n if (!result.data) {\n emitExportEvent(exportContext, \"export.api.failed\", {\n operation: \"updateExportTemplate\",\n });\n throw new Error(\"Failed to update export template\");\n }\n return mapTemplate(result.data.updateExportTemplate);\n };\n\n return {\n updateTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Hook to delete an export template\n */\nexport function useDeleteExportTemplate() {\n const exportContext = useExport();\n const { workspaceId } = exportContext;\n const [mutate, { loading, error }] = useMutation<\n DeleteExportTemplateMutation,\n DeleteExportTemplateMutationVariables\n >(DeleteExportTemplateDocument);\n\n const deleteTemplate = async (id: string): Promise<boolean> => {\n await mutate({\n variables: {\n id,\n context: { workspaceId },\n },\n refetchQueries: [\n {\n query: ListExportTemplatesDocument,\n variables: { context: { workspaceId } },\n },\n ],\n });\n emitExportEvent(exportContext, \"export.template.deleted\", {\n templateId: id,\n });\n return true;\n };\n\n return {\n deleteTemplate,\n loading,\n isPending: loading,\n error: error ?? null,\n };\n}\n\n/**\n * Whether the person may download the whole organization: no, for everyone, and nothing is\n * asked (BOFF-16327). The organization option stays locked, as it always was in practice.\n *\n * This used to ask the workspace access service (`myPermissions` with the organization's id).\n * That service answers only for the person's own workspace, so every member got a 403 in the\n * console on each visit, and its catalog has no organization export grant at all, so no one,\n * admins included, could get a yes. The grant (`export:organization_admin`) belongs to Global\n * RBAC (BOFF-8579). When organization downloads are checked there, ask Global RBAC's\n * `myPermissions` (a self query: the person's own grants, in any scope).\n */\nexport function useOrganizationExportPermission(\n // The organization in question; unused until then (see above).\n _organizationId: string | undefined,\n): boolean {\n return false;\n}\n"],"mappings":";;;;;;;;;;;AA8JA,SAASG,EAAe,GAA6C;CACnE,OAAOC,KAAS,KAAA;AAClB;AAEA,SAASC,EAAe,GAAsD;CAC5E,IAAID,KAAS,MAAM;CACnB,IAAME,IAAS,OAAOF,KAAU,WAAWA,IAAQ,OAAOA,CAAK;CAC/D,OAAO,OAAO,SAASE,CAAM,IAAIA,IAAS,KAAA;AAC5C;AAEA,SAASC,EAAa,GAA0C;CAC9D,OAAOF,EAAeD,CAAK,KAAK;AAClC;AAEA,SAASI,EACP,GACqC;CACrC,OAAOJ,KAAS,OAAOA,KAAU,YAAY,CAAC,MAAM,QAAQA,CAAK,IAC7DA,IACA,KAAA;AACN;AAEA,SAASK,EAAY,GAKR;CACX,OAAO;EACL,aAAaC,EAAS;EACtB,iBAAiBA,EAAS;EAC1B,aAAaP,EAAeO,EAAS,WAAW;EAChD,WAAWP,EAAeO,EAAS,SAAS;CAC9C;AACF;AAEA,SAASC,EAAQ,GAAkC;CACjD,OAAO;EACL,IAAIC,EAAK;EACT,OAAOT,EAAeS,EAAK,KAAK;EAChC,YAAYA,EAAK;EACjB,UAAUA,EAAK;EACf,WAAWL,EAAaK,EAAK,SAAS;EACtC,aAAaA,EAAK;E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,EAAO;GACX,WAAW;IACT;IACA,SAAS,EAAE,eAAY;GACzB;GACA,gBAAgB,CACd;IACE,OAAOZ;IACP,WAAW,EAAE,SAAS,EAAE,eAAY,EAAE;GACxC,CACF;EACF,CAAC,GACDqB,EAAgBhB,GAAe,2BAA2B,EACxD,YAAYuB,EACd,CAAC,GACM;EAKP;EACA,WAAWlE;EACX,OAAOC,KAAS;CAClB;AACF;AAaA,SAAgB6E,GAEd,GACS;CACT,OAAO;AACT"}
|
|
@@ -154,7 +154,7 @@ function ne(n, i) {
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
function re({ kinds: e, initial: t, setupMissing: r, onClose: o, onStarted: s, onBusy: c }) {
|
|
157
|
-
let l = i(), d = _(), { organizationId: f } = a(), p = n(f
|
|
157
|
+
let l = i(), d = _(), { organizationId: f } = a(), p = n(f), m = te(e), [h, g] = y("what"), [v, b] = y(t), { start: T, busy: E, problem: D, setupSaved: M } = ne(s, c), N = v.nameEdited ? v.name : m(v.entityTypes), P = {
|
|
158
158
|
...v,
|
|
159
159
|
name: N
|
|
160
160
|
}, F = u(P), R = (e) => b((t) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewDownloadDialog.js","names":["_Fragment","NewDownloadDialog","tr","useTr","busy","setBusy","useState","TabbedDialog","props","next","TabbedDialogContent","TabbedDialogHeader","Download","NewDownloadLoader","useStartingSetup","setups","useSavedSetups","listed","setupId","candidate","single","useSetupById","LoadFailed","Notice","testId","Button","onRetry","message","kinds","useOfferedKinds","starting","Skeleton","NothingOffered","NewDownloadForm","draftFromSetup","EMPTY_DRAFT","EmptyState","Archive","useSuggestedName","picked","chosen","whole","group","type","covered","loose","what","suggestedDownloadName","useStartDownload","useExport","useCreateExportJob","useCreateExportTemplate","useUpdateExportTemplate","problem","setProblem","savedSetup","setSavedSetup","onBusy","draft","input","setupInput","saved","updateTemplate","setup","createTemplate","createJob","jobInput","organizationId","error","isQuotaExhaustedError","access","useExportAccess","canOrganization","useOrganizationExportPermission","suggestName","tab","setTab","setDraft","initial","onStarted","name","effective","missing","draftProblem","change","current","patch","Fragment","setupMissing","StartProblemNotice","TabbedDialogTabs","ListChecks","FileText","CalendarClock","value","WhatPanel","FormatPanel","WhenPanel","TabbedDialogFooter","onClose","LockedButton","start","openBilling","navigate","workspaceLocked","scopes","kindRow","SettingRow","Checkbox","groupState","types","toggleKinds","ids","key","SettingsSection","UserRound","Segmented","LockNote","OptionalFields","formats","SummaryRow","periods","setupsLocked","Input","event","Lock","setupSaved","Switch"],"sources":["../../../src/export/workspace-v2/NewDownloadDialog.tsx"],"sourcesContent":["/**\n * New download (BOFF-15822): the primary button on \"Download your data\" opens\n * it, in place of the old page. Three tabs on the stable tabbed frame:\n *\n * - What: whose data (\"Just mine\", \"All of the workspace\" — locked for people\n * without `export:workspace_admin` — and, for organization admins, the whole\n * organization) and the kinds of data;\n * - Format: CSV or JSON, always packaged as one ZIP file;\n * - When: how far back the data goes, the download's name, and \"Save as a\n * setup\" (locked without `export:manage_templates`).\n *\n * It can start from a saved setup (`setupId`). \"Start download\" saves the\n * setup first when asked, then starts the download; a failure keeps the dialog\n * open with the reason, and a setup already saved is not saved twice.\n */\nimport { useState, type ReactNode } from \"react\";\nimport {\n Archive,\n CalendarClock,\n Download,\n FileText,\n ListChecks,\n Lock,\n UserRound,\n} from \"lucide-react\";\nimport { isQuotaExhaustedError } from \"@burdenoff/fe-libs/shared/utils\";\nimport {\n Button,\n Checkbox,\n EmptyState,\n Input,\n LockNote,\n LockedButton,\n Notice,\n OptionalFields,\n Segmented,\n SettingRow,\n SettingsSection,\n Skeleton,\n Switch,\n TabbedDialog,\n TabbedDialogContent,\n TabbedDialogFooter,\n TabbedDialogHeader,\n TabbedDialogTabs,\n} from \"@burdenoff/fe-libs/ui\";\nimport {\n useCreateExportJob,\n useCreateExportTemplate,\n useOrganizationExportPermission,\n useUpdateExportTemplate,\n} from \"../hooks/useExportQueries\";\nimport { useTr } from \"../hooks/useTr\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport type {\n ExportFormat,\n ExportJob,\n ExportScope,\n ExportTemplate,\n} from \"../types\";\nimport { openBilling } from \"../utils/billing\";\nimport { suggestedDownloadName } from \"../utils/newDownloadForm\";\nimport {\n EMPTY_DRAFT,\n draftFromSetup,\n draftProblem,\n groupState,\n jobInput,\n setupInput,\n toggleKinds,\n type NewDownloadDraft,\n type Period,\n} from \"./newDownloadModel\";\nimport { useSavedSetups, useSetupById } from \"./useDownloadsData\";\nimport { useExportAccess, type ExportAccess } from \"./useExportAccess\";\nimport { useOfferedKinds, type OfferedKinds } from \"./useOfferedKinds\";\n\ntype NewDownloadTab = \"what\" | \"format\" | \"when\";\n\nexport interface NewDownloadDialogProps {\n open: boolean;\n /** Start from this saved setup. */\n setupId?: string | null;\n onClose: () => void;\n /** The download started (after its setup, if any, was saved). */\n onStarted: (job: ExportJob) => void;\n}\n\nexport function NewDownloadDialog(props: NewDownloadDialogProps) {\n const tr = useTr();\n const [busy, setBusy] = useState(false);\n return (\n <TabbedDialog\n open={props.open}\n onOpenChange={(next) => {\n // While it starts, Escape, the backdrop and × wait for the answer.\n if (!next && !busy) props.onClose();\n }}\n >\n <TabbedDialogContent\n size=\"viewer\"\n width=\"medium\"\n presentation=\"sheet\"\n data-testid=\"new-download-dialog\"\n >\n <TabbedDialogHeader\n icon={\n <span\n aria-hidden=\"true\"\n className=\"grid size-9 shrink-0 place-items-center rounded-lg border border-border-subtle bg-accent-soft text-action-primary-bg\"\n >\n <Download className=\"size-4\" aria-hidden=\"true\" />\n </span>\n }\n title={tr(\"export.v2.new.title\", \"New download\")}\n description={tr(\n \"export.v2.new.description\",\n \"We package it as one ZIP file. It shows up in Downloads when it’s ready.\",\n )}\n closeLabel={tr(\"export.v2.common.close\", \"Close\")}\n />\n {/* Mounted while open: each opening starts from scratch (or its setup). */}\n {props.open ? <NewDownloadLoader {...props} onBusy={setBusy} /> : null}\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\ninterface LoaderProps extends NewDownloadDialogProps {\n onBusy: (busy: boolean) => void;\n}\n\n/** Where the setup to start from stands. */\ntype StartingSetup =\n | { kind: \"none\" }\n | { kind: \"waiting\" }\n | { kind: \"failed\"; retry: () => void }\n | { kind: \"found\"; setup: ExportTemplate }\n | { kind: \"missing\" };\n\n/**\n * The saved setup New download starts from, if any: from the list, or asked\n * for on its own when the list doesn't hold it (past its first 100: an old\n * link, or the setup's own page), once the list has answered.\n */\nfunction useStartingSetup(setupId: string | null | undefined): StartingSetup {\n const setups = useSavedSetups();\n const listed = setupId\n ? setups.setups.find((candidate) => candidate.id === setupId)\n : undefined;\n const single = useSetupById(\n setupId && !setups.loading && !listed ? setupId : undefined,\n );\n if (!setupId) return { kind: \"none\" };\n if (listed) return { kind: \"found\", setup: listed };\n if (setups.loading) return { kind: \"waiting\" };\n if (single.error) return { kind: \"failed\", retry: single.retry };\n if (!single.answered) return { kind: \"waiting\" };\n return single.setup\n ? { kind: \"found\", setup: single.setup }\n : { kind: \"missing\" };\n}\n\n/** A load that failed, with Try again. */\nfunction LoadFailed({\n message,\n onRetry,\n testId,\n}: {\n message: string;\n onRetry: () => void;\n testId?: string;\n}) {\n const tr = useTr();\n return (\n <div className=\"min-h-0 flex-1 p-5\">\n <Notice\n tone=\"bad\"\n data-testid={testId}\n action={\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onRetry}>\n {tr(\"export.v2.common.tryAgain\", \"Try again\")}\n </Button>\n }\n >\n {message}\n </Notice>\n </div>\n );\n}\n\n/** Waits for the kinds of data (and the setup to start from), then shows the form. */\nfunction NewDownloadLoader(props: LoaderProps) {\n const tr = useTr();\n const kinds = useOfferedKinds();\n const starting = useStartingSetup(props.setupId);\n if (kinds.error) {\n return (\n <LoadFailed\n message={tr(\n \"export.v2.new.kindsFailed\",\n \"Couldn’t load what you can download.\",\n )}\n onRetry={kinds.retry}\n />\n );\n }\n if (starting.kind === \"failed\") {\n return (\n <LoadFailed\n testId=\"new-download-setup-failed\"\n message={tr(\n \"export.v2.new.setupFailed\",\n \"Couldn’t load the saved setup to start from.\",\n )}\n onRetry={starting.retry}\n />\n );\n }\n if (kinds.loading || starting.kind === \"waiting\") {\n return (\n <div\n className=\"flex min-h-0 flex-1 flex-col gap-3 p-5\"\n data-testid=\"new-download-loading\"\n aria-busy=\"true\"\n >\n <Skeleton className=\"h-10 w-full rounded-card\" />\n <Skeleton className=\"h-40 w-full rounded-card\" />\n </div>\n );\n }\n if (kinds.groups.length === 0 && kinds.others.length === 0) {\n return <NothingOffered />;\n }\n return (\n <NewDownloadForm\n {...props}\n kinds={kinds}\n initial={\n starting.kind === \"found\"\n ? draftFromSetup(starting.setup, kinds.isOffered)\n : EMPTY_DRAFT\n }\n setupMissing={starting.kind === \"missing\"}\n />\n );\n}\n\n/** Nothing this product can download here yet: said, not a blank form. */\nfunction NothingOffered() {\n const tr = useTr();\n return (\n <div className=\"min-h-0 flex-1 p-5\" data-testid=\"new-download-nothing\">\n <EmptyState\n size=\"panel\"\n illustration=\"documents\"\n icon={<Archive aria-hidden=\"true\" />}\n title={tr(\"export.create.select.emptyTitle\", \"Nothing to export yet\")}\n description={tr(\n \"export.create.select.empty\",\n \"No exportable entity types are configured for this workspace yet. Once your workspace has data in supported modules, they'll show up here to select.\",\n )}\n />\n </div>\n );\n}\n\ninterface FormProps extends LoaderProps {\n kinds: OfferedKinds;\n initial: NewDownloadDraft;\n /** The setup to start from wasn't found (deleted, or not this workspace's). */\n setupMissing: boolean;\n}\n\n/** The name a download gets unless the person types one: what it covers, and today's date. */\nfunction useSuggestedName(kinds: OfferedKinds) {\n const tr = useTr();\n return (chosen: readonly string[]) => {\n const picked = new Set(chosen);\n const whole = kinds.groups.filter((group) =>\n group.entityTypes.every((type) => picked.has(type)),\n );\n const covered = new Set(whole.flatMap((group) => group.entityTypes));\n const loose = chosen.filter((type) => !covered.has(type));\n let what = tr(\"export.v2.new.nameMyData\", \"My data\");\n if (whole.length === 1 && loose.length === 0 && whole[0])\n what = whole[0].label;\n else if (whole.length === 0 && loose.length === 1 && loose[0])\n what = kinds.label(loose[0]);\n return suggestedDownloadName(what);\n };\n}\n\ntype StartProblem =\n { kind: \"quota\" } | { kind: \"failed\"; reason: string | null };\n\n/** \"Start download\": save the setup when asked (once), then start the download. */\nfunction useStartDownload(\n onStarted: (job: ExportJob) => void,\n onBusy: (busy: boolean) => void,\n) {\n const { organizationId } = useExport();\n const { createJob } = useCreateExportJob();\n const { createTemplate } = useCreateExportTemplate();\n const { updateTemplate } = useUpdateExportTemplate();\n const [busy, setBusy] = useState(false);\n const [problem, setProblem] = useState<StartProblem | null>(null);\n // A setup saved by an earlier try that then failed to start: not saved\n // again, but kept in step with the choices (`input`, what it was saved as).\n const [savedSetup, setSavedSetup] = useState<{\n id: string;\n input: string;\n } | null>(null);\n\n const start = async (draft: NewDownloadDraft) => {\n setBusy(true);\n onBusy(true);\n setProblem(null);\n try {\n let setupId = draft.setupId;\n if (draft.save) {\n const input = setupInput(draft);\n const saved = JSON.stringify(input);\n if (!savedSetup) {\n const setup = await createTemplate(input);\n setSavedSetup({ id: setup.id, input: saved });\n setupId = setup.id;\n } else {\n if (savedSetup.input !== saved) {\n await updateTemplate(savedSetup.id, input);\n setSavedSetup({ id: savedSetup.id, input: saved });\n }\n setupId = savedSetup.id;\n }\n }\n const job = await createJob(jobInput(draft, organizationId, setupId));\n onStarted(job);\n } catch (error) {\n setProblem(\n isQuotaExhaustedError(error)\n ? { kind: \"quota\" }\n : {\n kind: \"failed\",\n reason:\n error instanceof Error && error.message ? error.message : null,\n },\n );\n } finally {\n setBusy(false);\n onBusy(false);\n }\n };\n\n return { start, busy, problem, setupSaved: savedSetup !== null };\n}\n\nfunction NewDownloadForm({\n kinds,\n initial,\n setupMissing,\n onClose,\n onStarted,\n onBusy,\n}: FormProps) {\n const tr = useTr();\n const access = useExportAccess();\n const { organizationId } = useExport();\n // Asked here, where the choice is made, and of everyone: an organization\n // grant doesn't follow from the workspace's. The access service decides, and\n // refuses most people (it answers for their own workspace only), so the\n // question is quiet: a refusal is a \"no\", never an error toast.\n const canOrganization = useOrganizationExportPermission(organizationId, {\n quiet: true,\n });\n const suggestName = useSuggestedName(kinds);\n const [tab, setTab] = useState<NewDownloadTab>(\"what\");\n const [draft, setDraft] = useState<NewDownloadDraft>(initial);\n const { start, busy, problem, setupSaved } = useStartDownload(\n onStarted,\n onBusy,\n );\n\n const name = draft.nameEdited ? draft.name : suggestName(draft.entityTypes);\n const effective: NewDownloadDraft = { ...draft, name };\n const missing = draftProblem(effective);\n const change = (patch: Partial<NewDownloadDraft>) =>\n setDraft((current) => ({ ...current, ...patch }));\n\n const submit = () => {\n if (missing === \"noKinds\") {\n setTab(\"what\");\n return;\n }\n if (missing) {\n setTab(\"when\");\n return;\n }\n void start(effective);\n };\n\n return (\n <>\n {setupMissing || problem ? (\n <div className=\"flex shrink-0 flex-col gap-2 border-b border-border-subtle px-5 py-3\">\n {setupMissing ? (\n <Notice tone=\"warn\" data-testid=\"new-download-setup-missing\">\n {tr(\n \"export.v2.new.setupMissing\",\n \"That saved setup wasn’t found. It may have been deleted. You can still make a new download here.\",\n )}\n </Notice>\n ) : null}\n {problem ? <StartProblemNotice problem={problem} /> : null}\n </div>\n ) : null}\n <TabbedDialogTabs<NewDownloadTab>\n tabs={[\n {\n value: \"what\",\n label: tr(\"export.v2.new.tabWhat\", \"What\"),\n icon: ListChecks,\n },\n {\n value: \"format\",\n label: tr(\"export.v2.new.tabFormat\", \"Format\"),\n icon: FileText,\n },\n {\n value: \"when\",\n label: tr(\"export.v2.new.tabWhen\", \"When\"),\n icon: CalendarClock,\n },\n ]}\n value={tab}\n onValueChange={setTab}\n aria-label={tr(\"export.v2.new.title\", \"New download\")}\n renderPanel={(value) => {\n if (value === \"what\") {\n return (\n <WhatPanel\n draft={draft}\n access={access}\n canOrganization={canOrganization}\n kinds={kinds}\n change={change}\n />\n );\n }\n if (value === \"format\") {\n return (\n <FormatPanel draft={effective} kinds={kinds} change={change} />\n );\n }\n return (\n <WhenPanel\n draft={effective}\n access={access}\n setupSaved={setupSaved}\n change={change}\n />\n );\n }}\n />\n <TabbedDialogFooter>\n <span\n className=\"me-auto min-w-0 truncate text-sm text-text-secondary\"\n data-testid=\"new-download-summary\"\n >\n {draft.entityTypes.length > 0\n ? draft.entityTypes.map(kinds.label).join(\", \")\n : tr(\"export.v2.new.pickKinds\", \"Pick at least one kind of data\")}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onClose}\n disabled={busy}\n >\n {tr(\"export.v2.common.cancel\", \"Cancel\")}\n </Button>\n <LockedButton\n type=\"button\"\n locked={access.settled && !access.canCreate}\n reason={tr(\n \"export.v2.new.createLocked\",\n \"Starting a download needs permission to export in this workspace. Ask a workspace admin.\",\n )}\n icon={Download}\n disabled={busy || missing === \"noKinds\"}\n aria-busy={busy || undefined}\n onClick={submit}\n >\n {busy\n ? tr(\"export.v2.new.starting\", \"Starting…\")\n : tr(\"export.v2.new.start\", \"Start download\")}\n </LockedButton>\n </TabbedDialogFooter>\n </>\n );\n}\n\nfunction StartProblemNotice({ problem }: { problem: StartProblem }) {\n const tr = useTr();\n const { navigate } = useExport();\n if (problem.kind === \"quota\") {\n return (\n <Notice\n tone=\"warn\"\n action={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={() => openBilling(navigate)}\n >\n {tr(\"export.v2.new.seePlans\", \"See plans\")}\n </Button>\n }\n >\n {tr(\n \"export.v2.new.quota\",\n \"You’ve reached this month’s download limit. A bigger plan raises it.\",\n )}\n </Notice>\n );\n }\n return (\n <Notice tone=\"bad\">\n {problem.reason\n ? tr(\n \"export.v2.new.failedWithReason\",\n \"Couldn’t start the download: {{reason}}\",\n {\n reason: problem.reason,\n },\n )\n : tr(\"export.v2.new.failed\", \"Couldn’t start the download. Try again.\")}\n </Notice>\n );\n}\n\ninterface PanelProps {\n draft: NewDownloadDraft;\n change: (patch: Partial<NewDownloadDraft>) => void;\n}\n\nfunction WhatPanel({\n draft,\n access,\n canOrganization,\n kinds,\n change,\n}: PanelProps & {\n access: ExportAccess;\n canOrganization: boolean;\n kinds: OfferedKinds;\n}) {\n const tr = useTr();\n const workspaceLocked = access.settled && !access.canWorkspace;\n const scopes: { value: ExportScope; label: string; disabled?: boolean }[] = [\n { value: \"INDIVIDUAL\", label: tr(\"export.v2.new.scopeMine\", \"Just mine\") },\n {\n value: \"WORKSPACE_ADMIN\",\n label: tr(\"export.v2.new.scopeWorkspace\", \"All of the workspace\"),\n disabled: !access.canWorkspace,\n },\n ];\n if (canOrganization) {\n scopes.push({\n value: \"ORG_ADMIN\",\n label: tr(\"export.v2.new.scopeOrganization\", \"All of the organization\"),\n });\n }\n const kindRow = (\n key: string,\n label: string,\n description: string | undefined,\n types: string[],\n ) => (\n <SettingRow\n key={key}\n label={label}\n description={description}\n control={(ids) => (\n <Checkbox\n checked={groupState(draft.entityTypes, types)}\n onCheckedChange={() =>\n change({ entityTypes: toggleKinds(draft.entityTypes, types) })\n }\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n );\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.whose\", \"Whose data\")}\n icon={UserRound}\n >\n <SettingRow\n label={tr(\"export.v2.new.whoseLabel\", \"Download\")}\n description={\n draft.scope === \"INDIVIDUAL\"\n ? tr(\"export.v2.new.scopeMineHelp\", \"What you made or can see.\")\n : draft.scope === \"WORKSPACE_ADMIN\"\n ? tr(\n \"export.v2.new.scopeWorkspaceHelp\",\n \"Every person’s data in this workspace.\",\n )\n : tr(\n \"export.v2.new.scopeOrganizationHelp\",\n \"The data of every workspace in your organization.\",\n )\n }\n control={(ids) => (\n <Segmented<ExportScope>\n options={scopes}\n value={draft.scope}\n onValueChange={(scope) => change({ scope })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n </SettingsSection>\n {/* Someone who can't export at all (a link can still open this) is told\n that, not offered their own data. */}\n {access.settled && !access.canCreate ? (\n <LockNote>\n {tr(\n \"export.v2.new.createLocked\",\n \"Starting a download needs permission to export in this workspace. Ask a workspace admin.\",\n )}\n </LockNote>\n ) : workspaceLocked ? (\n <LockNote>\n {tr(\n \"export.v2.new.workspaceLocked\",\n \"Downloading the whole workspace is for workspace admins. You can download your own data.\",\n )}\n </LockNote>\n ) : null}\n <SettingsSection\n title={tr(\"export.v2.new.kinds\", \"What to include\")}\n icon={ListChecks}\n >\n {kinds.groups.map((group) =>\n kindRow(group.id, group.label, group.description, group.entityTypes),\n )}\n </SettingsSection>\n {kinds.others.length > 0 ? (\n <OptionalFields\n storageKey=\"export.newDownload.moreKinds\"\n label={tr(\"export.v2.new.moreKinds\", \"More kinds of data\")}\n >\n <SettingsSection>\n {kinds.others.map((type) =>\n kindRow(type, kinds.label(type), undefined, [type]),\n )}\n </SettingsSection>\n </OptionalFields>\n ) : null}\n </div>\n );\n}\n\nfunction FormatPanel({\n draft,\n kinds,\n change,\n}: PanelProps & { kinds: OfferedKinds }) {\n const tr = useTr();\n const formats: { value: ExportFormat; label: string }[] = [\n { value: \"CSV\", label: tr(\"export.v2.new.formatCsv\", \"CSV\") },\n { value: \"JSON\", label: tr(\"export.v2.new.formatJson\", \"JSON\") },\n ];\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.fileType\", \"File type\")}\n icon={FileText}\n >\n <SettingRow\n label={tr(\"export.v2.new.formatLabel\", \"Files inside the ZIP\")}\n description={\n draft.format === \"CSV\"\n ? tr(\n \"export.v2.new.formatCsvHelp\",\n \"Spreadsheets, one per kind of data.\",\n )\n : tr(\n \"export.v2.new.formatJsonHelp\",\n \"One file per kind of data, for other tools and backups.\",\n )\n }\n control={(ids) => (\n <Segmented<ExportFormat>\n options={formats}\n value={draft.format}\n onValueChange={(format) => change({ format })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n </SettingsSection>\n <SettingsSection title={tr(\"export.v2.new.summary\", \"This download\")}>\n <SummaryRow label={tr(\"export.v2.new.summaryContains\", \"Contains\")}>\n {draft.entityTypes.length > 0\n ? draft.entityTypes.map(kinds.label).join(\", \")\n : tr(\"export.v2.new.summaryNothing\", \"Nothing yet\")}\n </SummaryRow>\n <SummaryRow label={tr(\"export.v2.new.summaryName\", \"Name\")}>\n {draft.name || \"—\"}\n </SummaryRow>\n </SettingsSection>\n </div>\n );\n}\n\nfunction SummaryRow({\n label,\n children,\n}: {\n label: string;\n children: ReactNode;\n}) {\n return (\n <SettingRow\n label={label}\n control={\n <span className=\"text-end text-sm text-text-primary\">{children}</span>\n }\n />\n );\n}\n\nfunction WhenPanel({\n draft,\n access,\n setupSaved,\n change,\n}: PanelProps & { access: ExportAccess; setupSaved: boolean }) {\n const tr = useTr();\n const periods: { value: Period; label: string }[] = [\n { value: \"all\", label: tr(\"export.v2.new.periodAll\", \"All time\") },\n { value: \"30\", label: tr(\"export.v2.new.period30\", \"Last 30 days\") },\n { value: \"90\", label: tr(\"export.v2.new.period90\", \"Last 90 days\") },\n ];\n const setupsLocked = access.settled && !access.canSetups;\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.when\", \"When\")}\n icon={CalendarClock}\n >\n <SettingRow\n label={tr(\"export.v2.new.period\", \"Data from\")}\n description={tr(\n \"export.v2.new.periodHelp\",\n \"All time includes everything. A shorter period makes a smaller download.\",\n )}\n control={(ids) => (\n <Segmented<Period>\n options={periods}\n value={draft.period}\n onValueChange={(period) => change({ period })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n <SettingRow\n label={tr(\"export.v2.new.name\", \"Name\")}\n description={tr(\n \"export.v2.new.nameHelp\",\n \"How it shows in Downloads.\",\n )}\n control={(ids) => (\n <Input\n className=\"w-72 max-md:w-full\"\n value={draft.name}\n maxLength={200}\n onChange={(event) =>\n change({ name: event.target.value, nameEdited: true })\n }\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n aria-invalid={!draft.name.trim() || undefined}\n />\n )}\n />\n </SettingsSection>\n <SettingsSection\n title={tr(\"export.v2.new.setupTitle\", \"Saved setup\")}\n icon={setupsLocked ? Lock : Archive}\n readOnly={!access.canSetups}\n lockNote={\n setupsLocked\n ? tr(\n \"export.v2.new.setupLocked\",\n \"Saving setups needs permission to manage them in this workspace. Ask a workspace admin.\",\n )\n : undefined\n }\n >\n <SettingRow\n label={tr(\"export.v2.new.save\", \"Save as a setup\")}\n description={\n setupSaved\n ? tr(\n \"export.v2.new.saveDone\",\n \"Saved. Starting the download uses it.\",\n )\n : tr(\n \"export.v2.new.saveHelp\",\n \"Shows up in Saved setups, to run again in one click.\",\n )\n }\n control={(ids) => (\n <Switch\n checked={draft.save}\n onCheckedChange={(save) => change({ save })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n {draft.save ? (\n <SettingRow\n label={tr(\"export.v2.new.setupName\", \"Setup name\")}\n control={(ids) => (\n <Input\n className=\"w-72 max-md:w-full\"\n value={draft.setupName}\n placeholder={draft.name}\n maxLength={200}\n onChange={(event) => change({ setupName: event.target.value })}\n aria-labelledby={ids.labelId}\n />\n )}\n />\n ) : null}\n </SettingsSection>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwFA,SAAgBC,EAAkB,GAA+B;CAC/D,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAMC,KAAWC,EAAS,EAAK;CACtC,OACE,kBAACC,GAAD;EACE,MAAMC,EAAM;EACZ,eAAe,MAAS;GAEtB,AAAI,CAACC,KAAQ,CAACL,KAAMI,EAAM,QAAQ;EACpC;EAEA,UAAA,kBAACE,GAAD;GACE,MAAK;GACL,OAAM;GACN,cAAa;GACb,eAAY;GAJd,UAAA,CAME,kBAACC,GAAD;IACE,MACE,kBAAC,QAAD;KACE,eAAY;KACZ,WAAU;KAEV,UAAA,kBAACC,GAAD;MAAU,WAAU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AAM,OAAO,MAAM,CAAC;KAC7D,mBAAiBZ,EAAI;IACtB,CAAA;GAEJ,CAAA,IACC,IACW;EACd,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"NewDownloadDialog.js","names":["_Fragment","NewDownloadDialog","tr","useTr","busy","setBusy","useState","TabbedDialog","props","next","TabbedDialogContent","TabbedDialogHeader","Download","NewDownloadLoader","useStartingSetup","setups","useSavedSetups","listed","setupId","candidate","single","useSetupById","LoadFailed","Notice","testId","Button","onRetry","message","kinds","useOfferedKinds","starting","Skeleton","NothingOffered","NewDownloadForm","draftFromSetup","EMPTY_DRAFT","EmptyState","Archive","useSuggestedName","picked","chosen","whole","group","type","covered","loose","what","suggestedDownloadName","useStartDownload","useExport","useCreateExportJob","useCreateExportTemplate","useUpdateExportTemplate","problem","setProblem","savedSetup","setSavedSetup","onBusy","draft","input","setupInput","saved","updateTemplate","setup","createTemplate","createJob","jobInput","organizationId","error","isQuotaExhaustedError","access","useExportAccess","canOrganization","useOrganizationExportPermission","suggestName","tab","setTab","setDraft","initial","onStarted","name","effective","missing","draftProblem","change","current","patch","Fragment","setupMissing","StartProblemNotice","TabbedDialogTabs","ListChecks","FileText","CalendarClock","value","WhatPanel","FormatPanel","WhenPanel","TabbedDialogFooter","onClose","LockedButton","start","openBilling","navigate","workspaceLocked","scopes","kindRow","SettingRow","Checkbox","groupState","types","toggleKinds","ids","key","SettingsSection","UserRound","Segmented","LockNote","OptionalFields","formats","SummaryRow","periods","setupsLocked","Input","event","Lock","setupSaved","Switch"],"sources":["../../../src/export/workspace-v2/NewDownloadDialog.tsx"],"sourcesContent":["/**\n * New download (BOFF-15822): the primary button on \"Download your data\" opens\n * it, in place of the old page. Three tabs on the stable tabbed frame:\n *\n * - What: whose data (\"Just mine\", \"All of the workspace\" — locked for people\n * without `export:workspace_admin` — and, for organization admins, the whole\n * organization) and the kinds of data;\n * - Format: CSV or JSON, always packaged as one ZIP file;\n * - When: how far back the data goes, the download's name, and \"Save as a\n * setup\" (locked without `export:manage_templates`).\n *\n * It can start from a saved setup (`setupId`). \"Start download\" saves the\n * setup first when asked, then starts the download; a failure keeps the dialog\n * open with the reason, and a setup already saved is not saved twice.\n */\nimport { useState, type ReactNode } from \"react\";\nimport {\n Archive,\n CalendarClock,\n Download,\n FileText,\n ListChecks,\n Lock,\n UserRound,\n} from \"lucide-react\";\nimport { isQuotaExhaustedError } from \"@burdenoff/fe-libs/shared/utils\";\nimport {\n Button,\n Checkbox,\n EmptyState,\n Input,\n LockNote,\n LockedButton,\n Notice,\n OptionalFields,\n Segmented,\n SettingRow,\n SettingsSection,\n Skeleton,\n Switch,\n TabbedDialog,\n TabbedDialogContent,\n TabbedDialogFooter,\n TabbedDialogHeader,\n TabbedDialogTabs,\n} from \"@burdenoff/fe-libs/ui\";\nimport {\n useCreateExportJob,\n useCreateExportTemplate,\n useOrganizationExportPermission,\n useUpdateExportTemplate,\n} from \"../hooks/useExportQueries\";\nimport { useTr } from \"../hooks/useTr\";\nimport { useExport } from \"../providers/ExportProvider\";\nimport type {\n ExportFormat,\n ExportJob,\n ExportScope,\n ExportTemplate,\n} from \"../types\";\nimport { openBilling } from \"../utils/billing\";\nimport { suggestedDownloadName } from \"../utils/newDownloadForm\";\nimport {\n EMPTY_DRAFT,\n draftFromSetup,\n draftProblem,\n groupState,\n jobInput,\n setupInput,\n toggleKinds,\n type NewDownloadDraft,\n type Period,\n} from \"./newDownloadModel\";\nimport { useSavedSetups, useSetupById } from \"./useDownloadsData\";\nimport { useExportAccess, type ExportAccess } from \"./useExportAccess\";\nimport { useOfferedKinds, type OfferedKinds } from \"./useOfferedKinds\";\n\ntype NewDownloadTab = \"what\" | \"format\" | \"when\";\n\nexport interface NewDownloadDialogProps {\n open: boolean;\n /** Start from this saved setup. */\n setupId?: string | null;\n onClose: () => void;\n /** The download started (after its setup, if any, was saved). */\n onStarted: (job: ExportJob) => void;\n}\n\nexport function NewDownloadDialog(props: NewDownloadDialogProps) {\n const tr = useTr();\n const [busy, setBusy] = useState(false);\n return (\n <TabbedDialog\n open={props.open}\n onOpenChange={(next) => {\n // While it starts, Escape, the backdrop and × wait for the answer.\n if (!next && !busy) props.onClose();\n }}\n >\n <TabbedDialogContent\n size=\"viewer\"\n width=\"medium\"\n presentation=\"sheet\"\n data-testid=\"new-download-dialog\"\n >\n <TabbedDialogHeader\n icon={\n <span\n aria-hidden=\"true\"\n className=\"grid size-9 shrink-0 place-items-center rounded-lg border border-border-subtle bg-accent-soft text-action-primary-bg\"\n >\n <Download className=\"size-4\" aria-hidden=\"true\" />\n </span>\n }\n title={tr(\"export.v2.new.title\", \"New download\")}\n description={tr(\n \"export.v2.new.description\",\n \"We package it as one ZIP file. It shows up in Downloads when it’s ready.\",\n )}\n closeLabel={tr(\"export.v2.common.close\", \"Close\")}\n />\n {/* Mounted while open: each opening starts from scratch (or its setup). */}\n {props.open ? <NewDownloadLoader {...props} onBusy={setBusy} /> : null}\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\ninterface LoaderProps extends NewDownloadDialogProps {\n onBusy: (busy: boolean) => void;\n}\n\n/** Where the setup to start from stands. */\ntype StartingSetup =\n | { kind: \"none\" }\n | { kind: \"waiting\" }\n | { kind: \"failed\"; retry: () => void }\n | { kind: \"found\"; setup: ExportTemplate }\n | { kind: \"missing\" };\n\n/**\n * The saved setup New download starts from, if any: from the list, or asked\n * for on its own when the list doesn't hold it (past its first 100: an old\n * link, or the setup's own page), once the list has answered.\n */\nfunction useStartingSetup(setupId: string | null | undefined): StartingSetup {\n const setups = useSavedSetups();\n const listed = setupId\n ? setups.setups.find((candidate) => candidate.id === setupId)\n : undefined;\n const single = useSetupById(\n setupId && !setups.loading && !listed ? setupId : undefined,\n );\n if (!setupId) return { kind: \"none\" };\n if (listed) return { kind: \"found\", setup: listed };\n if (setups.loading) return { kind: \"waiting\" };\n if (single.error) return { kind: \"failed\", retry: single.retry };\n if (!single.answered) return { kind: \"waiting\" };\n return single.setup\n ? { kind: \"found\", setup: single.setup }\n : { kind: \"missing\" };\n}\n\n/** A load that failed, with Try again. */\nfunction LoadFailed({\n message,\n onRetry,\n testId,\n}: {\n message: string;\n onRetry: () => void;\n testId?: string;\n}) {\n const tr = useTr();\n return (\n <div className=\"min-h-0 flex-1 p-5\">\n <Notice\n tone=\"bad\"\n data-testid={testId}\n action={\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onRetry}>\n {tr(\"export.v2.common.tryAgain\", \"Try again\")}\n </Button>\n }\n >\n {message}\n </Notice>\n </div>\n );\n}\n\n/** Waits for the kinds of data (and the setup to start from), then shows the form. */\nfunction NewDownloadLoader(props: LoaderProps) {\n const tr = useTr();\n const kinds = useOfferedKinds();\n const starting = useStartingSetup(props.setupId);\n if (kinds.error) {\n return (\n <LoadFailed\n message={tr(\n \"export.v2.new.kindsFailed\",\n \"Couldn’t load what you can download.\",\n )}\n onRetry={kinds.retry}\n />\n );\n }\n if (starting.kind === \"failed\") {\n return (\n <LoadFailed\n testId=\"new-download-setup-failed\"\n message={tr(\n \"export.v2.new.setupFailed\",\n \"Couldn’t load the saved setup to start from.\",\n )}\n onRetry={starting.retry}\n />\n );\n }\n if (kinds.loading || starting.kind === \"waiting\") {\n return (\n <div\n className=\"flex min-h-0 flex-1 flex-col gap-3 p-5\"\n data-testid=\"new-download-loading\"\n aria-busy=\"true\"\n >\n <Skeleton className=\"h-10 w-full rounded-card\" />\n <Skeleton className=\"h-40 w-full rounded-card\" />\n </div>\n );\n }\n if (kinds.groups.length === 0 && kinds.others.length === 0) {\n return <NothingOffered />;\n }\n return (\n <NewDownloadForm\n {...props}\n kinds={kinds}\n initial={\n starting.kind === \"found\"\n ? draftFromSetup(starting.setup, kinds.isOffered)\n : EMPTY_DRAFT\n }\n setupMissing={starting.kind === \"missing\"}\n />\n );\n}\n\n/** Nothing this product can download here yet: said, not a blank form. */\nfunction NothingOffered() {\n const tr = useTr();\n return (\n <div className=\"min-h-0 flex-1 p-5\" data-testid=\"new-download-nothing\">\n <EmptyState\n size=\"panel\"\n illustration=\"documents\"\n icon={<Archive aria-hidden=\"true\" />}\n title={tr(\"export.create.select.emptyTitle\", \"Nothing to export yet\")}\n description={tr(\n \"export.create.select.empty\",\n \"No exportable entity types are configured for this workspace yet. Once your workspace has data in supported modules, they'll show up here to select.\",\n )}\n />\n </div>\n );\n}\n\ninterface FormProps extends LoaderProps {\n kinds: OfferedKinds;\n initial: NewDownloadDraft;\n /** The setup to start from wasn't found (deleted, or not this workspace's). */\n setupMissing: boolean;\n}\n\n/** The name a download gets unless the person types one: what it covers, and today's date. */\nfunction useSuggestedName(kinds: OfferedKinds) {\n const tr = useTr();\n return (chosen: readonly string[]) => {\n const picked = new Set(chosen);\n const whole = kinds.groups.filter((group) =>\n group.entityTypes.every((type) => picked.has(type)),\n );\n const covered = new Set(whole.flatMap((group) => group.entityTypes));\n const loose = chosen.filter((type) => !covered.has(type));\n let what = tr(\"export.v2.new.nameMyData\", \"My data\");\n if (whole.length === 1 && loose.length === 0 && whole[0])\n what = whole[0].label;\n else if (whole.length === 0 && loose.length === 1 && loose[0])\n what = kinds.label(loose[0]);\n return suggestedDownloadName(what);\n };\n}\n\ntype StartProblem =\n { kind: \"quota\" } | { kind: \"failed\"; reason: string | null };\n\n/** \"Start download\": save the setup when asked (once), then start the download. */\nfunction useStartDownload(\n onStarted: (job: ExportJob) => void,\n onBusy: (busy: boolean) => void,\n) {\n const { organizationId } = useExport();\n const { createJob } = useCreateExportJob();\n const { createTemplate } = useCreateExportTemplate();\n const { updateTemplate } = useUpdateExportTemplate();\n const [busy, setBusy] = useState(false);\n const [problem, setProblem] = useState<StartProblem | null>(null);\n // A setup saved by an earlier try that then failed to start: not saved\n // again, but kept in step with the choices (`input`, what it was saved as).\n const [savedSetup, setSavedSetup] = useState<{\n id: string;\n input: string;\n } | null>(null);\n\n const start = async (draft: NewDownloadDraft) => {\n setBusy(true);\n onBusy(true);\n setProblem(null);\n try {\n let setupId = draft.setupId;\n if (draft.save) {\n const input = setupInput(draft);\n const saved = JSON.stringify(input);\n if (!savedSetup) {\n const setup = await createTemplate(input);\n setSavedSetup({ id: setup.id, input: saved });\n setupId = setup.id;\n } else {\n if (savedSetup.input !== saved) {\n await updateTemplate(savedSetup.id, input);\n setSavedSetup({ id: savedSetup.id, input: saved });\n }\n setupId = savedSetup.id;\n }\n }\n const job = await createJob(jobInput(draft, organizationId, setupId));\n onStarted(job);\n } catch (error) {\n setProblem(\n isQuotaExhaustedError(error)\n ? { kind: \"quota\" }\n : {\n kind: \"failed\",\n reason:\n error instanceof Error && error.message ? error.message : null,\n },\n );\n } finally {\n setBusy(false);\n onBusy(false);\n }\n };\n\n return { start, busy, problem, setupSaved: savedSetup !== null };\n}\n\nfunction NewDownloadForm({\n kinds,\n initial,\n setupMissing,\n onClose,\n onStarted,\n onBusy,\n}: FormProps) {\n const tr = useTr();\n const access = useExportAccess();\n const { organizationId } = useExport();\n // The whole organization stays locked for everyone until organization\n // downloads are checked by Global RBAC (useOrganizationExportPermission).\n const canOrganization = useOrganizationExportPermission(organizationId);\n const suggestName = useSuggestedName(kinds);\n const [tab, setTab] = useState<NewDownloadTab>(\"what\");\n const [draft, setDraft] = useState<NewDownloadDraft>(initial);\n const { start, busy, problem, setupSaved } = useStartDownload(\n onStarted,\n onBusy,\n );\n\n const name = draft.nameEdited ? draft.name : suggestName(draft.entityTypes);\n const effective: NewDownloadDraft = { ...draft, name };\n const missing = draftProblem(effective);\n const change = (patch: Partial<NewDownloadDraft>) =>\n setDraft((current) => ({ ...current, ...patch }));\n\n const submit = () => {\n if (missing === \"noKinds\") {\n setTab(\"what\");\n return;\n }\n if (missing) {\n setTab(\"when\");\n return;\n }\n void start(effective);\n };\n\n return (\n <>\n {setupMissing || problem ? (\n <div className=\"flex shrink-0 flex-col gap-2 border-b border-border-subtle px-5 py-3\">\n {setupMissing ? (\n <Notice tone=\"warn\" data-testid=\"new-download-setup-missing\">\n {tr(\n \"export.v2.new.setupMissing\",\n \"That saved setup wasn’t found. It may have been deleted. You can still make a new download here.\",\n )}\n </Notice>\n ) : null}\n {problem ? <StartProblemNotice problem={problem} /> : null}\n </div>\n ) : null}\n <TabbedDialogTabs<NewDownloadTab>\n tabs={[\n {\n value: \"what\",\n label: tr(\"export.v2.new.tabWhat\", \"What\"),\n icon: ListChecks,\n },\n {\n value: \"format\",\n label: tr(\"export.v2.new.tabFormat\", \"Format\"),\n icon: FileText,\n },\n {\n value: \"when\",\n label: tr(\"export.v2.new.tabWhen\", \"When\"),\n icon: CalendarClock,\n },\n ]}\n value={tab}\n onValueChange={setTab}\n aria-label={tr(\"export.v2.new.title\", \"New download\")}\n renderPanel={(value) => {\n if (value === \"what\") {\n return (\n <WhatPanel\n draft={draft}\n access={access}\n canOrganization={canOrganization}\n kinds={kinds}\n change={change}\n />\n );\n }\n if (value === \"format\") {\n return (\n <FormatPanel draft={effective} kinds={kinds} change={change} />\n );\n }\n return (\n <WhenPanel\n draft={effective}\n access={access}\n setupSaved={setupSaved}\n change={change}\n />\n );\n }}\n />\n <TabbedDialogFooter>\n <span\n className=\"me-auto min-w-0 truncate text-sm text-text-secondary\"\n data-testid=\"new-download-summary\"\n >\n {draft.entityTypes.length > 0\n ? draft.entityTypes.map(kinds.label).join(\", \")\n : tr(\"export.v2.new.pickKinds\", \"Pick at least one kind of data\")}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={onClose}\n disabled={busy}\n >\n {tr(\"export.v2.common.cancel\", \"Cancel\")}\n </Button>\n <LockedButton\n type=\"button\"\n locked={access.settled && !access.canCreate}\n reason={tr(\n \"export.v2.new.createLocked\",\n \"Starting a download needs permission to export in this workspace. Ask a workspace admin.\",\n )}\n icon={Download}\n disabled={busy || missing === \"noKinds\"}\n aria-busy={busy || undefined}\n onClick={submit}\n >\n {busy\n ? tr(\"export.v2.new.starting\", \"Starting…\")\n : tr(\"export.v2.new.start\", \"Start download\")}\n </LockedButton>\n </TabbedDialogFooter>\n </>\n );\n}\n\nfunction StartProblemNotice({ problem }: { problem: StartProblem }) {\n const tr = useTr();\n const { navigate } = useExport();\n if (problem.kind === \"quota\") {\n return (\n <Notice\n tone=\"warn\"\n action={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={() => openBilling(navigate)}\n >\n {tr(\"export.v2.new.seePlans\", \"See plans\")}\n </Button>\n }\n >\n {tr(\n \"export.v2.new.quota\",\n \"You’ve reached this month’s download limit. A bigger plan raises it.\",\n )}\n </Notice>\n );\n }\n return (\n <Notice tone=\"bad\">\n {problem.reason\n ? tr(\n \"export.v2.new.failedWithReason\",\n \"Couldn’t start the download: {{reason}}\",\n {\n reason: problem.reason,\n },\n )\n : tr(\"export.v2.new.failed\", \"Couldn’t start the download. Try again.\")}\n </Notice>\n );\n}\n\ninterface PanelProps {\n draft: NewDownloadDraft;\n change: (patch: Partial<NewDownloadDraft>) => void;\n}\n\nfunction WhatPanel({\n draft,\n access,\n canOrganization,\n kinds,\n change,\n}: PanelProps & {\n access: ExportAccess;\n canOrganization: boolean;\n kinds: OfferedKinds;\n}) {\n const tr = useTr();\n const workspaceLocked = access.settled && !access.canWorkspace;\n const scopes: { value: ExportScope; label: string; disabled?: boolean }[] = [\n { value: \"INDIVIDUAL\", label: tr(\"export.v2.new.scopeMine\", \"Just mine\") },\n {\n value: \"WORKSPACE_ADMIN\",\n label: tr(\"export.v2.new.scopeWorkspace\", \"All of the workspace\"),\n disabled: !access.canWorkspace,\n },\n ];\n if (canOrganization) {\n scopes.push({\n value: \"ORG_ADMIN\",\n label: tr(\"export.v2.new.scopeOrganization\", \"All of the organization\"),\n });\n }\n const kindRow = (\n key: string,\n label: string,\n description: string | undefined,\n types: string[],\n ) => (\n <SettingRow\n key={key}\n label={label}\n description={description}\n control={(ids) => (\n <Checkbox\n checked={groupState(draft.entityTypes, types)}\n onCheckedChange={() =>\n change({ entityTypes: toggleKinds(draft.entityTypes, types) })\n }\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n );\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.whose\", \"Whose data\")}\n icon={UserRound}\n >\n <SettingRow\n label={tr(\"export.v2.new.whoseLabel\", \"Download\")}\n description={\n draft.scope === \"INDIVIDUAL\"\n ? tr(\"export.v2.new.scopeMineHelp\", \"What you made or can see.\")\n : draft.scope === \"WORKSPACE_ADMIN\"\n ? tr(\n \"export.v2.new.scopeWorkspaceHelp\",\n \"Every person’s data in this workspace.\",\n )\n : tr(\n \"export.v2.new.scopeOrganizationHelp\",\n \"The data of every workspace in your organization.\",\n )\n }\n control={(ids) => (\n <Segmented<ExportScope>\n options={scopes}\n value={draft.scope}\n onValueChange={(scope) => change({ scope })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n </SettingsSection>\n {/* Someone who can't export at all (a link can still open this) is told\n that, not offered their own data. */}\n {access.settled && !access.canCreate ? (\n <LockNote>\n {tr(\n \"export.v2.new.createLocked\",\n \"Starting a download needs permission to export in this workspace. Ask a workspace admin.\",\n )}\n </LockNote>\n ) : workspaceLocked ? (\n <LockNote>\n {tr(\n \"export.v2.new.workspaceLocked\",\n \"Downloading the whole workspace is for workspace admins. You can download your own data.\",\n )}\n </LockNote>\n ) : null}\n <SettingsSection\n title={tr(\"export.v2.new.kinds\", \"What to include\")}\n icon={ListChecks}\n >\n {kinds.groups.map((group) =>\n kindRow(group.id, group.label, group.description, group.entityTypes),\n )}\n </SettingsSection>\n {kinds.others.length > 0 ? (\n <OptionalFields\n storageKey=\"export.newDownload.moreKinds\"\n label={tr(\"export.v2.new.moreKinds\", \"More kinds of data\")}\n >\n <SettingsSection>\n {kinds.others.map((type) =>\n kindRow(type, kinds.label(type), undefined, [type]),\n )}\n </SettingsSection>\n </OptionalFields>\n ) : null}\n </div>\n );\n}\n\nfunction FormatPanel({\n draft,\n kinds,\n change,\n}: PanelProps & { kinds: OfferedKinds }) {\n const tr = useTr();\n const formats: { value: ExportFormat; label: string }[] = [\n { value: \"CSV\", label: tr(\"export.v2.new.formatCsv\", \"CSV\") },\n { value: \"JSON\", label: tr(\"export.v2.new.formatJson\", \"JSON\") },\n ];\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.fileType\", \"File type\")}\n icon={FileText}\n >\n <SettingRow\n label={tr(\"export.v2.new.formatLabel\", \"Files inside the ZIP\")}\n description={\n draft.format === \"CSV\"\n ? tr(\n \"export.v2.new.formatCsvHelp\",\n \"Spreadsheets, one per kind of data.\",\n )\n : tr(\n \"export.v2.new.formatJsonHelp\",\n \"One file per kind of data, for other tools and backups.\",\n )\n }\n control={(ids) => (\n <Segmented<ExportFormat>\n options={formats}\n value={draft.format}\n onValueChange={(format) => change({ format })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n </SettingsSection>\n <SettingsSection title={tr(\"export.v2.new.summary\", \"This download\")}>\n <SummaryRow label={tr(\"export.v2.new.summaryContains\", \"Contains\")}>\n {draft.entityTypes.length > 0\n ? draft.entityTypes.map(kinds.label).join(\", \")\n : tr(\"export.v2.new.summaryNothing\", \"Nothing yet\")}\n </SummaryRow>\n <SummaryRow label={tr(\"export.v2.new.summaryName\", \"Name\")}>\n {draft.name || \"—\"}\n </SummaryRow>\n </SettingsSection>\n </div>\n );\n}\n\nfunction SummaryRow({\n label,\n children,\n}: {\n label: string;\n children: ReactNode;\n}) {\n return (\n <SettingRow\n label={label}\n control={\n <span className=\"text-end text-sm text-text-primary\">{children}</span>\n }\n />\n );\n}\n\nfunction WhenPanel({\n draft,\n access,\n setupSaved,\n change,\n}: PanelProps & { access: ExportAccess; setupSaved: boolean }) {\n const tr = useTr();\n const periods: { value: Period; label: string }[] = [\n { value: \"all\", label: tr(\"export.v2.new.periodAll\", \"All time\") },\n { value: \"30\", label: tr(\"export.v2.new.period30\", \"Last 30 days\") },\n { value: \"90\", label: tr(\"export.v2.new.period90\", \"Last 90 days\") },\n ];\n const setupsLocked = access.settled && !access.canSetups;\n return (\n <div className=\"flex flex-col gap-4\">\n <SettingsSection\n title={tr(\"export.v2.new.when\", \"When\")}\n icon={CalendarClock}\n >\n <SettingRow\n label={tr(\"export.v2.new.period\", \"Data from\")}\n description={tr(\n \"export.v2.new.periodHelp\",\n \"All time includes everything. A shorter period makes a smaller download.\",\n )}\n control={(ids) => (\n <Segmented<Period>\n options={periods}\n value={draft.period}\n onValueChange={(period) => change({ period })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n <SettingRow\n label={tr(\"export.v2.new.name\", \"Name\")}\n description={tr(\n \"export.v2.new.nameHelp\",\n \"How it shows in Downloads.\",\n )}\n control={(ids) => (\n <Input\n className=\"w-72 max-md:w-full\"\n value={draft.name}\n maxLength={200}\n onChange={(event) =>\n change({ name: event.target.value, nameEdited: true })\n }\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n aria-invalid={!draft.name.trim() || undefined}\n />\n )}\n />\n </SettingsSection>\n <SettingsSection\n title={tr(\"export.v2.new.setupTitle\", \"Saved setup\")}\n icon={setupsLocked ? Lock : Archive}\n readOnly={!access.canSetups}\n lockNote={\n setupsLocked\n ? tr(\n \"export.v2.new.setupLocked\",\n \"Saving setups needs permission to manage them in this workspace. Ask a workspace admin.\",\n )\n : undefined\n }\n >\n <SettingRow\n label={tr(\"export.v2.new.save\", \"Save as a setup\")}\n description={\n setupSaved\n ? tr(\n \"export.v2.new.saveDone\",\n \"Saved. Starting the download uses it.\",\n )\n : tr(\n \"export.v2.new.saveHelp\",\n \"Shows up in Saved setups, to run again in one click.\",\n )\n }\n control={(ids) => (\n <Switch\n checked={draft.save}\n onCheckedChange={(save) => change({ save })}\n aria-labelledby={ids.labelId}\n aria-describedby={ids.descriptionId}\n />\n )}\n />\n {draft.save ? (\n <SettingRow\n label={tr(\"export.v2.new.setupName\", \"Setup name\")}\n control={(ids) => (\n <Input\n className=\"w-72 max-md:w-full\"\n value={draft.setupName}\n placeholder={draft.name}\n maxLength={200}\n onChange={(event) => change({ setupName: event.target.value })}\n aria-labelledby={ids.labelId}\n />\n )}\n />\n ) : null}\n </SettingsSection>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwFA,SAAgBC,EAAkB,GAA+B;CAC/D,IAAMC,IAAKC,EAAM,GACX,CAACC,GAAMC,KAAWC,EAAS,EAAK;CACtC,OACE,kBAACC,GAAD;EACE,MAAMC,EAAM;EACZ,eAAe,MAAS;GAEtB,AAAI,CAACC,KAAQ,CAACL,KAAMI,EAAM,QAAQ;EACpC;EAEA,UAAA,kBAACE,GAAD;GACE,MAAK;GACL,OAAM;GACN,cAAa;GACb,eAAY;GAJd,UAAA,CAME,kBAACC,GAAD;IACE,MACE,kBAAC,QAAD;KACE,eAAY;KACZ,WAAU;KAEV,UAAA,kBAACC,GAAD;MAAU,WAAU;MAAS,eAAY;KAAQ,CAAA;IAC7C,CAAA;IAER,OAAOV,EAAG,uBAAuB,cAAc;IAC/C,aAAaA,EACX,6BACA,0EACF;IACA,YAAYA,EAAG,0BAA0B,OAAO;GACjD,CAAA,GAEAM,EAAM,OAAO,kBAACK,GAAD;IAAmB,GAAIL;IAAO,QAAQH;GAAU,CAAA,IAAI,IAC/C;;CACT,CAAA;AAElB;AAmBA,SAASS,EAAiB,GAAmD;CAC3E,IAAMC,IAASC,EAAe,GACxBC,IAASC,IACXH,EAAO,OAAO,MAAM,MAAcI,EAAU,OAAOD,CAAO,IAC1D,KAAA,GACEE,IAASC,EACbH,KAAW,CAACH,EAAO,WAAW,CAACE,IAASC,IAAU,KAAA,CACpD;CAMA,OALKA,IACDD,IAAe;EAAE,MAAM;EAAS,OAAOA;CAAO,IAC9CF,EAAO,UAAgB,EAAE,MAAM,UAAU,IACzCK,EAAO,QAAc;EAAE,MAAM;EAAU,OAAOA,EAAO;CAAM,IAC1DA,EAAO,WACLA,EAAO,QACV;EAAE,MAAM;EAAS,OAAOA,EAAO;CAAM,IACrC,EAAE,MAAM,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BACA,yFACF,IACA,KAAA;GAVR,UAAA,CAaE,kBAACyG,GAAD;IACE,OAAOzG,EAAG,sBAAsB,iBAAiB;IACjD,aACE4H,IACI5H,EACE,0BACA,uCACF,IACAA,EACE,0BACA,sDACF;IAEN,UAAU,MACR,kBAAC6H,IAAD;KACE,SAASrE,EAAM;KACf,kBAAkB,MAAS0B,EAAO,EAAE,QAAK,CAAC;KAC1C,mBAAiB4B,EAAI;KACrB,oBAAkBA,EAAI;IACvB,CAAA;GAEJ,CAAA,GACAtD,EAAM,OACL,kBAACiD,GAAD;IACE,OAAOzG,EAAG,2BAA2B,YAAY;IACjD,UAAU,MACR,kBAACyH,GAAD;KACE,WAAU;KACV,OAAOjE,EAAM;KACb,aAAaA,EAAM;KACnB,WAAW;KACX,WAAW,MAAU0B,EAAO,EAAE,WAAWwC,EAAM,OAAO,MAAM,CAAC;KAC7D,mBAAiBZ,EAAI;IACtB,CAAA;GAEJ,CAAA,IACC,IACW;EACd,CAAA,CAAA;;AAET"}
|
|
@@ -15,7 +15,7 @@ export interface ExportAccess {
|
|
|
15
15
|
/**
|
|
16
16
|
* The workspace's export permissions, from the shell's permission set (no
|
|
17
17
|
* request of its own). Whether someone may download the whole organization is
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* separate (`useOrganizationExportPermission`): no one may yet, and nothing is
|
|
19
|
+
* asked (BOFF-16327).
|
|
20
20
|
*/
|
|
21
21
|
export declare function useExportAccess(): ExportAccess;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportAccess.js","names":["useExportAccess","loading","usePermissionLoading","canCreate","usePermission","canWorkspace","canSetups","canCancel","canDelete"],"sources":["../../../src/export/workspace-v2/useExportAccess.ts"],"sourcesContent":["/**\n * What this person may do on \"Download your data\" (BOFF-15822). Members see\n * what admins can do, locked and told why, never hidden; the export service\n * checks the same permissions (`@rbac` on each call).\n */\nimport {\n usePermission,\n usePermissionLoading,\n} from \"@burdenoff/fe-libs/shared/providers/shell\";\n\nexport interface ExportAccess {\n /** The permissions have loaded: a lock can show. */\n settled: boolean;\n /** Start a download (`export:create`). */\n canCreate: boolean;\n /** Download everyone's data in the workspace (`export:workspace_admin`). */\n canWorkspace: boolean;\n /** Save and delete setups (`export:manage_templates`). */\n canSetups: boolean;\n /** Cancel a download that is preparing (`export:cancel`). */\n canCancel: boolean;\n /** Delete a download (`export:delete`). */\n canDelete: boolean;\n}\n\n/**\n * The workspace's export permissions, from the shell's permission set (no\n * request of its own). Whether someone may download the whole organization is\n *
|
|
1
|
+
{"version":3,"file":"useExportAccess.js","names":["useExportAccess","loading","usePermissionLoading","canCreate","usePermission","canWorkspace","canSetups","canCancel","canDelete"],"sources":["../../../src/export/workspace-v2/useExportAccess.ts"],"sourcesContent":["/**\n * What this person may do on \"Download your data\" (BOFF-15822). Members see\n * what admins can do, locked and told why, never hidden; the export service\n * checks the same permissions (`@rbac` on each call).\n */\nimport {\n usePermission,\n usePermissionLoading,\n} from \"@burdenoff/fe-libs/shared/providers/shell\";\n\nexport interface ExportAccess {\n /** The permissions have loaded: a lock can show. */\n settled: boolean;\n /** Start a download (`export:create`). */\n canCreate: boolean;\n /** Download everyone's data in the workspace (`export:workspace_admin`). */\n canWorkspace: boolean;\n /** Save and delete setups (`export:manage_templates`). */\n canSetups: boolean;\n /** Cancel a download that is preparing (`export:cancel`). */\n canCancel: boolean;\n /** Delete a download (`export:delete`). */\n canDelete: boolean;\n}\n\n/**\n * The workspace's export permissions, from the shell's permission set (no\n * request of its own). Whether someone may download the whole organization is\n * separate (`useOrganizationExportPermission`): no one may yet, and nothing is\n * asked (BOFF-16327).\n */\nexport function useExportAccess(): ExportAccess {\n const loading = usePermissionLoading();\n const canCreate = usePermission(\"export:create\");\n const canWorkspace = usePermission(\"export:workspace_admin\");\n const canSetups = usePermission(\"export:manage_templates\");\n const canCancel = usePermission(\"export:cancel\");\n const canDelete = usePermission(\"export:delete\");\n return {\n settled: !loading,\n canCreate,\n canWorkspace,\n canSetups,\n canCancel,\n canDelete,\n };\n}\n"],"mappings":";;AA+BA,SAAgBA,IAAgC;CAC9C,IAAMC,IAAUC,EAAqB,GAC/BC,IAAYC,EAAc,eAAe,GACzCC,IAAeD,EAAc,wBAAwB,GACrDE,IAAYF,EAAc,yBAAyB,GACnDG,IAAYH,EAAc,eAAe,GACzCI,IAAYJ,EAAc,eAAe;CAC/C,OAAO;EACL,SAAS,CAACH;EACV;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -217,18 +217,6 @@ export type UpdateExportTemplateMutation = {
|
|
|
217
217
|
updatedAt: string;
|
|
218
218
|
};
|
|
219
219
|
};
|
|
220
|
-
export type ExportOrganizationPermissionQueryVariables = Exact<{
|
|
221
|
-
scopeId: string;
|
|
222
|
-
}>;
|
|
223
|
-
export type ExportOrganizationPermissionQuery = {
|
|
224
|
-
myPermissions: {
|
|
225
|
-
scopeId: string;
|
|
226
|
-
permissions: Array<{
|
|
227
|
-
resourceType: string;
|
|
228
|
-
allowedActions: Array<string>;
|
|
229
|
-
}>;
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
220
|
export type GetAvailableExportEntitiesQueryVariables = Exact<{
|
|
233
221
|
context: Types.ContextInput;
|
|
234
222
|
pagination?: Types.ExportPaginationInput | null | undefined;
|
|
@@ -643,36 +631,6 @@ export declare function useUpdateExportTemplateMutation(baseOptions?: ApolloReac
|
|
|
643
631
|
export type UpdateExportTemplateMutationHookResult = ReturnType<typeof useUpdateExportTemplateMutation>;
|
|
644
632
|
export type UpdateExportTemplateMutationResult = Apollo.MutationResult<Types.UpdateExportTemplateMutation>;
|
|
645
633
|
export type UpdateExportTemplateMutationOptions = Apollo.BaseMutationOptions<Types.UpdateExportTemplateMutation, Types.UpdateExportTemplateMutationVariables>;
|
|
646
|
-
export declare const ExportOrganizationPermissionDocument: Apollo.DocumentNode;
|
|
647
|
-
/**
|
|
648
|
-
* __useExportOrganizationPermissionQuery__
|
|
649
|
-
*
|
|
650
|
-
* To run a query within a React component, call `useExportOrganizationPermissionQuery` and pass it any options that fit your needs.
|
|
651
|
-
* When your component renders, `useExportOrganizationPermissionQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
652
|
-
* you can use to render your UI.
|
|
653
|
-
*
|
|
654
|
-
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
655
|
-
*
|
|
656
|
-
* @example
|
|
657
|
-
* const { data, loading, error } = useExportOrganizationPermissionQuery({
|
|
658
|
-
* variables: {
|
|
659
|
-
* scopeId: // value for 'scopeId'
|
|
660
|
-
* },
|
|
661
|
-
* });
|
|
662
|
-
*/
|
|
663
|
-
export declare function useExportOrganizationPermissionQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables> & ({
|
|
664
|
-
variables: Types.ExportOrganizationPermissionQueryVariables;
|
|
665
|
-
skip?: boolean;
|
|
666
|
-
} | {
|
|
667
|
-
skip: boolean;
|
|
668
|
-
})): ApolloReactHooks.useQuery.Result<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables, "complete" | "empty" | "streaming", Types.ExportOrganizationPermissionQueryVariables, undefined>;
|
|
669
|
-
export declare function useExportOrganizationPermissionLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables, "complete" | "empty" | "streaming", undefined>;
|
|
670
|
-
export declare function useExportOrganizationPermissionSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables>;
|
|
671
|
-
export declare function useExportOrganizationPermissionSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ExportOrganizationPermissionQuery | undefined, Types.ExportOrganizationPermissionQueryVariables>;
|
|
672
|
-
export type ExportOrganizationPermissionQueryHookResult = ReturnType<typeof useExportOrganizationPermissionQuery>;
|
|
673
|
-
export type ExportOrganizationPermissionLazyQueryHookResult = ReturnType<typeof useExportOrganizationPermissionLazyQuery>;
|
|
674
|
-
export type ExportOrganizationPermissionSuspenseQueryHookResult = ReturnType<typeof useExportOrganizationPermissionSuspenseQuery>;
|
|
675
|
-
export type ExportOrganizationPermissionQueryResult = Apollo.QueryResult<Types.ExportOrganizationPermissionQuery, Types.ExportOrganizationPermissionQueryVariables>;
|
|
676
634
|
export declare const GetAvailableExportEntitiesDocument: Apollo.DocumentNode;
|
|
677
635
|
/**
|
|
678
636
|
* __useGetAvailableExportEntitiesQuery__
|
|
@@ -110,16 +110,6 @@ var t = e`
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
`, c = e`
|
|
113
|
-
query ExportOrganizationPermission($scopeId: String!) {
|
|
114
|
-
myPermissions(scopeId: $scopeId) {
|
|
115
|
-
scopeId
|
|
116
|
-
permissions {
|
|
117
|
-
resourceType
|
|
118
|
-
allowedActions
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
`, l = e`
|
|
123
113
|
query GetAvailableExportEntities($context: ContextInput!, $pagination: ExportPaginationInput) {
|
|
124
114
|
getAvailableExportEntities(context: $context, pagination: $pagination) {
|
|
125
115
|
edges {
|
|
@@ -143,7 +133,7 @@ var t = e`
|
|
|
143
133
|
totalCount
|
|
144
134
|
}
|
|
145
135
|
}
|
|
146
|
-
`,
|
|
136
|
+
`, l = e`
|
|
147
137
|
query GetExportJob($context: ContextInput, $id: ID!) {
|
|
148
138
|
getExportJob(context: $context, id: $id) {
|
|
149
139
|
id
|
|
@@ -214,7 +204,7 @@ e`
|
|
|
214
204
|
}
|
|
215
205
|
}
|
|
216
206
|
`;
|
|
217
|
-
var
|
|
207
|
+
var u = e`
|
|
218
208
|
query GetExportTemplate($context: ContextInput, $id: ID!) {
|
|
219
209
|
getExportTemplate(context: $context, id: $id) {
|
|
220
210
|
id
|
|
@@ -234,7 +224,7 @@ var d = e`
|
|
|
234
224
|
updatedBy
|
|
235
225
|
}
|
|
236
226
|
}
|
|
237
|
-
`,
|
|
227
|
+
`, d = e`
|
|
238
228
|
query ListExportTemplates($context: ContextInput!, $pagination: ExportPaginationInput) {
|
|
239
229
|
listExportTemplates(context: $context, pagination: $pagination) {
|
|
240
230
|
edges {
|
|
@@ -263,7 +253,7 @@ var d = e`
|
|
|
263
253
|
totalCount
|
|
264
254
|
}
|
|
265
255
|
}
|
|
266
|
-
`,
|
|
256
|
+
`, f = e`
|
|
267
257
|
query ListExportJobs($filter: ExportJobFilterInput, $pagination: ExportPaginationInput, $context: ContextInput!) {
|
|
268
258
|
listExportJobs(filter: $filter, pagination: $pagination, context: $context) {
|
|
269
259
|
edges {
|
|
@@ -305,7 +295,7 @@ var d = e`
|
|
|
305
295
|
totalCount
|
|
306
296
|
}
|
|
307
297
|
}
|
|
308
|
-
`,
|
|
298
|
+
`, p = e`
|
|
309
299
|
subscription ExportJobProgress($jobId: ID!) {
|
|
310
300
|
exportJobProgress(jobId: $jobId) {
|
|
311
301
|
id
|
|
@@ -346,6 +336,6 @@ var d = e`
|
|
|
346
336
|
}
|
|
347
337
|
}
|
|
348
338
|
`;
|
|
349
|
-
export { t as CancelExportJobDocument, n as CreateExportJobDocument, r as CreateExportTemplateDocument, i as DeleteExportJobDocument, a as DeleteExportTemplateDocument,
|
|
339
|
+
export { t as CancelExportJobDocument, n as CreateExportJobDocument, r as CreateExportTemplateDocument, i as DeleteExportJobDocument, a as DeleteExportTemplateDocument, p as ExportJobProgressDocument, c as GetAvailableExportEntitiesDocument, l as GetExportJobDocument, u as GetExportTemplateDocument, f as ListExportJobsDocument, d as ListExportTemplatesDocument, o as RetryExportJobDocument, s as UpdateExportTemplateDocument };
|
|
350
340
|
|
|
351
341
|
//# sourceMappingURL=wspace-operations.js.map
|