@salsita-ai/sdk 0.50.0-develop.f81ab6ac76 → 0.50.0-develop.f9cd9b3a12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application-spec/errors/diagnostic-codes.d.ts +9 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +10 -1
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/application-types.js +6 -6
- package/dist/application-spec/generate-application/code/templates/common/doc-comment.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/common/doc-comment.js +1 -0
- package/dist/application-spec/generate-application/code/templates/configurator-globals.d.ts +2 -1
- package/dist/application-spec/generate-application/code/templates/configurator-globals.js +19 -6
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +7 -7
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.d.ts +12 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.js +7 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +24 -22
- package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +13 -6
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +33 -3
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.d.ts +9 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.js +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +4 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/app-loader-content/DefaultAppLoaderContent.d.ts +2 -0
- package/dist/configurator/app-loader-content/DefaultAppLoaderContent.js +5 -0
- package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +5 -0
- package/dist/configurator/app-loader-content/app-loader-content-name.js +1 -0
- package/dist/configurator/app-loader-content/index.d.ts +2 -0
- package/dist/configurator/app-loader-content/index.js +1 -0
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +4 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +33 -7
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.d.ts +1 -1
- package/dist/configurator/application-runtime/extensions/systems/canvas-system.d.ts +8 -0
- package/dist/configurator/application-runtime/extensions/systems/canvas-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.d.ts +8 -0
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts +23 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +14 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +45 -4
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.d.ts +14 -5
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +112 -4
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.d.ts +9 -0
- package/dist/configurator/configuration-not-found-page/create-configuration-not-found-page.js +1 -0
- package/dist/configurator/configuration-not-found-page/index.d.ts +1 -0
- package/dist/configurator/configuration-not-found-page/index.js +1 -1
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.d.ts +12 -0
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.js +1 -0
- package/dist/configurator/configurator-context/PreviewContextProvider.js +1 -1
- package/dist/configurator/configurator-context/ViewportStateSync.d.ts +2 -2
- package/dist/configurator/configurator-context/ViewportStateSync.js +1 -1
- package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.d.ts +10 -0
- package/dist/configurator/configurator-context/configurator-routing/ConfiguratorRoutingProvider.js +1 -1
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +6 -0
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -0
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +12 -0
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -0
- package/dist/configurator/configurator-error-page/create-configurator-error-page.d.ts +9 -0
- package/dist/configurator/configurator-error-page/create-configurator-error-page.js +1 -0
- package/dist/configurator/configurator-error-page/index.d.ts +3 -0
- package/dist/configurator/configurator-error-page/index.js +1 -0
- package/dist/configurator/index.d.ts +3 -0
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/pages/ConfiguratorErrorPage.d.ts +0 -1
- package/dist/configurator/pages/ConfiguratorErrorPage.js +1 -1
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.d.ts +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.js +1 -1
- package/dist/configurator/pages/default-configurator-elements.d.ts +4 -2
- package/dist/configurator/pages/default-configurator-elements.js +1 -1
- package/dist/configurator/pages/default-elements/index.d.ts +1 -0
- package/dist/configurator/pages/default-elements/index.js +1 -1
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/index.d.ts +6 -0
- package/dist/configurator/pages/default-elements/scene-controls/index.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.d.ts +6 -0
- package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.js +1 -0
- package/dist/configurator/pages/error-boundaries/GeneralErrorBoundary.js +1 -1
- package/dist/configurator/scene/index.d.ts +1 -0
- package/dist/configurator/scene/index.js +1 -1
- package/dist/configurator/scene/scene-controls/ToolFab.d.ts +4 -0
- package/dist/configurator/scene/scene-controls/ToolFab.js +1 -1
- package/dist/configurator/scene/scene-controls/use-scene-control-tooltip.d.ts +2 -1
- package/dist/configurator/scene/scene-entity/scene-controls/SceneEntityHtmlHotspots.js +1 -1
- package/dist/configurator/toolbar-actions/index.d.ts +3 -0
- package/dist/configurator/toolbar-actions/index.js +1 -0
- package/dist/configurator/toolbar-actions/use-assistant-panel.d.ts +18 -0
- package/dist/configurator/toolbar-actions/use-assistant-panel.js +1 -0
- package/dist/configurator/toolbar-actions/use-measurements.d.ts +35 -0
- package/dist/configurator/toolbar-actions/use-measurements.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.d.ts +100 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-help.d.ts +7 -0
- package/dist/configurator/toolbar-actions/use-toolbar-help.js +1 -0
- package/dist/configurator/ui/assistant/AssistantChips.d.ts +3 -2
- package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
- package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +1 -1
- package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
- package/dist/configurator/ui/assistant/alert/AssistantAlert.d.ts +8 -0
- package/dist/configurator/ui/assistant/alert/AssistantAlert.js +1 -0
- package/dist/configurator/ui/assistant/alert/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/alert/index.js +1 -0
- package/dist/configurator/ui/assistant/alert/remark-alerts.d.ts +10 -0
- package/dist/configurator/ui/assistant/alert/remark-alerts.js +1 -0
- package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -1
- package/dist/configurator/ui/assistant/form/compose-answer.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/compose-answer.js +1 -1
- package/dist/configurator/ui/assistant/form/form-model.d.ts +3 -4
- package/dist/configurator/ui/assistant/form/form-state.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/form/index.js +1 -1
- package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +3 -2
- package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -1
- package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -1
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.d.ts +3 -0
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +31 -0
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.js +1 -0
- package/dist/configurator/ui/assistant/form/{form-element-definition.d.ts → registry/form-element-definition.d.ts} +3 -1
- package/dist/configurator/ui/assistant/form/registry/form-element-definition.js +1 -0
- package/dist/configurator/ui/assistant/form/{form-registry.d.ts → registry/form-registry.d.ts} +2 -2
- package/dist/configurator/ui/assistant/form/registry/form-registry.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/index.d.ts +6 -0
- package/dist/configurator/ui/assistant/form/registry/index.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/use-form-registry.d.ts +8 -0
- package/dist/configurator/ui/assistant/form/registry/use-form-registry.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormCard.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormCard.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +4 -1
- package/dist/configurator/ui/assistant/form-elements/FormNumber.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormNumber.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +4 -1
- package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +4 -1
- package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.d.ts +10 -0
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +4 -1
- package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/clamp-form-number.d.ts +10 -0
- package/dist/configurator/ui/assistant/form-elements/clamp-form-number.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +20 -16
- package/dist/configurator/ui/assistant/form-elements/index.d.ts +4 -0
- package/dist/configurator/ui/assistant/form-elements/index.js +1 -1
- package/dist/configurator/ui/assistant/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/index.js +1 -1
- package/dist/configurator/ui/assistant/resource-image/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/resource-image/index.js +1 -1
- package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +0 -9
- package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +9 -0
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -0
- package/dist/configurator/ui/assistant/screenshots/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/screenshots/index.js +1 -0
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +14 -0
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -0
- package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -2
- package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
- package/dist/configurator/ui/assistant/tool-chip.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.d.ts +5 -0
- package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +1 -1
- package/dist/configurator/ui/index.d.ts +1 -0
- package/dist/configurator/ui/index.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -6
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LanguageMenuAction.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LanguageToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/MeasurementsMenuAction.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/MeasurementsToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/ShareToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/DesktopNavigationSteps.d.ts +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/DesktopNavigationSteps.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.d.ts +2 -8
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/DimensionUnitSelector.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/MeasurementsIndicatorsSwitch.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/share/ShareModal.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/share/use-share.d.ts +7 -8
- package/dist/configurator/ui/phoenix-layout-elements/share/use-share.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/FinalizeActions.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/NextStepButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -1
- package/dist/docs/complex-use-cases/focus-mode.mdx +2 -0
- package/dist/docs/fabs/basic.mdx +4 -0
- package/dist/docs/index.json +62 -1
- package/dist/docs/integrations/webcomponent-api/basics.mdx +2 -0
- package/dist/docs/layouts/custom-layout.mdx +321 -159
- package/dist/docs/layouts/gallery/ardent-compressor.mdx +3516 -0
- package/dist/docs/layouts/gallery/fenwick-window.mdx +2803 -0
- package/dist/docs/layouts/gallery/ferrule-bar-station.mdx +6567 -0
- package/dist/docs/layouts/gallery/kestrel-kettle.mdx +1858 -0
- package/dist/docs/layouts/gallery/sunfold-solar.mdx +2683 -0
- package/dist/docs/other-features/client-side-rendering/declarative.mdx +1 -1
- package/dist/docs/other-features/error-5xx.mdx +1 -1
- package/dist/docs/other-features/navigation-hotspot.mdx +2 -0
- package/dist/docs/other-features/not-found-404.mdx +1 -1
- package/dist/docs/phoenix/configurator-interface.mdx +200 -66
- package/dist/docs/phoenix/finalization.mdx +1 -1
- package/dist/docs/phoenix/layout-slots.mdx +5 -5
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +1 -1
- package/dist/docs/phoenix/sessions-and-access.mdx +2 -0
- package/dist/docs/phoenix/testing.mdx +2 -2
- package/dist/docs/selection-and-highlight/hotspots.mdx +2 -0
- package/dist/domain/application/assistant/assistant-manifest.d.ts +16 -1
- package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +8 -1
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/form/assistant-form-element-name.d.ts +11 -0
- package/dist/domain/application/assistant/form/assistant-form-element-name.js +8 -0
- package/dist/domain/application/assistant/form/assistant-form-elements.d.ts +174 -0
- package/dist/domain/application/assistant/form/assistant-form-elements.js +1 -0
- package/dist/domain/application/assistant/form/assistant-resource-path.d.ts +10 -0
- package/dist/domain/application/assistant/form/assistant-resource-path.js +1 -0
- package/dist/domain/application/assistant/form/index.d.ts +4 -0
- package/dist/domain/application/assistant/form/index.js +1 -0
- package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +3 -0
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +2 -3
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +2 -0
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
- package/dist/domain/application/web-component-property.d.ts +3 -1
- package/dist/domain/application/web-component-property.js +1 -1
- package/dist/domain/available-system-components.d.ts +1 -1
- package/dist/domain/available-system-components.js +1 -1
- package/dist/domain/domain-context/store-system/store-system.d.ts +5 -0
- package/dist/domain/domain-context/store-system/store-system.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +8 -0
- package/dist/domain/domain-runtime/environment/types.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +15 -1
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.d.ts +12 -0
- package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +2 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
- package/dist/domain/domain-runtime/spec/selectors.d.ts +3 -1
- package/dist/domain/domain-runtime/spec/selectors.js +1 -1
- package/dist/domain/extensions/export-images/agent-screenshot.d.ts +24 -0
- package/dist/domain/extensions/export-images/agent-screenshot.js +1 -0
- package/dist/domain/extensions/{client-side-image.d.ts → export-images/client-side-image.d.ts} +2 -2
- package/dist/domain/extensions/export-images/client-side-image.js +1 -0
- package/dist/domain/extensions/export-images/index.d.ts +3 -0
- package/dist/domain/extensions/export-images/index.js +1 -0
- package/dist/domain/extensions/{save-template-thumbnail.d.ts → export-images/save-template-thumbnail.d.ts} +2 -2
- package/dist/domain/extensions/export-images/save-template-thumbnail.js +1 -0
- package/dist/domain/extensions/index.d.ts +1 -2
- package/dist/domain/extensions/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +4 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.d.ts +8 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/editor/screenshot/ScreenshotHandler.js +1 -1
- package/dist/i18n/locales/cs/messages.js +1 -1
- package/dist/i18n/locales/da/messages.js +1 -1
- package/dist/i18n/locales/de/messages.js +1 -1
- package/dist/i18n/locales/de-AT/messages.js +1 -1
- package/dist/i18n/locales/en/messages.js +1 -1
- package/dist/i18n/locales/en-AU/messages.js +1 -1
- package/dist/i18n/locales/en-GB/messages.js +1 -1
- package/dist/i18n/locales/es/messages.js +1 -1
- package/dist/i18n/locales/fr/messages.js +1 -1
- package/dist/i18n/locales/hu/messages.js +1 -1
- package/dist/i18n/locales/it/messages.js +1 -1
- package/dist/i18n/locales/nl/messages.js +1 -1
- package/dist/i18n/locales/pl/messages.js +1 -1
- package/dist/i18n/locales/pt/messages.js +1 -1
- package/dist/i18n/locales/ro/messages.js +1 -1
- package/dist/i18n/locales/sk/messages.js +1 -1
- package/dist/i18n/locales/tr/messages.js +1 -1
- package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
- package/dist/legacy/domain-cli/utils/cache.js +1 -1
- package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +16 -0
- package/dist/legacy/domain-spec/spec/domain-spec.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +11 -5
- package/dist/react-sdk/application-runtime/common-services/analytics/frontend-analytics.d.ts +4 -0
- package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/responsive/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +26 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.d.ts +10 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-phoenix-element-slots.d.ts +2 -1
- package/dist/react-sdk/application-runtime/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/integration/initialize.d.ts +7 -6
- package/dist/react-sdk/application-runtime/integration/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/integration/selectors.d.ts +11 -2
- package/dist/react-sdk/application-runtime/integration/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/integration/types.d.ts +5 -2
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/actions.d.ts +47 -0
- package/dist/react-sdk/application-runtime/responsive/actions.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.d.ts +20 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/types.d.ts +104 -0
- package/dist/react-sdk/application-runtime/routing/routing-service.d.ts +34 -2
- package/dist/react-sdk/application-runtime/routing/routing-service.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +95 -2
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/index.d.ts +9 -0
- package/dist/react-sdk/domain-context/common-hooks/index.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.d.ts +23 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/domain-context/component-hooks/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/component-hooks/index.js +1 -0
- package/dist/react-sdk/domain-context/component-hooks/use-component.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-domain-entity-state.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-entity-price.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-id.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-state.js +1 -1
- package/dist/react-sdk/domain-context/index.d.ts +5 -0
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/composition-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/dimension-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.d.ts +8 -0
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/hover-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.d.ts +24 -0
- package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/selection-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.d.ts +32 -0
- package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/step-navigation-hooks.d.ts +57 -0
- package/dist/react-sdk/domain-context/system-hooks/step-navigation-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/tab-navigation-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.js +1 -1
- package/dist/react-sdk/elements/configurator-error-page-props.d.ts +20 -0
- package/dist/react-sdk/elements/configurator-error-page-props.js +1 -0
- package/dist/react-sdk/elements/index.d.ts +1 -0
- package/dist/react-sdk/handlers/FinalizeActionRunner.d.ts +13 -0
- package/dist/react-sdk/handlers/FinalizeActionRunner.js +1 -0
- package/dist/react-sdk/handlers/FinalizeActionsHost.d.ts +10 -0
- package/dist/react-sdk/handlers/FinalizeActionsHost.js +1 -0
- package/dist/react-sdk/handlers/FinalizeActionsProvider.d.ts +11 -0
- package/dist/react-sdk/handlers/FinalizeActionsProvider.js +1 -0
- package/dist/react-sdk/handlers/finalize-actions-context.d.ts +6 -0
- package/dist/react-sdk/handlers/finalize-actions-context.js +1 -0
- package/dist/react-sdk/handlers/finalize-actions-store.d.ts +23 -0
- package/dist/react-sdk/handlers/finalize-actions-store.js +1 -0
- package/dist/react-sdk/handlers/index.d.ts +5 -0
- package/dist/react-sdk/handlers/index.js +1 -1
- package/dist/react-sdk/handlers/use-finalize-action.d.ts +3 -2
- package/dist/react-sdk/handlers/use-finalize-action.js +1 -1
- package/dist/react-sdk/handlers/use-finalize-actions.d.ts +53 -0
- package/dist/react-sdk/handlers/use-finalize-actions.js +1 -0
- package/dist/react-sdk/index.d.ts +1 -0
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/loading-state/loading-state-manager.d.ts +5 -0
- package/dist/react-sdk/loading-state/loading-state-manager.js +1 -1
- package/dist/react-sdk/scene-control-elements/AddEntityFabElement.d.ts +36 -0
- package/dist/react-sdk/scene-control-elements/AddEntityFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.d.ts +44 -0
- package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.d.ts +38 -0
- package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.d.ts +30 -0
- package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.d.ts +30 -0
- package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-add-entity-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-add-entity-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.d.ts +10 -0
- package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-selection-hotspot.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-selection-hotspot.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/index.d.ts +11 -0
- package/dist/react-sdk/scene-control-elements/index.js +1 -0
- package/dist/react-sdk/scene-control-elements/scene-control-tooltip-visibility.d.ts +5 -0
- package/dist/react-sdk/scene-control-elements/scene-control-tooltip-visibility.js +1 -0
- package/dist/react-sdk/web-component/create-web-component.js +1 -1
- package/dist/react-sdk/web-component/god-mode/god-mode-registry.d.ts +30 -0
- package/dist/react-sdk/web-component/god-mode/god-mode-registry.js +1 -0
- package/dist/react-sdk/web-component/god-mode/index.d.ts +1 -0
- package/dist/react-sdk/web-component/god-mode/index.js +1 -0
- package/dist/ui-sdk/icons/__generated/Lightbulb.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/Lightbulb.js +1 -0
- package/dist/ui-sdk/icons/__generated/XCircle.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/XCircle.js +1 -0
- package/dist/ui-sdk/icons/__generated/index.d.ts +4 -0
- package/dist/ui-sdk/icons/__generated/index.js +1 -1
- package/dist/ui-sdk/icons/icons-registry.js +1 -1
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.d.ts +9 -0
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.js +1 -1
- package/dist/ui-sdk/responsive-application/index.d.ts +1 -0
- package/dist/ui-sdk/responsive-application/responsive-state-store.d.ts +59 -0
- package/dist/ui-sdk/responsive-application/responsive-state-store.js +1 -0
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.d.ts +7 -0
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.js +1 -0
- package/dist/ui-sdk/theme/types.d.ts +5 -1
- package/package.json +13 -3
- package/schema/domain-spec.json +140 -0
- package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +0 -10
- package/dist/configurator/ui/assistant/form/built-in-form-registry.js +0 -1
- package/dist/configurator/ui/assistant/form/form-registry.js +0 -8
- package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.d.ts +0 -4
- package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.js +0 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.d.ts +0 -4
- package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.js +0 -1
- package/dist/domain/application/assistant/assistant-form-elements.d.ts +0 -28
- package/dist/domain/application/assistant/assistant-form-elements.js +0 -1
- package/dist/domain/extensions/client-side-image.js +0 -1
- package/dist/domain/extensions/save-template-thumbnail.js +0 -1
- package/dist/react-sdk/application-runtime/runtime/god-mode.d.ts +0 -19
- package/dist/react-sdk/application-runtime/runtime/god-mode.js +0 -1
- /package/dist/{configurator/ui/assistant/form/form-element-definition.js → react-sdk/application-runtime/responsive/types.js} +0 -0
|
@@ -8,6 +8,7 @@ Make the configurator look like the brand's own product page. A furniture shop w
|
|
|
8
8
|
- [Read and change the product](#read-and-change-the-product)
|
|
9
9
|
- [Draw the choices](#draw-the-choices)
|
|
10
10
|
- [Offer fullscreen](#offer-fullscreen)
|
|
11
|
+
- [Undo and redo](#undo-and-redo)
|
|
11
12
|
- [Show messages](#show-messages)
|
|
12
13
|
- [Request a quote](#request-a-quote)
|
|
13
14
|
- [Serve read mode](#serve-read-mode)
|
|
@@ -27,7 +28,7 @@ Write your own layout when the configurator has to follow a design the built-in
|
|
|
27
28
|
|
|
28
29
|
Stay with the built-in layout when its structure fits and only its parts change. [Universal](?path=/docs/layouts-universal--docs) demonstrates that layout, and the pages of its parts describe what the spec configures: [Header](?path=/docs/layouts-header-floating--docs), [Sidebar](?path=/docs/layouts-sidebar-general--docs), [Sidebar Footer](?path=/docs/layouts-sidebar-footer-basic--docs), [Toolbar](?path=/docs/layouts-toolbar--docs) and [View Controls](?path=/docs/layouts-view-controls--docs).
|
|
29
30
|
|
|
30
|
-
A project layout replaces all of that. None of the built-in sidebar, footer, toolbar or property pages is rendered for it, so the layout builds every control the user needs. This example uses no SDK component that draws UI: only the scene
|
|
31
|
+
A project layout replaces all of that. None of the built-in sidebar, footer, toolbar or property pages is rendered for it, so the layout builds every control the user needs. This example uses no SDK component that draws UI: only the scene and the `phx.frontend` hooks that measure the free area, read and change the product's state and record analytics. A layout may also mount the SDK's own pieces where it wants them, see [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui).
|
|
31
32
|
|
|
32
33
|
## Register the layout
|
|
33
34
|
|
|
@@ -37,8 +38,7 @@ Create `src/elements/ConfiguratorLayout.tsx` with a default export made by `phx.
|
|
|
37
38
|
import { Box } from '@mui/material'
|
|
38
39
|
import { useState } from 'react'
|
|
39
40
|
|
|
40
|
-
import { LayoutSlots
|
|
41
|
-
import { useActiveViewports } from '@salsita-ai/sdk/react'
|
|
41
|
+
import { LayoutSlots } from '@salsita-ai/sdk/configurator'
|
|
42
42
|
|
|
43
43
|
import { phx } from '../../.phoenix/phx.js'
|
|
44
44
|
import { BottomSheet } from '../_shared/BottomSheet.js'
|
|
@@ -46,6 +46,7 @@ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
|
|
|
46
46
|
import { MessageToast } from '../_shared/MessageToast.js'
|
|
47
47
|
import { ProductPanel } from '../_shared/ProductPanel.js'
|
|
48
48
|
import { SceneControls } from '../_shared/SceneControls.js'
|
|
49
|
+
import { UndoRedo } from '../_shared/UndoRedo.js'
|
|
49
50
|
|
|
50
51
|
const GUTTER = 24
|
|
51
52
|
const PANEL_WIDTH = 380
|
|
@@ -53,10 +54,10 @@ const PHONE_GUTTER = 16
|
|
|
53
54
|
const TOUCH_TARGET = 44
|
|
54
55
|
|
|
55
56
|
const ConfiguratorLayout = () => {
|
|
56
|
-
const { containerRef, safeAreaRef } = useSceneSafeArea()
|
|
57
|
+
const { containerRef, safeAreaRef } = phx.frontend.useSceneSafeArea()
|
|
57
58
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
58
59
|
// `null` until the container has been measured; the layout shows only the scene until then
|
|
59
|
-
const viewports = useActiveViewports()
|
|
60
|
+
const viewports = phx.frontend.useActiveViewports()
|
|
60
61
|
const [isSheetOpen, setSheetOpen] = useState(false)
|
|
61
62
|
|
|
62
63
|
const isDesktop = viewports?.includes('desktop') ?? false
|
|
@@ -115,8 +116,16 @@ const ConfiguratorLayout = () => {
|
|
|
115
116
|
>
|
|
116
117
|
<Box
|
|
117
118
|
component="div"
|
|
118
|
-
sx={{
|
|
119
|
+
sx={{
|
|
120
|
+
position: 'absolute',
|
|
121
|
+
insetBlockStart: gutter,
|
|
122
|
+
insetInlineEnd: gutter,
|
|
123
|
+
display: 'flex',
|
|
124
|
+
gap: 1,
|
|
125
|
+
pointerEvents: 'auto',
|
|
126
|
+
}}
|
|
119
127
|
>
|
|
128
|
+
{!isFullscreen && <UndoRedo />}
|
|
120
129
|
<FullscreenToggle compact={!isDesktop} />
|
|
121
130
|
</Box>
|
|
122
131
|
<Box
|
|
@@ -124,11 +133,11 @@ const ConfiguratorLayout = () => {
|
|
|
124
133
|
sx={{
|
|
125
134
|
position: 'absolute',
|
|
126
135
|
pointerEvents: 'auto',
|
|
127
|
-
// Desktop: bottom left, above the row of view controls. Phone: at the top
|
|
128
|
-
// clear of the sheet's handle and the view controls.
|
|
136
|
+
// Desktop: bottom left, above the row of view controls. Phone: at the top below the row of undo, redo and
|
|
137
|
+
// fullscreen, clear of the sheet's handle and the view controls.
|
|
129
138
|
...(isDesktop
|
|
130
139
|
? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
|
|
131
|
-
: { insetBlockStart: gutter
|
|
140
|
+
: { insetBlockStart: gutter + TOUCH_TARGET + gutter / 2, insetInline: gutter }),
|
|
132
141
|
}}
|
|
133
142
|
>
|
|
134
143
|
<MessageToast />
|
|
@@ -164,13 +173,13 @@ The components it uses live in `src/_shared/`, which Phoenix does not import by
|
|
|
164
173
|
## What the layout has to do
|
|
165
174
|
|
|
166
175
|
- **Position the root and cover the page.** `LayoutSlots.SharedCanvas` is absolutely positioned and fills its nearest positioned ancestor. The root here is `position: absolute; inset: 0`.
|
|
167
|
-
- **Mount the shared canvas.**
|
|
176
|
+
- **Mount the shared canvas.** It renders the scene, and the app loader stays on screen until the scene has loaded. A layout without a canvas is not held by the loader: it leaves once the configuration is up.
|
|
168
177
|
- **Put the UI above the canvas.** The canvas is opaque. Content that is positioned and comes after it in the markup is painted above it; unpositioned content is painted under it and cannot be seen.
|
|
169
|
-
- **Tell the camera where the free area is.** `useSceneSafeArea()` returns two refs. `containerRef` goes on the element that covers the whole canvas, `safeAreaRef` on the region the product should stay visible in, here everything right of the panel, or above the sheet on a phone. The camera then frames the product in that region. The hook measures again whenever either of the two elements resizes; for a change no resize reports, such as a `transform` on an ancestor settling at the end of an animation, it also returns `update` to call. Without the two refs the product is centred in the whole canvas and sits against the panel.
|
|
178
|
+
- **Tell the camera where the free area is.** `phx.frontend.useSceneSafeArea()` returns two refs. `containerRef` goes on the element that covers the whole canvas, `safeAreaRef` on the region the product should stay visible in, here everything right of the panel, or above the sheet on a phone. The camera then frames the product in that region. The hook measures again whenever either of the two elements resizes; for a change no resize reports, such as a `transform` on an ancestor settling at the end of an animation, it also returns `update` to call. Without the two refs the product is centred in the whole canvas and sits against the panel.
|
|
170
179
|
- **Let the pointer through.** The safe-area element lies over the canvas, so it sets `pointerEvents: 'none'`; otherwise the scene cannot be orbited. The fullscreen button inside it switches pointer events back on.
|
|
171
180
|
- **Honour fullscreen.** Fullscreen is a flag in the product's state, not a browser feature. The layout reads it with `phx.frontend.useIsFullscreenActive()`, removes the panel or the sheet and lets the safe area cover the canvas, so the camera frames the product in the whole canvas.
|
|
172
|
-
- **Fit the width it is given.** The configurator can be embedded in a narrow column or opened on a phone. The layout reads the container's width class with `useActiveViewports()` and renders a desktop or a phone arrangement, see [Fit a phone](#fit-a-phone).
|
|
173
|
-
- **Serve read mode.** The same element renders a configuration shared for viewing, and the layout decides what a viewer sees.
|
|
181
|
+
- **Fit the width it is given.** The configurator can be embedded in a narrow column or opened on a phone. The layout reads the container's width class with `phx.frontend.useActiveViewports()` and renders a desktop or a phone arrangement, see [Fit a phone](#fit-a-phone).
|
|
182
|
+
- **Serve read mode.** The same element renders a configuration shared for viewing, or one the host page opens read-only, and the layout decides what a viewer sees; see [Serve read mode](#serve-read-mode).
|
|
174
183
|
|
|
175
184
|
## Read and change the product
|
|
176
185
|
|
|
@@ -179,8 +188,7 @@ The panel reads everything it shows from hooks and writes the customer's choice
|
|
|
179
188
|
```tsx
|
|
180
189
|
import { Box, Button, Typography } from '@mui/material'
|
|
181
190
|
|
|
182
|
-
import { detailComponent
|
|
183
|
-
import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
|
|
191
|
+
import { detailComponent } from '@salsita-ai/sdk/domain'
|
|
184
192
|
|
|
185
193
|
import { phx } from '../../.phoenix/phx.js'
|
|
186
194
|
import { EdgeFinishCards } from './EdgeFinishCards.js'
|
|
@@ -196,7 +204,7 @@ interface ProductPanelProps {
|
|
|
196
204
|
}
|
|
197
205
|
|
|
198
206
|
export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
|
|
199
|
-
const resolve = useResolveLocalizable()
|
|
207
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
200
208
|
const detail = phx.frontend.useFirstRootComponent(detailComponent)
|
|
201
209
|
const price = phx.frontend.useRootEntityPrice()
|
|
202
210
|
const tableId = phx.frontend.useRootEntityId()
|
|
@@ -206,12 +214,9 @@ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPane
|
|
|
206
214
|
const pushNavigate = phx.frontend.usePushNavigate()
|
|
207
215
|
const popNavigate = phx.frontend.usePopNavigate()
|
|
208
216
|
const navigate = phx.frontend.useNavigate()
|
|
209
|
-
const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
|
|
210
217
|
|
|
211
218
|
const isReadMode = accessInfo.viewMode
|
|
212
219
|
const isReview = isReadMode || navigationState !== 'configure'
|
|
213
|
-
// The spec's primary finalize action, or its first one
|
|
214
|
-
const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
|
|
215
220
|
const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
|
|
216
221
|
|
|
217
222
|
return (
|
|
@@ -289,19 +294,7 @@ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPane
|
|
|
289
294
|
<Typography variant="body2" color="text.secondary">
|
|
290
295
|
Your table is ready for a quote. A real shop collects the contact details here.
|
|
291
296
|
</Typography>
|
|
292
|
-
{
|
|
293
|
-
<PhoenixHandlerBoundary name={quoteAction.state.handler}>
|
|
294
|
-
<ReviewActions
|
|
295
|
-
handler={quoteAction.state.handler}
|
|
296
|
-
label={resolve(quoteAction.state.label)}
|
|
297
|
-
onBack={popNavigate}
|
|
298
|
-
/>
|
|
299
|
-
</PhoenixHandlerBoundary>
|
|
300
|
-
) : (
|
|
301
|
-
<Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
|
|
302
|
-
Back to the configuration
|
|
303
|
-
</Button>
|
|
304
|
-
)}
|
|
297
|
+
<ReviewActions onBack={popNavigate} />
|
|
305
298
|
</>
|
|
306
299
|
)}
|
|
307
300
|
{!isReadMode && navigationState === 'requested' && (
|
|
@@ -320,26 +313,26 @@ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPane
|
|
|
320
313
|
}
|
|
321
314
|
```
|
|
322
315
|
|
|
323
|
-
| Hook | What the layout uses it for
|
|
324
|
-
| ---------------------------------------------------------------------------- |
|
|
325
|
-
| `phx.frontend.useFirstRootComponent(detailComponent)` | The `detail` component of the root entity: name, subtitle and description. `detailComponent` comes from `@salsita-ai/sdk/domain`; the hook returns `null` without one.
|
|
326
|
-
| `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take.
|
|
327
|
-
| `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`.
|
|
328
|
-
| `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one.
|
|
329
|
-
| `phx.frontend.
|
|
330
|
-
| `phx.frontend.
|
|
331
|
-
| `phx.frontend.
|
|
332
|
-
| `phx.frontend.
|
|
333
|
-
| `phx.frontend.
|
|
334
|
-
| `phx.frontend.
|
|
335
|
-
| `phx.frontend.
|
|
336
|
-
| `phx.frontend.
|
|
337
|
-
| `phx.frontend.
|
|
338
|
-
| `phx.frontend.
|
|
339
|
-
| `useActiveViewports()`
|
|
340
|
-
| `phx.frontend.
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
316
|
+
| Hook | What the layout uses it for |
|
|
317
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
318
|
+
| `phx.frontend.useFirstRootComponent(detailComponent)` | The `detail` component of the root entity: name, subtitle and description. `detailComponent` comes from `@salsita-ai/sdk/domain`; the hook returns `null` without one. |
|
|
319
|
+
| `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take. |
|
|
320
|
+
| `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`. |
|
|
321
|
+
| `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one. |
|
|
322
|
+
| `phx.frontend.useResolveLocalizable()` | Turns the localizable texts of the spec into strings in the current language. [Localization](?path=/docs/phoenix-localization--docs) describes it, `phx.frontend.useLocalizable(text)` and `LocalizableMessage`. |
|
|
323
|
+
| `phx.frontend.useAccessService()` | `accessInfo.viewMode` is `true` while a configuration shared for viewing is open, and also while the host sets the `readonly` property; see [Serve read mode](#serve-read-mode). |
|
|
324
|
+
| `phx.frontend.useActiveNavigationState()` | The active navigation state; the panel shows its review step while it is `checkout`. |
|
|
325
|
+
| `phx.frontend.usePushNavigate()` and `phx.frontend.usePopNavigate()` | Enter the review step and leave it again. |
|
|
326
|
+
| `phx.frontend.useNavigate()` | Return from the confirmation to the configuration, forgetting the review step. |
|
|
327
|
+
| `phx.frontend.useFinalizeActions()` | The spec's `finalizeAction` components with what a button needs; the review step offers the `primary` one and runs it, with its pending state, its error and whether finalizing is possible; see [Request a quote](#request-a-quote). |
|
|
328
|
+
| `phx.frontend.useUndoRedo()` | Whether there is a change to undo or redo, and `undo` and `redo`, for the layout's own buttons; see [Undo and redo](#undo-and-redo). |
|
|
329
|
+
| `phx.frontend.useIsFullscreenActive()` and `phx.frontend.useSetFullscreen()` | Read the fullscreen flag, and set it from the layout's own button. |
|
|
330
|
+
| `phx.frontend.useAnalytics()` | Record the fullscreen button's click as the built-in button does; see [Offer fullscreen](#offer-fullscreen). |
|
|
331
|
+
| `phx.frontend.useSceneSafeArea()` | The two refs that tell the camera which part of the canvas the panel or the sheet leaves free; see [What the layout has to do](#what-the-layout-has-to-do). |
|
|
332
|
+
| `phx.frontend.useActiveViewports()` | The width classes of the configurator's container, or `null` before it is measured; the layout renders its phone arrangement unless it includes `desktop`, see [Fit a phone](#fit-a-phone). |
|
|
333
|
+
| `phx.frontend.useActiveViewState()` and `phx.frontend.useSetViewState()` | Read the active view state, one of the spec's `viewStates`, to mark the active view button, and make another one active; see [Control the scene](#control-the-scene). |
|
|
334
|
+
| `phx.frontend.useResetCamera()` | Move the camera back to the framing of the active camera, undoing the customer's orbit, pan and zoom. |
|
|
335
|
+
| `phx.frontend.useConfiguratorMessages(onMessage)` | Receive violations, side-effect hints and errors one by one, with their text resolved, for the layout's own toast; see [Show messages](#show-messages). |
|
|
343
336
|
|
|
344
337
|
Calling an option's `onSelect` is the whole write: it changes `edgeFinish` on the table, the scene morphs the edge and the price expression recalculates. The option fields are named for display: the spec's `label` arrives as `title`, its `img` as `imageSrc`.
|
|
345
338
|
|
|
@@ -353,7 +346,9 @@ The edge finish is a visual choice, so the panel shows it as cards with a drawin
|
|
|
353
346
|
import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
|
|
354
347
|
import type { KeyboardEvent } from 'react'
|
|
355
348
|
|
|
356
|
-
import {
|
|
349
|
+
import type { UseAttributeSelection } from '@salsita-ai/sdk/react'
|
|
350
|
+
|
|
351
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
357
352
|
|
|
358
353
|
// Cross-sections of the tabletop's edge, keyed by the option values of the spec.
|
|
359
354
|
const EDGE_PROFILES: Readonly<Record<string, string>> = {
|
|
@@ -390,7 +385,7 @@ interface EdgeFinishCardsProps {
|
|
|
390
385
|
}
|
|
391
386
|
|
|
392
387
|
export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
393
|
-
const resolve = useResolveLocalizable()
|
|
388
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
394
389
|
const { options } = selection
|
|
395
390
|
// The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
|
|
396
391
|
const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
|
|
@@ -486,11 +481,13 @@ The drawings are keyed by the option values of the spec. A spec can carry a pict
|
|
|
486
481
|
|
|
487
482
|
## Offer fullscreen
|
|
488
483
|
|
|
489
|
-
Fullscreen is a flag in the configurator's state, not the browser's fullscreen mode. `phx.frontend.useIsFullscreenActive()` reads it and `phx.frontend.useSetFullscreen()` returns a function that sets it: `setFullscreen(true)` turns it on, `setFullscreen(false)` off. The layout's own button flips it, and the layout decides what to hide.
|
|
484
|
+
Fullscreen is a flag in the configurator's state, not the browser's fullscreen mode. `phx.frontend.useIsFullscreenActive()` reads it and `phx.frontend.useSetFullscreen()` returns a function that sets it: `setFullscreen(true)` turns it on, `setFullscreen(false)` off. The layout's own button flips it, and the layout decides what to hide. Before it flips the flag, the button records the click with `phx.frontend.useAnalytics().push(FrontendAnalyticsFactory.FullScreenModeToggled())`, the event the built-in fullscreen button records, so the shop's analytics count fullscreen the same way with either layout. `FrontendAnalyticsFactory` comes from `@salsita-ai/sdk/configurator`.
|
|
490
485
|
|
|
491
486
|
```tsx
|
|
492
487
|
import { Button, Tooltip } from '@mui/material'
|
|
493
488
|
|
|
489
|
+
import { FrontendAnalyticsFactory } from '@salsita-ai/sdk/configurator'
|
|
490
|
+
|
|
494
491
|
import { phx } from '../../.phoenix/phx.js'
|
|
495
492
|
|
|
496
493
|
const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
|
|
@@ -504,6 +501,7 @@ interface FullscreenToggleProps {
|
|
|
504
501
|
export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
|
|
505
502
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
506
503
|
const setFullscreen = phx.frontend.useSetFullscreen()
|
|
504
|
+
const analytics = phx.frontend.useAnalytics()
|
|
507
505
|
const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
|
|
508
506
|
const icon = (
|
|
509
507
|
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
@@ -511,10 +509,16 @@ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) =>
|
|
|
511
509
|
</svg>
|
|
512
510
|
)
|
|
513
511
|
|
|
512
|
+
// The same event the built-in fullscreen button records, for entering and for leaving
|
|
513
|
+
const toggle = () => {
|
|
514
|
+
analytics.push(FrontendAnalyticsFactory.FullScreenModeToggled())
|
|
515
|
+
setFullscreen(!isFullscreen)
|
|
516
|
+
}
|
|
517
|
+
|
|
514
518
|
return (
|
|
515
519
|
<Tooltip title={compact ? label : ''}>
|
|
516
520
|
<Button
|
|
517
|
-
onClick={
|
|
521
|
+
onClick={toggle}
|
|
518
522
|
aria-label={compact ? label : undefined}
|
|
519
523
|
startIcon={compact ? undefined : icon}
|
|
520
524
|
sx={{
|
|
@@ -539,9 +543,81 @@ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) =>
|
|
|
539
543
|
|
|
540
544
|
The button stays in the free area in both states, so the way back is always where the user left it. [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#full-screen-preview) describes what fullscreen hides.
|
|
541
545
|
|
|
546
|
+
## Undo and redo
|
|
547
|
+
|
|
548
|
+
The customer tries the four finishes against each other, so the layout offers **Undo** and **Redo** at the top right of the free area, beside the fullscreen button. `phx.frontend.useUndoRedo()` returns `canUndo` and `canRedo`, whether the history has a change to undo or to redo, and `undo` and `redo`, which change the configuration back or forward as the built-in toolbar's buttons do and push the same analytics events:
|
|
549
|
+
|
|
550
|
+
```tsx
|
|
551
|
+
import { Box, IconButton, Tooltip } from '@mui/material'
|
|
552
|
+
|
|
553
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
554
|
+
|
|
555
|
+
const UNDO_ICON = 'M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'
|
|
556
|
+
const REDO_ICON = 'M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13'
|
|
557
|
+
|
|
558
|
+
interface HistoryButtonProps {
|
|
559
|
+
readonly label: string
|
|
560
|
+
readonly icon: string
|
|
561
|
+
readonly enabled: boolean
|
|
562
|
+
readonly onClick: () => void
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const HistoryButton = ({ label, icon, enabled, onClick }: HistoryButtonProps) => (
|
|
566
|
+
<Tooltip title={label}>
|
|
567
|
+
{/* A disabled button fires no pointer events, so the span keeps the tooltip working */}
|
|
568
|
+
<span>
|
|
569
|
+
<IconButton
|
|
570
|
+
aria-label={label}
|
|
571
|
+
disabled={!enabled}
|
|
572
|
+
onClick={onClick}
|
|
573
|
+
sx={{ inlineSize: 44, blockSize: 44, color: 'text.primary' }}
|
|
574
|
+
>
|
|
575
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
576
|
+
<path d={icon} />
|
|
577
|
+
</svg>
|
|
578
|
+
</IconButton>
|
|
579
|
+
</span>
|
|
580
|
+
</Tooltip>
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
// Undo and redo for the customer's choices. They change the configuration, so they are offered only where the cards
|
|
584
|
+
// are: not to a viewer, and not in the review step, where the summary and a running request must not change under the
|
|
585
|
+
// customer. `useUndoRedo` pushes the same analytics events as the built-in toolbar's buttons.
|
|
586
|
+
export const UndoRedo = () => {
|
|
587
|
+
const { canUndo, canRedo, undo, redo } = phx.frontend.useUndoRedo()
|
|
588
|
+
const { accessInfo } = phx.frontend.useAccessService()
|
|
589
|
+
const navigationState = phx.frontend.useActiveNavigationState()
|
|
590
|
+
|
|
591
|
+
if (accessInfo.viewMode || navigationState !== 'configure') {
|
|
592
|
+
return null
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return (
|
|
596
|
+
<Box
|
|
597
|
+
component="div"
|
|
598
|
+
role="group"
|
|
599
|
+
aria-label="History"
|
|
600
|
+
sx={{
|
|
601
|
+
display: 'flex',
|
|
602
|
+
borderRadius: 999,
|
|
603
|
+
bgcolor: 'background.paper',
|
|
604
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
605
|
+
}}
|
|
606
|
+
>
|
|
607
|
+
<HistoryButton label="Undo" icon={UNDO_ICON} enabled={canUndo} onClick={undo} />
|
|
608
|
+
<HistoryButton label="Redo" icon={REDO_ICON} enabled={canRedo} onClick={redo} />
|
|
609
|
+
</Box>
|
|
610
|
+
)
|
|
611
|
+
}
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
- Each choice of a finish is one step of the history, whether it is made on the cards or on the button on the table's edge; undoing it moves the check mark back, changes the edge back and restores the price.
|
|
615
|
+
- Each button is disabled while there is nothing to undo or redo, and keeps its tooltip and accessible name. A disabled MUI button receives no pointer events, so a `span` around it carries the tooltip.
|
|
616
|
+
- The hook does not look at read mode or at the navigation state. The buttons change the configuration, so the component renders them only while the cards are shown: not to a viewer, not in the review step, where the summary and a running request must not change under the customer, and not in the confirmation. The layout also leaves them out in fullscreen, which gives the canvas to the product and keeps only the controls placed on it or for looking at it. The button on the table's edge stays there and still changes the finish; the history keeps that change, so **Undo** undoes it after fullscreen is left.
|
|
617
|
+
|
|
542
618
|
## Show messages
|
|
543
619
|
|
|
544
|
-
When a change is rejected because it breaks an invariant, when a committed change carries a hint, when an error is thrown while a change is validated, or when saving the configuration fails and later succeeds again, the configurator has a message for the customer. `phx.frontend.useConfiguratorMessages(onMessage)` calls `onMessage` once for each, with the text already in the customer's language, and the layout shows it its own way. Here a toast shows a message for six seconds, colored by its severity, at the bottom left of the free area above the view controls on a desktop, and at its top on a phone:
|
|
620
|
+
When a change is rejected because it breaks an invariant, when a committed change carries a hint, when an error is thrown while a change is validated, or when saving the configuration fails and later succeeds again, the configurator has a message for the customer. `phx.frontend.useConfiguratorMessages(onMessage)` calls `onMessage` once for each, with the text already in the customer's language, and the layout shows it its own way. Here a toast shows a message for six seconds, colored by its severity, at the bottom left of the free area above the view controls on a desktop, and at its top, below the row of buttons, on a phone:
|
|
545
621
|
|
|
546
622
|
```tsx
|
|
547
623
|
import { Alert } from '@mui/material'
|
|
@@ -658,7 +734,7 @@ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
|
|
|
658
734
|
|
|
659
735
|
The handler stands in for the shop's quote service: it waits a moment, as a request would, and then enters the `requested` navigation state, in which the panel thanks the customer. A handler is a hook factory, so it can use any hook, here `phx.frontend.useNavigate()`.
|
|
660
736
|
|
|
661
|
-
The
|
|
737
|
+
The review step offers the spec's primary finalize action, or the first one when none is primary, with `phx.frontend.useFinalizeActions()`. The hook lists the active `finalizeAction` components with what a button needs, the label and the title resolved to the customer's language, and runs their handlers itself, beside the layout, so the buttons need no handler boundary and the component may be called anywhere and as often as the layout likes. **Back to the configuration** lives in the same component, so it can be disabled while the request is pending.
|
|
662
738
|
|
|
663
739
|
```tsx
|
|
664
740
|
import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
|
|
@@ -668,39 +744,40 @@ import { phx } from '../../.phoenix/phx.js'
|
|
|
668
744
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
669
745
|
|
|
670
746
|
interface ReviewActionsProps {
|
|
671
|
-
readonly handler: string
|
|
672
|
-
readonly label: string
|
|
673
747
|
readonly onBack: () => void
|
|
674
748
|
}
|
|
675
749
|
|
|
676
|
-
// The review step's buttons:
|
|
677
|
-
//
|
|
678
|
-
//
|
|
679
|
-
//
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
const
|
|
750
|
+
// The review step's buttons: the spec's primary finalize action and the way back. `useFinalizeActions` runs the
|
|
751
|
+
// action's handler beside the layout, so its pending state and error outlive this component: when the panel unmounts,
|
|
752
|
+
// as in fullscreen, the request goes on and the remounted buttons still show it. Back is disabled while the request
|
|
753
|
+
// is pending, so the customer cannot change the configuration while it is sent.
|
|
754
|
+
export const ReviewActions = ({ onBack }: ReviewActionsProps) => {
|
|
755
|
+
const { primary, hints } = phx.frontend.useFinalizeActions()
|
|
756
|
+
const isPending = primary?.isPending ?? false
|
|
683
757
|
|
|
684
758
|
return (
|
|
685
759
|
<Box component="div" sx={{ display: 'grid', gap: 2 }}>
|
|
686
|
-
|
|
687
|
-
<
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
760
|
+
{primary && (
|
|
761
|
+
<Box component="div" sx={{ display: 'grid', gap: 1 }}>
|
|
762
|
+
<Button
|
|
763
|
+
size="large"
|
|
764
|
+
variant="contained"
|
|
765
|
+
disabled={primary.disabled || isPending}
|
|
766
|
+
onClick={() => void primary.run()}
|
|
767
|
+
title={primary.title}
|
|
768
|
+
startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
|
|
769
|
+
sx={BUTTON_SX}
|
|
770
|
+
>
|
|
771
|
+
{isPending ? 'Sending the request…' : primary.label}
|
|
772
|
+
</Button>
|
|
773
|
+
{primary.disabled && hints && (
|
|
774
|
+
<Typography variant="caption" color="text.secondary">
|
|
775
|
+
{hints}
|
|
776
|
+
</Typography>
|
|
777
|
+
)}
|
|
778
|
+
{primary.error && <Alert severity="error">The request could not be sent: {primary.error.message}</Alert>}
|
|
779
|
+
</Box>
|
|
780
|
+
)}
|
|
704
781
|
<Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
|
|
705
782
|
Back to the configuration
|
|
706
783
|
</Button>
|
|
@@ -709,22 +786,30 @@ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) =>
|
|
|
709
786
|
}
|
|
710
787
|
```
|
|
711
788
|
|
|
712
|
-
- `
|
|
713
|
-
-
|
|
789
|
+
- `primary` is the first `'primary'` action, or else the first action, or `null` when the spec has none; the component then shows only **Back to the configuration**. `secondary` holds the others, which this product does not have.
|
|
790
|
+
- `run()` records the finalize-button click for analytics and runs the handler; it does nothing while `disabled` or `isPending`, and returns a promise that never rejects.
|
|
791
|
+
- While `isPending` the button shows a spinner and cannot be clicked again, and **Back to the configuration** is disabled, so the customer cannot change the configuration while it is sent. The configurator keeps `isPending` and `error` while the layout's components unmount: entering fullscreen during the request removes the panel, and the panel shown after fullscreen still shows the spinner until the handler settles.
|
|
714
792
|
- `error` is what the handler rejected with. The layout shows it under the button; no snackbar is raised. It is cleared when the customer tries again.
|
|
715
793
|
- `disabled` and `hints` come from the configuration's violations: while a `warning` or worse holds, or the configuration failed to save, finalizing is not possible and `hints` says why.
|
|
716
794
|
|
|
717
|
-
The review step stays: a quote request is a commitment, so the customer sees the summary first, and a real shop collects the contact details there. A product that finalizes without a review offers the button in place of **Review and request a quote**. [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout) describes the hook, and [Finalization](?path=/docs/phoenix-finalization--docs) what a real flow does on the server.
|
|
795
|
+
The review step stays: a quote request is a commitment, so the customer sees the summary first, and a real shop collects the contact details there. A product that finalizes without a review offers the button in place of **Review and request a quote**. [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout) describes the hook, and `phx.frontend.useFinalizeAction(handler)`, which runs one known action inside the layout instead, and [Finalization](?path=/docs/phoenix-finalization--docs) what a real flow does on the server.
|
|
718
796
|
|
|
719
797
|
## Serve read mode
|
|
720
798
|
|
|
721
|
-
|
|
799
|
+
A configuration is in read mode by one of two routes, and the layout does not need to know which:
|
|
800
|
+
|
|
801
|
+
- **A configuration shared for viewing.** The configuration is opened with `read-revision` access, as a viewer of a shared link opens it. The `read` mock template sets that access, and the **Read Mode** story below opens it.
|
|
802
|
+
- **The host page sets `readonly`.** The page that embeds the configurator sets the web component's `readonly` property, here on a configuration the user owns. The mock template `mocks/readonly-host.yaml`, **Host sets readonly** in the editor's **Mocks** panel, keeps `access: owner` and sets the property with `webComponentProperties: { readonly: true }`.
|
|
803
|
+
|
|
804
|
+
Both routes set `accessInfo.viewMode` to `true`, and both switch the spec's filter mode to read, so a component filtered with `$filter.modes: [owner]` is left out either way. While `viewMode` is `true` the panel marks the view as view only, replaces the cards with the chosen finish and shows the price without an action; neither the finalize action nor undo and redo are offered, since `useFinalizeActions` and `useUndoRedo` do not check read mode themselves. The hooks do not hide or disable anything in read mode: what a viewer can change is decided by what the layout renders. Rotating and zooming the scene, and fullscreen, stay available, as [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#view-only-mode) recommends. The button on the table's edge is hidden for viewers by the spec, see [Put a control on the product](#put-a-control-on-the-product).
|
|
805
|
+
|
|
806
|
+
A viewer of a shared configuration has no way here to edit a copy of it; see **Clone to edit in read mode** in [Known gaps](#known-gaps).
|
|
722
807
|
|
|
723
808
|
## Fit a phone
|
|
724
809
|
|
|
725
810
|
A panel 380 pixels wide beside the scene leaves nothing of the table on a phone. Below a desktop width the layout puts the panel into a sheet at the bottom and lets the camera frame the table in the area above it. The layout above shows both arrangements.
|
|
726
811
|
|
|
727
|
-
**The switch.** `useActiveViewports()`
|
|
812
|
+
**The switch.** `phx.frontend.useActiveViewports()` returns the width classes the configurator's container satisfies. The container decides, not the window, so a configurator embedded in a narrow column of a wide page gets the phone arrangement too. The built-in layout switches on `desktop` as well.
|
|
728
813
|
|
|
729
814
|
| Value | When it is active |
|
|
730
815
|
| ----------- | ---------------------------------------------------------------------------------- |
|
|
@@ -903,10 +988,10 @@ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheet
|
|
|
903
988
|
|
|
904
989
|
- The handle is a real button with `aria-expanded`. A tap, Enter or Space toggles the sheet, and dragging it up or down snaps the sheet to the other position when the drag is long or fast enough. `touchAction: 'none'` is set on the handle only, so the cards still scroll by touch.
|
|
905
990
|
- The sheet's height comes from its content and is at most 55% of the configurator; when the content does not fit, the cards region shrinks until only the top of the cards shows and scrolls, and below that the sheet's content scrolls as a whole. On a phone with room for the header, the top of the cards and the footer, the price and the action stay in view with the sheet open; on a shorter one the customer scrolls the sheet to them, and the review step's buttons are reached the same way in both positions. A scroll on the cards that reaches their end moves the sheet on. Because the safe-area element is its neighbour in the column, the free area ends where the sheet starts without anything being measured by the layout.
|
|
906
|
-
- While the handle is dragged the sheet follows the finger with a `transform`. `useSceneSafeArea()` does not see a transform, so the free area changes once, when the sheet snaps, and the camera refits once. A safe area that followed the finger would refit the camera on every move and reset an orbit the customer made.
|
|
991
|
+
- While the handle is dragged the sheet follows the finger with a `transform`. `phx.frontend.useSceneSafeArea()` does not see a transform, so the free area changes once, when the sheet snaps, and the camera refits once. A safe area that followed the finger would refit the camera on every move and reset an orbit the customer made.
|
|
907
992
|
- The sheet is not a modal: no backdrop covers the scene, so the table can be orbited with one finger and zoomed with two while the sheet is open. MUI's temporary `Drawer` and `SwipeableDrawer` are modals and would block the scene; their persistent and permanent variants have no backdrop, but no drag handle with two positions either.
|
|
908
993
|
|
|
909
|
-
**What else moves.** The toast sits at the top of the free area, so it does not cover the sheet's handle, and the fullscreen button shows only its icon, with its label as tooltip and accessible name
|
|
994
|
+
**What else moves.** The toast sits at the top of the free area, below the row of undo, redo and fullscreen buttons, so it does not cover the sheet's handle, and the fullscreen button shows only its icon, with its label as tooltip and accessible name. Fullscreen removes the sheet as it removes the panel on a desktop. The sheet keeps its position while fullscreen is on.
|
|
910
995
|
|
|
911
996
|
**A camera for the phone.** The desktop camera is close enough to fill a wide free area, and on a narrow one it cuts off the ends of the table. So each camera has a filter on the viewport: the desktop camera `main` applies while `desktop` is active, and a second camera, `phone`, with a larger distance frames the whole table while `mobile` is. The filters exclude each other once the container is measured. Before that, for example when an image of the configuration is rendered, no viewport is known and a viewport filter matches, so both cameras apply and the higher priority of `main` decides:
|
|
912
997
|
|
|
@@ -1032,6 +1117,8 @@ export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot'
|
|
|
1032
1117
|
|
|
1033
1118
|
[Html Hotspots](?path=/docs/controls-scene-html-hotspots--docs) describes the component and its other properties.
|
|
1034
1119
|
|
|
1120
|
+
The SDK's own controls on the product, such as `sceneEntityAddFab` and `sceneEntitySelectHotspot`, keep the SDK's look in a project layout too. Each is rendered through an entity element of its own name, so a project gives it the brand's look by registering that name, for example with `phx.frontend.createAddEntityFab`; see [Configurator Interface → In-Scene Controls](?path=/docs/phoenix-configurator-interface--docs#in-scene-controls). `htmlHotspot` is for a control the SDK has none of, like this one.
|
|
1121
|
+
|
|
1035
1122
|
## Control the scene
|
|
1036
1123
|
|
|
1037
1124
|
The four finishes differ by a few millimetres on a table two metres long, so from the default distance the difference is hard to judge. The layout offers two views, **Whole table** and **Edge close-up**, a close and low look at a corner of the top, and a **Reset view** button that brings back the framing after the customer has orbited, panned or zoomed.
|
|
@@ -1235,7 +1322,7 @@ transformers:
|
|
|
1235
1322
|
|
|
1236
1323
|
## Try the example
|
|
1237
1324
|
|
|
1238
|
-
|
|
1325
|
+
Each story names the mock template it opens with `args: { mockTemplate }`: **Example** and **Phone** open `default-user`, and **Read Mode** opens `read`. A template applied from the **Mocks** panel lasts until the story is opened again.
|
|
1239
1326
|
|
|
1240
1327
|
The same layout in a frame 390 pixels wide, as on a phone. Opened on its own from the sidebar, the **Phone** story sets Storybook's viewport to 390 × 844.
|
|
1241
1328
|
|
|
@@ -1249,14 +1336,19 @@ The same layout in a frame 390 pixels wide, as on a phone. Opened on its own fro
|
|
|
1249
1336
|
- **Review and request a quote** replaces the cards with the chosen finish and offers **Request a quote**; **Back to the configuration** brings the cards back.
|
|
1250
1337
|
- **Request a quote** shows a spinner and "Sending the request…" for about a second and a half, with **Back to the configuration** disabled, then "Thank you. Your quote request is on its way, and the shop replies within two working days."; **Back to the configuration** then returns to the cards.
|
|
1251
1338
|
- **Fullscreen** removes the panel and the table moves to the centre of the canvas; **Exit fullscreen** brings both back.
|
|
1252
|
-
-
|
|
1339
|
+
- In the **Read Mode** story the panel says **View only**, shows the chosen finish and the price, and has no button, so no quote can be requested; **Undo**, **Redo** and the button on the table's edge are not shown, and **Fullscreen**, the view buttons and **Reset view** work.
|
|
1340
|
+
- Applying **Host sets readonly** from the **Mocks** panel in the **Example** story shows the same read mode: **View only**, the chosen finish, no button in the panel, no **Undo**, **Redo** or button on the table's edge. Applying **Default User** brings the cards back.
|
|
1341
|
+
- **Undo** and **Redo** are disabled when the story opens. After choosing **Tree trunk**, **Undo** restores **Square** and $1,290.00 and enables **Redo**; **Redo** chooses **Tree trunk** again at $1,630.00.
|
|
1342
|
+
- **Undo** and **Redo** are not shown in the review step, in the confirmation or in fullscreen.
|
|
1343
|
+
- Clicking **Fullscreen** and **Exit fullscreen** each pushes the `fullscreenButton` user-action event, as an `AnalyticsService.push` line in the browser console shows: without a Google Tag Manager id, Storybook's analytics only log their events with `console.debug`, which the console shows only with its Verbose level enabled.
|
|
1344
|
+
- Entering fullscreen while **Request a quote** is pending and leaving it again shows the panel with the spinner still running, until the thank-you message appears.
|
|
1253
1345
|
- A round button sits on the middle of the table's long edge. Clicking it opens the four finishes next to it; choosing **Round** there moves the check mark in the popover and in the panel, rounds the edge and raises the price to $1,410.00. Escape closes the popover.
|
|
1254
1346
|
- Tab reaches the button on the edge, and Enter or Space opens the popover.
|
|
1255
|
-
- The button on the edge is gone in the review step, in the confirmation and
|
|
1347
|
+
- The button on the edge is gone in the review step, in the confirmation and in both read routes, and stays in fullscreen.
|
|
1256
1348
|
- In the **Phone** story the panel is a sheet at the bottom showing the name, the price and **Review and request a quote**, and the whole table is visible above it.
|
|
1257
1349
|
- Tapping the sheet's handle, or dragging it up, opens the sheet with the cards; the table moves up once the sheet has snapped and stays fully visible. Dragging the handle down, or tapping it again, collapses the sheet.
|
|
1258
1350
|
- On the phone, the review step, **Request a quote** and the thank-you message work with the sheet collapsed and open.
|
|
1259
|
-
- On the phone, choosing **Tree trunk** shows the hint at the top of the free area,
|
|
1351
|
+
- On the phone, choosing **Tree trunk** shows the hint at the top of the free area, below the undo, redo and fullscreen buttons.
|
|
1260
1352
|
- On the phone, the fullscreen button removes the sheet and the table moves to the centre of the canvas; pressing it again brings the sheet back in the position it had.
|
|
1261
1353
|
- **Edge close-up** moves the camera close to the near corner of the top, where the edge profile shows; the button is drawn dark and the other light. **Whole table** returns to the whole table.
|
|
1262
1354
|
- After dragging in the free area to orbit the table, **Reset view** returns to the framing of the active view, the whole table or the close-up.
|
|
@@ -1268,14 +1360,14 @@ The same layout in a frame 390 pixels wide, as on a phone. Opened on its own fro
|
|
|
1268
1360
|
A project layout has only what it renders. This one leaves out the following, each of which a product may need. [Layout Slots](?path=/docs/phoenix-layout-slots--docs) describes every `LayoutSlots` member named here.
|
|
1269
1361
|
|
|
1270
1362
|
- **Messages that stay snackbars.** The toast shows violations, side effects, errors and failed saves, and the finalize button shows its own error. Two kinds of message stay snackbars. An error of a built-in action, such as one from `LayoutSlots.DesktopToolbar`, renders into `LayoutSlots.DesktopSnackbarsRoot`; this layout mounts neither, and a layout that mounts such an action mounts the root too, or the snackbar appears outside the configurator. A failure to start from a preset appears on the preset screen, before this layout mounts; a project replaces that screen with `phx.frontend.createPresetUi`, see [Configurator Interface → Preset UI](?path=/docs/phoenix-configurator-interface--docs#preset-ui).
|
|
1271
|
-
- **Toolbar actions.**
|
|
1363
|
+
- **Toolbar actions.** Measurements, sharing and language switching are not offered; undo and redo are the layout's own buttons, see [Undo and redo](#undo-and-redo). A layout can mount `LayoutSlots.DesktopToolbar` for the toolbar the spec configures, or build its own buttons: `phx.frontend.useToolbarActions()` returns the spec's toolbar as runnable entries, and `phx.frontend.useUndoRedo()`, `useMeasurements()`, `useShareLinks()` and `useLocaleSwitch()` serve single actions, pushing the same analytics events as the built-in buttons; see [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout).
|
|
1272
1364
|
- **The spec's view controls, tool controls and leaving a tool mode.** A spec can configure view controls and tool controls, and a tool mode has a button that leaves it. The built-in layout places them with `LayoutSlots.DesktopViewControls`, `LayoutSlots.DesktopToolControls` and `LayoutSlots.DesktopCallToAction`; this layout mounts none of them, so the spec's `viewControls` and `toolControls` do not appear. Its views come from its own buttons instead, see [Control the scene](#control-the-scene), and it has no tool modes.
|
|
1273
1365
|
- **A project's layout dialog.** A dialog the project registers with `phx.frontend.createLayoutDialog` is shown by `LayoutDialog`, which the built-in layout mounts. This layout does not; a layout that needs the dialog mounts `LayoutDialog` from `@salsita-ai/sdk/configurator`.
|
|
1274
1366
|
- **Selection.** The table has no parts to select. A product with selectable parts reads `phx.frontend.useSelectedDomainEntityId()` and shows the controls of the selected part.
|
|
1275
|
-
- **Clone to edit in read mode.** With `shareCloneToEdit` set, the built-in layout's `LayoutSlots.DesktopReadonlyBanner` offers **Edit configuration** to a viewer; this layout's "View only" label offers nothing. A layout mounts the banner, or builds its own action with `
|
|
1276
|
-
- **Back and close.** The built-in header's back button returns to the product choice, runs the host's close action or leaves the expanded view, whichever applies. This layout has none of them. `useCloseAction()`
|
|
1277
|
-
- **Analytics.** The finalize button records `FinalizeButtonClicked` through `
|
|
1278
|
-
- **Preview start screen.** The built-in layout shows a preview while `usePreview().isPreview` is set, which `preview: auto` does on phones without the project opting in. This layout ignores it and always renders the interface.
|
|
1367
|
+
- **Clone to edit in read mode.** With `shareCloneToEdit` set, the built-in layout's `LayoutSlots.DesktopReadonlyBanner` offers **Edit configuration** to a viewer; this layout's "View only" label offers nothing. A layout mounts the banner, or builds its own action with `phx.frontend.useIsCloningAllowed()` and `LayoutSlots.CloneToEditDialog`. The example leaves it out because Storybook cannot show the result: the dialog creates and opens the copy, but the mock template keeps its `read-revision` access on every configuration it opens, so the copy opens in read mode again.
|
|
1368
|
+
- **Back and close.** The built-in header's back button returns to the product choice, runs the host's close action or leaves the expanded view, whichever applies. This layout has none of them. `phx.frontend.useCloseAction()` returns the host's close action, or `null` when there is none, as in this Storybook example; the hook that chooses among the three is not exported.
|
|
1369
|
+
- **Analytics.** The finalize button records `FinalizeButtonClicked` through `useFinalizeActions`, the cards record the attribute choice through `useAttributeSelection`, undo and redo record their events through `useUndoRedo`, and the fullscreen button records `FullScreenModeToggled` itself. The review step's navigation buttons, the view buttons, **Reset view**, the sheet's handle and the button on the table's edge record nothing. A layout that wants more events pushes them from `FrontendAnalyticsFactory`, from `@salsita-ai/sdk/configurator`, with `phx.frontend.useAnalytics().push(...)`, as [Offer fullscreen](#offer-fullscreen) does.
|
|
1370
|
+
- **Preview start screen.** The built-in layout shows a preview while `phx.frontend.usePreview().isPreview` is set, which `preview: auto` does on phones without the project opting in. This layout ignores it and always renders the interface.
|
|
1279
1371
|
- **Assistant panel.** A project layout gets it only with `LayoutSlots.DesktopSidebar`, the built-in sidebar as one piece, see [Sidebar in a Custom Layout](?path=/docs/layouts-sidebar-in-a-custom-layout--docs); this layout does not use it.
|
|
1280
1372
|
- **"Powered by Salsita" mark.** The built-in layout shows it; a project layout decides whether to mount `LayoutSlots.DesktopPoweredBy`, and this one does not.
|
|
1281
1373
|
|
|
@@ -1284,7 +1376,7 @@ A project layout has only what it renders. This one leaves out the following, ea
|
|
|
1284
1376
|
- [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) is the reference for the element name, the minimal layout, the SDK pieces a layout can mount and the hooks it reads.
|
|
1285
1377
|
- [Universal](?path=/docs/layouts-universal--docs) is the built-in layout this one replaces.
|
|
1286
1378
|
- [Header / Custom](?path=/docs/layouts-header-custom--docs) replaces only the header, with the price from `useRootEntityPrice()`.
|
|
1287
|
-
- [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `useSceneSafeArea()` measures.
|
|
1379
|
+
- [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `phx.frontend.useSceneSafeArea()` measures.
|
|
1288
1380
|
- [Presets / Custom](?path=/docs/layouts-presets-custom--docs) replaces the preset screen the same way.
|
|
1289
1381
|
|
|
1290
1382
|
## Complete Implementation
|
|
@@ -1648,7 +1740,9 @@ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheet
|
|
|
1648
1740
|
import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
|
|
1649
1741
|
import type { KeyboardEvent } from 'react'
|
|
1650
1742
|
|
|
1651
|
-
import {
|
|
1743
|
+
import type { UseAttributeSelection } from '@salsita-ai/sdk/react'
|
|
1744
|
+
|
|
1745
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
1652
1746
|
|
|
1653
1747
|
// Cross-sections of the tabletop's edge, keyed by the option values of the spec.
|
|
1654
1748
|
const EDGE_PROFILES: Readonly<Record<string, string>> = {
|
|
@@ -1685,7 +1779,7 @@ interface EdgeFinishCardsProps {
|
|
|
1685
1779
|
}
|
|
1686
1780
|
|
|
1687
1781
|
export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
1688
|
-
const resolve = useResolveLocalizable()
|
|
1782
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
1689
1783
|
const { options } = selection
|
|
1690
1784
|
// The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
|
|
1691
1785
|
const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
|
|
@@ -1782,6 +1876,8 @@ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
|
1782
1876
|
```tsx
|
|
1783
1877
|
import { Button, Tooltip } from '@mui/material'
|
|
1784
1878
|
|
|
1879
|
+
import { FrontendAnalyticsFactory } from '@salsita-ai/sdk/configurator'
|
|
1880
|
+
|
|
1785
1881
|
import { phx } from '../../.phoenix/phx.js'
|
|
1786
1882
|
|
|
1787
1883
|
const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
|
|
@@ -1795,6 +1891,7 @@ interface FullscreenToggleProps {
|
|
|
1795
1891
|
export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
|
|
1796
1892
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
1797
1893
|
const setFullscreen = phx.frontend.useSetFullscreen()
|
|
1894
|
+
const analytics = phx.frontend.useAnalytics()
|
|
1798
1895
|
const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
|
|
1799
1896
|
const icon = (
|
|
1800
1897
|
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
@@ -1802,10 +1899,16 @@ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) =>
|
|
|
1802
1899
|
</svg>
|
|
1803
1900
|
)
|
|
1804
1901
|
|
|
1902
|
+
// The same event the built-in fullscreen button records, for entering and for leaving
|
|
1903
|
+
const toggle = () => {
|
|
1904
|
+
analytics.push(FrontendAnalyticsFactory.FullScreenModeToggled())
|
|
1905
|
+
setFullscreen(!isFullscreen)
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1805
1908
|
return (
|
|
1806
1909
|
<Tooltip title={compact ? label : ''}>
|
|
1807
1910
|
<Button
|
|
1808
|
-
onClick={
|
|
1911
|
+
onClick={toggle}
|
|
1809
1912
|
aria-label={compact ? label : undefined}
|
|
1810
1913
|
startIcon={compact ? undefined : icon}
|
|
1811
1914
|
sx={{
|
|
@@ -1889,8 +1992,7 @@ export const MessageToast = () => {
|
|
|
1889
1992
|
```tsx
|
|
1890
1993
|
import { Box, Button, Typography } from '@mui/material'
|
|
1891
1994
|
|
|
1892
|
-
import { detailComponent
|
|
1893
|
-
import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
|
|
1995
|
+
import { detailComponent } from '@salsita-ai/sdk/domain'
|
|
1894
1996
|
|
|
1895
1997
|
import { phx } from '../../.phoenix/phx.js'
|
|
1896
1998
|
import { EdgeFinishCards } from './EdgeFinishCards.js'
|
|
@@ -1906,7 +2008,7 @@ interface ProductPanelProps {
|
|
|
1906
2008
|
}
|
|
1907
2009
|
|
|
1908
2010
|
export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
|
|
1909
|
-
const resolve = useResolveLocalizable()
|
|
2011
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
1910
2012
|
const detail = phx.frontend.useFirstRootComponent(detailComponent)
|
|
1911
2013
|
const price = phx.frontend.useRootEntityPrice()
|
|
1912
2014
|
const tableId = phx.frontend.useRootEntityId()
|
|
@@ -1916,12 +2018,9 @@ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPane
|
|
|
1916
2018
|
const pushNavigate = phx.frontend.usePushNavigate()
|
|
1917
2019
|
const popNavigate = phx.frontend.usePopNavigate()
|
|
1918
2020
|
const navigate = phx.frontend.useNavigate()
|
|
1919
|
-
const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
|
|
1920
2021
|
|
|
1921
2022
|
const isReadMode = accessInfo.viewMode
|
|
1922
2023
|
const isReview = isReadMode || navigationState !== 'configure'
|
|
1923
|
-
// The spec's primary finalize action, or its first one
|
|
1924
|
-
const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
|
|
1925
2024
|
const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
|
|
1926
2025
|
|
|
1927
2026
|
return (
|
|
@@ -1999,19 +2098,7 @@ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPane
|
|
|
1999
2098
|
<Typography variant="body2" color="text.secondary">
|
|
2000
2099
|
Your table is ready for a quote. A real shop collects the contact details here.
|
|
2001
2100
|
</Typography>
|
|
2002
|
-
{
|
|
2003
|
-
<PhoenixHandlerBoundary name={quoteAction.state.handler}>
|
|
2004
|
-
<ReviewActions
|
|
2005
|
-
handler={quoteAction.state.handler}
|
|
2006
|
-
label={resolve(quoteAction.state.label)}
|
|
2007
|
-
onBack={popNavigate}
|
|
2008
|
-
/>
|
|
2009
|
-
</PhoenixHandlerBoundary>
|
|
2010
|
-
) : (
|
|
2011
|
-
<Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
|
|
2012
|
-
Back to the configuration
|
|
2013
|
-
</Button>
|
|
2014
|
-
)}
|
|
2101
|
+
<ReviewActions onBack={popNavigate} />
|
|
2015
2102
|
</>
|
|
2016
2103
|
)}
|
|
2017
2104
|
{!isReadMode && navigationState === 'requested' && (
|
|
@@ -2040,39 +2127,40 @@ import { phx } from '../../.phoenix/phx.js'
|
|
|
2040
2127
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
2041
2128
|
|
|
2042
2129
|
interface ReviewActionsProps {
|
|
2043
|
-
readonly handler: string
|
|
2044
|
-
readonly label: string
|
|
2045
2130
|
readonly onBack: () => void
|
|
2046
2131
|
}
|
|
2047
2132
|
|
|
2048
|
-
// The review step's buttons:
|
|
2049
|
-
//
|
|
2050
|
-
//
|
|
2051
|
-
//
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
const
|
|
2133
|
+
// The review step's buttons: the spec's primary finalize action and the way back. `useFinalizeActions` runs the
|
|
2134
|
+
// action's handler beside the layout, so its pending state and error outlive this component: when the panel unmounts,
|
|
2135
|
+
// as in fullscreen, the request goes on and the remounted buttons still show it. Back is disabled while the request
|
|
2136
|
+
// is pending, so the customer cannot change the configuration while it is sent.
|
|
2137
|
+
export const ReviewActions = ({ onBack }: ReviewActionsProps) => {
|
|
2138
|
+
const { primary, hints } = phx.frontend.useFinalizeActions()
|
|
2139
|
+
const isPending = primary?.isPending ?? false
|
|
2055
2140
|
|
|
2056
2141
|
return (
|
|
2057
2142
|
<Box component="div" sx={{ display: 'grid', gap: 2 }}>
|
|
2058
|
-
|
|
2059
|
-
<
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2143
|
+
{primary && (
|
|
2144
|
+
<Box component="div" sx={{ display: 'grid', gap: 1 }}>
|
|
2145
|
+
<Button
|
|
2146
|
+
size="large"
|
|
2147
|
+
variant="contained"
|
|
2148
|
+
disabled={primary.disabled || isPending}
|
|
2149
|
+
onClick={() => void primary.run()}
|
|
2150
|
+
title={primary.title}
|
|
2151
|
+
startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
|
|
2152
|
+
sx={BUTTON_SX}
|
|
2153
|
+
>
|
|
2154
|
+
{isPending ? 'Sending the request…' : primary.label}
|
|
2155
|
+
</Button>
|
|
2156
|
+
{primary.disabled && hints && (
|
|
2157
|
+
<Typography variant="caption" color="text.secondary">
|
|
2158
|
+
{hints}
|
|
2159
|
+
</Typography>
|
|
2160
|
+
)}
|
|
2161
|
+
{primary.error && <Alert severity="error">The request could not be sent: {primary.error.message}</Alert>}
|
|
2162
|
+
</Box>
|
|
2163
|
+
)}
|
|
2076
2164
|
<Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
|
|
2077
2165
|
Back to the configuration
|
|
2078
2166
|
</Button>
|
|
@@ -2176,14 +2264,79 @@ export const SceneControls = ({ compact = false, resetOnly = false }: SceneContr
|
|
|
2176
2264
|
}
|
|
2177
2265
|
```
|
|
2178
2266
|
|
|
2267
|
+
### ./src/\_shared/UndoRedo.tsx
|
|
2268
|
+
|
|
2269
|
+
```tsx
|
|
2270
|
+
import { Box, IconButton, Tooltip } from '@mui/material'
|
|
2271
|
+
|
|
2272
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
2273
|
+
|
|
2274
|
+
const UNDO_ICON = 'M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'
|
|
2275
|
+
const REDO_ICON = 'M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13'
|
|
2276
|
+
|
|
2277
|
+
interface HistoryButtonProps {
|
|
2278
|
+
readonly label: string
|
|
2279
|
+
readonly icon: string
|
|
2280
|
+
readonly enabled: boolean
|
|
2281
|
+
readonly onClick: () => void
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
const HistoryButton = ({ label, icon, enabled, onClick }: HistoryButtonProps) => (
|
|
2285
|
+
<Tooltip title={label}>
|
|
2286
|
+
{/* A disabled button fires no pointer events, so the span keeps the tooltip working */}
|
|
2287
|
+
<span>
|
|
2288
|
+
<IconButton
|
|
2289
|
+
aria-label={label}
|
|
2290
|
+
disabled={!enabled}
|
|
2291
|
+
onClick={onClick}
|
|
2292
|
+
sx={{ inlineSize: 44, blockSize: 44, color: 'text.primary' }}
|
|
2293
|
+
>
|
|
2294
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
2295
|
+
<path d={icon} />
|
|
2296
|
+
</svg>
|
|
2297
|
+
</IconButton>
|
|
2298
|
+
</span>
|
|
2299
|
+
</Tooltip>
|
|
2300
|
+
)
|
|
2301
|
+
|
|
2302
|
+
// Undo and redo for the customer's choices. They change the configuration, so they are offered only where the cards
|
|
2303
|
+
// are: not to a viewer, and not in the review step, where the summary and a running request must not change under the
|
|
2304
|
+
// customer. `useUndoRedo` pushes the same analytics events as the built-in toolbar's buttons.
|
|
2305
|
+
export const UndoRedo = () => {
|
|
2306
|
+
const { canUndo, canRedo, undo, redo } = phx.frontend.useUndoRedo()
|
|
2307
|
+
const { accessInfo } = phx.frontend.useAccessService()
|
|
2308
|
+
const navigationState = phx.frontend.useActiveNavigationState()
|
|
2309
|
+
|
|
2310
|
+
if (accessInfo.viewMode || navigationState !== 'configure') {
|
|
2311
|
+
return null
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
return (
|
|
2315
|
+
<Box
|
|
2316
|
+
component="div"
|
|
2317
|
+
role="group"
|
|
2318
|
+
aria-label="History"
|
|
2319
|
+
sx={{
|
|
2320
|
+
display: 'flex',
|
|
2321
|
+
borderRadius: 999,
|
|
2322
|
+
bgcolor: 'background.paper',
|
|
2323
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
2324
|
+
}}
|
|
2325
|
+
>
|
|
2326
|
+
<HistoryButton label="Undo" icon={UNDO_ICON} enabled={canUndo} onClick={undo} />
|
|
2327
|
+
<HistoryButton label="Redo" icon={REDO_ICON} enabled={canRedo} onClick={redo} />
|
|
2328
|
+
</Box>
|
|
2329
|
+
)
|
|
2330
|
+
}
|
|
2331
|
+
```
|
|
2332
|
+
|
|
2179
2333
|
### ./src/elements/ConfiguratorLayout.tsx
|
|
2180
2334
|
|
|
2181
2335
|
```tsx
|
|
2182
2336
|
import { Box } from '@mui/material'
|
|
2183
2337
|
import { useState } from 'react'
|
|
2184
2338
|
|
|
2185
|
-
import { LayoutSlots
|
|
2186
|
-
import { useActiveViewports } from '@salsita-ai/sdk/react'
|
|
2339
|
+
import { LayoutSlots } from '@salsita-ai/sdk/configurator'
|
|
2187
2340
|
|
|
2188
2341
|
import { phx } from '../../.phoenix/phx.js'
|
|
2189
2342
|
import { BottomSheet } from '../_shared/BottomSheet.js'
|
|
@@ -2191,6 +2344,7 @@ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
|
|
|
2191
2344
|
import { MessageToast } from '../_shared/MessageToast.js'
|
|
2192
2345
|
import { ProductPanel } from '../_shared/ProductPanel.js'
|
|
2193
2346
|
import { SceneControls } from '../_shared/SceneControls.js'
|
|
2347
|
+
import { UndoRedo } from '../_shared/UndoRedo.js'
|
|
2194
2348
|
|
|
2195
2349
|
const GUTTER = 24
|
|
2196
2350
|
const PANEL_WIDTH = 380
|
|
@@ -2198,10 +2352,10 @@ const PHONE_GUTTER = 16
|
|
|
2198
2352
|
const TOUCH_TARGET = 44
|
|
2199
2353
|
|
|
2200
2354
|
const ConfiguratorLayout = () => {
|
|
2201
|
-
const { containerRef, safeAreaRef } = useSceneSafeArea()
|
|
2355
|
+
const { containerRef, safeAreaRef } = phx.frontend.useSceneSafeArea()
|
|
2202
2356
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
2203
2357
|
// `null` until the container has been measured; the layout shows only the scene until then
|
|
2204
|
-
const viewports = useActiveViewports()
|
|
2358
|
+
const viewports = phx.frontend.useActiveViewports()
|
|
2205
2359
|
const [isSheetOpen, setSheetOpen] = useState(false)
|
|
2206
2360
|
|
|
2207
2361
|
const isDesktop = viewports?.includes('desktop') ?? false
|
|
@@ -2260,8 +2414,16 @@ const ConfiguratorLayout = () => {
|
|
|
2260
2414
|
>
|
|
2261
2415
|
<Box
|
|
2262
2416
|
component="div"
|
|
2263
|
-
sx={{
|
|
2417
|
+
sx={{
|
|
2418
|
+
position: 'absolute',
|
|
2419
|
+
insetBlockStart: gutter,
|
|
2420
|
+
insetInlineEnd: gutter,
|
|
2421
|
+
display: 'flex',
|
|
2422
|
+
gap: 1,
|
|
2423
|
+
pointerEvents: 'auto',
|
|
2424
|
+
}}
|
|
2264
2425
|
>
|
|
2426
|
+
{!isFullscreen && <UndoRedo />}
|
|
2265
2427
|
<FullscreenToggle compact={!isDesktop} />
|
|
2266
2428
|
</Box>
|
|
2267
2429
|
<Box
|
|
@@ -2269,11 +2431,11 @@ const ConfiguratorLayout = () => {
|
|
|
2269
2431
|
sx={{
|
|
2270
2432
|
position: 'absolute',
|
|
2271
2433
|
pointerEvents: 'auto',
|
|
2272
|
-
// Desktop: bottom left, above the row of view controls. Phone: at the top
|
|
2273
|
-
// clear of the sheet's handle and the view controls.
|
|
2434
|
+
// Desktop: bottom left, above the row of view controls. Phone: at the top below the row of undo, redo and
|
|
2435
|
+
// fullscreen, clear of the sheet's handle and the view controls.
|
|
2274
2436
|
...(isDesktop
|
|
2275
2437
|
? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
|
|
2276
|
-
: { insetBlockStart: gutter
|
|
2438
|
+
: { insetBlockStart: gutter + TOUCH_TARGET + gutter / 2, insetInline: gutter }),
|
|
2277
2439
|
}}
|
|
2278
2440
|
>
|
|
2279
2441
|
<MessageToast />
|