@burdenoff/microfe-export 2026.1107.2 → 2026.1108.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/dev/main.d.ts +0 -2
- package/dist/export/ExportRoot.d.ts +0 -2
- package/dist/export/ExportRoot.js +9 -6
- package/dist/export/ExportRoot.js.map +1 -1
- package/dist/export/ExportRoutes.d.ts +1 -2
- package/dist/export/ExportRoutes.js +1 -2
- package/dist/export/ExportRoutes.js.map +1 -1
- package/dist/export/components/ExportProgressBar.d.ts +1 -2
- package/dist/export/components/ExportProgressBar.js +1 -2
- package/dist/export/components/ExportProgressBar.js.map +1 -1
- package/dist/export/components/ExportStatusBadge.d.ts +1 -3
- package/dist/export/components/ExportStatusBadge.js +7 -8
- package/dist/export/components/ExportStatusBadge.js.map +1 -1
- package/dist/export/components/PageLayout.d.ts +3 -5
- package/dist/export/components/PageLayout.js +1 -2
- package/dist/export/components/PageLayout.js.map +1 -1
- package/dist/export/constants/enums.d.ts +0 -2
- package/dist/export/constants/enums.js +1 -2
- package/dist/export/constants/enums.js.map +1 -1
- package/dist/export/constants/index.d.ts +0 -1
- package/dist/export/hooks/useExportQueries.d.ts +14 -31
- package/dist/export/hooks/useExportQueries.js +162 -163
- package/dist/export/hooks/useExportQueries.js.map +1 -1
- package/dist/export/hooks/useTr.d.ts +0 -2
- package/dist/export/hooks/useTr.js +1 -2
- package/dist/export/hooks/useTr.js.map +1 -1
- package/dist/export/index.d.ts +0 -1
- package/dist/export/index.js +5 -4
- package/dist/export/pages/CreateExportPage.d.ts +1 -2
- package/dist/export/pages/CreateExportPage.js +53 -54
- package/dist/export/pages/CreateExportPage.js.map +1 -1
- package/dist/export/pages/ExportDashboardPage.d.ts +1 -2
- package/dist/export/pages/ExportDashboardPage.js +17 -18
- package/dist/export/pages/ExportDashboardPage.js.map +1 -1
- package/dist/export/pages/ExportDetailPage.d.ts +1 -2
- package/dist/export/pages/ExportDetailPage.js +20 -21
- package/dist/export/pages/ExportDetailPage.js.map +1 -1
- package/dist/export/pages/ExportHistoryPage.d.ts +1 -2
- package/dist/export/pages/ExportHistoryPage.js +21 -20
- package/dist/export/pages/ExportHistoryPage.js.map +1 -1
- package/dist/export/pages/ExportLandingPage.d.ts +1 -2
- package/dist/export/pages/ExportLandingPage.js +1 -2
- package/dist/export/pages/ExportLandingPage.js.map +1 -1
- package/dist/export/pages/ExportTemplatesPage.d.ts +1 -2
- package/dist/export/pages/ExportTemplatesPage.js +25 -30
- package/dist/export/pages/ExportTemplatesPage.js.map +1 -1
- package/dist/export/pages/TemplateDetailPage.d.ts +1 -2
- package/dist/export/pages/TemplateDetailPage.js +11 -12
- package/dist/export/pages/TemplateDetailPage.js.map +1 -1
- package/dist/export/providers/ExportProvider.d.ts +0 -2
- package/dist/export/providers/ExportProvider.js +12 -16
- package/dist/export/providers/ExportProvider.js.map +1 -1
- package/dist/export/store/exportStore.d.ts +0 -2
- package/dist/export/store/exportStore.js +1 -2
- package/dist/export/store/exportStore.js.map +1 -1
- package/dist/export/types/index.d.ts +0 -1
- package/dist/export/utils/cn.d.ts +0 -2
- package/dist/export/utils/cn.js +2 -3
- package/dist/export/utils/cn.js.map +1 -1
- package/dist/export/utils/disabledModules.d.ts +0 -1
- package/dist/export/utils/disabledModules.js +3 -4
- package/dist/export/utils/disabledModules.js.map +1 -1
- package/dist/export/utils/events.d.ts +0 -2
- package/dist/export/utils/events.js +1 -2
- package/dist/export/utils/events.js.map +1 -1
- package/dist/export/utils/exportAuthority.d.ts +0 -2
- package/dist/export/utils/exportAuthority.js +1 -2
- package/dist/export/utils/exportAuthority.js.map +1 -1
- package/dist/export/utils/i18n.d.ts +0 -2
- package/dist/export/utils/i18n.js +1 -2
- package/dist/export/utils/i18n.js.map +1 -1
- package/dist/generated/global-operations.d.ts +4 -2
- package/dist/generated/global-types.d.ts +2 -22
- package/dist/generated/wspace-operations.d.ts +226 -181
- package/dist/generated/wspace-operations.js +1 -2
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +4 -24
- package/dist/generated/wspace-types.js +1 -2
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +1 -2
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +1 -2
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +7 -8
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +15 -16
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +5 -6
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +4 -5
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +2 -3
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +2 -3
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -1
- package/dist/node_modules/@apollo/client/version.js +2 -3
- package/dist/node_modules/@apollo/client/version.js.map +1 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +1 -2
- package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -1
- package/dist/node_modules/@wry/trie/lib/index.js +2 -3
- package/dist/node_modules/@wry/trie/lib/index.js.map +1 -1
- package/dist/node_modules/clsx/dist/clsx.js +8 -7
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/graphql-ws/dist/client.js +76 -69
- package/dist/node_modules/graphql-ws/dist/client.js.map +1 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +2 -3
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +2 -3
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +41 -42
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +14 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +21 -18
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +2 -3
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +229 -167
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/{rxjs/node_modules/tslib → tslib}/tslib.es6.js +1 -2
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/test/happydom.d.ts +1 -0
- package/dist/translations/en.d.ts +0 -1
- package/dist/translations/en.js +1 -2
- package/dist/translations/en.js.map +1 -1
- package/dist/utils/nativeBridge.d.ts +0 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +62 -46
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/export/ExportRoot.d.ts.map +0 -1
- package/dist/export/ExportRoutes.d.ts.map +0 -1
- package/dist/export/components/ExportProgressBar.d.ts.map +0 -1
- package/dist/export/components/ExportStatusBadge.d.ts.map +0 -1
- package/dist/export/components/PageLayout.d.ts.map +0 -1
- package/dist/export/constants/enums.d.ts.map +0 -1
- package/dist/export/constants/index.d.ts.map +0 -1
- package/dist/export/hooks/useExportQueries.d.ts.map +0 -1
- package/dist/export/hooks/useTr.d.ts.map +0 -1
- package/dist/export/index.d.ts.map +0 -1
- package/dist/export/pages/CreateExportPage.d.ts.map +0 -1
- package/dist/export/pages/ExportDashboardPage.d.ts.map +0 -1
- package/dist/export/pages/ExportDetailPage.d.ts.map +0 -1
- package/dist/export/pages/ExportHistoryPage.d.ts.map +0 -1
- package/dist/export/pages/ExportLandingPage.d.ts.map +0 -1
- package/dist/export/pages/ExportTemplatesPage.d.ts.map +0 -1
- package/dist/export/pages/TemplateDetailPage.d.ts.map +0 -1
- package/dist/export/providers/ExportProvider.d.ts.map +0 -1
- package/dist/export/store/exportStore.d.ts.map +0 -1
- package/dist/export/types/index.d.ts.map +0 -1
- package/dist/export/utils/cn.d.ts.map +0 -1
- package/dist/export/utils/disabledModules.d.ts.map +0 -1
- package/dist/export/utils/events.d.ts.map +0 -1
- package/dist/export/utils/exportAuthority.d.ts.map +0 -1
- package/dist/export/utils/i18n.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/translations/en.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExportQueries.js","names":[],"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 { useEffect, useRef } 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 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} 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\ninterface 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\ninterface 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\nfunction 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\nfunction 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/** 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(overrideWorkspaceId?: string) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = 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 const entities =\n connection?.edges.map((edge) => mapAvailableEntity(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: 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 const requestedCursor = useRef<string | null>(null);\n useEffect(() => {\n if (loading || !workspaceId || !hasNextPage || !endCursor) return;\n if (requestedCursor.current === endCursor) return;\n requestedCursor.current = endCursor;\n void fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: endCursor },\n },\n updateQuery: appendEntityPage,\n });\n }, [loading, workspaceId, hasNextPage, endCursor, fetchMore]);\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 };\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 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/** Organization scope is independent of workspace grants; this is a UX hint only. */\nexport function useOrganizationExportPermission(\n organizationId: string | undefined,\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 });\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":";;;;;;;AAqJA,SAAS,EAAe,GAA6C;AACnE,QAAO,KAAS,KAAA;;AAGlB,SAAS,EAAe,GAAsD;AAC5E,KAAI,KAAS,KAAM;CACnB,IAAM,IAAS,OAAO,KAAU,WAAW,IAAQ,OAAO,EAAM;AAChE,QAAO,OAAO,SAAS,EAAO,GAAG,IAAS,KAAA;;AAG5C,SAAS,EAAa,GAA0C;AAC9D,QAAO,EAAe,EAAM,IAAI;;AAGlC,SAAS,EACP,GACqC;AACrC,QAAO,KAAS,OAAO,KAAU,YAAY,CAAC,MAAM,QAAQ,EAAM,GAC9D,IACA,KAAA;;AAGN,SAAS,EAAY,GAKR;AACX,QAAO;EACL,aAAa,EAAS;EACtB,iBAAiB,EAAS;EAC1B,aAAa,EAAe,EAAS,YAAY;EACjD,WAAW,EAAe,EAAS,UAAU;EAC9C;;AAGH,SAAS,EAAQ,GAAkC;AACjD,QAAO;EACL,IAAI,EAAK;EACT,OAAO,EAAe,EAAK,MAAM;EACjC,Y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AAKrD,UAHA,EAAgB,GAAe,2BAA2B,EACxD,YAAY,EAAO,KAAK,qBAAqB,IAC9C,CAAC,EACK,EAAY,EAAO,KAAK,qBAAqB;;EAKpD;EACA,WAAW;EACX,OAAO,KAAS;EACjB;;AAMH,SAAgB,IAA0B;CACxC,IAAM,IAAgB,GAAW,EAC3B,EAAE,mBAAgB,GAClB,CAAC,GAAQ,EAAE,YAAS,cAAW,EAGnC,EAA6B;AAqB/B,QAAO;EACL,gBApBqB,OAAO,OAC5B,MAAM,EAAO;GACX,WAAW;IACT;IACA,SAAS,EAAE,gBAAa;IACzB;GACD,gBAAgB,CACd;IACE,OAAO;IACP,WAAW,EAAE,SAAS,EAAE,gBAAa,EAAE;IACxC,CACF;GACF,CAAC,EACF,EAAgB,GAAe,2BAA2B,EACxD,YAAY,GACb,CAAC,EACK;EAKP;EACA,WAAW;EACX,OAAO,KAAS;EACjB;;AAIH,SAAgB,EACd,GACS;CACT,IAAM,EAAE,SAAM,YAAS,aAAU,EAG/B,GAAsC;EACtC,WAAW,EAAE,SAAS,KAAkB,IAAI;EAC5C,MAAM,CAAC;EACP,aAAa;EACd,CAAC;AACF,QACE,CAAC,CAAC,KACF,CAAC,CAAC,KACF,CAAC,KACD,CAAC,KACD,GAAM,cAAc,YAAY,KAChC,EAAK,cAAc,YAAY,MAC5B,MACC,EAAW,iBAAiB,YAC5B,EAAW,eAAe,SAAS,qBAAqB,CAC3D"}
|
|
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","appendEntityPage","fetchMoreResult","previous","useAvailableEntities","ctxWorkspaceId","overrideWorkspaceId","GetAvailableExportEntitiesDocument","connection","entities","edge","loadMore","fetchMore","hasNextPage","endCursor","requestedCursor","useRef","useEffect","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","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 { useEffect, useRef } 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 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} 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\ninterface 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\ninterface 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\nfunction 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\nfunction 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/** 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(overrideWorkspaceId?: string) {\n const { workspaceId: ctxWorkspaceId } = useExport();\n const workspaceId = 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 const entities =\n connection?.edges.map((edge) => mapAvailableEntity(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: 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 const requestedCursor = useRef<string | null>(null);\n useEffect(() => {\n if (loading || !workspaceId || !hasNextPage || !endCursor) return;\n if (requestedCursor.current === endCursor) return;\n requestedCursor.current = endCursor;\n void fetchMore({\n variables: {\n context: { workspaceId },\n pagination: { first: 100, after: endCursor },\n },\n updateQuery: appendEntityPage,\n });\n }, [loading, workspaceId, hasNextPage, endCursor, fetchMore]);\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 };\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 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/** Organization scope is independent of workspace grants; this is a UX hint only. */\nexport function useOrganizationExportPermission(\n organizationId: string | undefined,\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 });\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":";;;;;;;AAqJA,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;CAC1C;AACF;AAEA,SAASC,EAAO,GAA+B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
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TranslationParams } from '../utils/i18n';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* useTr — translation hook with fallback semantics.
|
|
5
4
|
*
|
|
@@ -16,4 +15,3 @@ import { TranslationParams } from '../utils/i18n';
|
|
|
16
15
|
* return <p>{tr('export.dashboard.activeCount', '{{count}} active exports', { count: 5 })}</p>;
|
|
17
16
|
*/
|
|
18
17
|
export declare function useTr(): (key: string, fallback: string, params?: TranslationParams) => string;
|
|
19
|
-
//# sourceMappingURL=useTr.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { interpolateFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { useCallback as t } from "react";
|
|
3
3
|
import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
4
|
-
|
|
4
|
+
// src/export/hooks/useTr.ts
|
|
5
5
|
function r() {
|
|
6
6
|
let { t: r } = n();
|
|
7
7
|
return t((t, n, i) => {
|
|
@@ -9,7 +9,6 @@ function r() {
|
|
|
9
9
|
return e(a === t ? n : a, i);
|
|
10
10
|
}, [r]);
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { r as useTr };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=useTr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTr.js","names":[],"sources":["../../../src/export/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { interpolateFallback, type TranslationParams } from \"../utils/i18n\";\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('export.dashboard.title', 'Export')}</h1>;\n * return <p>{tr('export.dashboard.activeCount', '{{count}} active exports', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: TranslationParams,\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: TranslationParams): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n return interpolateFallback(raw, params);\n },\n [t],\n );\n}\n"],"mappings":";;;;AAmBA,
|
|
1
|
+
{"version":3,"file":"useTr.js","names":["useTr","useI18n","useCallback","translated","t","key","interpolateFallback","fallback","params"],"sources":["../../../src/export/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { interpolateFallback, type TranslationParams } from \"../utils/i18n\";\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('export.dashboard.title', 'Export')}</h1>;\n * return <p>{tr('export.dashboard.activeCount', '{{count}} active exports', { count: 5 })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: TranslationParams,\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: TranslationParams): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n return interpolateFallback(raw, params);\n },\n [t],\n );\n}\n"],"mappings":";;;;AAmBA,SAAgBA,IAIJ;CACV,IAAM,EAAE,SAAMC,EAAQ;CACtB,OAAOC,GACJ,GAAa,GAAkB,MAAuC;EACrE,IAAMC,IAAaC,EAAEC,CAAG;EAExB,OAAOC,EADKH,MAAeE,IAAME,IAAWJ,GACZK,CAAM;CACxC,GACA,CAACJ,CAAC,CACJ;AACF"}
|
package/dist/export/index.d.ts
CHANGED
|
@@ -27,4 +27,3 @@ export type { ExportRootProps, ExportJob, ExportPart, ExportTemplate, ExportAvai
|
|
|
27
27
|
export { useExport } from './providers/ExportProvider';
|
|
28
28
|
export { useExportStore } from './store/exportStore';
|
|
29
29
|
export { enTranslations } from '../translations/en';
|
|
30
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/export/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "../translations/en.js";
|
|
1
|
+
import { ExportRoot as e } from "./ExportRoot.js";
|
|
2
|
+
import { useExport as t } from "./providers/ExportProvider.js";
|
|
3
|
+
import { useExportStore as n } from "./store/exportStore.js";
|
|
4
|
+
import { enTranslations as r } from "../translations/en.js";
|
|
5
|
+
export { e as ExportRoot, r as enTranslations, t as useExport, n as useExportStore };
|
|
@@ -2,5 +2,4 @@
|
|
|
2
2
|
* Create Export Page
|
|
3
3
|
* Multi-step form: select entities, configure options, review & start
|
|
4
4
|
*/
|
|
5
|
-
export declare function CreateExportPage(): import(
|
|
6
|
-
//# sourceMappingURL=CreateExportPage.d.ts.map
|
|
5
|
+
export declare function CreateExportPage(): import('react').JSX.Element;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { useExport as e } from "../providers/ExportProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { isExportEntityDisabled as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { ArrowLeft as
|
|
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 { isExportEntityDisabled as s, isForeignProductEntity as c } from "../utils/disabledModules.js";
|
|
8
|
+
import { useCallback as ne, useEffect as re, useRef as ie, useState as l } from "react";
|
|
9
|
+
import { ArrowLeft as ae, ArrowRight as u, Building2 as d, CalendarRange as oe, CheckCircle2 as f, Download as p, FileJson as m, FileSpreadsheet as h, Loader2 as g, Lock as _, Package as v, User as y, Users as b } from "lucide-react";
|
|
10
10
|
import { useAppShell as se, usePermission as ce } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
11
|
import { useSearchParams as le } from "react-router";
|
|
12
12
|
import { isQuotaExhaustedError as ue } from "@burdenoff/fe-libs/shared/utils";
|
|
13
13
|
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
14
|
-
import { AlertDialog as de, AlertDialogAction as
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
CSV:
|
|
18
|
-
JSON:
|
|
19
|
-
},
|
|
14
|
+
import { AlertDialog as de, AlertDialogAction as fe, AlertDialogCancel as pe, AlertDialogContent as me, AlertDialogDescription as he, AlertDialogFooter as ge, AlertDialogHeader as _e, AlertDialogTitle as ve, EmphasisPanel as ye, IllustratedEmptyState as be, PagePurpose as xe, ShowMore as Se } from "@burdenoff/fe-libs/ui";
|
|
15
|
+
// src/export/pages/CreateExportPage.tsx
|
|
16
|
+
var C = ["CSV", "JSON"], Ce = {
|
|
17
|
+
CSV: h,
|
|
18
|
+
JSON: m
|
|
19
|
+
}, w = {
|
|
20
20
|
INDIVIDUAL: y,
|
|
21
21
|
WORKSPACE_ADMIN: b,
|
|
22
|
-
ORG_ADMIN:
|
|
22
|
+
ORG_ADMIN: d
|
|
23
23
|
};
|
|
24
24
|
function T() {
|
|
25
|
-
let { basePath:
|
|
26
|
-
|
|
25
|
+
let { basePath: d = "/", navigate: m, organizationId: h } = e(), y = te(), { createJob: b, isPending: T } = n(), { data: E } = t(), { data: D } = r(), [O] = le(), { productSlug: k } = se(), A = ne((e) => !s(e) && !c(e, k), [k]), we = ce("export:workspace_admin"), Te = i(h), [j, M] = l("entities"), [N, P] = l([]), [F, I] = l(""), [L, R] = l("CSV"), [z, Ee] = l("INDIVIDUAL"), [B, V] = l(O.get("templateId") ?? void 0), [H, De] = l(""), [U, Oe] = l(""), [W, G] = l(null), [ke, K] = l(!1), q = ie(null);
|
|
26
|
+
re(() => {
|
|
27
27
|
let e = O.get("templateId");
|
|
28
28
|
if (!e || !D?.length || q.current === e) return;
|
|
29
29
|
let t = D.find((t) => t.id === e);
|
|
30
30
|
if (!t) return;
|
|
31
31
|
q.current = e, V(t.id), P((t.entityTypes ?? []).filter(A));
|
|
32
32
|
let n = t.format?.toUpperCase();
|
|
33
|
-
n &&
|
|
33
|
+
n && C.includes(n) && R(n), t.name && I(t.name);
|
|
34
34
|
}, [
|
|
35
35
|
A,
|
|
36
36
|
O,
|
|
37
37
|
D
|
|
38
38
|
]);
|
|
39
39
|
let Ae = () => {
|
|
40
|
-
j === "options" ? M("entities") : j === "review" ? M("options") :
|
|
40
|
+
j === "options" ? M("entities") : j === "review" ? M("options") : m?.(d);
|
|
41
41
|
}, je = () => {
|
|
42
42
|
if (j === "entities") {
|
|
43
43
|
if (N.length === 0) {
|
|
@@ -59,11 +59,11 @@ function T() {
|
|
|
59
59
|
entityTypes: N,
|
|
60
60
|
format: L,
|
|
61
61
|
exportScope: z,
|
|
62
|
-
organizationId: z === "ORG_ADMIN" ?
|
|
62
|
+
organizationId: z === "ORG_ADMIN" ? h : void 0,
|
|
63
63
|
templateId: B,
|
|
64
64
|
dateRangeStart: H ? new Date(H).toISOString() : null,
|
|
65
65
|
dateRangeEnd: U ? new Date(U).toISOString() : null
|
|
66
|
-
}),
|
|
66
|
+
}), m?.(d);
|
|
67
67
|
} catch (e) {
|
|
68
68
|
if (ue(e)) {
|
|
69
69
|
K(!0), G(y("export.create.errors.quotaReached", "You have reached your export limit for this month."));
|
|
@@ -120,7 +120,7 @@ function T() {
|
|
|
120
120
|
label: y("export.create.entities.calendar.label", "Calendar Events"),
|
|
121
121
|
description: y("export.create.entities.calendar.description", "Events and bookings")
|
|
122
122
|
}
|
|
123
|
-
}, X = E.filter((e) => e.enabled !== !1 && !
|
|
123
|
+
}, X = E.filter((e) => e.enabled !== !1 && !c(e.entityType, k)), Z = X.filter((e) => !s(e.entityType)), Q = X.filter((e) => s(e.entityType)), $ = (e, t) => {
|
|
124
124
|
let n = !t && N.includes(e.entityType);
|
|
125
125
|
return /* @__PURE__ */ S("button", {
|
|
126
126
|
type: "button",
|
|
@@ -128,7 +128,7 @@ function T() {
|
|
|
128
128
|
disabled: t,
|
|
129
129
|
"aria-disabled": t,
|
|
130
130
|
title: t ? y("export.create.select.unavailableHint", "Export for this product isn't available yet") : void 0,
|
|
131
|
-
className:
|
|
131
|
+
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"),
|
|
132
132
|
children: [
|
|
133
133
|
/* @__PURE__ */ S("div", {
|
|
134
134
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
@@ -138,7 +138,7 @@ function T() {
|
|
|
138
138
|
}), t ? /* @__PURE__ */ x("span", {
|
|
139
139
|
className: "shrink-0 text-xs font-medium px-2 py-0.5 rounded-full bg-bg-sunken text-text-secondary",
|
|
140
140
|
children: y("export.create.select.unavailable", "Unavailable")
|
|
141
|
-
}) : n && /* @__PURE__ */ x(
|
|
141
|
+
}) : n && /* @__PURE__ */ x(f, {
|
|
142
142
|
size: 18,
|
|
143
143
|
className: "text-primary"
|
|
144
144
|
})]
|
|
@@ -154,7 +154,7 @@ function T() {
|
|
|
154
154
|
]
|
|
155
155
|
}, e.entityType);
|
|
156
156
|
};
|
|
157
|
-
return /* @__PURE__ */ S(
|
|
157
|
+
return /* @__PURE__ */ S(ee, {
|
|
158
158
|
showHeader: !1,
|
|
159
159
|
children: [
|
|
160
160
|
/* @__PURE__ */ x("div", {
|
|
@@ -163,15 +163,15 @@ function T() {
|
|
|
163
163
|
className: "relative z-10 flex items-center gap-4",
|
|
164
164
|
children: [/* @__PURE__ */ x("button", {
|
|
165
165
|
type: "button",
|
|
166
|
-
onClick: () =>
|
|
166
|
+
onClick: () => m?.(d),
|
|
167
167
|
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",
|
|
168
168
|
"aria-label": y("export.create.actions.backToDashboard", "Back to export dashboard"),
|
|
169
|
-
children: /* @__PURE__ */ x(
|
|
169
|
+
children: /* @__PURE__ */ x(ae, { size: 20 })
|
|
170
170
|
}), /* @__PURE__ */ S("div", {
|
|
171
171
|
className: "flex items-center gap-3",
|
|
172
172
|
children: [/* @__PURE__ */ x("div", {
|
|
173
173
|
className: "p-2.5 rounded-lg bg-action-primary-bg/10 backdrop-blur-sm",
|
|
174
|
-
children: /* @__PURE__ */ x(
|
|
174
|
+
children: /* @__PURE__ */ x(p, {
|
|
175
175
|
size: 24,
|
|
176
176
|
className: "text-primary"
|
|
177
177
|
})
|
|
@@ -182,8 +182,8 @@ function T() {
|
|
|
182
182
|
})]
|
|
183
183
|
})
|
|
184
184
|
}),
|
|
185
|
-
/* @__PURE__ */ x(
|
|
186
|
-
icon: /* @__PURE__ */ x(
|
|
185
|
+
/* @__PURE__ */ x(xe, {
|
|
186
|
+
icon: /* @__PURE__ */ x(p, { size: 16 }),
|
|
187
187
|
children: y("export.create.purpose", "Build a one-off export in three steps: pick which data to include, choose a format and scope, then review and start it. The export runs in the background and produces a downloadable ZIP you can grab from History when it finishes.")
|
|
188
188
|
}),
|
|
189
189
|
/* @__PURE__ */ x("div", {
|
|
@@ -194,11 +194,11 @@ function T() {
|
|
|
194
194
|
"review"
|
|
195
195
|
].map((e, t) => /* @__PURE__ */ S("div", {
|
|
196
196
|
className: "flex items-center gap-2",
|
|
197
|
-
children: [t > 0 && /* @__PURE__ */ x(
|
|
197
|
+
children: [t > 0 && /* @__PURE__ */ x(u, {
|
|
198
198
|
size: 18,
|
|
199
199
|
className: "text-text-secondary"
|
|
200
200
|
}), /* @__PURE__ */ S("div", {
|
|
201
|
-
className:
|
|
201
|
+
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"),
|
|
202
202
|
children: [/* @__PURE__ */ x("div", {
|
|
203
203
|
className: "flex items-center justify-center size-6 rounded-full bg-bg-surface/20 font-bold",
|
|
204
204
|
children: t + 1
|
|
@@ -224,7 +224,7 @@ function T() {
|
|
|
224
224
|
className: "text-sm text-text-secondary",
|
|
225
225
|
children: y("export.create.select.description", "Choose which entity types to include in your export.")
|
|
226
226
|
}),
|
|
227
|
-
X.length === 0 ? /* @__PURE__ */ x(
|
|
227
|
+
X.length === 0 ? /* @__PURE__ */ x(be, {
|
|
228
228
|
illustration: "empty-data",
|
|
229
229
|
title: y("export.create.select.emptyTitle", "Nothing to export yet"),
|
|
230
230
|
description: y("export.create.select.empty", "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.")
|
|
@@ -272,12 +272,12 @@ function T() {
|
|
|
272
272
|
"WORKSPACE_ADMIN",
|
|
273
273
|
"ORG_ADMIN"
|
|
274
274
|
].map((e) => {
|
|
275
|
-
let t = e === "WORKSPACE_ADMIN" && !we || e === "ORG_ADMIN" && !Te, n =
|
|
275
|
+
let t = e === "WORKSPACE_ADMIN" && !we || e === "ORG_ADMIN" && !Te, n = w[e], r = e === "WORKSPACE_ADMIN" ? y("export.create.scope.workspaceAdmin.required", "Workspace admin access required") : y("export.create.scope.orgAdmin.required", "Organization admin access required");
|
|
276
276
|
return /* @__PURE__ */ S("button", {
|
|
277
277
|
type: "button",
|
|
278
278
|
onClick: () => !t && Ee(e),
|
|
279
279
|
disabled: t,
|
|
280
|
-
className:
|
|
280
|
+
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"),
|
|
281
281
|
title: t ? r : void 0,
|
|
282
282
|
children: [
|
|
283
283
|
/* @__PURE__ */ S("div", {
|
|
@@ -287,11 +287,11 @@ function T() {
|
|
|
287
287
|
size: 18,
|
|
288
288
|
className: z === e ? "text-primary" : t ? "text-text-secondary/50" : "text-text-secondary"
|
|
289
289
|
}),
|
|
290
|
-
z === e && /* @__PURE__ */ x(
|
|
290
|
+
z === e && /* @__PURE__ */ x(f, {
|
|
291
291
|
size: 16,
|
|
292
292
|
className: "text-primary"
|
|
293
293
|
}),
|
|
294
|
-
t && /* @__PURE__ */ x(
|
|
294
|
+
t && /* @__PURE__ */ x(_, {
|
|
295
295
|
size: 14,
|
|
296
296
|
className: "text-text-secondary/50"
|
|
297
297
|
})
|
|
@@ -334,18 +334,18 @@ function T() {
|
|
|
334
334
|
children: y("export.create.options.outputFormat", "Output Format")
|
|
335
335
|
}), /* @__PURE__ */ x("div", {
|
|
336
336
|
className: "grid grid-cols-2 gap-3",
|
|
337
|
-
children:
|
|
338
|
-
let t =
|
|
337
|
+
children: C.map((e) => {
|
|
338
|
+
let t = Ce[e];
|
|
339
339
|
return /* @__PURE__ */ S("button", {
|
|
340
340
|
type: "button",
|
|
341
341
|
onClick: () => R(e),
|
|
342
|
-
className:
|
|
342
|
+
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"),
|
|
343
343
|
children: [/* @__PURE__ */ x(t, {
|
|
344
344
|
size: 18,
|
|
345
345
|
className: L === e ? "text-primary" : "text-text-secondary"
|
|
346
346
|
}), /* @__PURE__ */ x("span", {
|
|
347
347
|
className: "font-medium text-sm",
|
|
348
|
-
children:
|
|
348
|
+
children: a(e)
|
|
349
349
|
})]
|
|
350
350
|
}, e);
|
|
351
351
|
})
|
|
@@ -358,8 +358,8 @@ function T() {
|
|
|
358
358
|
/* @__PURE__ */ x("div", {
|
|
359
359
|
className: "flex gap-3",
|
|
360
360
|
children: /* @__PURE__ */ S("div", {
|
|
361
|
-
className:
|
|
362
|
-
children: [/* @__PURE__ */ x(
|
|
361
|
+
className: o("flex items-center gap-2 border-2 rounded-lg px-4 py-2 border-primary bg-action-primary-bg/5"),
|
|
362
|
+
children: [/* @__PURE__ */ x(v, {
|
|
363
363
|
size: 16,
|
|
364
364
|
className: "text-primary"
|
|
365
365
|
}), /* @__PURE__ */ x("span", {
|
|
@@ -373,7 +373,7 @@ function T() {
|
|
|
373
373
|
children: y("export.create.options.archiveDescription", "Exports are packaged as ZIP archives.")
|
|
374
374
|
})
|
|
375
375
|
] }),
|
|
376
|
-
/* @__PURE__ */ x(
|
|
376
|
+
/* @__PURE__ */ x(Se, {
|
|
377
377
|
collapsedHeight: 0,
|
|
378
378
|
label: y("export.create.options.advancedToggle", "Date range & template"),
|
|
379
379
|
children: /* @__PURE__ */ S("div", {
|
|
@@ -384,7 +384,7 @@ function T() {
|
|
|
384
384
|
children: /* @__PURE__ */ S("span", {
|
|
385
385
|
className: "inline-flex items-center gap-1.5",
|
|
386
386
|
children: [
|
|
387
|
-
/* @__PURE__ */ x(
|
|
387
|
+
/* @__PURE__ */ x(oe, { size: 15 }),
|
|
388
388
|
y("export.create.options.dateRange", "Date Range"),
|
|
389
389
|
" ",
|
|
390
390
|
/* @__PURE__ */ x("span", {
|
|
@@ -453,7 +453,7 @@ function T() {
|
|
|
453
453
|
" ",
|
|
454
454
|
/* @__PURE__ */ x("button", {
|
|
455
455
|
type: "button",
|
|
456
|
-
onClick: () =>
|
|
456
|
+
onClick: () => m?.(d + "/templates"),
|
|
457
457
|
className: "text-primary underline-offset-2 hover:underline",
|
|
458
458
|
children: y("export.create.options.createTemplateLink", "Create one")
|
|
459
459
|
}),
|
|
@@ -468,11 +468,11 @@ function T() {
|
|
|
468
468
|
}),
|
|
469
469
|
j === "review" && /* @__PURE__ */ x("div", {
|
|
470
470
|
className: "space-y-6",
|
|
471
|
-
children: /* @__PURE__ */ S(
|
|
471
|
+
children: /* @__PURE__ */ S(ye, {
|
|
472
472
|
className: "p-6 space-y-4",
|
|
473
473
|
children: [/* @__PURE__ */ S("h2", {
|
|
474
474
|
className: "text-lg font-bold flex items-center gap-2",
|
|
475
|
-
children: [/* @__PURE__ */ x(
|
|
475
|
+
children: [/* @__PURE__ */ x(f, {
|
|
476
476
|
size: 20,
|
|
477
477
|
className: "text-primary"
|
|
478
478
|
}), y("export.create.review.title", "Review Export")]
|
|
@@ -493,7 +493,7 @@ function T() {
|
|
|
493
493
|
},
|
|
494
494
|
{
|
|
495
495
|
label: y("export.create.review.fields.format", "Format"),
|
|
496
|
-
value:
|
|
496
|
+
value: a(L)
|
|
497
497
|
},
|
|
498
498
|
{
|
|
499
499
|
label: y("export.create.review.fields.archive", "Archive"),
|
|
@@ -532,21 +532,21 @@ function T() {
|
|
|
532
532
|
onClick: Me,
|
|
533
533
|
disabled: T,
|
|
534
534
|
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",
|
|
535
|
-
children: [T ? /* @__PURE__ */ x(
|
|
535
|
+
children: [T ? /* @__PURE__ */ x(g, {
|
|
536
536
|
size: 18,
|
|
537
537
|
className: "animate-spin"
|
|
538
|
-
}) : /* @__PURE__ */ x(
|
|
538
|
+
}) : /* @__PURE__ */ x(p, { size: 18 }), y("export.create.actions.startExport", "Start Export")]
|
|
539
539
|
}) : /* @__PURE__ */ S("button", {
|
|
540
540
|
type: "button",
|
|
541
541
|
onClick: je,
|
|
542
542
|
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",
|
|
543
|
-
children: [y("export.create.actions.next", "Next"), /* @__PURE__ */ x(
|
|
543
|
+
children: [y("export.create.actions.next", "Next"), /* @__PURE__ */ x(u, { size: 18 })]
|
|
544
544
|
})]
|
|
545
545
|
}),
|
|
546
546
|
/* @__PURE__ */ x(de, {
|
|
547
547
|
open: ke,
|
|
548
548
|
onOpenChange: K,
|
|
549
|
-
children: /* @__PURE__ */ S(
|
|
549
|
+
children: /* @__PURE__ */ S(me, { children: [/* @__PURE__ */ S(_e, { children: [/* @__PURE__ */ x(ve, { children: y("export.create.quotaDialog.title", "Export Limit Reached") }), /* @__PURE__ */ x(he, { children: y("export.create.quotaDialog.description", "You have reached your export limit for this month.") })] }), /* @__PURE__ */ S(ge, { children: [/* @__PURE__ */ x(pe, { children: y("export.create.quotaDialog.dismiss", "Dismiss") }), /* @__PURE__ */ x(fe, {
|
|
550
550
|
onClick: () => window.location.assign("/billing"),
|
|
551
551
|
children: y("export.create.quotaDialog.viewBilling", "View Billing")
|
|
552
552
|
})] })] })
|
|
@@ -554,7 +554,6 @@ function T() {
|
|
|
554
554
|
]
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
//#endregion
|
|
558
557
|
export { T as CreateExportPage };
|
|
559
558
|
|
|
560
559
|
//# sourceMappingURL=CreateExportPage.js.map
|