@salsita-ai/sdk 0.50.0-develop.be40f0cee8 → 0.50.0-develop.d81d7591c5
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/generate-application/code/common/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/common/index.js +1 -1
- package/dist/application-spec/generate-application/code/common/project-module-list.d.ts +8 -0
- package/dist/application-spec/generate-application/code/common/project-module-list.js +3 -0
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/templates/admin-domain-code.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/admin-domain-code.js +6 -14
- package/dist/application-spec/generate-application/code/templates/admin-frontend-code.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/admin-frontend-code.js +4 -4
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.js +7 -16
- package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.js +7 -9
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-assistant.d.ts +2 -2
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-assistant.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +4 -4
- package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
- package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +41 -13
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +6 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +30 -3
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +19 -5
- package/dist/application-spec/generate-application/code/templates/webhook-builders.js +8 -4
- package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +4 -3
- package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.d.ts +3 -8
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-field-type.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +9 -43
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-server-settings.d.ts +2 -2
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant.d.ts +5 -21
- package/dist/client/phoenix-api.d.ts +58 -30
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +158 -13
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.d.ts +85 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/change-recorder.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +8 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +4 -0
- 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 +16 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.d.ts +9 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/side-effects.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
- package/dist/configurator/common/frontend-analytics.d.ts +21 -21
- package/dist/configurator/index.d.ts +0 -1
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/scene/scene-analytics/scene-analytics.d.ts +2 -2
- package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
- package/dist/configurator/ui/assistant/AssistantComposer.d.ts +1 -6
- package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/AssistantThread.d.ts +1 -6
- package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
- package/dist/configurator/ui/assistant/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/index.js +1 -1
- package/dist/configurator/ui/assistant/thread-items.d.ts +1 -1
- package/dist/configurator/ui/assistant/tool-chip.d.ts +8 -1
- package/dist/configurator/ui/assistant/tool-chip.js +1 -1
- package/dist/configurator/ui/assistant/use-is-assistant-panel-open.d.ts +5 -0
- package/dist/configurator/ui/assistant/use-is-assistant-panel-open.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +2 -2
- package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
- package/dist/configurator/ui/legacy/mobile-controls/MobileControls.d.ts +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.d.ts +2 -2
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
- package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +84 -98
- package/dist/docs/complex-use-cases/navigation-reset-selection.mdx +18 -12
- package/dist/docs/index.json +1 -1
- package/dist/docs/layouts/custom-price.mdx +14 -16
- package/dist/docs/layouts/sidebar/tabs.mdx +24 -21
- package/dist/docs/layouts/toolbar.mdx +3 -1
- package/dist/docs/other-features/domain-actions.mdx +1 -1
- package/dist/docs/other-features/side-effects.mdx +68 -34
- package/dist/docs/other-features/transformers.mdx +1 -1
- package/dist/docs/phoenix/admin.mdx +9 -24
- package/dist/docs/phoenix/localization.mdx +3 -22
- package/dist/docs/phoenix/phoenix-cli.mdx +81 -2
- package/dist/docs/phoenix/project-structure.mdx +9 -2
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +4 -3
- package/dist/docs/recipes-and-delete/recipe-hierarchy-selection.mdx +15 -13
- package/dist/docs/relations/hierarchy.mdx +13 -2
- package/dist/domain/actions/action-factory.d.ts +3 -2
- package/dist/domain/application/application-config.d.ts +25 -75
- package/dist/domain/application/assistant/assistant-manifest.d.ts +61 -0
- package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +95 -0
- package/dist/domain/application/assistant/assistant-value-type.d.ts +9 -0
- package/dist/domain/application/assistant/assistant-value-type.js +1 -0
- package/dist/domain/application/assistant/build-assistant-manifest.d.ts +4 -0
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -0
- package/dist/{phoenix/application-spec → domain/application/assistant}/generate-assistant-prompt.d.ts +6 -5
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -0
- package/dist/domain/application/assistant/index.d.ts +4 -0
- package/dist/domain/application/assistant/index.js +1 -0
- package/dist/domain/application/assistant-field-options.d.ts +1 -1
- package/dist/domain/application/assistant-mutations.d.ts +1 -1
- package/dist/domain/application/assistant-recipe-groups.d.ts +1 -1
- package/dist/domain/application/configurator-builder.d.ts +33 -18
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/element-registration.d.ts +5 -0
- package/dist/domain/application/element-registration.js +1 -1
- package/dist/domain/application/handler-registration.d.ts +5 -0
- package/dist/domain/application/handler-registration.js +1 -1
- package/dist/domain/application/index.d.ts +5 -4
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/resolve-imported-transformers.d.ts +11 -1
- package/dist/domain/application/resolve-imported-transformers.js +1 -1
- package/dist/domain/components/domain-component-optic.d.ts +3 -0
- package/dist/domain/components/domain-component-optic.js +2 -2
- package/dist/domain/components/system-component-builder.js +1 -1
- package/dist/domain/components/updates.d.ts +16 -0
- package/dist/domain/core/action.d.ts +1 -1
- package/dist/domain/core/component.d.ts +1 -1
- package/dist/domain/core/decoder/create-decoder.d.ts +6 -0
- package/dist/domain/core/decoder/create-decoder.js +1 -0
- package/dist/domain/core/decoder/decoder.d.ts +6 -0
- package/dist/domain/core/decoder/decoder.js +1 -0
- package/dist/domain/core/decoder/index.d.ts +2 -0
- package/dist/domain/core/decoder/index.js +1 -0
- package/dist/domain/core/domain-factory.js +1 -1
- package/dist/domain/core/index.d.ts +1 -3
- package/dist/domain/core/index.js +1 -1
- package/dist/domain/core/reflection.d.ts +1 -1
- package/dist/domain/core/reflection.js +1 -1
- package/dist/domain/core/schema/enhanced-json-schema.js +1 -0
- package/dist/domain/core/schema/extended-schema-validator.js +1 -0
- package/dist/domain/core/schema/index.d.ts +3 -0
- package/dist/domain/core/schema/index.js +1 -0
- package/dist/domain/core/schema/schema-validator.js +1 -0
- package/dist/domain/domain-builder.d.ts +10 -1
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-context/action-system/action-system.js +1 -1
- package/dist/domain/domain-context/index.d.ts +1 -1
- package/dist/domain/domain-context/store-system/store-system.js +1 -1
- package/dist/domain/domain-context/transformers/chain-builder.d.ts +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +4 -4
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/domain-runtime/spec/selectors.d.ts +2 -2
- package/dist/domain/domain-runtime/spec/selectors.js +1 -1
- package/dist/domain/domain-runtime/spec/types.d.ts +3 -3
- package/dist/domain/index.d.ts +3 -2
- package/dist/domain/index.js +1 -1
- package/dist/domain/invariants/invariants.d.ts +9 -0
- package/dist/domain/invariants/invariants.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +3 -3
- package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
- package/dist/domain/project-modules/index.d.ts +1 -0
- package/dist/domain/project-modules/index.js +1 -0
- package/dist/domain/project-modules/project-modules.d.ts +41 -0
- package/dist/domain/project-modules/project-modules.js +1 -0
- package/dist/domain/system-components/common/dimension-indicator-schema.d.ts +1 -1
- package/dist/domain/system-components/common/dimension-indicator-schema.js +1 -1
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +7 -6
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/editor/graphql/GraphQLPanel.js +1 -1
- package/dist/editor/variants/VariantAnswerFooter.d.ts +17 -0
- package/dist/editor/variants/VariantAnswerFooter.js +1 -0
- package/dist/editor/variants/VariantPreviewHandler.d.ts +6 -0
- package/dist/editor/variants/VariantPreviewHandler.js +1 -0
- package/dist/editor/variants/variant-preview-styles.d.ts +49 -0
- package/dist/editor/variants/variant-preview-styles.js +1 -0
- 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/gen/configurator-builder.js +21 -8
- package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
- package/dist/legacy/domain-cli/utils/cache.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +18 -19
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +15 -16
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +22 -23
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +15 -16
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/generator-shared.d.ts +7 -2
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/generator-shared.js +8 -12
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/index.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/index.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/webhook-builders.js +7 -7
- package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +4 -3
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/deploy.js +2 -2
- package/dist/phoenix/commands/dev.js +5 -5
- package/dist/phoenix/commands/index.d.ts +1 -0
- package/dist/phoenix/commands/index.js +1 -1
- package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
- package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
- package/dist/phoenix/commands/story-dev.js +2 -2
- package/dist/phoenix/commands/variants.d.ts +35 -0
- package/dist/phoenix/commands/variants.js +1 -0
- package/dist/phoenix/editor-server/commands-router.d.ts +68 -1
- package/dist/phoenix/editor-server/commands-router.js +1 -1
- package/dist/phoenix/editor-server/editor-router.d.ts +65 -0
- package/dist/phoenix/editor-server/editor-server.d.ts +3 -3
- package/dist/phoenix/editor-server/editor-server.js +1 -1
- package/dist/phoenix/editor-server/protocol.d.ts +1 -0
- package/dist/phoenix/editor-server/spec-router.js +1 -1
- package/dist/phoenix/editor-server/trpc.d.ts +3 -0
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +13 -2
- package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
- package/dist/phoenix/services/index.d.ts +4 -0
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/phoenix-application.d.ts +21 -0
- package/dist/phoenix/services/phoenix-application.js +1 -0
- package/dist/phoenix/services/phoenix-store.d.ts +48 -0
- package/dist/phoenix/services/phoenix-store.js +1 -0
- package/dist/phoenix/services/phx-variant-previews-plugin.d.ts +9 -0
- package/dist/phoenix/services/phx-variant-previews-plugin.js +1 -0
- package/dist/phoenix/services/prepare-development-environment.js +1 -1
- package/dist/phoenix/services/variant-file-session.d.ts +36 -0
- package/dist/phoenix/services/variant-file-session.js +1 -0
- package/dist/phoenix/services/variant-preview-service.d.ts +80 -0
- package/dist/phoenix/services/variant-preview-service.js +1 -0
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/analytics/analytics-service.d.ts +2 -2
- package/dist/react-sdk/application-runtime/common-services/analytics/domain-controls-analytics.d.ts +21 -21
- package/dist/react-sdk/application-runtime/hooks/data/use-published-data.d.ts +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-domain-application-props.d.ts +5 -2
- package/dist/react-sdk/application-runtime/hooks/use-spec.d.ts +1 -1
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.d.ts +1 -1
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +4 -4
- package/dist/ui-sdk/common/use-viewport-size.d.ts +4 -1
- package/dist/ui-sdk/common/use-viewport-size.js +1 -1
- package/dist/ui-sdk/components/mobile-controls/index.d.ts +1 -1
- package/dist/webhook/builders/common.d.ts +3 -0
- package/dist/webhook/builders/webhook-builder.d.ts +1 -1
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +4 -4
- package/dist/configurator/assistant/index.d.ts +0 -1
- package/dist/configurator/assistant/index.js +0 -1
- package/dist/configurator/assistant/use-assistant-chat.d.ts +0 -30
- package/dist/configurator/assistant/use-assistant-chat.js +0 -1
- package/dist/configurator/ui/assistant/AssistantPanelProvider.d.ts +0 -42
- package/dist/configurator/ui/assistant/AssistantPanelProvider.js +0 -1
- package/dist/domain/core/json-schema.js +0 -1
- package/dist/phoenix/application-spec/generate-assistant-prompt.js +0 -1
- /package/dist/domain/{core/enhanced-json-schema.js → application/assistant/assistant-manifest.js} +0 -0
- /package/dist/domain/{core/schema-validator.js → application/assistant/assistant-resolved-manifest.js} +0 -0
- /package/dist/domain/core/{schema-validator-ajv.d.ts → schema/create-ajv-schema-validator.d.ts} +0 -0
- /package/dist/domain/core/{schema-validator-ajv.js → schema/create-ajv-schema-validator.js} +0 -0
- /package/dist/domain/core/{schema-validator-csp.d.ts → schema/create-csp-schema-validator.d.ts} +0 -0
- /package/dist/domain/core/{schema-validator-csp.js → schema/create-csp-schema-validator.js} +0 -0
- /package/dist/domain/core/{enhanced-json-schema.d.ts → schema/enhanced-json-schema.d.ts} +0 -0
- /package/dist/domain/core/{json-schema.d.ts → schema/extended-schema-validator.d.ts} +0 -0
- /package/dist/domain/core/{schema-validator.d.ts → schema/schema-validator.d.ts} +0 -0
|
@@ -104,106 +104,92 @@ All inputs include countersinkNotAvailable, as that is fixable by auto fix dialo
|
|
|
104
104
|
And corresponding transformers
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const similarMaterial = availableMaterials.find(m => m.material === newMaterial)
|
|
138
|
-
|
|
139
|
-
if (!similarMaterial) {
|
|
140
|
-
return updates
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const fixUpdate = updateFactory.DomainEntityModification({
|
|
144
|
-
entityId: plate.id,
|
|
145
|
-
stateDelta: {
|
|
146
|
-
material: similarMaterial.material,
|
|
147
|
-
finish: similarMaterial.finish,
|
|
148
|
-
thickness: similarMaterial.thickness,
|
|
149
|
-
},
|
|
150
|
-
updateTag: 'fix.material',
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
return [fixUpdate]
|
|
107
|
+
// src/transformers/fix-finish.ts
|
|
108
|
+
import { availableMaterials } from '../_shared/available-materials.js'
|
|
109
|
+
|
|
110
|
+
export default phx.frontend.transformerBuilder.when
|
|
111
|
+
.entity(['Plate'])
|
|
112
|
+
.modified({ atFields: ['finish'] })
|
|
113
|
+
.then.overrideMatchingUpdate(({ update, getOld$Entity }) => {
|
|
114
|
+
const plate = getOld$Entity()
|
|
115
|
+
const newFinish = update.stateDelta.finish
|
|
116
|
+
|
|
117
|
+
const isAvailable = availableMaterials.some(
|
|
118
|
+
state => state.material === plate.material && state.finish === newFinish && state.thickness === plate.thickness
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if (isAvailable) {
|
|
122
|
+
return [update]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const similarMaterial = availableMaterials.find(m => m.finish === newFinish && m.material === plate.material)
|
|
126
|
+
|
|
127
|
+
if (!similarMaterial) {
|
|
128
|
+
return [update]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const fixUpdate = phx.frontend.updates.DomainEntityModification({
|
|
132
|
+
entityId: plate.id,
|
|
133
|
+
stateDelta: {
|
|
134
|
+
material: similarMaterial.material,
|
|
135
|
+
finish: similarMaterial.finish,
|
|
136
|
+
thickness: similarMaterial.thickness,
|
|
154
137
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
stateDelta: {
|
|
195
|
-
material: similarMaterial.material,
|
|
196
|
-
finish: similarMaterial.finish,
|
|
197
|
-
thickness: similarMaterial.thickness,
|
|
198
|
-
},
|
|
199
|
-
updateTag: 'fix.brushed',
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
return [fixUpdate]
|
|
138
|
+
updateTag: 'fix.brushed',
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
return [fixUpdate]
|
|
142
|
+
})
|
|
143
|
+
.build('fix-finish')
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// src/transformers/fix-material.ts
|
|
148
|
+
import { availableMaterials } from '../_shared/available-materials.js'
|
|
149
|
+
|
|
150
|
+
export default phx.frontend.transformerBuilder.when
|
|
151
|
+
.entity(['Plate'])
|
|
152
|
+
.modified({ atFields: ['material'] })
|
|
153
|
+
.then.overrideMatchingUpdate(({ update, getOld$Entity }) => {
|
|
154
|
+
const plate = getOld$Entity()
|
|
155
|
+
const newMaterial = update.stateDelta.material
|
|
156
|
+
|
|
157
|
+
const isAvailable = availableMaterials.some(
|
|
158
|
+
state => state.material === newMaterial && state.finish === plate.finish && state.thickness === plate.thickness
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
if (isAvailable) {
|
|
162
|
+
return [update]
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const similarMaterial = availableMaterials.find(m => m.material === newMaterial)
|
|
166
|
+
|
|
167
|
+
if (!similarMaterial) {
|
|
168
|
+
return [update]
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const fixUpdate = phx.frontend.updates.DomainEntityModification({
|
|
172
|
+
entityId: plate.id,
|
|
173
|
+
stateDelta: {
|
|
174
|
+
material: similarMaterial.material,
|
|
175
|
+
finish: similarMaterial.finish,
|
|
176
|
+
thickness: similarMaterial.thickness,
|
|
203
177
|
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
178
|
+
updateTag: 'fix.material',
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
return [fixUpdate]
|
|
182
|
+
})
|
|
183
|
+
.build('fix-material')
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Each file in `src/transformers/` default-exports one transformer and is picked up by its location. The `transformers` section of the spec turns it on by name. For a transformer made with `build(name)` that is the name passed to `build(...)`, which must match the file name with case and dashes ignored (`fix-finish.ts` and `fixFinish` match). For a plain-function export it is the file name:
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
# spec/application.yaml
|
|
190
|
+
transformers:
|
|
191
|
+
- name: fix-finish
|
|
192
|
+
- name: fix-material
|
|
207
193
|
```
|
|
208
194
|
|
|
209
195
|
And FilteredControls
|
|
@@ -18,7 +18,7 @@ The `createResetSelectionOnNavigationTransformer` automatically deselects entiti
|
|
|
18
18
|
|
|
19
19
|
## Guide
|
|
20
20
|
|
|
21
|
-
The `createResetSelectionOnNavigationTransformer` is added
|
|
21
|
+
The `createResetSelectionOnNavigationTransformer` is added as a file in `src/transformers/`. It automatically injects a deselect update when navigating to specified states.
|
|
22
22
|
|
|
23
23
|
### Step 1: Import the transformer
|
|
24
24
|
|
|
@@ -28,19 +28,25 @@ Import the transformer function from the domain package:
|
|
|
28
28
|
import { createResetSelectionOnNavigationTransformer } from '@salsita-ai/sdk/domain'
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
### Step 2: Add the transformer to your
|
|
31
|
+
### Step 2: Add the transformer to your project
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Create the transformer in a file under `src/transformers/`:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
// src/transformers/reset-selection.ts
|
|
37
|
+
import { createResetSelectionOnNavigationTransformer } from '@salsita-ai/sdk/domain'
|
|
38
|
+
|
|
39
|
+
export default phx.frontend.createTransformer(ctx =>
|
|
40
|
+
createResetSelectionOnNavigationTransformer([phx.applicationTypes.NavigationState.SecondStep], ctx)
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Each file in `src/transformers/` default-exports one transformer and is picked up by its location. The `transformers` section of the spec turns it on by name. For a transformer made with `build(name)` that is the name passed to `build(...)`, which must match the file name with case and dashes ignored (`fix-finish.ts` and `fixFinish` match). For a plain-function export it is the file name:
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
# spec/application.yaml
|
|
48
|
+
transformers:
|
|
49
|
+
- name: reset-selection
|
|
44
50
|
```
|
|
45
51
|
|
|
46
52
|
The transformer takes two arguments:
|
|
@@ -97,7 +103,7 @@ When the transformer triggers, any selected entity is deselected automatically.
|
|
|
97
103
|
*
|
|
98
104
|
* @param navigationStates - Array of navigation state names that trigger deselection
|
|
99
105
|
* @param ctx - Domain context providing access to the navigation system
|
|
100
|
-
* @returns Update transformer
|
|
106
|
+
* @returns Update transformer to return from a transformer file in src/transformers/
|
|
101
107
|
*
|
|
102
108
|
* @example
|
|
103
109
|
* // Deselect when entering the summary step
|
package/dist/docs/index.json
CHANGED
|
@@ -78,24 +78,22 @@ Your custom component has full access to the Material-UI theme and SDK utilities
|
|
|
78
78
|
|
|
79
79
|
### Step 3: Attach the component to your entity
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Attach your custom price component to the root entity in a file under `src/components/`. The generated code picks the
|
|
82
|
+
file up by its location and registers its default export:
|
|
82
83
|
|
|
83
84
|
```typescript
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
),
|
|
97
|
-
])
|
|
98
|
-
.buildConfig()
|
|
85
|
+
// src/components/custom-price.tsx
|
|
86
|
+
export default phx.domain.attachComponent
|
|
87
|
+
.withEntity('Scene')
|
|
88
|
+
.withComponent(customPriceFooterComponent, 'default')
|
|
89
|
+
.attach(
|
|
90
|
+
memoEval(
|
|
91
|
+
(s) => [s.$price],
|
|
92
|
+
(price) => ({
|
|
93
|
+
node: <AppPrice price={price} />,
|
|
94
|
+
})
|
|
95
|
+
)
|
|
96
|
+
)
|
|
99
97
|
```
|
|
100
98
|
|
|
101
99
|
The `memoEval` function takes two arguments:
|
|
@@ -179,27 +179,30 @@ When a selected entity has no `sidebarTabs`, its property pages replace the root
|
|
|
179
179
|
You can use transformers to automatically navigate to specific tabs when entities are selected or deselected:
|
|
180
180
|
|
|
181
181
|
```typescript
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
182
|
+
// src/transformers/bucky-ball-tab.ts
|
|
183
|
+
export default phx.frontend.transformerBuilder.when
|
|
184
|
+
.entity(['BuckyBall'])
|
|
185
|
+
.selected()
|
|
186
|
+
.then.navigateTo('BuckyBallTab1')
|
|
187
|
+
.build('buckyBallTab')
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// src/transformers/tab.ts
|
|
192
|
+
export default phx.frontend.transformerBuilder.when
|
|
193
|
+
.entity(['BuckyBall'])
|
|
194
|
+
.deselected()
|
|
195
|
+
.then.navigateTo('tab1')
|
|
196
|
+
.build('tab')
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Each file in `src/transformers/` default-exports one transformer and is picked up by its location. The `transformers` section of the spec turns it on by name. For a transformer made with `build(name)` that is the name passed to `build(...)`, which must match the file name with case and dashes ignored (`fix-finish.ts` and `fixFinish` match). For a plain-function export it is the file name:
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
# spec/application.yaml
|
|
203
|
+
transformers:
|
|
204
|
+
- name: buckyBallTab
|
|
205
|
+
- name: tab
|
|
203
206
|
```
|
|
204
207
|
|
|
205
208
|
This creates smooth navigation flows where selecting specific entities automatically switches to their relevant tabs, and deselecting returns to a default tab state.
|
|
@@ -84,7 +84,9 @@ Phoenix provides built-in toolbar buttons for common operations:
|
|
|
84
84
|
- `assistantToolbarButton` - Open and close the built-in assistant panel. It renders only in a project whose
|
|
85
85
|
application spec has an `assistant` section. `props.showTitle` defaults to `true`; the label shows on a
|
|
86
86
|
desktop-sized layout only. The default toolbar includes it, in a group of its own, when the spec has an
|
|
87
|
-
`assistant` section.
|
|
87
|
+
`assistant` section. Only the universal layout carries the panel, and the button does not hide itself in a
|
|
88
|
+
layout without it. A custom layout that renders the toolbar therefore defines a `toolbar` component without the
|
|
89
|
+
button, because the default toolbar would add it.
|
|
88
90
|
|
|
89
91
|
### Mobile Toolbar Configuration
|
|
90
92
|
|
|
@@ -83,7 +83,7 @@ export default phx.domain.implementActions({
|
|
|
83
83
|
})
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Throw to reject a call: the message reaches the user through the control's hint and the assistant through the failed mutation, so say what went wrong and what to send instead. An
|
|
86
|
+
Throw to reject a call: the message reaches the user through the control's hint and the assistant through the failed mutation, so say what went wrong and what to send instead. An implementation of a name the spec does not declare is a type error. A declared action without an implementation is not: it stops the domain from initializing, and under `phoenix dev` the editor reports it as a `MISSING_ACTION_IMPLEMENTATIONS` diagnostic and does not apply the change; an implementation of an undeclared name is logged.
|
|
87
87
|
|
|
88
88
|
## Run it from the UI
|
|
89
89
|
|
|
@@ -66,42 +66,76 @@ With following control structure. The top input selects the material, the bottom
|
|
|
66
66
|
The transformer is used to change the finish if necessary and show the notification.
|
|
67
67
|
|
|
68
68
|
```typescript
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.
|
|
69
|
+
// src/transformers/fix-finish.ts
|
|
70
|
+
import { msg } from '@lingui/core/macro'
|
|
71
|
+
|
|
72
|
+
import { availableMaterials } from '../_shared/materials.js'
|
|
73
|
+
|
|
74
|
+
export default phx.frontend.transformerBuilder.when
|
|
75
|
+
.entity(['Plate'])
|
|
76
|
+
.modified({ atFields: ['material'] })
|
|
77
|
+
.causes.self.violation(['finishNotAvailable'])
|
|
78
|
+
.then.applySideEffect(({ update, getOld$Entity }) => {
|
|
79
|
+
const oldPlate = getOld$Entity()
|
|
80
|
+
const newMaterial = update.stateDelta.material
|
|
81
|
+
|
|
82
|
+
const validMaterial =
|
|
83
|
+
availableMaterials.find(m => m.material === newMaterial && m.finish === oldPlate.finish) ??
|
|
84
|
+
availableMaterials.find(m => m.material === newMaterial)
|
|
85
|
+
|
|
86
|
+
if (!validMaterial || validMaterial.finish === oldPlate.finish) {
|
|
87
|
+
return []
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// create an additional update that will fix the material finish
|
|
91
|
+
const fixUpdate = phx.frontend.updates.DomainEntityModification({
|
|
92
|
+
entityId: oldPlate.id,
|
|
93
|
+
stateDelta: {
|
|
94
|
+
finish: validMaterial.finish,
|
|
95
|
+
},
|
|
96
|
+
updateTag: 'fix.finish',
|
|
97
|
+
hint: msg`Material finish was adjusted`, // specify a hint for the user (side effect)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
return [fixUpdate]
|
|
101
|
+
})
|
|
102
|
+
.build('fix-finish')
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
Each file in `src/transformers/` default-exports one transformer and is picked up by its location. The `transformers` section of the spec turns it on by name. For a transformer made with `build(name)` that is the name passed to `build(...)`, which must match the file name with case and dashes ignored (`fix-finish.ts` and `fixFinish` match). For a plain-function export it is the file name:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
# spec/application.yaml
|
|
109
|
+
transformers:
|
|
110
|
+
- name: fix-finish
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Hints and the AI assistant
|
|
114
|
+
|
|
115
|
+
In a configurator with the AI assistant, the assistant is told the same hints: they arrive as
|
|
116
|
+
`sideEffects` with the result of its changes and in the dry-runs of recipes and options, so it can
|
|
117
|
+
tell the user what else happened. The hints also explain what the user changed between two messages:
|
|
118
|
+
every message carries a change record of the configuration, and each of its lines ends with the hint
|
|
119
|
+
of the last update that touched it, or with the `updateTag` when the update has none. Set `agentHint`
|
|
120
|
+
beside `hint` when the assistant needs different wording, for example with ids or values a snackbar
|
|
121
|
+
would not show:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
phx.frontend.updates.DomainEntityModification({
|
|
125
|
+
entityId: oldPlate.id,
|
|
126
|
+
stateDelta: { finish: validMaterial.finish },
|
|
127
|
+
updateTag: 'fix.finish',
|
|
128
|
+
hint: msg`Material finish was adjusted`,
|
|
129
|
+
agentHint: `The finish of ${oldPlate.id} was changed to ${validMaterial.finish}, the only one this material comes in.`,
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- `agentHint` is a plain string, never shown to the user and not localized.
|
|
134
|
+
- `agentHint: null` keeps the wording from the assistant while the user still gets the `hint`: the
|
|
135
|
+
update is left out of `sideEffects`, and the change record explains its line by the `updateTag`. It
|
|
136
|
+
does not hide the change itself, which the assistant can always read from the configuration.
|
|
137
|
+
- `agentHint` without a `hint` tells only the assistant.
|
|
138
|
+
|
|
105
139
|
## Example
|
|
106
140
|
|
|
107
141
|
Here you can see the live example!
|
|
@@ -102,7 +102,7 @@ export const removeExtraneousBranchesAndLeavesWhenShortened = phx.frontend.trans
|
|
|
102
102
|
- With `overrideMatchinUpdates(ctx => /* side effect updates */)` the updates returned by the provided callback will replace the original **matched update**. This will be triggered for every matching update. Note that this action is not available in events which are not bound to a specific update - such as a violation check without a defined cause.
|
|
103
103
|
- With `overrideAllUpdates(ctx => /* side effect updates */)` the updates returned by the provided callback will replace all original updates. This will be triggered only once for a single run of the transformer. This allows for implementation of transformers that behave similarly as the raw `UpdateTransformer`
|
|
104
104
|
- High-level actions: `select`, `deselect`, `navigate`, `changeView` - more on these in the other examples.
|
|
105
|
-
- `build(name)` is the final step to create the transformer.
|
|
105
|
+
- `build(name)` is the final step to create the transformer. The name identifies the transformer while tracing, and it is the name the `transformers` section of the spec refers to, so it must match the file name with case and dashes ignored (`fix-finish.ts` and `fixFinish` match). Note that this returns a `RegistrableTransformer`. Default-export it from a file in `src/transformers/` and list the name passed to `build(...)` in the `transformers` section of the spec; the generated code registers it. The shorter snippets on this page use descriptive names for readability; the complete implementation below uses names that match its files.
|
|
106
106
|
|
|
107
107
|
### Side-Effect on Update Causing Another Entity's Violation
|
|
108
108
|
|
|
@@ -427,43 +427,28 @@ For technical details about data transformation and storage, see [Data Sources -
|
|
|
427
427
|
|
|
428
428
|
## Web Component Integration
|
|
429
429
|
|
|
430
|
-
Admin functionality
|
|
430
|
+
Admin functionality is part of the same application as the configurator and needs no separate web component setup.
|
|
431
431
|
|
|
432
|
-
###
|
|
432
|
+
### Registering Admin Components
|
|
433
433
|
|
|
434
|
-
|
|
434
|
+
The frontend entry is generated into `.phoenix/`, so a project never calls the configurator builder itself. Every file
|
|
435
|
+
in `src/admin/components/` is picked up by its location and its default export is registered as admin components:
|
|
435
436
|
|
|
436
437
|
```typescript
|
|
437
438
|
// src/admin/components/admin-components.tsx
|
|
438
|
-
|
|
439
|
-
import { customAdminOptics } from './optics.js'
|
|
440
|
-
import { NotAuthenticatedPage } from '../pages/NotAuthenticatedPage.js'
|
|
441
|
-
|
|
442
|
-
const config = configuratorBuilder
|
|
443
|
-
.withComponentOptics(customConfiguratorComponents)
|
|
444
|
-
.withAdminComponentOptics(customAdminOptics) // Register admin components
|
|
445
|
-
.buildConfig({
|
|
446
|
-
deploymentId: phx.runtimeConfig.DEPLOYMENT_ID,
|
|
447
|
-
persistence: {
|
|
448
|
-
type: 'server',
|
|
449
|
-
serverUrl: phx.runtimeConfig.SERVER_URL,
|
|
450
|
-
},
|
|
451
|
-
ui: {
|
|
452
|
-
notAuthenticatedPage: <NotAuthenticatedPage />, // Show when user not authenticated
|
|
453
|
-
},
|
|
454
|
-
// ... other config
|
|
455
|
-
})
|
|
439
|
+
// ... customAdminOptics as defined in the example above
|
|
456
440
|
|
|
457
|
-
|
|
441
|
+
export default customAdminOptics
|
|
458
442
|
```
|
|
459
443
|
|
|
460
|
-
|
|
444
|
+
The page shown to a user who is not authenticated is an element. Create it with
|
|
445
|
+
`phx.frontend.createNotAuthenticatedPage(...)` in a file under `src/elements/`.
|
|
461
446
|
|
|
462
447
|
### Built-in Admin Integration
|
|
463
448
|
|
|
464
449
|
Phoenix automatically provides admin functionality when:
|
|
465
450
|
|
|
466
|
-
1. Admin components are
|
|
451
|
+
1. Admin components are default-exported from files in `src/admin/components/`
|
|
467
452
|
2. Admin configuration exists in `phoenix.config.ts`
|
|
468
453
|
3. User has admin session token
|
|
469
454
|
|
|
@@ -116,28 +116,9 @@ After running `pnpm lingui:compile`, your custom translations will override the
|
|
|
116
116
|
- Adapt translations for your target audience
|
|
117
117
|
- Maintain consistency with your existing product language
|
|
118
118
|
|
|
119
|
-
**Frontend integration**:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
import { configuratorBuilder } from 'project-domain'
|
|
123
|
-
import { createI18n } from 'project-i18n'
|
|
124
|
-
|
|
125
|
-
const i18n = createI18n()
|
|
126
|
-
|
|
127
|
-
export const config = configuratorBuilder
|
|
128
|
-
.withComponentOptics(customComponents)
|
|
129
|
-
.withPresets(presets)
|
|
130
|
-
.withI18n(i18n) // Register i18n service with configurator
|
|
131
|
-
.buildConfig({
|
|
132
|
-
features: {
|
|
133
|
-
availableLocales: ['en', 'de', 'cs'],
|
|
134
|
-
},
|
|
135
|
-
services: {
|
|
136
|
-
logger,
|
|
137
|
-
},
|
|
138
|
-
// ... other configuration
|
|
139
|
-
})
|
|
140
|
-
```
|
|
119
|
+
**Frontend integration**: the generated `.phoenix` code creates the i18n service from `.phoenix/i18n.ts` and registers
|
|
120
|
+
it with the application, so there is nothing to wire by hand. The languages come from `availableLocales` in
|
|
121
|
+
`spec/application.yaml`.
|
|
141
122
|
|
|
142
123
|
## Working with YAML Domain Specifications
|
|
143
124
|
|