@burdenoff/microfe-integrations 2026.1117.2 → 2026.1118.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.
Files changed (131) hide show
  1. package/dist/generated/global-types.d.ts +398 -121
  2. package/dist/generated/wspace-operations.d.ts +727 -0
  3. package/dist/generated/wspace-operations.js +453 -174
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +3838 -130
  6. package/dist/generated/wspace-types.js +28 -10
  7. package/dist/generated/wspace-types.js.map +1 -1
  8. package/dist/integrations/ConnectSourceDialog.js +30 -21
  9. package/dist/integrations/ConnectSourceDialog.js.map +1 -1
  10. package/dist/integrations/IntegrationsUserRoutes.js +32 -27
  11. package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
  12. package/dist/integrations/connected-apps/components/ActivitySections.d.ts +31 -0
  13. package/dist/integrations/connected-apps/components/ActivitySections.js +147 -0
  14. package/dist/integrations/connected-apps/components/ActivitySections.js.map +1 -0
  15. package/dist/integrations/connected-apps/components/AppItems.d.ts +26 -0
  16. package/dist/integrations/connected-apps/components/AppItems.js +171 -0
  17. package/dist/integrations/connected-apps/components/AppItems.js.map +1 -0
  18. package/dist/integrations/connected-apps/components/AppPanels.d.ts +48 -0
  19. package/dist/integrations/connected-apps/components/AppPanels.js +244 -0
  20. package/dist/integrations/connected-apps/components/AppPanels.js.map +1 -0
  21. package/dist/integrations/connected-apps/components/AppsSections.d.ts +30 -0
  22. package/dist/integrations/connected-apps/components/AppsSections.js +133 -0
  23. package/dist/integrations/connected-apps/components/AppsSections.js.map +1 -0
  24. package/dist/integrations/connected-apps/components/ConnectionActionDialogs.d.ts +30 -0
  25. package/dist/integrations/connected-apps/components/ConnectionActionDialogs.js +200 -0
  26. package/dist/integrations/connected-apps/components/ConnectionActionDialogs.js.map +1 -0
  27. package/dist/integrations/connected-apps/components/ConnectionActions.d.ts +38 -0
  28. package/dist/integrations/connected-apps/components/ConnectionActions.js +162 -0
  29. package/dist/integrations/connected-apps/components/ConnectionActions.js.map +1 -0
  30. package/dist/integrations/connected-apps/components/ConnectionHealth.d.ts +19 -0
  31. package/dist/integrations/connected-apps/components/ConnectionHealth.js +136 -0
  32. package/dist/integrations/connected-apps/components/ConnectionHealth.js.map +1 -0
  33. package/dist/integrations/connected-apps/components/ConnectionItems.d.ts +38 -0
  34. package/dist/integrations/connected-apps/components/ConnectionItems.js +358 -0
  35. package/dist/integrations/connected-apps/components/ConnectionItems.js.map +1 -0
  36. package/dist/integrations/connected-apps/components/ConnectionPanels.d.ts +37 -0
  37. package/dist/integrations/connected-apps/components/ConnectionPanels.js +248 -0
  38. package/dist/integrations/connected-apps/components/ConnectionPanels.js.map +1 -0
  39. package/dist/integrations/connected-apps/components/ConnectionsSections.d.ts +44 -0
  40. package/dist/integrations/connected-apps/components/ConnectionsSections.js +222 -0
  41. package/dist/integrations/connected-apps/components/ConnectionsSections.js.map +1 -0
  42. package/dist/integrations/connected-apps/components/Explainer.d.ts +3 -0
  43. package/dist/integrations/connected-apps/components/Explainer.js +56 -0
  44. package/dist/integrations/connected-apps/components/Explainer.js.map +1 -0
  45. package/dist/integrations/connected-apps/components/ListOrigin.d.ts +21 -0
  46. package/dist/integrations/connected-apps/components/ListOrigin.js +35 -0
  47. package/dist/integrations/connected-apps/components/ListOrigin.js.map +1 -0
  48. package/dist/integrations/connected-apps/components/Notices.d.ts +9 -0
  49. package/dist/integrations/connected-apps/components/Notices.js +71 -0
  50. package/dist/integrations/connected-apps/components/Notices.js.map +1 -0
  51. package/dist/integrations/connected-apps/components/PageFrame.d.ts +27 -0
  52. package/dist/integrations/connected-apps/components/PageFrame.js +55 -0
  53. package/dist/integrations/connected-apps/components/PageFrame.js.map +1 -0
  54. package/dist/integrations/connected-apps/components/Panels.d.ts +28 -0
  55. package/dist/integrations/connected-apps/components/Panels.js +50 -0
  56. package/dist/integrations/connected-apps/components/Panels.js.map +1 -0
  57. package/dist/integrations/connected-apps/components/Results.d.ts +50 -0
  58. package/dist/integrations/connected-apps/components/Results.js +129 -0
  59. package/dist/integrations/connected-apps/components/Results.js.map +1 -0
  60. package/dist/integrations/connected-apps/components/SearchPicker.d.ts +20 -0
  61. package/dist/integrations/connected-apps/components/SearchPicker.js +139 -0
  62. package/dist/integrations/connected-apps/components/SearchPicker.js.map +1 -0
  63. package/dist/integrations/connected-apps/components/StatusChip.d.ts +11 -0
  64. package/dist/integrations/connected-apps/components/StatusChip.js +40 -0
  65. package/dist/integrations/connected-apps/components/StatusChip.js.map +1 -0
  66. package/dist/integrations/connected-apps/components/Toolbar.d.ts +74 -0
  67. package/dist/integrations/connected-apps/components/Toolbar.js +216 -0
  68. package/dist/integrations/connected-apps/components/Toolbar.js.map +1 -0
  69. package/dist/integrations/connected-apps/components/styles.d.ts +12 -0
  70. package/dist/integrations/connected-apps/components/styles.js +15 -0
  71. package/dist/integrations/connected-apps/components/styles.js.map +1 -0
  72. package/dist/integrations/connected-apps/connect/AppPicker.d.ts +7 -0
  73. package/dist/integrations/connected-apps/connect/AppPicker.js +257 -0
  74. package/dist/integrations/connected-apps/connect/AppPicker.js.map +1 -0
  75. package/dist/integrations/connected-apps/connect/ConnectAppDialog.d.ts +18 -0
  76. package/dist/integrations/connected-apps/connect/ConnectAppDialog.js +224 -0
  77. package/dist/integrations/connected-apps/connect/ConnectAppDialog.js.map +1 -0
  78. package/dist/integrations/connected-apps/hooks/useCanCreateConnection.d.ts +1 -0
  79. package/dist/integrations/connected-apps/hooks/useCanCreateConnection.js +10 -0
  80. package/dist/integrations/connected-apps/hooks/useCanCreateConnection.js.map +1 -0
  81. package/dist/integrations/connected-apps/hooks/useConnectedAppsData.d.ts +372 -0
  82. package/dist/integrations/connected-apps/hooks/useConnectedAppsData.js +311 -0
  83. package/dist/integrations/connected-apps/hooks/useConnectedAppsData.js.map +1 -0
  84. package/dist/integrations/connected-apps/hooks/useListState.d.ts +21 -0
  85. package/dist/integrations/connected-apps/hooks/useListState.js +43 -0
  86. package/dist/integrations/connected-apps/hooks/useListState.js.map +1 -0
  87. package/dist/integrations/connected-apps/hooks/usePageChrome.d.ts +12 -0
  88. package/dist/integrations/connected-apps/hooks/usePageChrome.js +46 -0
  89. package/dist/integrations/connected-apps/hooks/usePageChrome.js.map +1 -0
  90. package/dist/integrations/connected-apps/model/activity.d.ts +26 -0
  91. package/dist/integrations/connected-apps/model/activity.js +79 -0
  92. package/dist/integrations/connected-apps/model/activity.js.map +1 -0
  93. package/dist/integrations/connected-apps/model/apps.d.ts +68 -0
  94. package/dist/integrations/connected-apps/model/apps.js +101 -0
  95. package/dist/integrations/connected-apps/model/apps.js.map +1 -0
  96. package/dist/integrations/connected-apps/model/connections.d.ts +58 -0
  97. package/dist/integrations/connected-apps/model/connections.js +55 -0
  98. package/dist/integrations/connected-apps/model/connections.js.map +1 -0
  99. package/dist/integrations/connected-apps/model/health.d.ts +30 -0
  100. package/dist/integrations/connected-apps/model/health.js +54 -0
  101. package/dist/integrations/connected-apps/model/health.js.map +1 -0
  102. package/dist/integrations/connected-apps/model/queries.d.ts +56 -0
  103. package/dist/integrations/connected-apps/model/queries.js +117 -0
  104. package/dist/integrations/connected-apps/model/queries.js.map +1 -0
  105. package/dist/integrations/connected-apps/model/status.d.ts +36 -0
  106. package/dist/integrations/connected-apps/model/status.js +73 -0
  107. package/dist/integrations/connected-apps/model/status.js.map +1 -0
  108. package/dist/integrations/connected-apps/model/translate.d.ts +2 -0
  109. package/dist/integrations/connected-apps/model/urlState.d.ts +52 -0
  110. package/dist/integrations/connected-apps/model/urlState.js +87 -0
  111. package/dist/integrations/connected-apps/model/urlState.js.map +1 -0
  112. package/dist/integrations/connected-apps/pages/ActivityPage.d.ts +1 -0
  113. package/dist/integrations/connected-apps/pages/ActivityPage.js +261 -0
  114. package/dist/integrations/connected-apps/pages/ActivityPage.js.map +1 -0
  115. package/dist/integrations/connected-apps/pages/AppDetailsPage.d.ts +1 -0
  116. package/dist/integrations/connected-apps/pages/AppDetailsPage.js +163 -0
  117. package/dist/integrations/connected-apps/pages/AppDetailsPage.js.map +1 -0
  118. package/dist/integrations/connected-apps/pages/AppsPage.d.ts +1 -0
  119. package/dist/integrations/connected-apps/pages/AppsPage.js +209 -0
  120. package/dist/integrations/connected-apps/pages/AppsPage.js.map +1 -0
  121. package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.d.ts +1 -0
  122. package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.js +240 -0
  123. package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.js.map +1 -0
  124. package/dist/integrations/connected-apps/pages/ConnectionsPage.d.ts +1 -0
  125. package/dist/integrations/connected-apps/pages/ConnectionsPage.js +254 -0
  126. package/dist/integrations/connected-apps/pages/ConnectionsPage.js.map +1 -0
  127. package/dist/integrations/providers/IntegrationsProvider.js +22 -21
  128. package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
  129. package/dist/integrations/translations/en.d.ts +426 -0
  130. package/dist/integrations/types/index.d.ts +9 -0
  131. package/package.json +9 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity.js","names":["levelLabel","level","LogLevel","tr","levelFilterLabel","levelTone","actionLabel","action","LogAction","rangeLabel","range","csvCell","text","value","eventsToCsv","events","event","row"],"sources":["../../../../src/integrations/connected-apps/model/activity.ts"],"sourcesContent":["/**\n * How activity events read in the redesigned Activity logs (BOFF-15373), as\n * plain functions with literal `tr()` calls.\n */\nimport type { GetActivityPageQuery } from '../../../generated/wspace-operations';\nimport { LogAction, LogLevel } from '../../../generated/wspace-types';\nimport type { StatusTone } from './status';\nimport type { Translate } from './translate';\nimport type { ActivityRange } from './urlState';\n\n/** One event as Activity logs reads it. */\nexport type ActivityEvent = GetActivityPageQuery['getIntegrationLogs']['items'][number];\n\nexport function levelLabel(tr: Translate, level: LogLevel): string {\n switch (level) {\n case LogLevel.Error:\n return tr('integrations.connectedApps.level.error', 'Error');\n case LogLevel.Warning:\n return tr('integrations.connectedApps.level.warning', 'Warning');\n case LogLevel.Info:\n return tr('integrations.connectedApps.level.info', 'Info');\n case LogLevel.Debug:\n return tr('integrations.connectedApps.level.debug', 'Debug');\n }\n}\n\n/** The level filter's option, and the results heading for it. */\nexport function levelFilterLabel(tr: Translate, level: LogLevel | 'all'): string {\n switch (level) {\n case 'all':\n return tr('integrations.connectedApps.level.all', 'Every level');\n case LogLevel.Error:\n return tr('integrations.connectedApps.level.errors', 'Errors');\n case LogLevel.Warning:\n return tr('integrations.connectedApps.level.warnings', 'Warnings');\n case LogLevel.Info:\n return tr('integrations.connectedApps.level.info', 'Info');\n case LogLevel.Debug:\n return tr('integrations.connectedApps.level.debug', 'Debug');\n }\n}\n\n/** Errors are red, warnings yellow, the rest quiet. */\nexport function levelTone(level: LogLevel): StatusTone {\n switch (level) {\n case LogLevel.Error:\n return 'danger';\n case LogLevel.Warning:\n return 'warning';\n case LogLevel.Info:\n case LogLevel.Debug:\n return 'neutral';\n }\n}\n\nexport function actionLabel(tr: Translate, action: LogAction): string {\n switch (action) {\n case LogAction.ApiCall:\n return tr('integrations.connectedApps.action.apiCall', 'Request');\n case LogAction.AuthCompleted:\n return tr('integrations.connectedApps.action.authCompleted', 'Sign-in completed');\n case LogAction.AuthFailed:\n return tr('integrations.connectedApps.action.authFailed', 'Sign-in failed');\n case LogAction.AuthInitiated:\n return tr('integrations.connectedApps.action.authInitiated', 'Sign-in started');\n case LogAction.ConnectionCreated:\n return tr('integrations.connectedApps.action.connectionCreated', 'Connection created');\n case LogAction.ConnectionDeleted:\n return tr('integrations.connectedApps.action.connectionDeleted', 'Connection removed');\n case LogAction.ConnectionUpdated:\n return tr('integrations.connectedApps.action.connectionUpdated', 'Connection updated');\n case LogAction.CredentialUpdated:\n return tr('integrations.connectedApps.action.credentialUpdated', 'Key updated');\n case LogAction.PermissionChanged:\n return tr('integrations.connectedApps.action.permissionChanged', 'Sharing changed');\n case LogAction.TokenExpired:\n return tr('integrations.connectedApps.action.tokenExpired', 'Token expired');\n case LogAction.TokenRefreshed:\n return tr('integrations.connectedApps.action.tokenRefreshed', 'Token refreshed');\n case LogAction.TokenRevoked:\n return tr('integrations.connectedApps.action.tokenRevoked', 'Token revoked');\n }\n}\n\nexport function rangeLabel(tr: Translate, range: ActivityRange): string {\n switch (range) {\n case 'all':\n return tr('integrations.connectedApps.range.all', 'Any time');\n case '24h':\n return tr('integrations.connectedApps.range.day', 'Last 24 hours');\n case '7d':\n return tr('integrations.connectedApps.range.week', 'Last 7 days');\n case '30d':\n return tr('integrations.connectedApps.range.month', 'Last 30 days');\n }\n}\n\n/**\n * One quoted CSV cell. Text a spreadsheet would run as a formula (it starts\n * with =, +, -, @, a tab or a carriage return) gets a leading apostrophe:\n * connection names and service messages are not ours to trust.\n */\nfunction csvCell(value: string | number | null | undefined): string {\n const text = String(value ?? '');\n const safe = /^[=+\\-@\\t\\r]/.test(text) ? `'${text}` : text;\n return `\"${safe.replaceAll('\"', '\"\"')}\"`;\n}\n\nexport interface CsvEvent {\n createdAt: string;\n level: LogLevel;\n action: LogAction;\n message: string;\n requestMethod: string | null;\n requestUrl: string | null;\n responseStatus: number | null;\n connectionName: string;\n}\n\n/** The events as CSV, with translated headings; values stay as the service wrote them. */\nexport function eventsToCsv(tr: Translate, events: readonly CsvEvent[]): string {\n const header = [\n tr('integrations.connectedApps.csv.createdAt', 'Time'),\n tr('integrations.connectedApps.csv.level', 'Level'),\n tr('integrations.connectedApps.csv.action', 'Action'),\n tr('integrations.connectedApps.csv.connection', 'Connection'),\n tr('integrations.connectedApps.csv.message', 'Message'),\n tr('integrations.connectedApps.csv.requestMethod', 'Request method'),\n tr('integrations.connectedApps.csv.requestUrl', 'Request URL'),\n tr('integrations.connectedApps.csv.status', 'Status'),\n ];\n const rows = events.map((event) => [\n event.createdAt,\n event.level,\n event.action,\n event.connectionName,\n event.message,\n event.requestMethod,\n event.requestUrl,\n event.responseStatus,\n ]);\n return [header, ...rows].map((row) => row.map(csvCell).join(',')).join('\\n');\n}\n"],"mappings":";;AAaA,SAAgBA,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denoff/fe-libs/connections';
2
+ import { GetAppDetailsQuery } from '../../../generated/wspace-operations';
3
+ import { AuthMethodFlow, AuthType, PluginStatus, ProviderCategory } from '../../../generated/wspace-types';
4
+ import { Translate } from './translate';
5
+ /** Everything an app's page reads. */
6
+ export type AppDetails = NonNullable<GetAppDetailsQuery['getProvider']>;
7
+ /** A category chip's value read back as the service's enum. */
8
+ export declare function isCategory(value: string): value is ProviderCategory;
9
+ export declare function categoryLabel(tr: Translate, category: ProviderCategory): string;
10
+ /** "How you connect": one auth type, in plain words. */
11
+ export declare function authTypeLabel(tr: Translate, authType: AuthType): string;
12
+ /** The "how you connect" filter's options, in menu order. */
13
+ export declare const METHOD_FILTERS: readonly AuthType[];
14
+ export declare function installStatusLabel(tr: Translate, status: PluginStatus): string;
15
+ /** The parts of a provider these rules read. */
16
+ export interface AppMethodsShape {
17
+ authType: AuthType;
18
+ authMethods: ReadonlyArray<{
19
+ key: string;
20
+ displayName: string;
21
+ authType: AuthType;
22
+ flow: AuthMethodFlow;
23
+ isConfigured: boolean;
24
+ isDefault: boolean;
25
+ isEnabled: boolean;
26
+ displayOrder: number;
27
+ }>;
28
+ }
29
+ type AppMethod = AppMethodsShape['authMethods'][number];
30
+ /** The methods a person can pick, default first, then in display order. */
31
+ export declare function enabledMethods<M extends AppMethod>(app: {
32
+ authMethods: readonly M[];
33
+ }): M[];
34
+ /**
35
+ * No sign-in method of this app is set up in this environment, so only an
36
+ * administrator can make it connectable. An app that declares no methods uses
37
+ * its own auth type, which needs no setup.
38
+ */
39
+ export declare function appNeedsAdminSetup(app: AppMethodsShape): boolean;
40
+ /** The auth types a person can actually use to connect, most recommended first. */
41
+ export declare function usableAuthTypes(app: AppMethodsShape): AuthType[];
42
+ /** "Sign in", "API key", or "Sign in or API key": how an app's card says you connect. */
43
+ export declare function methodHint(tr: Translate, app: AppMethodsShape): string;
44
+ /** Whether connecting opens the app's own sign-in window. */
45
+ export declare function isSignInMethod(authType: AuthType): boolean;
46
+ /**
47
+ * An app's website or docs link, only when it is a web address. Catalog
48
+ * links can come from published third-party connectors, so anything other
49
+ * than http(s) is left out rather than rendered as a link.
50
+ */
51
+ export declare function webLink(url: string | null | undefined): string | null;
52
+ /** `messages_read` → "Messages read": the service's feature keys, readable. */
53
+ export declare function featureLabel(feature: string): string;
54
+ /** What connecting with one method involves, when the app doesn't say. */
55
+ export declare function methodDescription(tr: Translate, method: {
56
+ description: string | null;
57
+ flow: AuthMethodFlow;
58
+ authType: AuthType;
59
+ }, appName: string): string;
60
+ /**
61
+ * Whether every way to connect this app keeps a key, so it cannot work in a
62
+ * workspace without a vault. One usable way that keeps none (a minted method,
63
+ * a service account) is enough for the form to have a chance. With no usable
64
+ * way at all, the form itself says an administrator must set one up, so this
65
+ * does not answer for it.
66
+ */
67
+ export declare function alwaysKeepsKey(provider: ConnectionProvider): boolean;
68
+ export {};
@@ -0,0 +1,101 @@
1
+ import { AuthMethodFlow as e, AuthType as t, PluginStatus as n, ProviderCategory as r } from "../../../generated/wspace-types.js";
2
+ import { resolveFlow as i } from "@burdenoff/fe-libs/connections";
3
+ // src/integrations/connected-apps/model/apps.ts
4
+ var a = new Set(Object.values(r));
5
+ function o(e) {
6
+ return a.has(e);
7
+ }
8
+ function s(e, t) {
9
+ switch (t) {
10
+ case r.Accounting: return e("integrations.connectedApps.category.accounting", "Accounting");
11
+ case r.Analytics: return e("integrations.connectedApps.category.analytics", "Analytics");
12
+ case r.Calendar: return e("integrations.connectedApps.category.calendar", "Calendar");
13
+ case r.CloudStorage: return e("integrations.connectedApps.category.cloudStorage", "Cloud storage");
14
+ case r.Communication: return e("integrations.connectedApps.category.communication", "Communication");
15
+ case r.Crm: return e("integrations.connectedApps.category.crm", "CRM & sales");
16
+ case r.Custom: return e("integrations.connectedApps.category.custom", "Custom");
17
+ case r.Development: return e("integrations.connectedApps.category.development", "Developer tools");
18
+ case r.Email: return e("integrations.connectedApps.category.email", "Email");
19
+ case r.Payment: return e("integrations.connectedApps.category.payment", "Payments");
20
+ case r.Productivity: return e("integrations.connectedApps.category.productivity", "Productivity");
21
+ case r.Social: return e("integrations.connectedApps.category.social", "Social");
22
+ }
23
+ }
24
+ function c(e, n) {
25
+ switch (n) {
26
+ case t.Oauth2:
27
+ case t.Oauth1: return e("integrations.connectedApps.method.signIn", "Sign in");
28
+ case t.ApiKey: return e("integrations.connectedApps.method.apiKey", "API key");
29
+ case t.BasicAuth: return e("integrations.connectedApps.method.basicAuth", "Username and password");
30
+ case t.BearerToken: return e("integrations.connectedApps.method.bearerToken", "Access token");
31
+ case t.ServiceAccount: return e("integrations.connectedApps.method.serviceAccount", "Connected for you");
32
+ case t.WorkspaceAppToken: return e("integrations.connectedApps.method.workspaceToken", "Workspace token");
33
+ case t.Custom: return e("integrations.connectedApps.method.custom", "Connection details");
34
+ }
35
+ }
36
+ var l = [
37
+ t.Oauth2,
38
+ t.ApiKey,
39
+ t.BasicAuth,
40
+ t.BearerToken,
41
+ t.Custom,
42
+ t.ServiceAccount,
43
+ t.WorkspaceAppToken
44
+ ];
45
+ function u(e, t) {
46
+ switch (t) {
47
+ case n.Installed: return e("integrations.connectedApps.install.installed", "Installed");
48
+ case n.Available: return e("integrations.connectedApps.install.available", "Available");
49
+ case n.Deprecated: return e("integrations.connectedApps.install.deprecated", "Deprecated");
50
+ case n.Disabled: return e("integrations.connectedApps.install.disabled", "Turned off");
51
+ }
52
+ }
53
+ function d(e) {
54
+ return e.authMethods.filter((e) => e.isEnabled).slice().sort((e, t) => Number(t.isDefault) - Number(e.isDefault) || e.displayOrder - t.displayOrder || e.key.localeCompare(t.key));
55
+ }
56
+ function f(e) {
57
+ let t = d(e);
58
+ return t.length > 0 && t.every((e) => !e.isConfigured);
59
+ }
60
+ function p(e) {
61
+ if (e.authMethods.length === 0) return [e.authType];
62
+ let t = /* @__PURE__ */ new Set();
63
+ for (let n of d(e)) n.isConfigured && t.add(n.authType);
64
+ return [...t];
65
+ }
66
+ function m(e, t) {
67
+ let [n, r] = p(t);
68
+ return n ? r ? e("integrations.connectedApps.method.either", "{{first}} or {{second}}", {
69
+ first: c(e, n),
70
+ second: c(e, r)
71
+ }) : c(e, n) : "";
72
+ }
73
+ function h(e) {
74
+ return e === t.Oauth2 || e === t.Oauth1;
75
+ }
76
+ function g(e) {
77
+ if (!e) return null;
78
+ try {
79
+ let t = new URL(e);
80
+ return t.protocol === "https:" || t.protocol === "http:" ? t.href : null;
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+ function _(e) {
86
+ let t = e.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").trim();
87
+ return t ? t.charAt(0).toUpperCase() + t.slice(1).toLowerCase() : e;
88
+ }
89
+ function v(t, n, r) {
90
+ return n.description ? n.description : n.flow === e.Minted ? t("integrations.connectedApps.app.methodMinted", "Nothing to copy or paste: access is set up for your workspace.") : h(n.authType) ? t("integrations.connectedApps.app.methodSignIn", "Opens {{app}} in a new window so you can sign in and approve access.", { app: r }) : t("integrations.connectedApps.app.methodKey", "Paste a key or details from your {{app}} account. It is stored encrypted.", { app: r });
91
+ }
92
+ function y(e) {
93
+ if (e.authType === "service_account") return !1;
94
+ let t = e.authMethods.filter((e) => e.isEnabled);
95
+ if (t.length === 0) return i(e, null) !== "minted";
96
+ let n = t.filter((e) => e.isConfigured);
97
+ return n.length !== 0 && n.every((t) => i(e, t) !== "minted");
98
+ }
99
+ export { l as METHOD_FILTERS, y as alwaysKeepsKey, f as appNeedsAdminSetup, c as authTypeLabel, s as categoryLabel, d as enabledMethods, _ as featureLabel, u as installStatusLabel, o as isCategory, h as isSignInMethod, v as methodDescription, m as methodHint, p as usableAuthTypes, g as webLink };
100
+
101
+ //# sourceMappingURL=apps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.js","names":["CATEGORIES","ProviderCategory","isCategory","value","categoryLabel","category","tr","authTypeLabel","authType","AuthType","METHOD_FILTERS","installStatusLabel","status","PluginStatus","enabledMethods","app","method","b","a","appNeedsAdminSetup","methods","usableAuthTypes","types","methodHint","first","second","isSignInMethod","webLink","url","parsed","featureLabel","words","feature","methodDescription","AuthMethodFlow","appName","alwaysKeepsKey","provider","enabled","resolveFlow","usable"],"sources":["../../../../src/integrations/connected-apps/model/apps.ts"],"sourcesContent":["/**\n * How apps (providers) read in the redesigned Connected apps (BOFF-15373):\n * category names, how you connect, and whether an admin must set an app up\n * first. Plain functions over the service's own enums, so every category the\n * catalog has is reachable (Productivity, Email and Calendar had no chip, and\n * \"Other\" mixed Custom with Accounting).\n *\n * Every label is a literal `tr()` call, for FluidGrids' static word extractor.\n */\nimport { resolveFlow, type ConnectionProvider } from '@burdenoff/fe-libs/connections';\n\nimport type { GetAppDetailsQuery } from '../../../generated/wspace-operations';\nimport {\n AuthMethodFlow,\n AuthType,\n PluginStatus,\n ProviderCategory,\n} from '../../../generated/wspace-types';\nimport type { Translate } from './translate';\n\n/** Everything an app's page reads. */\nexport type AppDetails = NonNullable<GetAppDetailsQuery['getProvider']>;\n\nconst CATEGORIES: ReadonlySet<string> = new Set(Object.values(ProviderCategory));\n\n/** A category chip's value read back as the service's enum. */\nexport function isCategory(value: string): value is ProviderCategory {\n return CATEGORIES.has(value);\n}\n\nexport function categoryLabel(tr: Translate, category: ProviderCategory): string {\n switch (category) {\n case ProviderCategory.Accounting:\n return tr('integrations.connectedApps.category.accounting', 'Accounting');\n case ProviderCategory.Analytics:\n return tr('integrations.connectedApps.category.analytics', 'Analytics');\n case ProviderCategory.Calendar:\n return tr('integrations.connectedApps.category.calendar', 'Calendar');\n case ProviderCategory.CloudStorage:\n return tr('integrations.connectedApps.category.cloudStorage', 'Cloud storage');\n case ProviderCategory.Communication:\n return tr('integrations.connectedApps.category.communication', 'Communication');\n case ProviderCategory.Crm:\n return tr('integrations.connectedApps.category.crm', 'CRM & sales');\n case ProviderCategory.Custom:\n return tr('integrations.connectedApps.category.custom', 'Custom');\n case ProviderCategory.Development:\n return tr('integrations.connectedApps.category.development', 'Developer tools');\n case ProviderCategory.Email:\n return tr('integrations.connectedApps.category.email', 'Email');\n case ProviderCategory.Payment:\n return tr('integrations.connectedApps.category.payment', 'Payments');\n case ProviderCategory.Productivity:\n return tr('integrations.connectedApps.category.productivity', 'Productivity');\n case ProviderCategory.Social:\n return tr('integrations.connectedApps.category.social', 'Social');\n }\n}\n\n/** \"How you connect\": one auth type, in plain words. */\nexport function authTypeLabel(tr: Translate, authType: AuthType): string {\n switch (authType) {\n case AuthType.Oauth2:\n case AuthType.Oauth1:\n return tr('integrations.connectedApps.method.signIn', 'Sign in');\n case AuthType.ApiKey:\n return tr('integrations.connectedApps.method.apiKey', 'API key');\n case AuthType.BasicAuth:\n return tr('integrations.connectedApps.method.basicAuth', 'Username and password');\n case AuthType.BearerToken:\n return tr('integrations.connectedApps.method.bearerToken', 'Access token');\n case AuthType.ServiceAccount:\n return tr('integrations.connectedApps.method.serviceAccount', 'Connected for you');\n case AuthType.WorkspaceAppToken:\n return tr('integrations.connectedApps.method.workspaceToken', 'Workspace token');\n case AuthType.Custom:\n return tr('integrations.connectedApps.method.custom', 'Connection details');\n }\n}\n\n/** The \"how you connect\" filter's options, in menu order. */\nexport const METHOD_FILTERS: readonly AuthType[] = [\n AuthType.Oauth2,\n AuthType.ApiKey,\n AuthType.BasicAuth,\n AuthType.BearerToken,\n AuthType.Custom,\n AuthType.ServiceAccount,\n AuthType.WorkspaceAppToken,\n];\n\nexport function installStatusLabel(tr: Translate, status: PluginStatus): string {\n switch (status) {\n case PluginStatus.Installed:\n return tr('integrations.connectedApps.install.installed', 'Installed');\n case PluginStatus.Available:\n return tr('integrations.connectedApps.install.available', 'Available');\n case PluginStatus.Deprecated:\n return tr('integrations.connectedApps.install.deprecated', 'Deprecated');\n case PluginStatus.Disabled:\n return tr('integrations.connectedApps.install.disabled', 'Turned off');\n }\n}\n\n/** The parts of a provider these rules read. */\nexport interface AppMethodsShape {\n authType: AuthType;\n authMethods: ReadonlyArray<{\n key: string;\n displayName: string;\n authType: AuthType;\n flow: AuthMethodFlow;\n isConfigured: boolean;\n isDefault: boolean;\n isEnabled: boolean;\n displayOrder: number;\n }>;\n}\n\ntype AppMethod = AppMethodsShape['authMethods'][number];\n\n/** The methods a person can pick, default first, then in display order. */\nexport function enabledMethods<M extends AppMethod>(app: { authMethods: readonly M[] }): M[] {\n return app.authMethods\n .filter((method) => method.isEnabled)\n .slice()\n .sort(\n (a, b) =>\n Number(b.isDefault) - Number(a.isDefault) ||\n a.displayOrder - b.displayOrder ||\n a.key.localeCompare(b.key)\n );\n}\n\n/**\n * No sign-in method of this app is set up in this environment, so only an\n * administrator can make it connectable. An app that declares no methods uses\n * its own auth type, which needs no setup.\n */\nexport function appNeedsAdminSetup(app: AppMethodsShape): boolean {\n const methods = enabledMethods(app);\n return methods.length > 0 && methods.every((method) => !method.isConfigured);\n}\n\n/** The auth types a person can actually use to connect, most recommended first. */\nexport function usableAuthTypes(app: AppMethodsShape): AuthType[] {\n if (app.authMethods.length === 0) return [app.authType];\n // A Set keeps each auth type once, in the methods' order.\n const types = new Set<AuthType>();\n for (const method of enabledMethods(app)) {\n if (method.isConfigured) types.add(method.authType);\n }\n return [...types];\n}\n\n/** \"Sign in\", \"API key\", or \"Sign in or API key\": how an app's card says you connect. */\nexport function methodHint(tr: Translate, app: AppMethodsShape): string {\n const [first, second] = usableAuthTypes(app);\n if (!first) return '';\n if (!second) return authTypeLabel(tr, first);\n return tr('integrations.connectedApps.method.either', '{{first}} or {{second}}', {\n first: authTypeLabel(tr, first),\n second: authTypeLabel(tr, second),\n });\n}\n\n/** Whether connecting opens the app's own sign-in window. */\nexport function isSignInMethod(authType: AuthType): boolean {\n return authType === AuthType.Oauth2 || authType === AuthType.Oauth1;\n}\n\n/**\n * An app's website or docs link, only when it is a web address. Catalog\n * links can come from published third-party connectors, so anything other\n * than http(s) is left out rather than rendered as a link.\n */\nexport function webLink(url: string | null | undefined): string | null {\n if (!url) return null;\n try {\n const parsed = new URL(url);\n return parsed.protocol === 'https:' || parsed.protocol === 'http:' ? parsed.href : null;\n } catch {\n return null;\n }\n}\n\n/** `messages_read` → \"Messages read\": the service's feature keys, readable. */\nexport function featureLabel(feature: string): string {\n const words = feature\n .replace(/[_-]+/g, ' ')\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n .trim();\n return words ? words.charAt(0).toUpperCase() + words.slice(1).toLowerCase() : feature;\n}\n\n/** What connecting with one method involves, when the app doesn't say. */\nexport function methodDescription(\n tr: Translate,\n method: { description: string | null; flow: AuthMethodFlow; authType: AuthType },\n appName: string\n): string {\n if (method.description) return method.description;\n if (method.flow === AuthMethodFlow.Minted)\n return tr(\n 'integrations.connectedApps.app.methodMinted',\n 'Nothing to copy or paste: access is set up for your workspace.'\n );\n return isSignInMethod(method.authType)\n ? tr(\n 'integrations.connectedApps.app.methodSignIn',\n 'Opens {{app}} in a new window so you can sign in and approve access.',\n { app: appName }\n )\n : tr(\n 'integrations.connectedApps.app.methodKey',\n 'Paste a key or details from your {{app}} account. It is stored encrypted.',\n { app: appName }\n );\n}\n\n/**\n * Whether every way to connect this app keeps a key, so it cannot work in a\n * workspace without a vault. One usable way that keeps none (a minted method,\n * a service account) is enough for the form to have a chance. With no usable\n * way at all, the form itself says an administrator must set one up, so this\n * does not answer for it.\n */\nexport function alwaysKeepsKey(provider: ConnectionProvider): boolean {\n if (provider.authType === 'service_account') return false;\n const enabled = provider.authMethods.filter((method) => method.isEnabled);\n if (enabled.length === 0) return resolveFlow(provider, null) !== 'minted';\n const usable = enabled.filter((method) => method.isConfigured);\n if (usable.length === 0) return false;\n return usable.every((method) => resolveFlow(provider, method) !== 'minted');\n}\n"],"mappings":";;;AAuBA,IAAMA,IAAkC,IAAI,IAAI,OAAO,OAAOC,CAAgB,CAAC;AAG/E,SAAgBC,EAAW,GAA0C;CACnE,OAAOF,EAAW,IAAIG,CAAK;AAC7B;AAEA,SAAgBC,EAAc,GAAe,GAAoC;CAC/E,QAAQC,GAAR;EACE,KAAKJ,EAAiB,YACpB,OAAOK,EAAG,kDAAkD,YAAY;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;AAOA,SAAgBkB,EAAQ,GAA+C;CACrE,IAAI,CAACC,GAAK,OAAO;CACjB,IAAI;EACF,IAAMC,IAAS,IAAI,IAAID,CAAG;EAC1B,OAAOC,EAAO,aAAa,YAAYA,EAAO,aAAa,UAAUA,EAAO,OAAO;CACrF,QAAQ;EACN,OAAO;CACT;AACF;AAGA,SAAgBC,EAAa,GAAyB;CACpD,IAAMC,IAAQC,EACX,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,mBAAmB,OAAO,CAAC,CACnC,KAAK;CACR,OAAOD,IAAQA,EAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAIA,EAAM,MAAM,CAAC,CAAC,CAAC,YAAY,IAAIC;AAChF;AAGA,SAAgBC,EACd,GACA,GACA,GACQ;CAOR,OANIjB,EAAO,cAAoBA,EAAO,cAClCA,EAAO,SAASkB,EAAe,SAC1B5B,EACL,+CACA,gEACF,IACKoB,EAAeV,EAAO,QAAQ,IACjCV,EACE,+CACA,wEACA,EAAE,KAAK6B,EAAQ,CACjB,IACA7B,EACE,4CACA,6EACA,EAAE,KAAK6B,EAAQ,CACjB;AACN;AASA,SAAgBC,EAAe,GAAuC;CACpE,IAAIC,EAAS,aAAa,mBAAmB,OAAO;CACpD,IAAMC,IAAUD,EAAS,YAAY,QAAQ,MAAWrB,EAAO,SAAS;CACxE,IAAIsB,EAAQ,WAAW,GAAG,OAAOC,EAAYF,GAAU,IAAI,MAAM;CACjE,IAAMG,IAASF,EAAQ,QAAQ,MAAWtB,EAAO,YAAY;CAE7D,OADIwB,EAAO,WAAW,KACfA,EAAO,OAAO,MAAWD,EAAYF,GAAUrB,CAAM,MAAM,QAAQ;AAC5E"}
@@ -0,0 +1,58 @@
1
+ import { ConnectedAppRowFieldsFragment, GetConnectedAppDetailsQuery } from '../../../generated/wspace-operations';
2
+ import { AuthType, ConnectionAccess, ConnectionVisibility, ConnectionStatus } from '../../../generated/wspace-types';
3
+ import { Translate } from './translate';
4
+ export type ConnectionItem = ConnectedAppRowFieldsFragment;
5
+ /** Everything the connection's page reads. */
6
+ export type ConnectionDetails = NonNullable<GetConnectedAppDetailsQuery['getConnection']>;
7
+ /** The parts of a connection the actions read. */
8
+ export interface ActionableConnection {
9
+ id: string;
10
+ name: string;
11
+ status: ConnectionStatus;
12
+ authMethodKey: string | null;
13
+ myAccess: ConnectionAccess | null;
14
+ visibility: ConnectionVisibility;
15
+ vaultId: string | null;
16
+ credentialSecretId: string | null;
17
+ /** The way this connection signs in, when the app offers more than one. */
18
+ authMethod?: {
19
+ authType: AuthType;
20
+ } | null;
21
+ provider: {
22
+ id: string;
23
+ name: string;
24
+ authType: AuthType;
25
+ };
26
+ }
27
+ /** What `authTypeOf` and `flowOf` read. */
28
+ export interface SignInShape {
29
+ authMethod?: {
30
+ authType: AuthType;
31
+ } | null;
32
+ provider: {
33
+ authType: AuthType;
34
+ };
35
+ }
36
+ /** How this connection signs in: its own method's type, else the app's. */
37
+ export declare function authTypeOf(connection: SignInShape): AuthType;
38
+ /** Sign-in connections say "Finish sign-in"; the rest "Finish setup". */
39
+ export declare function flowOf(connection: SignInShape): 'oauth' | 'other';
40
+ /** Just what the actions need, from a row or the connection page's record. */
41
+ export declare function toActionable(connection: ActionableConnection): ActionableConnection;
42
+ /** The signed-in account, when the service knows it (OAuth). */
43
+ export declare function accountOf(connection: {
44
+ externalAccountEmail: string | null;
45
+ externalAccountName: string | null;
46
+ }): string;
47
+ /** Every query a connection change can alter, refetched if on screen. */
48
+ export declare const QUERIES_AFTER_CHANGE: string[];
49
+ /** The person's own access to a connection, in words. */
50
+ export declare function accessLevelLabel(tr: Translate, access: ConnectionAccess | null): string;
51
+ /** "Who can use it", from the visibility, the shares and whose it is. */
52
+ export declare function whoCanUseText(tr: Translate, connection: {
53
+ visibility: ConnectionVisibility;
54
+ shareCount: number;
55
+ }, owner: {
56
+ isYou: boolean;
57
+ name: string;
58
+ }): string;
@@ -0,0 +1,55 @@
1
+ import { AuthType as e, ConnectionAccess as t, ConnectionVisibility as n } from "../../../generated/wspace-types.js";
2
+ // src/integrations/connected-apps/model/connections.ts
3
+ function r(e) {
4
+ return e.authMethod?.authType ?? e.provider.authType;
5
+ }
6
+ function i(t) {
7
+ let n = r(t);
8
+ return n === e.Oauth2 || n === e.Oauth1 ? "oauth" : "other";
9
+ }
10
+ function a(e) {
11
+ return {
12
+ id: e.id,
13
+ name: e.name,
14
+ status: e.status,
15
+ authMethodKey: e.authMethodKey,
16
+ myAccess: e.myAccess,
17
+ visibility: e.visibility,
18
+ vaultId: e.vaultId,
19
+ credentialSecretId: e.credentialSecretId,
20
+ authMethod: e.authMethod ? { authType: e.authMethod.authType } : null,
21
+ provider: {
22
+ id: e.provider.id,
23
+ name: e.provider.name,
24
+ authType: e.provider.authType
25
+ }
26
+ };
27
+ }
28
+ function o(e) {
29
+ return e.externalAccountEmail || e.externalAccountName || "";
30
+ }
31
+ var s = [
32
+ "GetConnectedAppsPage",
33
+ "GetConnectedAppsStatusCounts",
34
+ "GetConnectedAppDetails",
35
+ "GetAppConnections",
36
+ "GetAppsPage",
37
+ "GetConnections",
38
+ "GetConnection"
39
+ ];
40
+ function c(e, n) {
41
+ switch (n) {
42
+ case t.Owner: return e("integrations.connectedApps.detail.accessOwner", "Owner");
43
+ case t.Editor: return e("integrations.connectedApps.detail.accessEditor", "Can edit");
44
+ case t.Use: return e("integrations.connectedApps.detail.accessUse", "Can use");
45
+ case t.Workspace: return e("integrations.connectedApps.detail.accessWorkspace", "Everyone in the workspace can use it");
46
+ case t.Administrator: return e("integrations.connectedApps.detail.accessAdmin", "Workspace administrator (can manage, not use)");
47
+ case null: return e("integrations.connectedApps.detail.accessUnknown", "Not reported");
48
+ }
49
+ }
50
+ function l(e, t, r) {
51
+ return t.visibility === n.Restricted ? t.shareCount === 1 ? e("integrations.connectedApps.detail.privateSharedOne", "Private. Its owner and the person, group or project it’s shared with can use it.") : t.shareCount > 1 ? e("integrations.connectedApps.detail.privateShared", "Private. Its owner and the {{count}} people, groups or projects it’s shared with can use it.", { count: t.shareCount }) : r.isYou ? e("integrations.connectedApps.detail.privateYou", "Private. Only you can use it until you share it.") : e("integrations.connectedApps.detail.privateOnly", "Private. Only {{owner}} can use it until it’s shared.", { owner: r.name }) : e("integrations.connectedApps.detail.everyone", "Everyone in this workspace can use it in their workflows.");
52
+ }
53
+ export { s as QUERIES_AFTER_CHANGE, c as accessLevelLabel, o as accountOf, r as authTypeOf, i as flowOf, a as toActionable, l as whoCanUseText };
54
+
55
+ //# sourceMappingURL=connections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.js","names":["authTypeOf","connection","flowOf","authType","AuthType","toActionable","accountOf","QUERIES_AFTER_CHANGE","accessLevelLabel","access","ConnectionAccess","tr","whoCanUseText","ConnectionVisibility","owner"],"sources":["../../../../src/integrations/connected-apps/model/connections.ts"],"sourcesContent":["/**\n * A connection as the redesigned pages read it (BOFF-15373), and the few\n * plain rules about it the rows, cards and the connection page share.\n */\nimport type {\n ConnectedAppRowFieldsFragment,\n GetConnectedAppDetailsQuery,\n} from '../../../generated/wspace-operations';\nimport {\n AuthType,\n ConnectionAccess,\n ConnectionVisibility,\n type ConnectionStatus,\n} from '../../../generated/wspace-types';\nimport type { Translate } from './translate';\n\nexport type ConnectionItem = ConnectedAppRowFieldsFragment;\n\n/** Everything the connection's page reads. */\nexport type ConnectionDetails = NonNullable<GetConnectedAppDetailsQuery['getConnection']>;\n\n/** The parts of a connection the actions read. */\nexport interface ActionableConnection {\n id: string;\n name: string;\n status: ConnectionStatus;\n authMethodKey: string | null;\n myAccess: ConnectionAccess | null;\n visibility: ConnectionVisibility;\n vaultId: string | null;\n credentialSecretId: string | null;\n /** The way this connection signs in, when the app offers more than one. */\n authMethod?: { authType: AuthType } | null;\n provider: { id: string; name: string; authType: AuthType };\n}\n\n/** What `authTypeOf` and `flowOf` read. */\nexport interface SignInShape {\n authMethod?: { authType: AuthType } | null;\n provider: { authType: AuthType };\n}\n\n/** How this connection signs in: its own method's type, else the app's. */\nexport function authTypeOf(connection: SignInShape): AuthType {\n return connection.authMethod?.authType ?? connection.provider.authType;\n}\n\n/** Sign-in connections say \"Finish sign-in\"; the rest \"Finish setup\". */\nexport function flowOf(connection: SignInShape): 'oauth' | 'other' {\n const authType = authTypeOf(connection);\n return authType === AuthType.Oauth2 || authType === AuthType.Oauth1 ? 'oauth' : 'other';\n}\n\n/** Just what the actions need, from a row or the connection page's record. */\nexport function toActionable(connection: ActionableConnection): ActionableConnection {\n return {\n id: connection.id,\n name: connection.name,\n status: connection.status,\n authMethodKey: connection.authMethodKey,\n myAccess: connection.myAccess,\n visibility: connection.visibility,\n vaultId: connection.vaultId,\n credentialSecretId: connection.credentialSecretId,\n authMethod: connection.authMethod ? { authType: connection.authMethod.authType } : null,\n provider: {\n id: connection.provider.id,\n name: connection.provider.name,\n authType: connection.provider.authType,\n },\n };\n}\n\n/** The signed-in account, when the service knows it (OAuth). */\nexport function accountOf(connection: {\n externalAccountEmail: string | null;\n externalAccountName: string | null;\n}): string {\n return connection.externalAccountEmail || connection.externalAccountName || '';\n}\n\n/** Every query a connection change can alter, refetched if on screen. */\nexport const QUERIES_AFTER_CHANGE = [\n 'GetConnectedAppsPage',\n 'GetConnectedAppsStatusCounts',\n 'GetConnectedAppDetails',\n 'GetAppConnections',\n 'GetAppsPage',\n 'GetConnections',\n 'GetConnection',\n];\n\n/** The person's own access to a connection, in words. */\nexport function accessLevelLabel(tr: Translate, access: ConnectionAccess | null): string {\n switch (access) {\n case ConnectionAccess.Owner:\n return tr('integrations.connectedApps.detail.accessOwner', 'Owner');\n case ConnectionAccess.Editor:\n return tr('integrations.connectedApps.detail.accessEditor', 'Can edit');\n case ConnectionAccess.Use:\n return tr('integrations.connectedApps.detail.accessUse', 'Can use');\n case ConnectionAccess.Workspace:\n return tr(\n 'integrations.connectedApps.detail.accessWorkspace',\n 'Everyone in the workspace can use it'\n );\n case ConnectionAccess.Administrator:\n return tr(\n 'integrations.connectedApps.detail.accessAdmin',\n 'Workspace administrator (can manage, not use)'\n );\n case null:\n return tr('integrations.connectedApps.detail.accessUnknown', 'Not reported');\n }\n}\n\n/** \"Who can use it\", from the visibility, the shares and whose it is. */\nexport function whoCanUseText(\n tr: Translate,\n connection: { visibility: ConnectionVisibility; shareCount: number },\n owner: { isYou: boolean; name: string }\n): string {\n if (connection.visibility !== ConnectionVisibility.Restricted)\n return tr(\n 'integrations.connectedApps.detail.everyone',\n 'Everyone in this workspace can use it in their workflows.'\n );\n if (connection.shareCount === 1)\n return tr(\n 'integrations.connectedApps.detail.privateSharedOne',\n 'Private. Its owner and the person, group or project it’s shared with can use it.'\n );\n if (connection.shareCount > 1)\n return tr(\n 'integrations.connectedApps.detail.privateShared',\n 'Private. Its owner and the {{count}} people, groups or projects it’s shared with can use it.',\n { count: connection.shareCount }\n );\n return owner.isYou\n ? tr(\n 'integrations.connectedApps.detail.privateYou',\n 'Private. Only you can use it until you share it.'\n )\n : tr(\n 'integrations.connectedApps.detail.privateOnly',\n 'Private. Only {{owner}} can use it until it’s shared.',\n { owner: owner.name }\n );\n}\n"],"mappings":";;AA2CA,SAAgBA,EAAW,GAAmC;CAC5D,OAAOC,EAAW,YAAY,YAAYA,EAAW,SAAS;AAChE;AAGA,SAAgBC,EAAO,GAA4C;CACjE,IAAMC,IAAWH,EAAWC,CAAU;CACtC,OAAOE,MAAaC,EAAS,UAAUD,MAAaC,EAAS,SAAS,UAAU;AAClF;AAGA,SAAgBC,EAAa,GAAwD;CACnF,OAAO;EACL,IAAIJ,EAAW;EACf,MAAMA,EAAW;EACjB,QAAQA,EAAW;EACnB,eAAeA,EAAW;EAC1B,UAAUA,EAAW;EACrB,YAAYA,EAAW;EACvB,SAASA,EAAW;EACpB,oBAAoBA,EAAW;EAC/B,YAAYA,EAAW,aAAa,EAAE,UAAUA,EAAW,WAAW,SAAS,IAAI;EACnF,UAAU;GACR,IAAIA,EAAW,SAAS;GACxB,MAAMA,EAAW,SAAS;GAC1B,UAAUA,EAAW,SAAS;EAChC;CACF;AACF;AAGA,SAAgBK,EAAU,GAGf;CACT,OAAOL,EAAW,wBAAwBA,EAAW,uBAAuB;AAC9E;AAGA,IAAaM,IAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAGA,SAAgBC,EAAiB,GAAe,GAAyC;CACvF,QAAQC,GAAR;EACE,KAAKC,EAAiB,OACpB,OAAOC,EAAG,iDAAiD,OAAO;EACpE,KAAKD,EAAiB,QACpB,OAAOC,EAAG,kDAAkD,UAAU;EACxE,KAAKD,EAAiB,KACpB,OAAOC,EAAG,+CAA+C,SAAS;EACpE,KAAKD,EAAiB,WACpB,OAAOC,EACL,qDACA,sCACF;EACF,KAAKD,EAAiB,eACpB,OAAOC,EACL,iDACA,+CACF;EACF,KAAK,MACH,OAAOA,EAAG,mDAAmD,cAAc;CAC/E;AACF;AAGA,SAAgBC,EACd,GACA,GACA,GACQ;CAiBR,OAhBIX,EAAW,eAAeY,EAAqB,aAK/CZ,EAAW,eAAe,IACrBU,EACL,sDACA,kFACF,IACEV,EAAW,aAAa,IACnBU,EACL,mDACA,gGACA,EAAE,OAAOV,EAAW,WAAW,CACjC,IACKa,EAAM,QACTH,EACE,gDACA,kDACF,IACAA,EACE,iDACA,yDACA,EAAE,OAAOG,EAAM,KAAK,CACtB,IAxBKH,EACL,8CACA,2DACF;AAsBJ"}
@@ -0,0 +1,30 @@
1
+ import { AuthType, ConnectionStatus } from '../../../generated/wspace-types';
2
+ import { Translate } from './translate';
3
+ export type HealthTone = 'success' | 'danger' | 'warning' | 'neutral';
4
+ export type HealthIcon = 'working' | 'error' | 'expired' | 'pending' | 'off' | 'revoked';
5
+ /** The one action a status offers inside its block. */
6
+ export type HealthAction = 'test' | 'activity' | 'remove' | null;
7
+ export interface Health {
8
+ tone: HealthTone;
9
+ icon: HealthIcon;
10
+ title: string;
11
+ text: string;
12
+ /** Problems are announced at once; the rest are read in turn. */
13
+ role?: 'alert';
14
+ action: HealthAction;
15
+ }
16
+ export interface HealthSubject {
17
+ status: ConnectionStatus;
18
+ errorMessage: string | null;
19
+ authMethod?: {
20
+ authType: AuthType;
21
+ } | null;
22
+ provider: {
23
+ name: string;
24
+ authType: AuthType;
25
+ };
26
+ }
27
+ /**
28
+ * `checked` is "Checked 5m ago." when the service ran a health check, else ''.
29
+ */
30
+ export declare function healthOf(tr: Translate, connection: HealthSubject, checked: string): Health;
@@ -0,0 +1,54 @@
1
+ import { ConnectionStatus as e } from "../../../generated/wspace-types.js";
2
+ import { flowOf as t } from "./connections.js";
3
+ // src/integrations/connected-apps/model/health.ts
4
+ function n(n, r, i) {
5
+ switch (r.status) {
6
+ case e.Active: return {
7
+ tone: "success",
8
+ icon: "working",
9
+ title: n("integrations.connectedApps.health.working", "Working"),
10
+ text: i || n("integrations.connectedApps.health.workingText", "Workflows can use it."),
11
+ action: "test"
12
+ };
13
+ case e.Error: return {
14
+ tone: "danger",
15
+ icon: "error",
16
+ role: "alert",
17
+ title: n("integrations.connectedApps.brokenTitle", "{{provider}} stopped working", { provider: r.provider.name }),
18
+ text: [r.errorMessage, i].filter(Boolean).join(" "),
19
+ action: "activity"
20
+ };
21
+ case e.Expired: return {
22
+ tone: "warning",
23
+ icon: "expired",
24
+ role: "alert",
25
+ title: n("integrations.connectedApps.health.expired", "Sign-in expired"),
26
+ text: r.errorMessage || n("integrations.connectedApps.health.expiredText", "Workflows that use it can’t run until you reconnect."),
27
+ action: null
28
+ };
29
+ case e.PendingAuth: return {
30
+ tone: "warning",
31
+ icon: "pending",
32
+ title: t(r) === "oauth" ? n("integrations.connectedApps.reason.signInNotFinished", "Sign-in not finished") : n("integrations.connectedApps.reason.setupNotFinished", "Setup not finished"),
33
+ text: n("integrations.connectedApps.health.pendingText", "Finish it, or remove it if it was started by mistake."),
34
+ action: "remove"
35
+ };
36
+ case e.Inactive: return {
37
+ tone: "neutral",
38
+ icon: "off",
39
+ title: n("integrations.connectedApps.status.turnedOff", "Turned off"),
40
+ text: r.errorMessage || n("integrations.connectedApps.health.offText", "Workflows can’t use it while it’s turned off."),
41
+ action: null
42
+ };
43
+ case e.Revoked: return {
44
+ tone: "neutral",
45
+ icon: "revoked",
46
+ title: n("integrations.connectedApps.status.disconnected", "Disconnected"),
47
+ text: r.errorMessage || n("integrations.connectedApps.health.revokedText", "Access was revoked. Reconnect it to use it again, or remove it."),
48
+ action: "remove"
49
+ };
50
+ }
51
+ }
52
+ export { n as healthOf };
53
+
54
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","names":["healthOf","connection","ConnectionStatus","tr","checked","flowOf"],"sources":["../../../../src/integrations/connected-apps/model/health.ts"],"sourcesContent":["/**\n * What a connection's health block says (BOFF-15373), by status: green when\n * it works, red when it errors, yellow when its sign-in expired or was never\n * finished, grey when it is off or disconnected. Plain data, so the page only\n * draws it and the rules are tested on their own.\n */\nimport { AuthType, ConnectionStatus } from '../../../generated/wspace-types';\nimport { flowOf } from './connections';\nimport type { Translate } from './translate';\n\nexport type HealthTone = 'success' | 'danger' | 'warning' | 'neutral';\nexport type HealthIcon = 'working' | 'error' | 'expired' | 'pending' | 'off' | 'revoked';\n/** The one action a status offers inside its block. */\nexport type HealthAction = 'test' | 'activity' | 'remove' | null;\n\nexport interface Health {\n tone: HealthTone;\n icon: HealthIcon;\n title: string;\n text: string;\n /** Problems are announced at once; the rest are read in turn. */\n role?: 'alert';\n action: HealthAction;\n}\n\nexport interface HealthSubject {\n status: ConnectionStatus;\n errorMessage: string | null;\n authMethod?: { authType: AuthType } | null;\n provider: { name: string; authType: AuthType };\n}\n\n/**\n * `checked` is \"Checked 5m ago.\" when the service ran a health check, else ''.\n */\nexport function healthOf(tr: Translate, connection: HealthSubject, checked: string): Health {\n switch (connection.status) {\n case ConnectionStatus.Active:\n return {\n tone: 'success',\n icon: 'working',\n title: tr('integrations.connectedApps.health.working', 'Working'),\n text:\n checked || tr('integrations.connectedApps.health.workingText', 'Workflows can use it.'),\n action: 'test',\n };\n case ConnectionStatus.Error:\n return {\n tone: 'danger',\n icon: 'error',\n role: 'alert',\n title: tr('integrations.connectedApps.brokenTitle', '{{provider}} stopped working', {\n provider: connection.provider.name,\n }),\n text: [connection.errorMessage, checked].filter(Boolean).join(' '),\n action: 'activity',\n };\n case ConnectionStatus.Expired:\n return {\n tone: 'warning',\n icon: 'expired',\n role: 'alert',\n title: tr('integrations.connectedApps.health.expired', 'Sign-in expired'),\n text:\n connection.errorMessage ||\n tr(\n 'integrations.connectedApps.health.expiredText',\n 'Workflows that use it can’t run until you reconnect.'\n ),\n action: null,\n };\n case ConnectionStatus.PendingAuth:\n return {\n tone: 'warning',\n icon: 'pending',\n title:\n flowOf(connection) === 'oauth'\n ? tr('integrations.connectedApps.reason.signInNotFinished', 'Sign-in not finished')\n : tr('integrations.connectedApps.reason.setupNotFinished', 'Setup not finished'),\n text: tr(\n 'integrations.connectedApps.health.pendingText',\n 'Finish it, or remove it if it was started by mistake.'\n ),\n action: 'remove',\n };\n case ConnectionStatus.Inactive:\n return {\n tone: 'neutral',\n icon: 'off',\n title: tr('integrations.connectedApps.status.turnedOff', 'Turned off'),\n text:\n connection.errorMessage ||\n tr(\n 'integrations.connectedApps.health.offText',\n 'Workflows can’t use it while it’s turned off.'\n ),\n action: null,\n };\n case ConnectionStatus.Revoked:\n return {\n tone: 'neutral',\n icon: 'revoked',\n title: tr('integrations.connectedApps.status.disconnected', 'Disconnected'),\n text:\n connection.errorMessage ||\n tr(\n 'integrations.connectedApps.health.revokedText',\n 'Access was revoked. Reconnect it to use it again, or remove it.'\n ),\n action: 'remove',\n };\n }\n}\n"],"mappings":";;;AAmCA,SAAgBA,EAAS,GAAe,GAA2B,GAAyB;CAC1F,QAAQC,EAAW,QAAnB;EACE,KAAKC,EAAiB,QACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,OAAOC,EAAG,6CAA6C,SAAS;GAChE,MACEC,KAAWD,EAAG,iDAAiD,uBAAuB;GACxF,QAAQ;EACV;EACF,KAAKD,EAAiB,OACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,MAAM;GACN,OAAOC,EAAG,0CAA0C,gCAAgC,EAClF,UAAUF,EAAW,SAAS,KAChC,CAAC;GACD,MAAM,CAACA,EAAW,cAAcG,CAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACjE,QAAQ;EACV;EACF,KAAKF,EAAiB,SACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,MAAM;GACN,OAAOC,EAAG,6CAA6C,iBAAiB;GACxE,MACEF,EAAW,gBACXE,EACE,iDACA,sDACF;GACF,QAAQ;EACV;EACF,KAAKD,EAAiB,aACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,OACEG,EAAOJ,CAAU,MAAM,UACnBE,EAAG,uDAAuD,sBAAsB,IAChFA,EAAG,sDAAsD,oBAAoB;GACnF,MAAMA,EACJ,iDACA,uDACF;GACA,QAAQ;EACV;EACF,KAAKD,EAAiB,UACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,OAAOC,EAAG,+CAA+C,YAAY;GACrE,MACEF,EAAW,gBACXE,EACE,6CACA,+CACF;GACF,QAAQ;EACV;EACF,KAAKD,EAAiB,SACpB,OAAO;GACL,MAAM;GACN,MAAM;GACN,OAAOC,EAAG,kDAAkD,cAAc;GAC1E,MACEF,EAAW,gBACXE,EACE,iDACA,iEACF;GACF,QAAQ;EACV;CACJ;AACF"}
@@ -0,0 +1,56 @@
1
+ import { ConnectionFilterInput, ConnectionSortInput, LogFilterInput, ProviderFilterInput } from '../../../generated/wspace-types';
2
+ import { Translate } from './translate';
3
+ import { ActivityUrlState, AppsUrlState, ConnectionsSort, ConnectionsUrlState } from './urlState';
4
+ export declare function connectionsSortInput(sort: ConnectionsSort): ConnectionSortInput;
5
+ export declare function connectionsSortLabel(tr: Translate, sort: ConnectionsSort): string;
6
+ /** The connection filter for a list state; the status group becomes server statuses. */
7
+ export declare function connectionsFilter(state: Pick<ConnectionsUrlState, 'status' | 'q' | 'app' | 'owner'>): ConnectionFilterInput;
8
+ /** The list filters a status count shares: search, app and owner. */
9
+ export type ConnectionCountScope = Pick<ConnectionsUrlState, 'q' | 'app' | 'owner'>;
10
+ /** No filters: the workspace's own totals (the count line and the banner). */
11
+ export declare const WORKSPACE_COUNT_SCOPE: ConnectionCountScope;
12
+ /**
13
+ * One filter per status count: the list's search, app and owner filters plus
14
+ * that status, so a chip counts what the list would show if picked.
15
+ */
16
+ export declare function statusCountVariables(scope: ConnectionCountScope): {
17
+ all: ConnectionFilterInput;
18
+ active: ConnectionFilterInput;
19
+ error: ConnectionFilterInput;
20
+ expired: ConnectionFilterInput;
21
+ pendingAuth: ConnectionFilterInput;
22
+ inactive: ConnectionFilterInput;
23
+ revoked: ConnectionFilterInput;
24
+ };
25
+ export declare function connectionsPageVariables(state: ConnectionsUrlState, pageSize: number): {
26
+ filter: ConnectionFilterInput;
27
+ pagination: {
28
+ limit: number;
29
+ offset: number;
30
+ };
31
+ sort: ConnectionSortInput;
32
+ };
33
+ /** Only apps an administrator has turned on are offered. */
34
+ export declare function appsFilter(state: Pick<AppsUrlState, 'category' | 'method' | 'install' | 'q'>): ProviderFilterInput;
35
+ export declare function appsPageVariables(state: AppsUrlState, pageSize: number): {
36
+ filter: ProviderFilterInput;
37
+ pagination: {
38
+ limit: number;
39
+ offset: number;
40
+ };
41
+ };
42
+ /** The category counts use every filter except the category itself. */
43
+ export declare function appCategoryCountVariables(state: AppsUrlState): {
44
+ search: import('../../../generated/wspace-types').InputMaybe<string> | undefined;
45
+ authType: import('../../../generated/wspace-types').InputMaybe<import('../../../generated/wspace-types').AuthType> | undefined;
46
+ pluginStatus: import('../../../generated/wspace-types').InputMaybe<import('../../../generated/wspace-types').PluginStatus> | undefined;
47
+ isEnabled: import('../../../generated/wspace-types').InputMaybe<boolean> | undefined;
48
+ };
49
+ export declare function activityFilter(state: ActivityUrlState, now: number): LogFilterInput;
50
+ export declare function activityPageVariables(state: ActivityUrlState, pageSize: number, now: number): {
51
+ filter: LogFilterInput;
52
+ pagination: {
53
+ limit: number;
54
+ offset: number;
55
+ };
56
+ };
@@ -0,0 +1,117 @@
1
+ import { ConnectionAccessFilter as e, ConnectionSortDirection as t, ConnectionSortField as n, ConnectionStatus as r } from "../../../generated/wspace-types.js";
2
+ import { statusesOfGroup as i } from "./status.js";
3
+ import { rangeStart as a } from "./urlState.js";
4
+ import { offsetForPage as o } from "@burdenoff/fe-libs/ui";
5
+ // src/integrations/connected-apps/model/queries.ts
6
+ function s(e) {
7
+ switch (e) {
8
+ case "attention": return {
9
+ field: n.NeedsAttentionFirst,
10
+ direction: t.Asc
11
+ };
12
+ case "recent": return {
13
+ field: n.LastUsed,
14
+ direction: t.Desc
15
+ };
16
+ case "name": return {
17
+ field: n.Name,
18
+ direction: t.Asc
19
+ };
20
+ case "newest": return {
21
+ field: n.Created,
22
+ direction: t.Desc
23
+ };
24
+ }
25
+ }
26
+ function c(e, t) {
27
+ switch (t) {
28
+ case "attention": return e("integrations.connectedApps.sort.attention", "Needs attention first");
29
+ case "recent": return e("integrations.connectedApps.sort.recent", "Recently used");
30
+ case "name": return e("integrations.connectedApps.sort.name", "Name A–Z");
31
+ case "newest": return e("integrations.connectedApps.sort.newest", "Newest");
32
+ }
33
+ }
34
+ function l(t) {
35
+ let n = {}, r = t.q.trim();
36
+ if (r && (n.search = r), t.app && (n.providerId = t.app), t.owner === "mine" && (n.access = e.OwnedByMe), t.owner === "shared" && (n.access = e.SharedWithMe), t.status !== "all") {
37
+ let e = i(t.status);
38
+ e.length === 1 ? n.status = e[0] : n.statuses = e;
39
+ }
40
+ return n;
41
+ }
42
+ var u = {
43
+ q: "",
44
+ app: null,
45
+ owner: "all"
46
+ };
47
+ function d(e) {
48
+ let t = l({
49
+ ...e,
50
+ status: "all"
51
+ }), n = (e) => ({
52
+ ...t,
53
+ status: e
54
+ });
55
+ return {
56
+ all: t,
57
+ active: n(r.Active),
58
+ error: n(r.Error),
59
+ expired: n(r.Expired),
60
+ pendingAuth: n(r.PendingAuth),
61
+ inactive: n(r.Inactive),
62
+ revoked: n(r.Revoked)
63
+ };
64
+ }
65
+ function f(e, t) {
66
+ return {
67
+ filter: l(e),
68
+ pagination: {
69
+ limit: t,
70
+ offset: o(e.page, t)
71
+ },
72
+ sort: s(e.sort)
73
+ };
74
+ }
75
+ function p(e) {
76
+ let t = { isEnabled: !0 }, n = e.q.trim();
77
+ return n && (t.search = n), e.category !== "all" && (t.category = e.category), e.method !== "all" && (t.authType = e.method), e.install !== "all" && (t.pluginStatus = e.install), t;
78
+ }
79
+ function m(e, t) {
80
+ return {
81
+ filter: p(e),
82
+ pagination: {
83
+ limit: t,
84
+ offset: o(e.page, t)
85
+ }
86
+ };
87
+ }
88
+ function h(e) {
89
+ let { search: t, authType: n, pluginStatus: r, isEnabled: i } = p({
90
+ ...e,
91
+ category: "all"
92
+ });
93
+ return {
94
+ search: t,
95
+ authType: n,
96
+ pluginStatus: r,
97
+ isEnabled: i
98
+ };
99
+ }
100
+ function g(e, t) {
101
+ let n = {};
102
+ e.level !== "all" && (n.level = e.level), e.action !== "all" && (n.action = e.action), e.connectionId && (n.connectionId = e.connectionId);
103
+ let r = a(e.range, t);
104
+ return r && (n.startDate = r), n;
105
+ }
106
+ function _(e, t, n) {
107
+ return {
108
+ filter: g(e, n),
109
+ pagination: {
110
+ limit: t,
111
+ offset: o(e.page, t)
112
+ }
113
+ };
114
+ }
115
+ export { u as WORKSPACE_COUNT_SCOPE, g as activityFilter, _ as activityPageVariables, h as appCategoryCountVariables, p as appsFilter, m as appsPageVariables, l as connectionsFilter, f as connectionsPageVariables, s as connectionsSortInput, c as connectionsSortLabel, d as statusCountVariables };
116
+
117
+ //# sourceMappingURL=queries.js.map