@burdenoff/microfe-integrations 2026.930.1 → 2026.930.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.
Files changed (70) hide show
  1. package/dist/generated/wspace-operations.d.ts +0 -137
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +73 -142
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/integrations/ConnectSourceDialog.js +10 -10
  6. package/dist/integrations/components/AddConnectionDialog.d.ts +15 -3
  7. package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
  8. package/dist/integrations/components/AddConnectionDialog.js +53 -631
  9. package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
  10. package/dist/integrations/components/AuthMethodsEditor.d.ts.map +1 -1
  11. package/dist/integrations/components/AuthMethodsEditor.js +69 -68
  12. package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
  13. package/dist/integrations/components/ConnectionCard.js +28 -28
  14. package/dist/integrations/components/ConnectionCard.js.map +1 -1
  15. package/dist/integrations/components/ProviderCard.js +29 -29
  16. package/dist/integrations/components/ProviderCard.js.map +1 -1
  17. package/dist/integrations/hooks/useConnections.js +91 -102
  18. package/dist/integrations/hooks/useConnections.js.map +1 -1
  19. package/dist/integrations/hooks/useLogs.js +4 -4
  20. package/dist/integrations/hooks/useProviders.js +36 -36
  21. package/dist/integrations/pages/AddConnectionWizard.d.ts.map +1 -1
  22. package/dist/integrations/pages/AddConnectionWizard.js +281 -277
  23. package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
  24. package/dist/integrations/pages/ConnectionDetail.js +24 -24
  25. package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
  26. package/dist/integrations/pages/ConnectionsList.js +7 -7
  27. package/dist/integrations/pages/ConnectionsList.js.map +1 -1
  28. package/dist/integrations/pages/IntegrationsOverview.js +34 -34
  29. package/dist/integrations/pages/ProviderCatalog.js +4 -4
  30. package/dist/integrations/pages/ProviderDetail.js +110 -110
  31. package/dist/integrations/pages/ProviderDetail.js.map +1 -1
  32. package/dist/integrations/translations/en.d.ts +18 -0
  33. package/dist/integrations/translations/en.d.ts.map +1 -1
  34. package/dist/integrations/utils/appearance.d.ts +0 -3
  35. package/dist/integrations/utils/appearance.d.ts.map +1 -1
  36. package/dist/integrations/utils/appearance.js +1 -20
  37. package/dist/integrations/utils/appearance.js.map +1 -1
  38. package/dist/integrations/utils/integrationsHelpers.js +1 -4
  39. package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
  40. package/package.json +2 -2
  41. package/dist/integrations/assets/brands/bigconsole.js +0 -6
  42. package/dist/integrations/assets/brands/bigconsole.js.map +0 -1
  43. package/dist/integrations/assets/brands/burdenoff.js +0 -6
  44. package/dist/integrations/assets/brands/burdenoff.js.map +0 -1
  45. package/dist/integrations/components/AuthMethodSelector.d.ts +0 -30
  46. package/dist/integrations/components/AuthMethodSelector.d.ts.map +0 -1
  47. package/dist/integrations/components/AuthMethodSelector.js +0 -66
  48. package/dist/integrations/components/AuthMethodSelector.js.map +0 -1
  49. package/dist/integrations/components/CredentialStorageSelector.d.ts +0 -16
  50. package/dist/integrations/components/CredentialStorageSelector.d.ts.map +0 -1
  51. package/dist/integrations/components/CredentialStorageSelector.js +0 -262
  52. package/dist/integrations/components/CredentialStorageSelector.js.map +0 -1
  53. package/dist/integrations/components/ProviderIcon.d.ts +0 -25
  54. package/dist/integrations/components/ProviderIcon.d.ts.map +0 -1
  55. package/dist/integrations/components/ProviderIcon.js +0 -166
  56. package/dist/integrations/components/ProviderIcon.js.map +0 -1
  57. package/dist/integrations/components/SchemaForm.d.ts +0 -60
  58. package/dist/integrations/components/SchemaForm.d.ts.map +0 -1
  59. package/dist/integrations/components/SchemaForm.js +0 -235
  60. package/dist/integrations/components/SchemaForm.js.map +0 -1
  61. package/dist/integrations/hooks/useCredentialVaults.d.ts +0 -40
  62. package/dist/integrations/hooks/useCredentialVaults.d.ts.map +0 -1
  63. package/dist/integrations/hooks/useCredentialVaults.js +0 -98
  64. package/dist/integrations/hooks/useCredentialVaults.js.map +0 -1
  65. package/dist/integrations/utils/oauthPopup.d.ts +0 -16
  66. package/dist/integrations/utils/oauthPopup.d.ts.map +0 -1
  67. package/dist/integrations/utils/oauthPopup.js +0 -62
  68. package/dist/integrations/utils/oauthPopup.js.map +0 -1
  69. package/dist/node_modules/@iconify/react/dist/iconify.js +0 -1005
  70. package/dist/node_modules/@iconify/react/dist/iconify.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProviderIcon.js","names":[],"sources":["../../../src/integrations/components/ProviderIcon.tsx"],"sourcesContent":["import { useState, type FC } from 'react';\nimport { Icon } from '@iconify/react';\nimport { cn } from '../utils/cn';\nimport type { IntegrationProvider, ProviderCategory } from '../types';\nimport { getAccentClasses, getProviderAccent } from '../utils/appearance';\nimport bigconsoleIcon from '../assets/brands/bigconsole.png?url';\nimport burdenoffIcon from '../assets/brands/burdenoff.png?url';\n\ninterface ProviderIconProps {\n provider: IntegrationProvider;\n size?: number;\n className?: string;\n}\n\n// ============================================================================\n// Provider icon mapping — same Iconify icon names as fluidgrids-fe-sdk\n// ============================================================================\n\nconst PROVIDER_ICONS: Record<string, string> = {\n // Google services\n 'google-gmail': 'logos:google-gmail',\n 'google-drive': 'logos:google-drive',\n 'google-calendar': 'logos:google-calendar',\n 'google-sheets': 'thesvg-color:google-sheets',\n 'google-docs': 'thesvg-color:google-docs',\n 'google-chat': 'thesvg-color:google-chat',\n 'google-forms': 'simple-icons:googleforms',\n 'google-workspace-admin': 'thesvg-color:google-workspace-admin',\n // Microsoft services\n 'microsoft-outlook': 'thesvg-color:microsoft-outlook',\n 'microsoft-onedrive': 'logos:microsoft-onedrive',\n 'microsoft-teams': 'logos:microsoft-teams',\n 'microsoft-excel': 'thesvg-color:microsoft-excel',\n // Other OAuth2\n github: 'mdi:github',\n slack: 'logos:slack-icon',\n salesforce: 'logos:salesforce',\n notion: 'simple-icons:notion',\n airtable: 'logos:airtable',\n linear: 'simple-icons:linear',\n facebook: 'logos:facebook',\n instagram: 'logos:instagram-icon',\n twitter: 'simple-icons:x',\n linkedin: 'simple-icons:linkedin',\n youtube: 'logos:youtube-icon',\n tiktok: 'logos:tiktok-icon',\n pinterest: 'logos:pinterest',\n snapchat: 'simple-icons:snapchat',\n 'google-ads': 'logos:google-ads',\n 'linkedin-ads': 'simple-icons:linkedin',\n quickbooks: 'simple-icons:quickbooks',\n 'g2-data-feed': 'thesvg-color:g2',\n // API Key\n openai: 'simple-icons:openai',\n anthropic: 'simple-icons:anthropic',\n sendgrid: 'simple-icons:sendgrid',\n twilio: 'logos:twilio-icon',\n // Generic\n 'generic-oauth2': 'mdi:key-chain',\n 'generic-api-key': 'mdi:key-variant',\n 'generic-basic-auth': 'mdi:lock-outline',\n};\n\n/**\n * Fallback Iconify icons per category\n */\nconst CATEGORY_ICONS: Record<string, string> = {\n communication: 'mdi:message-text-outline',\n project_management: 'mdi:view-dashboard-outline',\n cloud_storage: 'mdi:cloud-outline',\n crm: 'mdi:account-group-outline',\n analytics: 'mdi:chart-bar',\n developer_tools: 'mdi:code-braces',\n finance: 'mdi:currency-usd',\n support: 'mdi:headset',\n social: 'mdi:share-variant-outline',\n ai: 'mdi:brain',\n email: 'mdi:email-outline',\n calendar: 'mdi:calendar-outline',\n productivity: 'mdi:file-document-outline',\n marketing: 'mdi:bullhorn-outline',\n hr: 'mdi:account-tie-outline',\n other: 'mdi:puzzle-outline',\n};\n\nfunction ownedValue<T>(values: Readonly<Record<string, T>>, key: string): T | undefined {\n return Object.prototype.hasOwnProperty.call(values, key) ? values[key] : undefined;\n}\n\nfunction getCategoryIcon(category: ProviderCategory): string {\n return ownedValue(CATEGORY_ICONS, category) ?? CATEGORY_ICONS.other;\n}\n\nconst LEGACY_BROKEN_ICON_IDS: Readonly<Record<string, { icon: string; replacement: string }>> = {\n pipedrive: { icon: 'simple-icons:pipedrive', replacement: 'thesvg-color:pipedrive' },\n};\n\n/**\n * Legacy bare keys remain readable while existing provider rows roll forward to\n * the self-describing `iconify:` values stored by the seed.\n */\nexport function getProviderIconName(\n provider: Pick<IntegrationProvider, 'icon' | 'key' | 'category'>\n): string {\n const icon = provider.icon ?? '';\n const legacyBrokenIcon = ownedValue(LEGACY_BROKEN_ICON_IDS, provider.key);\n if (icon === legacyBrokenIcon?.icon) return legacyBrokenIcon.replacement;\n if (icon.startsWith('iconify:')) return icon.slice('iconify:'.length);\n if (icon.startsWith('text:')) return getCategoryIcon(provider.category);\n if (/^[a-z0-9-]+:[a-z0-9-]+$/i.test(icon) && !icon.startsWith('brand:')) return icon;\n if (icon === 'key' && provider.key.startsWith('generic-')) {\n return ownedValue(PROVIDER_ICONS, provider.key) ?? getCategoryIcon(provider.category);\n }\n\n // An explicit administrator icon must not be replaced by an unrelated\n // provider-key mapping when it is not a recognized legacy value.\n return (\n ownedValue(PROVIDER_ICONS, icon) ??\n (icon\n ? getCategoryIcon(provider.category)\n : (ownedValue(PROVIDER_ICONS, provider.key) ?? getCategoryIcon(provider.category)))\n );\n}\n\n/**\n * True when the icon value is something the browser can load directly.\n * Supports remote URLs, app-relative paths and inline data URIs (admin upload).\n */\nfunction isImageSource(icon: string | undefined): boolean {\n if (!icon) return false;\n return icon.startsWith('http') || icon.startsWith('/') || icon.startsWith('data:');\n}\n\n// First-party marks, bundled into the MFE so host apps do not need to copy assets.\nconst BUNDLED_PROVIDER_ICONS: Readonly<Record<string, string>> = {\n bigconsole: bigconsoleIcon,\n burdenoff: burdenoffIcon,\n};\n\n// These services have no compact mark cleared for redistribution in this package.\n// A named tile is more accurate than an unrelated company's icon.\nconst TEXT_PROVIDER_LABELS: Readonly<Record<string, string>> = {\n bamboohr: 'BambooHR',\n 'meta-ads': 'Meta Ads',\n pgvector: 'pgvector',\n 'apple-app-store-connect': 'Connect',\n 'freshdesk-api': 'Freshdesk',\n hubspot: 'HubSpot',\n pinecone: 'Pinecone',\n ramp: 'Ramp',\n tally: 'TallyPrime',\n woocommerce: 'WooCommerce',\n 'zoho-books': 'Zoho Books',\n};\n\nconst LEGACY_TEXT_PROVIDER_ICONS: Readonly<Record<string, string>> = {\n bamboohr: 'simple-icons:bamboohr',\n 'meta-ads': 'meta-ads',\n pgvector: 'iconify:logos:postgresql',\n 'apple-app-store-connect': 'simple-icons:appstore',\n 'freshdesk-api': 'simple-icons:freshworks',\n hubspot: 'hubspot',\n pinecone: 'iconify:mdi:database-search',\n ramp: 'mdi:credit-card-outline',\n tally: 'tally',\n woocommerce: 'simple-icons:woocommerce',\n 'zoho-books': 'zoho-books',\n};\n\nexport function getProviderTextIcon(\n provider: Pick<IntegrationProvider, 'icon' | 'key'>\n): string | undefined {\n const { icon, key } = provider;\n const textKey = icon?.startsWith('text:') ? icon.slice('text:'.length) : key;\n if (icon?.startsWith('text:') || icon === ownedValue(LEGACY_TEXT_PROVIDER_ICONS, key)) {\n return ownedValue(TEXT_PROVIDER_LABELS, textKey);\n }\n return undefined;\n}\n\nexport function getProviderImageSource(\n provider: Pick<IntegrationProvider, 'icon' | 'key'>,\n bundledIcons: Readonly<Record<string, string>> = BUNDLED_PROVIDER_ICONS\n): string | undefined {\n const { icon } = provider;\n if (!icon) return undefined;\n if (isImageSource(icon)) return icon;\n\n return ownedValue(bundledIcons, icon.startsWith('brand:') ? icon.slice('brand:'.length) : icon);\n}\n\n/**\n * Renders a provider icon.\n *\n * Text tiles identify providers without an approved compact mark. Image URLs\n * and bundled `brand:` assets render as images; legacy values remain supported\n * during the seed rollout. Other icons use Iconify or a category fallback.\n */\nexport const ProviderIcon: FC<ProviderIconProps> = ({ provider, size = 40, className }) => {\n const iconSize = Math.round(size * 0.55);\n const accent = getAccentClasses(getProviderAccent(provider));\n const imageSource = getProviderImageSource(provider);\n const textIcon = getProviderTextIcon(provider);\n const [failedImageSource, setFailedImageSource] = useState<string | null>(null);\n\n if (textIcon) {\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n 'flex flex-shrink-0 items-center justify-center rounded-xl px-2 font-semibold tracking-tight whitespace-nowrap',\n accent.surface,\n 'text-text-primary',\n className\n )}\n style={{\n width: 'max-content',\n minWidth: Math.round(size * 1.7),\n height: size,\n fontSize: Math.max(10, Math.round(size * 0.25)),\n }}\n >\n {textIcon}\n </div>\n );\n }\n\n if (imageSource && failedImageSource !== imageSource) {\n return (\n <div\n className={cn(\n 'flex items-center justify-center rounded-xl flex-shrink-0 overflow-hidden',\n accent.surface,\n className\n )}\n style={{ width: size, height: size }}\n >\n <img\n src={imageSource}\n alt=\"\"\n className=\"object-contain\"\n style={{ width: iconSize, height: iconSize }}\n onError={() => setFailedImageSource(imageSource)}\n />\n </div>\n );\n }\n\n // 2 & 3. Iconify icon (provider-specific or category fallback)\n const iconName = getProviderIconName(provider);\n\n return (\n <div\n className={cn(\n 'flex items-center justify-center rounded-xl flex-shrink-0',\n accent.surface,\n className\n )}\n style={{\n width: size,\n height: size,\n }}\n >\n <Icon\n icon={iconName}\n width={iconSize}\n height={iconSize}\n className={iconName === 'thesvg:bedrock-aws' ? 'text-text-primary' : accent.icon}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAkBA,IAAM,IAAyC;CAE7C,gBAAgB;CAChB,gBAAgB;CAChB,mBAAmB;CACnB,iBAAiB;CACjB,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,0BAA0B;CAE1B,qBAAqB;CACrB,sBAAsB;CACtB,mBAAmB;CACnB,mBAAmB;CAEnB,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;CACR,WAAW;CACX,UAAU;CACV,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAEhB,QAAQ;CACR,WAAW;CACX,UAAU;CACV,QAAQ;CAER,kBAAkB;CAClB,mBAAmB;CACnB,sBAAsB;CACvB,EAKK,IAAyC;CAC7C,eAAe;CACf,oBAAoB;CACp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AU;GAC5C,eAAe,EAAqB,EAAY;GAChD,CAAA;EACE,CAAA;CAKV,IAAM,IAAW,EAAoB,EAAS;AAE9C,QACE,kBAAC,OAAD;EACE,WAAW,EACT,6DACA,EAAO,SACP,EACD;EACD,OAAO;GACL,OAAO;GACP,QAAQ;GACT;YAED,kBAAC,GAAD;GACE,MAAM;GACN,OAAO;GACP,QAAQ;GACR,WAAW,MAAa,uBAAuB,sBAAsB,EAAO;GAC5E,CAAA;EACE,CAAA"}
@@ -1,60 +0,0 @@
1
- import { FC } from 'react';
2
-
3
- export interface SchemaProperty {
4
- type?: string;
5
- title?: string;
6
- description?: string;
7
- placeholder?: string;
8
- secret?: boolean;
9
- format?: string;
10
- default?: string | number | boolean;
11
- enum?: Array<string | {
12
- label: string;
13
- value: string;
14
- }>;
15
- showIf?: Record<string, unknown>;
16
- }
17
- export interface FormSchema {
18
- type?: string;
19
- properties: Record<string, SchemaProperty>;
20
- required: string[];
21
- }
22
- /**
23
- * Narrow an arbitrary JSON value to a renderable schema. Returns null when the
24
- * value isn't a usable object schema, so callers can fall back rather than
25
- * rendering an empty form.
26
- */
27
- export declare function parseFormSchema(raw: unknown): FormSchema | null;
28
- /**
29
- * Required fields that are visible and filled. Hidden fields are excluded on
30
- * purpose — a `showIf` field the user never saw must not block submission.
31
- */
32
- export declare function isSchemaComplete(schema: FormSchema, values: Record<string, unknown>): boolean;
33
- /**
34
- * Seed values for a schema's declared defaults.
35
- *
36
- * A rendered control shows `property.default` as selected, but nothing was
37
- * written to form state — so validation treated the visible default as missing
38
- * and submit dropped it unless the user touched the control. The common
39
- * "accept the default" path silently lost the value.
40
- */
41
- export declare function initialValuesFromSchema(schema: FormSchema | null): Record<string, unknown>;
42
- /**
43
- * Drop values whose field is currently hidden by `showIf`.
44
- *
45
- * Changing a controlling option hides a field but leaves whatever was typed in
46
- * it in state; submitting that would store a credential the user can no longer
47
- * see and did not intend to send.
48
- */
49
- export declare function visibleValues(schema: FormSchema | null, values: Record<string, unknown>): Record<string, unknown>;
50
- interface SchemaFormProps {
51
- schema: FormSchema;
52
- values: Record<string, unknown>;
53
- onChange: (values: Record<string, unknown>) => void;
54
- disabled?: boolean;
55
- /** Prefix for generated element ids so several forms can coexist on a page. */
56
- idPrefix?: string;
57
- }
58
- export declare const SchemaForm: FC<SchemaFormProps>;
59
- export {};
60
- //# sourceMappingURL=SchemaForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaForm.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/SchemaForm.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAiB,EAAE,EAAE,MAAM,OAAO,CAAC;AAK/C,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAU/D;AAeD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAS7F;AAUD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB1F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAgBD,UAAU,eAAe;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2B1C,CAAC"}
@@ -1,235 +0,0 @@
1
- import { useTr as e } from "../hooks/useTr.js";
2
- import { useState as t } from "react";
3
- import { Eye as n, EyeOff as r, Info as i } from "lucide-react";
4
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
- //#region src/integrations/components/SchemaForm.tsx
6
- function s(e) {
7
- if (typeof e != "object" || !e || Array.isArray(e)) return null;
8
- let t = e;
9
- return typeof t.properties != "object" || t.properties === null ? null : {
10
- properties: t.properties,
11
- required: Array.isArray(t.required) ? t.required.filter((e) => typeof e == "string") : []
12
- };
13
- }
14
- function c(e, t) {
15
- return e.showIf ? Object.entries(e.showIf).every(([e, n]) => {
16
- let r = t[e];
17
- return Array.isArray(n) ? n.includes(r) : r === n;
18
- }) : !0;
19
- }
20
- function l(e, t) {
21
- return e.required.every((n) => {
22
- let r = e.properties[n];
23
- if (r && !c(r, t)) return !0;
24
- let i = t[n];
25
- return typeof i == "string" ? i.trim().length > 0 : i != null;
26
- });
27
- }
28
- function u(e) {
29
- return e.map((e) => typeof e == "string" ? {
30
- label: e,
31
- value: e
32
- } : e);
33
- }
34
- function d(e) {
35
- if (!e) return {};
36
- let t = {}, n = new Set(e.required);
37
- for (let [r, i] of Object.entries(e.properties)) {
38
- if (i.default !== void 0) {
39
- t[r] = i.default;
40
- continue;
41
- }
42
- i.type === "boolean" && n.has(r) && (t[r] = !1);
43
- }
44
- return t;
45
- }
46
- function f(e, t) {
47
- if (!e) return t;
48
- let n = {};
49
- for (let [r, i] of Object.entries(t)) {
50
- let a = e.properties[r];
51
- a && !c(a, t) || (n[r] = i);
52
- }
53
- return n;
54
- }
55
- var p = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("-webkit-text-security", "disc"), m = ({ schema: e, values: t, onChange: n, disabled: r, idPrefix: i = "schema" }) => {
56
- let o = new Set(e.required);
57
- return /* @__PURE__ */ a("div", {
58
- className: "space-y-3",
59
- children: Object.entries(e.properties).filter(([, e]) => c(e, t)).map(([e, s]) => /* @__PURE__ */ a(h, {
60
- id: `${i}-${e}`,
61
- name: e,
62
- property: s,
63
- value: t[e],
64
- required: o.has(e),
65
- disabled: r,
66
- onChange: (r) => n({
67
- ...t,
68
- [e]: r
69
- })
70
- }, e))
71
- });
72
- }, h = ({ id: s, name: c, property: l, value: d, required: f, disabled: m, onChange: h }) => {
73
- let g = e(), [_, v] = t(!1), [y, b] = t(!1), x = l.title ?? c, S = l.placeholder ?? l.description ?? "";
74
- if (l.type === "notice") return /* @__PURE__ */ o("div", {
75
- className: "flex items-start gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
76
- children: [/* @__PURE__ */ a(i, {
77
- size: 14,
78
- className: "text-status-info-text flex-shrink-0 mt-0.5"
79
- }), /* @__PURE__ */ a("span", {
80
- className: "text-xs text-status-info-text",
81
- children: l.description ?? x
82
- })]
83
- });
84
- let C = l.description ? /* @__PURE__ */ a("p", {
85
- className: "mt-1 text-xs text-text-secondary",
86
- children: l.description
87
- }) : null, w = /* @__PURE__ */ o("label", {
88
- htmlFor: s,
89
- className: "block text-sm font-medium text-text-primary mb-1.5",
90
- children: [
91
- x,
92
- " ",
93
- f && /* @__PURE__ */ a("span", {
94
- className: "text-status-error-text",
95
- children: "*"
96
- })
97
- ]
98
- }), T = "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50";
99
- if (l.type === "boolean") {
100
- let e = !!(d ?? l.default ?? !1);
101
- return /* @__PURE__ */ o("div", {
102
- className: "flex items-center gap-3",
103
- children: [/* @__PURE__ */ a("button", {
104
- type: "button",
105
- role: "switch",
106
- id: s,
107
- "aria-checked": e,
108
- "aria-label": x,
109
- onClick: () => h(!e),
110
- disabled: m,
111
- className: `relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${e ? "bg-primary" : "bg-bg-muted"}`,
112
- children: /* @__PURE__ */ a("span", { className: `inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${e ? "translate-x-4.5" : "translate-x-0.5"}` })
113
- }), /* @__PURE__ */ o("span", {
114
- className: "text-sm font-medium text-text-primary",
115
- children: [x, l.description && /* @__PURE__ */ o("span", {
116
- className: "text-text-secondary font-normal ml-1",
117
- children: ["— ", l.description]
118
- })]
119
- })]
120
- });
121
- }
122
- if (l.enum && l.enum.length > 0) return /* @__PURE__ */ o("div", { children: [
123
- w,
124
- /* @__PURE__ */ o("select", {
125
- id: s,
126
- "aria-label": x,
127
- value: String(d ?? l.default ?? ""),
128
- onChange: (e) => h(e.target.value),
129
- disabled: m,
130
- className: T,
131
- children: [/* @__PURE__ */ a("option", {
132
- value: "",
133
- children: g("integrations.schemaForm.select", "Select {{label}}", { label: x.toLowerCase() })
134
- }), u(l.enum).map((e) => /* @__PURE__ */ a("option", {
135
- value: e.value,
136
- children: e.label
137
- }, e.value))]
138
- }),
139
- C
140
- ] });
141
- if (l.type === "number") return /* @__PURE__ */ o("div", { children: [
142
- w,
143
- /* @__PURE__ */ a("input", {
144
- id: s,
145
- "aria-label": x,
146
- type: "number",
147
- value: d == null ? "" : String(d),
148
- onChange: (e) => h(e.target.value === "" ? void 0 : Number(e.target.value)),
149
- placeholder: S,
150
- disabled: m,
151
- className: T
152
- }),
153
- C
154
- ] });
155
- if (l.format === "textarea" || l.format === "json") {
156
- let e = !!l.secret && !_, t = typeof d == "string" && d.length > 0;
157
- return e && !p && t && !y ? /* @__PURE__ */ o("div", { children: [
158
- w,
159
- /* @__PURE__ */ o("div", {
160
- className: "flex items-center justify-between gap-2 px-3 py-2 border border-border-subtle rounded-md bg-bg-surface",
161
- children: [/* @__PURE__ */ a("span", {
162
- className: "text-sm font-mono text-text-secondary select-none",
163
- children: "••••••••••••"
164
- }), /* @__PURE__ */ o("button", {
165
- type: "button",
166
- onClick: () => v(!0),
167
- disabled: m,
168
- "aria-label": g("integrations.schemaForm.reveal", "Show {{label}}", { label: x }),
169
- className: "inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",
170
- children: [
171
- /* @__PURE__ */ a(n, { size: 14 }),
172
- " ",
173
- g("integrations.schemaForm.revealToEdit", "Reveal to edit")
174
- ]
175
- })]
176
- }),
177
- C
178
- ] }) : /* @__PURE__ */ o("div", { children: [
179
- w,
180
- /* @__PURE__ */ o("div", {
181
- className: "relative",
182
- children: [/* @__PURE__ */ a("textarea", {
183
- id: s,
184
- "aria-label": x,
185
- value: String(d ?? ""),
186
- onChange: (e) => h(e.target.value),
187
- onFocus: () => b(!0),
188
- onBlur: () => b(!1),
189
- placeholder: S,
190
- disabled: m,
191
- rows: 5,
192
- autoComplete: "off",
193
- spellCheck: !1,
194
- style: e ? { WebkitTextSecurity: "disc" } : void 0,
195
- className: `${T} font-mono ${l.secret ? "pr-10" : ""}`
196
- }), l.secret && /* @__PURE__ */ a("button", {
197
- type: "button",
198
- onClick: () => v((e) => !e),
199
- "aria-label": _ ? g("integrations.schemaForm.hide", "Hide {{label}}", { label: x }) : g("integrations.schemaForm.reveal", "Show {{label}}", { label: x }),
200
- className: "absolute right-2 top-2 text-text-secondary hover:text-text-primary",
201
- children: a(_ ? r : n, { size: 16 })
202
- })]
203
- }),
204
- C
205
- ] });
206
- }
207
- return /* @__PURE__ */ o("div", { children: [
208
- w,
209
- /* @__PURE__ */ o("div", {
210
- className: "relative",
211
- children: [/* @__PURE__ */ a("input", {
212
- id: s,
213
- "aria-label": x,
214
- type: l.secret && !_ ? "password" : "text",
215
- value: String(d ?? ""),
216
- onChange: (e) => h(e.target.value),
217
- placeholder: S,
218
- disabled: m,
219
- autoComplete: "off",
220
- className: `${T} ${l.secret ? "font-mono pr-10" : ""}`
221
- }), l.secret && /* @__PURE__ */ a("button", {
222
- type: "button",
223
- onClick: () => v((e) => !e),
224
- "aria-label": _ ? g("integrations.schemaForm.hide", "Hide {{label}}", { label: x }) : g("integrations.schemaForm.reveal", "Show {{label}}", { label: x }),
225
- className: "absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary",
226
- children: a(_ ? r : n, { size: 16 })
227
- })]
228
- }),
229
- C
230
- ] });
231
- };
232
- //#endregion
233
- export { m as SchemaForm, d as initialValuesFromSchema, l as isSchemaComplete, s as parseFormSchema, f as visibleValues };
234
-
235
- //# sourceMappingURL=SchemaForm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaForm.js","names":[],"sources":["../../../src/integrations/components/SchemaForm.tsx"],"sourcesContent":["/**\n * SchemaForm — renders a credential form from a JSON-Schema-ish description.\n *\n * The whole point of this component is that it is the *only* place credential\n * fields are drawn. A provider (or one of its auth methods) describes what it\n * needs as data, this renders it, and adding a provider or an authentication\n * method never requires new React.\n *\n * Supported per-property keys, beyond plain JSON Schema:\n * secret -> masked input with a reveal toggle\n * format -> 'textarea' | 'json' for multi-line values (service-account keys)\n * enum -> string[] or {label,value}[] for a select\n * showIf -> { field: value | value[] } conditional visibility\n * placeholder -> distinct from `description`, which renders as help text\n * type -> 'notice' renders informational copy instead of an input\n */\nimport type { CSSProperties, FC } from 'react';\nimport { useState } from 'react';\nimport { Eye, EyeOff, Info } from 'lucide-react';\nimport { useTr } from '../hooks/useTr';\n\nexport interface SchemaProperty {\n type?: string;\n title?: string;\n description?: string;\n placeholder?: string;\n secret?: boolean;\n format?: string;\n default?: string | number | boolean;\n enum?: Array<string | { label: string; value: string }>;\n showIf?: Record<string, unknown>;\n}\n\nexport interface FormSchema {\n type?: string;\n properties: Record<string, SchemaProperty>;\n required: string[];\n}\n\n/**\n * Narrow an arbitrary JSON value to a renderable schema. Returns null when the\n * value isn't a usable object schema, so callers can fall back rather than\n * rendering an empty form.\n */\nexport function parseFormSchema(raw: unknown): FormSchema | null {\n if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) return null;\n const candidate = raw as { properties?: unknown; required?: unknown };\n if (typeof candidate.properties !== 'object' || candidate.properties === null) return null;\n return {\n properties: candidate.properties as Record<string, SchemaProperty>,\n required: Array.isArray(candidate.required)\n ? candidate.required.filter((r): r is string => typeof r === 'string')\n : [],\n };\n}\n\n/**\n * Evaluate a property's `showIf`. A field is visible when every named field\n * holds one of the accepted values, so dependent fields (e.g. \"custom scopes\"\n * revealed by a toggle) need no bespoke component.\n */\nfunction isVisible(property: SchemaProperty, values: Record<string, unknown>): boolean {\n if (!property.showIf) return true;\n return Object.entries(property.showIf).every(([field, expected]) => {\n const actual = values[field];\n return Array.isArray(expected) ? expected.includes(actual) : actual === expected;\n });\n}\n\n/**\n * Required fields that are visible and filled. Hidden fields are excluded on\n * purpose — a `showIf` field the user never saw must not block submission.\n */\nexport function isSchemaComplete(schema: FormSchema, values: Record<string, unknown>): boolean {\n return schema.required.every((field) => {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) return true;\n const value = values[field];\n return typeof value === 'string'\n ? value.trim().length > 0\n : value !== undefined && value !== null;\n });\n}\n\nfunction normalizeOptions(\n options: Array<string | { label: string; value: string }>\n): Array<{ label: string; value: string }> {\n return options.map((option) =>\n typeof option === 'string' ? { label: option, value: option } : option\n );\n}\n\n/**\n * Seed values for a schema's declared defaults.\n *\n * A rendered control shows `property.default` as selected, but nothing was\n * written to form state — so validation treated the visible default as missing\n * and submit dropped it unless the user touched the control. The common\n * \"accept the default\" path silently lost the value.\n */\nexport function initialValuesFromSchema(schema: FormSchema | null): Record<string, unknown> {\n if (!schema) return {};\n const values: Record<string, unknown> = {};\n const required = new Set(schema.required);\n for (const [field, property] of Object.entries(schema.properties)) {\n if (property.default !== undefined) {\n values[field] = property.default;\n continue;\n }\n // A boolean with no declared default still renders as a usable control in\n // its \"off\" position, so a *required* boolean was impossible to satisfy.\n // Required only: seeding an *optional* boolean would submit an explicit\n // false the user never chose. A required one needs the entry because its\n // rendered \"off\" position is already a valid answer.\n if (property.type === 'boolean' && required.has(field)) values[field] = false;\n }\n return values;\n}\n\n/**\n * Drop values whose field is currently hidden by `showIf`.\n *\n * Changing a controlling option hides a field but leaves whatever was typed in\n * it in state; submitting that would store a credential the user can no longer\n * see and did not intend to send.\n */\nexport function visibleValues(\n schema: FormSchema | null,\n values: Record<string, unknown>\n): Record<string, unknown> {\n if (!schema) return values;\n const result: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(values)) {\n const property = schema.properties[field];\n if (property && !isVisible(property, values)) continue;\n result[field] = value;\n }\n return result;\n}\n\n/**\n * Whether the engine can mask a textarea's rendering without altering its value.\n *\n * `-webkit-text-security` is non-standard and Firefox does not implement it, so\n * on those engines a masked textarea would silently render the secret in\n * cleartext — the exact bug this masking exists to fix. Detected once at module\n * load; consumers fall back to a reveal-to-edit control that never renders the\n * raw value at all.\n */\nconst SUPPORTS_TEXT_SECURITY =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('-webkit-text-security', 'disc');\n\ninterface SchemaFormProps {\n schema: FormSchema;\n values: Record<string, unknown>;\n onChange: (values: Record<string, unknown>) => void;\n disabled?: boolean;\n /** Prefix for generated element ids so several forms can coexist on a page. */\n idPrefix?: string;\n}\n\nexport const SchemaForm: FC<SchemaFormProps> = ({\n schema,\n values,\n onChange,\n disabled,\n idPrefix = 'schema',\n}) => {\n const required = new Set(schema.required);\n\n return (\n <div className=\"space-y-3\">\n {Object.entries(schema.properties)\n .filter(([, property]) => isVisible(property, values))\n .map(([field, property]) => (\n <SchemaField\n key={field}\n id={`${idPrefix}-${field}`}\n name={field}\n property={property}\n value={values[field]}\n required={required.has(field)}\n disabled={disabled}\n onChange={(next) => onChange({ ...values, [field]: next })}\n />\n ))}\n </div>\n );\n};\n\ninterface SchemaFieldProps {\n id: string;\n name: string;\n property: SchemaProperty;\n value: unknown;\n required: boolean;\n disabled?: boolean;\n onChange: (value: unknown) => void;\n}\n\nconst SchemaField: FC<SchemaFieldProps> = ({\n id,\n name,\n property,\n value,\n required,\n disabled,\n onChange,\n}) => {\n const tr = useTr();\n const [revealed, setRevealed] = useState(false);\n // Only meaningful on engines without `-webkit-text-security` (see below): the\n // field is being typed into right now, so it must stay a real textarea.\n const [editing, setEditing] = useState(false);\n const label = property.title ?? name;\n const placeholder = property.placeholder ?? property.description ?? '';\n\n if (property.type === 'notice') {\n return (\n <div className=\"flex items-start gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Info size={14} className=\"text-status-info-text flex-shrink-0 mt-0.5\" />\n <span className=\"text-xs text-status-info-text\">{property.description ?? label}</span>\n </div>\n );\n }\n\n const help = property.description ? (\n <p className=\"mt-1 text-xs text-text-secondary\">{property.description}</p>\n ) : null;\n\n const labelNode = (\n <label htmlFor={id} className=\"block text-sm font-medium text-text-primary mb-1.5\">\n {label} {required && <span className=\"text-status-error-text\">*</span>}\n </label>\n );\n\n const inputClass =\n 'w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50';\n\n if (property.type === 'boolean') {\n // One resolved value drives aria-checked, the visual state and the toggle.\n // Reading `value` directly for the styling while aria-checked fell back to\n // `property.default` made a defaulted-true switch render as off, and the\n // first click then set it to the value it already reported — appearing to do\n // nothing.\n const checked = Boolean(value ?? property.default ?? false);\n return (\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n role=\"switch\"\n id={id}\n aria-checked={checked}\n aria-label={label}\n onClick={() => onChange(!checked)}\n disabled={disabled}\n className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors disabled:opacity-50 ${\n checked ? 'bg-primary' : 'bg-bg-muted'\n }`}\n >\n <span\n className={`inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform ${\n checked ? 'translate-x-4.5' : 'translate-x-0.5'\n }`}\n />\n </button>\n <span className=\"text-sm font-medium text-text-primary\">\n {label}\n {property.description && (\n <span className=\"text-text-secondary font-normal ml-1\">— {property.description}</span>\n )}\n </span>\n </div>\n );\n }\n\n if (property.enum && property.enum.length > 0) {\n return (\n <div>\n {labelNode}\n <select\n id={id}\n aria-label={label}\n value={String(value ?? property.default ?? '')}\n onChange={(event) => onChange(event.target.value)}\n disabled={disabled}\n className={inputClass}\n >\n <option value=\"\">\n {tr('integrations.schemaForm.select', 'Select {{label}}', {\n label: label.toLowerCase(),\n })}\n </option>\n {normalizeOptions(property.enum).map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n {help}\n </div>\n );\n }\n\n if (property.type === 'number') {\n return (\n <div>\n {labelNode}\n <input\n id={id}\n aria-label={label}\n type=\"number\"\n value={value === undefined || value === null ? '' : String(value)}\n onChange={(event) =>\n onChange(event.target.value === '' ? undefined : Number(event.target.value))\n }\n placeholder={placeholder}\n disabled={disabled}\n className={inputClass}\n />\n {help}\n </div>\n );\n }\n\n // Multi-line values (service-account key JSON, PEM blocks) are unusable in a\n // single-line input — the previous form made you paste a whole JSON key into\n // one, so `format` is honoured before the secret/plain split.\n const multiline = property.format === 'textarea' || property.format === 'json';\n if (multiline) {\n // A multi-line field can still be a secret — a service-account key JSON is\n // both `secret: true` and `format: textarea`. This branch used to return\n // before the masking code, so the private key rendered in cleartext.\n //\n // Masked with `-webkit-text-security`, the textarea equivalent of\n // `type=\"password\"` on the single-line branch: the DOM keeps the REAL\n // value, only its rendering changes. Every earlier attempt here swapped the\n // value for a mask string, and each one broke editing in a different way —\n // an empty field went read-only, then typing flipped it mid-edit, then\n // concealment keyed on mount state and so never engaged at all, because in\n // this dialog the field is always empty at mount (secrets are never read\n // back from the server). Not substituting the value avoids the whole class.\n const masked = Boolean(property.secret) && !revealed;\n const hasValue = typeof value === 'string' && value.length > 0;\n // Where the engine cannot mask rendering, never leave the value on screen:\n // show a placeholder box and require an explicit reveal to edit it.\n //\n // `editing` is what keeps this usable. Without it the box replaced the\n // textarea on the first keystroke, so a key pasted in chunks — or typed at\n // all — had to be revealed to continue. Concealment therefore waits for\n // focus to leave: while the field has focus it stays editable, and a secret\n // is only ever left drawn on a field the user is actively working in.\n const concealWithoutCss = masked && !SUPPORTS_TEXT_SECURITY && hasValue && !editing;\n\n if (concealWithoutCss) {\n return (\n <div>\n {labelNode}\n <div className=\"flex items-center justify-between gap-2 px-3 py-2 border border-border-subtle rounded-md bg-bg-surface\">\n <span className=\"text-sm font-mono text-text-secondary select-none\">••••••••••••</span>\n <button\n type=\"button\"\n onClick={() => setRevealed(true)}\n disabled={disabled}\n aria-label={tr('integrations.schemaForm.reveal', 'Show {{label}}', { label })}\n className=\"inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50\"\n >\n <Eye size={14} /> {tr('integrations.schemaForm.revealToEdit', 'Reveal to edit')}\n </button>\n </div>\n {help}\n </div>\n );\n }\n\n return (\n <div>\n {labelNode}\n <div className=\"relative\">\n <textarea\n id={id}\n aria-label={label}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n onFocus={() => setEditing(true)}\n onBlur={() => setEditing(false)}\n placeholder={placeholder}\n disabled={disabled}\n rows={5}\n autoComplete=\"off\"\n spellCheck={false}\n // Masks what is drawn, not what is stored, so typing and paste keep\n // working and focus discloses nothing.\n // Cast: -webkit-text-security is not in React's CSSProperties, but\n // it is the only way to mask a textarea without replacing its value.\n style={masked ? ({ WebkitTextSecurity: 'disc' } as CSSProperties) : undefined}\n className={`${inputClass} font-mono ${property.secret ? 'pr-10' : ''}`}\n />\n {property.secret && (\n <button\n type=\"button\"\n onClick={() => setRevealed((previous) => !previous)}\n aria-label={\n revealed\n ? tr('integrations.schemaForm.hide', 'Hide {{label}}', { label })\n : tr('integrations.schemaForm.reveal', 'Show {{label}}', { label })\n }\n className=\"absolute right-2 top-2 text-text-secondary hover:text-text-primary\"\n >\n {revealed ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n )}\n </div>\n {help}\n </div>\n );\n }\n\n return (\n <div>\n {labelNode}\n <div className=\"relative\">\n <input\n id={id}\n aria-label={label}\n type={property.secret && !revealed ? 'password' : 'text'}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n autoComplete=\"off\"\n className={`${inputClass} ${property.secret ? 'font-mono pr-10' : ''}`}\n />\n {property.secret && (\n <button\n type=\"button\"\n onClick={() => setRevealed((previous) => !previous)}\n aria-label={\n revealed\n ? tr('integrations.schemaForm.hide', 'Hide {{label}}', { label })\n : tr('integrations.schemaForm.reveal', 'Show {{label}}', { label })\n }\n className=\"absolute right-2 top-1/2 -translate-y-1/2 text-text-secondary hover:text-text-primary\"\n >\n {revealed ? <EyeOff size={16} /> : <Eye size={16} />}\n </button>\n )}\n </div>\n {help}\n </div>\n );\n};\n"],"mappings":";;;;;AA4CA,SAAgB,EAAgB,GAAiC;AAC/D,KAAI,OAAO,KAAQ,aAAY,KAAgB,MAAM,QAAQ,EAAI,CAAE,QAAO;CAC1E,IAAM,IAAY;AAElB,QADI,OAAO,EAAU,cAAe,YAAY,EAAU,eAA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,CAEP;;GACL;GACG,EAAA,CAAA;;AAIV,QACE,kBAAC,OAAD,EAAA,UAAA;EACG;EACD,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,SAAD;IACM;IACJ,cAAY;IACZ,MAAM,EAAS,UAAU,CAAC,IAAW,aAAa;IAClD,OAAO,OAAO,KAAS,GAAG;IAC1B,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;IACpC;IACH;IACV,cAAa;IACb,WAAW,GAAG,EAAW,GAAG,EAAS,SAAS,oBAAoB;IAClE,CAAA,EACD,EAAS,UACR,kBAAC,UAAD;IACE,MAAK;IACL,eAAe,GAAa,MAAa,CAAC,EAAS;IACnD,cACE,IACI,EAAG,gCAAgC,kBAAkB,EAAE,UAAO,CAAC,GAC/D,EAAG,kCAAkC,kBAAkB,EAAE,UAAO,CAAC;IAEvE,WAAU;cAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;IAC7C,CAAA,CAEP;;EACL;EACG,EAAA,CAAA"}
@@ -1,40 +0,0 @@
1
- import { VaultSummary } from '../types';
2
-
3
- export declare function useCredentialVaults(): {
4
- vaults: any;
5
- total: number;
6
- loading: boolean;
7
- error: import('@apollo/client').ErrorLike | undefined;
8
- refetch: (variables?: any) => Promise<{
9
- data: any;
10
- error?: import('@apollo/client').ErrorLike;
11
- }>;
12
- };
13
- /**
14
- * Create a vault without leaving the connection dialog.
15
- *
16
- * A connection cannot be saved without a vault to hold its secret, and a
17
- * workspace starts with none — so the dialog was a dead end until someone went
18
- * to the security module, created one, and came back. Creating it here keeps
19
- * the whole flow in one place.
20
- *
21
- * `WORKSPACE` scope matches what the security module's own create page uses, so
22
- * a vault made here is the same kind of vault, visible in both.
23
- */
24
- export declare function useCreateCredentialVault(): {
25
- createVault: (name: string, description?: string) => Promise<VaultSummary | null>;
26
- creating: boolean;
27
- error: string | null;
28
- clearError: () => void;
29
- };
30
- export declare function useVaultSecrets(vaultId: string | null, authType?: string | null): {
31
- secrets: any;
32
- total: number;
33
- loading: boolean;
34
- error: import('@apollo/client').ErrorLike | undefined;
35
- refetch: (variables?: any) => Promise<{
36
- data: any;
37
- error?: import('@apollo/client').ErrorLike;
38
- }>;
39
- };
40
- //# sourceMappingURL=useCredentialVaults.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCredentialVaults.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAsB,YAAY,EAAE,MAAM,UAAU,CAAC;AAwBjE,wBAAgB,mBAAmB;;;;;;;;;EAwBlC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB;wBAKvB,MAAM,gBAAgB,MAAM,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;;;;EA6B3E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;;;;;;;;;EA2C/E"}
@@ -1,98 +0,0 @@
1
- import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
2
- import { useCreateVaultForIntegrationsMutation as t, useGetVaultSecretsForIntegrationsQuery as n, useGetVaultsForIntegrationsQuery as r } from "../../generated/wspace-operations.js";
3
- import { useCallback as i, useMemo as a, useState as o } from "react";
4
- //#region src/integrations/hooks/useCredentialVaults.ts
5
- function s(e) {
6
- return {
7
- id: String(e.id ?? ""),
8
- name: String(e.name ?? ""),
9
- description: e.description ? String(e.description) : null,
10
- status: String(e.status ?? "UNKNOWN"),
11
- secretCount: Number(e.secretCount ?? 0)
12
- };
13
- }
14
- function c(e) {
15
- return {
16
- id: String(e.id ?? ""),
17
- vaultId: String(e.vaultId ?? ""),
18
- name: String(e.name ?? ""),
19
- key: String(e.key ?? ""),
20
- description: e.description ? String(e.description) : null,
21
- type: String(e.type ?? ""),
22
- status: String(e.status ?? "")
23
- };
24
- }
25
- function l() {
26
- let { workspaceId: t } = e(), { data: n, loading: i, error: o, refetch: c } = r({
27
- variables: {
28
- filter: { status: "ACTIVE" },
29
- pagination: { limit: 100 }
30
- },
31
- skip: !t,
32
- fetchPolicy: "network-only",
33
- errorPolicy: "all"
34
- });
35
- return {
36
- vaults: a(() => (n?.getVaults?.items ?? []).map((e) => s(e)), [n]),
37
- total: Number(n?.getVaults?.total ?? 0),
38
- loading: i,
39
- error: o,
40
- refetch: c
41
- };
42
- }
43
- function u() {
44
- let [e, { loading: n }] = t(), [r, a] = o(null);
45
- return {
46
- createVault: i(async (t, n) => {
47
- a(null);
48
- try {
49
- let r = (await e({ variables: { input: {
50
- name: t.trim(),
51
- description: n?.trim() ? n.trim() : void 0,
52
- scope: "WORKSPACE"
53
- } } })).data?.createVault;
54
- return r ? s(r) : (a("The vault could not be created"), null);
55
- } catch (e) {
56
- return a(e instanceof Error ? e.message : "The vault could not be created"), null;
57
- }
58
- }, [e]),
59
- creating: n,
60
- error: r,
61
- clearError: i(() => a(null), [])
62
- };
63
- }
64
- function d(t, r) {
65
- let { workspaceId: i } = e(), { data: o, loading: s, error: l, refetch: u } = n({
66
- variables: {
67
- vaultId: t ?? "",
68
- filter: { status: "ACTIVE" },
69
- pagination: { limit: 100 }
70
- },
71
- skip: !i || !t,
72
- fetchPolicy: "network-only",
73
- errorPolicy: "all"
74
- });
75
- return {
76
- secrets: a(() => {
77
- let e = (o?.getSecrets?.items ?? []).map((e) => c(e));
78
- return r ? r === "oauth2" || r === "basic_auth" ? e.filter((e) => [
79
- "TOKEN",
80
- "CREDENTIAL",
81
- "STRUCTURED_DATA"
82
- ].includes(e.type)) : r === "api_key" || r === "bearer_token" ? e.filter((e) => [
83
- "API_KEY",
84
- "TOKEN",
85
- "TEXT",
86
- "STRUCTURED_DATA"
87
- ].includes(e.type)) : e : e;
88
- }, [r, o]),
89
- total: Number(o?.getSecrets?.total ?? 0),
90
- loading: s,
91
- error: l,
92
- refetch: u
93
- };
94
- }
95
- //#endregion
96
- export { u as useCreateCredentialVault, l as useCredentialVaults, d as useVaultSecrets };
97
-
98
- //# sourceMappingURL=useCredentialVaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCredentialVaults.js","names":[],"sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\n\nimport {\n useCreateVaultForIntegrationsMutation,\n useGetVaultsForIntegrationsQuery,\n useGetVaultSecretsForIntegrationsQuery,\n} from '../../generated/wspace-operations';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport type { VaultSecretSummary, VaultSummary } from '../types';\n\nfunction mapVault(raw: Record<string, unknown>): VaultSummary {\n return {\n id: String(raw.id ?? ''),\n name: String(raw.name ?? ''),\n description: raw.description ? String(raw.description) : null,\n status: String(raw.status ?? 'UNKNOWN'),\n secretCount: Number(raw.secretCount ?? 0),\n };\n}\n\nfunction mapSecret(raw: Record<string, unknown>): VaultSecretSummary {\n return {\n id: String(raw.id ?? ''),\n vaultId: String(raw.vaultId ?? ''),\n name: String(raw.name ?? ''),\n key: String(raw.key ?? ''),\n description: raw.description ? String(raw.description) : null,\n type: String(raw.type ?? ''),\n status: String(raw.status ?? ''),\n };\n}\n\nexport function useCredentialVaults() {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultsForIntegrationsQuery({\n variables: {\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const vaults = useMemo(\n () => (data?.getVaults?.items ?? []).map((item: Record<string, unknown>) => mapVault(item)),\n [data]\n );\n\n return {\n vaults,\n total: Number(data?.getVaults?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n\n/**\n * Create a vault without leaving the connection dialog.\n *\n * A connection cannot be saved without a vault to hold its secret, and a\n * workspace starts with none — so the dialog was a dead end until someone went\n * to the security module, created one, and came back. Creating it here keeps\n * the whole flow in one place.\n *\n * `WORKSPACE` scope matches what the security module's own create page uses, so\n * a vault made here is the same kind of vault, visible in both.\n */\nexport function useCreateCredentialVault() {\n const [mutate, { loading }] = useCreateVaultForIntegrationsMutation();\n const [error, setError] = useState<string | null>(null);\n\n const createVault = useCallback(\n async (name: string, description?: string): Promise<VaultSummary | null> => {\n setError(null);\n try {\n const result = await mutate({\n variables: {\n input: {\n name: name.trim(),\n description: description?.trim() ? description.trim() : undefined,\n scope: 'WORKSPACE',\n },\n },\n });\n const created = result.data?.createVault;\n if (!created) {\n setError('The vault could not be created');\n return null;\n }\n return mapVault(created);\n } catch (caught) {\n setError(caught instanceof Error ? caught.message : 'The vault could not be created');\n return null;\n }\n },\n [mutate]\n );\n\n const clearError = useCallback(() => setError(null), []);\n\n return { createVault, creating: loading, error, clearError };\n}\n\nexport function useVaultSecrets(vaultId: string | null, authType?: string | null) {\n const { workspaceId } = useIntegrations();\n const { data, loading, error, refetch } = useGetVaultSecretsForIntegrationsQuery({\n variables: {\n vaultId: vaultId ?? '',\n filter: { status: 'ACTIVE' },\n pagination: { limit: 100 },\n },\n skip: !workspaceId || !vaultId,\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const secrets = useMemo(() => {\n const items = (data?.getSecrets?.items ?? []).map((item: Record<string, unknown>) =>\n mapSecret(item)\n );\n if (!authType) {\n return items;\n }\n\n if (authType === 'oauth2' || authType === 'basic_auth') {\n return items.filter((secret: VaultSecretSummary) =>\n ['TOKEN', 'CREDENTIAL', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n if (authType === 'api_key' || authType === 'bearer_token') {\n return items.filter((secret: VaultSecretSummary) =>\n ['API_KEY', 'TOKEN', 'TEXT', 'STRUCTURED_DATA'].includes(secret.type)\n );\n }\n\n return items;\n }, [authType, data]);\n\n return {\n secrets,\n total: Number(data?.getSecrets?.total ?? 0),\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;AAUA,SAAS,EAAS,GAA4C;AAC5D,QAAO;EACL,IAAI,OAAO,EAAI,MAAM,GAAG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F,CAAC,EACqB,MAAM;AAK7B,WAJK,IAIE,EAAS,EAAQ,IAHtB,EAAS,iCAAiC,EACnC;YAGF,GAAQ;AAEf,WADA,EAAS,aAAkB,QAAQ,EAAO,UAAU,iCAAiC,EAC9E;;KAGX,CAAC,EAAO,CACT;EAIqB,UAAU;EAAS;EAAO,YAF7B,QAAkB,EAAS,KAAK,EAAE,EAAE,CAAC;EAEI;;AAG9D,SAAgB,EAAgB,GAAwB,GAA0B;CAChF,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EAAuC;EAC/E,WAAW;GACT,SAAS,KAAW;GACpB,QAAQ,EAAE,QAAQ,UAAU;GAC5B,YAAY,EAAE,OAAO,KAAK;GAC3B;EACD,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACb,aAAa;EACd,CAAC;AAyBF,QAAO;EACL,SAxBc,QAAc;GAC5B,IAAM,KAAS,GAAM,YAAY,SAAS,EAAE,EAAE,KAAK,MACjD,EAAU,EAAK,CAChB;AAiBD,UAhBK,IAID,MAAa,YAAY,MAAa,eACjC,EAAM,QAAQ,MACnB;IAAC;IAAS;IAAc;IAAkB,CAAC,SAAS,EAAO,KAAK,CACjE,GAGC,MAAa,aAAa,MAAa,iBAClC,EAAM,QAAQ,MACnB;IAAC;IAAW;IAAS;IAAQ;IAAkB,CAAC,SAAS,EAAO,KAAK,CACtE,GAGI,IAfE;KAgBR,CAAC,GAAU,EAAK,CAAC;EAIlB,OAAO,OAAO,GAAM,YAAY,SAAS,EAAE;EAC3C;EACA;EACA;EACD"}
@@ -1,16 +0,0 @@
1
- type OAuthConnectionStatus = {
2
- status?: string | null;
3
- errorMessage?: string | null;
4
- };
5
- interface WaitForOAuthPopupCompletionOptions {
6
- connectionId: string;
7
- popup: Window;
8
- fetchConnectionStatus: () => Promise<OAuthConnectionStatus | null | undefined>;
9
- onSuccess: () => void;
10
- onError: (message: string) => void;
11
- onSettled: () => void;
12
- timeoutMs?: number;
13
- }
14
- export declare function waitForOAuthPopupCompletion({ connectionId, popup, fetchConnectionStatus, onSuccess, onError, onSettled, timeoutMs, }: WaitForOAuthPopupCompletionOptions): () => void;
15
- export {};
16
- //# sourceMappingURL=oauthPopup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauthPopup.d.ts","sourceRoot":"","sources":["../../../src/integrations/utils/oauthPopup.ts"],"names":[],"mappings":"AAQA,KAAK,qBAAqB,GAAG;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,UAAU,kCAAkC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB,EAAE,MAAM,OAAO,CAAC,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAC/E,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,wBAAgB,2BAA2B,CAAC,EAC1C,YAAY,EACZ,KAAK,EACL,qBAAqB,EACrB,SAAS,EACT,OAAO,EACP,SAAS,EACT,SAAkB,GACnB,EAAE,kCAAkC,GAAG,MAAM,IAAI,CA4FjD"}
@@ -1,62 +0,0 @@
1
- //#region src/integrations/utils/oauthPopup.ts
2
- function e(e) {
3
- return typeof e == "object" && !!e;
4
- }
5
- function t(t) {
6
- return e(t) && t.type === "OAUTH_CALLBACK" && typeof t.success == "boolean" && (t.connectionId === void 0 || typeof t.connectionId == "string") && (t.error === void 0 || typeof t.error == "string") && (t.errorCode === void 0 || typeof t.errorCode == "string");
7
- }
8
- function n(e) {
9
- if (!e) return null;
10
- try {
11
- let n = JSON.parse(e);
12
- return t(n) ? n : null;
13
- } catch {
14
- return null;
15
- }
16
- }
17
- function r({ connectionId: e, popup: r, fetchConnectionStatus: i, onSuccess: a, onError: o, onSettled: s, timeoutMs: c = 3e5 }) {
18
- let l = !1, u = null, d = null, f = () => {
19
- d &&= (clearTimeout(d), null), window.removeEventListener("message", m), window.removeEventListener("storage", h), u?.close(), u = null;
20
- }, p = async (t) => {
21
- if (!l && !(t?.connectionId && t.connectionId !== e)) {
22
- l = !0, f(), r.closed || r.close();
23
- try {
24
- if (t && !t.success) {
25
- o(t.error || "OAuth authorization failed");
26
- return;
27
- }
28
- let e = await i();
29
- if (!e) {
30
- o("Connection not found. It may have been deleted.");
31
- return;
32
- }
33
- if (e.status === "ACTIVE") {
34
- a();
35
- return;
36
- }
37
- o(e.errorMessage || "OAuth authorization failed");
38
- } finally {
39
- s();
40
- }
41
- }
42
- };
43
- function m(e) {
44
- t(e.data) && p(e.data);
45
- }
46
- function h(e) {
47
- if (e.key !== "oauth_callback_result") return;
48
- let t = n(e.newValue);
49
- t && p(t);
50
- }
51
- return window.addEventListener("message", m), window.addEventListener("storage", h), "BroadcastChannel" in window && (u = new BroadcastChannel("oauth_callback"), u.onmessage = (e) => {
52
- t(e.data) && p(e.data);
53
- }), d = setTimeout(() => {
54
- l || (l = !0, f(), r.closed || r.close(), o("OAuth authorization timed out"), s());
55
- }, c), () => {
56
- l || (l = !0, f());
57
- };
58
- }
59
- //#endregion
60
- export { r as waitForOAuthPopupCompletion };
61
-
62
- //# sourceMappingURL=oauthPopup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oauthPopup.js","names":[],"sources":["../../../src/integrations/utils/oauthPopup.ts"],"sourcesContent":["type OAuthCallbackMessage = {\n type: 'OAUTH_CALLBACK';\n success: boolean;\n connectionId?: string;\n error?: string;\n errorCode?: string;\n};\n\ntype OAuthConnectionStatus = {\n status?: string | null;\n errorMessage?: string | null;\n};\n\ninterface WaitForOAuthPopupCompletionOptions {\n connectionId: string;\n popup: Window;\n fetchConnectionStatus: () => Promise<OAuthConnectionStatus | null | undefined>;\n onSuccess: () => void;\n onError: (message: string) => void;\n onSettled: () => void;\n timeoutMs?: number;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction isOAuthCallbackMessage(value: unknown): value is OAuthCallbackMessage {\n return (\n isRecord(value) &&\n value.type === 'OAUTH_CALLBACK' &&\n typeof value.success === 'boolean' &&\n (value.connectionId === undefined || typeof value.connectionId === 'string') &&\n (value.error === undefined || typeof value.error === 'string') &&\n (value.errorCode === undefined || typeof value.errorCode === 'string')\n );\n}\n\nfunction parseStorageMessage(value: string | null): OAuthCallbackMessage | null {\n if (!value) return null;\n\n try {\n const parsed: unknown = JSON.parse(value);\n return isOAuthCallbackMessage(parsed) ? parsed : null;\n } catch {\n return null;\n }\n}\n\nexport function waitForOAuthPopupCompletion({\n connectionId,\n popup,\n fetchConnectionStatus,\n onSuccess,\n onError,\n onSettled,\n timeoutMs = 300000,\n}: WaitForOAuthPopupCompletionOptions): () => void {\n let settled = false;\n let channel: BroadcastChannel | null = null;\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n window.removeEventListener('message', handleWindowMessage);\n window.removeEventListener('storage', handleStorageMessage);\n channel?.close();\n channel = null;\n };\n\n const finish = async (message?: OAuthCallbackMessage) => {\n if (settled) return;\n if (message?.connectionId && message.connectionId !== connectionId) return;\n\n settled = true;\n cleanup();\n\n if (!popup.closed) {\n popup.close();\n }\n\n try {\n if (message && !message.success) {\n onError(message.error || 'OAuth authorization failed');\n return;\n }\n\n const connection = await fetchConnectionStatus();\n if (!connection) {\n onError('Connection not found. It may have been deleted.');\n return;\n }\n\n if (connection.status === 'ACTIVE') {\n onSuccess();\n return;\n }\n\n onError(connection.errorMessage || 'OAuth authorization failed');\n } finally {\n onSettled();\n }\n };\n\n function handleWindowMessage(event: MessageEvent<unknown>) {\n if (isOAuthCallbackMessage(event.data)) {\n void finish(event.data);\n }\n }\n\n function handleStorageMessage(event: StorageEvent) {\n if (event.key !== 'oauth_callback_result') return;\n const message = parseStorageMessage(event.newValue);\n if (message) {\n void finish(message);\n }\n }\n\n window.addEventListener('message', handleWindowMessage);\n window.addEventListener('storage', handleStorageMessage);\n\n if ('BroadcastChannel' in window) {\n channel = new BroadcastChannel('oauth_callback');\n channel.onmessage = (event: MessageEvent<unknown>) => {\n if (isOAuthCallbackMessage(event.data)) {\n void finish(event.data);\n }\n };\n }\n\n timeoutId = setTimeout(() => {\n if (settled) return;\n settled = true;\n cleanup();\n if (!popup.closed) {\n popup.close();\n }\n onError('OAuth authorization timed out');\n onSettled();\n }, timeoutMs);\n\n return () => {\n if (settled) return;\n settled = true;\n cleanup();\n };\n}\n"],"mappings":";AAuBA,SAAS,EAAS,GAAkD;AAClE,QAAO,OAAO,KAAU,cAAY;;AAGtC,SAAS,EAAuB,GAA+C;AAC7E,QACE,EAAS,EAAM,IACf,EAAM,SAAS,oBACf,OAAO,EAAM,WAAY,cACxB,EAAM,iBAAiB,KAAA,KAAa,OAAO,EAAM,gBAAiB,cAClE,EAAM,UAAU,KAAA,KAAa,OAAO,EAAM,SAAU,cACpD,EAAM,cAAc,KAAA,KAAa,OAAO,EAAM,aAAc;;AAIjE,SAAS,EAAoB,GAAmD;AAC9E,KAAI,CAAC,EAAO,QAAO;AAEnB,KAAI;EACF,IAAM,IAAkB,KAAK,MAAM,EAAM;AACzC,SAAO,EAAuB,EAAO,GAAG,IAAS;SAC3C;AACN,SAAO;;;AAIX,SAAgB,EAA4B,EAC1C,iBACA,UACA,0BACA,cACA,YACA,cACA,eAAY,OACqC;CACjD,IAAI,IAAU,IACV,IAAmC,MACnC,IAAkD,MAEhD,UAAgB;AAQpB,EAPA,AAEE,OADA,aAAa,EAAU,EACX,OAEd,OAAO,oBAAoB,WAAW,EAAoB,EAC1D,OAAO,oBAAoB,WAAW,EAAqB,EAC3D,GAAS,OAAO,EAChB,IAAU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