@burdenoff/microfe-integrations 2026.807.2 → 2026.810.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-operations.d.ts +36 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +98 -81
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
- package/dist/integrations/components/AddConnectionDialog.js +231 -201
- package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
- package/dist/integrations/components/AuthMethodSelector.d.ts +17 -0
- package/dist/integrations/components/AuthMethodSelector.d.ts.map +1 -1
- package/dist/integrations/components/AuthMethodSelector.js +45 -36
- package/dist/integrations/components/AuthMethodSelector.js.map +1 -1
- package/dist/integrations/components/CredentialStorageSelector.d.ts.map +1 -1
- package/dist/integrations/components/CredentialStorageSelector.js +151 -59
- package/dist/integrations/components/CredentialStorageSelector.js.map +1 -1
- package/dist/integrations/components/SchemaForm.d.ts.map +1 -1
- package/dist/integrations/components/SchemaForm.js +100 -59
- package/dist/integrations/components/SchemaForm.js.map +1 -1
- package/dist/integrations/constants/permissions.d.ts +1 -0
- package/dist/integrations/constants/permissions.d.ts.map +1 -1
- package/dist/integrations/constants/permissions.js +2 -1
- package/dist/integrations/constants/permissions.js.map +1 -1
- package/dist/integrations/hooks/useCredentialVaults.d.ts +19 -0
- package/dist/integrations/hooks/useCredentialVaults.d.ts.map +1 -1
- package/dist/integrations/hooks/useCredentialVaults.js +43 -22
- package/dist/integrations/hooks/useCredentialVaults.js.map +1 -1
- package/dist/integrations/pages/ProviderDetail.d.ts.map +1 -1
- package/dist/integrations/pages/ProviderDetail.js +1 -1
- package/dist/integrations/pages/ProviderDetail.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
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 { FC } from 'react';\nimport { useState } from 'react';\nimport { Eye, EyeOff, Info } from 'lucide-react';\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 for (const [field, property] of Object.entries(schema.properties)) {\n if (property.default !== undefined) values[field] = property.default;\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\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 [revealed, setRevealed] = 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=\"\">Select {label.toLowerCase()}</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 return (\n <div>\n {labelNode}\n <textarea\n id={id}\n aria-label={label}\n value={String(value ?? '')}\n onChange={(event) => onChange(event.target.value)}\n placeholder={placeholder}\n disabled={disabled}\n rows={5}\n autoComplete=\"off\"\n spellCheck={false}\n className={`${inputClass} font-mono`}\n />\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={revealed ? `Hide ${label}` : `Show ${label}`}\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":";;;;AA2CA,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,eAAe,OAAa,OAC/E;EACL,YAAY,EAAU;EACtB,UAAU,MAAM,QAAQ,EAAU,SAAS,GACvC,EAAU,SAAS,QAAQ,MAAmB,OAAO,KAAM,SAAS,GACpE,EAAE;EACP;;AAQH,SAAS,EAAU,GAA0B,GAA0C;AAErF,QADK,EAAS,SACP,OAAO,QAAQ,EAAS,OAAO,CAAC,OAAO,CAAC,GAAO,OAAc;EAClE,IAAM,IAAS,EAAO;AACtB,SAAO,MAAM,QAAQ,EAAS,GAAG,EAAS,SAAS,EAAO,GAAG,MAAW;GACxE,GAJ2B;;AAW/B,SAAgB,EAAiB,GAAoB,GAA0C;AAC7F,QAAO,EAAO,SAAS,OAAO,MAAU;EACtC,IAAM,IAAW,EAAO,WAAW;AACnC,MAAI,KAAY,CAAC,EAAU,GAAU,EAAO,CAAE,QAAO;EACrD,IAAM,IAAQ,EAAO;AACrB,SAAO,OAAO,KAAU,WACpB,EAAM,MAAM,CAAC,SAAS,IACtB,KAAiC;GACrC;;AAGJ,SAAS,EACP,GACyC;AACzC,QAAO,EAAQ,KAAK,MAClB,OAAO,KAAW,WAAW;EAAE,OAAO;EAAQ,OAAO;EAAQ,GAAG,EACjE;;AAWH,SAAgB,EAAwB,GAAoD;AAC1F,KAAI,CAAC,EAAQ,QAAO,EAAE;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AO,KAAK,OAAO,EAAM;GACjE,WAAW,MACT,EAAS,EAAM,OAAO,UAAU,KAAK,KAAA,IAAY,OAAO,EAAM,OAAO,MAAM,CAAC;GAEjE;GACH;GACV,WAAW;GACX,CAAA;EACD;EACG,EAAA,CAAA,GAOQ,EAAS,WAAW,cAAc,EAAS,WAAW,SAGpE,kBAAC,OAAD,EAAA,UAAA;EACG;EACD,kBAAC,YAAD;GACM;GACJ,cAAY;GACZ,OAAO,OAAO,KAAS,GAAG;GAC1B,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;GACpC;GACH;GACV,MAAM;GACN,cAAa;GACb,YAAY;GACZ,WAAW,GAAG,EAAW;GACzB,CAAA;EACD;EACG,EAAA,CAAA,GAKR,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,cAAY,IAAW,QAAQ,MAAU,QAAQ;IACjD,WAAU;cAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;IAC7C,CAAA,CAEP;;EACL;EACG,EAAA,CAAA"}
|
|
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';\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 [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=\"\">Select {label.toLowerCase()}</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={`Show ${label}`}\n className=\"inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50\"\n >\n <Eye size={14} /> 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={revealed ? `Hide ${label}` : `Show ${label}`}\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={revealed ? `Hide ${label}` : `Show ${label}`}\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":";;;;AA2CA,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,eAAe,OAAa,OAC/E;EACL,YAAY,EAAU;EACtB,UAAU,MAAM,QAAQ,EAAU,SAAS,GACvC,EAAU,SAAS,QAAQ,MAAmB,OAAO,KAAM,SAAS,GACpE,EAAE;EACP;;AAQH,SAAS,EAAU,GAA0B,GAA0C;AAErF,QADK,EAAS,SACP,OAAO,QAAQ,EAA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e,GAAa,MAAa,CAAC,EAAS;IACnD,cAAY,IAAW,QAAQ,MAAU,QAAQ;IACjD,WAAU;cAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;IAC7C,CAAA,CAEP;;EACL;EACG,EAAA,CAAA"}
|
|
@@ -17,6 +17,7 @@ export declare const INTEGRATION_PERMISSIONS: {
|
|
|
17
17
|
readonly PROVIDER_UPDATE: "integration-provider:update";
|
|
18
18
|
readonly PROVIDER_DELETE: "integration-provider:delete";
|
|
19
19
|
readonly LOG_READ: "integration-log:read";
|
|
20
|
+
readonly VAULT_CREATE: "vault:create";
|
|
20
21
|
};
|
|
21
22
|
export type IntegrationPermission = (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];
|
|
22
23
|
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/integrations/constants/permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;CA4B1B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -12,7 +12,8 @@ var e = {
|
|
|
12
12
|
PROVIDER_CREATE: "integration-provider:create",
|
|
13
13
|
PROVIDER_UPDATE: "integration-provider:update",
|
|
14
14
|
PROVIDER_DELETE: "integration-provider:delete",
|
|
15
|
-
LOG_READ: "integration-log:read"
|
|
15
|
+
LOG_READ: "integration-log:read",
|
|
16
|
+
VAULT_CREATE: "vault:create"
|
|
16
17
|
};
|
|
17
18
|
//#endregion
|
|
18
19
|
export { e as INTEGRATION_PERMISSIONS };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CAGnB,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAGjB,UAAU;
|
|
1
|
+
{"version":3,"file":"permissions.js","names":[],"sources":["../../../src/integrations/constants/permissions.ts"],"sourcesContent":["/**\n * Integrations Permission Constants\n *\n * Usage: hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE)\n */\n\nexport const INTEGRATION_PERMISSIONS = {\n // integration (module-level)\n // Note: the backend RBAC seed defines `integration:write` (not `update`) for\n // module-level config changes. Sub-resources use standard CRUD `update`.\n INTEGRATION_READ: 'integration:read',\n INTEGRATION_CREATE: 'integration:create',\n INTEGRATION_WRITE: 'integration:write',\n INTEGRATION_DELETE: 'integration:delete',\n\n // integration-connection\n CONNECTION_READ: 'integration-connection:read',\n CONNECTION_CREATE: 'integration-connection:create',\n CONNECTION_UPDATE: 'integration-connection:update',\n CONNECTION_DELETE: 'integration-connection:delete',\n\n // integration-provider\n PROVIDER_READ: 'integration-provider:read',\n PROVIDER_CREATE: 'integration-provider:create',\n PROVIDER_UPDATE: 'integration-provider:update',\n PROVIDER_DELETE: 'integration-provider:delete',\n\n // integration-log\n LOG_READ: 'integration-log:read',\n\n // vault — owned by the security module, not this one, but a connection\n // cannot be stored without one, so the connection dialog offers to create a\n // vault inline and must know whether this user is allowed to.\n VAULT_CREATE: 'vault:create',\n} as const;\n\nexport type IntegrationPermission =\n (typeof INTEGRATION_PERMISSIONS)[keyof typeof INTEGRATION_PERMISSIONS];\n"],"mappings":";AAMA,IAAa,IAA0B;CAIrC,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CAGpB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,mBAAmB;CAGnB,eAAe;CACf,iBAAiB;CACjB,iBAAiB;CACjB,iBAAiB;CAGjB,UAAU;CAKV,cAAc;CACf"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VaultSummary } from '../types';
|
|
2
|
+
|
|
1
3
|
export declare function useCredentialVaults(): {
|
|
2
4
|
vaults: any;
|
|
3
5
|
total: number;
|
|
@@ -8,6 +10,23 @@ export declare function useCredentialVaults(): {
|
|
|
8
10
|
error?: import('@apollo/client').ErrorLike;
|
|
9
11
|
}>;
|
|
10
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
|
+
};
|
|
11
30
|
export declare function useVaultSecrets(vaultId: string | null, authType?: string | null): {
|
|
12
31
|
secrets: any;
|
|
13
32
|
total: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCredentialVaults.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"names":[],"mappings":"
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { useIntegrations as e } from "../providers/IntegrationsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
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
4
|
//#region src/integrations/hooks/useCredentialVaults.ts
|
|
5
|
-
function
|
|
5
|
+
function s(e) {
|
|
6
6
|
return {
|
|
7
7
|
id: String(e.id ?? ""),
|
|
8
8
|
name: String(e.name ?? ""),
|
|
@@ -11,7 +11,7 @@ function i(e) {
|
|
|
11
11
|
secretCount: Number(e.secretCount ?? 0)
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function c(e) {
|
|
15
15
|
return {
|
|
16
16
|
id: String(e.id ?? ""),
|
|
17
17
|
vaultId: String(e.vaultId ?? ""),
|
|
@@ -22,8 +22,8 @@ function a(e) {
|
|
|
22
22
|
status: String(e.status ?? "")
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let { workspaceId: t } = e(), { data:
|
|
25
|
+
function l() {
|
|
26
|
+
let { workspaceId: t } = e(), { data: n, loading: i, error: o, refetch: c } = r({
|
|
27
27
|
variables: {
|
|
28
28
|
filter: { status: "ACTIVE" },
|
|
29
29
|
pagination: { limit: 100 }
|
|
@@ -33,45 +33,66 @@ function o() {
|
|
|
33
33
|
errorPolicy: "all"
|
|
34
34
|
});
|
|
35
35
|
return {
|
|
36
|
-
vaults:
|
|
37
|
-
total: Number(
|
|
38
|
-
loading:
|
|
39
|
-
error:
|
|
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
40
|
refetch: c
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let {
|
|
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({
|
|
45
66
|
variables: {
|
|
46
|
-
vaultId:
|
|
67
|
+
vaultId: t ?? "",
|
|
47
68
|
filter: { status: "ACTIVE" },
|
|
48
69
|
pagination: { limit: 100 }
|
|
49
70
|
},
|
|
50
|
-
skip: !
|
|
71
|
+
skip: !i || !t,
|
|
51
72
|
fetchPolicy: "network-only",
|
|
52
73
|
errorPolicy: "all"
|
|
53
74
|
});
|
|
54
75
|
return {
|
|
55
|
-
secrets:
|
|
56
|
-
let e = (
|
|
57
|
-
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) => [
|
|
58
79
|
"TOKEN",
|
|
59
80
|
"CREDENTIAL",
|
|
60
81
|
"STRUCTURED_DATA"
|
|
61
|
-
].includes(e.type)) :
|
|
82
|
+
].includes(e.type)) : r === "api_key" || r === "bearer_token" ? e.filter((e) => [
|
|
62
83
|
"API_KEY",
|
|
63
84
|
"TOKEN",
|
|
64
85
|
"TEXT",
|
|
65
86
|
"STRUCTURED_DATA"
|
|
66
87
|
].includes(e.type)) : e : e;
|
|
67
|
-
}, [
|
|
68
|
-
total: Number(
|
|
69
|
-
loading:
|
|
88
|
+
}, [r, o]),
|
|
89
|
+
total: Number(o?.getSecrets?.total ?? 0),
|
|
90
|
+
loading: s,
|
|
70
91
|
error: l,
|
|
71
92
|
refetch: u
|
|
72
93
|
};
|
|
73
94
|
}
|
|
74
95
|
//#endregion
|
|
75
|
-
export {
|
|
96
|
+
export { u as useCreateCredentialVault, l as useCredentialVaults, d as useVaultSecrets };
|
|
76
97
|
|
|
77
98
|
//# sourceMappingURL=useCredentialVaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCredentialVaults.js","names":[],"sources":["../../../src/integrations/hooks/useCredentialVaults.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\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\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":";;;;
|
|
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;EACxB,MAAM,OAAO,EAAI,QAAQ,GAAG;EAC5B,aAAa,EAAI,cAAc,OAAO,EAAI,YAAY,GAAG;EACzD,QAAQ,OAAO,EAAI,UAAU,UAAU;EACvC,aAAa,OAAO,EAAI,eAAe,EAAE;EAC1C;;AAGH,SAAS,EAAU,GAAkD;AACnE,QAAO;EACL,IAAI,OAAO,EAAI,MAAM,GAAG;EACxB,SAAS,OAAO,EAAI,WAAW,GAAG;EAClC,MAAM,OAAO,EAAI,QAAQ,GAAG;EAC5B,KAAK,OAAO,EAAI,OAAO,GAAG;EAC1B,aAAa,EAAI,cAAc,OAAO,EAAI,YAAY,GAAG;EACzD,MAAM,OAAO,EAAI,QAAQ,GAAG;EAC5B,QAAQ,OAAO,EAAI,UAAU,GAAG;EACjC;;AAGH,SAAgB,IAAsB;CACpC,IAAM,EAAE,mBAAgB,GAAiB,EACnC,EAAE,SAAM,YAAS,UAAO,eAAY,EA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AS,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"ProviderDetail.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,cAAc,gCA+c7B"}
|
|
@@ -18,7 +18,7 @@ import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
|
18
18
|
import { Button as x, CTAOverflowMenu as S, EmphasisPanel as C, GlassCard as w, IllustratedEmptyState as T, NextSteps as E, PagePurpose as D, ShowMore as O } from "@burdenoff/fe-libs/ui";
|
|
19
19
|
//#region src/integrations/pages/ProviderDetail.tsx
|
|
20
20
|
function k() {
|
|
21
|
-
let { providerId: k } = pe(), { adminMode: A = !1, basePath: j = "/", navigate: M, onConnectionSelect: N } = e(), { addConnectionDialogOpen: P, addConnectionProviderId: F, openAddConnectionDialog: I, closeAddConnectionDialog: L } = te(), { provider: R, loading: z, error: B, refetch: V } = o(k ?? ""), { connections: H, loading: U } = c(k ?? ""), { enableProvider: he, loading: ge } = a(), { disableProvider: _e, loading: ve } = i(), { uninstallPlugin: ye, loading: W } = s(), { hasPermission: G, isLoading: K } = me(), [be, q] = ae(!1), J = !K && G(t.CONNECTION_CREATE), xe = A && !K && G(t.PROVIDER_CREATE), Y = A && !K && G(t.PROVIDER_UPDATE), Se = A && !K && G(t.PROVIDER_DELETE), Ce = z, X = ge || ve || W;
|
|
21
|
+
let { providerId: k } = pe(), { adminMode: A = !1, basePath: j = "/", navigate: M, onConnectionSelect: N } = e(), { addConnectionDialogOpen: P, addConnectionProviderId: F, openAddConnectionDialog: I, closeAddConnectionDialog: L } = te(), { provider: R, loading: z, error: B, refetch: V } = o(k ?? ""), { connections: H, loading: U } = c(k ?? ""), { enableProvider: he, loading: ge } = a(), { disableProvider: _e, loading: ve } = i(), { uninstallPlugin: ye, loading: W } = s(), { hasPermission: G, isLoading: K } = me(), [be, q] = ae(!1), J = !K && G(t.CONNECTION_CREATE), xe = A && !K && G(t.PROVIDER_CREATE), Y = A && !K && G(t.PROVIDER_UPDATE), Se = A && !K && G(t.PROVIDER_DELETE), Ce = z && !R, X = ge || ve || W;
|
|
22
22
|
if (Ce) return /* @__PURE__ */ b("div", {
|
|
23
23
|
className: "flex flex-col items-center justify-center py-20",
|
|
24
24
|
children: [/* @__PURE__ */ b("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetail.js","names":[],"sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n ExternalLink,\n BookOpen,\n Plus,\n Link2,\n Loader2,\n AlertCircle,\n RefreshCw,\n Shield,\n Package,\n Star,\n Download,\n Trash2,\n Pencil,\n Power,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsStore } from '../store/integrationsStore';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport {\n useDisableProvider,\n useEnableProvider,\n useProvider,\n useUninstallPlugin,\n} from '../hooks/useProviders';\nimport { useConnectionsByProvider } from '../hooks/useConnections';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport { ConnectionCard } from '../components/ConnectionCard';\nimport { AddConnectionDialog } from '../components/AddConnectionDialog';\nimport { ConfirmDialog } from '../components/ConfirmDialog';\nimport {\n Button,\n GlassCard,\n EmphasisPanel,\n ShowMore,\n CTAOverflowMenu,\n IllustratedEmptyState,\n PagePurpose,\n NextSteps,\n type NextStep,\n type CTAAction,\n} from '@burdenoff/fe-libs/ui';\nimport type { IntegrationConnection } from '../types';\n\n/**\n * Provider Detail — Single provider view with info, connections, and actions.\n */\nexport function ProviderDetail() {\n const { providerId } = useParams<{ providerId: string }>();\n const { adminMode = false, basePath = '/', navigate, onConnectionSelect } = useIntegrations();\n const {\n addConnectionDialogOpen,\n addConnectionProviderId,\n openAddConnectionDialog,\n closeAddConnectionDialog,\n } = useIntegrationsStore();\n\n const {\n provider,\n loading: providerLoading,\n error: providerError,\n refetch,\n } = useProvider(providerId ?? '');\n const { connections, loading: connectionsLoading } = useConnectionsByProvider(providerId ?? '');\n const { enableProvider, loading: enabling } = useEnableProvider();\n const { disableProvider, loading: disabling } = useDisableProvider();\n const { uninstallPlugin, loading: uninstalling } = useUninstallPlugin();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const [uninstallDialogOpen, setUninstallDialogOpen] = useState(false);\n const canCreateConnection =\n !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const canCreateProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_CREATE);\n const canUpdateProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_UPDATE);\n const canDeleteProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_DELETE);\n\n const loading = providerLoading;\n const providerActionLoading = enabling || disabling || uninstalling;\n\n if (loading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl motion-safe:animate-vc-glow-pulse\" />\n <Loader2 size={48} className=\"relative animate-spin text-primary\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">\n Loading provider details…\n </span>\n </div>\n );\n }\n\n if (providerError || !provider) {\n return (\n <div className=\"p-6 max-w-4xl mx-auto\">\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Provider not found</h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {providerError?.message || 'The requested provider could not be loaded.'}\n </p>\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} />\n Try Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={14} />\n Back to Catalog\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n const handleCreateConnection = () => {\n openAddConnectionDialog(provider.id);\n };\n\n const handleConnectionClick = (connection: IntegrationConnection) => {\n onConnectionSelect?.(connection);\n navigate?.(joinPath(basePath, `connections/${connection.id}`));\n };\n\n const handleToggleEnabled = async () => {\n if (!provider) return;\n if (provider.isEnabled) {\n await disableProvider(provider.id);\n } else {\n await enableProvider(provider.id);\n }\n await refetch();\n };\n\n const handleUninstall = async () => {\n if (!provider) return;\n setUninstallDialogOpen(true);\n };\n\n const confirmUninstall = async () => {\n if (!provider) return;\n await uninstallPlugin(provider.id);\n setUninstallDialogOpen(false);\n navigate?.(joinPath(basePath, 'providers'));\n };\n\n const handleEditProvider = () => {\n navigate?.(joinPath(basePath, `providers/${provider.id}/edit`));\n };\n\n const canConnectNow =\n canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled;\n const hasConnections = (connections ?? []).length > 0;\n\n const nextSteps: NextStep[] = [\n ...(canConnectNow\n ? [\n {\n id: 'connect',\n label: `Connect ${provider.name}`,\n description: `Authenticate once to create a reusable connection to ${provider.name}.`,\n icon: <Plus size={16} />,\n onClick: handleCreateConnection,\n done: hasConnections,\n } satisfies NextStep,\n ]\n : []),\n ...(provider.docsUrl\n ? [\n {\n id: 'docs',\n label: 'Read the provider documentation',\n description: `Learn how ${provider.name} works and what credentials you will need.`,\n icon: <BookOpen size={16} />,\n href: provider.docsUrl,\n } satisfies NextStep,\n ]\n : []),\n {\n id: 'browse',\n label: 'Browse other providers',\n description: 'Return to the catalog to discover more services you can integrate.',\n icon: <Package size={16} />,\n onClick: () => navigate?.(joinPath(basePath, 'providers')),\n },\n ];\n\n return (\n <div className=\"space-y-6 p-6 max-w-5xl mx-auto\">\n {/* Header */}\n <div className=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n aria-label=\"Back to catalog\"\n >\n <ArrowLeft size={20} />\n </Button>\n <ProviderIcon provider={provider} size={56} />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl sm:text-3xl font-bold text-text-primary\">{provider.name}</h1>\n {provider.isBuiltIn && (\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-status-info-bg-subtle text-status-info-text border border-border-default\">\n Built-in\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary mt-1\">{provider.description}</p>\n </div>\n {canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <Button onClick={handleCreateConnection}>\n <Plus size={16} />\n Create Connection\n </Button>\n )}\n </div>\n </div>\n\n {/* Page purpose */}\n <PagePurpose icon={<Package size={16} />}>\n This is the {provider.name} provider — the platform's blueprint for talking to{' '}\n {provider.name}. Here you can see how it authenticates, which features and scopes it\n supports, and the connections your workspace has created with it. Create a connection to\n start using {provider.name} in your apps.\n </PagePurpose>\n\n {/* Next steps — guidance for getting value from this provider */}\n {(canConnectNow || provider.docsUrl) && (\n <NextSteps storageKey=\"integrations-provider-detail\" steps={nextSteps} />\n )}\n\n {/* Info Cards */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Provider Details */}\n <GlassCard className=\"border-border-seam p-5 space-y-4\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2\">\n <Package size={18} className=\"text-primary\" />\n Provider Details\n </h2>\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Category</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {getCategoryLabel(provider.category)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Auth Type</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Plugin Version</span>\n <span className=\"text-sm font-mono text-text-primary\">{provider.pluginVersion}</span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Author</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {provider.pluginAuthor || '-'}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Connections</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {provider.connectionCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-text-secondary\">Status</span>\n <span\n className={cn(\n 'text-sm font-medium px-2 py-0.5 rounded-full',\n provider.isEnabled\n ? 'text-status-success-text bg-status-success-bg-subtle'\n : 'text-text-secondary bg-bg-sunken'\n )}\n >\n {provider.isEnabled ? 'Enabled' : 'Disabled'}\n </span>\n </div>\n </div>\n </GlassCard>\n\n {/* Features & Links */}\n <div className=\"space-y-4\">\n {/* Supported Features */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Star size={18} className=\"text-primary\" />\n Supported Features\n </h2>\n {provider.supportedFeatures.length > 0 ? (\n <ShowMore collapsedHeight={88} label=\"Show all features\">\n <div className=\"flex flex-wrap gap-2\">\n {provider.supportedFeatures.map((feature) => (\n <span\n key={feature}\n className=\"text-xs px-2.5 py-1 rounded-full bg-bg-sunken text-text-secondary\"\n >\n {feature}\n </span>\n ))}\n </div>\n </ShowMore>\n ) : (\n <p className=\"text-sm text-text-secondary\">No specific features listed.</p>\n )}\n </GlassCard>\n\n {/* Links */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <ExternalLink size={18} className=\"text-primary\" />\n Links\n </h2>\n <div className=\"space-y-2\">\n {provider.website && (\n <a\n href={provider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-2 text-sm text-primary hover:underline\"\n >\n <ExternalLink size={14} />\n Website\n </a>\n )}\n {provider.docsUrl && (\n <a\n href={provider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-2 text-sm text-primary hover:underline\"\n >\n <BookOpen size={14} />\n Documentation\n </a>\n )}\n </div>\n </GlassCard>\n\n {/* Plugin Actions */}\n {adminMode && (\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Shield size={18} className=\"text-primary\" />\n Plugin Management\n </h2>\n <CTAOverflowMenu\n align=\"start\"\n primary={\n canUpdateProvider\n ? {\n label: 'Edit',\n onSelect: handleEditProvider,\n icon: <Pencil size={14} />,\n }\n : undefined\n }\n actions={[\n ...(canUpdateProvider && provider.pluginStatus === 'installed'\n ? [\n {\n label: provider.isEnabled ? 'Disable' : 'Enable',\n onSelect: () => {\n void handleToggleEnabled();\n },\n disabled: providerActionLoading,\n icon: <Power size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canCreateProvider && provider.pluginStatus === 'available'\n ? [\n {\n label: 'Install Plugin',\n onSelect: () => {},\n icon: <Download size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canUpdateProvider && provider.pluginStatus === 'update_available'\n ? [\n {\n label: 'Update Available',\n onSelect: () => {},\n icon: <Download size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canDeleteProvider && provider.pluginStatus === 'installed'\n ? [\n {\n label: 'Uninstall',\n onSelect: () => {\n void handleUninstall();\n },\n intent: 'destructive',\n disabled: providerActionLoading || provider.isBuiltIn,\n icon: <Trash2 size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ]}\n />\n </GlassCard>\n )}\n </div>\n </div>\n\n {/* Connections for this provider */}\n <EmphasisPanel className=\"overflow-hidden p-0\">\n <div className=\"flex items-center justify-between p-5 border-b border-border-seam\">\n <div className=\"flex items-center gap-2\">\n <Link2 size={18} className=\"text-primary\" />\n <h2 className=\"font-semibold text-text-primary\">\n Connections ({(connections ?? []).length})\n </h2>\n </div>\n {canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <Button size=\"sm\" onClick={handleCreateConnection}>\n <Plus size={14} />\n Add\n </Button>\n )}\n </div>\n\n {connectionsLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {!connectionsLoading && (connections ?? []).length === 0 && (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No connections yet\"\n description={`Create a connection to start using ${provider.name} in your workspace.`}\n action={\n canConnectNow ? (\n <Button onClick={handleCreateConnection}>\n <Plus size={16} />\n Create Connection\n </Button>\n ) : undefined\n }\n />\n )}\n\n {!connectionsLoading && (connections ?? []).length > 0 && (\n <div className=\"p-4 space-y-3\">\n {(connections ?? []).map((conn: IntegrationConnection) => (\n <ConnectionCard\n key={conn.id}\n connection={conn}\n displayMode=\"list\"\n onClick={handleConnectionClick}\n />\n ))}\n </div>\n )}\n </EmphasisPanel>\n\n {/* Add Connection Dialog */}\n <AddConnectionDialog\n open={addConnectionDialogOpen}\n onClose={closeAddConnectionDialog}\n preselectedProviderId={addConnectionProviderId}\n onConnectionCreated={() => {\n refetch();\n }}\n />\n <ConfirmDialog\n open={uninstallDialogOpen}\n title={`Uninstall ${provider.name}`}\n description=\"Existing active connections must be removed first. This action is only available in admin mode.\"\n confirmLabel=\"Uninstall\"\n cancelLabel=\"Cancel\"\n destructive\n loading={uninstalling}\n icon={<Trash2 size={20} />}\n onConfirm={confirmUninstall}\n onCancel={() => setUninstallDialogOpen(false)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,IAAiB;CAC/B,IAAM,EAAE,kBAAe,IAAmC,EACpD,EAAE,eAAY,IAAO,cAAW,KAAK,aAAU,0BAAuB,GAAiB,EACvF,EACJ,4BACA,4BACA,4BACA,gCACE,IAAsB,EAEpB,EACJ,aACA,SAAS,GACT,OAAO,GACP,eACE,EAAY,KAAc,GAAG,EAC3B,EAAE,gBAAa,SAAS,MAAuB,EAAyB,KAAc,GAAG,EACzF,EAAE,oBAAgB,SAAS,OAAa,GAAmB,EAC3D,EAAE,qBAAiB,SAAS,OAAc,GAAoB,EAC9D,EAAE,qBAAiB,SAAS,MAAiB,GAAoB,EACjE,EAAE,kBAAe,WAAW,MAAuB,IAAgB,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;IACvB,2BAA2B;AACzB,QAAS;;IAEX,CAAA;GACF,kBAAC,IAAD;IACE,MAAM;IACN,OAAO,aAAa,EAAS;IAC7B,aAAY;IACZ,cAAa;IACb,aAAY;IACZ,aAAA;IACA,SAAS;IACT,MAAM,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;IAC1B,WAAW;IACX,gBAAgB,EAAuB,GAAM;IAC7C,CAAA;GACE"}
|
|
1
|
+
{"version":3,"file":"ProviderDetail.js","names":[],"sources":["../../../src/integrations/pages/ProviderDetail.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ArrowLeft,\n ExternalLink,\n BookOpen,\n Plus,\n Link2,\n Loader2,\n AlertCircle,\n RefreshCw,\n Shield,\n Package,\n Star,\n Download,\n Trash2,\n Pencil,\n Power,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useIntegrationsStore } from '../store/integrationsStore';\nimport { joinPath } from '../utils/navigation';\nimport { getAuthTypeLabel, getCategoryLabel } from '../utils/integrationsHelpers';\nimport {\n useDisableProvider,\n useEnableProvider,\n useProvider,\n useUninstallPlugin,\n} from '../hooks/useProviders';\nimport { useConnectionsByProvider } from '../hooks/useConnections';\nimport { ProviderIcon } from '../components/ProviderIcon';\nimport { ConnectionCard } from '../components/ConnectionCard';\nimport { AddConnectionDialog } from '../components/AddConnectionDialog';\nimport { ConfirmDialog } from '../components/ConfirmDialog';\nimport {\n Button,\n GlassCard,\n EmphasisPanel,\n ShowMore,\n CTAOverflowMenu,\n IllustratedEmptyState,\n PagePurpose,\n NextSteps,\n type NextStep,\n type CTAAction,\n} from '@burdenoff/fe-libs/ui';\nimport type { IntegrationConnection } from '../types';\n\n/**\n * Provider Detail — Single provider view with info, connections, and actions.\n */\nexport function ProviderDetail() {\n const { providerId } = useParams<{ providerId: string }>();\n const { adminMode = false, basePath = '/', navigate, onConnectionSelect } = useIntegrations();\n const {\n addConnectionDialogOpen,\n addConnectionProviderId,\n openAddConnectionDialog,\n closeAddConnectionDialog,\n } = useIntegrationsStore();\n\n const {\n provider,\n loading: providerLoading,\n error: providerError,\n refetch,\n } = useProvider(providerId ?? '');\n const { connections, loading: connectionsLoading } = useConnectionsByProvider(providerId ?? '');\n const { enableProvider, loading: enabling } = useEnableProvider();\n const { disableProvider, loading: disabling } = useDisableProvider();\n const { uninstallPlugin, loading: uninstalling } = useUninstallPlugin();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const [uninstallDialogOpen, setUninstallDialogOpen] = useState(false);\n const canCreateConnection =\n !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n const canCreateProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_CREATE);\n const canUpdateProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_UPDATE);\n const canDeleteProvider =\n adminMode && !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.PROVIDER_DELETE);\n\n // Only the FIRST load replaces the page. A refetch — which any mutation on\n // the page can trigger — must not, because this early return unmounts the\n // whole subtree, including the open connection dialog: everything typed into\n // it is lost, its in-flight requests abort, and queued state updates are\n // discarded. Creating a vault from inside the dialog hit exactly that, and\n // the newly created vault silently failed to be selected.\n const loading = providerLoading && !provider;\n const providerActionLoading = enabling || disabling || uninstalling;\n\n if (loading) {\n return (\n <div className=\"flex flex-col items-center justify-center py-20\">\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl motion-safe:animate-vc-glow-pulse\" />\n <Loader2 size={48} className=\"relative animate-spin text-primary\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">\n Loading provider details…\n </span>\n </div>\n );\n }\n\n if (providerError || !provider) {\n return (\n <div className=\"p-6 max-w-4xl mx-auto\">\n <div className=\"rounded-xl border border-border-default bg-status-error-bg-subtle p-6 flex items-start gap-4\">\n <AlertCircle size={24} className=\"text-status-error-text flex-shrink-0\" />\n <div className=\"flex-1\">\n <h3 className=\"font-semibold text-status-error-text mb-1\">Provider not found</h3>\n <p className=\"text-sm text-status-error-text mb-3\">\n {providerError?.message || 'The requested provider could not be loaded.'}\n </p>\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg bg-status-error-bg-subtle text-status-error-text hover:bg-status-error-bg-subtle/80 transition-colors\"\n >\n <RefreshCw size={14} />\n Try Again\n </button>\n <button\n type=\"button\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-lg border border-border-subtle hover:bg-accent transition-colors\"\n >\n <ArrowLeft size={14} />\n Back to Catalog\n </button>\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n const handleCreateConnection = () => {\n openAddConnectionDialog(provider.id);\n };\n\n const handleConnectionClick = (connection: IntegrationConnection) => {\n onConnectionSelect?.(connection);\n navigate?.(joinPath(basePath, `connections/${connection.id}`));\n };\n\n const handleToggleEnabled = async () => {\n if (!provider) return;\n if (provider.isEnabled) {\n await disableProvider(provider.id);\n } else {\n await enableProvider(provider.id);\n }\n await refetch();\n };\n\n const handleUninstall = async () => {\n if (!provider) return;\n setUninstallDialogOpen(true);\n };\n\n const confirmUninstall = async () => {\n if (!provider) return;\n await uninstallPlugin(provider.id);\n setUninstallDialogOpen(false);\n navigate?.(joinPath(basePath, 'providers'));\n };\n\n const handleEditProvider = () => {\n navigate?.(joinPath(basePath, `providers/${provider.id}/edit`));\n };\n\n const canConnectNow =\n canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled;\n const hasConnections = (connections ?? []).length > 0;\n\n const nextSteps: NextStep[] = [\n ...(canConnectNow\n ? [\n {\n id: 'connect',\n label: `Connect ${provider.name}`,\n description: `Authenticate once to create a reusable connection to ${provider.name}.`,\n icon: <Plus size={16} />,\n onClick: handleCreateConnection,\n done: hasConnections,\n } satisfies NextStep,\n ]\n : []),\n ...(provider.docsUrl\n ? [\n {\n id: 'docs',\n label: 'Read the provider documentation',\n description: `Learn how ${provider.name} works and what credentials you will need.`,\n icon: <BookOpen size={16} />,\n href: provider.docsUrl,\n } satisfies NextStep,\n ]\n : []),\n {\n id: 'browse',\n label: 'Browse other providers',\n description: 'Return to the catalog to discover more services you can integrate.',\n icon: <Package size={16} />,\n onClick: () => navigate?.(joinPath(basePath, 'providers')),\n },\n ];\n\n return (\n <div className=\"space-y-6 p-6 max-w-5xl mx-auto\">\n {/* Header */}\n <div className=\"rounded-xl border border-border-seam bg-accent-wash p-6\">\n <div className=\"flex items-center gap-4\">\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => navigate?.(joinPath(basePath, 'providers'))}\n aria-label=\"Back to catalog\"\n >\n <ArrowLeft size={20} />\n </Button>\n <ProviderIcon provider={provider} size={56} />\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-3\">\n <h1 className=\"text-2xl sm:text-3xl font-bold text-text-primary\">{provider.name}</h1>\n {provider.isBuiltIn && (\n <span className=\"text-xs px-2 py-0.5 rounded-full bg-status-info-bg-subtle text-status-info-text border border-border-default\">\n Built-in\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary mt-1\">{provider.description}</p>\n </div>\n {canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <Button onClick={handleCreateConnection}>\n <Plus size={16} />\n Create Connection\n </Button>\n )}\n </div>\n </div>\n\n {/* Page purpose */}\n <PagePurpose icon={<Package size={16} />}>\n This is the {provider.name} provider — the platform's blueprint for talking to{' '}\n {provider.name}. Here you can see how it authenticates, which features and scopes it\n supports, and the connections your workspace has created with it. Create a connection to\n start using {provider.name} in your apps.\n </PagePurpose>\n\n {/* Next steps — guidance for getting value from this provider */}\n {(canConnectNow || provider.docsUrl) && (\n <NextSteps storageKey=\"integrations-provider-detail\" steps={nextSteps} />\n )}\n\n {/* Info Cards */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {/* Provider Details */}\n <GlassCard className=\"border-border-seam p-5 space-y-4\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2\">\n <Package size={18} className=\"text-primary\" />\n Provider Details\n </h2>\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Category</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {getCategoryLabel(provider.category)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Auth Type</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {getAuthTypeLabel(provider.authType)}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Plugin Version</span>\n <span className=\"text-sm font-mono text-text-primary\">{provider.pluginVersion}</span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Author</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {provider.pluginAuthor || '-'}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2 border-b border-border-seam\">\n <span className=\"text-sm text-text-secondary\">Connections</span>\n <span className=\"text-sm font-medium text-text-primary\">\n {provider.connectionCount}\n </span>\n </div>\n <div className=\"flex items-center justify-between py-2\">\n <span className=\"text-sm text-text-secondary\">Status</span>\n <span\n className={cn(\n 'text-sm font-medium px-2 py-0.5 rounded-full',\n provider.isEnabled\n ? 'text-status-success-text bg-status-success-bg-subtle'\n : 'text-text-secondary bg-bg-sunken'\n )}\n >\n {provider.isEnabled ? 'Enabled' : 'Disabled'}\n </span>\n </div>\n </div>\n </GlassCard>\n\n {/* Features & Links */}\n <div className=\"space-y-4\">\n {/* Supported Features */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Star size={18} className=\"text-primary\" />\n Supported Features\n </h2>\n {provider.supportedFeatures.length > 0 ? (\n <ShowMore collapsedHeight={88} label=\"Show all features\">\n <div className=\"flex flex-wrap gap-2\">\n {provider.supportedFeatures.map((feature) => (\n <span\n key={feature}\n className=\"text-xs px-2.5 py-1 rounded-full bg-bg-sunken text-text-secondary\"\n >\n {feature}\n </span>\n ))}\n </div>\n </ShowMore>\n ) : (\n <p className=\"text-sm text-text-secondary\">No specific features listed.</p>\n )}\n </GlassCard>\n\n {/* Links */}\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <ExternalLink size={18} className=\"text-primary\" />\n Links\n </h2>\n <div className=\"space-y-2\">\n {provider.website && (\n <a\n href={provider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-2 text-sm text-primary hover:underline\"\n >\n <ExternalLink size={14} />\n Website\n </a>\n )}\n {provider.docsUrl && (\n <a\n href={provider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-2 text-sm text-primary hover:underline\"\n >\n <BookOpen size={14} />\n Documentation\n </a>\n )}\n </div>\n </GlassCard>\n\n {/* Plugin Actions */}\n {adminMode && (\n <GlassCard className=\"border-border-seam p-5\">\n <h2 className=\"font-semibold text-text-primary flex items-center gap-2 mb-3\">\n <Shield size={18} className=\"text-primary\" />\n Plugin Management\n </h2>\n <CTAOverflowMenu\n align=\"start\"\n primary={\n canUpdateProvider\n ? {\n label: 'Edit',\n onSelect: handleEditProvider,\n icon: <Pencil size={14} />,\n }\n : undefined\n }\n actions={[\n ...(canUpdateProvider && provider.pluginStatus === 'installed'\n ? [\n {\n label: provider.isEnabled ? 'Disable' : 'Enable',\n onSelect: () => {\n void handleToggleEnabled();\n },\n disabled: providerActionLoading,\n icon: <Power size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canCreateProvider && provider.pluginStatus === 'available'\n ? [\n {\n label: 'Install Plugin',\n onSelect: () => {},\n icon: <Download size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canUpdateProvider && provider.pluginStatus === 'update_available'\n ? [\n {\n label: 'Update Available',\n onSelect: () => {},\n icon: <Download size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ...(canDeleteProvider && provider.pluginStatus === 'installed'\n ? [\n {\n label: 'Uninstall',\n onSelect: () => {\n void handleUninstall();\n },\n intent: 'destructive',\n disabled: providerActionLoading || provider.isBuiltIn,\n icon: <Trash2 size={14} />,\n } satisfies CTAAction,\n ]\n : []),\n ]}\n />\n </GlassCard>\n )}\n </div>\n </div>\n\n {/* Connections for this provider */}\n <EmphasisPanel className=\"overflow-hidden p-0\">\n <div className=\"flex items-center justify-between p-5 border-b border-border-seam\">\n <div className=\"flex items-center gap-2\">\n <Link2 size={18} className=\"text-primary\" />\n <h2 className=\"font-semibold text-text-primary\">\n Connections ({(connections ?? []).length})\n </h2>\n </div>\n {canCreateConnection && provider.pluginStatus === 'installed' && provider.isEnabled && (\n <Button size=\"sm\" onClick={handleCreateConnection}>\n <Plus size={14} />\n Add\n </Button>\n )}\n </div>\n\n {connectionsLoading && (\n <div className=\"flex items-center justify-center py-12\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {!connectionsLoading && (connections ?? []).length === 0 && (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No connections yet\"\n description={`Create a connection to start using ${provider.name} in your workspace.`}\n action={\n canConnectNow ? (\n <Button onClick={handleCreateConnection}>\n <Plus size={16} />\n Create Connection\n </Button>\n ) : undefined\n }\n />\n )}\n\n {!connectionsLoading && (connections ?? []).length > 0 && (\n <div className=\"p-4 space-y-3\">\n {(connections ?? []).map((conn: IntegrationConnection) => (\n <ConnectionCard\n key={conn.id}\n connection={conn}\n displayMode=\"list\"\n onClick={handleConnectionClick}\n />\n ))}\n </div>\n )}\n </EmphasisPanel>\n\n {/* Add Connection Dialog */}\n <AddConnectionDialog\n open={addConnectionDialogOpen}\n onClose={closeAddConnectionDialog}\n preselectedProviderId={addConnectionProviderId}\n onConnectionCreated={() => {\n refetch();\n }}\n />\n <ConfirmDialog\n open={uninstallDialogOpen}\n title={`Uninstall ${provider.name}`}\n description=\"Existing active connections must be removed first. This action is only available in admin mode.\"\n confirmLabel=\"Uninstall\"\n cancelLabel=\"Cancel\"\n destructive\n loading={uninstalling}\n icon={<Trash2 size={20} />}\n onConfirm={confirmUninstall}\n onCancel={() => setUninstallDialogOpen(false)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,SAAgB,IAAiB;CAC/B,IAAM,EAAE,kBAAe,IAAmC,EACpD,EAAE,eAAY,IAAO,cAAW,KAAK,aAAU,0BAAuB,GAAiB,EACvF,EACJ,4BACA,4BACA,4BACA,gCACE,IAAsB,EAEpB,EACJ,aACA,SAAS,GACT,OAAO,GACP,eACE,EAAY,KAAc,GAAG,EAC3B,EAAE,gBAAa,SAAS,MAAuB,EAAyB,KAAc,GAAG,EACzF,EAAE,oBAAgB,SAAS,OAAa,GAAmB,EAC3D,EAAE,qBAAiB,SAAS,OAAc,GAAoB,EAC9D,EAAE,qBAAiB,SAAS,MAAiB,GAAoB,EACjE,EAAE,kBAAe,WAAW,MAAuB,IAAgB,EACnE,CAAC,IAAqB,KAA0B,GAAS,GAAM,EAC/D,IACJ,CAAC,KAAsB,EAAc,EAAwB,kBAAkB,EAC3E,KACJ,KAAa,CAAC,KAAsB,EAAc,EAAwB,gBAAgB,EACtF,IACJ,KAAa,CAAC,KAAsB,EAAc,EAAwB,gBAAgB,EACtF,KACJ,KAAa,CAAC,KAAsB,EAAc,EAAwB,gBAAgB,EAQtF,KAAU,KAAmB,CAAC,GAC9B,IAAwB,MAAY,MAAa;AAEvD,KAAI,GACF,QACE,kBAAC,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