@burdenoff/microfe-export 2026.1124.1 → 2026.1125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export/ExportRoutes.js +62 -57
- package/dist/export/ExportRoutes.js.map +1 -1
- package/dist/export/components/ConfirmDestructiveDialog.js +18 -14
- package/dist/export/components/ConfirmDestructiveDialog.js.map +1 -1
- package/dist/export/components/DownloadStatus.js +14 -10
- package/dist/export/components/DownloadStatus.js.map +1 -1
- package/dist/export/components/ExportProgressBar.d.ts +3 -1
- package/dist/export/components/ExportProgressBar.js +23 -11
- package/dist/export/components/ExportProgressBar.js.map +1 -1
- package/dist/export/components/loadingSystem.d.ts +64 -0
- package/dist/export/components/loadingSystem.js +49 -0
- package/dist/export/components/loadingSystem.js.map +1 -0
- package/dist/export/hooks/exportBackgroundTask.d.ts +18 -0
- package/dist/export/hooks/exportBackgroundTask.js +46 -0
- package/dist/export/hooks/exportBackgroundTask.js.map +1 -0
- package/dist/export/hooks/useExportQueries.js +140 -124
- package/dist/export/hooks/useExportQueries.js.map +1 -1
- package/dist/export/pages/CreateExportPage.js +29 -27
- package/dist/export/pages/CreateExportPage.js.map +1 -1
- package/dist/export/pages/ExportDashboardPage.js +114 -113
- package/dist/export/pages/ExportDashboardPage.js.map +1 -1
- package/dist/export/pages/ExportDetailPage.js +104 -98
- package/dist/export/pages/ExportDetailPage.js.map +1 -1
- package/dist/export/pages/ExportHistoryPage.js +150 -149
- package/dist/export/pages/ExportHistoryPage.js.map +1 -1
- package/dist/export/pages/ExportTemplatesPage.js +156 -154
- package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
- package/dist/export/pages/TemplateDetailPage.js +142 -136
- package/dist/export/pages/TemplateDetailPage.js.map +1 -1
- package/dist/export/pages/v2/DownloadDetailPage.js +108 -103
- package/dist/export/pages/v2/DownloadDetailPage.js.map +1 -1
- package/dist/export/pages/v2/DownloadsPage.js +153 -152
- package/dist/export/pages/v2/DownloadsPage.js.map +1 -1
- package/dist/export/pages/v2/NewDownloadPage.js +142 -138
- package/dist/export/pages/v2/NewDownloadPage.js.map +1 -1
- package/dist/export/workspace-v2/DownloadCells.js +32 -20
- package/dist/export/workspace-v2/DownloadCells.js.map +1 -1
- package/package.json +2 -2
|
@@ -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","mutate","useMutation","CreateExportJobDocument","createJob","restInput","input","gqlInput","filters","result","emitExportEvent","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 { useMutation, useQuery, useSubscription } from \"@apollo/client/react\";\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 { 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 [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 return mapJob(result.data.createExportJob);\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":";;;;;;;AAwJA,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;EAClB,aAAaT,EAAeS,EAAK,WAAW;EAC5C,mBAAmBT,EAAeS,EAAK,iBAAiB;EACxD,UAAUT,EAAeS,EAAK,QAAQ;EACtC,WAAWT,EAAeS,EAAK,SAAS;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E,CAAC,CAACsD,KACF,CAAC,CAACxE,KACF,CAACC,KACD,CAACC,KACDF,GAAM,cAAc,YAAYwE,KAChCxE,EAAK,cAAc,YAAY,MAC5B,MACCyE,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","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,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,KAA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E;IACxC,CACF;GACF,CAAC;GACD,IAAI,CAACoB,EAAO,MAIV,MAHAC,EAAgBhB,GAAe,qBAAqB,EAClD,WAAW,uBACb,CAAC,GACS,MAAM,kCAAkC;GAEpD,OAAOhE,EAAY+E,EAAO,KAAK,oBAAoB;EACrD;EAIE;EACA,WAAW1D;EACX,OAAOC,KAAS;CAClB;AACF;AAKA,SAAgB2E,KAA0B;CACxC,IAAMjC,IAAgBlD,EAAU,GAC1B,EAAE,mBAAgBkD,GAClB,CAACO,GAAQ,EAAE,YAAS,cAAWC,EAGnC0B,CAA4B;CAqB9B,OAAO;EACL,uBApB4B,OAC5B,MAAM3B,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;AAcA,SAAgB6E,GACd,GACA,IAA+C,CAAC,GACvC;CACT,IAAM,EAAE,SAAM,YAAS,aAAUjF,EAG/BkF,GAAsC;EACtC,WAAW,EAAE,SAASC,KAAkB,GAAG;EAC3C,MAAM,CAACA;EACP,aAAa;EAEb,SAAS/D,EAAQ,QAAQ,EAAE,0BAA0B,GAAK,IAAI,KAAA;CAChE,CAAC;CACD,OACE,CAAC,CAAC+D,KACF,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,14 +1,15 @@
|
|
|
1
1
|
import { useExport as e } from "../providers/ExportProvider.js";
|
|
2
|
-
import { useAvailableEntities as t, useCreateExportJob as n, useExportTemplates as r, useOrganizationExportPermission as
|
|
3
|
-
import { getFormatDisplayName as
|
|
4
|
-
import { PageLayout as
|
|
5
|
-
import { useTr as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { openBilling as
|
|
8
|
-
import { LEGACY_ENTITY_COPY_KEY as
|
|
9
|
-
import { isExportEntityDisabled as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { useAvailableEntities as t, useCreateExportJob as n, useExportTemplates as r, useOrganizationExportPermission as i } from "../hooks/useExportQueries.js";
|
|
3
|
+
import { getFormatDisplayName as a } from "../constants/enums.js";
|
|
4
|
+
import { PageLayout as ee } from "../components/PageLayout.js";
|
|
5
|
+
import { useTr as te } from "../hooks/useTr.js";
|
|
6
|
+
import { cn as o } from "../utils/cn.js";
|
|
7
|
+
import { openBilling as ne } from "../utils/billing.js";
|
|
8
|
+
import { LEGACY_ENTITY_COPY_KEY as s } from "../utils/entityLabels.js";
|
|
9
|
+
import { isExportEntityDisabled as c, isForeignProductEntity as l } from "../utils/disabledModules.js";
|
|
10
|
+
import { SpinnerIcon as u } from "../components/loadingSystem.js";
|
|
11
|
+
import { useCallback as re, useEffect as ie, useRef as ae, useState as d } from "react";
|
|
12
|
+
import { ArrowLeft as oe, ArrowRight as f, Building2 as p, CalendarRange as se, CheckCircle2 as m, Download as h, FileJson as g, FileSpreadsheet as _, Lock as ce, Package as le, User as v, Users as y } from "lucide-react";
|
|
12
13
|
import { useAppShell as ue, usePermission as de } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
13
14
|
import { useSearchParams as fe } from "react-router";
|
|
14
15
|
import { isQuotaExhaustedError as pe } from "@burdenoff/fe-libs/shared/utils";
|
|
@@ -24,8 +25,8 @@ var C = ["CSV", "JSON"], Ee = {
|
|
|
24
25
|
ORG_ADMIN: p
|
|
25
26
|
};
|
|
26
27
|
function T() {
|
|
27
|
-
let { basePath: p = "/", navigate: g, organizationId: _ } = e(), v =
|
|
28
|
-
|
|
28
|
+
let { basePath: p = "/", navigate: g, organizationId: _ } = e(), v = te(), { createJob: y, isPending: T } = n(), { data: E } = t(), { data: D } = r(), [O] = fe(), { productSlug: k } = ue(), A = re((e) => !c(e) && !l(e, k), [k]), De = de("export:workspace_admin"), Oe = i(_), [j, M] = d("entities"), [N, P] = d([]), [F, I] = d(""), [L, R] = d("CSV"), [z, ke] = d("INDIVIDUAL"), [B, V] = d(O.get("templateId") ?? void 0), [H, Ae] = d(""), [U, je] = d(""), [W, G] = d(null), [Me, K] = d(!1), q = ae(null);
|
|
29
|
+
ie(() => {
|
|
29
30
|
let e = O.get("templateId");
|
|
30
31
|
if (!e || !D?.length || q.current === e) return;
|
|
31
32
|
let t = D.find((t) => t.id === e);
|
|
@@ -122,7 +123,7 @@ function T() {
|
|
|
122
123
|
label: v("export.create.entities.calendar.label", "Calendar Events"),
|
|
123
124
|
description: v("export.create.entities.calendar.description", "Events and bookings")
|
|
124
125
|
}
|
|
125
|
-
}, X = E.filter((e) => e.enabled !== !1 && !
|
|
126
|
+
}, X = E.filter((e) => e.enabled !== !1 && !l(e.entityType, k)), Z = X.filter((e) => !c(e.entityType)), Q = X.filter((e) => c(e.entityType)), $ = (e, t) => {
|
|
126
127
|
let n = !t && N.includes(e.entityType);
|
|
127
128
|
return /* @__PURE__ */ x("button", {
|
|
128
129
|
type: "button",
|
|
@@ -130,13 +131,13 @@ function T() {
|
|
|
130
131
|
disabled: t,
|
|
131
132
|
"aria-disabled": t,
|
|
132
133
|
title: t ? v("export.create.select.unavailableHint", "Export for this product isn't available yet") : void 0,
|
|
133
|
-
className:
|
|
134
|
+
className: o("text-left border-2 rounded-xl p-4 transition-all duration-200", t ? "border-border-subtle/30 opacity-50 cursor-not-allowed" : n ? "border-primary bg-action-primary-bg/5 shadow-md" : "border-border-subtle/50 hover:border-primary/30 hover:shadow-sm"),
|
|
134
135
|
children: [
|
|
135
136
|
/* @__PURE__ */ x("div", {
|
|
136
137
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
137
138
|
children: [/* @__PURE__ */ b("h3", {
|
|
138
139
|
className: "font-semibold",
|
|
139
|
-
children: Y[
|
|
140
|
+
children: Y[s[e.entityType] ?? e.entityType]?.label ?? e.displayName
|
|
140
141
|
}), t ? /* @__PURE__ */ b("span", {
|
|
141
142
|
className: "shrink-0 text-xs font-medium px-2 py-0.5 rounded-full bg-bg-sunken text-text-secondary",
|
|
142
143
|
children: v("export.create.select.unavailable", "Unavailable")
|
|
@@ -147,7 +148,7 @@ function T() {
|
|
|
147
148
|
}),
|
|
148
149
|
/* @__PURE__ */ b("p", {
|
|
149
150
|
className: "text-sm text-text-secondary",
|
|
150
|
-
children: Y[
|
|
151
|
+
children: Y[s[e.entityType] ?? e.entityType]?.description ?? e.description
|
|
151
152
|
}),
|
|
152
153
|
e.estimatedSize && /* @__PURE__ */ x("p", {
|
|
153
154
|
className: "text-xs text-text-secondary mt-2",
|
|
@@ -156,7 +157,7 @@ function T() {
|
|
|
156
157
|
]
|
|
157
158
|
}, e.entityType);
|
|
158
159
|
};
|
|
159
|
-
return /* @__PURE__ */ x(
|
|
160
|
+
return /* @__PURE__ */ x(ee, {
|
|
160
161
|
showHeader: !1,
|
|
161
162
|
children: [
|
|
162
163
|
/* @__PURE__ */ b("div", {
|
|
@@ -168,7 +169,7 @@ function T() {
|
|
|
168
169
|
onClick: () => g?.(p),
|
|
169
170
|
className: "p-2.5 hover:bg-accent rounded-lg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
170
171
|
"aria-label": v("export.create.actions.backToDashboard", "Back to export dashboard"),
|
|
171
|
-
children: /* @__PURE__ */ b(
|
|
172
|
+
children: /* @__PURE__ */ b(oe, { size: 20 })
|
|
172
173
|
}), /* @__PURE__ */ x("div", {
|
|
173
174
|
className: "flex items-center gap-3",
|
|
174
175
|
children: [/* @__PURE__ */ b("div", {
|
|
@@ -200,7 +201,7 @@ function T() {
|
|
|
200
201
|
size: 18,
|
|
201
202
|
className: "text-text-secondary"
|
|
202
203
|
}), /* @__PURE__ */ x("div", {
|
|
203
|
-
className:
|
|
204
|
+
className: o("flex items-center gap-2 px-4 py-2.5 rounded-lg text-sm font-medium border-2 transition-all duration-200", j === e ? "bg-action-primary-bg text-action-primary-text border-primary shadow-[var(--shadow-pop)]" : "bg-bg-sunken/50 text-text-secondary border-border-seam"),
|
|
204
205
|
children: [/* @__PURE__ */ b("div", {
|
|
205
206
|
className: "flex items-center justify-center size-6 rounded-full bg-bg-surface/20 font-bold",
|
|
206
207
|
children: t + 1
|
|
@@ -280,7 +281,7 @@ function T() {
|
|
|
280
281
|
type: "button",
|
|
281
282
|
onClick: () => !t && ke(e),
|
|
282
283
|
disabled: t,
|
|
283
|
-
className:
|
|
284
|
+
className: o("text-left border-2 rounded-xl p-4 transition-all duration-200", z === e ? "border-primary bg-action-primary-bg/5 shadow-md" : t ? "border-border-subtle/30 opacity-50 cursor-not-allowed" : "border-border-subtle/50 hover:border-primary/30 hover:shadow-sm"),
|
|
284
285
|
title: t ? r : void 0,
|
|
285
286
|
children: [
|
|
286
287
|
/* @__PURE__ */ x("div", {
|
|
@@ -342,13 +343,13 @@ function T() {
|
|
|
342
343
|
return /* @__PURE__ */ x("button", {
|
|
343
344
|
type: "button",
|
|
344
345
|
onClick: () => R(e),
|
|
345
|
-
className:
|
|
346
|
+
className: o("flex items-center gap-3 border-2 rounded-lg p-3 transition-all duration-200", L === e ? "border-primary bg-action-primary-bg/5" : "border-border-subtle/50 hover:border-primary/30"),
|
|
346
347
|
children: [/* @__PURE__ */ b(t, {
|
|
347
348
|
size: 18,
|
|
348
349
|
className: L === e ? "text-primary" : "text-text-secondary"
|
|
349
350
|
}), /* @__PURE__ */ b("span", {
|
|
350
351
|
className: "font-medium text-sm",
|
|
351
|
-
children:
|
|
352
|
+
children: a(e)
|
|
352
353
|
})]
|
|
353
354
|
}, e);
|
|
354
355
|
})
|
|
@@ -361,7 +362,7 @@ function T() {
|
|
|
361
362
|
/* @__PURE__ */ b("div", {
|
|
362
363
|
className: "flex gap-3",
|
|
363
364
|
children: /* @__PURE__ */ x("div", {
|
|
364
|
-
className:
|
|
365
|
+
className: o("flex items-center gap-2 border-2 rounded-lg px-4 py-2 border-primary bg-action-primary-bg/5"),
|
|
365
366
|
children: [/* @__PURE__ */ b(le, {
|
|
366
367
|
size: 16,
|
|
367
368
|
className: "text-primary"
|
|
@@ -387,7 +388,7 @@ function T() {
|
|
|
387
388
|
children: /* @__PURE__ */ x("span", {
|
|
388
389
|
className: "inline-flex items-center gap-1.5",
|
|
389
390
|
children: [
|
|
390
|
-
/* @__PURE__ */ b(
|
|
391
|
+
/* @__PURE__ */ b(se, { size: 15 }),
|
|
391
392
|
v("export.create.options.dateRange", "Date Range"),
|
|
392
393
|
" ",
|
|
393
394
|
/* @__PURE__ */ b("span", {
|
|
@@ -496,7 +497,7 @@ function T() {
|
|
|
496
497
|
},
|
|
497
498
|
{
|
|
498
499
|
label: v("export.create.review.fields.format", "Format"),
|
|
499
|
-
value:
|
|
500
|
+
value: a(L)
|
|
500
501
|
},
|
|
501
502
|
{
|
|
502
503
|
label: v("export.create.review.fields.archive", "Archive"),
|
|
@@ -535,7 +536,8 @@ function T() {
|
|
|
535
536
|
onClick: Fe,
|
|
536
537
|
disabled: T,
|
|
537
538
|
className: "flex-1 inline-flex items-center justify-center gap-2 px-6 py-3 bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bg/90 transition-all duration-200 font-bold shadow-lg disabled:opacity-50 disabled:cursor-not-allowed",
|
|
538
|
-
children: [T ? /* @__PURE__ */ b(
|
|
539
|
+
children: [T ? /* @__PURE__ */ b(u, {
|
|
540
|
+
tone: "current",
|
|
539
541
|
size: 18,
|
|
540
542
|
className: "animate-spin"
|
|
541
543
|
}) : /* @__PURE__ */ b(h, { size: 18 }), v("export.create.actions.startExport", "Start Export")]
|
|
@@ -550,7 +552,7 @@ function T() {
|
|
|
550
552
|
open: Me,
|
|
551
553
|
onOpenChange: K,
|
|
552
554
|
children: /* @__PURE__ */ x(_e, { children: [/* @__PURE__ */ x(be, { children: [/* @__PURE__ */ b(xe, { children: v("export.create.quotaDialog.title", "Export Limit Reached") }), /* @__PURE__ */ b(ve, { children: v("export.create.quotaDialog.description", "You have reached your export limit for this month.") })] }), /* @__PURE__ */ x(ye, { children: [/* @__PURE__ */ b(ge, { children: v("export.create.quotaDialog.dismiss", "Dismiss") }), /* @__PURE__ */ b(he, {
|
|
553
|
-
onClick: () =>
|
|
555
|
+
onClick: () => ne(g),
|
|
554
556
|
children: v("export.create.quotaDialog.viewBilling", "View Billing")
|
|
555
557
|
})] })] })
|
|
556
558
|
})
|