@burdenoff/microfe-integrations 2026.1107.1 → 2026.1109.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/generated/global-operations.d.ts +4 -2
- package/dist/generated/global-types.d.ts +210 -190
- package/dist/generated/wspace-operations.d.ts +1195 -670
- package/dist/generated/wspace-operations.js +265 -149
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +8728 -376
- package/dist/generated/wspace-types.js +6 -3
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/integrations/ConnectSourceDialog.d.ts +0 -2
- package/dist/integrations/ConnectSourceDialog.js +13 -14
- package/dist/integrations/ConnectSourceDialog.js.map +1 -1
- package/dist/integrations/ConnectionsPanel.d.ts +0 -2
- package/dist/integrations/ConnectionsPanel.js +5 -6
- package/dist/integrations/ConnectionsPanel.js.map +1 -1
- package/dist/integrations/IntegrationsAdminRoot.d.ts +0 -2
- package/dist/integrations/IntegrationsAdminRoot.js +14 -11
- package/dist/integrations/IntegrationsAdminRoot.js.map +1 -1
- package/dist/integrations/IntegrationsAdminRoutes.d.ts +1 -2
- package/dist/integrations/IntegrationsAdminRoutes.js +1 -2
- package/dist/integrations/IntegrationsAdminRoutes.js.map +1 -1
- package/dist/integrations/IntegrationsRoot.d.ts +0 -2
- package/dist/integrations/IntegrationsRoot.js +9 -6
- package/dist/integrations/IntegrationsRoot.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts +1 -2
- package/dist/integrations/IntegrationsUserRoutes.js +7 -8
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts +1 -3
- package/dist/integrations/components/AddConnectionDialog.js +12 -15
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts +0 -2
- package/dist/integrations/components/AuthMethodsEditor.js +1 -2
- package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
- package/dist/integrations/components/ConfirmDialog.d.ts +1 -3
- package/dist/integrations/components/ConfirmDialog.js +1 -2
- package/dist/integrations/components/ConfirmDialog.js.map +1 -1
- package/dist/integrations/components/ConnectionCard.d.ts +0 -2
- package/dist/integrations/components/ConnectionCard.js +9 -10
- package/dist/integrations/components/ConnectionCard.js.map +1 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts +0 -2
- package/dist/integrations/components/ConnectionModalFrame.js +2 -3
- package/dist/integrations/components/ConnectionModalFrame.js.map +1 -1
- package/dist/integrations/components/ConnectionSharing.d.ts +0 -2
- package/dist/integrations/components/ConnectionSharing.js +7 -8
- package/dist/integrations/components/ConnectionSharing.js.map +1 -1
- package/dist/integrations/components/ConnectionStatusBadge.d.ts +0 -2
- package/dist/integrations/components/ConnectionStatusBadge.js +1 -2
- package/dist/integrations/components/ConnectionStatusBadge.js.map +1 -1
- package/dist/integrations/components/ConnectorSubmissionCard.d.ts +2 -4
- package/dist/integrations/components/ConnectorSubmissionCard.js +8 -9
- package/dist/integrations/components/ConnectorSubmissionCard.js.map +1 -1
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts +1 -2
- package/dist/integrations/components/ConnectorSubmissionPager.js +1 -2
- package/dist/integrations/components/ConnectorSubmissionPager.js.map +1 -1
- package/dist/integrations/components/MailMessageBody.d.ts +5 -0
- package/dist/integrations/components/MailMessageBody.js +174 -0
- package/dist/integrations/components/MailMessageBody.js.map +1 -0
- package/dist/integrations/components/ProviderCard.d.ts +0 -2
- package/dist/integrations/components/ProviderCard.js +8 -9
- package/dist/integrations/components/ProviderCard.js.map +1 -1
- package/dist/integrations/constants/featureFlags.d.ts +0 -1
- package/dist/integrations/constants/featureFlags.js +1 -2
- package/dist/integrations/constants/featureFlags.js.map +1 -1
- package/dist/integrations/constants/permissions.d.ts +0 -1
- package/dist/integrations/constants/permissions.js +1 -2
- package/dist/integrations/constants/permissions.js.map +1 -1
- package/dist/integrations/events/integrations-events.d.ts +0 -1
- package/dist/integrations/events/useIntegrationsEventBus.d.ts +0 -2
- package/dist/integrations/events/useIntegrationsEventBus.js +1 -2
- package/dist/integrations/events/useIntegrationsEventBus.js.map +1 -1
- package/dist/integrations/hooks/useConnections.d.ts +3 -14
- package/dist/integrations/hooks/useConnections.js +74 -75
- package/dist/integrations/hooks/useConnections.js.map +1 -1
- package/dist/integrations/hooks/useConnectorSubmissions.d.ts +2 -10
- package/dist/integrations/hooks/useConnectorSubmissions.js +23 -24
- package/dist/integrations/hooks/useConnectorSubmissions.js.map +1 -1
- package/dist/integrations/hooks/useFormatDate.d.ts +0 -1
- package/dist/integrations/hooks/useFormatDate.js +1 -2
- package/dist/integrations/hooks/useFormatDate.js.map +1 -1
- package/dist/integrations/hooks/useFormatLastUsed.d.ts +0 -1
- package/dist/integrations/hooks/useFormatLastUsed.js +1 -2
- package/dist/integrations/hooks/useFormatLastUsed.js.map +1 -1
- package/dist/integrations/hooks/useLabel.d.ts +0 -2
- package/dist/integrations/hooks/useLabel.js +1 -2
- package/dist/integrations/hooks/useLabel.js.map +1 -1
- package/dist/integrations/hooks/useLogs.d.ts +1 -6
- package/dist/integrations/hooks/useLogs.js +6 -7
- package/dist/integrations/hooks/useLogs.js.map +1 -1
- package/dist/integrations/hooks/useMailbox.d.ts +77 -40
- package/dist/integrations/hooks/useMailbox.js +113 -35
- package/dist/integrations/hooks/useMailbox.js.map +1 -1
- package/dist/integrations/hooks/useProviders.d.ts +3 -14
- package/dist/integrations/hooks/useProviders.js +42 -43
- package/dist/integrations/hooks/useProviders.js.map +1 -1
- package/dist/integrations/hooks/useTr.d.ts +0 -1
- package/dist/integrations/hooks/useTr.js +1 -2
- package/dist/integrations/hooks/useTr.js.map +1 -1
- package/dist/integrations/index.d.ts +0 -1
- package/dist/integrations/index.js +9 -8
- package/dist/integrations/pages/AddConnectionWizard.d.ts +1 -2
- package/dist/integrations/pages/AddConnectionWizard.js +291 -306
- package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts +1 -2
- package/dist/integrations/pages/ConnectionDetail.js +241 -246
- package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
- package/dist/integrations/pages/ConnectionLogs.d.ts +1 -2
- package/dist/integrations/pages/ConnectionLogs.js +154 -155
- package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
- package/dist/integrations/pages/ConnectionsList.d.ts +1 -2
- package/dist/integrations/pages/ConnectionsList.js +40 -41
- package/dist/integrations/pages/ConnectionsList.js.map +1 -1
- package/dist/integrations/pages/ConnectorReviewQueuePage.d.ts +1 -2
- package/dist/integrations/pages/ConnectorReviewQueuePage.js +9 -10
- package/dist/integrations/pages/ConnectorReviewQueuePage.js.map +1 -1
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts +1 -2
- package/dist/integrations/pages/ConnectorSubmissionsPage.js +138 -139
- package/dist/integrations/pages/ConnectorSubmissionsPage.js.map +1 -1
- package/dist/integrations/pages/IntegrationsOverview.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsOverview.js +35 -36
- package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
- package/dist/integrations/pages/IntegrationsSettings.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsSettings.js +7 -8
- package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts +1 -2
- package/dist/integrations/pages/IntegrationsUserLandingPage.js +1 -2
- package/dist/integrations/pages/IntegrationsUserLandingPage.js.map +1 -1
- package/dist/integrations/pages/MailboxInbox.d.ts +1 -2
- package/dist/integrations/pages/MailboxInbox.js +442 -280
- package/dist/integrations/pages/MailboxInbox.js.map +1 -1
- package/dist/integrations/pages/ProviderCatalog.d.ts +1 -2
- package/dist/integrations/pages/ProviderCatalog.js +107 -108
- package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.d.ts +1 -2
- package/dist/integrations/pages/ProviderDetail.js +21 -22
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/dist/integrations/pages/ProviderEditorPage.d.ts +1 -2
- package/dist/integrations/pages/ProviderEditorPage.js +261 -264
- package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts +0 -2
- package/dist/integrations/providers/IntegrationsProvider.js +109 -96
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/store/integrationsStore.d.ts +0 -2
- package/dist/integrations/store/integrationsStore.js +1 -2
- package/dist/integrations/store/integrationsStore.js.map +1 -1
- package/dist/integrations/store/mailboxStore.d.ts +3 -2
- package/dist/integrations/store/mailboxStore.js +8 -2
- package/dist/integrations/store/mailboxStore.js.map +1 -1
- package/dist/integrations/translations/en.d.ts +0 -1
- package/dist/integrations/types/index.d.ts +0 -1
- package/dist/integrations/utils/appearance.d.ts +0 -1
- package/dist/integrations/utils/appearance.js +1 -2
- package/dist/integrations/utils/appearance.js.map +1 -1
- package/dist/integrations/utils/cn.d.ts +0 -2
- package/dist/integrations/utils/cn.js +2 -3
- package/dist/integrations/utils/cn.js.map +1 -1
- package/dist/integrations/utils/constants.d.ts +0 -1
- package/dist/integrations/utils/constants.js +1 -2
- package/dist/integrations/utils/constants.js.map +1 -1
- package/dist/integrations/utils/integrationsHelpers.d.ts +0 -2
- package/dist/integrations/utils/integrationsHelpers.js +1 -2
- package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
- package/dist/integrations/utils/mailHtml.d.ts +31 -0
- package/dist/integrations/utils/mailHtml.js +126 -0
- package/dist/integrations/utils/mailHtml.js.map +1 -0
- package/dist/integrations/utils/mappers.d.ts +0 -2
- package/dist/integrations/utils/mappers.js +2 -3
- package/dist/integrations/utils/mappers.js.map +1 -1
- package/dist/integrations/utils/navigation.d.ts +0 -1
- package/dist/integrations/utils/navigation.js +2 -8
- package/dist/integrations/utils/navigation.js.map +1 -1
- package/dist/integrations/utils/paths.d.ts +0 -1
- package/dist/integrations/utils/paths.js +1 -2
- package/dist/integrations/utils/paths.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/dompurify/dist/purify.es.js +878 -0
- package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
- 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/utils/nativeBridge.d.ts +0 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +67 -50
- package/dist/dev/main.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/integrations/ConnectSourceDialog.d.ts.map +0 -1
- package/dist/integrations/ConnectionsPanel.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsAdminRoutes.d.ts.map +0 -1
- package/dist/integrations/IntegrationsRoot.d.ts.map +0 -1
- package/dist/integrations/IntegrationsUserRoutes.d.ts.map +0 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +0 -1
- package/dist/integrations/components/AuthMethodsEditor.d.ts.map +0 -1
- package/dist/integrations/components/ConfirmDialog.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionCard.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionModalFrame.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionSharing.d.ts.map +0 -1
- package/dist/integrations/components/ConnectionStatusBadge.d.ts.map +0 -1
- package/dist/integrations/components/ConnectorSubmissionCard.d.ts.map +0 -1
- package/dist/integrations/components/ConnectorSubmissionPager.d.ts.map +0 -1
- package/dist/integrations/components/ProviderCard.d.ts.map +0 -1
- package/dist/integrations/constants/featureFlags.d.ts.map +0 -1
- package/dist/integrations/constants/permissions.d.ts.map +0 -1
- package/dist/integrations/events/integrations-events.d.ts.map +0 -1
- package/dist/integrations/events/useIntegrationsEventBus.d.ts.map +0 -1
- package/dist/integrations/hooks/useConnections.d.ts.map +0 -1
- package/dist/integrations/hooks/useConnectorSubmissions.d.ts.map +0 -1
- package/dist/integrations/hooks/useFormatDate.d.ts.map +0 -1
- package/dist/integrations/hooks/useFormatLastUsed.d.ts.map +0 -1
- package/dist/integrations/hooks/useLabel.d.ts.map +0 -1
- package/dist/integrations/hooks/useLogs.d.ts.map +0 -1
- package/dist/integrations/hooks/useMailbox.d.ts.map +0 -1
- package/dist/integrations/hooks/useProviders.d.ts.map +0 -1
- package/dist/integrations/hooks/useTr.d.ts.map +0 -1
- package/dist/integrations/index.d.ts.map +0 -1
- package/dist/integrations/pages/AddConnectionWizard.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionLogs.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectionsList.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectorReviewQueuePage.d.ts.map +0 -1
- package/dist/integrations/pages/ConnectorSubmissionsPage.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsOverview.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsSettings.d.ts.map +0 -1
- package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts.map +0 -1
- package/dist/integrations/pages/MailboxInbox.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderCatalog.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderDetail.d.ts.map +0 -1
- package/dist/integrations/pages/ProviderEditorPage.d.ts.map +0 -1
- package/dist/integrations/providers/IntegrationsProvider.d.ts.map +0 -1
- package/dist/integrations/store/integrationsStore.d.ts.map +0 -1
- package/dist/integrations/store/mailboxStore.d.ts.map +0 -1
- package/dist/integrations/translations/en.d.ts.map +0 -1
- package/dist/integrations/types/index.d.ts.map +0 -1
- package/dist/integrations/utils/appearance.d.ts.map +0 -1
- package/dist/integrations/utils/cn.d.ts.map +0 -1
- package/dist/integrations/utils/constants.d.ts.map +0 -1
- package/dist/integrations/utils/integrationsHelpers.d.ts.map +0 -1
- package/dist/integrations/utils/mappers.d.ts.map +0 -1
- package/dist/integrations/utils/navigation.d.ts.map +0 -1
- package/dist/integrations/utils/paths.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnectorSubmissions.js","names":[],"sources":["../../../src/integrations/hooks/useConnectorSubmissions.ts"],"sourcesContent":["/**\n * Third-party connector submissions (BOFF-4417).\n *\n * Developers submit connectors for the integrations catalog and follow their\n * review; platform reviewers (super admins) work the review queue. The service\n * scopes the developer queries to the caller, so these hooks carry no ids.\n */\nimport { useCallback } from 'react';\n\nimport {\n type ConnectorSubmissionFieldsFragment,\n useApproveConnectorSubmissionMutation,\n useConnectorSubmissionsQuery,\n useMyConnectorSubmissionsQuery,\n useRejectConnectorSubmissionMutation,\n useSubmitConnectorMutation,\n useUpdateConnectorSubmissionOAuthClientMutation,\n useWithdrawConnectorSubmissionMutation,\n} from '../../generated/wspace-operations';\nimport {\n type ConnectorOAuthClientInput,\n ConnectorSubmissionStatus,\n type SubmitConnectorInput,\n} from '../../generated/wspace-types';\n\nexport type ConnectorSubmission = ConnectorSubmissionFieldsFragment;\nexport type ConnectorSubmissionInput = SubmitConnectorInput;\nexport { ConnectorSubmissionStatus };\n\n/** Rows per page. The service caps a page at 100. */\nexport const CONNECTOR_SUBMISSION_PAGE_SIZE = 25;\nconst REFETCH = ['MyConnectorSubmissions', 'ConnectorSubmissions'];\n\nfunction page(offset: number) {\n return { limit: CONNECTOR_SUBMISSION_PAGE_SIZE, offset: Math.max(0, Math.trunc(offset)) };\n}\n\n/** One page of the caller's own submissions, newest first. */\nexport function useMyConnectorSubmissions(offset = 0) {\n const { data, dataState, loading, error, refetch } = useMyConnectorSubmissionsQuery({\n variables: { pagination: page(offset) },\n fetchPolicy: 'cache-and-network',\n errorPolicy: 'all',\n });\n // Only a complete result carries fully typed rows; partial data (an error\n // with errorPolicy 'all') is treated as empty so the page shows the error.\n const complete = dataState === 'complete' ? data : null;\n const submissions: ConnectorSubmission[] = complete?.myConnectorSubmissions.items ?? [];\n return {\n submissions,\n total: complete?.myConnectorSubmissions.total ?? 0,\n hasMore: complete?.myConnectorSubmissions.hasMore ?? false,\n loading,\n error,\n refetch,\n };\n}\n\n/** One page of the review queue (oldest first) and its counters. Super admins only. */\nexport function useConnectorReviewQueue(status: ConnectorSubmissionStatus | null, offset = 0) {\n const { data, dataState, loading, error, refetch } = useConnectorSubmissionsQuery({\n variables: { filter: status ? { status } : null, pagination: page(offset) },\n fetchPolicy: 'cache-and-network',\n errorPolicy: 'all',\n });\n const complete = dataState === 'complete' ? data : null;\n const submissions: ConnectorSubmission[] = complete?.connectorSubmissions.items ?? [];\n return {\n submissions,\n total: complete?.connectorSubmissions.total ?? 0,\n hasMore: complete?.connectorSubmissions.hasMore ?? false,\n stats: complete?.connectorSubmissionReviewStats ?? null,\n loading,\n error,\n refetch,\n };\n}\n\nexport function useSubmitConnector() {\n const [mutate, { loading }] = useSubmitConnectorMutation({ refetchQueries: REFETCH });\n const submitConnector = useCallback(\n async (input: SubmitConnectorInput) => {\n const result = await mutate({ variables: { input } });\n return result.data?.submitConnector ?? null;\n },\n [mutate]\n );\n return { submitConnector, loading };\n}\n\nexport function useWithdrawConnectorSubmission() {\n const [mutate, { loading }] = useWithdrawConnectorSubmissionMutation({\n refetchQueries: REFETCH,\n });\n const withdraw = useCallback(\n async (id: string) => {\n const result = await mutate({ variables: { id } });\n return result.data?.withdrawConnectorSubmission ?? null;\n },\n [mutate]\n );\n return { withdraw, loading };\n}\n\n/**\n * Replace the OAuth client of one of the caller's OAuth submissions (BOFF-10637).\n * The secret is write-only: the result only says that one is stored.\n */\nexport function useUpdateConnectorSubmissionOAuthClient() {\n const [mutate, { loading }] = useUpdateConnectorSubmissionOAuthClientMutation({\n refetchQueries: REFETCH,\n });\n const updateOAuthClient = useCallback(\n async (id: string, input: ConnectorOAuthClientInput) => {\n const result = await mutate({ variables: { id, input } });\n return result.data?.updateConnectorSubmissionOAuthClient ?? null;\n },\n [mutate]\n );\n return { updateOAuthClient, loading };\n}\n\nexport function useReviewConnectorSubmission() {\n const [approveMutation, { loading: approving }] = useApproveConnectorSubmissionMutation({\n refetchQueries: [...REFETCH, 'GetProviders', 'GetProviderCatalog'],\n });\n const [rejectMutation, { loading: rejecting }] = useRejectConnectorSubmissionMutation({\n refetchQueries: REFETCH,\n });\n const approve = useCallback(\n async (id: string, notes: string | null) => {\n const result = await approveMutation({ variables: { id, notes } });\n return result.data?.approveConnectorSubmission ?? null;\n },\n [approveMutation]\n );\n const reject = useCallback(\n async (id: string, reason: string) => {\n const result = await rejectMutation({ variables: { id, reason } });\n return result.data?.rejectConnectorSubmission ?? null;\n },\n [rejectMutation]\n );\n return { approve, reject, loading: approving || rejecting };\n}\n"],"mappings":";;;AA+BA,
|
|
1
|
+
{"version":3,"file":"useConnectorSubmissions.js","names":["REFETCH","page","offset","useMyConnectorSubmissions","useMyConnectorSubmissionsQuery","complete","dataState","data","useConnectorReviewQueue","useConnectorSubmissionsQuery","status","useSubmitConnector","mutate","useSubmitConnectorMutation","useCallback","useWithdrawConnectorSubmission","useWithdrawConnectorSubmissionMutation","useUpdateConnectorSubmissionOAuthClient","useUpdateConnectorSubmissionOAuthClientMutation","useReviewConnectorSubmission","approveMutation","approving","useApproveConnectorSubmissionMutation","rejectMutation","rejecting","useRejectConnectorSubmissionMutation","ConnectorSubmissionStatus"],"sources":["../../../src/integrations/hooks/useConnectorSubmissions.ts"],"sourcesContent":["/**\n * Third-party connector submissions (BOFF-4417).\n *\n * Developers submit connectors for the integrations catalog and follow their\n * review; platform reviewers (super admins) work the review queue. The service\n * scopes the developer queries to the caller, so these hooks carry no ids.\n */\nimport { useCallback } from 'react';\n\nimport {\n type ConnectorSubmissionFieldsFragment,\n useApproveConnectorSubmissionMutation,\n useConnectorSubmissionsQuery,\n useMyConnectorSubmissionsQuery,\n useRejectConnectorSubmissionMutation,\n useSubmitConnectorMutation,\n useUpdateConnectorSubmissionOAuthClientMutation,\n useWithdrawConnectorSubmissionMutation,\n} from '../../generated/wspace-operations';\nimport {\n type ConnectorOAuthClientInput,\n ConnectorSubmissionStatus,\n type SubmitConnectorInput,\n} from '../../generated/wspace-types';\n\nexport type ConnectorSubmission = ConnectorSubmissionFieldsFragment;\nexport type ConnectorSubmissionInput = SubmitConnectorInput;\nexport { ConnectorSubmissionStatus };\n\n/** Rows per page. The service caps a page at 100. */\nexport const CONNECTOR_SUBMISSION_PAGE_SIZE = 25;\nconst REFETCH = ['MyConnectorSubmissions', 'ConnectorSubmissions'];\n\nfunction page(offset: number) {\n return { limit: CONNECTOR_SUBMISSION_PAGE_SIZE, offset: Math.max(0, Math.trunc(offset)) };\n}\n\n/** One page of the caller's own submissions, newest first. */\nexport function useMyConnectorSubmissions(offset = 0) {\n const { data, dataState, loading, error, refetch } = useMyConnectorSubmissionsQuery({\n variables: { pagination: page(offset) },\n fetchPolicy: 'cache-and-network',\n errorPolicy: 'all',\n });\n // Only a complete result carries fully typed rows; partial data (an error\n // with errorPolicy 'all') is treated as empty so the page shows the error.\n const complete = dataState === 'complete' ? data : null;\n const submissions: ConnectorSubmission[] = complete?.myConnectorSubmissions.items ?? [];\n return {\n submissions,\n total: complete?.myConnectorSubmissions.total ?? 0,\n hasMore: complete?.myConnectorSubmissions.hasMore ?? false,\n loading,\n error,\n refetch,\n };\n}\n\n/** One page of the review queue (oldest first) and its counters. Super admins only. */\nexport function useConnectorReviewQueue(status: ConnectorSubmissionStatus | null, offset = 0) {\n const { data, dataState, loading, error, refetch } = useConnectorSubmissionsQuery({\n variables: { filter: status ? { status } : null, pagination: page(offset) },\n fetchPolicy: 'cache-and-network',\n errorPolicy: 'all',\n });\n const complete = dataState === 'complete' ? data : null;\n const submissions: ConnectorSubmission[] = complete?.connectorSubmissions.items ?? [];\n return {\n submissions,\n total: complete?.connectorSubmissions.total ?? 0,\n hasMore: complete?.connectorSubmissions.hasMore ?? false,\n stats: complete?.connectorSubmissionReviewStats ?? null,\n loading,\n error,\n refetch,\n };\n}\n\nexport function useSubmitConnector() {\n const [mutate, { loading }] = useSubmitConnectorMutation({ refetchQueries: REFETCH });\n const submitConnector = useCallback(\n async (input: SubmitConnectorInput) => {\n const result = await mutate({ variables: { input } });\n return result.data?.submitConnector ?? null;\n },\n [mutate]\n );\n return { submitConnector, loading };\n}\n\nexport function useWithdrawConnectorSubmission() {\n const [mutate, { loading }] = useWithdrawConnectorSubmissionMutation({\n refetchQueries: REFETCH,\n });\n const withdraw = useCallback(\n async (id: string) => {\n const result = await mutate({ variables: { id } });\n return result.data?.withdrawConnectorSubmission ?? null;\n },\n [mutate]\n );\n return { withdraw, loading };\n}\n\n/**\n * Replace the OAuth client of one of the caller's OAuth submissions (BOFF-10637).\n * The secret is write-only: the result only says that one is stored.\n */\nexport function useUpdateConnectorSubmissionOAuthClient() {\n const [mutate, { loading }] = useUpdateConnectorSubmissionOAuthClientMutation({\n refetchQueries: REFETCH,\n });\n const updateOAuthClient = useCallback(\n async (id: string, input: ConnectorOAuthClientInput) => {\n const result = await mutate({ variables: { id, input } });\n return result.data?.updateConnectorSubmissionOAuthClient ?? null;\n },\n [mutate]\n );\n return { updateOAuthClient, loading };\n}\n\nexport function useReviewConnectorSubmission() {\n const [approveMutation, { loading: approving }] = useApproveConnectorSubmissionMutation({\n refetchQueries: [...REFETCH, 'GetProviders', 'GetProviderCatalog'],\n });\n const [rejectMutation, { loading: rejecting }] = useRejectConnectorSubmissionMutation({\n refetchQueries: REFETCH,\n });\n const approve = useCallback(\n async (id: string, notes: string | null) => {\n const result = await approveMutation({ variables: { id, notes } });\n return result.data?.approveConnectorSubmission ?? null;\n },\n [approveMutation]\n );\n const reject = useCallback(\n async (id: string, reason: string) => {\n const result = await rejectMutation({ variables: { id, reason } });\n return result.data?.rejectConnectorSubmission ?? null;\n },\n [rejectMutation]\n );\n return { approve, reject, loading: approving || rejecting };\n}\n"],"mappings":";;;AA+BA,IAAMA,IAAU,CAAC,0BAA0B,sBAAsB;AAEjE,SAASC,EAAK,GAAgB;CAC5B,OAAO;EAAE,OAAA;EAAuC,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAM,CAAC;CAAE;AAC1F;AAGA,SAAgBC,EAA0B,IAAS,GAAG;CACpD,IAAM,EAAE,SAAM,cAAW,YAAS,UAAO,eAAYC,EAA+B;EAClF,WAAW,EAAE,YAAYH,EAAKC,CAAM,EAAE;EACtC,aAAa;EACb,aAAa;CACf,CAAC,GAGKG,IAAWC,MAAc,aAAaC,IAAO;CAEnD,OAAO;EACL,aAFyCF,GAAU,uBAAuB,SAAS,CAAC;EAGpF,OAAOA,GAAU,uBAAuB,SAAS;EACjD,SAASA,GAAU,uBAAuB,WAAW;EACrD;EACA;EACA;CACF;AACF;AAGA,SAAgBG,EAAwB,GAA0C,IAAS,GAAG;CAC5F,IAAM,EAAE,SAAM,cAAW,YAAS,UAAO,eAAYC,EAA6B;EAChF,WAAW;GAAE,QAAQC,IAAS,EAAE,UAAO,IAAI;GAAM,YAAYT,EAAKC,CAAM;EAAE;EAC1E,aAAa;EACb,aAAa;CACf,CAAC,GACKG,IAAWC,MAAc,aAAaC,IAAO;CAEnD,OAAO;EACL,aAFyCF,GAAU,qBAAqB,SAAS,CAAC;EAGlF,OAAOA,GAAU,qBAAqB,SAAS;EAC/C,SAASA,GAAU,qBAAqB,WAAW;EACnD,OAAOA,GAAU,kCAAkC;EACnD;EACA;EACA;CACF;AACF;AAEA,SAAgBM,IAAqB;CACnC,IAAM,CAACC,GAAQ,EAAE,gBAAaC,EAA2B,EAAE,gBAAgBb,EAAQ,CAAC;CAQpF,OAAO;EAAE,iBAPec,EACtB,OAAO,OAEE,MADcF,EAAO,EAAE,WAAW,EAAE,SAAM,EAAE,CAAC,EAAA,CACtC,MAAM,mBAAmB,MAEzC,CAACA,CAAM,CAEA;EAAiB;CAAQ;AACpC;AAEA,SAAgBG,IAAiC;CAC/C,IAAM,CAACH,GAAQ,EAAE,gBAAaI,EAAuC,EACnE,gBAAgBhB,EAClB,CAAC;CAQD,OAAO;EAAE,UAPQc,EACf,OAAO,OAEE,MADcF,EAAO,EAAE,WAAW,EAAE,MAAG,EAAE,CAAC,EAAA,CACnC,MAAM,+BAA+B,MAErD,CAACA,CAAM,CAEA;EAAU;CAAQ;AAC7B;AAMA,SAAgBK,IAA0C;CACxD,IAAM,CAACL,GAAQ,EAAE,gBAAaM,EAAgD,EAC5E,gBAAgBlB,EAClB,CAAC;CAQD,OAAO;EAAE,mBAPiBc,EACxB,OAAO,GAAY,OAEV,MADcF,EAAO,EAAE,WAAW;GAAE;GAAI;EAAM,EAAE,CAAC,EAAA,CAC1C,MAAM,wCAAwC,MAE9D,CAACA,CAAM,CAEA;EAAmB;CAAQ;AACtC;AAEA,SAAgBO,IAA+B;CAC7C,IAAM,CAACC,GAAiB,EAAE,SAASC,OAAeC,EAAsC,EACtF,gBAAgB;EAAC,GAAGtB;EAAS;EAAgB;CAAoB,EACnE,CAAC,GACK,CAACuB,GAAgB,EAAE,SAASC,OAAeC,EAAqC,EACpF,gBAAgBzB,EAClB,CAAC;CAeD,OAAO;EAAE,SAdOc,EACd,OAAO,GAAY,OAEV,MADcM,EAAgB,EAAE,WAAW;GAAE;GAAI;EAAM,EAAE,CAAC,EAAA,CACnD,MAAM,8BAA8B,MAEpD,CAACA,CAAe,CAST;EAAS,QAPHN,EACb,OAAO,GAAY,OAEV,MADcS,EAAe,EAAE,WAAW;GAAE;GAAI;EAAO,EAAE,CAAC,EAAA,CACnD,MAAM,6BAA6B,MAEnD,CAACA,CAAc,CAEC;EAAQ,SAASF,KAAaG;CAAU;AAC5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTr as e } from "./useTr.js";
|
|
2
2
|
import { useCallback as t } from "react";
|
|
3
|
-
|
|
3
|
+
// src/integrations/hooks/useFormatDate.ts
|
|
4
4
|
function n() {
|
|
5
5
|
let n = e();
|
|
6
6
|
return t((e) => e ? new Date(e).toLocaleString(void 0, {
|
|
@@ -11,7 +11,6 @@ function n() {
|
|
|
11
11
|
minute: "2-digit"
|
|
12
12
|
}) : n("integrations.common.empty", "-"), [n]);
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { n as useFormatDate };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=useFormatDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormatDate.js","names":[],"sources":["../../../src/integrations/hooks/useFormatDate.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a date string to a localized display format.\n *\n * Returns a translated dash (\"-\") when the input is null/empty.\n */\nexport function useFormatDate(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.common.empty', '-');\n return new Date(date).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n },\n [tr]\n );\n}\n"],"mappings":";;;AAQA,
|
|
1
|
+
{"version":3,"file":"useFormatDate.js","names":["useFormatDate","tr","useTr","useCallback","date"],"sources":["../../../src/integrations/hooks/useFormatDate.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a date string to a localized display format.\n *\n * Returns a translated dash (\"-\") when the input is null/empty.\n */\nexport function useFormatDate(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.common.empty', '-');\n return new Date(date).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n },\n [tr]\n );\n}\n"],"mappings":";;;AAQA,SAAgBA,IAAiD;CAC/D,IAAMC,IAAKC,EAAM;CAEjB,OAAOC,GACJ,MACMC,IACE,IAAI,KAAKA,CAAI,CAAC,CAAC,eAAe,KAAA,GAAW;EAC9C,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;CACV,CAAC,IAPiBH,EAAG,6BAA6B,GAAG,GASvD,CAACA,CAAE,CACL;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTr as e } from "./useTr.js";
|
|
2
2
|
import { useCallback as t } from "react";
|
|
3
|
-
|
|
3
|
+
// src/integrations/hooks/useFormatLastUsed.ts
|
|
4
4
|
function n() {
|
|
5
5
|
let n = e();
|
|
6
6
|
return t((e) => {
|
|
@@ -9,7 +9,6 @@ function n() {
|
|
|
9
9
|
return a < 1 ? n("integrations.time.justNow", "Just now") : a < 60 ? n("integrations.time.minutesAgo", "{{count}}m ago", { count: a }) : o < 24 ? n("integrations.time.hoursAgo", "{{count}}h ago", { count: o }) : s < 7 ? n("integrations.time.daysAgo", "{{count}}d ago", { count: s }) : s < 30 ? n("integrations.time.weeksAgo", "{{count}}w ago", { count: Math.floor(s / 7) }) : r.toLocaleDateString();
|
|
10
10
|
}, [n]);
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { n as useFormatLastUsed };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=useFormatLastUsed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormatLastUsed.js","names":[],"sources":["../../../src/integrations/hooks/useFormatLastUsed.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a \"last used\" timestamp into a translated relative string.\n *\n * Returns translated equivalents of \"Never\", \"Just now\", \"{{count}}m ago\",\n * \"{{count}}h ago\", \"{{count}}d ago\", \"{{count}}w ago\", or a localized date\n * string for older timestamps.\n */\nexport function useFormatLastUsed(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.time.never', 'Never');\n\n const now = new Date();\n const then = new Date(date);\n const diffMs = now.getTime() - then.getTime();\n const diffMinutes = Math.floor(diffMs / 60_000);\n const diffHours = Math.floor(diffMs / 3_600_000);\n const diffDays = Math.floor(diffMs / 86_400_000);\n\n if (diffMinutes < 1) {\n return tr('integrations.time.justNow', 'Just now');\n }\n if (diffMinutes < 60) {\n return tr('integrations.time.minutesAgo', '{{count}}m ago', { count: diffMinutes });\n }\n if (diffHours < 24) {\n return tr('integrations.time.hoursAgo', '{{count}}h ago', { count: diffHours });\n }\n if (diffDays < 7) {\n return tr('integrations.time.daysAgo', '{{count}}d ago', { count: diffDays });\n }\n if (diffDays < 30) {\n return tr('integrations.time.weeksAgo', '{{count}}w ago', {\n count: Math.floor(diffDays / 7),\n });\n }\n return then.toLocaleDateString();\n },\n [tr]\n );\n}\n"],"mappings":";;;AAUA,
|
|
1
|
+
{"version":3,"file":"useFormatLastUsed.js","names":["useFormatLastUsed","tr","useTr","useCallback","date","now","then","diffMs","diffMinutes","diffHours","diffDays"],"sources":["../../../src/integrations/hooks/useFormatLastUsed.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a \"last used\" timestamp into a translated relative string.\n *\n * Returns translated equivalents of \"Never\", \"Just now\", \"{{count}}m ago\",\n * \"{{count}}h ago\", \"{{count}}d ago\", \"{{count}}w ago\", or a localized date\n * string for older timestamps.\n */\nexport function useFormatLastUsed(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.time.never', 'Never');\n\n const now = new Date();\n const then = new Date(date);\n const diffMs = now.getTime() - then.getTime();\n const diffMinutes = Math.floor(diffMs / 60_000);\n const diffHours = Math.floor(diffMs / 3_600_000);\n const diffDays = Math.floor(diffMs / 86_400_000);\n\n if (diffMinutes < 1) {\n return tr('integrations.time.justNow', 'Just now');\n }\n if (diffMinutes < 60) {\n return tr('integrations.time.minutesAgo', '{{count}}m ago', { count: diffMinutes });\n }\n if (diffHours < 24) {\n return tr('integrations.time.hoursAgo', '{{count}}h ago', { count: diffHours });\n }\n if (diffDays < 7) {\n return tr('integrations.time.daysAgo', '{{count}}d ago', { count: diffDays });\n }\n if (diffDays < 30) {\n return tr('integrations.time.weeksAgo', '{{count}}w ago', {\n count: Math.floor(diffDays / 7),\n });\n }\n return then.toLocaleDateString();\n },\n [tr]\n );\n}\n"],"mappings":";;;AAUA,SAAgBA,IAAqD;CACnE,IAAMC,IAAKC,EAAM;CAEjB,OAAOC,GACJ,MAAgC;EAC/B,IAAI,CAACC,GAAM,OAAOH,EAAG,2BAA2B,OAAO;EAEvD,IAAMI,oBAAM,IAAI,KAAK,GACfC,IAAO,IAAI,KAAKF,CAAI,GACpBG,IAASF,EAAI,QAAQ,IAAIC,EAAK,QAAQ,GACtCE,IAAc,KAAK,MAAMD,IAAS,GAAM,GACxCE,IAAY,KAAK,MAAMF,IAAS,IAAS,GACzCG,IAAW,KAAK,MAAMH,IAAS,KAAU;EAmB/C,OAjBIC,IAAc,IACTP,EAAG,6BAA6B,UAAU,IAE/CO,IAAc,KACTP,EAAG,gCAAgC,kBAAkB,EAAE,OAAOO,EAAY,CAAC,IAEhFC,IAAY,KACPR,EAAG,8BAA8B,kBAAkB,EAAE,OAAOQ,EAAU,CAAC,IAE5EC,IAAW,IACNT,EAAG,6BAA6B,kBAAkB,EAAE,OAAOS,EAAS,CAAC,IAE1EA,IAAW,KACNT,EAAG,8BAA8B,kBAAkB,EACxD,OAAO,KAAK,MAAMS,IAAW,CAAC,EAChC,CAAC,IAEIJ,EAAK,mBAAmB;CACjC,GACA,CAACL,CAAE,CACL;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ConnectionStatus, ProviderCategory, AuthType } from '../types';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Translated label hooks for shared enums.
|
|
5
4
|
*
|
|
@@ -10,4 +9,3 @@ import { ConnectionStatus, ProviderCategory, AuthType } from '../types';
|
|
|
10
9
|
export declare function useStatusLabel(): (status: ConnectionStatus) => string;
|
|
11
10
|
export declare function useCategoryLabel(): (category: ProviderCategory) => string;
|
|
12
11
|
export declare function useAuthTypeLabel(): (authType: AuthType) => string;
|
|
13
|
-
//# sourceMappingURL=useLabel.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTr as e } from "./useTr.js";
|
|
2
2
|
import { getAuthTypeLabel as t, getCategoryLabel as n, getStatusLabel as r } from "../utils/integrationsHelpers.js";
|
|
3
3
|
import { useCallback as i } from "react";
|
|
4
|
-
|
|
4
|
+
// src/integrations/hooks/useLabel.ts
|
|
5
5
|
function a() {
|
|
6
6
|
let t = e();
|
|
7
7
|
return i((e) => t(`integrations.status.${e}`, r(e)), [t]);
|
|
@@ -14,7 +14,6 @@ function s() {
|
|
|
14
14
|
let n = e();
|
|
15
15
|
return i((e) => n(`integrations.authType.${e}`, t(e)), [n]);
|
|
16
16
|
}
|
|
17
|
-
//#endregion
|
|
18
17
|
export { s as useAuthTypeLabel, o as useCategoryLabel, a as useStatusLabel };
|
|
19
18
|
|
|
20
19
|
//# sourceMappingURL=useLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLabel.js","names":[],"sources":["../../../src/integrations/hooks/useLabel.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\nimport { getStatusLabel, getCategoryLabel, getAuthTypeLabel } from '../utils/integrationsHelpers';\nimport type { ConnectionStatus, ProviderCategory, AuthType } from '../types';\n\n/**\n * Translated label hooks for shared enums.\n *\n * These wrap the existing English helper functions so call sites can keep using\n * the helpers as fallbacks while the translation layer provides localized\n * strings when available.\n */\n\nexport function useStatusLabel(): (status: ConnectionStatus) => string {\n const tr = useTr();\n return useCallback(\n (status: ConnectionStatus) => tr(`integrations.status.${status}`, getStatusLabel(status)),\n [tr]\n );\n}\n\nexport function useCategoryLabel(): (category: ProviderCategory) => string {\n const tr = useTr();\n return useCallback(\n (category: ProviderCategory) =>\n tr(`integrations.category.${category}`, getCategoryLabel(category)),\n [tr]\n );\n}\n\nexport function useAuthTypeLabel(): (authType: AuthType) => string {\n const tr = useTr();\n return useCallback(\n (authType: AuthType) => tr(`integrations.authType.${authType}`, getAuthTypeLabel(authType)),\n [tr]\n );\n}\n"],"mappings":";;;;AAaA,
|
|
1
|
+
{"version":3,"file":"useLabel.js","names":["useStatusLabel","tr","useTr","useCallback","status","getStatusLabel","useCategoryLabel","category","getCategoryLabel","useAuthTypeLabel","authType","getAuthTypeLabel"],"sources":["../../../src/integrations/hooks/useLabel.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\nimport { getStatusLabel, getCategoryLabel, getAuthTypeLabel } from '../utils/integrationsHelpers';\nimport type { ConnectionStatus, ProviderCategory, AuthType } from '../types';\n\n/**\n * Translated label hooks for shared enums.\n *\n * These wrap the existing English helper functions so call sites can keep using\n * the helpers as fallbacks while the translation layer provides localized\n * strings when available.\n */\n\nexport function useStatusLabel(): (status: ConnectionStatus) => string {\n const tr = useTr();\n return useCallback(\n (status: ConnectionStatus) => tr(`integrations.status.${status}`, getStatusLabel(status)),\n [tr]\n );\n}\n\nexport function useCategoryLabel(): (category: ProviderCategory) => string {\n const tr = useTr();\n return useCallback(\n (category: ProviderCategory) =>\n tr(`integrations.category.${category}`, getCategoryLabel(category)),\n [tr]\n );\n}\n\nexport function useAuthTypeLabel(): (authType: AuthType) => string {\n const tr = useTr();\n return useCallback(\n (authType: AuthType) => tr(`integrations.authType.${authType}`, getAuthTypeLabel(authType)),\n [tr]\n );\n}\n"],"mappings":";;;;AAaA,SAAgBA,IAAuD;CACrE,IAAMC,IAAKC,EAAM;CACjB,OAAOC,GACJ,MAA6BF,EAAG,uBAAuBG,KAAUC,EAAeD,CAAM,CAAC,GACxF,CAACH,CAAE,CACL;AACF;AAEA,SAAgBK,IAA2D;CACzE,IAAML,IAAKC,EAAM;CACjB,OAAOC,GACJ,MACCF,EAAG,yBAAyBM,KAAYC,EAAiBD,CAAQ,CAAC,GACpE,CAACN,CAAE,CACL;AACF;AAEA,SAAgBQ,IAAmD;CACjE,IAAMR,IAAKC,EAAM;CACjB,OAAOC,GACJ,MAAuBF,EAAG,yBAAyBS,KAAYC,EAAiBD,CAAQ,CAAC,GAC1F,CAACT,CAAE,CACL;AACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IntegrationLog, LogLevel, LogAction } from '../types';
|
|
2
|
-
|
|
3
2
|
interface LogFilterOptions {
|
|
4
3
|
level?: LogLevel;
|
|
5
4
|
action?: LogAction;
|
|
@@ -13,10 +12,6 @@ export declare function useIntegrationLogs(filter?: LogFilterOptions): {
|
|
|
13
12
|
hasMore: any;
|
|
14
13
|
loading: boolean;
|
|
15
14
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
16
|
-
refetch: (
|
|
17
|
-
data: any;
|
|
18
|
-
error?: import('@apollo/client').ErrorLike;
|
|
19
|
-
}>;
|
|
15
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.GetIntegrationLogsQuery, Types.GetIntegrationLogsQueryVariables, undefined>;
|
|
20
16
|
};
|
|
21
17
|
export {};
|
|
22
|
-
//# sourceMappingURL=useLogs.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { useGetIntegrationLogsQuery as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useIntegrations as t } from "../providers/IntegrationsProvider.js";
|
|
3
|
+
import { mapLog as n } from "../utils/mappers.js";
|
|
4
|
+
// src/integrations/hooks/useLogs.ts
|
|
5
5
|
function r(r) {
|
|
6
|
-
let { workspaceId: i } =
|
|
6
|
+
let { workspaceId: i } = t(), a = r?.page ?? 1, o = r?.pageSize ?? 20, { data: s, loading: c, error: l, refetch: u } = e({
|
|
7
7
|
variables: {
|
|
8
8
|
filter: {
|
|
9
9
|
level: r?.level,
|
|
@@ -18,7 +18,7 @@ function r(r) {
|
|
|
18
18
|
errorPolicy: "all"
|
|
19
19
|
});
|
|
20
20
|
return {
|
|
21
|
-
logs: (s?.getIntegrationLogs?.items ?? []).map((e) =>
|
|
21
|
+
logs: (s?.getIntegrationLogs?.items ?? []).map((e) => n(e)),
|
|
22
22
|
total: s?.getIntegrationLogs?.total ?? 0,
|
|
23
23
|
hasMore: s?.getIntegrationLogs?.hasMore ?? !1,
|
|
24
24
|
loading: c,
|
|
@@ -26,7 +26,6 @@ function r(r) {
|
|
|
26
26
|
refetch: u
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { r as useIntegrationLogs };
|
|
31
30
|
|
|
32
31
|
//# sourceMappingURL=useLogs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogs.js","names":[],"sources":["../../../src/integrations/hooks/useLogs.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries for integration logs.\n */\n\nimport { useGetIntegrationLogsQuery } from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { mapLog } from '../utils/mappers';\nimport type { IntegrationLog, LogLevel, LogAction } from '../types';\nimport { DEFAULT_PAGE_SIZE } from '../utils/constants';\n\n// ─── Hooks ──────────────────────────────────────────────────────────────────\n\ninterface LogFilterOptions {\n level?: LogLevel;\n action?: LogAction;\n page?: number;\n pageSize?: number;\n skip?: boolean;\n}\n\nexport function useIntegrationLogs(filter?: LogFilterOptions) {\n const { workspaceId } = useIntegrations();\n const page = filter?.page ?? 1;\n const pageSize = filter?.pageSize ?? DEFAULT_PAGE_SIZE;\n\n const { data, loading, error, refetch } = useGetIntegrationLogsQuery({\n variables: {\n filter: {\n level: filter?.level,\n action: filter?.action,\n },\n pagination: {\n limit: pageSize,\n offset: (page - 1) * pageSize,\n },\n },\n skip: !workspaceId || filter?.skip,\n errorPolicy: 'all',\n });\n\n const logs: IntegrationLog[] = (data?.getIntegrationLogs?.items ?? []).map(\n (item: Record<string, unknown>) => mapLog(item)\n );\n\n return {\n logs,\n total: data?.getIntegrationLogs?.total ?? 0,\n hasMore: data?.getIntegrationLogs?.hasMore ?? false,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;AAoBA,
|
|
1
|
+
{"version":3,"file":"useLogs.js","names":["useIntegrationLogs","useIntegrations","page","filter","pageSize","useGetIntegrationLogsQuery","workspaceId","data","mapLog","item"],"sources":["../../../src/integrations/hooks/useLogs.ts"],"sourcesContent":["/**\n * Custom hooks wrapping GraphQL queries for integration logs.\n */\n\nimport { useGetIntegrationLogsQuery } from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { mapLog } from '../utils/mappers';\nimport type { IntegrationLog, LogLevel, LogAction } from '../types';\nimport { DEFAULT_PAGE_SIZE } from '../utils/constants';\n\n// ─── Hooks ──────────────────────────────────────────────────────────────────\n\ninterface LogFilterOptions {\n level?: LogLevel;\n action?: LogAction;\n page?: number;\n pageSize?: number;\n skip?: boolean;\n}\n\nexport function useIntegrationLogs(filter?: LogFilterOptions) {\n const { workspaceId } = useIntegrations();\n const page = filter?.page ?? 1;\n const pageSize = filter?.pageSize ?? DEFAULT_PAGE_SIZE;\n\n const { data, loading, error, refetch } = useGetIntegrationLogsQuery({\n variables: {\n filter: {\n level: filter?.level,\n action: filter?.action,\n },\n pagination: {\n limit: pageSize,\n offset: (page - 1) * pageSize,\n },\n },\n skip: !workspaceId || filter?.skip,\n errorPolicy: 'all',\n });\n\n const logs: IntegrationLog[] = (data?.getIntegrationLogs?.items ?? []).map(\n (item: Record<string, unknown>) => mapLog(item)\n );\n\n return {\n logs,\n total: data?.getIntegrationLogs?.total ?? 0,\n hasMore: data?.getIntegrationLogs?.hasMore ?? false,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;AAoBA,SAAgBA,EAAmB,GAA2B;CAC5D,IAAM,EAAE,mBAAgBC,EAAgB,GAClCC,IAAOC,GAAQ,QAAQ,GACvBC,IAAWD,GAAQ,YAAA,IAEnB,EAAE,SAAM,YAAS,UAAO,eAAYE,EAA2B;EACnE,WAAW;GACT,QAAQ;IACN,OAAOF,GAAQ;IACf,QAAQA,GAAQ;GAClB;GACA,YAAY;IACV,OAAOC;IACP,SAASF,IAAO,KAAKE;GACvB;EACF;EACA,MAAM,CAACE,KAAeH,GAAQ;EAC9B,aAAa;CACf,CAAC;CAMD,OAAO;EACL,OAL8BI,GAAM,oBAAoB,SAAS,CAAC,EAAA,CAAG,KACpE,MAAkCC,EAAOC,CAAI,CAI9C;EACA,OAAOF,GAAM,oBAAoB,SAAS;EAC1C,SAASA,GAAM,oBAAoB,WAAW;EAC9C;EACA;EACA;CACF;AACF"}
|
|
@@ -1,102 +1,140 @@
|
|
|
1
|
-
import { MailboxFolder } from '../../generated/wspace-types';
|
|
2
|
-
import { MailboxAccountsQuery, MailboxMessagesQuery, MailboxThreadQuery, SendMailboxMessageMutation } from '../../generated/wspace-operations';
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { MailboxFolder, MailboxKind, MailboxLabelKind } from '../../generated/wspace-types';
|
|
2
|
+
import { MailboxAccountsQuery, MailboxAttachmentQuery, MailboxLabelsQuery, MailboxMessagesQuery, MailboxThreadQuery, SendMailboxMessageMutation } from '../../generated/wspace-operations';
|
|
3
|
+
export { MailboxFolder, MailboxKind, MailboxLabelKind };
|
|
4
|
+
/** Files on one outgoing message; matches the service limit. */
|
|
5
|
+
export declare const MAILBOX_MAX_ATTACHMENTS = 10;
|
|
6
|
+
/**
|
|
7
|
+
* Total attachment bytes per outgoing message, matching the service caps:
|
|
8
|
+
* Gmail takes a 25 MB message, Microsoft Graph 4 MB per request.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAILBOX_SEND_ATTACHMENT_BYTES: Readonly<Record<MailboxKind, number>>;
|
|
5
11
|
export declare const MAILBOX_PAGE_SIZE = 25;
|
|
6
12
|
export type MailboxAccount = MailboxAccountsQuery['mailboxAccounts'][number];
|
|
7
13
|
export type MailboxMessageSummary = MailboxMessagesQuery['mailboxMessages']['messages'][number];
|
|
8
14
|
export type MailboxThread = NonNullable<MailboxThreadQuery['mailboxThread']>;
|
|
9
15
|
export type MailboxSendResult = SendMailboxMessageMutation['sendMailboxMessage'];
|
|
16
|
+
export type MailboxLabel = MailboxLabelsQuery['mailboxLabels'][number];
|
|
17
|
+
export type MailboxThreadMessage = MailboxThread['messages'][number];
|
|
18
|
+
export type MailboxAttachment = MailboxThreadMessage['attachments'][number];
|
|
19
|
+
export type MailboxAttachmentContent = MailboxAttachmentQuery['mailboxAttachment'];
|
|
10
20
|
export declare function useMailboxAccounts(): {
|
|
11
21
|
accounts: {
|
|
12
|
-
__typename?: "MailboxAccount";
|
|
13
22
|
connectionId: string;
|
|
14
23
|
name: string;
|
|
15
24
|
providerKey: string;
|
|
16
|
-
kind:
|
|
17
|
-
emailAddress
|
|
25
|
+
kind: MailboxKind;
|
|
26
|
+
emailAddress: string | null;
|
|
18
27
|
status: import('../../generated/wspace-types').ConnectionStatus;
|
|
19
28
|
}[];
|
|
20
29
|
answered: boolean;
|
|
21
30
|
loading: boolean;
|
|
22
31
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
23
|
-
refetch: (
|
|
24
|
-
data: any;
|
|
25
|
-
error?: import('@apollo/client').ErrorLike;
|
|
26
|
-
}>;
|
|
32
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxAccountsQuery, Types.MailboxAccountsQueryVariables, undefined>;
|
|
27
33
|
};
|
|
28
34
|
export declare function useMailboxMessages(options: {
|
|
29
35
|
connectionId: string | null;
|
|
30
36
|
folder: MailboxFolder;
|
|
37
|
+
/** A label or folder from useMailboxLabels; replaces `folder` when set. */
|
|
38
|
+
folderId: string | null;
|
|
31
39
|
query: string;
|
|
32
40
|
pageToken: string | null;
|
|
33
41
|
}): {
|
|
34
42
|
messages: {
|
|
35
|
-
__typename?: "MailboxMessageSummary";
|
|
36
43
|
id: string;
|
|
37
44
|
threadId: string;
|
|
38
45
|
subject: string;
|
|
39
46
|
snippet: string;
|
|
40
|
-
receivedAt
|
|
47
|
+
receivedAt: string | null;
|
|
41
48
|
isUnread: boolean;
|
|
42
49
|
hasAttachments: boolean;
|
|
43
|
-
from
|
|
44
|
-
|
|
45
|
-
name?: string | null;
|
|
50
|
+
from: {
|
|
51
|
+
name: string | null;
|
|
46
52
|
email: string;
|
|
47
53
|
} | null;
|
|
48
54
|
to: Array<{
|
|
49
|
-
|
|
50
|
-
name?: string | null;
|
|
55
|
+
name: string | null;
|
|
51
56
|
email: string;
|
|
52
57
|
}>;
|
|
53
58
|
}[];
|
|
54
59
|
nextPageToken: string | null;
|
|
55
60
|
loading: boolean;
|
|
56
61
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
57
|
-
refetch: (
|
|
58
|
-
data: any;
|
|
59
|
-
error?: import('@apollo/client').ErrorLike;
|
|
60
|
-
}>;
|
|
62
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxMessagesQuery, Types.MailboxMessagesQueryVariables, undefined>;
|
|
61
63
|
};
|
|
62
64
|
export declare function useMailboxThread(connectionId: string | null, threadId: string | null): {
|
|
63
65
|
thread: {
|
|
64
|
-
__typename?: "MailboxThread";
|
|
65
66
|
id: string;
|
|
66
67
|
subject: string;
|
|
67
68
|
messages: Array<{
|
|
68
|
-
__typename?: "MailboxMessage";
|
|
69
69
|
id: string;
|
|
70
70
|
threadId: string;
|
|
71
71
|
subject: string;
|
|
72
|
-
receivedAt
|
|
72
|
+
receivedAt: string | null;
|
|
73
73
|
isUnread: boolean;
|
|
74
74
|
hasAttachments: boolean;
|
|
75
75
|
bodyText: string;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
bodyHtml: string | null;
|
|
77
|
+
attachments: Array<{
|
|
78
|
+
id: string;
|
|
79
|
+
filename: string;
|
|
80
|
+
mimeType: string;
|
|
81
|
+
size: number;
|
|
82
|
+
isInline: boolean;
|
|
83
|
+
contentId: string | null;
|
|
84
|
+
}>;
|
|
85
|
+
from: {
|
|
86
|
+
name: string | null;
|
|
79
87
|
email: string;
|
|
80
88
|
} | null;
|
|
81
89
|
to: Array<{
|
|
82
|
-
|
|
83
|
-
name?: string | null;
|
|
90
|
+
name: string | null;
|
|
84
91
|
email: string;
|
|
85
92
|
}>;
|
|
86
93
|
cc: Array<{
|
|
87
|
-
|
|
88
|
-
name?: string | null;
|
|
94
|
+
name: string | null;
|
|
89
95
|
email: string;
|
|
90
96
|
}>;
|
|
91
97
|
}>;
|
|
92
98
|
} | null;
|
|
93
99
|
loading: boolean;
|
|
94
100
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
95
|
-
refetch: (
|
|
96
|
-
data: any;
|
|
97
|
-
error?: import('@apollo/client').ErrorLike;
|
|
98
|
-
}>;
|
|
101
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxThreadQuery, Types.MailboxThreadQueryVariables, undefined>;
|
|
99
102
|
};
|
|
103
|
+
export declare function useMailboxLabels(connectionId: string | null): {
|
|
104
|
+
labels: {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
kind: MailboxLabelKind;
|
|
108
|
+
unreadCount: number | null;
|
|
109
|
+
totalCount: number | null;
|
|
110
|
+
}[];
|
|
111
|
+
loading: boolean;
|
|
112
|
+
error: import('@apollo/client').ErrorLike | undefined;
|
|
113
|
+
};
|
|
114
|
+
/** Fetches one received attachment's bytes. Never cached: files can be large. */
|
|
115
|
+
export declare function useMailboxAttachmentContent(): (connectionId: string, messageId: string, attachmentId: string) => Promise<{
|
|
116
|
+
filename: string;
|
|
117
|
+
mimeType: string;
|
|
118
|
+
size: number;
|
|
119
|
+
contentBase64: string;
|
|
120
|
+
}>;
|
|
121
|
+
export declare function useMailboxThreadActions(): {
|
|
122
|
+
archiveThread: (connectionId: string, threadId: string) => Promise<void>;
|
|
123
|
+
trashThread: (connectionId: string, threadId: string) => Promise<void>;
|
|
124
|
+
busy: boolean;
|
|
125
|
+
};
|
|
126
|
+
/** A file uploaded to Files for an outgoing message. */
|
|
127
|
+
export interface PendingMailAttachment {
|
|
128
|
+
fileId: string;
|
|
129
|
+
name: string;
|
|
130
|
+
size: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Uploads a file to wspace-files-svc (initiateUpload, PUT to the presigned
|
|
134
|
+
* URL, completeUpload) so sendMailboxMessage can attach it by id. The service
|
|
135
|
+
* reads it back as the caller; the bytes never pass through the gateway.
|
|
136
|
+
*/
|
|
137
|
+
export declare function useUploadMailAttachment(): (file: File) => Promise<PendingMailAttachment>;
|
|
100
138
|
export interface SendMailInput {
|
|
101
139
|
connectionId: string;
|
|
102
140
|
to: string[];
|
|
@@ -104,12 +142,12 @@ export interface SendMailInput {
|
|
|
104
142
|
subject?: string;
|
|
105
143
|
bodyText: string;
|
|
106
144
|
replyToMessageId?: string;
|
|
145
|
+
attachmentFileIds?: string[];
|
|
107
146
|
}
|
|
108
147
|
export declare function useSendMail(): {
|
|
109
148
|
send: (input: SendMailInput) => Promise<{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
threadId?: string | null;
|
|
149
|
+
messageId: string | null;
|
|
150
|
+
threadId: string | null;
|
|
113
151
|
} | null>;
|
|
114
152
|
sending: boolean;
|
|
115
153
|
};
|
|
@@ -120,4 +158,3 @@ export declare function useSetMailRead(): (connectionId: string, messageId: stri
|
|
|
120
158
|
* as one address instead of receiving fragments of it.
|
|
121
159
|
*/
|
|
122
160
|
export declare function splitRecipients(value: string): string[];
|
|
123
|
-
//# sourceMappingURL=useMailbox.d.ts.map
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMailboxAccountsQuery as
|
|
3
|
-
import "
|
|
4
|
-
import { useCallback as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { MailboxFolder as e, MailboxKind as t, MailboxLabelKind as n } from "../../generated/wspace-types.js";
|
|
2
|
+
import { useArchiveMailboxThreadMutation as r, useMailboxAccountsQuery as i, useMailboxAttachmentCompleteUploadMutation as a, useMailboxAttachmentInitiateUploadMutation as o, useMailboxAttachmentLazyQuery as s, useMailboxLabelsQuery as c, useMailboxMessagesQuery as l, useMailboxThreadQuery as u, useSendMailboxMessageMutation as d, useSetMailboxMessageReadMutation as f, useTrashMailboxThreadMutation as p } from "../../generated/wspace-operations.js";
|
|
3
|
+
import { useIntegrations as m } from "../providers/IntegrationsProvider.js";
|
|
4
|
+
import { useCallback as h } from "react";
|
|
5
|
+
// src/integrations/hooks/useMailbox.ts
|
|
6
|
+
var g = {
|
|
7
|
+
[t.Gmail]: 17825792,
|
|
8
|
+
[t.Outlook]: 2621440
|
|
9
|
+
};
|
|
10
|
+
function _() {
|
|
11
|
+
let { workspaceId: e } = m(), { data: t, loading: n, error: r, refetch: a } = i({
|
|
12
|
+
skip: !e,
|
|
8
13
|
errorPolicy: "all",
|
|
9
14
|
fetchPolicy: "cache-and-network"
|
|
10
|
-
}),
|
|
15
|
+
}), o = t;
|
|
11
16
|
return {
|
|
12
|
-
accounts:
|
|
13
|
-
answered:
|
|
14
|
-
loading:
|
|
15
|
-
error:
|
|
16
|
-
refetch:
|
|
17
|
+
accounts: o?.mailboxAccounts ?? [],
|
|
18
|
+
answered: o?.mailboxAccounts !== void 0,
|
|
19
|
+
loading: n,
|
|
20
|
+
error: r,
|
|
21
|
+
refetch: a
|
|
17
22
|
};
|
|
18
23
|
}
|
|
19
|
-
function
|
|
20
|
-
let { connectionId: t, folder: r, query: i, pageToken: a } = e, { data: o, loading: s, error: c, refetch:
|
|
24
|
+
function v(e) {
|
|
25
|
+
let { connectionId: t, folder: n, folderId: r, query: i, pageToken: a } = e, { data: o, loading: s, error: c, refetch: u } = l({
|
|
21
26
|
variables: { input: {
|
|
22
27
|
connectionId: t ?? "",
|
|
23
|
-
folder:
|
|
28
|
+
folder: n,
|
|
29
|
+
folderId: r,
|
|
24
30
|
query: i || null,
|
|
25
31
|
pageToken: a,
|
|
26
32
|
limit: 25
|
|
@@ -28,17 +34,17 @@ function c(e) {
|
|
|
28
34
|
skip: !t,
|
|
29
35
|
errorPolicy: "none",
|
|
30
36
|
fetchPolicy: "network-only"
|
|
31
|
-
}),
|
|
37
|
+
}), d = o;
|
|
32
38
|
return {
|
|
33
|
-
messages:
|
|
34
|
-
nextPageToken:
|
|
39
|
+
messages: d?.mailboxMessages.messages ?? [],
|
|
40
|
+
nextPageToken: d?.mailboxMessages.nextPageToken ?? null,
|
|
35
41
|
loading: s,
|
|
36
42
|
error: c,
|
|
37
|
-
refetch:
|
|
43
|
+
refetch: u
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
|
-
function
|
|
41
|
-
let { data: n, loading:
|
|
46
|
+
function y(e, t) {
|
|
47
|
+
let { data: n, loading: r, error: i, refetch: a } = u({
|
|
42
48
|
variables: {
|
|
43
49
|
connectionId: e ?? "",
|
|
44
50
|
threadId: t ?? ""
|
|
@@ -49,28 +55,101 @@ function l(e, t) {
|
|
|
49
55
|
});
|
|
50
56
|
return {
|
|
51
57
|
thread: n?.mailboxThread ?? null,
|
|
52
|
-
loading:
|
|
53
|
-
error:
|
|
54
|
-
refetch:
|
|
58
|
+
loading: r,
|
|
59
|
+
error: i,
|
|
60
|
+
refetch: a
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
|
-
function
|
|
58
|
-
let
|
|
63
|
+
function b(e) {
|
|
64
|
+
let { data: t, loading: n, error: r } = c({
|
|
65
|
+
variables: { connectionId: e ?? "" },
|
|
66
|
+
skip: !e,
|
|
67
|
+
errorPolicy: "none",
|
|
68
|
+
fetchPolicy: "cache-and-network"
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
labels: t?.mailboxLabels ?? [],
|
|
72
|
+
loading: n,
|
|
73
|
+
error: r
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function x() {
|
|
77
|
+
let [e] = s({ fetchPolicy: "no-cache" });
|
|
78
|
+
return h(async (t, n, r) => {
|
|
79
|
+
let i = await e({ variables: {
|
|
80
|
+
connectionId: t,
|
|
81
|
+
messageId: n,
|
|
82
|
+
attachmentId: r
|
|
83
|
+
} });
|
|
84
|
+
if (i.error) throw i.error;
|
|
85
|
+
let a = i.data?.mailboxAttachment ?? null;
|
|
86
|
+
if (!a) throw Error("Attachment not found");
|
|
87
|
+
return a;
|
|
88
|
+
}, [e]);
|
|
89
|
+
}
|
|
90
|
+
function S() {
|
|
91
|
+
let [e, t] = r(), [n, i] = p();
|
|
92
|
+
return {
|
|
93
|
+
archiveThread: h(async (t, n) => {
|
|
94
|
+
await e({ variables: {
|
|
95
|
+
connectionId: t,
|
|
96
|
+
threadId: n
|
|
97
|
+
} });
|
|
98
|
+
}, [e]),
|
|
99
|
+
trashThread: h(async (e, t) => {
|
|
100
|
+
await n({ variables: {
|
|
101
|
+
connectionId: e,
|
|
102
|
+
threadId: t
|
|
103
|
+
} });
|
|
104
|
+
}, [n]),
|
|
105
|
+
busy: t.loading || i.loading
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function C() {
|
|
109
|
+
let [e] = o(), [t] = a();
|
|
110
|
+
return h(async (n) => {
|
|
111
|
+
let r = n.type || "application/octet-stream", i = n.name.lastIndexOf("."), a = i > 0 ? n.name.slice(i + 1).toLowerCase() : "bin", o = String(n.size), s = (await e({ variables: { input: {
|
|
112
|
+
fileName: n.name,
|
|
113
|
+
fileSize: o,
|
|
114
|
+
mimeType: r,
|
|
115
|
+
extension: a
|
|
116
|
+
} } })).data?.initiateUpload;
|
|
117
|
+
if (!s?.uploadUrl || !s.session.id) throw Error(`Could not start uploading ${n.name}`);
|
|
118
|
+
if (!(await fetch(s.uploadUrl, {
|
|
119
|
+
method: "PUT",
|
|
120
|
+
body: n,
|
|
121
|
+
headers: { "Content-Type": r }
|
|
122
|
+
})).ok) throw Error(`Uploading ${n.name} failed`);
|
|
123
|
+
let c = (await t({ variables: { input: {
|
|
124
|
+
sessionId: s.session.id,
|
|
125
|
+
fileSize: o
|
|
126
|
+
} } })).data?.completeUpload.fileId;
|
|
127
|
+
if (!c) throw Error(`Could not finish uploading ${n.name}`);
|
|
128
|
+
return {
|
|
129
|
+
fileId: c,
|
|
130
|
+
name: n.name,
|
|
131
|
+
size: n.size
|
|
132
|
+
};
|
|
133
|
+
}, [e, t]);
|
|
134
|
+
}
|
|
135
|
+
function w() {
|
|
136
|
+
let [e, { loading: t }] = d();
|
|
59
137
|
return {
|
|
60
|
-
send:
|
|
138
|
+
send: h(async (t) => (await e({ variables: { input: {
|
|
61
139
|
connectionId: t.connectionId,
|
|
62
140
|
to: t.to,
|
|
63
141
|
cc: t.cc ?? null,
|
|
64
142
|
subject: t.subject ?? null,
|
|
65
143
|
bodyText: t.bodyText,
|
|
66
|
-
replyToMessageId: t.replyToMessageId ?? null
|
|
144
|
+
replyToMessageId: t.replyToMessageId ?? null,
|
|
145
|
+
attachmentFileIds: t.attachmentFileIds?.length ? t.attachmentFileIds : null
|
|
67
146
|
} } })).data?.sendMailboxMessage ?? null, [e]),
|
|
68
147
|
sending: t
|
|
69
148
|
};
|
|
70
149
|
}
|
|
71
|
-
function
|
|
72
|
-
let [e] =
|
|
73
|
-
return
|
|
150
|
+
function T() {
|
|
151
|
+
let [e] = f();
|
|
152
|
+
return h(async (t, n, r) => {
|
|
74
153
|
await e({ variables: {
|
|
75
154
|
connectionId: t,
|
|
76
155
|
messageId: n,
|
|
@@ -78,10 +157,9 @@ function d() {
|
|
|
78
157
|
} });
|
|
79
158
|
}, [e]);
|
|
80
159
|
}
|
|
81
|
-
function
|
|
160
|
+
function E(e) {
|
|
82
161
|
return e.split(/[,;\r\n]+/).map((e) => e.trim()).filter(Boolean);
|
|
83
162
|
}
|
|
84
|
-
|
|
85
|
-
export { f as splitRecipients, s as useMailboxAccounts, c as useMailboxMessages, l as useMailboxThread, u as useSendMail, d as useSetMailRead };
|
|
163
|
+
export { g as MAILBOX_SEND_ATTACHMENT_BYTES, e as MailboxFolder, t as MailboxKind, n as MailboxLabelKind, E as splitRecipients, _ as useMailboxAccounts, x as useMailboxAttachmentContent, b as useMailboxLabels, v as useMailboxMessages, y as useMailboxThread, S as useMailboxThreadActions, w as useSendMail, T as useSetMailRead, C as useUploadMailAttachment };
|
|
86
164
|
|
|
87
165
|
//# sourceMappingURL=useMailbox.js.map
|