@burdenoff/microfe-integrations 2026.828.1 → 2026.830.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 (75) hide show
  1. package/dist/integrations/components/AddConnectionDialog.d.ts.map +1 -1
  2. package/dist/integrations/components/AddConnectionDialog.js +151 -152
  3. package/dist/integrations/components/AddConnectionDialog.js.map +1 -1
  4. package/dist/integrations/components/AuthMethodSelector.d.ts.map +1 -1
  5. package/dist/integrations/components/AuthMethodSelector.js +48 -40
  6. package/dist/integrations/components/AuthMethodSelector.js.map +1 -1
  7. package/dist/integrations/components/AuthMethodsEditor.d.ts.map +1 -1
  8. package/dist/integrations/components/AuthMethodsEditor.js +207 -190
  9. package/dist/integrations/components/AuthMethodsEditor.js.map +1 -1
  10. package/dist/integrations/components/ConnectionCard.d.ts.map +1 -1
  11. package/dist/integrations/components/ConnectionCard.js +102 -98
  12. package/dist/integrations/components/ConnectionCard.js.map +1 -1
  13. package/dist/integrations/components/ConnectionStatusBadge.d.ts.map +1 -1
  14. package/dist/integrations/components/ConnectionStatusBadge.js +9 -5
  15. package/dist/integrations/components/ConnectionStatusBadge.js.map +1 -1
  16. package/dist/integrations/components/CredentialStorageSelector.d.ts.map +1 -1
  17. package/dist/integrations/components/CredentialStorageSelector.js +124 -121
  18. package/dist/integrations/components/CredentialStorageSelector.js.map +1 -1
  19. package/dist/integrations/components/ProviderCard.d.ts.map +1 -1
  20. package/dist/integrations/components/ProviderCard.js +25 -65
  21. package/dist/integrations/components/ProviderCard.js.map +1 -1
  22. package/dist/integrations/components/SchemaForm.d.ts.map +1 -1
  23. package/dist/integrations/components/SchemaForm.js +116 -111
  24. package/dist/integrations/components/SchemaForm.js.map +1 -1
  25. package/dist/integrations/hooks/useFormatDate.d.ts +7 -0
  26. package/dist/integrations/hooks/useFormatDate.d.ts.map +1 -0
  27. package/dist/integrations/hooks/useFormatDate.js +17 -0
  28. package/dist/integrations/hooks/useFormatDate.js.map +1 -0
  29. package/dist/integrations/hooks/useFormatLastUsed.d.ts +9 -0
  30. package/dist/integrations/hooks/useFormatLastUsed.d.ts.map +1 -0
  31. package/dist/integrations/hooks/useFormatLastUsed.js +15 -0
  32. package/dist/integrations/hooks/useFormatLastUsed.js.map +1 -0
  33. package/dist/integrations/hooks/useLabel.d.ts +13 -0
  34. package/dist/integrations/hooks/useLabel.d.ts.map +1 -0
  35. package/dist/integrations/hooks/useLabel.js +20 -0
  36. package/dist/integrations/hooks/useLabel.js.map +1 -0
  37. package/dist/integrations/hooks/useTr.d.ts +17 -0
  38. package/dist/integrations/hooks/useTr.d.ts.map +1 -0
  39. package/dist/integrations/hooks/useTr.js +14 -0
  40. package/dist/integrations/hooks/useTr.js.map +1 -0
  41. package/dist/integrations/pages/AddConnectionWizard.d.ts.map +1 -1
  42. package/dist/integrations/pages/AddConnectionWizard.js +396 -387
  43. package/dist/integrations/pages/AddConnectionWizard.js.map +1 -1
  44. package/dist/integrations/pages/ConnectionDetail.d.ts.map +1 -1
  45. package/dist/integrations/pages/ConnectionDetail.js +128 -128
  46. package/dist/integrations/pages/ConnectionDetail.js.map +1 -1
  47. package/dist/integrations/pages/ConnectionLogs.d.ts.map +1 -1
  48. package/dist/integrations/pages/ConnectionLogs.js +210 -181
  49. package/dist/integrations/pages/ConnectionLogs.js.map +1 -1
  50. package/dist/integrations/pages/ConnectionsList.d.ts.map +1 -1
  51. package/dist/integrations/pages/ConnectionsList.js +136 -115
  52. package/dist/integrations/pages/ConnectionsList.js.map +1 -1
  53. package/dist/integrations/pages/IntegrationsOverview.d.ts.map +1 -1
  54. package/dist/integrations/pages/IntegrationsOverview.js +76 -77
  55. package/dist/integrations/pages/IntegrationsOverview.js.map +1 -1
  56. package/dist/integrations/pages/IntegrationsSettings.d.ts.map +1 -1
  57. package/dist/integrations/pages/IntegrationsSettings.js +59 -61
  58. package/dist/integrations/pages/IntegrationsSettings.js.map +1 -1
  59. package/dist/integrations/pages/IntegrationsUserLandingPage.d.ts.map +1 -1
  60. package/dist/integrations/pages/IntegrationsUserLandingPage.js +29 -28
  61. package/dist/integrations/pages/IntegrationsUserLandingPage.js.map +1 -1
  62. package/dist/integrations/pages/ProviderCatalog.d.ts.map +1 -1
  63. package/dist/integrations/pages/ProviderCatalog.js +99 -141
  64. package/dist/integrations/pages/ProviderCatalog.js.map +1 -1
  65. package/dist/integrations/pages/ProviderDetail.d.ts.map +1 -1
  66. package/dist/integrations/pages/ProviderDetail.js +208 -220
  67. package/dist/integrations/pages/ProviderDetail.js.map +1 -1
  68. package/dist/integrations/pages/ProviderEditorPage.d.ts.map +1 -1
  69. package/dist/integrations/pages/ProviderEditorPage.js +262 -261
  70. package/dist/integrations/pages/ProviderEditorPage.js.map +1 -1
  71. package/dist/integrations/translations/en.d.ts +731 -0
  72. package/dist/integrations/translations/en.d.ts.map +1 -0
  73. package/dist/integrations/utils/integrationsHelpers.js +2 -16
  74. package/dist/integrations/utils/integrationsHelpers.js.map +1 -1
  75. 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 { 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,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,WAC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ACJ,cAAY;KACZ,OAAO,OAAO,KAAS,GAAG;KAC1B,WAAW,MAAU,EAAS,EAAM,OAAO,MAAM;KACjD,eAAe,EAAW,GAAK;KAC/B,cAAc,EAAW,GAAM;KAClB;KACH;KACV,MAAM;KACN,cAAa;KACb,YAAY;KAKZ,OAAO,IAAU,EAAE,oBAAoB,QAAQ,GAAqB,KAAA;KACpE,WAAW,GAAG,EAAW,aAAa,EAAS,SAAS,UAAU;KAClE,CAAA,EACD,EAAS,UACR,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,GAAa,MAAa,CAAC,EAAS;KACnD,cAAY,IAAW,QAAQ,MAAU,QAAQ;KACjD,WAAU;eAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;KAC7C,CAAA,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,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';\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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AAkC,kBAAkB,EAAE,UAAO,CAAC;KAEvE,WAAU;eAEE,EAAX,IAAY,IAAuB,GAAxB,EAAQ,MAAM,IAAM,CAAoB;KAC7C,CAAA,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"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Format a date string to a localized display format.
3
+ *
4
+ * Returns a translated dash ("-") when the input is null/empty.
5
+ */
6
+ export declare function useFormatDate(): (date: string | null) => string;
7
+ //# sourceMappingURL=useFormatDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormatDate.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useFormatDate.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAgB/D"}
@@ -0,0 +1,17 @@
1
+ import { useTr as e } from "./useTr.js";
2
+ import { useCallback as t } from "react";
3
+ //#region src/integrations/hooks/useFormatDate.ts
4
+ function n() {
5
+ let n = e();
6
+ return t((e) => e ? new Date(e).toLocaleString(void 0, {
7
+ year: "numeric",
8
+ month: "short",
9
+ day: "numeric",
10
+ hour: "2-digit",
11
+ minute: "2-digit"
12
+ }) : n("integrations.common.empty", "-"), [n]);
13
+ }
14
+ //#endregion
15
+ export { n as useFormatDate };
16
+
17
+ //# sourceMappingURL=useFormatDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormatDate.js","names":[],"sources":["../../../src/integrations/hooks/useFormatDate.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a date string to a localized display format.\n *\n * Returns a translated dash (\"-\") when the input is null/empty.\n */\nexport function useFormatDate(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.common.empty', '-');\n return new Date(date).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n },\n [tr]\n );\n}\n"],"mappings":";;;AAQA,SAAgB,IAAiD;CAC/D,IAAM,IAAK,GAAO;AAElB,QAAO,GACJ,MACM,IACE,IAAI,KAAK,EAAK,CAAC,eAAe,KAAA,GAAW;EAC9C,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN,QAAQ;EACT,CAAC,GAPgB,EAAG,6BAA6B,IAAI,EASxD,CAAC,EAAG,CACL"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Format a "last used" timestamp into a translated relative string.
3
+ *
4
+ * Returns translated equivalents of "Never", "Just now", "{{count}}m ago",
5
+ * "{{count}}h ago", "{{count}}d ago", "{{count}}w ago", or a localized date
6
+ * string for older timestamps.
7
+ */
8
+ export declare function useFormatLastUsed(): (date: string | null) => string;
9
+ //# sourceMappingURL=useFormatLastUsed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormatLastUsed.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useFormatLastUsed.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAmCnE"}
@@ -0,0 +1,15 @@
1
+ import { useTr as e } from "./useTr.js";
2
+ import { useCallback as t } from "react";
3
+ //#region src/integrations/hooks/useFormatLastUsed.ts
4
+ function n() {
5
+ let n = e();
6
+ return t((e) => {
7
+ if (!e) return n("integrations.time.never", "Never");
8
+ let t = /* @__PURE__ */ new Date(), r = new Date(e), i = t.getTime() - r.getTime(), a = Math.floor(i / 6e4), o = Math.floor(i / 36e5), s = Math.floor(i / 864e5);
9
+ return a < 1 ? n("integrations.time.justNow", "Just now") : a < 60 ? n("integrations.time.minutesAgo", "{{count}}m ago", { count: a }) : o < 24 ? n("integrations.time.hoursAgo", "{{count}}h ago", { count: o }) : s < 7 ? n("integrations.time.daysAgo", "{{count}}d ago", { count: s }) : s < 30 ? n("integrations.time.weeksAgo", "{{count}}w ago", { count: Math.floor(s / 7) }) : r.toLocaleDateString();
10
+ }, [n]);
11
+ }
12
+ //#endregion
13
+ export { n as useFormatLastUsed };
14
+
15
+ //# sourceMappingURL=useFormatLastUsed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormatLastUsed.js","names":[],"sources":["../../../src/integrations/hooks/useFormatLastUsed.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\n\n/**\n * Format a \"last used\" timestamp into a translated relative string.\n *\n * Returns translated equivalents of \"Never\", \"Just now\", \"{{count}}m ago\",\n * \"{{count}}h ago\", \"{{count}}d ago\", \"{{count}}w ago\", or a localized date\n * string for older timestamps.\n */\nexport function useFormatLastUsed(): (date: string | null) => string {\n const tr = useTr();\n\n return useCallback(\n (date: string | null): string => {\n if (!date) return tr('integrations.time.never', 'Never');\n\n const now = new Date();\n const then = new Date(date);\n const diffMs = now.getTime() - then.getTime();\n const diffMinutes = Math.floor(diffMs / 60_000);\n const diffHours = Math.floor(diffMs / 3_600_000);\n const diffDays = Math.floor(diffMs / 86_400_000);\n\n if (diffMinutes < 1) {\n return tr('integrations.time.justNow', 'Just now');\n }\n if (diffMinutes < 60) {\n return tr('integrations.time.minutesAgo', '{{count}}m ago', { count: diffMinutes });\n }\n if (diffHours < 24) {\n return tr('integrations.time.hoursAgo', '{{count}}h ago', { count: diffHours });\n }\n if (diffDays < 7) {\n return tr('integrations.time.daysAgo', '{{count}}d ago', { count: diffDays });\n }\n if (diffDays < 30) {\n return tr('integrations.time.weeksAgo', '{{count}}w ago', {\n count: Math.floor(diffDays / 7),\n });\n }\n return then.toLocaleDateString();\n },\n [tr]\n );\n}\n"],"mappings":";;;AAUA,SAAgB,IAAqD;CACnE,IAAM,IAAK,GAAO;AAElB,QAAO,GACJ,MAAgC;AAC/B,MAAI,CAAC,EAAM,QAAO,EAAG,2BAA2B,QAAQ;EAExD,IAAM,oBAAM,IAAI,MAAM,EAChB,IAAO,IAAI,KAAK,EAAK,EACrB,IAAS,EAAI,SAAS,GAAG,EAAK,SAAS,EACvC,IAAc,KAAK,MAAM,IAAS,IAAO,EACzC,IAAY,KAAK,MAAM,IAAS,KAAU,EAC1C,IAAW,KAAK,MAAM,IAAS,MAAW;AAmBhD,SAjBI,IAAc,IACT,EAAG,6BAA6B,WAAW,GAEhD,IAAc,KACT,EAAG,gCAAgC,kBAAkB,EAAE,OAAO,GAAa,CAAC,GAEjF,IAAY,KACP,EAAG,8BAA8B,kBAAkB,EAAE,OAAO,GAAW,CAAC,GAE7E,IAAW,IACN,EAAG,6BAA6B,kBAAkB,EAAE,OAAO,GAAU,CAAC,GAE3E,IAAW,KACN,EAAG,8BAA8B,kBAAkB,EACxD,OAAO,KAAK,MAAM,IAAW,EAAE,EAChC,CAAC,GAEG,EAAK,oBAAoB;IAElC,CAAC,EAAG,CACL"}
@@ -0,0 +1,13 @@
1
+ import { ConnectionStatus, ProviderCategory, AuthType } from '../types';
2
+
3
+ /**
4
+ * Translated label hooks for shared enums.
5
+ *
6
+ * These wrap the existing English helper functions so call sites can keep using
7
+ * the helpers as fallbacks while the translation layer provides localized
8
+ * strings when available.
9
+ */
10
+ export declare function useStatusLabel(): (status: ConnectionStatus) => string;
11
+ export declare function useCategoryLabel(): (category: ProviderCategory) => string;
12
+ export declare function useAuthTypeLabel(): (authType: AuthType) => string;
13
+ //# sourceMappingURL=useLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLabel.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useLabel.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7E;;;;;;GAMG;AAEH,wBAAgB,cAAc,IAAI,CAAC,MAAM,EAAE,gBAAgB,KAAK,MAAM,CAMrE;AAED,wBAAgB,gBAAgB,IAAI,CAAC,QAAQ,EAAE,gBAAgB,KAAK,MAAM,CAOzE;AAED,wBAAgB,gBAAgB,IAAI,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAMjE"}
@@ -0,0 +1,20 @@
1
+ import { useTr as e } from "./useTr.js";
2
+ import { getAuthTypeLabel as t, getCategoryLabel as n, getStatusLabel as r } from "../utils/integrationsHelpers.js";
3
+ import { useCallback as i } from "react";
4
+ //#region src/integrations/hooks/useLabel.ts
5
+ function a() {
6
+ let t = e();
7
+ return i((e) => t(`integrations.status.${e}`, r(e)), [t]);
8
+ }
9
+ function o() {
10
+ let t = e();
11
+ return i((e) => t(`integrations.category.${e}`, n(e)), [t]);
12
+ }
13
+ function s() {
14
+ let n = e();
15
+ return i((e) => n(`integrations.authType.${e}`, t(e)), [n]);
16
+ }
17
+ //#endregion
18
+ export { s as useAuthTypeLabel, o as useCategoryLabel, a as useStatusLabel };
19
+
20
+ //# sourceMappingURL=useLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLabel.js","names":[],"sources":["../../../src/integrations/hooks/useLabel.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useTr } from './useTr';\nimport { getStatusLabel, getCategoryLabel, getAuthTypeLabel } from '../utils/integrationsHelpers';\nimport type { ConnectionStatus, ProviderCategory, AuthType } from '../types';\n\n/**\n * Translated label hooks for shared enums.\n *\n * These wrap the existing English helper functions so call sites can keep using\n * the helpers as fallbacks while the translation layer provides localized\n * strings when available.\n */\n\nexport function useStatusLabel(): (status: ConnectionStatus) => string {\n const tr = useTr();\n return useCallback(\n (status: ConnectionStatus) => tr(`integrations.status.${status}`, getStatusLabel(status)),\n [tr]\n );\n}\n\nexport function useCategoryLabel(): (category: ProviderCategory) => string {\n const tr = useTr();\n return useCallback(\n (category: ProviderCategory) =>\n tr(`integrations.category.${category}`, getCategoryLabel(category)),\n [tr]\n );\n}\n\nexport function useAuthTypeLabel(): (authType: AuthType) => string {\n const tr = useTr();\n return useCallback(\n (authType: AuthType) => tr(`integrations.authType.${authType}`, getAuthTypeLabel(authType)),\n [tr]\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,IAAuD;CACrE,IAAM,IAAK,GAAO;AAClB,QAAO,GACJ,MAA6B,EAAG,uBAAuB,KAAU,EAAe,EAAO,CAAC,EACzF,CAAC,EAAG,CACL;;AAGH,SAAgB,IAA2D;CACzE,IAAM,IAAK,GAAO;AAClB,QAAO,GACJ,MACC,EAAG,yBAAyB,KAAY,EAAiB,EAAS,CAAC,EACrE,CAAC,EAAG,CACL;;AAGH,SAAgB,IAAmD;CACjE,IAAM,IAAK,GAAO;AAClB,QAAO,GACJ,MAAuB,EAAG,yBAAyB,KAAY,EAAiB,EAAS,CAAC,EAC3F,CAAC,EAAG,CACL"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * useTr — translation hook with fallback semantics.
3
+ *
4
+ * Wraps `useI18n().t()` so that when a key has no translation (i.e. the
5
+ * provider returns the key itself), the caller's English fallback is used
6
+ * instead. This keeps consumer call sites consistent and avoids leaking
7
+ * untranslated keys into the UI.
8
+ *
9
+ * Supports optional interpolation params using `{{key}}` placeholders.
10
+ *
11
+ * @example
12
+ * const tr = useTr();
13
+ * return <h1>{tr('integrations.overview.title', 'Integrations')}</h1>;
14
+ * return <p>{tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', { time: '2m ago' })}</p>;
15
+ */
16
+ export declare function useTr(): (key: string, fallback: string, params?: Record<string, string | number>) => string;
17
+ //# sourceMappingURL=useTr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTr.d.ts","sourceRoot":"","sources":["../../../src/integrations/hooks/useTr.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,IAAI,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KACrC,MAAM,CAcV"}
@@ -0,0 +1,14 @@
1
+ import { useCallback as e } from "react";
2
+ import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
3
+ //#region src/integrations/hooks/useTr.ts
4
+ function n() {
5
+ let { t: n } = t();
6
+ return e((e, t, r) => {
7
+ let i = n(e), a = i === e ? t : i;
8
+ return r ? Object.entries(r).reduce((e, [t, n]) => e.replace(RegExp(`\\{\\{${t}\\}\\}`, "g"), String(n)), a) : a;
9
+ }, [n]);
10
+ }
11
+ //#endregion
12
+ export { n as useTr };
13
+
14
+ //# sourceMappingURL=useTr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTr.js","names":[],"sources":["../../../src/integrations/hooks/useTr.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\n/**\n * useTr — translation hook with fallback semantics.\n *\n * Wraps `useI18n().t()` so that when a key has no translation (i.e. the\n * provider returns the key itself), the caller's English fallback is used\n * instead. This keeps consumer call sites consistent and avoids leaking\n * untranslated keys into the UI.\n *\n * Supports optional interpolation params using `{{key}}` placeholders.\n *\n * @example\n * const tr = useTr();\n * return <h1>{tr('integrations.overview.title', 'Integrations')}</h1>;\n * return <p>{tr('integrations.connectionCard.lastUsed', 'Last used {{time}}', { time: '2m ago' })}</p>;\n */\nexport function useTr(): (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string {\n const { t } = useI18n();\n return useCallback(\n (key: string, fallback: string, params?: Record<string, string | number>): string => {\n const translated = t(key);\n const raw = translated === key ? fallback : translated;\n if (!params) return raw;\n return Object.entries(params).reduce(\n (str, [k, v]) => str.replace(new RegExp(`\\\\{\\\\{${k}\\\\}\\\\}`, 'g'), String(v)),\n raw\n );\n },\n [t]\n );\n}\n"],"mappings":";;;AAkBA,SAAgB,IAIJ;CACV,IAAM,EAAE,SAAM,GAAS;AACvB,QAAO,GACJ,GAAa,GAAkB,MAAqD;EACnF,IAAM,IAAa,EAAE,EAAI,EACnB,IAAM,MAAe,IAAM,IAAW;AAE5C,SADK,IACE,OAAO,QAAQ,EAAO,CAAC,QAC3B,GAAK,CAAC,GAAG,OAAO,EAAI,QAAY,OAAO,SAAS,EAAE,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC,EAC5E,EACD,GAJmB;IAMtB,CAAC,EAAE,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnectionWizard.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"names":[],"mappings":"AAgDA;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,gCAu4BlC"}
1
+ {"version":3,"file":"AddConnectionWizard.d.ts","sourceRoot":"","sources":["../../../src/integrations/pages/AddConnectionWizard.tsx"],"names":[],"mappings":"AA8CA;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,gCAgkClC"}