@burdenoff/microfe-integrations 2026.1107.2 → 2026.1109.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/main.d.ts +0 -2
- 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 +995 -705
- package/dist/generated/wspace-operations.js +180 -167
- 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/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 +1 -3
- package/dist/integrations/components/MailMessageBody.js +4 -5
- package/dist/integrations/components/MailMessageBody.js.map +1 -1
- 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 +19 -43
- package/dist/integrations/hooks/useMailbox.js +46 -47
- 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 +135 -140
- 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 +0 -2
- package/dist/integrations/store/mailboxStore.js +1 -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 +0 -2
- package/dist/integrations/utils/mailHtml.js +3 -4
- package/dist/integrations/utils/mailHtml.js.map +1 -1
- 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 +20 -36
- package/dist/node_modules/dompurify/dist/purify.es.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/utils/nativeBridge.d.ts +0 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +63 -49
- 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/MailMessageBody.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/mailHtml.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,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,6 +1,5 @@
|
|
|
1
1
|
import { MailboxFolder, MailboxKind, MailboxLabelKind } from '../../generated/wspace-types';
|
|
2
2
|
import { MailboxAccountsQuery, MailboxAttachmentQuery, MailboxLabelsQuery, MailboxMessagesQuery, MailboxThreadQuery, SendMailboxMessageMutation } from '../../generated/wspace-operations';
|
|
3
|
-
|
|
4
3
|
export { MailboxFolder, MailboxKind, MailboxLabelKind };
|
|
5
4
|
/** Files on one outgoing message; matches the service limit. */
|
|
6
5
|
export declare const MAILBOX_MAX_ATTACHMENTS = 10;
|
|
@@ -20,21 +19,17 @@ export type MailboxAttachment = MailboxThreadMessage['attachments'][number];
|
|
|
20
19
|
export type MailboxAttachmentContent = MailboxAttachmentQuery['mailboxAttachment'];
|
|
21
20
|
export declare function useMailboxAccounts(): {
|
|
22
21
|
accounts: {
|
|
23
|
-
__typename?: "MailboxAccount";
|
|
24
22
|
connectionId: string;
|
|
25
23
|
name: string;
|
|
26
24
|
providerKey: string;
|
|
27
25
|
kind: MailboxKind;
|
|
28
|
-
emailAddress
|
|
26
|
+
emailAddress: string | null;
|
|
29
27
|
status: import('../../generated/wspace-types').ConnectionStatus;
|
|
30
28
|
}[];
|
|
31
29
|
answered: boolean;
|
|
32
30
|
loading: boolean;
|
|
33
31
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
34
|
-
refetch: (
|
|
35
|
-
data: any;
|
|
36
|
-
error?: import('@apollo/client').ErrorLike;
|
|
37
|
-
}>;
|
|
32
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxAccountsQuery, Types.MailboxAccountsQueryVariables, undefined>;
|
|
38
33
|
};
|
|
39
34
|
export declare function useMailboxMessages(options: {
|
|
40
35
|
connectionId: string | null;
|
|
@@ -45,96 +40,79 @@ export declare function useMailboxMessages(options: {
|
|
|
45
40
|
pageToken: string | null;
|
|
46
41
|
}): {
|
|
47
42
|
messages: {
|
|
48
|
-
__typename?: "MailboxMessageSummary";
|
|
49
43
|
id: string;
|
|
50
44
|
threadId: string;
|
|
51
45
|
subject: string;
|
|
52
46
|
snippet: string;
|
|
53
|
-
receivedAt
|
|
47
|
+
receivedAt: string | null;
|
|
54
48
|
isUnread: boolean;
|
|
55
49
|
hasAttachments: boolean;
|
|
56
|
-
from
|
|
57
|
-
|
|
58
|
-
name?: string | null;
|
|
50
|
+
from: {
|
|
51
|
+
name: string | null;
|
|
59
52
|
email: string;
|
|
60
53
|
} | null;
|
|
61
54
|
to: Array<{
|
|
62
|
-
|
|
63
|
-
name?: string | null;
|
|
55
|
+
name: string | null;
|
|
64
56
|
email: string;
|
|
65
57
|
}>;
|
|
66
58
|
}[];
|
|
67
59
|
nextPageToken: string | null;
|
|
68
60
|
loading: boolean;
|
|
69
61
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
70
|
-
refetch: (
|
|
71
|
-
data: any;
|
|
72
|
-
error?: import('@apollo/client').ErrorLike;
|
|
73
|
-
}>;
|
|
62
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxMessagesQuery, Types.MailboxMessagesQueryVariables, undefined>;
|
|
74
63
|
};
|
|
75
64
|
export declare function useMailboxThread(connectionId: string | null, threadId: string | null): {
|
|
76
65
|
thread: {
|
|
77
|
-
__typename?: "MailboxThread";
|
|
78
66
|
id: string;
|
|
79
67
|
subject: string;
|
|
80
68
|
messages: Array<{
|
|
81
|
-
__typename?: "MailboxMessage";
|
|
82
69
|
id: string;
|
|
83
70
|
threadId: string;
|
|
84
71
|
subject: string;
|
|
85
|
-
receivedAt
|
|
72
|
+
receivedAt: string | null;
|
|
86
73
|
isUnread: boolean;
|
|
87
74
|
hasAttachments: boolean;
|
|
88
75
|
bodyText: string;
|
|
89
|
-
bodyHtml
|
|
76
|
+
bodyHtml: string | null;
|
|
90
77
|
attachments: Array<{
|
|
91
|
-
__typename?: "MailboxAttachment";
|
|
92
78
|
id: string;
|
|
93
79
|
filename: string;
|
|
94
80
|
mimeType: string;
|
|
95
81
|
size: number;
|
|
96
82
|
isInline: boolean;
|
|
97
|
-
contentId
|
|
83
|
+
contentId: string | null;
|
|
98
84
|
}>;
|
|
99
|
-
from
|
|
100
|
-
|
|
101
|
-
name?: string | null;
|
|
85
|
+
from: {
|
|
86
|
+
name: string | null;
|
|
102
87
|
email: string;
|
|
103
88
|
} | null;
|
|
104
89
|
to: Array<{
|
|
105
|
-
|
|
106
|
-
name?: string | null;
|
|
90
|
+
name: string | null;
|
|
107
91
|
email: string;
|
|
108
92
|
}>;
|
|
109
93
|
cc: Array<{
|
|
110
|
-
|
|
111
|
-
name?: string | null;
|
|
94
|
+
name: string | null;
|
|
112
95
|
email: string;
|
|
113
96
|
}>;
|
|
114
97
|
}>;
|
|
115
98
|
} | null;
|
|
116
99
|
loading: boolean;
|
|
117
100
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
118
|
-
refetch: (
|
|
119
|
-
data: any;
|
|
120
|
-
error?: import('@apollo/client').ErrorLike;
|
|
121
|
-
}>;
|
|
101
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.MailboxThreadQuery, Types.MailboxThreadQueryVariables, undefined>;
|
|
122
102
|
};
|
|
123
103
|
export declare function useMailboxLabels(connectionId: string | null): {
|
|
124
104
|
labels: {
|
|
125
|
-
__typename?: "MailboxLabel";
|
|
126
105
|
id: string;
|
|
127
106
|
name: string;
|
|
128
107
|
kind: MailboxLabelKind;
|
|
129
|
-
unreadCount
|
|
130
|
-
totalCount
|
|
108
|
+
unreadCount: number | null;
|
|
109
|
+
totalCount: number | null;
|
|
131
110
|
}[];
|
|
132
111
|
loading: boolean;
|
|
133
112
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
134
113
|
};
|
|
135
114
|
/** Fetches one received attachment's bytes. Never cached: files can be large. */
|
|
136
115
|
export declare function useMailboxAttachmentContent(): (connectionId: string, messageId: string, attachmentId: string) => Promise<{
|
|
137
|
-
__typename?: "MailboxAttachmentContent";
|
|
138
116
|
filename: string;
|
|
139
117
|
mimeType: string;
|
|
140
118
|
size: number;
|
|
@@ -168,9 +146,8 @@ export interface SendMailInput {
|
|
|
168
146
|
}
|
|
169
147
|
export declare function useSendMail(): {
|
|
170
148
|
send: (input: SendMailInput) => Promise<{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
threadId?: string | null;
|
|
149
|
+
messageId: string | null;
|
|
150
|
+
threadId: string | null;
|
|
174
151
|
} | null>;
|
|
175
152
|
sending: boolean;
|
|
176
153
|
};
|
|
@@ -181,4 +158,3 @@ export declare function useSetMailRead(): (connectionId: string, messageId: stri
|
|
|
181
158
|
* as one address instead of receiving fragments of it.
|
|
182
159
|
*/
|
|
183
160
|
export declare function splitRecipients(value: string): string[];
|
|
184
|
-
//# sourceMappingURL=useMailbox.d.ts.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useArchiveMailboxThreadMutation as
|
|
3
|
-
import {
|
|
4
|
-
import { useCallback as
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
[
|
|
8
|
-
[
|
|
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
9
|
};
|
|
10
|
-
function
|
|
11
|
-
let { workspaceId:
|
|
12
|
-
skip: !
|
|
10
|
+
function _() {
|
|
11
|
+
let { workspaceId: e } = m(), { data: t, loading: n, error: r, refetch: a } = i({
|
|
12
|
+
skip: !e,
|
|
13
13
|
errorPolicy: "all",
|
|
14
14
|
fetchPolicy: "cache-and-network"
|
|
15
|
-
}),
|
|
15
|
+
}), o = t;
|
|
16
16
|
return {
|
|
17
|
-
accounts:
|
|
18
|
-
answered:
|
|
19
|
-
loading:
|
|
20
|
-
error:
|
|
21
|
-
refetch:
|
|
17
|
+
accounts: o?.mailboxAccounts ?? [],
|
|
18
|
+
answered: o?.mailboxAccounts !== void 0,
|
|
19
|
+
loading: n,
|
|
20
|
+
error: r,
|
|
21
|
+
refetch: a
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
let { connectionId: t, folder: n, folderId: r, query: i, pageToken: a } = e, { data: o, loading:
|
|
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({
|
|
26
26
|
variables: { input: {
|
|
27
27
|
connectionId: t ?? "",
|
|
28
28
|
folder: n,
|
|
@@ -38,13 +38,13 @@ function g(e) {
|
|
|
38
38
|
return {
|
|
39
39
|
messages: d?.mailboxMessages.messages ?? [],
|
|
40
40
|
nextPageToken: d?.mailboxMessages.nextPageToken ?? null,
|
|
41
|
-
loading:
|
|
42
|
-
error:
|
|
41
|
+
loading: s,
|
|
42
|
+
error: c,
|
|
43
43
|
refetch: u
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let { data: n, loading: r, error: i, refetch: a } =
|
|
46
|
+
function y(e, t) {
|
|
47
|
+
let { data: n, loading: r, error: i, refetch: a } = u({
|
|
48
48
|
variables: {
|
|
49
49
|
connectionId: e ?? "",
|
|
50
50
|
threadId: t ?? ""
|
|
@@ -60,8 +60,8 @@ function _(e, t) {
|
|
|
60
60
|
refetch: a
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
let { data: t, loading: n, error: r } =
|
|
63
|
+
function b(e) {
|
|
64
|
+
let { data: t, loading: n, error: r } = c({
|
|
65
65
|
variables: { connectionId: e ?? "" },
|
|
66
66
|
skip: !e,
|
|
67
67
|
errorPolicy: "none",
|
|
@@ -73,9 +73,9 @@ function v(e) {
|
|
|
73
73
|
error: r
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let [e] =
|
|
78
|
-
return
|
|
76
|
+
function x() {
|
|
77
|
+
let [e] = s({ fetchPolicy: "no-cache" });
|
|
78
|
+
return h(async (t, n, r) => {
|
|
79
79
|
let i = await e({ variables: {
|
|
80
80
|
connectionId: t,
|
|
81
81
|
messageId: n,
|
|
@@ -87,27 +87,27 @@ function y() {
|
|
|
87
87
|
return a;
|
|
88
88
|
}, [e]);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
let [e,
|
|
90
|
+
function S() {
|
|
91
|
+
let [e, t] = r(), [n, i] = p();
|
|
92
92
|
return {
|
|
93
|
-
archiveThread:
|
|
93
|
+
archiveThread: h(async (t, n) => {
|
|
94
94
|
await e({ variables: {
|
|
95
95
|
connectionId: t,
|
|
96
96
|
threadId: n
|
|
97
97
|
} });
|
|
98
98
|
}, [e]),
|
|
99
|
-
trashThread:
|
|
100
|
-
await
|
|
99
|
+
trashThread: h(async (e, t) => {
|
|
100
|
+
await n({ variables: {
|
|
101
101
|
connectionId: e,
|
|
102
102
|
threadId: t
|
|
103
103
|
} });
|
|
104
|
-
}, [
|
|
105
|
-
busy:
|
|
104
|
+
}, [n]),
|
|
105
|
+
busy: t.loading || i.loading
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
let [e] =
|
|
110
|
-
return
|
|
108
|
+
function C() {
|
|
109
|
+
let [e] = o(), [t] = a();
|
|
110
|
+
return h(async (n) => {
|
|
111
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
112
|
fileName: n.name,
|
|
113
113
|
fileSize: o,
|
|
@@ -132,10 +132,10 @@ function x() {
|
|
|
132
132
|
};
|
|
133
133
|
}, [e, t]);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
let [e, { loading: t }] =
|
|
135
|
+
function w() {
|
|
136
|
+
let [e, { loading: t }] = d();
|
|
137
137
|
return {
|
|
138
|
-
send:
|
|
138
|
+
send: h(async (t) => (await e({ variables: { input: {
|
|
139
139
|
connectionId: t.connectionId,
|
|
140
140
|
to: t.to,
|
|
141
141
|
cc: t.cc ?? null,
|
|
@@ -147,9 +147,9 @@ function S() {
|
|
|
147
147
|
sending: t
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
let [e] =
|
|
152
|
-
return
|
|
150
|
+
function T() {
|
|
151
|
+
let [e] = f();
|
|
152
|
+
return h(async (t, n, r) => {
|
|
153
153
|
await e({ variables: {
|
|
154
154
|
connectionId: t,
|
|
155
155
|
messageId: n,
|
|
@@ -157,10 +157,9 @@ function C() {
|
|
|
157
157
|
} });
|
|
158
158
|
}, [e]);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function E(e) {
|
|
161
161
|
return e.split(/[,;\r\n]+/).map((e) => e.trim()).filter(Boolean);
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
export { m as MAILBOX_SEND_ATTACHMENT_BYTES, w as splitRecipients, h as useMailboxAccounts, y as useMailboxAttachmentContent, v as useMailboxLabels, g as useMailboxMessages, _ as useMailboxThread, b as useMailboxThreadActions, S as useSendMail, C as useSetMailRead, x as useUploadMailAttachment };
|
|
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 };
|
|
165
164
|
|
|
166
165
|
//# sourceMappingURL=useMailbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMailbox.js","names":[],"sources":["../../../src/integrations/hooks/useMailbox.ts"],"sourcesContent":["/**\n * Connected mailbox hooks (BOFF-4422): the caller's own Gmail / Outlook\n * connections, a page of messages, one conversation, and send / mark read.\n */\nimport { useCallback } from 'react';\n\nimport { MailboxFolder, MailboxKind, MailboxLabelKind } from '../../generated/wspace-types';\nimport type {\n MailboxAccountsQuery,\n MailboxAttachmentCompleteUploadMutation,\n MailboxAttachmentInitiateUploadMutation,\n MailboxAttachmentQuery,\n MailboxLabelsQuery,\n MailboxMessagesQuery,\n MailboxThreadQuery,\n SendMailboxMessageMutation,\n} from '../../generated/wspace-operations';\nimport {\n useArchiveMailboxThreadMutation,\n useMailboxAccountsQuery,\n useMailboxAttachmentCompleteUploadMutation,\n useMailboxAttachmentInitiateUploadMutation,\n useMailboxAttachmentLazyQuery,\n useMailboxLabelsQuery,\n useMailboxMessagesQuery,\n useMailboxThreadQuery,\n useSendMailboxMessageMutation,\n useSetMailboxMessageReadMutation,\n useTrashMailboxThreadMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\n\nexport { MailboxFolder, MailboxKind, MailboxLabelKind };\n\n/** Files on one outgoing message; matches the service limit. */\nexport const MAILBOX_MAX_ATTACHMENTS = 10;\n\n/**\n * Total attachment bytes per outgoing message, matching the service caps:\n * Gmail takes a 25 MB message, Microsoft Graph 4 MB per request.\n */\nexport const MAILBOX_SEND_ATTACHMENT_BYTES: Readonly<Record<MailboxKind, number>> = {\n [MailboxKind.Gmail]: 17 * 1024 * 1024,\n [MailboxKind.Outlook]: Math.floor(2.5 * 1024 * 1024),\n};\n\nexport const MAILBOX_PAGE_SIZE = 25;\n\n/*\n * The generated hooks reference result types through `Types.*`, which the\n * import-types preset does not emit into wspace-types.ts, so their `data` is\n * untyped. The operation result types below are generated in\n * wspace-operations.ts and pin the shapes this module hands to the page.\n */\nexport type MailboxAccount = MailboxAccountsQuery['mailboxAccounts'][number];\nexport type MailboxMessageSummary = MailboxMessagesQuery['mailboxMessages']['messages'][number];\nexport type MailboxThread = NonNullable<MailboxThreadQuery['mailboxThread']>;\nexport type MailboxSendResult = SendMailboxMessageMutation['sendMailboxMessage'];\nexport type MailboxLabel = MailboxLabelsQuery['mailboxLabels'][number];\nexport type MailboxThreadMessage = MailboxThread['messages'][number];\nexport type MailboxAttachment = MailboxThreadMessage['attachments'][number];\nexport type MailboxAttachmentContent = MailboxAttachmentQuery['mailboxAttachment'];\n\nexport function useMailboxAccounts() {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useMailboxAccountsQuery({\n skip: !workspaceId,\n errorPolicy: 'all',\n fetchPolicy: 'cache-and-network',\n });\n const typed = data as MailboxAccountsQuery | undefined;\n const accounts: MailboxAccount[] = typed?.mailboxAccounts ?? [];\n // True once the gateway has answered; a skipped query (no workspace yet)\n // must not read as \"no mailboxes connected\".\n const answered = typed?.mailboxAccounts !== undefined;\n return { accounts, answered, loading, error, refetch };\n}\n\nexport function useMailboxMessages(options: {\n connectionId: string | null;\n folder: MailboxFolder;\n /** A label or folder from useMailboxLabels; replaces `folder` when set. */\n folderId: string | null;\n query: string;\n pageToken: string | null;\n}) {\n const { connectionId, folder, folderId, query, pageToken } = options;\n const { data, loading, error, refetch } = useMailboxMessagesQuery({\n variables: {\n input: {\n connectionId: connectionId ?? '',\n folder,\n folderId,\n query: query || null,\n pageToken,\n limit: MAILBOX_PAGE_SIZE,\n },\n },\n skip: !connectionId,\n errorPolicy: 'none',\n fetchPolicy: 'network-only',\n });\n const typed = data as MailboxMessagesQuery | undefined;\n const messages: MailboxMessageSummary[] = typed?.mailboxMessages.messages ?? [];\n const nextPageToken: string | null = typed?.mailboxMessages.nextPageToken ?? null;\n return {\n messages,\n nextPageToken,\n loading,\n error,\n refetch,\n };\n}\n\nexport function useMailboxThread(connectionId: string | null, threadId: string | null) {\n const { data, loading, error, refetch } = useMailboxThreadQuery({\n variables: { connectionId: connectionId ?? '', threadId: threadId ?? '' },\n skip: !connectionId || !threadId,\n errorPolicy: 'none',\n fetchPolicy: 'network-only',\n });\n const thread: MailboxThread | null =\n (data as MailboxThreadQuery | undefined)?.mailboxThread ?? null;\n return { thread, loading, error, refetch };\n}\n\nexport function useMailboxLabels(connectionId: string | null) {\n const { data, loading, error } = useMailboxLabelsQuery({\n variables: { connectionId: connectionId ?? '' },\n skip: !connectionId,\n errorPolicy: 'none',\n fetchPolicy: 'cache-and-network',\n });\n const labels: MailboxLabel[] = (data as MailboxLabelsQuery | undefined)?.mailboxLabels ?? [];\n return { labels, loading, error };\n}\n\n/** Fetches one received attachment's bytes. Never cached: files can be large. */\nexport function useMailboxAttachmentContent() {\n const [load] = useMailboxAttachmentLazyQuery({ fetchPolicy: 'no-cache' });\n return useCallback(\n async (connectionId: string, messageId: string, attachmentId: string) => {\n const result = await load({ variables: { connectionId, messageId, attachmentId } });\n if (result.error) throw result.error;\n const content: MailboxAttachmentContent | null =\n (result.data as MailboxAttachmentQuery | undefined)?.mailboxAttachment ?? null;\n if (!content) throw new Error('Attachment not found');\n return content;\n },\n [load]\n );\n}\n\nexport function useMailboxThreadActions() {\n const [archive, archiveState] = useArchiveMailboxThreadMutation();\n const [trash, trashState] = useTrashMailboxThreadMutation();\n const archiveThread = useCallback(\n async (connectionId: string, threadId: string) => {\n await archive({ variables: { connectionId, threadId } });\n },\n [archive]\n );\n const trashThread = useCallback(\n async (connectionId: string, threadId: string) => {\n await trash({ variables: { connectionId, threadId } });\n },\n [trash]\n );\n return { archiveThread, trashThread, busy: archiveState.loading || trashState.loading };\n}\n\n/** A file uploaded to Files for an outgoing message. */\nexport interface PendingMailAttachment {\n fileId: string;\n name: string;\n size: number;\n}\n\n/**\n * Uploads a file to wspace-files-svc (initiateUpload, PUT to the presigned\n * URL, completeUpload) so sendMailboxMessage can attach it by id. The service\n * reads it back as the caller; the bytes never pass through the gateway.\n */\nexport function useUploadMailAttachment() {\n const [initiate] = useMailboxAttachmentInitiateUploadMutation();\n const [complete] = useMailboxAttachmentCompleteUploadMutation();\n return useCallback(\n async (file: File): Promise<PendingMailAttachment> => {\n const mimeType = file.type || 'application/octet-stream';\n const dot = file.name.lastIndexOf('.');\n const extension = dot > 0 ? file.name.slice(dot + 1).toLowerCase() : 'bin';\n const fileSize = String(file.size);\n const started = await initiate({\n variables: { input: { fileName: file.name, fileSize, mimeType, extension } },\n });\n const session = (started.data as MailboxAttachmentInitiateUploadMutation | null | undefined)\n ?.initiateUpload;\n if (!session?.uploadUrl || !session.session.id) {\n throw new Error(`Could not start uploading ${file.name}`);\n }\n const put = await fetch(session.uploadUrl, {\n method: 'PUT',\n body: file,\n headers: { 'Content-Type': mimeType },\n });\n if (!put.ok) throw new Error(`Uploading ${file.name} failed`);\n const done = await complete({\n variables: { input: { sessionId: session.session.id, fileSize } },\n });\n const fileId = (done.data as MailboxAttachmentCompleteUploadMutation | null | undefined)\n ?.completeUpload.fileId;\n if (!fileId) throw new Error(`Could not finish uploading ${file.name}`);\n return { fileId, name: file.name, size: file.size };\n },\n [initiate, complete]\n );\n}\n\nexport interface SendMailInput {\n connectionId: string;\n to: string[];\n cc?: string[];\n subject?: string;\n bodyText: string;\n replyToMessageId?: string;\n attachmentFileIds?: string[];\n}\n\nexport function useSendMail() {\n const [mutate, { loading }] = useSendMailboxMessageMutation();\n const send = useCallback(\n async (input: SendMailInput) => {\n const result = await mutate({\n variables: {\n input: {\n connectionId: input.connectionId,\n to: input.to,\n cc: input.cc ?? null,\n subject: input.subject ?? null,\n bodyText: input.bodyText,\n replyToMessageId: input.replyToMessageId ?? null,\n attachmentFileIds: input.attachmentFileIds?.length ? input.attachmentFileIds : null,\n },\n },\n });\n const sent: MailboxSendResult | null =\n (result.data as SendMailboxMessageMutation | null | undefined)?.sendMailboxMessage ?? null;\n return sent;\n },\n [mutate]\n );\n return { send, sending: loading };\n}\n\nexport function useSetMailRead() {\n const [mutate] = useSetMailboxMessageReadMutation();\n return useCallback(\n async (connectionId: string, messageId: string, read: boolean) => {\n await mutate({ variables: { connectionId, messageId, read } });\n },\n [mutate]\n );\n}\n\n/**\n * Splits a recipient field on commas, semicolons and line breaks. Spaces are\n * not separators, so a pasted entry stays whole and the service validates it\n * as one address instead of receiving fragments of it.\n */\nexport function splitRecipients(value: string): string[] {\n return value\n .split(/[,;\\r\\n]+/)\n .map((part) => part.trim())\n .filter(Boolean);\n}\n"],"mappings":";;;;;AAyCA,IAAa,IAAuE;EACjF,EAAY,QAAQ,KAAK,OAAO;EAChC,EAAY,UAAU;CACxB;AAmBD,SAAgB,IAAqB;CACnC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAwB;EAChE,MAAM,CAAC;EAC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AS,EAC1B,WAAW,EAAE,OAAO;GAAE,WAAW,EAAQ,QAAQ;GAAI;GAAU,EAAE,EAClE,CAAC,EACmB,MACjB,eAAe;AACnB,MAAI,CAAC,EAAQ,OAAU,MAAM,8BAA8B,EAAK,OAAO;AACvE,SAAO;GAAE;GAAQ,MAAM,EAAK;GAAM,MAAM,EAAK;GAAM;IAErD,CAAC,GAAU,EAAS,CACrB;;AAaH,SAAgB,IAAc;CAC5B,IAAM,CAAC,GAAQ,EAAE,gBAAa,GAA+B;AAsB7D,QAAO;EAAE,MArBI,EACX,OAAO,OACU,MAAM,EAAO,EAC1B,WAAW,EACT,OAAO;GACL,cAAc,EAAM;GACpB,IAAI,EAAM;GACV,IAAI,EAAM,MAAM;GAChB,SAAS,EAAM,WAAW;GAC1B,UAAU,EAAM;GAChB,kBAAkB,EAAM,oBAAoB;GAC5C,mBAAmB,EAAM,mBAAmB,SAAS,EAAM,oBAAoB;GAChF,EACF,EACF,CAAC,EAEQ,MAAwD,sBAAsB,MAG1F,CAAC,EAAO,CACT;EACc,SAAS;EAAS;;AAGnC,SAAgB,IAAiB;CAC/B,IAAM,CAAC,KAAU,GAAkC;AACnD,QAAO,EACL,OAAO,GAAsB,GAAmB,MAAkB;AAChE,QAAM,EAAO,EAAE,WAAW;GAAE;GAAc;GAAW;GAAM,EAAE,CAAC;IAEhE,CAAC,EAAO,CACT;;AAQH,SAAgB,EAAgB,GAAyB;AACvD,QAAO,EACJ,MAAM,YAAY,CAClB,KAAK,MAAS,EAAK,MAAM,CAAC,CAC1B,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"useMailbox.js","names":["MAILBOX_SEND_ATTACHMENT_BYTES","MailboxKind","useMailboxAccounts","useIntegrations","useMailboxAccountsQuery","workspaceId","typed","data","useMailboxMessages","options","useMailboxMessagesQuery","connectionId","query","useMailboxThread","useMailboxThreadQuery","threadId","useMailboxLabels","useMailboxLabelsQuery","useMailboxAttachmentContent","load","useMailboxAttachmentLazyQuery","useCallback","result","content","useMailboxThreadActions","archive","archiveState","useArchiveMailboxThreadMutation","trash","trashState","useTrashMailboxThreadMutation","useUploadMailAttachment","initiate","useMailboxAttachmentInitiateUploadMutation","complete","useMailboxAttachmentCompleteUploadMutation","mimeType","file","dot","extension","fileSize","session","fileId","useSendMail","mutate","useSendMailboxMessageMutation","input","loading","useSetMailRead","useSetMailboxMessageReadMutation","splitRecipients","value","part","MailboxFolder","MailboxLabelKind"],"sources":["../../../src/integrations/hooks/useMailbox.ts"],"sourcesContent":["/**\n * Connected mailbox hooks (BOFF-4422): the caller's own Gmail / Outlook\n * connections, a page of messages, one conversation, and send / mark read.\n */\nimport { useCallback } from 'react';\n\nimport { MailboxFolder, MailboxKind, MailboxLabelKind } from '../../generated/wspace-types';\nimport type {\n MailboxAccountsQuery,\n MailboxAttachmentCompleteUploadMutation,\n MailboxAttachmentInitiateUploadMutation,\n MailboxAttachmentQuery,\n MailboxLabelsQuery,\n MailboxMessagesQuery,\n MailboxThreadQuery,\n SendMailboxMessageMutation,\n} from '../../generated/wspace-operations';\nimport {\n useArchiveMailboxThreadMutation,\n useMailboxAccountsQuery,\n useMailboxAttachmentCompleteUploadMutation,\n useMailboxAttachmentInitiateUploadMutation,\n useMailboxAttachmentLazyQuery,\n useMailboxLabelsQuery,\n useMailboxMessagesQuery,\n useMailboxThreadQuery,\n useSendMailboxMessageMutation,\n useSetMailboxMessageReadMutation,\n useTrashMailboxThreadMutation,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\n\nexport { MailboxFolder, MailboxKind, MailboxLabelKind };\n\n/** Files on one outgoing message; matches the service limit. */\nexport const MAILBOX_MAX_ATTACHMENTS = 10;\n\n/**\n * Total attachment bytes per outgoing message, matching the service caps:\n * Gmail takes a 25 MB message, Microsoft Graph 4 MB per request.\n */\nexport const MAILBOX_SEND_ATTACHMENT_BYTES: Readonly<Record<MailboxKind, number>> = {\n [MailboxKind.Gmail]: 17 * 1024 * 1024,\n [MailboxKind.Outlook]: Math.floor(2.5 * 1024 * 1024),\n};\n\nexport const MAILBOX_PAGE_SIZE = 25;\n\n/*\n * The generated hooks reference result types through `Types.*`, which the\n * import-types preset does not emit into wspace-types.ts, so their `data` is\n * untyped. The operation result types below are generated in\n * wspace-operations.ts and pin the shapes this module hands to the page.\n */\nexport type MailboxAccount = MailboxAccountsQuery['mailboxAccounts'][number];\nexport type MailboxMessageSummary = MailboxMessagesQuery['mailboxMessages']['messages'][number];\nexport type MailboxThread = NonNullable<MailboxThreadQuery['mailboxThread']>;\nexport type MailboxSendResult = SendMailboxMessageMutation['sendMailboxMessage'];\nexport type MailboxLabel = MailboxLabelsQuery['mailboxLabels'][number];\nexport type MailboxThreadMessage = MailboxThread['messages'][number];\nexport type MailboxAttachment = MailboxThreadMessage['attachments'][number];\nexport type MailboxAttachmentContent = MailboxAttachmentQuery['mailboxAttachment'];\n\nexport function useMailboxAccounts() {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useMailboxAccountsQuery({\n skip: !workspaceId,\n errorPolicy: 'all',\n fetchPolicy: 'cache-and-network',\n });\n const typed = data as MailboxAccountsQuery | undefined;\n const accounts: MailboxAccount[] = typed?.mailboxAccounts ?? [];\n // True once the gateway has answered; a skipped query (no workspace yet)\n // must not read as \"no mailboxes connected\".\n const answered = typed?.mailboxAccounts !== undefined;\n return { accounts, answered, loading, error, refetch };\n}\n\nexport function useMailboxMessages(options: {\n connectionId: string | null;\n folder: MailboxFolder;\n /** A label or folder from useMailboxLabels; replaces `folder` when set. */\n folderId: string | null;\n query: string;\n pageToken: string | null;\n}) {\n const { connectionId, folder, folderId, query, pageToken } = options;\n const { data, loading, error, refetch } = useMailboxMessagesQuery({\n variables: {\n input: {\n connectionId: connectionId ?? '',\n folder,\n folderId,\n query: query || null,\n pageToken,\n limit: MAILBOX_PAGE_SIZE,\n },\n },\n skip: !connectionId,\n errorPolicy: 'none',\n fetchPolicy: 'network-only',\n });\n const typed = data as MailboxMessagesQuery | undefined;\n const messages: MailboxMessageSummary[] = typed?.mailboxMessages.messages ?? [];\n const nextPageToken: string | null = typed?.mailboxMessages.nextPageToken ?? null;\n return {\n messages,\n nextPageToken,\n loading,\n error,\n refetch,\n };\n}\n\nexport function useMailboxThread(connectionId: string | null, threadId: string | null) {\n const { data, loading, error, refetch } = useMailboxThreadQuery({\n variables: { connectionId: connectionId ?? '', threadId: threadId ?? '' },\n skip: !connectionId || !threadId,\n errorPolicy: 'none',\n fetchPolicy: 'network-only',\n });\n const thread: MailboxThread | null =\n (data as MailboxThreadQuery | undefined)?.mailboxThread ?? null;\n return { thread, loading, error, refetch };\n}\n\nexport function useMailboxLabels(connectionId: string | null) {\n const { data, loading, error } = useMailboxLabelsQuery({\n variables: { connectionId: connectionId ?? '' },\n skip: !connectionId,\n errorPolicy: 'none',\n fetchPolicy: 'cache-and-network',\n });\n const labels: MailboxLabel[] = (data as MailboxLabelsQuery | undefined)?.mailboxLabels ?? [];\n return { labels, loading, error };\n}\n\n/** Fetches one received attachment's bytes. Never cached: files can be large. */\nexport function useMailboxAttachmentContent() {\n const [load] = useMailboxAttachmentLazyQuery({ fetchPolicy: 'no-cache' });\n return useCallback(\n async (connectionId: string, messageId: string, attachmentId: string) => {\n const result = await load({ variables: { connectionId, messageId, attachmentId } });\n if (result.error) throw result.error;\n const content: MailboxAttachmentContent | null =\n (result.data as MailboxAttachmentQuery | undefined)?.mailboxAttachment ?? null;\n if (!content) throw new Error('Attachment not found');\n return content;\n },\n [load]\n );\n}\n\nexport function useMailboxThreadActions() {\n const [archive, archiveState] = useArchiveMailboxThreadMutation();\n const [trash, trashState] = useTrashMailboxThreadMutation();\n const archiveThread = useCallback(\n async (connectionId: string, threadId: string) => {\n await archive({ variables: { connectionId, threadId } });\n },\n [archive]\n );\n const trashThread = useCallback(\n async (connectionId: string, threadId: string) => {\n await trash({ variables: { connectionId, threadId } });\n },\n [trash]\n );\n return { archiveThread, trashThread, busy: archiveState.loading || trashState.loading };\n}\n\n/** A file uploaded to Files for an outgoing message. */\nexport interface PendingMailAttachment {\n fileId: string;\n name: string;\n size: number;\n}\n\n/**\n * Uploads a file to wspace-files-svc (initiateUpload, PUT to the presigned\n * URL, completeUpload) so sendMailboxMessage can attach it by id. The service\n * reads it back as the caller; the bytes never pass through the gateway.\n */\nexport function useUploadMailAttachment() {\n const [initiate] = useMailboxAttachmentInitiateUploadMutation();\n const [complete] = useMailboxAttachmentCompleteUploadMutation();\n return useCallback(\n async (file: File): Promise<PendingMailAttachment> => {\n const mimeType = file.type || 'application/octet-stream';\n const dot = file.name.lastIndexOf('.');\n const extension = dot > 0 ? file.name.slice(dot + 1).toLowerCase() : 'bin';\n const fileSize = String(file.size);\n const started = await initiate({\n variables: { input: { fileName: file.name, fileSize, mimeType, extension } },\n });\n const session = (started.data as MailboxAttachmentInitiateUploadMutation | null | undefined)\n ?.initiateUpload;\n if (!session?.uploadUrl || !session.session.id) {\n throw new Error(`Could not start uploading ${file.name}`);\n }\n const put = await fetch(session.uploadUrl, {\n method: 'PUT',\n body: file,\n headers: { 'Content-Type': mimeType },\n });\n if (!put.ok) throw new Error(`Uploading ${file.name} failed`);\n const done = await complete({\n variables: { input: { sessionId: session.session.id, fileSize } },\n });\n const fileId = (done.data as MailboxAttachmentCompleteUploadMutation | null | undefined)\n ?.completeUpload.fileId;\n if (!fileId) throw new Error(`Could not finish uploading ${file.name}`);\n return { fileId, name: file.name, size: file.size };\n },\n [initiate, complete]\n );\n}\n\nexport interface SendMailInput {\n connectionId: string;\n to: string[];\n cc?: string[];\n subject?: string;\n bodyText: string;\n replyToMessageId?: string;\n attachmentFileIds?: string[];\n}\n\nexport function useSendMail() {\n const [mutate, { loading }] = useSendMailboxMessageMutation();\n const send = useCallback(\n async (input: SendMailInput) => {\n const result = await mutate({\n variables: {\n input: {\n connectionId: input.connectionId,\n to: input.to,\n cc: input.cc ?? null,\n subject: input.subject ?? null,\n bodyText: input.bodyText,\n replyToMessageId: input.replyToMessageId ?? null,\n attachmentFileIds: input.attachmentFileIds?.length ? input.attachmentFileIds : null,\n },\n },\n });\n const sent: MailboxSendResult | null =\n (result.data as SendMailboxMessageMutation | null | undefined)?.sendMailboxMessage ?? null;\n return sent;\n },\n [mutate]\n );\n return { send, sending: loading };\n}\n\nexport function useSetMailRead() {\n const [mutate] = useSetMailboxMessageReadMutation();\n return useCallback(\n async (connectionId: string, messageId: string, read: boolean) => {\n await mutate({ variables: { connectionId, messageId, read } });\n },\n [mutate]\n );\n}\n\n/**\n * Splits a recipient field on commas, semicolons and line breaks. Spaces are\n * not separators, so a pasted entry stays whole and the service validates it\n * as one address instead of receiving fragments of it.\n */\nexport function splitRecipients(value: string): string[] {\n return value\n .split(/[,;\\r\\n]+/)\n .map((part) => part.trim())\n .filter(Boolean);\n}\n"],"mappings":";;;;;AAyCA,IAAaA,IAAuE;EACjFC,EAAY,QAAQ;EACpBA,EAAY,UAAU;AACzB;AAmBA,SAAgBC,IAAqB;CACnC,IAAM,EAAE,mBAAgBC,EAAgB,GAClC,EAAE,SAAM,YAAS,UAAO,eAAYC,EAAwB;EAChE,MAAM,CAACC;EACP,aAAa;EACb,aAAa;CACf,CAAC,GACKC,IAAQC;CAKd,OAAO;EAAE,UAJ0BD,GAAO,mBAAmB,CAAC;EAI3C,UADFA,GAAO,oBAAoB,KAAA;EACf;EAAS;EAAO;CAAQ;AACvD;AAEA,SAAgBE,EAAmB,GAOhC;CACD,IAAM,EAAE,iBAAc,WAAQ,aAAU,UAAO,iBAAcC,GACvD,EAAE,SAAM,YAAS,UAAO,eAAYC,EAAwB;EAChE,WAAW,EACT,OAAO;GACL,cAAcC,KAAgB;GAC9B;GACA;GACA,OAAOC,KAAS;GAChB;GACA,OAAA;EACF,EACF;EACA,MAAM,CAACD;EACP,aAAa;EACb,aAAa;CACf,CAAC,GACKL,IAAQC;CAGd,OAAO;EACL,UAHwCD,GAAO,gBAAgB,YAAY,CAAC;EAI5E,eAHmCA,GAAO,gBAAgB,iBAAiB;EAI3E;EACA;EACA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,EAC1B,WAAW,EACT,OAAO;GACL,cAAcE,EAAM;GACpB,IAAIA,EAAM;GACV,IAAIA,EAAM,MAAM;GAChB,SAASA,EAAM,WAAW;GAC1B,UAAUA,EAAM;GAChB,kBAAkBA,EAAM,oBAAoB;GAC5C,mBAAmBA,EAAM,mBAAmB,SAASA,EAAM,oBAAoB;EACjF,EACF,EACF,CAAC,EAAA,CAES,MAAwD,sBAAsB,MAG1F,CAACF,CAAM,CAEA;EAAM,SAASG;CAAQ;AAClC;AAEA,SAAgBC,IAAiB;CAC/B,IAAM,CAACJ,KAAUK,EAAiC;CAClD,OAAO5B,EACL,OAAO,GAAsB,GAAmB,MAAkB;EAChE,MAAMuB,EAAO,EAAE,WAAW;GAAE;GAAc;GAAW;EAAK,EAAE,CAAC;CAC/D,GACA,CAACA,CAAM,CACT;AACF;AAOA,SAAgBM,EAAgB,GAAyB;CACvD,OAAOC,EACJ,MAAM,WAAW,CAAC,CAClB,KAAK,MAASC,EAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;AACnB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IntegrationProvider, ProviderCategory, PluginStatus } from '../types';
|
|
2
|
-
|
|
3
2
|
interface ProviderFilterOptions {
|
|
4
3
|
category?: ProviderCategory;
|
|
5
4
|
pluginStatus?: PluginStatus;
|
|
@@ -10,28 +9,19 @@ export declare function useProviders(filter?: ProviderFilterOptions): {
|
|
|
10
9
|
total: number;
|
|
11
10
|
loading: boolean;
|
|
12
11
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
13
|
-
refetch: (
|
|
14
|
-
data: any;
|
|
15
|
-
error?: import('@apollo/client').ErrorLike;
|
|
16
|
-
}>;
|
|
12
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.GetProvidersQuery, Types.GetProvidersQueryVariables, undefined>;
|
|
17
13
|
};
|
|
18
14
|
export declare function useProvider(id: string): {
|
|
19
15
|
provider: IntegrationProvider | null;
|
|
20
16
|
loading: boolean;
|
|
21
17
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
22
|
-
refetch: (
|
|
23
|
-
data: any;
|
|
24
|
-
error?: import('@apollo/client').ErrorLike;
|
|
25
|
-
}>;
|
|
18
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.GetProviderQuery, Types.GetProviderQueryVariables, undefined>;
|
|
26
19
|
};
|
|
27
20
|
export declare function useProviderByKey(key: string): {
|
|
28
21
|
provider: IntegrationProvider | null;
|
|
29
22
|
loading: boolean;
|
|
30
23
|
error: import('@apollo/client').ErrorLike | undefined;
|
|
31
|
-
refetch: (
|
|
32
|
-
data: any;
|
|
33
|
-
error?: import('@apollo/client').ErrorLike;
|
|
34
|
-
}>;
|
|
24
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<Types.GetProviderByKeyQuery, Types.GetProviderByKeyQueryVariables, undefined>;
|
|
35
25
|
};
|
|
36
26
|
export declare function useInstallPlugin(): {
|
|
37
27
|
installPlugin: (input: {
|
|
@@ -123,4 +113,3 @@ export declare function useDeleteAuthMethod(): {
|
|
|
123
113
|
loading: boolean;
|
|
124
114
|
};
|
|
125
115
|
export {};
|
|
126
|
-
//# sourceMappingURL=useProviders.d.ts.map
|