@salsita-ai/sdk 0.50.0-develop.c33986dc44 → 0.50.0-develop.ca5894b56c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/application-spec/core/enhanced-json-value.d.ts +2 -31
- package/dist/application-spec/core/enhanced-json-value.js +1 -1
- package/dist/application-spec/core/index.d.ts +1 -3
- package/dist/application-spec/core/index.js +1 -1
- package/dist/application-spec/core/json-schema.d.ts +2 -52
- package/dist/application-spec/core/markers/index.d.ts +1 -1
- package/dist/application-spec/core/markers/index.js +1 -1
- package/dist/application-spec/core/markers/msg-marker.d.ts +2 -28
- package/dist/application-spec/core/markers/msg-marker.js +1 -1
- package/dist/application-spec/core/markers/raw-eval-write-marker.d.ts +1 -1
- package/dist/application-spec/core/markers/raw-eval-write-marker.js +1 -1
- package/dist/application-spec/core/markers/raw-read-write-marker.js +1 -1
- package/dist/application-spec/errors/diagnostic-codes.d.ts +1 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +1 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/templates/index.d.ts +2 -6
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.d.ts +10 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +7 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -1
- package/dist/application-spec/generate-application/runtime/generate-runtime-instance.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/generate-runtime-instance.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/preset-runtime.d.ts +2 -3
- package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +1 -1
- package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.d.ts +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/aliases.d.ts +3 -9
- package/dist/application-spec/parse-application-files/spec/model/common-types.d.ts +6 -14
- package/dist/application-spec/parse-application-files/spec/model/defaults.d.ts +6 -31
- package/dist/application-spec/parse-application-files/spec/model/entity-types.d.ts +3 -8
- package/dist/application-spec/parse-application-files/spec/model/model-version-key.d.ts +3 -3
- package/dist/application-spec/parse-application-files/spec/model/names/action-name.d.ts +3 -7
- package/dist/application-spec/parse-application-files/spec/model/names/alias-name.d.ts +3 -7
- package/dist/application-spec/parse-application-files/spec/model/names/entity-or-alias-name.d.ts +3 -8
- package/dist/application-spec/parse-application-files/spec/model/names/entity-type-name.d.ts +3 -8
- package/dist/application-spec/parse-application-files/spec/model/names/expression-name.d.ts +3 -6
- package/dist/application-spec/parse-application-files/spec/model/names/instance-name.d.ts +3 -7
- package/dist/application-spec/parse-application-files/spec/model/names/invariant-name.d.ts +3 -3
- package/dist/application-spec/parse-application-files/spec/model/names/shape-property-name.d.ts +3 -11
- package/dist/application-spec/parse-application-files/spec/model/names/violation-type-name.d.ts +3 -3
- package/dist/application-spec/parse-application-files/spec/model/presets.d.ts +6 -29
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/contract.d.ts +17 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/local-authorized-client.d.ts +3 -1
- package/dist/client/local-authorized-client.js +1 -1
- package/dist/client/memory-authorized-client.d.ts +4 -1
- package/dist/client/memory-authorized-client.js +1 -1
- package/dist/client/phoenix-api.d.ts +228 -0
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +13 -0
- 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 +2 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +15 -9
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +2 -2
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/configurator-context/ConfiguratorDataProvider.js +1 -1
- package/dist/configurator/configurator-context/PresetSelectionProvider.js +1 -1
- package/dist/configurator/configurator-context/configurator-hooks/index.d.ts +0 -1
- package/dist/configurator/configurator-context/configurator-hooks/index.js +1 -1
- package/dist/configurator/configurator-context/index.d.ts +0 -4
- package/dist/configurator/configurator-context/index.js +1 -1
- package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/pages/error-boundaries/DevContextFallback.js +1 -1
- package/dist/configurator/pages/error-boundaries/DevLoadingFallback.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +12 -4
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +8 -0
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -0
- package/dist/configurator/ui/configurator-layout/slots/canvas/GPUAccelerationDisabled.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/WebGLNotSupported.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/readonly-banner/CloneToEditDialog.js +1 -1
- package/dist/configurator/ui/legacy/chat/MobileChat.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/CommonTopNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/simple/SimpleSidebar.js +1 -1
- package/dist/configurator/ui/legacy/layout/simple/SimpleTopNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsSideBar.js +1 -1
- package/dist/configurator/ui/legacy/layout/tabs/TabsSidebar.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/back-button/use-go-back-action.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
- package/dist/docs/3d-scene/cameras/custom.mdx +4 -2
- package/dist/docs/index.json +1 -1
- package/dist/docs/phoenix/domain-model.mdx +4 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +14 -6
- package/dist/docs/phoenix/project-structure.mdx +21 -17
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
- package/dist/docs/phoenix/webhooks.mdx +5 -1
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/index.d.ts +1 -0
- package/dist/domain/index.js +1 -1
- package/dist/domain/spec/application/index.d.ts +1 -0
- package/dist/domain/spec/application/index.js +1 -0
- package/dist/{application-spec/core → domain/spec}/components/component-filter.d.ts +3 -2
- package/dist/domain/spec/enhanced-json-value.d.ts +30 -0
- package/dist/domain/spec/enhanced-json-value.js +1 -0
- package/dist/domain/spec/index.d.ts +7 -0
- package/dist/domain/spec/index.js +1 -0
- package/dist/domain/spec/json-schema.d.ts +52 -0
- package/dist/domain/spec/json-schema.js +1 -0
- package/dist/domain/spec/markers/index.d.ts +2 -0
- package/dist/domain/spec/markers/index.js +1 -0
- package/dist/domain/spec/markers/msg-marker.d.ts +28 -0
- package/dist/domain/spec/markers/msg-marker.js +1 -0
- package/dist/domain/spec/model/aliases.d.ts +9 -0
- package/dist/domain/spec/model/aliases.js +1 -0
- package/dist/domain/spec/model/common-types.d.ts +15 -0
- package/dist/domain/spec/model/common-types.js +1 -0
- package/dist/domain/spec/model/defaults.d.ts +33 -0
- package/dist/domain/spec/model/defaults.js +1 -0
- package/dist/domain/spec/model/entity-types.d.ts +8 -0
- package/dist/domain/spec/model/entity-types.js +1 -0
- package/dist/domain/spec/model/index.d.ts +7 -0
- package/dist/domain/spec/model/index.js +1 -0
- package/dist/domain/spec/model/model-version-key.d.ts +3 -0
- package/dist/domain/spec/model/model-version-key.js +1 -0
- package/dist/domain/spec/model/names/action-name.d.ts +7 -0
- package/dist/domain/spec/model/names/action-name.js +1 -0
- package/dist/domain/spec/model/names/alias-name.d.ts +7 -0
- package/dist/domain/spec/model/names/alias-name.js +1 -0
- package/dist/domain/spec/model/names/entity-or-alias-name.d.ts +8 -0
- package/dist/domain/spec/model/names/entity-or-alias-name.js +1 -0
- package/dist/domain/spec/model/names/entity-type-name.d.ts +8 -0
- package/dist/domain/spec/model/names/entity-type-name.js +1 -0
- package/dist/domain/spec/model/names/expression-name.d.ts +6 -0
- package/dist/domain/spec/model/names/expression-name.js +1 -0
- package/dist/domain/spec/model/names/index.d.ts +9 -0
- package/dist/domain/spec/model/names/index.js +1 -0
- package/dist/domain/spec/model/names/instance-name.d.ts +7 -0
- package/dist/domain/spec/model/names/instance-name.js +1 -0
- package/dist/domain/spec/model/names/invariant-name.d.ts +3 -0
- package/dist/domain/spec/model/names/invariant-name.js +1 -0
- package/dist/domain/spec/model/names/shape-property-name.d.ts +11 -0
- package/dist/domain/spec/model/names/shape-property-name.js +1 -0
- package/dist/domain/spec/model/names/violation-type-name.d.ts +3 -0
- package/dist/domain/spec/model/names/violation-type-name.js +1 -0
- package/dist/domain/spec/model/presets.d.ts +30 -0
- package/dist/domain/spec/model/presets.js +1 -0
- package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +1 -0
- package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
- package/dist/phoenix/application-spec/generate-project-files.d.ts +1 -0
- package/dist/phoenix/application-spec/index.d.ts +1 -0
- package/dist/phoenix/application-spec/index.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +11 -0
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/bin.js +1 -1
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/build.js +1 -1
- package/dist/phoenix/commands/clean.js +1 -1
- package/dist/phoenix/commands/deploy.js +1 -1
- package/dist/phoenix/commands/dev.js +5 -5
- package/dist/phoenix/commands/generated-env-markers.d.ts +1 -0
- package/dist/phoenix/commands/generated-env-markers.js +1 -1
- package/dist/phoenix/commands/index.d.ts +1 -1
- package/dist/phoenix/commands/index.js +1 -1
- package/dist/phoenix/commands/sync.js +1 -1
- package/dist/phoenix/lingui/index.d.ts +1 -0
- package/dist/phoenix/lingui/index.js +1 -0
- package/dist/phoenix/{services → lingui}/lingui.d.ts +5 -2
- package/dist/phoenix/lingui/lingui.js +1 -0
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +3 -1
- package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
- package/dist/phoenix/services/index.d.ts +1 -0
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/lingui-watcher.js +1 -1
- package/dist/phoenix/services/prepare-development-environment.js +1 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/react-sdk/application-runtime/domain-application-context/chat-system.d.ts +1 -1
- package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/ConfiguratorRoutingProvider.d.ts +1 -1
- package/dist/react-sdk/configurator-routing/ConfiguratorRoutingProvider.js +1 -0
- package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/OnGoToIndexHandler.d.ts +1 -2
- package/dist/react-sdk/configurator-routing/OnGoToIndexHandler.js +1 -0
- package/dist/react-sdk/configurator-routing/index.d.ts +3 -0
- package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/index.js +1 -1
- package/dist/{configurator/configurator-context → react-sdk}/configurator-routing/use-power-routing-lifecycle.d.ts +2 -0
- package/dist/react-sdk/configurator-routing/use-power-routing-lifecycle.js +1 -0
- package/dist/react-sdk/domain-application-context/OnPresetLoadedHandler.js +1 -0
- package/dist/react-sdk/domain-application-context/chat-hooks.d.ts +4 -0
- package/dist/react-sdk/domain-application-context/chat-hooks.js +1 -0
- package/dist/react-sdk/domain-application-context/index.d.ts +2 -0
- package/dist/react-sdk/domain-application-context/index.js +1 -1
- package/dist/react-sdk/index.d.ts +3 -0
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/integration/IntegrationSubscription.js +1 -0
- package/dist/react-sdk/integration/index.d.ts +1 -0
- package/dist/react-sdk/integration/index.js +1 -0
- package/dist/react-sdk/lifecycle-providers/LifecycleProviders.js +1 -0
- package/dist/react-sdk/lifecycle-providers/index.d.ts +1 -0
- package/dist/react-sdk/lifecycle-providers/index.js +1 -0
- package/package.json +3 -3
- package/dist/configurator/configurator-context/IntegrationSubscription.js +0 -1
- package/dist/configurator/configurator-context/LifecycleProviders.js +0 -1
- package/dist/configurator/configurator-context/OnPresetLoadedHandler.js +0 -1
- package/dist/configurator/configurator-context/configurator-hooks/chat-hooks.d.ts +0 -1
- package/dist/configurator/configurator-context/configurator-hooks/chat-hooks.js +0 -1
- package/dist/configurator/configurator-context/configurator-routing/ConfiguratorRoutingProvider.js +0 -1
- package/dist/configurator/configurator-context/configurator-routing/OnGoToIndexHandler.js +0 -1
- package/dist/configurator/configurator-context/configurator-routing/index.d.ts +0 -2
- package/dist/configurator/configurator-context/configurator-routing/use-power-routing-lifecycle.js +0 -1
- package/dist/phoenix/services/lingui.js +0 -1
- /package/dist/{application-spec/core → domain/spec/application}/application-instance.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec/application}/application-instance.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/component-filter.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/index.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/index.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/components/sdk-code-ref.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/index.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/index.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/relation-expression-params.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/relation-expression-params.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/expressions/sdk-expression-implementation.js +0 -0
- /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.d.ts +0 -0
- /package/dist/{application-spec/core → domain/spec}/markers/eval-marker.js +0 -0
- /package/dist/{configurator/configurator-context → react-sdk/domain-application-context}/OnPresetLoadedHandler.d.ts +0 -0
- /package/dist/{configurator/configurator-context → react-sdk/integration}/IntegrationSubscription.d.ts +0 -0
- /package/dist/{configurator/configurator-context → react-sdk/lifecycle-providers}/LifecycleProviders.d.ts +0 -0
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts
CHANGED
|
@@ -11,19 +11,25 @@ export interface GraphQLOperation {
|
|
|
11
11
|
export interface GraphQLScreenshot {
|
|
12
12
|
readonly entityId: string;
|
|
13
13
|
readonly view: string;
|
|
14
|
-
/** The picture
|
|
15
|
-
readonly
|
|
16
|
-
readonly mimeType: 'image/jpeg' | 'image/png';
|
|
14
|
+
/** The id the server stored the picture under, which the tool result references it by. */
|
|
15
|
+
readonly imageId: string;
|
|
17
16
|
}
|
|
18
17
|
export interface GraphQLSystemContext {
|
|
19
18
|
/** The assistant the initialized session runs: the operations are validated and executed against its schema. */
|
|
20
19
|
readonly getAssistantSetup: () => SessionAssistantSetup;
|
|
21
20
|
/**
|
|
22
21
|
* Renders the picture an `agentScreenshot` component of a state declares, behind every export
|
|
23
|
-
* already queued; `null` from an executor that renders no pictures.
|
|
24
|
-
* execution, and the only one that needs a canvas.
|
|
22
|
+
* already queued, as a JPEG or PNG blob; `null` from an executor that renders no pictures. One of
|
|
23
|
+
* the two async steps of an execution, and the only one that needs a canvas.
|
|
25
24
|
*/
|
|
26
25
|
readonly renderScreenshot: (component: ComponentSnapshot<AgentScreenshotComponent>, state: AnyDomainState) => Promise<Blob | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Stores a rendered screenshot in the assistant thread on the server and resolves with the id the
|
|
28
|
+
* tool result references it by. The other async step of an execution, run right after each render.
|
|
29
|
+
*/
|
|
30
|
+
readonly uploadScreenshot: (image: Blob) => Promise<{
|
|
31
|
+
readonly imageId: string;
|
|
32
|
+
}>;
|
|
27
33
|
readonly specSelectors: SpecSelectors;
|
|
28
34
|
readonly domainContextSelectors: DomainContextSelectors;
|
|
29
35
|
readonly domainServicesSelectors: DomainServicesSelectors;
|
|
@@ -97,7 +103,7 @@ export declare class GraphQLSystem {
|
|
|
97
103
|
private readonly _resolveType;
|
|
98
104
|
private _generation;
|
|
99
105
|
/**
|
|
100
|
-
* The picture of an entity of a state from one `agentScreenshot` view, as
|
|
106
|
+
* The picture of an entity of a state from one `agentScreenshot` view, as a blob of the view's
|
|
101
107
|
* file format; `null` when the view is not attached to the entity there or nothing renders it.
|
|
102
108
|
*/
|
|
103
109
|
private readonly _renderScreenshot;
|
|
@@ -118,9 +124,9 @@ export declare class GraphQLSystem {
|
|
|
118
124
|
private readonly _runMutation;
|
|
119
125
|
/**
|
|
120
126
|
* Takes a screenshot once every one asked for before it in the execution has been taken, so they
|
|
121
|
-
* render and
|
|
122
|
-
* nothing else: the user kept changing the configuration,
|
|
123
|
-
*
|
|
127
|
+
* render in document order, and uploads it as soon as it has rendered. A failure nulls only its
|
|
128
|
+
* own field and fails nothing else: the user kept changing the configuration, rendering failed,
|
|
129
|
+
* or the server did not store the picture.
|
|
124
130
|
*/
|
|
125
131
|
private readonly _takeScreenshot;
|
|
126
132
|
private readonly _setup;
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as r,parse as o,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as f,agentScreenshotComponent as m,createAssistantExecutionSchema as p,findAssistantMutation as g}from"#package/domain";import{ExportBusyError as y}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as v}from"./close-unclosed-braces.js";import{createEntityMeta as S}from"./entity-meta.js";import{injectAssistantLenses as w}from"./inject-assistant-lenses.js";import{readSideEffects as _}from"./side-effects.js";let x={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},$={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},b="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",E="Not taken: the screenshots of this tool call have used up its image size budget. Ask for this screenshot in another call, and for fewer in one call.",T=async e=>{let t=new Uint8Array(await e.arrayBuffer()),i="";for(let e=0;e<t.length;e+=32768)i+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(i)},C=new RegExp(f.pattern),M=[...s,t],k=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,j=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,R=e=>e instanceof Error?e.message:String(e),A=e=>/[.!?]$/.test(e)?e:`${e}.`,N=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,z=(e,t)=>{let i=N(e)?e._raw:void 0;if(k(i))return i;if(!Array.isArray(e)&&!N(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>z(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,z(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||u(e)?t(e):e;let q=t=>new e(`The configurator cannot handle this request: ${A(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),L="SCREENSHOT_NOT_TAKEN",F=(t,i)=>new e(t,{originalError:i,extensions:{code:L}}),O=e=>(e.errors??[]).some(e=>e.extensions.code!==L),V=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=p(e),i=l(t);return i.length>0?q(i.map(e=>e.message).join(" ")):t}catch(e){return q(R(e))}});_selectLenses=h([h.leaf(e=>e)],e=>o(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,o,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,o,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),o,s);if(!k(n))return i(n,o,s,a);if("meta"===a.fieldName){let e;return S({entity:n,state:("object"==typeof(e=j(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return j(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===r(a.returnType).name?((t,i,n)=>{try{return z(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let r=t.filter(e=>!C.test(e));if(r.length>0)throw new e(`${r.map(e=>`"${e}"`).join(", ")} ${1===r.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>C.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>k(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:m,instanceName:t},i);if(!n)return null;let r=await this._context.renderScreenshot(n,i);return null===r?null:{data:await T(r),mimeType:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"}};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,r)=>{if(void 0!==r.failedMutationField)throw new e(`Not run: the earlier field "${r.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,r)}catch(e){throw r.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let r=g(t,n.manifest);if(!r)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let o=n.state,s=r.implementation(i,o,{manifest:n.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(o),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(s.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(s.updates,o,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${A(R(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);n.emissions.push(i),n.state=i.state}return s.readResult({previousState:o,state:n.state})};_takeScreenshot=({entity:t,state:i},n,r)=>{let o=r.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!o)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=r.lastScreenshot.then(async()=>{if(!r.generation.active)throw F(b);if(r.screenshotBudget<=0)throw F(E);let e=await this._renderScreenshot(t.id,o.instanceName,i).catch(e=>{throw F(e instanceof y?"User made concurrent actions that prevented the screenshot from being taken, try again":`The screenshot of ${t.id} from "${n}" could not be taken: ${A(R(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!r.generation.active)throw F(b);if(null===e)return null;if(e.data.length>r.screenshotBudget)throw r.screenshotBudget=0,F(E);r.screenshotBudget-=e.data.length;let s=`${t.id}/${n}`,a=[...r.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,l=0===a?s:`${s}#${a+1}`;return r.screenshots.set(l,{entityId:t.id,view:n,...e}),{image:l}});return r.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:x};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,r,s)=>{let l;try{l=o(t)}catch(t){return{errors:[t instanceof e?t:new e(R(t))]}}let c=a(r.schema,l,M);return c.length>0?{errors:c}:n({schema:r.schema,document:l,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:r.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i,n=this._generation)=>{let r,o=this._setup();if(!o.ready)return i.map(()=>({result:o.result,emissions:[],screenshots:new Map}));let s={manifest:o.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,screenshotBudget:14e5,lastScreenshot:Promise.resolve(),generation:n},a=[];for(let[t,n]of i.entries())if(void 0===r){let i=s.emissions.length,l=s.screenshots.size;s.failedMutationField=void 0;let c=v(n.document),h=o.lenses?w(c,o.lenses):c,d=h instanceof e?{errors:[h]}:await this._run(h,n,o,s);await s.lastScreenshot,a.push({result:d,emissions:s.emissions.slice(i),screenshots:new Map([...s.screenshots].slice(l))}),O(d)&&(r=t)}else a.push({result:V(r),emissions:[],screenshots:new Map});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>_(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));_prepareAndCommit=async(e,t)=>{let i,n,r,o=this._context.domainContextSelectors.getStoreSystem(),s=await this.prepare(o.stateSlices.committed.value.state,e,t),a=s.map(({result:e})=>e),l=this.readSideEffects(s),h=this.readScreenshots(s),d=s.flatMap(e=>e.emissions);if(!t.active)return{results:a,sideEffects:l,screenshots:h,outcome:"conflict"};if(a.some(O)||0===d.length)return{results:a,sideEffects:l,screenshots:h,outcome:"none"};let u=(i=c(d[0]),n=c(d[d.length-1]),r=d.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:i.previousState,state:n.state,updates:d.flatMap(e=>e.updates),validity:n.validity,transformationLog:r?d.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:l,screenshots:h,outcome:o.commitPrepared(u),preparedState:u.state}};execute=async e=>{let t=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>$),committed:!1,sideEffects:[],screenshots:new Map};let i=await this._prepareAndCommit(e,t),{results:n,sideEffects:r,screenshots:o,outcome:s,preparedState:a}="conflict"===i.outcome&&t.active?await this._prepareAndCommit(e,t):i;return"committed"===s?{results:n,committed:!0,sideEffects:r,screenshots:o,preparedState:a}:"held"===s?{results:n,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:r,screenshots:o,preparedState:a}:"conflict"===s?{results:n,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:r,screenshots:o}:{results:n,committed:!1,sideEffects:r,screenshots:o}}}
|
|
1
|
+
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as o,parse as r,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as f,agentScreenshotComponent as m,createAssistantExecutionSchema as p,findAssistantMutation as g}from"#package/domain";import{ExportBusyError as y}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as v}from"./close-unclosed-braces.js";import{createEntityMeta as S}from"./entity-meta.js";import{injectAssistantLenses as _}from"./inject-assistant-lenses.js";import{readSideEffects as w}from"./side-effects.js";let x={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},$={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},b="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",E=new RegExp(f.pattern),T=[...s,t],C=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,M=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,j=e=>e instanceof Error?e.message:String(e),k=e=>/[.!?]$/.test(e)?e:`${e}.`,R=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,N=(e,t)=>{let i=R(e)?e._raw:void 0;if(C(i))return i;if(!Array.isArray(e)&&!R(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>N(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,N(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||u(e)?t(e):e;let A=t=>new e(`The configurator cannot handle this request: ${k(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),q="SCREENSHOT_NOT_TAKEN",z=(t,i)=>new e(t,{originalError:i,extensions:{code:q}}),L=e=>(e.errors??[]).some(e=>e.extensions.code!==q),F=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=p(e),i=l(t);return i.length>0?A(i.map(e=>e.message).join(" ")):t}catch(e){return A(j(e))}});_selectLenses=h([h.leaf(e=>e)],e=>r(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,r,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,r,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),r,s);if(!C(n))return i(n,r,s,a);if("meta"===a.fieldName){let e;return S({entity:n,state:("object"==typeof(e=M(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return M(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${C(t)?t.id:"an entity"}: ${k(j(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===o(a.returnType).name?((t,i,n)=>{try{return N(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${C(t)?t.id:"an entity"}: ${k(j(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let o=t.filter(e=>!E.test(e));if(o.length>0)throw new e(`${o.map(e=>`"${e}"`).join(", ")} ${1===o.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>E.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>C(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:m,instanceName:t},i);if(!n)return null;let o=await this._context.renderScreenshot(n,i);return null===o?null:new Blob([o],{type:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"})};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,o)=>{if(void 0!==o.failedMutationField)throw new e(`Not run: the earlier field "${o.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,o)}catch(e){throw o.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let o=g(t,n.manifest);if(!o)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let r=n.state,s=o.implementation(i,r,{manifest:n.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(r),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(s.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(s.updates,r,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${k(j(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);n.emissions.push(i),n.state=i.state}return s.readResult({previousState:r,state:n.state})};_takeScreenshot=({entity:t,state:i},n,o)=>{let r=o.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!r)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=o.lastScreenshot.then(async()=>{if(!o.generation.active)throw z(b);let e=await this._renderScreenshot(t.id,r.instanceName,i).catch(e=>{throw z(e instanceof y?"User made concurrent actions that prevented the screenshot from being taken, try again":`The screenshot of ${t.id} from "${n}" could not be taken: ${k(j(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!o.generation.active)throw z(b);if(null===e)return null;let{imageId:s}=await this._context.uploadScreenshot(e).catch(e=>{throw z(`The screenshot of ${t.id} from "${n}" was taken but could not be stored: ${k(j(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)}),a=`${t.id}/${n}`,l=[...o.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,c=0===l?a:`${a}#${l+1}`;return o.screenshots.set(c,{entityId:t.id,view:n,imageId:s}),{image:c}});return o.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:x};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,o,s)=>{let l;try{l=r(t)}catch(t){return{errors:[t instanceof e?t:new e(j(t))]}}let c=a(o.schema,l,T);return c.length>0?{errors:c}:n({schema:o.schema,document:l,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:o.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i,n=this._generation)=>{let o,r=this._setup();if(!r.ready)return i.map(()=>({result:r.result,emissions:[],screenshots:new Map}));let s={manifest:r.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,lastScreenshot:Promise.resolve(),generation:n},a=[];for(let[t,n]of i.entries())if(void 0===o){let i=s.emissions.length,l=s.screenshots.size;s.failedMutationField=void 0;let c=v(n.document),h=r.lenses?_(c,r.lenses):c,d=h instanceof e?{errors:[h]}:await this._run(h,n,r,s);await s.lastScreenshot,a.push({result:d,emissions:s.emissions.slice(i),screenshots:new Map([...s.screenshots].slice(l))}),L(d)&&(o=t)}else a.push({result:F(o),emissions:[],screenshots:new Map});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>w(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));_prepareAndCommit=async(e,t)=>{let i,n,o,r=this._context.domainContextSelectors.getStoreSystem(),s=await this.prepare(r.stateSlices.committed.value.state,e,t),a=s.map(({result:e})=>e),l=this.readSideEffects(s),h=this.readScreenshots(s),d=s.flatMap(e=>e.emissions);if(!t.active)return{results:a,sideEffects:l,screenshots:h,outcome:"conflict"};if(a.some(L)||0===d.length)return{results:a,sideEffects:l,screenshots:h,outcome:"none"};let u=(i=c(d[0]),n=c(d[d.length-1]),o=d.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:i.previousState,state:n.state,updates:d.flatMap(e=>e.updates),validity:n.validity,transformationLog:o?d.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:l,screenshots:h,outcome:r.commitPrepared(u),preparedState:u.state}};execute=async e=>{let t=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>$),committed:!1,sideEffects:[],screenshots:new Map};let i=await this._prepareAndCommit(e,t),{results:n,sideEffects:o,screenshots:r,outcome:s,preparedState:a}="conflict"===i.outcome&&t.active?await this._prepareAndCommit(e,t):i;return"committed"===s?{results:n,committed:!0,sideEffects:o,screenshots:r,preparedState:a}:"held"===s?{results:n,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:o,screenshots:r,preparedState:a}:"conflict"===s?{results:n,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:o,screenshots:r}:{results:n,committed:!1,sideEffects:o,screenshots:r}}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type $DomainEntity, type ConfiguratorBuilder, type CreateCustomPhoenixEntityElement, type CreateCustomPhoenixLayoutElement, type CreateGetThemeHandler, type CreateGetWebComponentOptionsHandler, type CreatePhoenixHandler, type DomainEntity, type IsCreateRecipeUpdate, type IsReplaceRecipeUpdate, type TransformerBuilder, type TransformerFactory, type UpdateFactory, getIdSequence } from '#package/domain';
|
|
2
|
-
import { type CreateAddEntityFab, type CreateAppLoader, type CreateCollectFrontendDataHandler, type CreateConfigurationNotFoundPage, type CreateConfiguratorErrorPage, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreatePresetUi, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
|
|
2
|
+
import { type CreateAddEntityFab, type CreateAppLoader, type CreateCollectFrontendDataHandler, type CreateConfigurationNotFoundPage, type CreateConfiguratorErrorPage, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type CreatePresetUi, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseConfiguratorRouting, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
|
|
3
3
|
import { type CreatePhoenixIconSet } from '#package/ui-sdk';
|
|
4
4
|
import { type UseConfiguratorExtensions } from '../application-runtime/index.js';
|
|
5
|
-
import { type
|
|
5
|
+
import { type UsePresetSelection, usePreview, usePropertyPageStack, usePropertyPageState } from '../configurator-context/index.js';
|
|
6
6
|
import { useCloseAction } from '../integration/index.js';
|
|
7
7
|
import { type CreateGetTextureProcessingMapHandler } from '../scene/index.js';
|
|
8
8
|
import type { UseUpdateEntityObjectSelection } from '../scene/scene-entity/drag-and-drop/use-updated-selection.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as t,createGetThemeHandler as r,createGetWebComponentOptionsHandler as o,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as a,getIdSequence as m,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{createAddEntityFab as c,createAppLoader as u,createCollectFrontendDataHandler as f,createConfigurationNotFoundPage as l,createConfiguratorErrorPage as g,createDeleteEntityFab as j,createFilterPublishedChunksHandler as x,createNavigationHotspot as k,createNotAuthenticatedPage as y,
|
|
1
|
+
import{createCustomPhoenixEntityElement as e,createCustomPhoenixLayoutElement as t,createGetThemeHandler as r,createGetWebComponentOptionsHandler as o,createPhoenixHandler as i,createTransformer as n,createTransformerBuilder as s,createUpdateFactory as a,getIdSequence as m,isCreateEntityUpdate as p,isReplaceEntityUpdate as d}from"#package/domain";import{createAddEntityFab as c,createAppLoader as u,createCollectFrontendDataHandler as f,createConfigurationNotFoundPage as l,createConfiguratorErrorPage as g,createDeleteEntityFab as j,createFilterPublishedChunksHandler as x,createNavigationHotspot as k,createNotAuthenticatedPage as y,createOnApplicationStartProvider as I,createOnBackendDataReadyProvider as A,createOnConfiguratorReadyProvider as C,createOnFrontendDataReadyProvider as S,createOnGoToIndexHandler as w,createOnPresetLoadedHandler as E,createOnPublishedDataReadyProvider as b,createOnRoutingReadyProvider as q,createOnSessionReadyProvider as B,createPresetUi as P,createSelectionHotspot as R,createToolMenuFab as U,isAngleDimensionUpdate as h,isAttributeSelectionUpdate as v,isAttributeSwitchUpdate as z,isDeleteEntityUpdate as D,isDistanceDimensionUpdate as F,isGenericDimensionUpdate as G,isSwatchSelectionUpdate as H,isTextValueUpdate as J,useAccessService as K,useActiveNavigationState as L,useActiveToolState as M,useActiveViewState as N,useActiveViewports as O,useAnalyticsService as Q,useAngleDimension as T,useAttributeSelection as V,useAttributeSwitch as W,useAuthenticatedClient as X,useAuthorizedClient as Y,useBackendData as Z,useChildEntitySelection as $,useCommittedSlice as _,useCommittedState as ee,useComponent as et,useComponents as er,useComposition as eo,useConfigurationId as ei,useConfigurationSaveState as en,useConfiguratorMessages as es,useConfiguratorRouting as ea,useControlViolations as em,useCookRecipes as ep,useCookReplaceRecipes as ed,useCookedRecipes as ec,useCookedReplaceRecipes as eu,useCreateAuthorizedClient as ef,useDeleteEntity as el,useDeletedEntity as eg,useDeselect as ej,useDistanceDimension as ex,useDistanceDimensionSelection as ek,useDomain as ey,useDomainApplication as eI,useDomainApplicationProps as eA,useDomainEntityRenderedState as eC,useDomainEntityState as eS,useEntityPrice as ew,useEntitySelector as eE,useFinalizeAction as eb,useFinalizeActions as eq,useFinalizeViolations as eB,useFirstComponent as eP,useFirstRenderedComponent as eR,useFirstRootComponent as eU,useFirstRootRenderedComponent as eh,useFrontendData as ev,useGenerateShareLink as ez,useGenericDimension as eD,useGroupedRecipeOptions as eF,useHoveredDomainEntityId as eG,useHoveredEntity as eH,useHoveredEntityId as eJ,useIntegrationService as eK,useIntegrationState as eL,useIsFullscreenActive as eM,useLoadedData as eN,useLoadingState as eO,useLoadingStateValue as eQ,useLocaleSwitch as eT,useLocalizable as eV,useMapViolationHints as eW,useNavigate as eX,usePopNavigate as eY,usePresetEmbeddedState as eZ,usePublishedData as e$,usePushNavigate as e_,useRecipeEmbeddedState as e0,useRenderedComponent as e1,useRenderedComponents as e2,useRenderedEntitySelector as e3,useRenderedRootEntitySelector as e4,useRenderedSelector as e5,useRenderedSelector$ as e6,useRenderedSlice as e7,useRenderedState as e8,useReplaceEntityRecipeOptions as e9,useResolveLocalizable as te,useRootComponents as tt,useRootEntityId as tr,useRootEntityPrice as to,useRootEntityRenderedId as ti,useRootEntityRenderedState as tn,useRootEntitySelector as ts,useRootEntityState as ta,useRootRenderedComponents as tm,useSelectEntity as tp,useSelectParent as td,useSelectedDomainEntityId as tc,useSelectedEntity as tu,useSelectedEntityId as tf,useSession as tl,useSessionRole as tg,useSessionService as tj,useSetFullscreen as tx,useSetViewState as tk,useShareLinks as ty,useStateValidity as tI,useStepNavigation as tA,useStoreSelector as tC,useStoreSelector$ as tS,useSwatchSelection as tw,useTabNavigation as tE,useTextValue as tb,useUndoRedo as tq,useUpdateControl as tB,useUpdatedControl as tP}from"#package/react-sdk";import{createPhoenixIconSet as tR}from"#package/ui-sdk";import{useConfigurator as tU}from"../application-runtime/index.js";import{usePresetSelection as th,usePreview as tv,usePropertyPageStack as tz,usePropertyPageState as tD}from"../configurator-context/index.js";import{useCloseAction as tF}from"../integration/index.js";import{createGetTextureProcessingMapHandler as tG}from"../scene/index.js";import{useUpdateEntityObjectSelection as tH}from"../scene/scene-entity/drag-and-drop/use-updated-selection.js";import{useAssistantPanel as tJ,useMeasurements as tK,useToolbarActions as tL}from"../toolbar-actions/index.js";import{LayoutSlots as tM,createCanvasLoader as tN,createLayoutAdminUi as tO,createLayoutCustomOwnerUi as tQ,createLayoutCustomReadUi as tT,createLayoutDialog as tV,createLayoutFooter as tW,createLayoutToolbarDesktop as tX,createLayoutToolbarDesktopFullScreen as tY,createLayoutToolbarReadDesktop as tZ,createLayoutToolbarReadDesktopFullScreen as t$,createLayoutUserUi as t_,createToolbarHelp as t0,useSceneSafeArea as t1}from"../ui/index.js";import{createPresetDeviceNotSupported as t2,createPresetPageAction as t3}from"../ui/preset-layout/PresetUi.js";import{useResetCamera as t4}from"./use-reset-camera.js";export const createConfiguratorInterface=t5=>({updates:a(),getIdSequence:m,createGetWebComponentOptionsHandler:o,createGetThemeHandler:r,createPhoenixHandler:i,createCustomPhoenixEntityElement:e,createCustomPhoenixLayoutElement:t,createPhoenixIconSet:tR,createGetTextureProcessingMapHandler:tG,createCollectFrontendDataHandler:f,createFilterPublishedChunksHandler:x,createOnGoToIndexHandler:w,createOnApplicationStartProvider:I,createOnSessionReadyProvider:B,createOnPublishedDataReadyProvider:b,createOnFrontendDataReadyProvider:S,createOnBackendDataReadyProvider:A,createOnRoutingReadyProvider:q,createOnConfiguratorReadyProvider:C,createOnPresetLoadedHandler:E,createPresetUi:P,createPresetPageAction:t3,createPresetDeviceNotSupported:t2,createLayoutFooter:tW,createAppLoader:u,createCanvasLoader:tN,createLayoutDialog:tV,createLayoutToolbarDesktop:tX,createLayoutToolbarDesktopFullScreen:tY,createLayoutToolbarReadDesktop:tZ,createLayoutToolbarReadDesktopFullScreen:t$,createLayoutCustomOwnerUi:tQ,createLayoutCustomReadUi:tT,createLayoutAdminUi:tO,createLayoutUserUi:t_,createToolbarHelp:t0,createNotAuthenticatedPage:y,createConfigurationNotFoundPage:l,createConfiguratorErrorPage:g,createAddEntityFab:c,createDeleteEntityFab:j,createSelectionHotspot:R,createNavigationHotspot:k,createToolMenuFab:U,createTransformer:n,transformerBuilder:s(),useAnalytics:Q,useAuthenticatedClient:X,useAuthorizedClient:Y,useCreateAuthorizedClient:ef,useAccessService:K,useConfigurationId:ei,useSession:tl,useSessionRole:tg,useSessionService:tj,useDomain:ey,useDomainApplication:eI,useConfigurator:tU,useConfiguratorRouting:ea,usePresetSelection:th,usePublishedData:e$,useFrontendData:ev,useBackendData:Z,useDomainApplicationProps:eA,useLoadedData:eN,useIntegrationService:eK,useIntegrationState:eL,usePresetEmbeddedState:eZ,useRecipeEmbeddedState:e0,useCommittedSlice:_,useRenderedSlice:e7,useCommittedState:ee,useRenderedState:e8,useStoreSelector:tC,useRenderedSelector:e5,useStoreSelector$:tS,useRenderedSelector$:e6,useEntitySelector:eE,useRenderedEntitySelector:e3,useRootEntitySelector:ts,useRenderedRootEntitySelector:e4,useStateValidity:tI,useMapViolationHints:eW,useNavigate:eX,usePopNavigate:eY,usePushNavigate:e_,useControlViolations:em,useFinalizeViolations:eB,useConfiguratorMessages:es,useConfigurationSaveState:en,useFinalizeAction:eb,useFinalizeActions:eq,useComponent:et,useRenderedComponent:e1,useComponents:er,useRenderedComponents:e2,useFirstComponent:eP,useFirstRenderedComponent:eR,useRootComponents:tt,useRootRenderedComponents:tm,useFirstRootComponent:eU,useFirstRootRenderedComponent:eh,useEntityState:eS,useEntityRenderedState:eC,useRootEntityState:ta,useRootEntityRenderedState:tn,useRootEntityId:tr,useRootEntityRenderedId:ti,useEntityPrice:ew,useRootEntityPrice:to,useSelectedEntity:tu,useSelectedEntityId:tf,useSelectedDomainEntityId:tc,useSelectEntity:tp,useDeselect:ej,useSelectParent:td,useHoveredEntity:eH,useHoveredEntityId:eJ,useHoveredDomainEntityId:eG,useActiveNavigationState:L,useActiveViewState:N,useSetViewState:tk,useActiveToolState:M,useIsFullscreenActive:eM,useSetFullscreen:tx,useResetCamera:t4,useUndoRedo:tq,useTabNavigation:tE,useStepNavigation:tA,useSceneSafeArea:t1,useActiveViewports:O,usePreview:tv,useCloseAction:tF,useIsCloningAllowed:tM.useIsCloningAllowed,useResolveLocalizable:te,useLocalizable:eV,useToolbarActions:tL,useMeasurements:tK,useLocaleSwitch:eT,useShareLinks:ty,useAssistantPanel:tJ,useComposition:eo,useUpdateControl:tB,useUpdatedControl:tP,useCookRecipes:ep,useCookedRecipes:ec,useCookReplaceRecipes:ed,useCookedReplaceRecipes:eu,useDeleteEntity:el,useDeletedEntity:eg,useSwatchSelection:tw,useTextValue:tb,useAttributeSelection:V,useAttributeSwitch:W,useDistanceDimension:ex,useDistanceDimensionSelection:ek,useGenericDimension:eD,useAngleDimension:T,useChildEntitySelection:$,useGroupedRecipeOptions:eF,useReplaceEntityRecipeOptions:e9,useUpdateEntityObjectSelection:tH,useGenerateShareLink:ez,useLoadingState:eO,useLoadingStateValue:eQ,usePropertyPageStack:tz,usePropertyPageState:tD,isCreateEntityUpdate:p,isReplaceEntityUpdate:d,isDeleteEntityUpdate:D,isAngleDimensionUpdate:h,isDistanceDimensionUpdate:F,isGenericDimensionUpdate:G,isAttributeSelectionUpdate:v,isAttributeSwitchUpdate:z,isTextValueUpdate:J,isSwatchSelectionUpdate:H});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{BackendDataProvider as e,FrontendDataProvider as i,
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{BackendDataProvider as e,FrontendDataProvider as i,OnBackendDataReadyProvider as c,OnFrontendDataReadyProvider as n,OnPublishedDataReadyProvider as o,PublishedDataProvider as t}from"#package/react-sdk";export const ConfiguratorDataProvider=({children:a})=>r(t,{children:r(o,{children:r(i,{children:r(n,{children:r(e,{children:r(c,{children:a})})})})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{Button as t}from"@mui/material";import{useMutation as r}from"@tanstack/react-query";import{useSnackbar as i}from"notistack";import{useSubscription as o}from"observable-hooks";import{createContext as s,useCallback as n,useContext as a,useEffect as l,useMemo as m,useState as d}from"react";import{skip as p}from"rxjs";import{match as c}from"ts-pattern";import{AuthorizedClient as g,LocalStorageAuthorizedPhoenixApiClient as u,MemoryAuthorizedPhoenixApiClient as f}from"#package/client";import{SYSTEM_CHUNK_KEY as h,standardWebComponentProperties as y}from"#package/domain";import{ApplicationRoutes as P,FrontendAnalyticsFactory as v,useAnalyticsService as w,useAuthenticatedClient as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{Button as t}from"@mui/material";import{useMutation as r}from"@tanstack/react-query";import{useSnackbar as i}from"notistack";import{useSubscription as o}from"observable-hooks";import{createContext as s,useCallback as n,useContext as a,useEffect as l,useMemo as m,useState as d}from"react";import{skip as p}from"rxjs";import{match as c}from"ts-pattern";import{AuthorizedClient as g,LocalStorageAuthorizedPhoenixApiClient as u,MemoryAuthorizedPhoenixApiClient as f}from"#package/client";import{SYSTEM_CHUNK_KEY as h,standardWebComponentProperties as y}from"#package/domain";import{ApplicationRoutes as P,FrontendAnalyticsFactory as v,useAnalyticsService as w,useAuthenticatedClient as C,useConfiguratorDomainFactory as T,useConfiguratorRouting as k,useEagerObservableValue as x,useIsDev as D,useLogger as S,useOnPresetLoadedHandler as E,usePersistenceConfig as b,usePublishedData as A,useResolveLocalizable as I,useRoutingSelectors as V,useSessionService as $,useSpecPresetSeed as j,useWebComponentProperty$ as F}from"#package/react-sdk";let M={id:"sdk.presets.create.error.message",message:"Could not start configuring from this preset. Please try again."},R={id:"sdk.presets.create.error.dismiss.label",message:"Dismiss"},q="phx-preset-creation-error";export const PresetSelectionContext=s(null);export const usePresetSelection=()=>{let e=a(PresetSelectionContext);if(null===e)throw Error("usePresetSelection must be used within a PresetSelectionProvider!");return e};let z=e=>t=>null===e||void 0!==t.tags&&t.tags.some(t=>e.includes(t));export const PresetSelectionProvider=s=>{let{children:a}=s,[U,B]=d(null),[G,H]=d(null),J=j(),K=C(),L=w(),N=b(),O=T(),Q=D(),W=I(),{requestSessionToken:X}=$(),Y=S(),Z=k(),_=V(),ee=A(),{enqueueSnackbar:et,closeSnackbar:er}=i(),ei=F(y.presetTags),eo=x(ei),es=E();o(m(()=>ei.pipe(p(1)),[ei]),()=>{_.getRoutingState().route!==P.Index&&Z.goToIndex()}),l(()=>{H(null),er(q)},[Q,er]);let{mutate:en}=r({mutationFn:n(async e=>{let{getData:t,name:r}=e,{rootEntityType:i,entities:o,modelVersion:s}=await t(),n=O.validateAndMigrateState(o,s);L.push(v.ProductSelected(i,W(r)));let a=es?await es(n):n;return K.createConfiguration({rootEntityType:i,data:a})},[O,L,W,K,es]),onSuccess:e=>{Z.goToConfigurationDetail(e.configurationId,e.accessToken)},onError:(e,t)=>{Y.error("Failed to create a new configuration from a preset!",{name:t.name},e),H(e)},onSettled:()=>{B(null)}}),ea=m(()=>{let e,t=(e=h in ee?ee[h].presetCategories:ee.presetCategories,{publishedPresetCategories:(e??[]).map(e=>({...e,presets:e.presets.filter(z(eo))})).filter(e=>e.presets.length>0),seedPresets:J.filter(z(eo))});return t.publishedPresetCategories.length>0?t.publishedPresetCategories.map(e=>({id:e.id,name:e.name,description:e.description,img:e.img,imgAlt:e.imgAlt,presets:e.presets.map(e=>({id:e.configurationId,name:e.name,description:e.description,img:e?.img,imgAlt:e?.imgAlt,detailTitle:e?.detailTitle,detailDescription:e?.detailDescription,getData:async()=>{let t=c(N).with({type:"server"},t=>new g(t.serverUrl,()=>e.readToken,X)).with({type:"local-storage"},()=>new u(O.modelVersion)).with({type:"memory"},()=>new f(O.modelVersion)).exhaustive(),r=await t.getConfigurationRevision(e.configurationId,e.revisionId);return{entities:r.data,rootEntityType:r.rootEntityType,modelVersion:r.modelVersion}}}))})):t.seedPresets.length>0?[{id:"Default",name:"Default Category",presets:t.seedPresets.map((e,t)=>({id:`${t}`,name:e.name??`${e.rootEntityType} preset - ${t}`,description:e.description??"",img:e.img,imgAlt:e.imgAlt,detailTitle:e.detailTitle,detailDescription:e.detailDescription,getData:async()=>({entities:e.initialDomainEntities,rootEntityType:e.rootEntityType,modelVersion:O.modelVersion})}))}]:[]},[ee,X,N,O,eo,J]),el=m(()=>ea.flatMap(e=>e.presets),[ea]),em=n(r=>{let i=el.find(e=>e.id===r);if(void 0===i)throw Error(`Preset with id ${r} not found!`);let{getData:o,name:s}=i,n=!Q&&el.length>1;H(null),B(r),en({getData:o,name:s},{onError:()=>{n&&(er(q),et(W(M),{variant:"error",key:q,persist:!0,preventDuplicate:!0,action:r=>e(t,{color:"inherit",size:"small",onClick:()=>{H(null),er(r)},children:W(R)})}))}})},[el,Q,en,et,er,W]),ed=el.length>1,ep=m(()=>({hasMultiplePresets:ed,presetCategories:ea,selectPreset:em,selectionError:G,creatingPresetId:U}),[em,ed,ea,G,U]);return e(PresetSelectionContext.Provider,{value:ep,children:a})};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { useLayoutSystemConfig, useEnterSidebarSummary, useLeaveSidebarSummary, useIsSidebarSummaryActive, useSidebarSummary, useSidebarContents, useSidebarGoBack, useHasSidebarSummary, useToolbarState, useSteps, useBackToPresetEnabled, useEmbeddedModeActive, usePresetEmbeddedModeActive, useHasSteps, useHeaderStyle, } from './layout-hooks.js';
|
|
2
2
|
export { usePropertyPageState, usePropertyPageStack } from './property-page/property-page-hooks.js';
|
|
3
3
|
export { PropertyStateProvider } from './property-page/PropertyStateProvider.js';
|
|
4
|
-
export { useChatEnabled } from './chat-hooks.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useLayoutSystemConfig,useEnterSidebarSummary,useLeaveSidebarSummary,useIsSidebarSummaryActive,useSidebarSummary,useSidebarContents,useSidebarGoBack,useHasSidebarSummary,useToolbarState,useSteps,useBackToPresetEnabled,useEmbeddedModeActive,usePresetEmbeddedModeActive,useHasSteps,useHeaderStyle}from"./layout-hooks.js";export{usePropertyPageState,usePropertyPageStack}from"./property-page/property-page-hooks.js";export{PropertyStateProvider}from"./property-page/PropertyStateProvider.js";
|
|
1
|
+
export{useLayoutSystemConfig,useEnterSidebarSummary,useLeaveSidebarSummary,useIsSidebarSummaryActive,useSidebarSummary,useSidebarContents,useSidebarGoBack,useHasSidebarSummary,useToolbarState,useSteps,useBackToPresetEnabled,useEmbeddedModeActive,usePresetEmbeddedModeActive,useHasSteps,useHeaderStyle}from"./layout-hooks.js";export{usePropertyPageState,usePropertyPageStack}from"./property-page/property-page-hooks.js";export{PropertyStateProvider}from"./property-page/PropertyStateProvider.js";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export { usePresetSelection, type UsePresetSelection, PresetSelectionProvider, type PresetSelectionProviderProps, } from './PresetSelectionProvider.js';
|
|
2
|
-
export { useOnPresetLoadedHandler, createOnPresetLoadedHandler, type CreateOnPresetLoadedHandler, } from './OnPresetLoadedHandler.js';
|
|
3
|
-
export { IntegrationSubscription, type IntegrationSubscriptionProps } from './IntegrationSubscription.js';
|
|
4
2
|
export { ViewportStateSync } from './ViewportStateSync.js';
|
|
5
3
|
export { PreviewApplicationProvider } from './PreviewApplicationProvider.js';
|
|
6
4
|
export { PreviewContextProvider, usePreview } from './PreviewContextProvider.js';
|
|
7
|
-
export * from './LifecycleProviders.js';
|
|
8
5
|
export * from './configurator-hooks/index.js';
|
|
9
|
-
export * from './configurator-routing/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePresetSelection,PresetSelectionProvider}from"./PresetSelectionProvider.js";export{
|
|
1
|
+
export{usePresetSelection,PresetSelectionProvider}from"./PresetSelectionProvider.js";export{ViewportStateSync}from"./ViewportStateSync.js";export{PreviewApplicationProvider}from"./PreviewApplicationProvider.js";export{PreviewContextProvider,usePreview}from"./PreviewContextProvider.js";export*from"./configurator-hooks/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{useConfiguratorRouting as r}from"#package/react-sdk";import{ConfigurationNotFoundPageElement as t}from"../configuration-not-found-page/index.js";export const ConfiguratorNotFoundPage=()=>o(t,{onBack:r().goToIndex});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as r}from"react/jsx-runtime";import i from"mui-modal-provider";import{memo as e,useCallback as n,useEffect as t,useState as a}from"react";import{InvalidAccessKeyError as d}from"#package/client";import{BuiltInLoadingPhase as l,CommonAnalyticsFactory as s,DomainLifecycleBoundary as c,FinalizeActionsHost as u,FinalizeActionsProvider as f,
|
|
1
|
+
import{jsx as o,jsxs as r}from"react/jsx-runtime";import i from"mui-modal-provider";import{memo as e,useCallback as n,useEffect as t,useState as a}from"react";import{InvalidAccessKeyError as d}from"#package/client";import{BuiltInLoadingPhase as l,CommonAnalyticsFactory as s,DomainLifecycleBoundary as c,FinalizeActionsHost as u,FinalizeActionsProvider as f,IntegrationSubscription as m,LoadedDataProvider as g,OnConfiguratorReadyProvider as p,PhoenixLayoutElement as v,useAccessService as I,useAnalyticsService as h,useAuthorizedClient as j,useConfiguratorDomainFactory as C,useConfiguratorLoadStatus as k,useConfiguratorRawLoadedData as w,useLoadedDataActions as y,useLoadingError as b,useLoadingPhase as x,useLogger as M,useRoutingService as E,useSpecAssistant as L}from"#package/react-sdk";import{useConfigurator as D}from"../application-runtime/index.js";import{ViewportStateSync as F}from"../configurator-context/index.js";import{ConfiguratorNotFoundPage as T}from"./ConfiguratorNotFoundPage.js";import{ConfiguratorLayoutName as P}from"./configurator-layout-name.js";import{DevContextFallback as R}from"./error-boundaries/DevContextFallback.js";import{DevLoadingFallback as V}from"./error-boundaries/DevLoadingFallback.js";import{LoadingErrorBoundary as A}from"./error-boundaries/LoadingErrorBoundary.js";import{useLoad as S}from"./use-load.js";let q=({onMount:o})=>(t(()=>{o()},[o]),null),B=e(({onLayoutMount:e})=>((()=>{let{assistantSystem:o}=D(),r=null!=L();t(()=>{if(r)return o.activate()},[o,r])})(),o(f,{children:o(i,{children:r(p,{children:[o(u,{}),o(v,{name:P}),o(q,{onMount:e})]})})})));export const LoadedConfiguratorDetailPage=()=>{let[i,e]=a(!1),t=n(()=>{e(!0)},[]),{configurationId:u,accessInfo:f}=I(),p=j(),v=E(),L=M(),D=h(),{startConfiguratorLoad:P,completeConfiguratorLoad:q,failConfiguratorLoad:G,resetConfiguratorLoad:N}=y(),{isLoading:z,isError:H}=k(),J=w(),K=C(),O=n(()=>f.viewMode&&void 0!==f.revisionId?p.getConfigurationRevision(u,f.revisionId):p.getConfiguration(u),[f.revisionId,f.viewMode,p,u]),Q=n(()=>{P()},[P]),U=n(o=>{q({initialRevisionId:o.revisionId,initialEntities:o.data,modelVersion:o.modelVersion,rootEntityType:o.rootEntityType,schemaIdentity:K}),D.push(s.ConfigurationLoaded(o.configurationId,o.revisionId,f.viewMode?"read":"owner")),L.appendToGlobalContext({configurationId:o.configurationId,revisionId:o.revisionId,mode:f.viewMode}),L.info("Configuration loaded.")},[f.viewMode,D,q,K,L]),W=n(o=>{if(G(o),o instanceof d)return void v.rejectAccessToken(u,f.raw);let r=o instanceof Error?o:Error("Configuration loading failed with an unknown error.",{cause:o});L.error("Configuration loading failed because the API request did not succeed. Verify the configuration ID and access token.",{configurationId:u},r)},[f.raw,u,G,L,v]),X=n(()=>{N()},[N]);return(S({key:[p,u,f.revisionId,f.viewMode],load:O,onStart:Q,onSuccess:U,onError:W,onCleanup:X}),x({id:l.DataFetch,label:"Loading configuration…"},z||!H&&!i),b(H),H)?o(T,{}):null===J?null:o(g,{value:J,children:o(A,{fallbackRender:r=>o(V,{...r}),children:o(c,{type:"configurator",children:o(A,{FallbackComponent:R,children:r(m,{children:[o(F,{}),o(B,{onLayoutMount:t})]})})})})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as i}from"react/jsx-runtime";import{Box as n,Button as r,Divider as o,Typography as a}from"@mui/material";import{Stack as d}from"@mui/system";import{useMemo as s}from"react";import{domainEntityTypeFromId as c}from"#package/domain";import{ControlAttachmentError as l,useAccessService as h,useBackendData as m,useCommittedState as p,useDomain as f,useFrontendData as b,useIsDev as u,useLoadedData as v,usePublishedData as y,useRenderedState as x,useSessionService as g}from"#package/react-sdk";import{JsonViewer as S,StackTraceViewer as k}from"#package/ui-sdk";import{useConfiguratorRouting as w}from"../../configurator-context/index.js";import{useResetOnEditorHotReload as C}from"./use-reset-on-editor-hot-reload.js";let W=()=>{let i=w();return e(d,{direction:"row",spacing:2,sx:{mb:2},children:[t(r,{variant:"outlined",size:"small",onClick:()=>{i.goToIndex()},children:"Reset state"}),t(r,{variant:"outlined",size:"small",onClick:()=>{window.location.reload()},children:"Reload Page"})]})},T=()=>{let{compositionProjections:r,componentReader:c,storeSystem:l}=f(),u=p(),k=x(),w=v(),C=h(),W=g(),T=y(),I=b(),z=m(),L=s(()=>{try{return r.getTree(u)}catch(t){return null}},[u,r]),D=s(()=>c.readManyComponents({},u),[u,c]),R=s(()=>{try{return r.getTree(k)}catch(t){return null}},[k,r]),A=s(()=>c.readManyComponents({},k),[k,c]),U=l.stateSlices.committed.value,E=l.stateSlices.potentiallyInvalid.value,j=E.validity.valid||"uncaught"===E.validity.severity?[]:E.validity.entityViolations,M=j.length>0,N="reset"!==U.kind;return e(n,{component:"div",children:[t(a,{variant:"h5",sx:{mb:2,mt:4,fontWeight:600},children:"Debug Data"}),e(n,{component:"div",sx:{p:2,mb:4,backgroundColor:"#e3f2fd",borderRadius:1,borderLeft:"4px solid #2196f3"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1,color:"primary.main"},children:"\uD83D\uDD0D How to Debug This Issue"}),t(a,{variant:"body2",component:"div",children:e("ul",{style:{margin:"8px 0",paddingLeft:"20px"},children:[e("li",{children:[t("strong",{children:"Start with Last Emission:"})," Check if there are invariant violations - these often indicate the root cause"]}),e("li",{children:[t("strong",{children:"Review Last Updates:"})," See which state changes were applied right before the error occurred"]}),e("li",{children:[t("strong",{children:"Check Committed vs Rendered State:"})," Compare these to identify inconsistencies or timing issues"]}),e("li",{children:[t("strong",{children:"Inspect Composition Tree:"})," Verify that all entities are composed correctly"]}),e("li",{children:[t("strong",{children:"Review Data Sources:"})," Ensure all required data is loaded and in the expected format"]}),t("li",{children:'Use the "Reset state" button to navigate back to the index page without reloading'}),t("li",{children:'Use the "Reload Page" button to perform a full page refresh if state is corrupted'})]})})]}),(M||N)&&e(i,{children:[e(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:M?"error.main":"primary.main"},children:["Last Emission ",M&&"(Has Violations!)"]}),e(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:["The most recent state update that was applied."," ",M?"Contains invariant violations that prevented the state from being committed.":"Shows what changed in the application state."]}),M&&t(i,{children:e(n,{component:"div",sx:{p:2,backgroundColor:"#ffebee",borderRadius:1,borderLeft:"4px solid #f44336",mb:2},children:[t(a,{variant:"subtitle2",sx:{color:"error.main",mb:1},children:"⚠️ Invariant Violations:"}),t(d,{component:"div",spacing:1,children:j.map((i,r)=>e(n,{component:"div",sx:{pl:2},children:[e(a,{variant:"body2",sx:{fontWeight:600},children:["Entity: ",String(i.entityId)]}),t(a,{variant:"caption",sx:{color:"text.secondary",display:"block",fontFamily:"monospace",fontSize:"0.75rem"},children:JSON.stringify(i.violation)})]},r))})]})}),N&&e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Last Updates"}),t(S,{data:U.updates})]}),U.transformationLog&&e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Transformation Log"}),t(S,{data:U.transformationLog})]}),t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Validity"}),t(S,{data:E.validity}),t(o,{sx:{my:4}})]}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Committed Slice"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:'The last valid state that was successfully committed. This is the "source of truth" for the application state and passes all invariant checks.'}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"State"}),t(S,{data:u})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Active components"}),t(S,{data:D})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Composition Tree"}),L&&t(S,{data:L})]}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Rendered Slice"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"The state that's currently being used to render the UI. This may differ from committed state during animations or transitions."}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"State"}),t(S,{data:k})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Active components"}),t(S,{data:A})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Composition Tree"}),R&&t(S,{data:R})]}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Published Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configuration data published to S3. This is the main source of truth for domain entities, components, and rules. Loaded from the backend at application startup."}),t(S,{data:T}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Frontend Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Data collected and processed on the frontend. Contains UI state, user selections, and client-side computed values."}),t(S,{data:I}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Backend Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Optional data fetched from backend APIs. May include pricing, availability, or other dynamic server-side data."}),t(S,{data:z}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Session Service"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Authentication and session information. Contains user identity, permissions, and session tokens."}),t(S,{data:W}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Loaded Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"The initial data of the configuration used to start the configurator. This is the starting state and context provided when the configurator was initialized."}),t(S,{data:w}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Access Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Access control and permissions service. Determines what actions the current user can perform and what data they can view."}),t(S,{data:C}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Configurator Props"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configurator-specific properties and settings. Contains routing information, UI configuration, and configurator context settings."})]})};export const DevContextFallback=r=>{let{error:s,resetErrorBoundary:h}=r,m=u();if(C(h),!m)throw s;if(s instanceof l)return t(n,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(d,{sx:{p:5,boxSizing:"border-box"},spacing:3,children:[t(a,{variant:"h4",sx:{mb:2,mt:2},color:"error",children:"Can not render a control input!"}),e(n,{component:"div",sx:{p:2,mb:2,backgroundColor:"#fff3cd",borderRadius:1,borderLeft:"4px solid #ffc107"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1},children:"⚠️ When does this error occur?"}),e(a,{variant:"body2",children:["This error occurred ",t("strong",{children:"while the configurator was running"}),", during the rendering of UI controls. Most likely causes:"]}),e(a,{variant:"body2",component:"ul",sx:{mt:1,mb:0},children:[t("li",{children:"A control input component is referenced but not defined in the domain"}),t("li",{children:"The instanceName has a typo or doesn't match the actual component name"}),t("li",{children:"The entity type doesn't support the requested control input"})]})]}),t(W,{}),t(o,{}),t(a,{variant:"body1",children:s.message}),t(o,{}),e(d,{spacing:2,direction:"row",children:[e(d,{children:[t(a,{variant:"subtitle2",children:"Instance Name: "}),t(a,{variant:"subtitle2",children:"Entity Id: "})]}),e(d,{children:[t(a,{variant:"body1",children:s.instanceName}),t(a,{variant:"body1",children:s.entityId})]})]}),t(o,{}),s.stack&&e(i,{children:[t(k,{stack:s.stack,error:s}),t(o,{})]}),e(d,{children:[t(a,{variant:"subtitle2",children:"To debug: "}),e("ul",{children:[t("li",{children:t(a,{variant:"body1",children:"Check that input component exists"})}),t("li",{children:e(a,{variant:"body1",children:["Check it exists on an entity of type ",t("strong",{children:c(s.entityId)})]})}),t("li",{children:e(a,{variant:"body1",children:["Check that the ",t("strong",{children:"instanceName"})," is correct and there is no typo"]})})]})]}),t(o,{}),t(T,{})]})});let p=s instanceof Error?s.stack:null;return t(n,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(d,{sx:{p:5,boxSizing:"border-box"},spacing:3,children:[t(a,{variant:"h4",sx:{mb:2,mt:2},color:"error",children:"There was an unknown error in the configurator context!"}),e(n,{component:"div",sx:{p:2,mb:2,backgroundColor:"#fff3cd",borderRadius:1,borderLeft:"4px solid #ffc107"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1},children:"⚠️ When does this error occur?"}),e(a,{variant:"body2",children:["This error occurred ",t("strong",{children:"while the configurator was running"}),", after data was successfully loaded. Most likely causes:"]}),e(a,{variant:"body2",component:"ul",sx:{mt:1,mb:0},children:[t("li",{children:"A state update caused an invariant violation"}),t("li",{children:"Component rendering failed due to invalid state"}),t("li",{children:"Business rules or transformations threw an unexpected error"}),t("li",{children:"Invalid data was introduced through user interactions or computed values"})]})]}),t(a,{variant:"body2",sx:{mb:2},children:"This should not happen, please report it so we can improve the platform!"}),t(W,{}),t(a,{variant:"subtitle2",children:"Error: "}),t(a,{variant:"body2",children:`${s}`}),p&&e(i,{children:[t(o,{}),t(k,{stack:p,error:s})]}),t(o,{}),t(T,{})]})})};
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as i}from"react/jsx-runtime";import{Box as n,Button as r,Divider as o,Typography as a}from"@mui/material";import{Stack as d}from"@mui/system";import{useMemo as s}from"react";import{domainEntityTypeFromId as c}from"#package/domain";import{ControlAttachmentError as l,useAccessService as h,useBackendData as m,useCommittedState as p,useConfiguratorRouting as f,useDomain as b,useFrontendData as u,useIsDev as v,useLoadedData as y,usePublishedData as x,useRenderedState as g,useSessionService as S}from"#package/react-sdk";import{JsonViewer as k,StackTraceViewer as w}from"#package/ui-sdk";import{useResetOnEditorHotReload as C}from"./use-reset-on-editor-hot-reload.js";let W=()=>{let i=f();return e(d,{direction:"row",spacing:2,sx:{mb:2},children:[t(r,{variant:"outlined",size:"small",onClick:()=>{i.goToIndex()},children:"Reset state"}),t(r,{variant:"outlined",size:"small",onClick:()=>{window.location.reload()},children:"Reload Page"})]})},T=()=>{let{compositionProjections:r,componentReader:c,storeSystem:l}=b(),f=p(),v=g(),w=y(),C=h(),W=S(),T=x(),I=u(),z=m(),L=s(()=>{try{return r.getTree(f)}catch(t){return null}},[f,r]),D=s(()=>c.readManyComponents({},f),[f,c]),R=s(()=>{try{return r.getTree(v)}catch(t){return null}},[v,r]),A=s(()=>c.readManyComponents({},v),[v,c]),U=l.stateSlices.committed.value,E=l.stateSlices.potentiallyInvalid.value,M=E.validity.valid||"uncaught"===E.validity.severity?[]:E.validity.entityViolations,N=M.length>0,P="reset"!==U.kind;return e(n,{component:"div",children:[t(a,{variant:"h5",sx:{mb:2,mt:4,fontWeight:600},children:"Debug Data"}),e(n,{component:"div",sx:{p:2,mb:4,backgroundColor:"#e3f2fd",borderRadius:1,borderLeft:"4px solid #2196f3"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1,color:"primary.main"},children:"\uD83D\uDD0D How to Debug This Issue"}),t(a,{variant:"body2",component:"div",children:e("ul",{style:{margin:"8px 0",paddingLeft:"20px"},children:[e("li",{children:[t("strong",{children:"Start with Last Emission:"})," Check if there are invariant violations - these often indicate the root cause"]}),e("li",{children:[t("strong",{children:"Review Last Updates:"})," See which state changes were applied right before the error occurred"]}),e("li",{children:[t("strong",{children:"Check Committed vs Rendered State:"})," Compare these to identify inconsistencies or timing issues"]}),e("li",{children:[t("strong",{children:"Inspect Composition Tree:"})," Verify that all entities are composed correctly"]}),e("li",{children:[t("strong",{children:"Review Data Sources:"})," Ensure all required data is loaded and in the expected format"]}),t("li",{children:'Use the "Reset state" button to navigate back to the index page without reloading'}),t("li",{children:'Use the "Reload Page" button to perform a full page refresh if state is corrupted'})]})})]}),(N||P)&&e(i,{children:[e(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:N?"error.main":"primary.main"},children:["Last Emission ",N&&"(Has Violations!)"]}),e(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:["The most recent state update that was applied."," ",N?"Contains invariant violations that prevented the state from being committed.":"Shows what changed in the application state."]}),N&&t(i,{children:e(n,{component:"div",sx:{p:2,backgroundColor:"#ffebee",borderRadius:1,borderLeft:"4px solid #f44336",mb:2},children:[t(a,{variant:"subtitle2",sx:{color:"error.main",mb:1},children:"⚠️ Invariant Violations:"}),t(d,{component:"div",spacing:1,children:M.map((i,r)=>e(n,{component:"div",sx:{pl:2},children:[e(a,{variant:"body2",sx:{fontWeight:600},children:["Entity: ",String(i.entityId)]}),t(a,{variant:"caption",sx:{color:"text.secondary",display:"block",fontFamily:"monospace",fontSize:"0.75rem"},children:JSON.stringify(i.violation)})]},r))})]})}),P&&e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Last Updates"}),t(k,{data:U.updates})]}),U.transformationLog&&e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Transformation Log"}),t(k,{data:U.transformationLog})]}),t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Validity"}),t(k,{data:E.validity}),t(o,{sx:{my:4}})]}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Committed Slice"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:'The last valid state that was successfully committed. This is the "source of truth" for the application state and passes all invariant checks.'}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"State"}),t(k,{data:f})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Active components"}),t(k,{data:D})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Composition Tree"}),L&&t(k,{data:L})]}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Rendered Slice"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"The state that's currently being used to render the UI. This may differ from committed state during animations or transitions."}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"State"}),t(k,{data:v})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Active components"}),t(k,{data:A})]}),e(n,{component:"div",sx:{mb:3},children:[t(a,{variant:"body1",sx:{mb:2,fontWeight:600,fontSize:"1.1rem"},children:"Composition Tree"}),R&&t(k,{data:R})]}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Published Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configuration data published to S3. This is the main source of truth for domain entities, components, and rules. Loaded from the backend at application startup."}),t(k,{data:T}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Frontend Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Data collected and processed on the frontend. Contains UI state, user selections, and client-side computed values."}),t(k,{data:I}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Backend Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Optional data fetched from backend APIs. May include pricing, availability, or other dynamic server-side data."}),t(k,{data:z}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Session Service"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Authentication and session information. Contains user identity, permissions, and session tokens."}),t(k,{data:W}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Loaded Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"The initial data of the configuration used to start the configurator. This is the starting state and context provided when the configurator was initialized."}),t(k,{data:w}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Access Data"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Access control and permissions service. Determines what actions the current user can perform and what data they can view."}),t(k,{data:C}),t(o,{sx:{my:4}}),t(a,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Configurator Props"}),t(a,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configurator-specific properties and settings. Contains routing information, UI configuration, and configurator context settings."})]})};export const DevContextFallback=r=>{let{error:s,resetErrorBoundary:h}=r,m=v();if(C(h),!m)throw s;if(s instanceof l)return t(n,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(d,{sx:{p:5,boxSizing:"border-box"},spacing:3,children:[t(a,{variant:"h4",sx:{mb:2,mt:2},color:"error",children:"Can not render a control input!"}),e(n,{component:"div",sx:{p:2,mb:2,backgroundColor:"#fff3cd",borderRadius:1,borderLeft:"4px solid #ffc107"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1},children:"⚠️ When does this error occur?"}),e(a,{variant:"body2",children:["This error occurred ",t("strong",{children:"while the configurator was running"}),", during the rendering of UI controls. Most likely causes:"]}),e(a,{variant:"body2",component:"ul",sx:{mt:1,mb:0},children:[t("li",{children:"A control input component is referenced but not defined in the domain"}),t("li",{children:"The instanceName has a typo or doesn't match the actual component name"}),t("li",{children:"The entity type doesn't support the requested control input"})]})]}),t(W,{}),t(o,{}),t(a,{variant:"body1",children:s.message}),t(o,{}),e(d,{spacing:2,direction:"row",children:[e(d,{children:[t(a,{variant:"subtitle2",children:"Instance Name: "}),t(a,{variant:"subtitle2",children:"Entity Id: "})]}),e(d,{children:[t(a,{variant:"body1",children:s.instanceName}),t(a,{variant:"body1",children:s.entityId})]})]}),t(o,{}),s.stack&&e(i,{children:[t(w,{stack:s.stack,error:s}),t(o,{})]}),e(d,{children:[t(a,{variant:"subtitle2",children:"To debug: "}),e("ul",{children:[t("li",{children:t(a,{variant:"body1",children:"Check that input component exists"})}),t("li",{children:e(a,{variant:"body1",children:["Check it exists on an entity of type ",t("strong",{children:c(s.entityId)})]})}),t("li",{children:e(a,{variant:"body1",children:["Check that the ",t("strong",{children:"instanceName"})," is correct and there is no typo"]})})]})]}),t(o,{}),t(T,{})]})});let p=s instanceof Error?s.stack:null;return t(n,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(d,{sx:{p:5,boxSizing:"border-box"},spacing:3,children:[t(a,{variant:"h4",sx:{mb:2,mt:2},color:"error",children:"There was an unknown error in the configurator context!"}),e(n,{component:"div",sx:{p:2,mb:2,backgroundColor:"#fff3cd",borderRadius:1,borderLeft:"4px solid #ffc107"},children:[t(a,{variant:"subtitle2",sx:{fontWeight:600,mb:1},children:"⚠️ When does this error occur?"}),e(a,{variant:"body2",children:["This error occurred ",t("strong",{children:"while the configurator was running"}),", after data was successfully loaded. Most likely causes:"]}),e(a,{variant:"body2",component:"ul",sx:{mt:1,mb:0},children:[t("li",{children:"A state update caused an invariant violation"}),t("li",{children:"Component rendering failed due to invalid state"}),t("li",{children:"Business rules or transformations threw an unexpected error"}),t("li",{children:"Invalid data was introduced through user interactions or computed values"})]})]}),t(a,{variant:"body2",sx:{mb:2},children:"This should not happen, please report it so we can improve the platform!"}),t(W,{}),t(a,{variant:"subtitle2",children:"Error: "}),t(a,{variant:"body2",children:`${s}`}),p&&e(i,{children:[t(o,{}),t(w,{stack:p,error:s})]}),t(o,{}),t(T,{})]})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as r}from"react/jsx-runtime";import{Box as i,Button as n,Divider as o,Stack as a,Typography as s}from"@mui/material";import{useEffect as c,useRef as d}from"react";import{useAccessService as l,useBackendData as h,
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as r}from"react/jsx-runtime";import{Box as i,Button as n,Divider as o,Stack as a,Typography as s}from"@mui/material";import{useEffect as c,useRef as d}from"react";import{useAccessService as l,useBackendData as h,useConfiguratorRouting as m,useFrontendData as f,useIsDev as u,useLoadedData as p,useOverridesHash as b,usePublishedData as x,useSessionService as v}from"#package/react-sdk";import{JsonViewer as g,StackTraceViewer as y}from"#package/ui-sdk";import{useResetOnEditorHotReload as k}from"./use-reset-on-editor-hot-reload.js";let w=()=>{let r=m();return e(a,{direction:"row",spacing:2,sx:{mb:2},children:[t(n,{variant:"outlined",size:"small",onClick:()=>{r.goToIndex()},children:"Reset state"}),t(n,{variant:"outlined",size:"small",onClick:()=>{window.location.reload()},children:"Reload Page"})]})},S=()=>{let n=p(),a=l(),c=v(),d=x(),m=f(),u=h();return e(r,{children:[t(s,{variant:"h5",sx:{mb:2,mt:4,fontWeight:600},children:"Debug Data"}),e(i,{component:"div",sx:{p:2,mb:4,backgroundColor:"#e3f2fd",borderRadius:1,borderLeft:"4px solid #2196f3"},children:[t(s,{variant:"subtitle2",sx:{fontWeight:600,mb:1,color:"primary.main"},children:"\uD83D\uDD0D How to Debug This Issue"}),t(s,{variant:"body2",component:"div",children:e("ul",{style:{margin:"8px 0",paddingLeft:"20px"},children:[t("li",{children:"Check the error message and stack trace above for the exact location of the issue"}),t("li",{children:"Review the data sections below to understand the current application state"}),t("li",{children:"Look for missing or unexpected values in Published, Frontend, or Backend Data"}),t("li",{children:"Verify that all required data sources are loaded correctly"}),t("li",{children:"Check Session Service for authentication issues"}),t("li",{children:'Use the "Reset state" button to return to the index page'}),t("li",{children:'Use the "Reload Page" button to start fresh if the issue persists'})]})})]}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Published Data"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configuration data published to S3. This is the main source of truth for domain entities, components, and rules. Loaded from the backend at application startup."}),t(g,{data:d}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Frontend Data"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Data collected and processed on the frontend. Contains UI state, user selections, and client-side computed values."}),t(g,{data:m}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Backend Data"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Optional data fetched from backend APIs. May include pricing, availability, or other dynamic server-side data."}),t(g,{data:u}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Session Service"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Authentication and session information. Contains user identity, permissions, and session tokens."}),t(g,{data:c}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Loaded Data"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"The initial data of the configuration used to start the configurator. This is the starting state and context provided when the configurator was initialized."}),t(g,{data:n}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Access Data"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Access control and permissions service. Determines what actions the current user can perform and what data they can view."}),t(g,{data:a}),t(o,{sx:{my:4}}),t(s,{variant:"h6",sx:{mb:1,mt:3,fontWeight:600,color:"primary.main"},children:"Configurator Props"}),t(s,{variant:"body2",sx:{mb:2,color:"text.secondary",fontStyle:"italic"},children:"Configurator-specific properties and settings. Contains routing information, UI configuration, and configurator context settings."})]})};export const DevLoadingFallback=n=>{let{error:l,resetErrorBoundary:h}=n,m=u(),f=b();k(h);let p=d(null);if(c(()=>{if(h){if(null===p.current){p.current=f;return}f!==p.current&&h()}},[f,h]),!m)throw l;if(l instanceof Error)return t(i,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(a,{component:"div",spacing:3,sx:{p:5,boxSizing:"border-box"},alignItems:"flex-start",children:[t(s,{variant:"h6",sx:{mb:2,mt:2},color:"error",children:"Loading of the context failed for an unknown reason!"}),e(i,{component:"div",sx:{p:2,mb:2,backgroundColor:"#fff3cd",borderRadius:1,borderLeft:"4px solid #ffc107"},children:[t(s,{variant:"subtitle2",sx:{fontWeight:600,mb:1},children:"⚠️ When does this error occur?"}),e(s,{variant:"body2",children:["This error happened ",t("strong",{children:"during the initial loading of data"})," before the configurator could start. Most likely causes:"]}),e(s,{variant:"body2",component:"ul",sx:{mt:1,mb:0},children:[t("li",{children:"Migration scripts failed to transform the data correctly"}),t("li",{children:"State initialization encountered invalid or corrupted data"})]})]}),t(s,{variant:"body2",sx:{mb:2},children:"This should not happen, please report it so we can improve the platform!"}),t(w,{}),t(s,{variant:"subtitle2",children:"Error: "}),t(s,{variant:"body2",children:l.message}),l.stack&&e(r,{children:[t(o,{}),t(y,{stack:l.stack,error:l})]}),t(o,{}),t(S,{})]})});let x=l instanceof Error?l.stack:null;return t(i,{component:"div",sx:{height:"100vh",overflow:"auto"},children:e(a,{component:"div",spacing:3,sx:{p:5,boxSizing:"border-box"},children:[t(s,{variant:"h6",sx:{mb:2,mt:2},color:"error",children:"Loading of the context failed for an unknown reason!"}),t(s,{variant:"body2",children:"This should not happen, please report it so we can improve the platform!"}),t(w,{}),t(s,{variant:"subtitle2",children:"Error: "}),t(s,{variant:"body2",children:`${l}`}),x&&e(r,{children:[t(o,{}),t(y,{stack:x,error:l})]}),t(o,{}),t(S,{})]})})};
|
|
@@ -4,6 +4,6 @@ interface ScreenshotThumbnailsProps {
|
|
|
4
4
|
/** Called once a picture has loaded, which changes the size of the popover. */
|
|
5
5
|
readonly onImageLoad: () => void;
|
|
6
6
|
}
|
|
7
|
-
/** The pictures of a tool call's screenshots
|
|
7
|
+
/** The pictures of a tool call's screenshots. */
|
|
8
8
|
export declare const ScreenshotThumbnails: ({ screenshots, onImageLoad }: ScreenshotThumbnailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{styled as o}from"@mui/material";import{AssistantPanelName as r}from"../theme.js";import{useScreenshotSrc as a}from"./use-screenshot-src.js";let i=o("span",{name:r,slot:"screenshots",shouldForwardProp:e=>"columns"!==e})(({columns:e,theme:{palette:o,shape:r,shadows:a,spacing:i}})=>({background:o.background.paper,borderRadius:r.borderRadius,boxShadow:a[4],display:"grid",gap:i(1.5),gridTemplateColumns:`repeat(${e}, minmax(0, 200px))`,maxInlineSize:"80vw",padding:i(1.5)})),s=o("img")(({theme:{palette:e,shape:o}})=>({blockSize:"auto",borderRadius:o.borderRadius/2,boxShadow:`inset 0 0 0 1px ${e.divider}`,display:"block",inlineSize:"100%"})),d=o("span")(({theme:{palette:e,shape:o}})=>({aspectRatio:"4 / 3",background:e.action.hover,borderRadius:o.borderRadius/2,display:"block"})),t=({picture:o,onImageLoad:r})=>{let i=a(o);return void 0===i?e(d,{}):e(s,{src:i,alt:"",onLoad:r})};export const ScreenshotThumbnails=({screenshots:o,onImageLoad:r})=>e(i,{columns:Math.min(o.length,2),children:o.map(({label:o,picture:a})=>e(t,{picture:a,onImageLoad:r},o))});
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the panel gets a screenshot's picture from: the server, by the id the browser uploaded it
|
|
3
|
+
* under, or the data URL of a picture a thread from before the upload carries inline.
|
|
4
|
+
*/
|
|
5
|
+
export type AssistantScreenshotPicture = {
|
|
6
|
+
readonly kind: 'stored';
|
|
7
|
+
readonly imageId: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'inline';
|
|
10
|
+
readonly src: string;
|
|
11
|
+
};
|
|
1
12
|
/** A screenshot a `query` or `apply` call took, as the panel shows it. */
|
|
2
13
|
export interface AssistantToolScreenshot {
|
|
3
14
|
/** The label the call's `image` field returned, such as `Cabinet-2/doorLayout#2`. */
|
|
4
15
|
readonly label: string;
|
|
5
|
-
readonly
|
|
6
|
-
readonly view: string;
|
|
7
|
-
/** The picture as a data URL. */
|
|
8
|
-
readonly src: string;
|
|
16
|
+
readonly picture: AssistantScreenshotPicture;
|
|
9
17
|
}
|
|
10
18
|
/**
|
|
11
19
|
* The screenshots of a tool result: the image parts that follow the result's JSON, each after the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as t}from"zod";import{readAssistantImageReference as e}from"@salsita-ai/contracts/assistant";let a=t.object({type:t.literal("text"),content:t.string()}),r=t.object({type:t.literal("image"),source:t.discriminatedUnion("type",[t.object({type:t.literal("url"),value:t.string()}),t.object({type:t.literal("data"),value:t.string(),mimeType:t.string()})])}),s=/^[^/]+\/[^#]+(?:#\d+)?$/;export const readToolScreenshots=t=>Array.isArray(t)?t.slice(1).flatMap((t,l,i)=>{let n=r.safeParse(t),o=a.safeParse(i[l-1]),c=n.success?(({source:t})=>{if("data"===t.type)return{kind:"inline",src:`data:${t.mimeType};base64,${t.value}`};let a=e(t.value);return null===a?null:{kind:"stored",imageId:a}})(n.data):null;return c&&o.success&&s.test(o.data.content)?[{label:o.data.content,picture:c}]:[]}):[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AssistantScreenshotPicture } from './tool-screenshots.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `src` of a screenshot's picture: the data URL of an inline one at once, and for an uploaded
|
|
4
|
+
* one the object URL the assistant system reads it into, once it has been read; `undefined` until
|
|
5
|
+
* then and when the read fails. Only the open popover of a call's screenshots calls it, so nothing
|
|
6
|
+
* is read while the popover is closed.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useScreenshotSrc: (picture: AssistantScreenshotPicture) => string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as r,useState as e}from"react";import{useConfigurator as n}from"../../../application-runtime/index.js";export const useScreenshotSrc=t=>{let{assistantSystem:i}=n(),o="stored"===t.kind?t.imageId:null,[l,d]=e();return(r(()=>{if(null===o)return;let r=!0;return i.loadScreenshotUrl(o).then(e=>{r&&d({imageId:o,src:e})},()=>void 0),()=>{r=!1}},[i,o]),"inline"===t.kind)?t.src:l?.imageId===o?l.src:void 0};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Trans as i}from"@lingui/react";import{Button as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Trans as i}from"@lingui/react";import{Button as a,Typography as t,styled as s}from"@mui/material";import{useConfiguratorRouting as o}from"#package/react-sdk";import{PhxIcon as n}from"#package/ui-sdk";let c=s("div")(({theme:{spacing:e}})=>({display:"grid",minBlockSize:"100cqb",padding:e(2),placeItems:"center",position:"relative"})),m=s("div")({maxInlineSize:"80ch",textAlign:"center",textWrap:"pretty"});export const GPUAccelerationDisabled=()=>{let{goToIndex:s}=o();return e(c,{children:r(m,{children:[e(n,{name:"CubeDuotone",sx:{fontSize:48}}),e(t,{component:"h1",variant:"h4",sx:{my:4},children:e(i,{id:"sdk.messages.error.gpuDisabled.title",message:"GPU acceleration disabled"})}),e(t,{color:"text.secondary",children:e(i,{id:"sdk.messages.error.gpuDisabled.message",message:"Your browser has GPU acceleration disabled, which prevents the configurator from working correctly. 3D performance is severely impacted. Enabled this option in your browser settings to use the configurator."})}),e(a,{variant:"text",color:"primary",size:"large",sx:{mt:6.5},onClick:s,children:e(i,{id:"sdk.messages.navigation.goToHomepage.label",message:"Go To Homepage"})})]})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Trans as
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{Trans as t}from"@lingui/react";import{Button as o,Typography as i,styled as s}from"@mui/material";import{useConfiguratorRouting as a}from"#package/react-sdk";import{PhxIcon as n}from"#package/ui-sdk";let m=s("div")(({theme:{spacing:e}})=>({display:"grid",minBlockSize:"100cqb",padding:e(2),placeItems:"center",position:"relative"})),d=s("div")({maxInlineSize:"80ch",textAlign:"center",textWrap:"pretty"});export const WebGLNotSupported=()=>{let{goToIndex:s}=a();return e(m,{children:r(d,{children:[e(n,{name:"CubeDuotone",sx:{fontSize:48}}),e(i,{component:"h1",variant:"h4",sx:{my:4},children:e(t,{id:"sdk.messages.error.webglNotSupported.title",message:"WebGL is not supported or cannot be initialized"})}),e(i,{color:"text.secondary",children:e(t,{id:"sdk.messages.error.webglNotSupported.message",message:"Your device or browser does not support WebGL, which is required for the configurator to function. Try a different browser or device that supports WebGL"})}),e(o,{variant:"text",color:"primary",size:"large",sx:{mt:6.5},onClick:s,children:e(t,{id:"sdk.messages.navigation.goToHomepage.label",message:"Go To Homepage"})})]})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Trans as
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Trans as n}from"@lingui/react";import{Button as o,DialogActions as r,DialogContent as i,DialogContentText as t,DialogTitle as l,Dialog as s,dialogClasses as c,styled as d}from"@mui/material";import{useMutation as m}from"@tanstack/react-query";import{useCallback as u}from"react";import{useAuthorizedClient as p,useConfigurationId as g,useConfiguratorRouting as k,useDomainApplication as y}from"#package/react-sdk";import{LoadingButton as f}from"#package/ui-sdk";let h=d(s)(()=>({[`.${c.paper}`]:{inlineSize:"min(480px, 100%)",maxWidth:"unset"}}));export const CloneToEditDialog=s=>{let{onClose:c,open:d}=s,{goToConfigurationDetail:b}=k(),C=p(),x=g(),{configurationPersistSystem:v}=y(),{mutate:j,isPending:T}=m({mutationFn:()=>C.cloneConfiguration(x,v.revisionId$.value),onSuccess:e=>{c(),b(e.configurationId,e.accessToken)}}),D=u(()=>{j()},[j]);return a(h,{open:d,onClose:c,children:[e(l,{children:e(n,{id:"sdk.layout.banner.readonly.clone.title",message:"Edit configuration"})}),e(i,{children:e(t,{children:e(n,{id:"sdk.layout.banner.readonly.clone.message",message:"You're about to create an editable copy of this setup. Changes you make won't affect the original shared link."})})}),a(r,{children:[e(o,{variant:"text",color:"inherit",onClick:c,children:e(n,{id:"sdk.layout.banner.readonly.cancel.label",message:"Cancel"})}),e(f,{variant:"contained",color:"primary",busy:T,onClick:D,children:e(n,{id:"sdk.layout.banner.readonly.clone.label",message:"Create editable copy"})})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as
|
|
1
|
+
import{jsx as a,jsxs as e,Fragment as r}from"react/jsx-runtime";import{useCallback as t,useState as o}from"react";import{useChatEnabled as i,useLocalizable as n}from"#package/react-sdk";import{ExperimentalChatUi as l,MobileChat as m}from"#package/ui-sdk";import{Chat as s}from"./Chat.js";export const MobileChat=c=>{let{icon:h,label:p,heading:d}=c,[b,f]=o(!1),g=i(),u=n(p),C=t(()=>{f(!0)},[]),j=t(()=>{f(!1)},[]);return g?e(r,{children:[a(m.Button,{icon:h,ariaLabel:u,handleOpen:C}),a(m.Dialog,{isOpen:b,handleClose:j,heading:d,children:a(l.ChatRoot,{variant:"mobile",children:a(s,{variant:"mobile"})})})]}):null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{Trans as r}from"@lingui/react";import{Button as t}from"@mui/material";import{memo as e,useCallback as i}from"react";import{FrontendAnalyticsFactory as a,useAnalyticsService as m,useIntegrationState as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Trans as r}from"@lingui/react";import{Button as t}from"@mui/material";import{memo as e,useCallback as i}from"react";import{FrontendAnalyticsFactory as a,useAnalyticsService as m,useConfiguratorRouting as n,useIntegrationState as s}from"#package/react-sdk";import{PhxIcon as c}from"#package/ui-sdk";import{usePresetSelection as l,usePreview as p}from"../../../../configurator-context/index.js";import{CloseConfiguratorButton as d}from"./CloseConfiguratorButton.js";export const CommonTopNavigation=e(()=>{let e=m(),f=n(),{presetCategories:u}=l(),{isPreview:g,isPreviewEnabled:k}=p(),x=u.flatMap(o=>o.presets).length>1,C=s(),j=i(()=>{e.push(a.GoToProductsClicked()),f.goToIndex()},[e,f]);if(!C.embeddedView)return x||!k||g?x?o(t,{size:"small",startIcon:o(c,{name:"ArrowLeft"}),onClick:j,children:o(r,{id:"sdk.layout.navigation.common.product.label",message:"Website"})}):null:o(d,{})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as e,motion as r}from"motion/react";import{
|
|
1
|
+
import{jsx as t,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as e,motion as r}from"motion/react";import{useChatEnabled as m}from"#package/react-sdk";import{AnimationTarget as a,Sidebar as i}from"#package/ui-sdk";import{ChatInteractionContainer as n}from"../../chat/ChatInteractionContainer.js";import{CommonFinalizeButton as c}from"../common/CommonFinalizeButton.js";import{CommonSidebarFooter as s}from"../common/CommonSidebarFooter.js";import{DesktopSummaryButton as p}from"../common/DesktopSummaryButton.js";import{SimpleSidebarContent as u}from"./SimpleSidebarContent.js";let d={transition:{type:"spring",duration:.3},variants:{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:16}}};export const SimpleSidebar=l=>{let{summaryPage:y,customPriceNode:S,onEnterSummary:f,onLeaveSummary:h,price:B,isSummaryActive:j,hasSummary:v}=l,P=m();return t(i.Layout,{content:t(u,{isSummaryActive:j,summaryPage:y,onLeaveSummary:h}),chat:P&&t(n,{}),footer:o(e,{initial:!1,mode:"wait",children:[!v&&t(s,{customPriceNode:S,formattedPrice:B,actionButton:t(c,{}),showTemplateButton:!0,showSaveTemplateButton:!0}),v&&!j&&t(r.div,{...d,...a,children:t(s,{customPriceNode:S,actionButton:t(p,{onEnterSummary:f}),formattedPrice:B,showSaveTemplateButton:!1})},"sidebarFooterSummary"),v&&j&&t(r.div,{...d,...a,children:t(s,{customPriceNode:S,actionButton:t(c,{}),formattedPrice:B,showTemplateButton:!0,showSaveTemplateButton:!0})},"sidebarFooterSummary")]})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{Trans as r}from"@lingui/react";import{Button as t}from"@mui/material";import{memo as e,useCallback as i}from"react";import{FrontendAnalyticsFactory as a,useAnalyticsService as m,usePresetEmbeddedState as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Trans as r}from"@lingui/react";import{Button as t}from"@mui/material";import{memo as e,useCallback as i}from"react";import{FrontendAnalyticsFactory as a,useAnalyticsService as m,useConfiguratorRouting as s,usePresetEmbeddedState as n}from"#package/react-sdk";import{PhxIcon as l}from"#package/ui-sdk";import{usePresetSelection as p,usePreview as c}from"../../../../configurator-context/index.js";import{CloseConfiguratorButton as f}from"../common/CloseConfiguratorButton.js";export const SimpleMobileTopNavigation=e(()=>{let e=m(),u=s(),{presetCategories:d}=p(),{isPreview:g,isPreviewEnabled:k}=c(),x=d.flatMap(o=>o.presets).length>1,b=i(()=>{e.push(a.GoToProductsClicked()),u.goToIndex()},[e,u]);if(!n())return x||g||!k?x?o(t,{size:"small",startIcon:o(l,{name:"ArrowLeft"}),onClick:b,children:o(r,{id:"sdk.layout.navigation.mobile.product.label",message:"Website"})}):null:o(f,{})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{Trans as a}from"@lingui/react";import{memo as i,useCallback as o}from"react";import{FrontendAnalyticsFactory as s,useActiveNavigationState as n,useAnalyticsService as r,
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{Trans as a}from"@lingui/react";import{memo as i,useCallback as o}from"react";import{FrontendAnalyticsFactory as s,useActiveNavigationState as n,useAnalyticsService as r,useConfiguratorRouting as p,useDomain as c,usePresetEmbeddedState as l,useResolveLocalizable as d}from"#package/react-sdk";import{TopNavigation as m,useResponsive as g}from"#package/ui-sdk";import{usePresetSelection as u}from"../../../../configurator-context/index.js";export const StepsNavigation=i(i=>{let{steps:f}=i,k=r(),{navigationSystem:v,storeSystem:x}=c(),h=n(),C=p(),S=d(),{presetCategories:T}=u(),j=l(),N=T.flatMap(t=>t.presets).length>1,b=!j&&N,I=f.findIndex(t=>t.navigationStates.includes(h))+ +!!b,{isTablet:P}=g(),y=o(()=>{k.push(s.GoToProductsClicked()),C.goToIndex()},[k,C]);return e(m.Root,{activeStep:I,nonLinear:!0,compact:P,fullWidth:!0,children:[b&&t(m.Step,{isCompleted:!0,onClick:y,compact:P,children:t(a,{id:"sdk.layout.navigation.steps.first.label",message:"Products"})}),f.map((e,a)=>{let i=b?a<I-1:a<I,o=S(e.label);return t(m.Step,{isCompleted:i,isDisabled:!i,compact:P,onClick:()=>{let t=e.navigationStates[0];t&&(k.push(s.TopNavigationStepClicked(t)),x.stageAndCommit([v.getNavigationUpdate(t)]))},children:o},o)})]})});
|