@xemahq/ui-kernel 0.9.0 → 0.9.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/README.md +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/biome-host/biome-builders.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-builders.js +3 -1
- package/dist/lib/biome-host/biome-builders.js.map +1 -1
- package/dist/lib/biome-host/biome-registry.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-registry.js +14 -9
- package/dist/lib/biome-host/biome-registry.js.map +1 -1
- package/dist/lib/biome-host/biome-scope-hooks.d.ts +11 -0
- package/dist/lib/biome-host/biome-scope-hooks.d.ts.map +1 -0
- package/dist/lib/biome-host/biome-scope-hooks.js +25 -0
- package/dist/lib/biome-host/biome-scope-hooks.js.map +1 -0
- package/dist/lib/biome-host/biome-scope.d.ts +1 -10
- package/dist/lib/biome-host/biome-scope.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-scope.js +1 -24
- package/dist/lib/biome-host/biome-scope.js.map +1 -1
- package/dist/lib/biome-host/biome-scoped-query.d.ts +1 -1
- package/dist/lib/biome-host/biome-scoped-query.d.ts.map +1 -1
- package/dist/lib/biome-host/biome-scoped-query.js +1 -1
- package/dist/lib/biome-host/biome-scoped-query.js.map +1 -1
- package/dist/lib/biome-host/create-biome-orval-config.js +2 -2
- package/dist/lib/biome-host/create-biome-orval-config.js.map +1 -1
- package/dist/lib/biome-host/errors.js.map +1 -1
- package/dist/lib/biome-host/index.d.ts +1 -1
- package/dist/lib/biome-host/index.d.ts.map +1 -1
- package/dist/lib/biome-host/index.js +1 -1
- package/dist/lib/biome-host/index.js.map +1 -1
- package/dist/lib/biome-host/session-profiles.d.ts.map +1 -1
- package/dist/lib/biome-host/session-profiles.js +4 -1
- package/dist/lib/biome-host/session-profiles.js.map +1 -1
- package/dist/lib/capabilities/capability-context.d.ts +9 -0
- package/dist/lib/capabilities/capability-context.d.ts.map +1 -0
- package/dist/lib/capabilities/capability-context.js +13 -0
- package/dist/lib/capabilities/capability-context.js.map +1 -0
- package/dist/lib/capabilities/capability-provider.d.ts +2 -8
- package/dist/lib/capabilities/capability-provider.d.ts.map +1 -1
- package/dist/lib/capabilities/capability-provider.js +1 -12
- package/dist/lib/capabilities/capability-provider.js.map +1 -1
- package/dist/lib/capabilities/index.d.ts +1 -0
- package/dist/lib/capabilities/index.d.ts.map +1 -1
- package/dist/lib/capabilities/index.js +1 -0
- package/dist/lib/capabilities/index.js.map +1 -1
- package/dist/lib/capabilities/use-capability.d.ts.map +1 -1
- package/dist/lib/capabilities/use-capability.js +1 -1
- package/dist/lib/capabilities/use-capability.js.map +1 -1
- package/dist/lib/contribution-registry/contribution-registry.d.ts +24 -0
- package/dist/lib/contribution-registry/contribution-registry.d.ts.map +1 -0
- package/dist/lib/contribution-registry/contribution-registry.js +67 -0
- package/dist/lib/contribution-registry/contribution-registry.js.map +1 -0
- package/dist/lib/contribution-registry/index.d.ts +3 -0
- package/dist/lib/contribution-registry/index.d.ts.map +1 -0
- package/dist/lib/contribution-registry/index.js +3 -0
- package/dist/lib/contribution-registry/index.js.map +1 -0
- package/dist/lib/contribution-registry/renderable-registry.d.ts +33 -0
- package/dist/lib/contribution-registry/renderable-registry.d.ts.map +1 -0
- package/dist/lib/contribution-registry/renderable-registry.js +51 -0
- package/dist/lib/contribution-registry/renderable-registry.js.map +1 -0
- package/dist/lib/system-bus/deeplink.js.map +1 -1
- package/dist/lib/system-bus/host-ports.d.ts +2 -1
- package/dist/lib/system-bus/host-ports.d.ts.map +1 -1
- package/dist/lib/system-bus/intent-registry.d.ts.map +1 -1
- package/dist/lib/system-bus/intent-registry.js.map +1 -1
- package/dist/offline/index.d.ts +2 -1
- package/dist/offline/index.d.ts.map +1 -1
- package/dist/offline/index.js +2 -1
- package/dist/offline/index.js.map +1 -1
- package/dist/offline/offline-status-badge.js +1 -1
- package/dist/offline/offline-status-badge.js.map +1 -1
- package/dist/offline/outbox.js.map +1 -1
- package/dist/offline/react-hooks.d.ts +7 -0
- package/dist/offline/react-hooks.d.ts.map +1 -0
- package/dist/offline/react-hooks.js +25 -0
- package/dist/offline/react-hooks.js.map +1 -0
- package/dist/offline/react.d.ts +0 -4
- package/dist/offline/react.d.ts.map +1 -1
- package/dist/offline/react.js +2 -24
- package/dist/offline/react.js.map +1 -1
- package/dist/offline/storage.d.ts.map +1 -1
- package/dist/offline/storage.js +8 -5
- package/dist/offline/storage.js.map +1 -1
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.d.ts.map +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.js +1 -1
- package/dist/registry/lib/primitives/SessionEventCard.js.map +1 -1
- package/dist/registry/lib/session-context-provider.d.ts +1 -3
- package/dist/registry/lib/session-context-provider.d.ts.map +1 -1
- package/dist/registry/lib/session-context-provider.js +2 -15
- package/dist/registry/lib/session-context-provider.js.map +1 -1
- package/dist/registry/lib/session-context.d.ts +5 -0
- package/dist/registry/lib/session-context.d.ts.map +1 -0
- package/dist/registry/lib/session-context.js +15 -0
- package/dist/registry/lib/session-context.js.map +1 -0
- package/dist/registry/lib/session-selectors.d.ts.map +1 -1
- package/dist/registry/lib/session-selectors.js +3 -1
- package/dist/registry/lib/session-selectors.js.map +1 -1
- package/dist/ui/branding/app-branding-context.d.ts +9 -0
- package/dist/ui/branding/app-branding-context.d.ts.map +1 -0
- package/dist/ui/branding/app-branding-context.js +10 -0
- package/dist/ui/branding/app-branding-context.js.map +1 -0
- package/dist/ui/branding/app-branding-provider.d.ts +0 -6
- package/dist/ui/branding/app-branding-provider.d.ts.map +1 -1
- package/dist/ui/branding/app-branding-provider.js +1 -8
- package/dist/ui/branding/app-branding-provider.js.map +1 -1
- package/dist/ui/capture/field-spec-to-zod.d.ts +1 -0
- package/dist/ui/capture/field-spec-to-zod.d.ts.map +1 -1
- package/dist/ui/capture/field-spec-to-zod.js +19 -0
- package/dist/ui/capture/field-spec-to-zod.js.map +1 -1
- package/dist/ui/capture/field-spec-validate.d.ts +4 -0
- package/dist/ui/capture/field-spec-validate.d.ts.map +1 -0
- package/dist/ui/capture/field-spec-validate.js +129 -0
- package/dist/ui/capture/field-spec-validate.js.map +1 -0
- package/dist/ui/capture/field-spec.d.ts +13 -1
- package/dist/ui/capture/field-spec.d.ts.map +1 -1
- package/dist/ui/capture/field-spec.js +25 -0
- package/dist/ui/capture/field-spec.js.map +1 -1
- package/dist/ui/capture/index.d.ts +4 -2
- package/dist/ui/capture/index.d.ts.map +1 -1
- package/dist/ui/capture/index.js +4 -2
- package/dist/ui/capture/index.js.map +1 -1
- package/dist/ui/capture/schema-field-input.d.ts.map +1 -1
- package/dist/ui/capture/schema-field-input.js +40 -13
- package/dist/ui/capture/schema-field-input.js.map +1 -1
- package/dist/ui/capture/submit-values.d.ts +6 -0
- package/dist/ui/capture/submit-values.d.ts.map +1 -0
- package/dist/ui/capture/submit-values.js +28 -0
- package/dist/ui/capture/submit-values.js.map +1 -0
- package/dist/ui/capture/use-prefill.d.ts.map +1 -1
- package/dist/ui/capture/use-prefill.js +3 -1
- package/dist/ui/capture/use-prefill.js.map +1 -1
- package/dist/ui/capture/use-wizard.d.ts +1 -1
- package/dist/ui/capture/use-wizard.d.ts.map +1 -1
- package/dist/ui/capture/use-wizard.js +1 -1
- package/dist/ui/capture/use-wizard.js.map +1 -1
- package/dist/ui/capture/wizard.d.ts.map +1 -1
- package/dist/ui/capture/wizard.js.map +1 -1
- package/dist/ui/index.d.ts +6 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +6 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/primitives/alert-dialog.js +1 -1
- package/dist/ui/primitives/alert-dialog.js.map +1 -1
- package/dist/ui/primitives/badge-variants.d.ts +4 -0
- package/dist/ui/primitives/badge-variants.d.ts.map +1 -0
- package/dist/ui/primitives/badge-variants.js +15 -0
- package/dist/ui/primitives/badge-variants.js.map +1 -0
- package/dist/ui/primitives/badge.d.ts +3 -5
- package/dist/ui/primitives/badge.d.ts.map +1 -1
- package/dist/ui/primitives/badge.js +2 -15
- package/dist/ui/primitives/badge.js.map +1 -1
- package/dist/ui/primitives/button-variants.d.ts +5 -0
- package/dist/ui/primitives/button-variants.d.ts.map +1 -0
- package/dist/ui/primitives/button-variants.js +24 -0
- package/dist/ui/primitives/button-variants.js.map +1 -0
- package/dist/ui/primitives/button.d.ts +3 -6
- package/dist/ui/primitives/button.d.ts.map +1 -1
- package/dist/ui/primitives/button.js +2 -24
- package/dist/ui/primitives/button.js.map +1 -1
- package/dist/ui/primitives/form-stepper.d.ts +1 -13
- package/dist/ui/primitives/form-stepper.d.ts.map +1 -1
- package/dist/ui/primitives/form-stepper.js +1 -6
- package/dist/ui/primitives/form-stepper.js.map +1 -1
- package/dist/ui/primitives/form-stepper.types.d.ts +14 -0
- package/dist/ui/primitives/form-stepper.types.d.ts.map +1 -0
- package/dist/ui/primitives/form-stepper.types.js +7 -0
- package/dist/ui/primitives/form-stepper.types.js.map +1 -0
- package/dist/ui/primitives/overflow-tabs.d.ts +5 -0
- package/dist/ui/primitives/overflow-tabs.d.ts.map +1 -1
- package/dist/ui/primitives/overflow-tabs.js +4 -4
- package/dist/ui/primitives/overflow-tabs.js.map +1 -1
- package/dist/ui/primitives/preview-device-frame.js +1 -1
- package/dist/ui/primitives/preview-device-frame.js.map +1 -1
- package/dist/ui/primitives/tag-multi-select.d.ts.map +1 -1
- package/dist/ui/primitives/tag-multi-select.js +1 -1
- package/dist/ui/primitives/tag-multi-select.js.map +1 -1
- package/dist/ui/primitives/url-preview-chrome.d.ts +8 -0
- package/dist/ui/primitives/url-preview-chrome.d.ts.map +1 -0
- package/dist/ui/primitives/url-preview-chrome.js +40 -0
- package/dist/ui/primitives/url-preview-chrome.js.map +1 -0
- package/dist/vista/GenericCatalogueSurface.d.ts +10 -0
- package/dist/vista/GenericCatalogueSurface.d.ts.map +1 -0
- package/dist/vista/GenericCatalogueSurface.js +80 -0
- package/dist/vista/GenericCatalogueSurface.js.map +1 -0
- package/dist/vista/SurfaceFallbackCard.d.ts +9 -0
- package/dist/vista/SurfaceFallbackCard.d.ts.map +1 -0
- package/dist/vista/SurfaceFallbackCard.js +44 -0
- package/dist/vista/SurfaceFallbackCard.js.map +1 -0
- package/dist/vista/VistaPanel.d.ts +21 -0
- package/dist/vista/VistaPanel.d.ts.map +1 -0
- package/dist/vista/VistaPanel.js +31 -0
- package/dist/vista/VistaPanel.js.map +1 -0
- package/dist/vista/html/CustomUiFrame.d.ts +20 -0
- package/dist/vista/html/CustomUiFrame.d.ts.map +1 -0
- package/dist/vista/html/CustomUiFrame.js +69 -0
- package/dist/vista/html/CustomUiFrame.js.map +1 -0
- package/dist/vista/html/custom-ui-frame-bridge.d.ts +13 -0
- package/dist/vista/html/custom-ui-frame-bridge.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-frame-bridge.js +30 -0
- package/dist/vista/html/custom-ui-frame-bridge.js.map +1 -0
- package/dist/vista/html/custom-ui-frame-contract.d.ts +29 -0
- package/dist/vista/html/custom-ui-frame-contract.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-frame-contract.js +16 -0
- package/dist/vista/html/custom-ui-frame-contract.js.map +1 -0
- package/dist/vista/html/custom-ui-intents.d.ts +20 -0
- package/dist/vista/html/custom-ui-intents.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-intents.js +57 -0
- package/dist/vista/html/custom-ui-intents.js.map +1 -0
- package/dist/vista/html/custom-ui-srcdoc.d.ts +17 -0
- package/dist/vista/html/custom-ui-srcdoc.d.ts.map +1 -0
- package/dist/vista/html/custom-ui-srcdoc.js +70 -0
- package/dist/vista/html/custom-ui-srcdoc.js.map +1 -0
- package/dist/vista/html/index.d.ts +6 -0
- package/dist/vista/html/index.d.ts.map +1 -0
- package/dist/vista/html/index.js +6 -0
- package/dist/vista/html/index.js.map +1 -0
- package/dist/vista/index.d.ts +22 -0
- package/dist/vista/index.d.ts.map +1 -0
- package/dist/vista/index.js +22 -0
- package/dist/vista/index.js.map +1 -0
- package/dist/vista/surface-catalogue.d.ts +5 -0
- package/dist/vista/surface-catalogue.d.ts.map +1 -0
- package/dist/vista/surface-catalogue.js +30 -0
- package/dist/vista/surface-catalogue.js.map +1 -0
- package/dist/vista/surface-icons.d.ts +7 -0
- package/dist/vista/surface-icons.d.ts.map +1 -0
- package/dist/vista/surface-icons.js +26 -0
- package/dist/vista/surface-icons.js.map +1 -0
- package/dist/vista/surface-registry.d.ts +7 -0
- package/dist/vista/surface-registry.d.ts.map +1 -0
- package/dist/vista/surface-registry.js +7 -0
- package/dist/vista/surface-registry.js.map +1 -0
- package/dist/vista/surfaces/ChartSurface.d.ts +4 -0
- package/dist/vista/surfaces/ChartSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/ChartSurface.js +17 -0
- package/dist/vista/surfaces/ChartSurface.js.map +1 -0
- package/dist/vista/surfaces/FilesSurface.d.ts +4 -0
- package/dist/vista/surfaces/FilesSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/FilesSurface.js +77 -0
- package/dist/vista/surfaces/FilesSurface.js.map +1 -0
- package/dist/vista/surfaces/FormSurface.d.ts +4 -0
- package/dist/vista/surfaces/FormSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/FormSurface.js +124 -0
- package/dist/vista/surfaces/FormSurface.js.map +1 -0
- package/dist/vista/surfaces/HtmlSurface.d.ts +4 -0
- package/dist/vista/surfaces/HtmlSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/HtmlSurface.js +11 -0
- package/dist/vista/surfaces/HtmlSurface.js.map +1 -0
- package/dist/vista/surfaces/TableSurface.d.ts +4 -0
- package/dist/vista/surfaces/TableSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/TableSurface.js +42 -0
- package/dist/vista/surfaces/TableSurface.js.map +1 -0
- package/dist/vista/surfaces/UrlSurface.d.ts +4 -0
- package/dist/vista/surfaces/UrlSurface.d.ts.map +1 -0
- package/dist/vista/surfaces/UrlSurface.js +7 -0
- package/dist/vista/surfaces/UrlSurface.js.map +1 -0
- package/dist/vista/surfaces/blob-surfaces.d.ts +6 -0
- package/dist/vista/surfaces/blob-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/blob-surfaces.js +38 -0
- package/dist/vista/surfaces/blob-surfaces.js.map +1 -0
- package/dist/vista/surfaces/elicitation-transport.d.ts +27 -0
- package/dist/vista/surfaces/elicitation-transport.d.ts.map +1 -0
- package/dist/vista/surfaces/elicitation-transport.js +193 -0
- package/dist/vista/surfaces/elicitation-transport.js.map +1 -0
- package/dist/vista/surfaces/file-surface-utils.d.ts +13 -0
- package/dist/vista/surfaces/file-surface-utils.d.ts.map +1 -0
- package/dist/vista/surfaces/file-surface-utils.js +46 -0
- package/dist/vista/surfaces/file-surface-utils.js.map +1 -0
- package/dist/vista/surfaces/index.d.ts +12 -0
- package/dist/vista/surfaces/index.d.ts.map +1 -0
- package/dist/vista/surfaces/index.js +12 -0
- package/dist/vista/surfaces/index.js.map +1 -0
- package/dist/vista/surfaces/register-surfaces.d.ts +2 -0
- package/dist/vista/surfaces/register-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/register-surfaces.js +80 -0
- package/dist/vista/surfaces/register-surfaces.js.map +1 -0
- package/dist/vista/surfaces/text-surfaces.d.ts +8 -0
- package/dist/vista/surfaces/text-surfaces.d.ts.map +1 -0
- package/dist/vista/surfaces/text-surfaces.js +54 -0
- package/dist/vista/surfaces/text-surfaces.js.map +1 -0
- package/dist/vista/use-vista-tabs.d.ts +30 -0
- package/dist/vista/use-vista-tabs.d.ts.map +1 -0
- package/dist/vista/use-vista-tabs.js +77 -0
- package/dist/vista/use-vista-tabs.js.map +1 -0
- package/dist/vista/vista-code-renderer-context.d.ts +9 -0
- package/dist/vista/vista-code-renderer-context.d.ts.map +1 -0
- package/dist/vista/vista-code-renderer-context.js +6 -0
- package/dist/vista/vista-code-renderer-context.js.map +1 -0
- package/dist/vista/vista-code-renderer.d.ts +7 -0
- package/dist/vista/vista-code-renderer.d.ts.map +1 -0
- package/dist/vista/vista-code-renderer.js +6 -0
- package/dist/vista/vista-code-renderer.js.map +1 -0
- package/dist/vista/vista-file-context.d.ts +8 -0
- package/dist/vista/vista-file-context.d.ts.map +1 -0
- package/dist/vista/vista-file-context.js +6 -0
- package/dist/vista/vista-file-context.js.map +1 -0
- package/dist/vista/vista-file-source.d.ts +15 -0
- package/dist/vista/vista-file-source.d.ts.map +1 -0
- package/dist/vista/vista-file-source.js +66 -0
- package/dist/vista/vista-file-source.js.map +1 -0
- package/dist/vista/vista-form-context.d.ts +13 -0
- package/dist/vista/vista-form-context.d.ts.map +1 -0
- package/dist/vista/vista-form-context.js +6 -0
- package/dist/vista/vista-form-context.js.map +1 -0
- package/dist/vista/vista-form-host.d.ts +7 -0
- package/dist/vista/vista-form-host.d.ts.map +1 -0
- package/dist/vista/vista-form-host.js +6 -0
- package/dist/vista/vista-form-host.js.map +1 -0
- package/dist/vista/vista-model.d.ts +12 -0
- package/dist/vista/vista-model.d.ts.map +1 -0
- package/dist/vista/vista-model.js +72 -0
- package/dist/vista/vista-model.js.map +1 -0
- package/dist/vista/vista-open-context.d.ts +7 -0
- package/dist/vista/vista-open-context.d.ts.map +1 -0
- package/dist/vista/vista-open-context.js +6 -0
- package/dist/vista/vista-open-context.js.map +1 -0
- package/dist/vista/vista-open-state.d.ts +5 -0
- package/dist/vista/vista-open-state.d.ts.map +1 -0
- package/dist/vista/vista-open-state.js +6 -0
- package/dist/vista/vista-open-state.js.map +1 -0
- package/dist/vista/vista-payloads.d.ts +106 -0
- package/dist/vista/vista-payloads.d.ts.map +1 -0
- package/dist/vista/vista-payloads.js +302 -0
- package/dist/vista/vista-payloads.js.map +1 -0
- package/dist/vista/vista-tabs-manifest.d.ts +17 -0
- package/dist/vista/vista-tabs-manifest.d.ts.map +1 -0
- package/dist/vista/vista-tabs-manifest.js +60 -0
- package/dist/vista/vista-tabs-manifest.js.map +1 -0
- package/dist/vista/vista-tools.d.ts +41 -0
- package/dist/vista/vista-tools.d.ts.map +1 -0
- package/dist/vista/vista-tools.js +113 -0
- package/dist/vista/vista-tools.js.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +5 -0
- package/src/lib/biome-host/biome-builders.ts +4 -1
- package/src/lib/biome-host/biome-registry.ts +31 -12
- package/src/lib/biome-host/biome-scope-hooks.ts +39 -0
- package/src/lib/biome-host/biome-scope.tsx +1 -68
- package/src/lib/biome-host/biome-scoped-query.ts +4 -1
- package/src/lib/biome-host/create-biome-orval-config.ts +2 -2
- package/src/lib/biome-host/errors.ts +1 -1
- package/src/lib/biome-host/index.ts +1 -1
- package/src/lib/biome-host/session-profiles.ts +7 -1
- package/src/lib/capabilities/capability-context.ts +25 -0
- package/src/lib/capabilities/capability-provider.tsx +5 -34
- package/src/lib/capabilities/index.ts +1 -0
- package/src/lib/capabilities/use-capability.ts +4 -1
- package/src/lib/contribution-registry/contribution-registry.spec.ts +141 -0
- package/src/lib/contribution-registry/contribution-registry.ts +202 -0
- package/src/lib/contribution-registry/index.ts +9 -0
- package/src/lib/contribution-registry/renderable-registry.ts +142 -0
- package/src/lib/system-bus/deeplink.ts +1 -1
- package/src/lib/system-bus/host-ports.ts +2 -1
- package/src/lib/system-bus/intent-registry.ts +1 -2
- package/src/offline/index.ts +4 -2
- package/src/offline/offline-status-badge.tsx +1 -1
- package/src/offline/outbox.test.ts +23 -16
- package/src/offline/outbox.ts +1 -1
- package/src/offline/react-hooks.ts +37 -0
- package/src/offline/react.tsx +1 -40
- package/src/offline/storage.ts +11 -6
- package/src/registry/index.ts +1 -0
- package/src/registry/lib/primitives/SessionEventCard.tsx +4 -2
- package/src/registry/lib/session-context-provider.tsx +8 -25
- package/src/registry/lib/session-context.ts +21 -0
- package/src/registry/lib/session-selectors.ts +3 -1
- package/src/ui/branding/app-branding-context.ts +20 -0
- package/src/ui/branding/app-branding-provider.tsx +5 -27
- package/src/ui/capture/field-spec-to-zod.ts +22 -0
- package/src/ui/capture/field-spec-validate.ts +147 -0
- package/src/ui/capture/field-spec.ts +62 -0
- package/src/ui/capture/index.ts +9 -1
- package/src/ui/capture/schema-field-input.tsx +141 -15
- package/src/ui/capture/submit-values.test.ts +70 -0
- package/src/ui/capture/submit-values.ts +63 -0
- package/src/ui/capture/use-prefill.ts +4 -1
- package/src/ui/capture/use-wizard.ts +2 -2
- package/src/ui/capture/wizard.tsx +2 -1
- package/src/ui/index.ts +11 -2
- package/src/ui/primitives/alert-dialog.tsx +1 -1
- package/src/ui/primitives/badge-variants.ts +21 -0
- package/src/ui/primitives/badge.tsx +3 -19
- package/src/ui/primitives/button-variants.ts +31 -0
- package/src/ui/primitives/button.tsx +3 -28
- package/src/ui/primitives/form-stepper.tsx +1 -16
- package/src/ui/primitives/form-stepper.types.ts +15 -0
- package/src/ui/primitives/overflow-tabs.tsx +24 -4
- package/src/ui/primitives/preview-device-frame.tsx +1 -1
- package/src/ui/primitives/tag-multi-select.tsx +3 -4
- package/src/ui/primitives/url-preview-chrome.tsx +102 -0
- package/src/vista/GenericCatalogueSurface.tsx +177 -0
- package/src/vista/SurfaceFallbackCard.tsx +109 -0
- package/src/vista/VistaPanel.tsx +155 -0
- package/src/vista/form-payload.spec.ts +139 -0
- package/src/vista/html/CustomUiFrame.spec.tsx +125 -0
- package/src/vista/html/CustomUiFrame.tsx +204 -0
- package/src/vista/html/custom-ui-frame-bridge.spec.ts +191 -0
- package/src/vista/html/custom-ui-frame-bridge.ts +92 -0
- package/src/vista/html/custom-ui-frame-contract.ts +88 -0
- package/src/vista/html/custom-ui-intents.spec.ts +133 -0
- package/src/vista/html/custom-ui-intents.ts +151 -0
- package/src/vista/html/custom-ui-srcdoc.spec.ts +151 -0
- package/src/vista/html/custom-ui-srcdoc.ts +193 -0
- package/src/vista/html/index.ts +13 -0
- package/src/vista/index.ts +52 -0
- package/src/vista/surface-catalogue.spec.ts +140 -0
- package/src/vista/surface-catalogue.ts +84 -0
- package/src/vista/surface-icons.ts +57 -0
- package/src/vista/surface-registry.ts +56 -0
- package/src/vista/surfaces/ChartSurface.tsx +34 -0
- package/src/vista/surfaces/FilesSurface.tsx +202 -0
- package/src/vista/surfaces/FormSurface.tsx +363 -0
- package/src/vista/surfaces/HtmlSurface.tsx +43 -0
- package/src/vista/surfaces/TableSurface.tsx +99 -0
- package/src/vista/surfaces/UrlSurface.tsx +40 -0
- package/src/vista/surfaces/blob-surfaces.tsx +129 -0
- package/src/vista/surfaces/elicitation-transport.spec.ts +369 -0
- package/src/vista/surfaces/elicitation-transport.ts +353 -0
- package/src/vista/surfaces/file-surface-utils.ts +62 -0
- package/src/vista/surfaces/index.ts +24 -0
- package/src/vista/surfaces/register-surfaces.tsx +137 -0
- package/src/vista/surfaces/text-surfaces.tsx +119 -0
- package/src/vista/use-vista-tabs.ts +188 -0
- package/src/vista/vista-code-renderer-context.ts +16 -0
- package/src/vista/vista-code-renderer.tsx +34 -0
- package/src/vista/vista-file-context.ts +14 -0
- package/src/vista/vista-file-source.tsx +140 -0
- package/src/vista/vista-form-context.ts +20 -0
- package/src/vista/vista-form-host.tsx +53 -0
- package/src/vista/vista-model.ts +130 -0
- package/src/vista/vista-open-context.tsx +32 -0
- package/src/vista/vista-open-state.ts +11 -0
- package/src/vista/vista-payloads.ts +512 -0
- package/src/vista/vista-tabs-manifest.ts +123 -0
- package/src/vista/vista-tools.ts +220 -0
- package/dist/lib/biome-host/response-envelope.d.ts +0 -3
- package/dist/lib/biome-host/response-envelope.d.ts.map +0 -1
- package/dist/lib/biome-host/response-envelope.js +0 -21
- package/dist/lib/biome-host/response-envelope.js.map +0 -1
- package/src/lib/biome-host/response-envelope.ts +0 -69
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SurfaceKind.Url` — a live external URL inside mock browser chrome.
|
|
3
|
+
*
|
|
4
|
+
* The chrome (traffic lights + address bar + reload) is `UrlPreviewChrome`,
|
|
5
|
+
* lifted out of the thin session workspace; the device bezel is the shared
|
|
6
|
+
* `PreviewDeviceFrame`. The frame itself is `sandbox="allow-scripts
|
|
7
|
+
* allow-forms"` and NEVER `allow-same-origin`: a previewed app runs in its own
|
|
8
|
+
* opaque origin and cannot reach the host's DOM, cookies or tokens.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { PreviewDeviceFrame } from '../../ui/primitives/preview-device-frame';
|
|
12
|
+
import { UrlPreviewChrome } from '../../ui/primitives/url-preview-chrome';
|
|
13
|
+
|
|
14
|
+
import type { VistaUrlPayload } from '../vista-payloads';
|
|
15
|
+
import type { ReactElement } from 'react';
|
|
16
|
+
|
|
17
|
+
export function UrlSurface({
|
|
18
|
+
url,
|
|
19
|
+
device = 'desktop',
|
|
20
|
+
reloadNonce,
|
|
21
|
+
}: Readonly<VistaUrlPayload>): ReactElement {
|
|
22
|
+
return (
|
|
23
|
+
<UrlPreviewChrome url={url}>
|
|
24
|
+
<PreviewDeviceFrame device={device}>
|
|
25
|
+
<iframe
|
|
26
|
+
// Remounting on a nonce change is how a reload is requested without
|
|
27
|
+
// reaching into the frame (which we cannot do: it is cross-origin).
|
|
28
|
+
key={`${url}::${device}::${reloadNonce ?? 0}`}
|
|
29
|
+
title={`Preview of ${url}`}
|
|
30
|
+
src={url}
|
|
31
|
+
// NEVER add allow-same-origin — it would dissolve the origin boundary
|
|
32
|
+
// between the previewed app and the host.
|
|
33
|
+
sandbox="allow-scripts allow-forms"
|
|
34
|
+
loading="lazy"
|
|
35
|
+
style={{ height: '100%', width: '100%', border: 0 }}
|
|
36
|
+
/>
|
|
37
|
+
</PreviewDeviceFrame>
|
|
38
|
+
</UrlPreviewChrome>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The binary-bodied first-party surfaces: `image`, `media`, `pdf`.
|
|
3
|
+
*
|
|
4
|
+
* Each accepts an already-resolved `url` OR a workspace `path` resolved through
|
|
5
|
+
* the host {@link VistaFileSource}.
|
|
6
|
+
*
|
|
7
|
+
* SECURITY — `pdf`: the bytes are frequently UNTRUSTED (user uploads,
|
|
8
|
+
* agent-produced artifacts). The PDF is painted onto a `<canvas>` by pdf.js
|
|
9
|
+
* (the shared `PdfPreview`) — NO iframe, NO script execution — never embedded
|
|
10
|
+
* in the browser's own viewer. `PdfPreview` is lazy-imported so pdf.js
|
|
11
|
+
* (~1.9 MB) stays out of any bundle that never opens a PDF; that dynamic import
|
|
12
|
+
* is the whole point of the `@xemahq/ui-kernel/pdf` subpath.
|
|
13
|
+
*/
|
|
14
|
+
import { Suspense, lazy, type ReactElement, type ReactNode } from 'react';
|
|
15
|
+
|
|
16
|
+
import { VistaFileUrl } from '../vista-file-source';
|
|
17
|
+
|
|
18
|
+
import type { VistaBlobPayload } from '../vista-payloads';
|
|
19
|
+
|
|
20
|
+
const PdfPreview = lazy(() =>
|
|
21
|
+
import('../../pdf').then((m) => ({ default: m.PdfPreview })),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/** Render from an inline url, or resolve the path first. */
|
|
25
|
+
function BlobBody({
|
|
26
|
+
payload,
|
|
27
|
+
render,
|
|
28
|
+
}: Readonly<{
|
|
29
|
+
payload: VistaBlobPayload;
|
|
30
|
+
render: (url: string) => ReactNode;
|
|
31
|
+
}>): ReactElement {
|
|
32
|
+
if (payload.url !== undefined) return <>{render(payload.url)}</>;
|
|
33
|
+
// `validateBlobPayload` guarantees exactly one of url/path.
|
|
34
|
+
return <VistaFileUrl path={payload.path as string} render={render} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ImageSurface(payload: VistaBlobPayload): ReactElement {
|
|
38
|
+
return (
|
|
39
|
+
<BlobBody
|
|
40
|
+
payload={payload}
|
|
41
|
+
render={(url) => (
|
|
42
|
+
<div
|
|
43
|
+
style={{
|
|
44
|
+
height: '100%',
|
|
45
|
+
display: 'grid',
|
|
46
|
+
placeItems: 'center',
|
|
47
|
+
padding: 16,
|
|
48
|
+
overflow: 'auto',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<img
|
|
52
|
+
src={url}
|
|
53
|
+
alt={payload.alt ?? 'Preview'}
|
|
54
|
+
style={{ maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' }}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function PdfSurface(payload: VistaBlobPayload): ReactElement {
|
|
63
|
+
return (
|
|
64
|
+
<BlobBody
|
|
65
|
+
payload={payload}
|
|
66
|
+
render={(url) => (
|
|
67
|
+
<Suspense
|
|
68
|
+
fallback={
|
|
69
|
+
<div
|
|
70
|
+
style={{
|
|
71
|
+
height: '100%',
|
|
72
|
+
display: 'grid',
|
|
73
|
+
placeItems: 'center',
|
|
74
|
+
fontSize: 12.5,
|
|
75
|
+
color: 'hsl(var(--ink-4))',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
Loading viewer…
|
|
79
|
+
</div>
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
<PdfPreview
|
|
83
|
+
url={url}
|
|
84
|
+
title={payload.alt ?? 'PDF preview'}
|
|
85
|
+
className="h-full w-full"
|
|
86
|
+
/>
|
|
87
|
+
</Suspense>
|
|
88
|
+
)}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* `media` — audio or video, chosen by `contentType`. The type is REQUIRED by the
|
|
95
|
+
* payload validator for this kind (see the registration): guessing between an
|
|
96
|
+
* `<audio>` and a `<video>` element from a URL would be a heuristic that fails
|
|
97
|
+
* on extension-less URLs.
|
|
98
|
+
*/
|
|
99
|
+
export function MediaSurface(payload: VistaBlobPayload): ReactElement {
|
|
100
|
+
const isAudio = (payload.contentType ?? '').startsWith('audio/');
|
|
101
|
+
return (
|
|
102
|
+
<BlobBody
|
|
103
|
+
payload={payload}
|
|
104
|
+
render={(url) => (
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
height: '100%',
|
|
108
|
+
display: 'grid',
|
|
109
|
+
placeItems: 'center',
|
|
110
|
+
padding: 16,
|
|
111
|
+
background: 'hsl(var(--paper-sunk))',
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
{isAudio ? (
|
|
115
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
116
|
+
<audio src={url} controls style={{ width: '100%', maxWidth: 520 }} />
|
|
117
|
+
) : (
|
|
118
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
119
|
+
<video
|
|
120
|
+
src={url}
|
|
121
|
+
controls
|
|
122
|
+
style={{ maxWidth: '100%', maxHeight: '100%' }}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Guards the secure-elicitation transport — the ONE place a captured field
|
|
3
|
+
* value is read out of the `form` surface.
|
|
4
|
+
*
|
|
5
|
+
* These are the load-bearing proofs of Canopy §8.4: the value goes browser →
|
|
6
|
+
* service and the only thing that comes back out is `{ submitted, ref,
|
|
7
|
+
* connectionId }`. Runs under the host-web vitest mirror (this package carries
|
|
8
|
+
* no vitest dep).
|
|
9
|
+
*/
|
|
10
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
extractServiceMessage,
|
|
14
|
+
readElicitationStatus,
|
|
15
|
+
resolveTrustedElicitationEndpoints,
|
|
16
|
+
resolveTrustedElicitationLaunchUrl,
|
|
17
|
+
submitElicitationFields,
|
|
18
|
+
VistaFormSubmitError,
|
|
19
|
+
VistaFormTransportConfigError,
|
|
20
|
+
} from './elicitation-transport';
|
|
21
|
+
|
|
22
|
+
const SERVICE_ORIGIN = 'https://connector-gateway.example.test';
|
|
23
|
+
const API_BASE_URL = `${SERVICE_ORIGIN}/credential-elicitations`;
|
|
24
|
+
const SUBMIT_URL = `${SERVICE_ORIGIN}/credential-elicitations/ref-1/submit`;
|
|
25
|
+
const STATUS_URL = `${SERVICE_ORIGIN}/credential-elicitations/ref-1`;
|
|
26
|
+
const SECRET = 'sk-live-DO-NOT-LEAK';
|
|
27
|
+
|
|
28
|
+
function jsonResponse(status: number, body: unknown): Response {
|
|
29
|
+
return new Response(JSON.stringify(body), {
|
|
30
|
+
status,
|
|
31
|
+
headers: { 'content-type': 'application/json' },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function stubFetch(response: Response): ReturnType<typeof vi.fn> {
|
|
36
|
+
const fetchMock = vi.fn().mockResolvedValue(response);
|
|
37
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
38
|
+
return fetchMock;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
vi.unstubAllGlobals();
|
|
43
|
+
vi.restoreAllMocks();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('trusted elicitation endpoint resolution', () => {
|
|
47
|
+
it('derives exact status and submit paths from the host trust anchor', () => {
|
|
48
|
+
expect(resolveTrustedElicitationEndpoints(API_BASE_URL, 'ref-1')).toEqual({
|
|
49
|
+
statusUrl: STATUS_URL,
|
|
50
|
+
submitUrl: SUBMIT_URL,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it.each([
|
|
55
|
+
['relative', '/credential-elicitations'],
|
|
56
|
+
['network-path', '//evil.example/credential-elicitations'],
|
|
57
|
+
['scheme confusion', 'javascript:https://trusted.example'],
|
|
58
|
+
[
|
|
59
|
+
'authority confusion',
|
|
60
|
+
'https://trusted.example@evil.example/credential-elicitations',
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
'query',
|
|
64
|
+
'https://trusted.example/credential-elicitations?next=https://evil.example',
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
'fragment',
|
|
68
|
+
'https://trusted.example/credential-elicitations#https://evil.example',
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
'path traversal',
|
|
72
|
+
'https://trusted.example/credential-elicitations/../evil',
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
'encoded path traversal',
|
|
76
|
+
'https://trusted.example/credential-elicitations/%2e%2e/evil',
|
|
77
|
+
],
|
|
78
|
+
])('rejects %s base URL input', (_label, apiBaseUrl) => {
|
|
79
|
+
expect(() =>
|
|
80
|
+
resolveTrustedElicitationEndpoints(apiBaseUrl, 'ref-1'),
|
|
81
|
+
).toThrow(VistaFormTransportConfigError);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('requires HTTPS for a non-local service', () => {
|
|
85
|
+
expect(() =>
|
|
86
|
+
resolveTrustedElicitationEndpoints(
|
|
87
|
+
'http://api.example.test/credential-elicitations',
|
|
88
|
+
'ref-1',
|
|
89
|
+
'http://host.example.test:8080',
|
|
90
|
+
),
|
|
91
|
+
).toThrow(/Insecure elicitation HTTP/);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('permits explicit loopback and same-host HTTP development', () => {
|
|
95
|
+
expect(
|
|
96
|
+
resolveTrustedElicitationEndpoints(
|
|
97
|
+
'http://localhost:3010/credential-elicitations',
|
|
98
|
+
'ref-1',
|
|
99
|
+
'http://localhost:8080',
|
|
100
|
+
).statusUrl,
|
|
101
|
+
).toBe('http://localhost:3010/credential-elicitations/ref-1');
|
|
102
|
+
expect(
|
|
103
|
+
resolveTrustedElicitationEndpoints(
|
|
104
|
+
'http://192.168.1.20:3010/credential-elicitations',
|
|
105
|
+
'ref-1',
|
|
106
|
+
'http://192.168.1.20:8080',
|
|
107
|
+
).statusUrl,
|
|
108
|
+
).toBe('http://192.168.1.20:3010/credential-elicitations/ref-1');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it.each(['.', '..', '../steal', 'a/b', '%2e%2e', 'réf'])(
|
|
112
|
+
'rejects unsafe ref %s before URL construction',
|
|
113
|
+
(ref) => {
|
|
114
|
+
expect(() =>
|
|
115
|
+
resolveTrustedElicitationEndpoints(API_BASE_URL, ref),
|
|
116
|
+
).toThrow(VistaFormTransportConfigError);
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
it('keeps launch paths on the trusted origin and rejects authority/traversal', () => {
|
|
121
|
+
expect(
|
|
122
|
+
resolveTrustedElicitationLaunchUrl(
|
|
123
|
+
API_BASE_URL,
|
|
124
|
+
'/oauth/acme/authorize?flow=1',
|
|
125
|
+
),
|
|
126
|
+
).toBe(`${SERVICE_ORIGIN}/oauth/acme/authorize?flow=1`);
|
|
127
|
+
|
|
128
|
+
for (const path of [
|
|
129
|
+
'https://evil.example/steal',
|
|
130
|
+
'//evil.example/steal',
|
|
131
|
+
'/oauth/../steal',
|
|
132
|
+
'/oauth/%2e%2e/steal',
|
|
133
|
+
'/oauth\\..\\steal',
|
|
134
|
+
'/oauth/start#https://evil.example',
|
|
135
|
+
]) {
|
|
136
|
+
expect(() =>
|
|
137
|
+
resolveTrustedElicitationLaunchUrl(API_BASE_URL, path),
|
|
138
|
+
).toThrow(VistaFormTransportConfigError);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('does not call fetch when the trusted base or ref is invalid', async () => {
|
|
143
|
+
const fetchMock = vi.fn();
|
|
144
|
+
vi.stubGlobal('fetch', fetchMock);
|
|
145
|
+
await expect(
|
|
146
|
+
submitElicitationFields({
|
|
147
|
+
apiBaseUrl:
|
|
148
|
+
'https://trusted.example@evil.example/credential-elicitations',
|
|
149
|
+
ref: '../steal',
|
|
150
|
+
accessToken: 'user-jwt',
|
|
151
|
+
fields: { apiKey: SECRET },
|
|
152
|
+
}),
|
|
153
|
+
).rejects.toBeInstanceOf(VistaFormTransportConfigError);
|
|
154
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe('submitElicitationFields', () => {
|
|
159
|
+
it('POSTs to the SERVICE origin directly — not a host-relative path', async () => {
|
|
160
|
+
const fetchMock = stubFetch(
|
|
161
|
+
jsonResponse(201, {
|
|
162
|
+
data: { submitted: true, ref: 'ref-1', connectionId: 'conn-9' },
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
await submitElicitationFields({
|
|
167
|
+
apiBaseUrl: API_BASE_URL,
|
|
168
|
+
ref: 'ref-1',
|
|
169
|
+
accessToken: 'user-jwt',
|
|
170
|
+
fields: { apiKey: SECRET },
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
174
|
+
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
|
175
|
+
expect(url).toBe(SUBMIT_URL);
|
|
176
|
+
expect(new URL(url).origin).toBe(SERVICE_ORIGIN);
|
|
177
|
+
expect(init.method).toBe('POST');
|
|
178
|
+
expect(init.redirect).toBe('error');
|
|
179
|
+
// The SUBJECT's own bearer — not a service token, not the agent's.
|
|
180
|
+
expect((init.headers as Record<string, string>).Authorization).toBe(
|
|
181
|
+
'Bearer user-jwt',
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('never hands a secret back to the caller, even when the service echoes it', async () => {
|
|
186
|
+
stubFetch(
|
|
187
|
+
jsonResponse(201, {
|
|
188
|
+
data: {
|
|
189
|
+
submitted: true,
|
|
190
|
+
ref: 'ref-1',
|
|
191
|
+
connectionId: 'conn-9',
|
|
192
|
+
// A hostile / careless service echoing the submission back.
|
|
193
|
+
fields: { apiKey: SECRET },
|
|
194
|
+
credentials: { apiKey: SECRET },
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const outcome = await submitElicitationFields({
|
|
200
|
+
apiBaseUrl: API_BASE_URL,
|
|
201
|
+
ref: 'ref-1',
|
|
202
|
+
accessToken: 'user-jwt',
|
|
203
|
+
fields: { apiKey: SECRET },
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// The outcome is a FRESH object with exactly three keys.
|
|
207
|
+
expect(Object.keys(outcome).sort()).toEqual([
|
|
208
|
+
'connectionId',
|
|
209
|
+
'ref',
|
|
210
|
+
'submitted',
|
|
211
|
+
]);
|
|
212
|
+
expect(outcome).toEqual({
|
|
213
|
+
submitted: true,
|
|
214
|
+
ref: 'ref-1',
|
|
215
|
+
connectionId: 'conn-9',
|
|
216
|
+
});
|
|
217
|
+
expect(JSON.stringify(outcome)).not.toContain(SECRET);
|
|
218
|
+
expect(JSON.stringify(outcome)).not.toContain('apiKey');
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('round-trips a NON-secret field to the service body', async () => {
|
|
222
|
+
const fetchMock = stubFetch(
|
|
223
|
+
jsonResponse(201, {
|
|
224
|
+
data: { submitted: true, ref: 'ref-1', connectionId: 'conn-9' },
|
|
225
|
+
}),
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
await submitElicitationFields({
|
|
229
|
+
apiBaseUrl: API_BASE_URL,
|
|
230
|
+
ref: 'ref-1',
|
|
231
|
+
accessToken: 'user-jwt',
|
|
232
|
+
fields: { baseUrl: 'https://acme.example.com', apiKey: SECRET },
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const [, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
|
236
|
+
expect(JSON.parse(init.body as string)).toEqual({
|
|
237
|
+
fields: { baseUrl: 'https://acme.example.com', apiKey: SECRET },
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('accepts a flat (un-enveloped) response body', async () => {
|
|
242
|
+
stubFetch(
|
|
243
|
+
jsonResponse(200, {
|
|
244
|
+
submitted: true,
|
|
245
|
+
ref: 'ref-1',
|
|
246
|
+
connectionId: 'conn-2',
|
|
247
|
+
}),
|
|
248
|
+
);
|
|
249
|
+
await expect(
|
|
250
|
+
submitElicitationFields({
|
|
251
|
+
apiBaseUrl: API_BASE_URL,
|
|
252
|
+
ref: 'ref-1',
|
|
253
|
+
accessToken: 't',
|
|
254
|
+
fields: {},
|
|
255
|
+
}),
|
|
256
|
+
).resolves.toEqual({
|
|
257
|
+
submitted: true,
|
|
258
|
+
ref: 'ref-1',
|
|
259
|
+
connectionId: 'conn-2',
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("surfaces the backend's empty-schema 400 as a usable message", async () => {
|
|
264
|
+
stubFetch(
|
|
265
|
+
jsonResponse(400, {
|
|
266
|
+
statusCode: 400,
|
|
267
|
+
message:
|
|
268
|
+
'No credential form is declared for a connection to "ACME" — there is nothing to validate ' +
|
|
269
|
+
'the submitted values against, so they cannot be stored.',
|
|
270
|
+
}),
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
// An empty field schema submits an empty map; the SERVICE is the authority.
|
|
274
|
+
const promise = submitElicitationFields({
|
|
275
|
+
apiBaseUrl: API_BASE_URL,
|
|
276
|
+
ref: 'ref-1',
|
|
277
|
+
accessToken: 'user-jwt',
|
|
278
|
+
fields: {},
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
await expect(promise).rejects.toBeInstanceOf(VistaFormSubmitError);
|
|
282
|
+
await expect(promise).rejects.toThrow(/No credential form is declared/);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('refuses a 2xx that does not report the elicitation as submitted', async () => {
|
|
286
|
+
stubFetch(jsonResponse(200, { data: { ref: 'ref-1' } }));
|
|
287
|
+
await expect(
|
|
288
|
+
submitElicitationFields({
|
|
289
|
+
apiBaseUrl: API_BASE_URL,
|
|
290
|
+
ref: 'ref-1',
|
|
291
|
+
accessToken: 't',
|
|
292
|
+
fields: {},
|
|
293
|
+
}),
|
|
294
|
+
).rejects.toThrow(/did not report the elicitation as submitted/);
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
describe('readElicitationStatus', () => {
|
|
299
|
+
it('returns null while pending — an explicit "not yet", never a guess', async () => {
|
|
300
|
+
stubFetch(
|
|
301
|
+
jsonResponse(200, {
|
|
302
|
+
data: { ref: 'ref-1', status: 'pending', connectionId: null },
|
|
303
|
+
}),
|
|
304
|
+
);
|
|
305
|
+
await expect(
|
|
306
|
+
readElicitationStatus({
|
|
307
|
+
apiBaseUrl: API_BASE_URL,
|
|
308
|
+
ref: 'ref-1',
|
|
309
|
+
accessToken: 't',
|
|
310
|
+
}),
|
|
311
|
+
).resolves.toBeNull();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('settles on the service-reported submitted status', async () => {
|
|
315
|
+
stubFetch(
|
|
316
|
+
jsonResponse(200, {
|
|
317
|
+
data: { ref: 'ref-1', status: 'submitted', connectionId: 'conn-3' },
|
|
318
|
+
}),
|
|
319
|
+
);
|
|
320
|
+
await expect(
|
|
321
|
+
readElicitationStatus({
|
|
322
|
+
apiBaseUrl: API_BASE_URL,
|
|
323
|
+
ref: 'ref-1',
|
|
324
|
+
accessToken: 't',
|
|
325
|
+
}),
|
|
326
|
+
).resolves.toEqual({
|
|
327
|
+
submitted: true,
|
|
328
|
+
ref: 'ref-1',
|
|
329
|
+
connectionId: 'conn-3',
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it('GETs the service origin with the subject bearer', async () => {
|
|
334
|
+
const fetchMock = stubFetch(
|
|
335
|
+
jsonResponse(200, { data: { ref: 'ref-1', status: 'pending' } }),
|
|
336
|
+
);
|
|
337
|
+
await readElicitationStatus({
|
|
338
|
+
apiBaseUrl: API_BASE_URL,
|
|
339
|
+
ref: 'ref-1',
|
|
340
|
+
accessToken: 'user-jwt',
|
|
341
|
+
});
|
|
342
|
+
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
|
343
|
+
expect(new URL(url).origin).toBe(SERVICE_ORIGIN);
|
|
344
|
+
expect(init.method).toBe('GET');
|
|
345
|
+
expect(init.redirect).toBe('error');
|
|
346
|
+
expect((init.headers as Record<string, string>).Authorization).toBe(
|
|
347
|
+
'Bearer user-jwt',
|
|
348
|
+
);
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
describe('extractServiceMessage', () => {
|
|
353
|
+
it('reads a string message, a message array, and a nested error message', () => {
|
|
354
|
+
expect(extractServiceMessage({ message: 'nope' }, 400)).toBe('nope');
|
|
355
|
+
expect(extractServiceMessage({ message: ['a', 'b'] }, 400)).toBe('a b');
|
|
356
|
+
expect(extractServiceMessage({ error: { message: 'deep' } }, 400)).toBe(
|
|
357
|
+
'deep',
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('never yields an empty string', () => {
|
|
362
|
+
expect(extractServiceMessage(null, 503)).toBe(
|
|
363
|
+
'The service rejected the submission (HTTP 503).',
|
|
364
|
+
);
|
|
365
|
+
expect(extractServiceMessage({ message: '' }, 500)).toBe(
|
|
366
|
+
'The service rejected the submission (HTTP 500).',
|
|
367
|
+
);
|
|
368
|
+
});
|
|
369
|
+
});
|