@salsita-ai/sdk 0.50.0-develop.b5dfdd9774 → 0.50.0-develop.b65a5a9c66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/common/admin-interface.d.ts +11 -1
- package/dist/admin/common/admin-interface.js +1 -1
- package/dist/admin/ui/layout/UserProfile.d.ts +1 -1
- package/dist/admin/ui/layout/UserProfile.js +1 -1
- package/dist/admin/ui/maintenance/ImportPresets.js +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.js +1 -1
- package/dist/application/studio-embedding.d.ts +6 -0
- package/dist/application/studio-embedding.js +1 -0
- package/dist/application-spec/core/enhanced-json-schema.d.ts +5 -6
- package/dist/application-spec/core/enhanced-json-schema.js +1 -1
- package/dist/application-spec/core/markers/index.d.ts +1 -0
- package/dist/application-spec/core/markers/index.js +1 -1
- package/dist/application-spec/core/markers/set-in-studio-marker.d.ts +15 -0
- package/dist/application-spec/core/markers/set-in-studio-marker.js +1 -0
- package/dist/application-spec/errors/diagnostic-codes.d.ts +14 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +14 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/domain-runtime-files.d.ts +3 -3
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +0 -12
- package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.d.ts +5 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.js +4 -4
- package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +19 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +12 -12
- package/dist/application-spec/generate-application/code/templates/globals.js +21 -12
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/core/cli.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/custom-layout.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.js +19 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.js +32 -26
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.js +1 -3
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/webhooks.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/guide.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-subpath-imports.js +1 -1
- package/dist/application-spec/generate-application/code/templates/webhook-builders.js +3 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.js +3 -7
- package/dist/application-spec/generate-application/code/webhook-safe-files.d.ts +3 -1
- package/dist/application-spec/generate-application/code/webhook-safe-files.js +1 -1
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.d.ts +18 -0
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.js +1 -0
- package/dist/application-spec/parse-application-files/access/analyzed-file.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/analyzed-file.js +1 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.d.ts +20 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.d.ts +17 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/index.d.ts +5 -0
- package/dist/application-spec/parse-application-files/access/index.js +1 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.js +1 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +2 -1
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +30 -4
- package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/webhook-safety.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.d.ts +14 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +7 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
- package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
- package/dist/application-spec/parse-application-files/parse-common-admin-spec.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +6 -0
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/index.d.ts +2 -1
- package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.d.ts +5 -2
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.js +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.d.ts +15 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.js +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/app-metadata.js +1 -1
- package/dist/client/authenticated-client.d.ts +5 -1
- package/dist/client/authenticated-client.js +1 -1
- package/dist/client/authorized-client.d.ts +3 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/base-client.d.ts +15 -1
- package/dist/client/base-client.js +1 -1
- package/dist/client/contract.d.ts +25 -0
- package/dist/client/contract.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/phoenix-api.d.ts +941 -8
- package/dist/client/unauthenticated-client.d.ts +1 -0
- package/dist/client/unauthenticated-client.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +9 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +11 -1
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/docs/index.json +1 -1
- package/dist/docs/phoenix/admin.mdx +5 -40
- package/dist/docs/phoenix/clerk-sign-in.mdx +9 -5
- package/dist/docs/phoenix/data-sources.mdx +25 -29
- package/dist/docs/phoenix/deployments.mdx +3 -3
- package/dist/docs/phoenix/finalization.mdx +0 -1
- package/dist/docs/phoenix/integration/authentication-external.mdx +5 -5
- package/dist/docs/phoenix/integration/authentication-internal.mdx +1 -1
- package/dist/docs/phoenix/integration/finalization-internal.mdx +1 -4
- package/dist/docs/phoenix/integration/integration-modes-internal.mdx +9 -0
- package/dist/docs/phoenix/phoenix-cli.mdx +4 -4
- package/dist/docs/phoenix/project-structure.mdx +13 -8
- package/dist/docs/phoenix/publishing.mdx +21 -28
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
- package/dist/docs/phoenix/sessions-and-access.mdx +169 -163
- package/dist/docs/phoenix/webhook-membership.mdx +3 -0
- package/dist/docs/phoenix/webhooks.mdx +90 -113
- package/dist/domain/application/access/access-handlers.d.ts +19 -0
- package/dist/domain/application/access/access-handlers.js +1 -0
- package/dist/domain/application/access/anonymous-handler.d.ts +16 -0
- package/dist/domain/application/access/anonymous-handler.js +1 -0
- package/dist/domain/application/access/chunk-scopes-handler.d.ts +27 -0
- package/dist/domain/application/access/chunk-scopes-handler.js +1 -0
- package/dist/domain/application/access/code-handler.d.ts +16 -0
- package/dist/domain/application/access/code-handler.js +1 -0
- package/dist/domain/application/access/index.d.ts +7 -0
- package/dist/domain/application/access/index.js +1 -0
- package/dist/domain/application/access/refresh-handler.d.ts +16 -0
- package/dist/domain/application/access/refresh-handler.js +1 -0
- package/dist/domain/application/access/signed-in-handler.d.ts +44 -0
- package/dist/domain/application/access/signed-in-handler.js +1 -0
- package/dist/domain/application/access/visitor-handler.d.ts +23 -0
- package/dist/domain/application/access/visitor-handler.js +1 -0
- package/dist/domain/application/application-config.d.ts +29 -0
- package/dist/domain/application/configurator-builder.d.ts +2 -0
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +2 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.d.ts +1 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/core/domain-factory.d.ts +6 -0
- package/dist/domain/core/domain-factory.js +1 -1
- package/dist/domain/core/fit-session-data.d.ts +16 -0
- package/dist/domain/core/fit-session-data.js +1 -0
- package/dist/domain/domain-runtime/domain-context/actions.d.ts +4 -0
- package/dist/domain/domain-runtime/domain-context/actions.js +1 -1
- package/dist/domain/domain-runtime/domain-context/domain-context.d.ts +8 -0
- package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-context/types.d.ts +8 -4
- package/dist/domain/domain-runtime/domain-runtime.d.ts +8 -0
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +4 -0
- package/dist/domain/spec/sections/app-metadata.d.ts +10 -0
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/extras/clerk/index.d.ts +6 -0
- package/dist/extras/cognito/AccountAvatar.d.ts +7 -0
- package/dist/extras/cognito/AccountAvatar.js +1 -0
- package/dist/extras/cognito/AccountControl.d.ts +13 -0
- package/dist/extras/cognito/AccountControl.js +1 -0
- package/dist/extras/cognito/AdminSignInPage.d.ts +26 -0
- package/dist/extras/cognito/AdminSignInPage.js +1 -0
- package/dist/extras/cognito/CognitoSignInPage.d.ts +8 -2
- package/dist/extras/cognito/CognitoSignInPage.js +1 -1
- package/dist/extras/cognito/ConfiguratorSignInPage.d.ts +19 -0
- package/dist/extras/cognito/ConfiguratorSignInPage.js +1 -0
- package/dist/extras/cognito/SignInFailurePage.d.ts +11 -0
- package/dist/extras/cognito/SignInFailurePage.js +1 -0
- package/dist/extras/cognito/SignInGateLayout.d.ts +25 -0
- package/dist/extras/cognito/SignInGateLayout.js +1 -0
- package/dist/extras/cognito/SignInNotice.d.ts +8 -0
- package/dist/extras/cognito/SignInNotice.js +1 -0
- package/dist/extras/cognito/index.d.ts +4 -0
- package/dist/extras/cognito/index.js +1 -1
- package/dist/i18n/locales/cs/messages.js +1 -1
- package/dist/i18n/locales/da/messages.js +1 -1
- package/dist/i18n/locales/de/messages.js +1 -1
- package/dist/i18n/locales/de-AT/messages.js +1 -1
- package/dist/i18n/locales/en/messages.js +1 -1
- package/dist/i18n/locales/en-AU/messages.js +1 -1
- package/dist/i18n/locales/en-GB/messages.js +1 -1
- package/dist/i18n/locales/es/messages.js +1 -1
- package/dist/i18n/locales/fr/messages.js +1 -1
- package/dist/i18n/locales/hu/messages.js +1 -1
- package/dist/i18n/locales/it/messages.js +1 -1
- package/dist/i18n/locales/nl/messages.js +1 -1
- package/dist/i18n/locales/pl/messages.js +1 -1
- package/dist/i18n/locales/pt/messages.js +1 -1
- package/dist/i18n/locales/ro/messages.js +1 -1
- package/dist/i18n/locales/sk/messages.js +1 -1
- package/dist/i18n/locales/tr/messages.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +10 -3
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/commands/deps/deps.js +2 -2
- package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
- package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
- package/dist/phoenix/services/prepare-development-environment.js +2 -2
- package/dist/phoenix/services/variant-file-session.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.d.ts +6 -0
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +2 -2
- package/dist/react-sdk/application-runtime/integration/integration-mode.d.ts +30 -0
- package/dist/react-sdk/application-runtime/integration/integration-mode.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +20 -6
- package/dist/react-sdk/application-runtime/session/actions.d.ts +2 -1
- package/dist/react-sdk/application-runtime/session/actions.js +1 -1
- package/dist/react-sdk/application-runtime/session/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/session/selectors.d.ts +2 -0
- package/dist/react-sdk/application-runtime/session/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-service.d.ts +34 -1
- package/dist/react-sdk/application-runtime/session/session-service.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-token.d.ts +8 -0
- package/dist/react-sdk/application-runtime/session/session-token.js +1 -1
- package/dist/react-sdk/application-runtime/session/types.d.ts +6 -1
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/preset-selection/PresetSelectionProvider.js +1 -1
- package/dist/react-sdk/session/AccessDeniedAdminPage.d.ts +13 -0
- package/dist/react-sdk/session/AccessDeniedAdminPage.js +1 -0
- package/dist/react-sdk/session/AccessDeniedPage.d.ts +20 -0
- package/dist/react-sdk/session/AccessDeniedPage.js +1 -0
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/dist/react-sdk/session/index.d.ts +3 -0
- package/dist/react-sdk/session/index.js +1 -1
- package/dist/react-sdk/session/sign-in-address.d.ts +13 -0
- package/dist/react-sdk/session/sign-in-address.js +1 -0
- package/dist/react-sdk/session/studio-frame.d.ts +7 -0
- package/dist/react-sdk/session/studio-frame.js +1 -0
- package/dist/react-sdk/session/use-sign-in.d.ts +50 -0
- package/dist/react-sdk/session/use-sign-in.js +1 -0
- package/dist/webhook/builders/auth-handler-builder.d.ts +21 -1
- package/dist/webhook/builders/auth-handler-builder.js +1 -1
- package/dist/webhook/builders/common.d.ts +9 -0
- package/dist/webhook/builders/webhook-builder.d.ts +13 -0
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +4 -4
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{autoHeader as e}from"../common/file-headers.js";import{generateApplicationSpecTypeDeclarations as a}from"./application-types.js";import{generateGlobalPhxTypes as n}from"./global-definition/index.js";export const generateApplicationSpecGlobals=(t,o)=>{let i,l,
|
|
2
|
-
${m([...
|
|
1
|
+
import{autoHeader as e}from"../common/file-headers.js";import{generateApplicationSpecTypeDeclarations as a}from"./application-types.js";import{generateGlobalPhxTypes as n}from"./global-definition/index.js";export const generateApplicationSpecGlobals=(t,o)=>{let d,i,r,l,s,p,y,c,m,{declarations:h,imports:f}=a(t,o,2);f.addTypeImport("@salsita-ai/sdk/domain","EnumLike"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateChunkScopesHandler"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateVisitorHandler"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateSignedInHandler"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateCodeHandler"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateRefreshHandler"),f.addTypeImport("@salsita-ai/sdk/domain","TypedCreateAnonymousHandler");let S=n(t,f),g=[h,(d=t.configurator.latestModel,i=t.admin.latestModel,r=d.entityTypes.map(String),l=[...d.aliases].map(([e])=>String(e)),s=[...d.commonTypes].map(([e])=>String(e)),p=i.entityTypes.map(String),y=[...i.aliases].map(([e])=>String(e)),c=[...i.commonTypes].map(([e])=>String(e)),m=(e,a)=>e.map(e=>` ${a(e)}`).join("\n"),` interface Model {
|
|
2
|
+
${m([...r,...s,...l],e=>`readonly ${e}: ${e}`)}
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
interface EnhancedModel {
|
|
6
|
-
${m([...
|
|
6
|
+
${m([...r,...l],e=>`readonly $${e}: $${e}`)}
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
interface AdminModel {
|
|
10
|
-
${m([...p,...y
|
|
10
|
+
${m([...p,...c,...y],e=>`readonly ${e}: Admin.${e}`)}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface AdminEnhancedModel {
|
|
14
|
-
${m([...p,...
|
|
14
|
+
${m([...p,...y],e=>`readonly $${e}: Admin.$${e}`)}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface ApplicationTypes {
|
|
@@ -36,7 +36,7 @@ ${m([...p,...c],e=>`readonly $${e}: Admin.$${e}`)}
|
|
|
36
36
|
readonly AdminModel: AdminModel
|
|
37
37
|
readonly AdminEnhancedModel: AdminEnhancedModel
|
|
38
38
|
readonly ApplicationTypes: ApplicationTypes
|
|
39
|
-
}`)].filter(Boolean).join("\n\n"),
|
|
39
|
+
}`)].filter(Boolean).join("\n\n"),T=(e,a)=>e.replaceAll("\n",`
|
|
40
40
|
${a}`);return`${e("globals.d.ts","Global type declarations for the phx namespace, env configs and domain types.")}
|
|
41
41
|
/* eslint-disable @typescript-eslint/triple-slash-reference, @typescript-eslint/consistent-type-imports */
|
|
42
42
|
/// <reference types="@salsita-ai/sdk/globals" />
|
|
@@ -51,10 +51,10 @@ ${a}`);return`${e("globals.d.ts","Global type declarations for the phx namespace
|
|
|
51
51
|
|
|
52
52
|
${f.toTypeOnlyString(".phoenix/globals.d.ts")}
|
|
53
53
|
|
|
54
|
-
${
|
|
54
|
+
${S.declarations}
|
|
55
55
|
|
|
56
56
|
declare global {
|
|
57
|
-
${
|
|
57
|
+
${g}
|
|
58
58
|
|
|
59
59
|
interface PhxGlobal {
|
|
60
60
|
readonly frontendEnv: import('./frontend.config.js').RuntimeConfig
|
|
@@ -78,13 +78,22 @@ ${S}
|
|
|
78
78
|
readonly AdminNavigationState: EnumLike<AdminNavigationState>
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
readonly domain: ${
|
|
81
|
+
readonly domain: ${T(S.domainType," ")}
|
|
82
82
|
|
|
83
|
-
readonly
|
|
84
|
-
readonly
|
|
83
|
+
readonly access: {
|
|
84
|
+
readonly createChunkScopesHandler: TypedCreateChunkScopesHandler<SessionData>
|
|
85
|
+
readonly createVisitorHandler: TypedCreateVisitorHandler<SessionData>
|
|
86
|
+
readonly createSignedInHandler: TypedCreateSignedInHandler<SessionData>
|
|
87
|
+
readonly createCodeHandler: TypedCreateCodeHandler<SessionData>
|
|
88
|
+
readonly createRefreshHandler: TypedCreateRefreshHandler<SessionData>
|
|
89
|
+
readonly createAnonymousHandler: TypedCreateAnonymousHandler<SessionData>
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
readonly
|
|
92
|
+
readonly frontend: ${S.configuratorInterfaceType} & {
|
|
93
|
+
readonly admin: ${S.adminInterfaceType}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
readonly webhooks: ${T(S.webhooksType," ")}
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
`};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options the generated code passes to the Studio-account sign-in pages: the spec's page title names the project
|
|
3
|
+
* on them; without one they take none and say "this configurator".
|
|
4
|
+
*/
|
|
5
|
+
export declare const generateSignInPageOptions: (pageTitle: string | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const generateSignInPageOptions=e=>e?`{ projectName: ${JSON.stringify(e)} }`:"";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPhoenixTopicGuide as e}from"../guide.js";export const generatePhoenixCliCore=()=>e({path:"core/cli.md",title:"CLI",summary:"tooling, identity, project structure and ownership, local development and deployment",sections:["## Tooling and dependencies\n\nCommands use pnpm notation; use the project's package manager identified by its lockfile or `packageManager` in `package.json`, and ask when neither identifies it. Keep the SDK on its intended release channel: stable, PR beta and workspace-linked projects must not be moved to canary.\n\n`phoenix deps` aligns missing or out-of-range peer dependencies in `package.json` but installs nothing. Install with the project's package manager, then `phoenix sync` regenerates project files and guidance. Refresh changed guidance after sync. An install with pnpm 11 that skips build scripts leaves placeholder entries under `allowBuilds` in `pnpm-workspace.yaml`; decide them, `true` for `@swc/core` and `esbuild` and `false` for `es5-ext`, because the platform build stops on a placeholder and `phoenix deploy` refuses one. [CLI and setup documentation](../features/index.md#cli-access-and-deployment) owns flags and installation details.\n\n## Identity and authentication\n\nA workspace contains projects, and a project has target environments and deployments. Confirm ambiguous identity before mutations or deploys. `phoenix login` authorizes the CLI across currently permitted Builder projects. `phoenix dev` and `phoenix deploy` work in the project that `--project <slug>` names, else the one `project` in `spec/application.yaml` names; the starter spec names none. With neither, a run without a terminal uses the only project the sign-in can reach and prints the `project: <slug>` line to add, so add it; when it can reach several, the command stops and lists them, and the client chooses the slug to set as `project` or to pass as `--project`. `project: default` no longer names a project: replace it with a slug from the list. `phoenix whoami` shows current access. The legacy `phoenix login <workspace>` form keeps workspace-bound credentials. For CI deploys, a superadmin creates a deploy-only token in Studio for one project they manage, or a workspace superadmin for the whole workspace, and supplies `PHOENIX_API_TOKEN` through the process environment. It overrides saved login only for deploy and whoami; never print it, write it into project files, or load it from dotenv. The token belongs to that project or workspace, not to the person who created it, and keeps deploying after that person leaves, until someone who manages the scope revokes it. Consult [project and authentication documentation](../features/index.md#cli-access-and-deployment) for local versus remote setup.\n\n## Project structure\n\n- `spec/` — domain, relations, expressions, invariants, components and application YAML.\n- `src/expressions/`, `actions/`, `invariants/`, `transformers/` — typed implementations of domain behavior and consistency rules.\n- `src/components/`, `elements/`, `handlers/` — runtime components, custom UI and layout elements, event and lifecycle handlers. See [Custom project layout](../features/custom-layout/index.md) and [Domain controls](../features/domain-controls/index.md).\n- `src/webhooks/` — the server side. The entry is the default export of `index.ts`, the only file imported; it imports the others. Without it the SDK supplies anonymous auth, or invitation-only Phoenix auth when `useCognito: true`; enabling custom or Clerk auth without it reports `AUTH_WITHOUT_PROJECT_WEBHOOK`. See [Webhooks](../features/webhooks/index.md).\n- `src/migrations/` — versioned model migrations; `src/admin/` mirrors the main source structure for Admin.\n- `src/locales/` — authored PO catalogs and generated TS catalogs.\n- `src/_shared/`, `src/_utils/` and other `_`-prefixed folders — helpers and supporting modules. Phoenix skips these folders during auto-import; import their modules explicitly.\n- `public/` — static models, textures, images and fonts; `assets/` — uploadable resources such as templates and email assets.\n- `docs/` — rendered specification PDFs for the client.\n- `tools/` — reproducible project scripts, such as model conversion or rendering the specification PDFs. One-off scripts, screenshots and downloads stay in the agent's scratch space outside the project.\n- `.phoenix/` — generated files, with the project-owned exceptions below. The root `tsconfig.json` belongs to the project and extends `.phoenix/tsconfig.json`.\n\nDo not edit generated output or compiled locale TS. `.phoenix/workspace/` holds the specification sources and project records; application-spec sync, build and clean preserve it, and the generated Git ignore rules leave it available for version control. Deploy includes `.phoenix/workspace/` and `docs/` in the private deployment sources, outside application inputs and public assets. `.phoenix/variants/` option files survive rebuilds. Legacy tooling has a separate lifecycle.\n\nSync rewrites and prunes Phoenix's `phoenix` and `phoenix-*` skill folders under `.claude/skills/` and `.agents/skills/`; keep custom skills under another name. Root `AGENTS.md` and client source documents are client-owned. Components use PascalCase TSX, utilities kebab-case TS, expressions entity-name TS, migrations sequential `v*.ts` and specs kebab-case YAML. `docs/phoenix/project-structure.mdx` has the full reference; the [capability index](../features/index.md#project-and-customization) lists it.\n\n### Source conventions\n\n- Auto-imported expressions, actions, invariants, transformers, components, handlers and elements must default-export their folder's phx factory result, as one item or an array. Named exports are ignored.\n- `phx` is a global in every project: use it without importing it.\n- Keep plain helpers in underscore folders and import them explicitly.\n- Use relative imports: dev, build and webhook bundling do not resolve tsconfig `paths` aliases.\n\n## Local development\n\n`phoenix dev` runs the live preview, `sync` regenerates without bundling, `build` produces the production build, and `check` checks project quality.\n\n### Keep the preview in front of the client\n\nThe client should see the configurator change while it is built. Before the first change in a conversation, make sure `pnpm phoenix dev` is running, starting it in the background when it is not, and wait for the `Preview: <url>` line it prints and writes to `.phoenix/phoenix-dev.log`. The log keeps the lines of earlier runs, so use the last one written after the start.\n\nFor a new project, start by understanding the client’s product and what they want to configure before asking them to sign in; then make the preview reflect that before showing it, rather than presenting the generated starter scene.\n\nOpen the address where the client can see it: in the agent application's built-in browser when it has one the client sees, otherwise in the client's browser with `open '<url>'` on macOS, `xdg-open '<url>'` on Linux or `Start-Process '<url>'` in PowerShell. Keep the quotes; the shell would otherwise read a `?` in the address as a pattern. Then tell the client in one line where the preview is and that it updates by itself as the work goes on. Variant comparisons open in the same preview, so say there what to compare and how to choose.\n\nOpen it once: the preview reloads on every change. A domain model change is the exception. Dev registers the model with the server only when it starts and logs an error asking for a restart; restart it, wait for the new `Preview:` line and open that address in place of the old tab, whose `?cid=` names a configuration of the earlier model.\n\n### Logs and inspection\n\nLogs in `.phoenix/phoenix-dev.log` contain spec, build and runtime errors and watcher events; check them after changes. Signed in, `phoenix dev` runs in agent mode: the preview hides the editor, a corner badge shows when the latest change didn't build, and any dev error shows an \"Agent at work\" screen with no details, so the client never sees them. The details are only in the log; the page recovers by itself after the next successful rebuild. `--editor` shows the editor and the detailed error pages. [Inspection tools](../features/inspection.md) cover assets, state, data, scene and screenshots. Runtime inspection needs dev running and the preview open in a browser; a screenshot of the canvas does not verify the surrounding interface.\n\n## Deployment\n\n`pnpm phoenix deploy` builds the project on the server into a hosted preview (not the local preview of `phoenix dev`) and waits until it is live. Without `--env` it uses `preview`, created when missing; `--env <name>` needs an existing preview. It never deploys to production: the client promotes a checked build in Studio. Watch its output: after `Build #<n> started in <preview>` it prints `Follow the build in Studio: <url>`; open that link where the client sees it. If that line is missing, run `pnpm phoenix login` again. `Build #<n> is queued behind build #<m>` means wait: it starts after the build ahead.\n\nA successful local preview does not establish deployed model compatibility. A new project starts empty, so the model of its first deploy becomes v1. A hosted preview replaces a changed schema, but promotion is refused when the model changed under a version production serves, as is the hello-world starter that the production of some early beta projects was first deployed as; [Model migration](../processes/model-migration.md) handles that. `pnpm phoenix deploy` and `pnpm phoenix dev` are both refused while the project is being set up (its first minute) or after its setup failed: wait a minute and retry, or ask the client to choose **Retry setup** on the project's overview in Studio. When the build fails, tell the client why and what next. Record each deploy and its outcome in the project record. [Deployment documentation](../features/index.md#cli-access-and-deployment) covers status and environment details.\n\n## Internal beta\n\nPhoenix is in an internal beta. Read [Beta](../processes/beta.md) before each deploy and when a deploy goes live; a project on the `canary` SDK build also reads it once per conversation before changing anything.\n\n## Interactive and support tools\n\n[Variants](../features/variants.md) compares frontend alternatives over the live preview and applies the choice. [Feedback](../processes/feedback/index.md) submits an approved issue or evaluation. The [workflow](workflow.md) owns when either is useful and how much client interaction fits the task."]});
|
|
1
|
+
import{createPhoenixTopicGuide as e}from"../guide.js";export const generatePhoenixCliCore=()=>e({path:"core/cli.md",title:"CLI",summary:"tooling, identity, project structure and ownership, local development and deployment",sections:["## Tooling and dependencies\n\nCommands use pnpm notation; use the project's package manager identified by its lockfile or `packageManager` in `package.json`, and ask when neither identifies it. Keep the SDK on its intended release channel: stable, PR beta and workspace-linked projects must not be moved to canary.\n\n`phoenix deps` aligns missing or out-of-range peer dependencies in `package.json` but installs nothing. Install with the project's package manager, then `phoenix sync` regenerates project files and guidance. Refresh changed guidance after sync. An install with pnpm 11 that skips build scripts leaves placeholder entries under `allowBuilds` in `pnpm-workspace.yaml`; decide them, `true` for `@swc/core` and `esbuild` and `false` for `es5-ext`, because the platform build stops on a placeholder and `phoenix deploy` refuses one. [CLI and setup documentation](../features/index.md#cli-access-and-deployment) owns flags and installation details.\n\n## Identity and authentication\n\nA workspace contains projects, and a project has target environments and deployments. Confirm ambiguous identity before mutations or deploys. `phoenix login` authorizes the CLI across currently permitted Builder projects. `phoenix dev` and `phoenix deploy` work in the project that `--project <slug>` names, else the one `project` in `spec/application.yaml` names; the starter spec names none. With neither, a run without a terminal uses the only project the sign-in can reach and prints the `project: <slug>` line to add, so add it; when it can reach several, the command stops and lists them, and the client chooses the slug to set as `project` or to pass as `--project`. `project: default` no longer names a project: replace it with a slug from the list. `phoenix whoami` shows current access. The legacy `phoenix login <workspace>` form keeps workspace-bound credentials. For CI deploys, a superadmin creates a deploy-only token in Studio for one project they manage, or a workspace superadmin for the whole workspace, and supplies `PHOENIX_API_TOKEN` through the process environment. It overrides saved login only for deploy and whoami; never print it, write it into project files, or load it from dotenv. The token belongs to that project or workspace, not to the person who created it, and keeps deploying after that person leaves, until someone who manages the scope revokes it. Consult [project and authentication documentation](../features/index.md#cli-access-and-deployment) for local versus remote setup.\n\n## Project structure\n\n- `spec/` — domain, relations, expressions, invariants, components and application YAML.\n- `src/expressions/`, `actions/`, `invariants/`, `transformers/` — typed implementations of domain behavior and consistency rules.\n- `src/components/`, `elements/`, `handlers/` — runtime components, custom UI and layout elements, event and lifecycle handlers. See [Custom project layout](../features/custom-layout/index.md) and [Domain controls](../features/domain-controls/index.md).\n- `src/webhooks/` — the server side. The entry is the default export of `index.ts`, the only file imported; it imports the others. Without it the SDK supplies the sign-in of the access mode alone; `access: custom` without it or a sign-in handler file reports `AUTH_WITHOUT_PROJECT_WEBHOOK`. See [Webhooks](../features/webhooks/index.md).\n- `src/migrations/` — versioned model migrations; `src/admin/` mirrors the main source structure for Admin.\n- `src/locales/` — authored PO catalogs and generated TS catalogs.\n- `src/_shared/`, `src/_utils/` and other `_`-prefixed folders — helpers and supporting modules. Phoenix skips these folders during auto-import; import their modules explicitly.\n- `public/` — static models, textures, images and fonts; `assets/` — uploadable resources such as templates and email assets.\n- `docs/` — rendered specification PDFs for the client.\n- `tools/` — reproducible project scripts, such as model conversion or rendering the specification PDFs. One-off scripts, screenshots and downloads stay in the agent's scratch space outside the project.\n- `.phoenix/` — generated files, with the project-owned exceptions below. The root `tsconfig.json` belongs to the project and extends `.phoenix/tsconfig.json`.\n\nDo not edit generated output or compiled locale TS. `.phoenix/workspace/` holds the specification sources and project records; application-spec sync, build and clean preserve it, and the generated Git ignore rules leave it available for version control. Deploy includes `.phoenix/workspace/` and `docs/` in the private deployment sources, outside application inputs and public assets. `.phoenix/variants/` option files survive rebuilds. Legacy tooling has a separate lifecycle.\n\nSync rewrites and prunes Phoenix's `phoenix` and `phoenix-*` skill folders under `.claude/skills/` and `.agents/skills/`; keep custom skills under another name. Root `AGENTS.md` and client source documents are client-owned. Components use PascalCase TSX, utilities kebab-case TS, expressions entity-name TS, migrations sequential `v*.ts` and specs kebab-case YAML. `docs/phoenix/project-structure.mdx` has the full reference; the [capability index](../features/index.md#project-and-customization) lists it.\n\n### Source conventions\n\n- Auto-imported expressions, actions, invariants, transformers, components, handlers and elements must default-export their folder's phx factory result, as one item or an array. Named exports are ignored.\n- `phx` is a global in every project: use it without importing it.\n- Keep plain helpers in underscore folders and import them explicitly.\n- Use relative imports: dev, build and webhook bundling do not resolve tsconfig `paths` aliases.\n\n## Local development\n\n`phoenix dev` runs the live preview, `sync` regenerates without bundling, `build` produces the production build, and `check` checks project quality.\n\n### Keep the preview in front of the client\n\nThe client should see the configurator change while it is built. Before the first change in a conversation, make sure `pnpm phoenix dev` is running, starting it in the background when it is not, and wait for the `Preview: <url>` line it prints and writes to `.phoenix/phoenix-dev.log`. The log keeps the lines of earlier runs, so use the last one written after the start.\n\nFor a new project, start by understanding the client’s product and what they want to configure before asking them to sign in; then make the preview reflect that before showing it, rather than presenting the generated starter scene.\n\nOpen the address where the client can see it: in the agent application's built-in browser when it has one the client sees, otherwise in the client's browser with `open '<url>'` on macOS, `xdg-open '<url>'` on Linux or `Start-Process '<url>'` in PowerShell. Keep the quotes; the shell would otherwise read a `?` in the address as a pattern. Then tell the client in one line where the preview is and that it updates by itself as the work goes on. Variant comparisons open in the same preview, so say there what to compare and how to choose.\n\nOpen it once: the preview reloads on every change. A domain model change is the exception. Dev registers the model with the server only when it starts and logs an error asking for a restart; restart it, wait for the new `Preview:` line and open that address in place of the old tab, whose `?cid=` names a configuration of the earlier model.\n\n### Logs and inspection\n\nLogs in `.phoenix/phoenix-dev.log` contain spec, build and runtime errors and watcher events; check them after changes. Signed in, `phoenix dev` runs in agent mode: the preview hides the editor, a corner badge shows when the latest change didn't build, and any dev error shows an \"Agent at work\" screen with no details, so the client never sees them. The details are only in the log; the page recovers by itself after the next successful rebuild. `--editor` shows the editor and the detailed error pages. [Inspection tools](../features/inspection.md) cover assets, state, data, scene and screenshots. Runtime inspection needs dev running and the preview open in a browser; a screenshot of the canvas does not verify the surrounding interface.\n\n## Deployment\n\n`pnpm phoenix deploy` builds the project on the server into a hosted preview (not the local preview of `phoenix dev`) and waits until it is live. Without `--env` it uses `preview`, created when missing; `--env <name>` needs an existing preview. It never deploys to production: the client promotes a checked build in Studio. Watch its output: after `Build #<n> started in <preview>` it prints `Follow the build in Studio: <url>`; open that link where the client sees it. If that line is missing, run `pnpm phoenix login` again. `Build #<n> is queued behind build #<m>` means wait: it starts after the build ahead.\n\nA successful local preview does not establish deployed model compatibility. A new project starts empty, so the model of its first deploy becomes v1. A hosted preview replaces a changed schema, but promotion is refused when the model changed under a version production serves, as is the hello-world starter that the production of some early beta projects was first deployed as; [Model migration](../processes/model-migration.md) handles that. `pnpm phoenix deploy` and `pnpm phoenix dev` are both refused while the project is being set up (its first minute) or after its setup failed: wait a minute and retry, or ask the client to choose **Retry setup** on the project's overview in Studio. When the build fails, tell the client why and what next. Record each deploy and its outcome in the project record. [Deployment documentation](../features/index.md#cli-access-and-deployment) covers status and environment details.\n\n## Internal beta\n\nPhoenix is in an internal beta. Read [Beta](../processes/beta.md) before each deploy and when a deploy goes live; a project on the `canary` SDK build also reads it once per conversation before changing anything.\n\n## Interactive and support tools\n\n[Variants](../features/variants.md) compares frontend alternatives over the live preview and applies the choice. [Feedback](../processes/feedback/index.md) submits an approved issue or evaluation. The [workflow](workflow.md) owns when either is useful and how much client interaction fits the task."]});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{createPhoenixIndexGuide as e}from"../../guide.js";import{generatePhoenixFinalizationActionsFeature as o}from"./finalization-actions.js";import{generatePhoenixMessagesFeature as t}from"./messages.js";import{generatePhoenixProjectPagesFeature as s}from"./pages.js";import{generatePhoenixSceneAndSafeAreaFeature as a}from"./scene-and-safe-area.js";import{
|
|
1
|
+
import{createPhoenixIndexGuide as e}from"../../guide.js";import{generatePhoenixFinalizationActionsFeature as o}from"./finalization-actions.js";import{generatePhoenixMessagesFeature as t}from"./messages.js";import{generatePhoenixProjectPagesFeature as s}from"./pages.js";import{generatePhoenixSceneAndSafeAreaFeature as a}from"./scene-and-safe-area.js";import{generatePhoenixSignInFeature as n}from"./sign-in.js";import{generatePhoenixLayoutSlotsFeature as r}from"./slots.js";import{generatePhoenixTabsAndStepsFeature as i}from"./tabs-and-steps.js";import{generatePhoenixToolbarActionsFeature as d}from"./toolbar-actions.js";import{generatePhoenixViewModeFeature as l}from"./view-mode.js";let m=`A layout element registered as \`ConfiguratorLayout\` replaces everything Phoenix renders for a loaded configuration, in owner and in read mode, finalization included. It shows only what it composes.
|
|
2
2
|
|
|
3
3
|
- YAML keeps the domain and the structure the layout reads: control components, in-scene anchors, tabs, steps, toolbar entries and finalize actions. The layout reads them through \`phx.frontend\` hooks, or mounts a built-in slot that reads them.
|
|
4
4
|
- The spec does not describe the page: the layout draws its own panels and renders the project's control elements in them.
|
|
5
5
|
- Start every layout from the skeleton in [Scene and safe area](scene-and-safe-area.md). Before adding a feature, read its guide below and use its spec and hook contracts. In particular, custom tabs and steps use [Tabs and steps](tabs-and-steps.md), not a parallel React navigation state.
|
|
6
6
|
- Each feature is either a built-in slot ([Layout slots](slots.md)) or the layout's own UI over hooks, which the other guides cover. No hook enforces read mode, so [View mode](view-mode.md) applies to all of them.
|
|
7
|
-
- The controls inside the layout's panels and on the product, their YAML components and React elements, belong to [Domain controls](../domain-controls/index.md); use [Scene controls](../domain-controls/scene-controls.md) for actions placed at positions on the product.`;export const generatePhoenixCustomLayoutGuides=()=>{let
|
|
7
|
+
- The controls inside the layout's panels and on the product, their YAML components and React elements, belong to [Domain controls](../domain-controls/index.md); use [Scene controls](../domain-controls/scene-controls.md) for actions placed at positions on the product.`;export const generatePhoenixCustomLayoutGuides=()=>{let c=[a(),r(),i(),d(),t(),o(),l(),s(),n()];return[e({path:"features/custom-layout/index.md",title:"Custom project layout",summary:"The project's page-level UI: the `ConfiguratorLayout` element with its canvas, built-in slots, tabs and steps, toolbar, messages, finalization and read mode, the preset screen, loader and error pages; read when creating or changing a project layout or one of these pages.",intro:m,guides:c,notes:[]}),...c]};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{createPhoenixFeatureGuide as e}from"../../guide.js";let n=`A toolbar that offers sign-in to visitors and names the dealer signed in:
|
|
2
|
+
|
|
3
|
+
\`\`\`tsx
|
|
4
|
+
// src/elements/Toolbar.tsx
|
|
5
|
+
import { AccountControl } from '@salsita-ai/sdk/extras/cognito'
|
|
6
|
+
|
|
7
|
+
const Toolbar = () => {
|
|
8
|
+
const { person } = phx.frontend.useSignIn()
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<header style={{ display: 'flex', justifyContent: 'space-between', padding: 8 }}>
|
|
12
|
+
<span>{person ? 'Dealer prices' : 'Retail prices'}</span>
|
|
13
|
+
<AccountControl />
|
|
14
|
+
</header>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default phx.frontend.createCustomPhoenixLayoutElement('Toolbar', Toolbar)
|
|
19
|
+
\`\`\``;export const generatePhoenixSignInFeature=()=>e({path:"features/custom-layout/sign-in.md",title:"Sign-in pages and account control",summary:"The Studio-account sign-in in the browser: the built-in sign-in and access-denied pages, the account control of Public with sign-in, and `useSignIn` for a project's own; read when people sign in to the configurator or its admin.",whenToUse:"Read when the configurator or its admin signs people in with Studio accounts, when visitors should be able to sign in, or when a sign-in or access-denied page should carry the brand.",capabilities:"This guide applies in the Studio-account access modes, `invited`, `public-with-sign-in` and `public` ([Authentication](../webhooks/authentication.md)).\n\n### Built-in pages\n\n- Generated code registers them by itself: the configurator's sign-in page in `invited` and `public-with-sign-in`, the admin's in all three. The spec's `pageTitle` names the project on them.\n- Sign-in is a redirect to Studio's form, never a password field on the configurator's address. The page leaves straight away and shows its button after a sign-out, after a sign-in that did not finish, and when the sign-in is unavailable right now. In Studio's frame the pages and the control render nothing.\n- A refused account sees the access-denied page with \"Sign in with another account\", and with the account when the person is a member of the project's workspace; anyone else is refused without being named. It is refused when it is not invited, or when the project's signed-in handler returned `{ allow: false }`. The admin's tells a person without the Admin role so and offers the configurator.\n- Replace a page by default-exporting a registration from `src/elements/`:\n - `phx.frontend.createAccessDeniedPage(({ projectName }) => …)` — the configurator's access-denied page.\n - `phx.frontend.admin.createAccessDeniedAdminPage(({ projectName }) => …)` — the admin's, from `src/admin/elements/`.\n - `phx.frontend.createNotAuthenticatedPage(Component)` — the configurator's whole sign-in page ([Project pages](pages.md)).\n\n### Account control\n\n- In `public-with-sign-in` visitors use the configurator and sign in only by choice, so place `<AccountControl />` from `@salsita-ai/sdk/extras/cognito` in the layout, such as in its toolbar. Without it, or a control built on `useSignIn`, parsing reports `SIGN_IN_CONTROL_NOT_PLACED`.\n- A visitor sees Sign in. A signed-in person sees their name, or their email when their Studio account has no name, with a menu holding the email and Sign out. Sign out ends this configurator's sign-in, and the person continues as a visitor.\n- A sign-in that did not finish, or a refused account, leaves the person a visitor, and the control says so under its button. To show that note in the page instead, place `<SignInNotice />` and set `<AccountControl notice={false} />`.\n- A visitor who signs in comes back to the same configuration: signing in saves its latest change first.\n\n### useSignIn\n\n`phx.frontend.useSignIn()` returns `{ state, person, refusedAccount, failure, signedOut, hidden, signIn, signOut }`:\n\n- `state` — `idle`, `signing-in`, `refused` or `failed`.\n- `person` — `{ email, name }` of the person signed in, `null` for a visitor; `name` is `null` when the account has none.\n- `refusedAccount` — with `refused`, the account the server named, `null` when it named none.\n- `failure` — with `failed`, `{ reason, message }`: `not-completed` when the person came back without being signed in, `unavailable` when trying again may help.\n- `signedOut` — the person signed out here; a sign-in page waits for a click.\n- `hidden` — render nothing: Studio's frame, or no server.\n- `signIn()` — saves the latest change and leaves for the form; after a sign-out or a refusal the form asks which account continues. `signIn({ anotherAccount: true })` asks it too while the person is signed in, for a \"Sign in with another account\" button. `signOut()` ends the sign-in.",example:n,documentation:"Read with `pnpm phoenix docs -r <path>`:\n\n- `docs/phoenix/sessions-and-access.mdx` — sessions, roles and the Studio-account sign-in.",phxMembers:["frontend.useSignIn","frontend.createAccessDeniedPage"]});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type PhoenixGuide } from '../../guide.js';
|
|
2
|
-
/**
|
|
2
|
+
/** Access modes and the handler files that customise their sign-in: what each allows and what a handler returns. */
|
|
3
3
|
export declare const generatePhoenixWebhookAuthenticationFeature: () => PhoenixGuide;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{createPhoenixFeatureGuide as e}from"../../guide.js";let s=`Dealers arrive from a portal with a code; everyone else browses with retail prices:
|
|
1
|
+
import{createPhoenixFeatureGuide as e}from"../../guide.js";let s=`Dealers arrive from a portal with a code and read dealer prices; everyone else browses with retail prices:
|
|
2
2
|
|
|
3
3
|
\`\`\`yaml
|
|
4
4
|
# spec/session.yaml
|
|
5
|
-
|
|
5
|
+
access: custom
|
|
6
6
|
sessionData:
|
|
7
7
|
type: object
|
|
8
8
|
properties:
|
|
@@ -15,28 +15,34 @@ sessionData:
|
|
|
15
15
|
\`\`\`
|
|
16
16
|
|
|
17
17
|
\`\`\`ts
|
|
18
|
-
// src/
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
headers: { authorization: \`Bearer \${accessToken}\` },
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
if (!response.ok) {
|
|
26
|
-
logger.warn(\`The CRM refused the dealer token with status \${response.status}.\`)
|
|
27
|
-
|
|
28
|
-
return { success: false }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const dealer: { readonly id: string } = await response.json()
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
success: true,
|
|
35
|
-
role: 'user',
|
|
36
|
-
data: { customerGroup: 'dealer' },
|
|
37
|
-
userId: dealer.id,
|
|
38
|
-
}
|
|
18
|
+
// src/handlers/dealer-sign-in.ts
|
|
19
|
+
export default phx.access.createCodeHandler(async ({ accessToken }) => {
|
|
20
|
+
const response = await fetch(\`\${phx.webhooksEnv.CRM_API_URL}/dealers/me\`, {
|
|
21
|
+
headers: { authorization: \`Bearer \${accessToken}\` },
|
|
39
22
|
})
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
console.warn(\`The CRM refused the dealer token with status \${response.status}.\`)
|
|
26
|
+
|
|
27
|
+
return { success: false }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const dealer: { readonly id: string } = await response.json()
|
|
31
|
+
|
|
32
|
+
return { success: true, role: 'user', data: { customerGroup: 'dealer' }, userId: dealer.id }
|
|
33
|
+
})
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
\`\`\`ts
|
|
37
|
+
// src/handlers/retail-visitors.ts
|
|
38
|
+
export default phx.access.createAnonymousHandler(async () => ({
|
|
39
|
+
success: true,
|
|
40
|
+
role: 'anonymous',
|
|
41
|
+
data: { customerGroup: 'retail' },
|
|
42
|
+
}))
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
\`\`\`ts
|
|
46
|
+
// src/handlers/chunk-scopes.ts
|
|
47
|
+
export default phx.access.createChunkScopesHandler(({ data }) => (data.customerGroup === 'dealer' ? ['dealer'] : []))
|
|
48
|
+
\`\`\``;export const generatePhoenixWebhookAuthenticationFeature=()=>e({path:"features/webhooks/authentication.md",title:"Authentication",summary:"Access modes and the `phx.access` handler files: who signs in, chunk scopes, visitors, Studio-account sign-ins, a project's own code, refresh and anonymous sign-in, roles and session data; read when the configurator signs users in or treats some of them differently.",whenToUse:"Read when configurator users sign in, arrive from a host application, need different roles or prices, or when anonymous access must be refused.",capabilities:"### Choosing the mode\n\n- `access` in `spec/application.yaml` says who can open the configurator and who signs its users in; only `custom` needs sign-in code of its own:\n - `public` — the default; everyone opens it as a visitor.\n - `invited` — only people invited to the project open it, signed in with a Studio account.\n - `public-with-sign-in` — visitors open it, and invited people can sign in with a Studio account; place the account control ([Sign-in pages and account control](../custom-layout/sign-in.md)).\n - `custom` — the project's own handlers sign people in and decide every role, admin included.\n - `legacy-clerk` — the workspace's Clerk signs people in and visitors get in.\n- In `public`, `invited` and `public-with-sign-in` a Studio-account sign-in with the project's Admin or Superadmin role gets Project Admin. Project code cannot grant a role there: a visitor is always anonymous, and the server refuses a project's own code and refresh sign-in. A sign-in lasts up to 30 days and ends at the next deploy, its sessions three hours (see the Studio-account sign-in section of `docs/phoenix/webhooks.mdx`). In `invited` and `public-with-sign-in` the other `sessionData` properties are set per person in Studio ([Session fields set in Studio](session-fields.md)). These modes need Studio accounts; a Clerk workspace gets a warning and uses `legacy-clerk` or `custom`.\n- In the three Studio-account modes the session data holds the person's `id`, `emailAddress`, `fullName`, `tags` and `accessToken` undeclared; declaring one with another type fails with `COGNITO_SESSION_DATA_INCOMPATIBLE`. Visitors carry none.\n- `useAuthHook`, `useClerk` and `useCognito` are deprecated: parsing reports `ACCESS_FLAGS_DEPRECATED` with the mode they map to, or fails with `ACCESS_WITH_DEPRECATED_FLAGS` beside `access`.\n\n### Customising the sign-in with handler files\n\n- Customise the sign-in with a file in `src/handlers/` that default-exports one `phx.access` handler. Parsing finds the call (use the factory's full name) and bundles the file into the webhook only, so it may import server-only modules. Parsing fails with `ACCESS_HANDLER_DUPLICATE` for a second file of a kind, `ACCESS_HANDLER_NOT_EXPORTED` for a handler not default-exported, `ACCESS_HANDLER_NOT_ALONE` for other handlers beside it, and `ACCESS_HANDLER_NOT_ALLOWED` for a kind the mode does not allow:\n - `phx.access.createChunkScopesHandler(({ role, data }) => [...])` — every mode. It returns the published-data chunk scopes a session may read; `public` is always added. Read `docs/phoenix/publishing.mdx` before scoping chunks.\n - `phx.access.createVisitorHandler(async ({ data }) => ({ data }))` — `public` and `public-with-sign-in`. It adds session data for visitors (people not signed in) and cannot refuse one.\n - `phx.access.createSignedInHandler(async ({ user, role, data }) => ({ data: { ... } }))` — `invited` and `public-with-sign-in`. It runs at each Studio-account sign-in and refresh, about every three hours per person, and so does any outside call it makes. It receives `user` (`id`, `email`, `name` or `null`), the `role` and the session data with the Studio values:\n - `{ data }` merges over that data, property by property; one `sessionData` does not declare or that does not fit is left out with a warning in the logs.\n - `{ allow: false }` refuses the person, admins included, so also out of Project Admin: `403` with `code: 'access-refused'`.\n - A throw, any other answer, or none within ten seconds fails the sign-in with `503` and `code: 'sign-in-unavailable'`; it never lets the person in.\n - A changed `id`, `emailAddress`, `fullName`, `tags` or `accessToken` is refused, and the role cannot change.\n - `phx.access.createCodeHandler`, `phx.access.createRefreshHandler` and `phx.access.createAnonymousHandler` — `custom` only. They answer the three flows of the project's own sign-in, picked by what the browser sends:\n - **Code** — a host application's backend deposited its token and handed the configurator a one-time code; the handler receives `{ accessToken, refreshToken?, idToken? }` and decides who signs in.\n - **Refresh** — the browser holds a refresh token an earlier answer returned; the handler receives `{ refreshToken }`.\n - **Anonymous** — neither; the handler grants or refuses a session to users who are not signed in, and without it their sessions fail.\n- `custom` with neither `src/webhooks/index.ts` nor a code, refresh or anonymous handler reports `AUTH_WITHOUT_PROJECT_WEBHOOK`.\n- An auth hook assembled in `src/webhooks/` is deprecated and reports `AUTH_HOOK_DEPRECATED`; with `access` set to `public`, `invited` or `public-with-sign-in` it fails with `AUTH_HOOK_NOT_ALLOWED`. Move its handlers to handler files.\n- Under `phoenix dev` the sign-in has 15 seconds to answer.\n\n### What a sign-in handler returns\n\n- `{ success: false }` refuses the session. `{ success: true, role, data }` grants it:\n - `role` — `anonymous`, `user`, `admin` or `superadmin`. The admin roles also open Project Admin.\n - `data` — the session data, validated strictly against the spec's `sessionData` schema. The schema declares no required properties, because Admin and preset sessions carry none, so readers handle a missing field. Webhook calls read it as `data.sessionPayload`. It is readable in the browser, so it never holds a credential such as an API key.\n - `userId` — the person's stable id, which their configurations and assistant threads follow.\n - `refreshToken` — returned to the browser for the refresh flow; return one only together with a refresh handler.\n - `expirationTime` — when the session ends, as a Unix timestamp in seconds, not a duration. Leave it out unless the client needs other session lengths: the platform's session tracking assumes the three-hour default.",example:s,documentation:"Read with `pnpm phoenix docs -r <path>`:\n\n- `docs/phoenix/sessions-and-access.mdx` — sessions, roles, the session user and access to configurations.\n- `docs/phoenix/clerk-sign-in.mdx` — Clerk sign-in, its handlers and pages.\n- `docs/phoenix/integration/authentication-internal.mdx` and `authentication-external.mdx` — a host application signing its users in with a code.",phxMembers:["access.createChunkScopesHandler","access.createVisitorHandler","access.createSignedInHandler","access.createCodeHandler","access.createRefreshHandler","access.createAnonymousHandler"]});
|
|
@@ -26,13 +26,11 @@ env:
|
|
|
26
26
|
|
|
27
27
|
\`\`\`ts
|
|
28
28
|
// src/webhooks/index.ts
|
|
29
|
-
import { authHandler } from './auth.js'
|
|
30
29
|
import { fetchBackendData } from './backend-data.js'
|
|
31
30
|
import { quoteFinalization } from './finalization.js'
|
|
32
31
|
|
|
33
32
|
export default phx.webhooks.webhookBuilder
|
|
34
|
-
.withAuthHook(authHandler)
|
|
35
33
|
.withFetchBackendData(fetchBackendData)
|
|
36
34
|
.withConfiguratorFinalize(quoteFinalization)
|
|
37
35
|
.build()
|
|
38
|
-
\`\`\``;export const generatePhoenixWebhookEntryFeature=()=>e({path:"features/webhooks/entry-and-environment.md",title:"Webhook entry and environment",summary:"`src/webhooks/index.ts`, which project code runs on the server, browser-import limits and `env.webhook` variables; read when creating the webhook, adding server code or a secret, or fixing a webhook parse or build error.",whenToUse:"Read when the project needs server-side code — sign-in, backend data, finalization — or a credential, or when parsing or the build names a webhook file.",capabilities:"### The entry\n\n- The webhook is the project's server side: one bundle the platform calls for sign-in, backend data, finalization and its callback, configuration insights evaluation, Admin publishing and assistant setup. A deployed environment runs it as a cloud function; `phoenix dev` runs it on the developer's machine through the development tunnel.\n- `src/webhooks/index.ts` is the entry and default-exports `phx.webhooks.webhookBuilder` with its hooks, then `.build()`. Only that file is imported; other files in `src/webhooks/` run when it imports them. Files in `src/webhooks/` without an `index.ts` fail with `MISSING_WEBHOOK_INDEX`.\n- The builder takes `
|
|
36
|
+
\`\`\``;export const generatePhoenixWebhookEntryFeature=()=>e({path:"features/webhooks/entry-and-environment.md",title:"Webhook entry and environment",summary:"`src/webhooks/index.ts`, which project code runs on the server, browser-import limits and `env.webhook` variables; read when creating the webhook, adding server code or a secret, or fixing a webhook parse or build error.",whenToUse:"Read when the project needs server-side code — sign-in, backend data, finalization — or a credential, or when parsing or the build names a webhook file.",capabilities:"### The entry\n\n- The webhook is the project's server side: one bundle the platform calls for sign-in, backend data, finalization and its callback, configuration insights evaluation, Admin publishing and assistant setup. A deployed environment runs it as a cloud function; `phoenix dev` runs it on the developer's machine through the development tunnel.\n- `src/webhooks/index.ts` is the entry and default-exports `phx.webhooks.webhookBuilder` with its hooks, then `.build()`. Only that file is imported; other files in `src/webhooks/` run when it imports them. Files in `src/webhooks/` without an `index.ts` fail with `MISSING_WEBHOOK_INDEX`.\n- The builder takes `withFetchBackendData` ([Backend data](backend-data.md)) and `withConfiguratorFinalize` ([Finalization](finalization.md)). Register only what the project uses. The SDK adds sign-in for the access mode itself, customised by handler files ([Authentication](authentication.md)), [Admin publishing](publishing.md), and [assistant setup](../assistant/session-setup.md) when the spec configures the assistant.\n- `withConfigurationInsights(fields)` publishes explicitly selected scalar expressions for Studio. Each field supplies `id`, `label`, `description`, `expression` (such as `$price`), `version` and `type` (`number`, `category` or `boolean`); money also supplies `currency` and `taxBasis`. Use only deterministic expressions over saved entities and published catalog data. Session, frontend and live backend dependencies are unsupported. Ask the Phoenix team to enable Configuration insights for the project in System Studio before finalizing. It defaults off. Enabling it does not backfill older finalizations. The server evaluates against the deployment and catalog versions captured when finalization is accepted, outside the finalization request. Mutable development tunnels and historical finalizations without provenance cannot produce verified values. Do not expose personal data through these fields.\n- Without an entry the SDK builds a webhook with the sign-in of the access mode alone. `access: custom` without an entry or a sign-in handler file reports `AUTH_WITHOUT_PROJECT_WEBHOOK`.\n- A hook that throws answers with an error: the sign-in, the finalization or the publish fails. Its message reaches the server log, not the configurator user, so log what went wrong with the `logger` each hook receives.\n\n### Project code in the webhook\n\n- The spec's domain, expressions and invariants also run in the webhook. Action implementation modules load and execute only in the browser, including assistant custom mutations; assistant setup uses their shared schemas. Components, admin components and handlers are frontend-only by default.\n- A handler module that calls `phx.domain.createAssistantSetupHandler`, one of the `phx.domain.admin` publishing and validation factories or one of the `phx.access` factories joins the webhook automatically. The call is detected literally, so do not alias it.\n- Make `'use webhook'` the first statement of another component or handler the server needs, such as one that prepares the scene for server rendering. Leading comments may precede it.\n- An included file and every local file it imports must not import the browser SDK entry points (`admin`, `application`, `configurator`, `editor`, `react`, `ui`, `extras/clerk`, `extras/cognito`) or style, font and image files. Type-only imports are allowed. For files included by `'use webhook'` or a detected handler registration, parsing reports `WEBHOOK_UNSAFE_IMPORT` with the import chain. Action implementations load only in the browser and are not part of webhook assembly. Move logic both sides need into a module without them, and keep rendering in a frontend-only file.\n\n### Environment variables and secrets\n\n- Declare variables under `env.webhook`: `type` is `bool`, `str`, `num` or `url`, with an optional `default`, `devDefault` (the value under `phoenix dev`) and `required`. A variable that is neither required nor defaulted is `undefined` when unset. Read them as `phx.webhooksEnv.NAME`.\n- Values are fixed when the webhook is built: a changed value needs a restart of `phoenix dev` locally and a new deploy on an environment. Deployed builds take values from the environment variables a workspace or project Superadmin sets in Studio; `phoenix dev` takes them from `.env`, which is not committed.\n- Keep credentials in the webhook. Session data, backend data and the finalization result all reach the browser, and `env.frontend` values are public.\n- `budgets.webhookGzipMb` fails the build when the compressed webhook grows past it; `phoenix build --onlyWebhook` builds the webhook alone.",example:t,documentation:"Read with `pnpm phoenix docs -r <path>`:\n\n- `docs/phoenix/webhooks.mdx` — the entry, the built-in webhook and environment variables.\n- `docs/phoenix/webhook-membership.mdx` — which files join the webhook and the server-safe import rule.\n- `docs/phoenix/sdk-builder-workflow.mdx` — setting environment variables in Studio.",phxMembers:["webhooks.webhookBuilder"]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPhoenixFeatureGuide as e}from"../../guide.js";export const generatePhoenixPublishingFeature=()=>e({path:"features/webhooks/publishing.md",title:"Admin publishing",summary:"What publishing in Project Admin runs in the webhook: the `PublishRevision` tasks, mapping admin entities to published data and validating data rows and sheets; read when admin content has to reach the configurator.",whenToUse:"Read when the project has Project Admin content to publish, maps its own admin entities into published data, or validates manual or connected data before publishing.",capabilities:"### What publishing runs\n\n- Publishing in Project Admin runs the webhook's Admin finalization, which the SDK builds itself: `phx.webhooks` has no builder for it and the [entry](entry-and-environment.md) registers nothing.\n- Without published-data chunks it produces one `PublishRevision` task with the whole published data. With chunks it produces `PublishRevisionChunksStaged`, which uploads the chunks first and takes up to 100 MiB, or `PublishRevisionChunks` with the chunks inline where the platform offers no upload.\n- Presets, preset categories, recipes and swatch options are published without project code. A project maps its own admin entities with a handler.\n\n### Project handlers\n\nDefault-export each from a file in `src/handlers/`. These files join the webhook automatically, so they import only server-safe modules. Only the first handler of each kind counts.\n\n- `phx.domain.admin.createMapPublishedRevisionDataHandler(({ entities, adminEntity }) => data)` — the published data, without chunks.\n- `phx.domain.admin.createMapPublishedChunkedDataHandler(({ entities, adminEntity, connectedSheetData }) => chunks)` — per-chunk data spread over what the SDK generates; `connectedSheetData` holds the rows of connected spreadsheets during publishing.\n- `phx.domain.admin.createDataRowValidatorHandler` and `createSheetValidatorHandler` — business rules for manual and connected data, returning messages with `severity` `error` or `warning`. They run in Admin's verify dialog and again when publishing, where an `error` stops the publish and a `warning` does not. Keep them synchronous and pure.\n\n### Reaching the configurator\n\n- The configurator reads published data as `publishedData` in expressions and tasks. A session reads the `public` chunk and the scopes [authentication](authentication.md)
|
|
1
|
+
import{createPhoenixFeatureGuide as e}from"../../guide.js";export const generatePhoenixPublishingFeature=()=>e({path:"features/webhooks/publishing.md",title:"Admin publishing",summary:"What publishing in Project Admin runs in the webhook: the `PublishRevision` tasks, mapping admin entities to published data and validating data rows and sheets; read when admin content has to reach the configurator.",whenToUse:"Read when the project has Project Admin content to publish, maps its own admin entities into published data, or validates manual or connected data before publishing.",capabilities:"### What publishing runs\n\n- Publishing in Project Admin runs the webhook's Admin finalization, which the SDK builds itself: `phx.webhooks` has no builder for it and the [entry](entry-and-environment.md) registers nothing.\n- Without published-data chunks it produces one `PublishRevision` task with the whole published data. With chunks it produces `PublishRevisionChunksStaged`, which uploads the chunks first and takes up to 100 MiB, or `PublishRevisionChunks` with the chunks inline where the platform offers no upload.\n- Presets, preset categories, recipes and swatch options are published without project code. A project maps its own admin entities with a handler.\n\n### Project handlers\n\nDefault-export each from a file in `src/handlers/`. These files join the webhook automatically, so they import only server-safe modules. Only the first handler of each kind counts.\n\n- `phx.domain.admin.createMapPublishedRevisionDataHandler(({ entities, adminEntity }) => data)` — the published data, without chunks.\n- `phx.domain.admin.createMapPublishedChunkedDataHandler(({ entities, adminEntity, connectedSheetData }) => chunks)` — per-chunk data spread over what the SDK generates; `connectedSheetData` holds the rows of connected spreadsheets during publishing.\n- `phx.domain.admin.createDataRowValidatorHandler` and `createSheetValidatorHandler` — business rules for manual and connected data, returning messages with `severity` `error` or `warning`. They run in Admin's verify dialog and again when publishing, where an `error` stops the publish and a `warning` does not. Keep them synchronous and pure.\n\n### Reaching the configurator\n\n- The configurator reads published data as `publishedData` in expressions and tasks. A session reads the `public` chunk and the scopes its chunk scopes handler grants, a `phx.access.createChunkScopesHandler` file described in [authentication](authentication.md).\n- Published data belongs to the environment and outlives deploys. Check the configurator against freshly published data after a deploy that changes the published-data schema.",example:'A catalogue maps its visible custom materials into the `catalog` chunk, and a row validator rejects a material without a price before it is published. The complete handler is the "Custom Mapping Handler" of `docs/phoenix/publishing.mdx`, and the validators are under "Custom Validation Handlers" in `docs/phoenix/connected-data-sources.mdx`; both depend on the project\'s admin model and data entries, so start from them rather than a copy.',documentation:"Read with `pnpm phoenix docs -r <path>`:\n\n- `docs/phoenix/publishing.mdx` — chunks, scopes, the publish flow and the mapping handler.\n- `docs/phoenix/connected-data-sources.mdx` — connected spreadsheets and the validators.\n- `docs/phoenix/admin.mdx` — Project Admin and its model.",phxMembers:[]});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createPhoenixFeatureGuide as e}from"../../guide.js";export const generatePhoenixWebhookSessionFieldsFeature=()=>e({path:"features/webhooks/session-fields.md",title:"Session fields set in Studio",summary:"Session fields: the `sessionData` properties whose values Studio sets per person and project in `invited` and `public-with-sign-in`, their shapes, limits and diagnostics, and what a deploy that changes them does; read when people need their own prices, categories or other values.",whenToUse:"Read when signed-in people should see different prices, categories or options, or when `sessionData` changes in a project that signs people in with Studio accounts.",capabilities:"- In `invited` and `public-with-sign-in` ([Authentication](authentication.md)), every top-level `sessionData` property except the identity fields (`id`, `emailAddress`, `fullName`, `tags`, `accessToken`) is a session field: workspace and project superadmins set its value per person and project in Studio, where it is a user setting, such as a dealer's price list.\n- `setInStudio: false` keeps a property out of Studio. A signed-in handler may fill it, and in `public-with-sign-in` a visitor handler fills it for visitors; otherwise it stays empty. `setInStudio: true` is the same as leaving the marker out.\n- In `public`, `custom` and `legacy-clerk` nothing is a session field: `setInStudio: false` has no effect and `setInStudio: true` fails with `SESSION_FIELD_ACCESS_MODE`.\n- A field is one of these, with only `title`, `description` and `default` besides; Studio shows each as the control in brackets:\n - `type: string`, at most 500 characters (text);\n - `type: number` or `type: integer` (number);\n - `type: boolean` (yes or no);\n - `type: string` with an `enum` of strings (one of);\n - `type: array` with `uniqueItems: true` and `items` a string `enum` (any of).\n- Limits: 30 fields per project, 100 values per list, 500 characters per text value, 4 KB of stored values per person and project.\n- Parsing fails with `SESSION_FIELD_UNSUPPORTED` for any other shape (an object, a nullable type, a reference, extra keywords), `SESSION_FIELD_DEFAULT` for a default the field does not allow, `SESSION_FIELD_IDENTITY_KEY` for an identity field marked `setInStudio: true` and `SESSION_FIELD_LIMIT` for more than 30 fields or 100 values in a list. Studio checks the text length and the 4 KB when it saves values.\n- The stored value arrives in the session data of every Studio-account sign-in and refresh, next to the identity fields. A person with no stored value gets the `default`, or no property, so code reading one handles it missing; visitors carry none.\n- Nothing is migrated when a deploy changes a field. A stored value the field no longer allows gets the `default` instead, or is left out; an any-of value keeps the choices still allowed. Studio marks the person Needs review until a superadmin sets it again. Values of a renamed or removed field are ignored and flag nobody; a renamed field starts at its `default`, or empty, for everyone.\n- A change in Studio applies on the next request: the configurator refreshes its session once by itself and sends the request again.",example:"The guides' example project signs dealers in with its own code in `custom`, where nothing is a session field. In a project with `access: invited`, a dealer's price list is a property under `sessionData.properties` in `spec/session.yaml`: `priceList` with `title: Price list`, `type: string`, `enum: [retail, dealer]` and `default: retail`. Superadmins set it per dealer in Studio, and the configurator reads `priceList` from the session data, falling back to `retail` when it is missing. A `portalId` the signed-in handler fills says `setInStudio: false`.",documentation:'Read with `pnpm phoenix docs -r <path>`:\n\n- `docs/phoenix/sessions-and-access.mdx` — the "Session fields set in Studio" section.',phxMembers:[]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createPhoenixIndexGuide as e}from"../../guide.js";import{generatePhoenixWebhookAuthenticationFeature as t}from"./authentication.js";import{generatePhoenixWebhookBackendDataFeature as n}from"./backend-data.js";import{generatePhoenixWebhookEntryFeature as o}from"./entry-and-environment.js";import{generatePhoenixWebhookFinalizationFeature as i}from"./finalization.js";import{generatePhoenixPublishingFeature as
|
|
1
|
+
import{createPhoenixIndexGuide as e}from"../../guide.js";import{generatePhoenixWebhookAuthenticationFeature as t}from"./authentication.js";import{generatePhoenixWebhookBackendDataFeature as n}from"./backend-data.js";import{generatePhoenixWebhookEntryFeature as o}from"./entry-and-environment.js";import{generatePhoenixWebhookFinalizationFeature as i}from"./finalization.js";import{generatePhoenixPublishingFeature as r}from"./publishing.js";import{generatePhoenixWebhookSessionFieldsFeature as s}from"./session-fields.js";import{generatePhoenixTaskGuides as a}from"./tasks/index.js";export const generatePhoenixWebhooksGuides=()=>{let h=a(),d=[o(),t(),s(),n(),i(),...h.slice(0,1),r()];return[e({path:"features/webhooks/index.md",title:"Webhooks",summary:"Server-side project code: the webhook entry and environment, sign-in, backend data, finalization and its tasks and Admin publishing; read when the configurator needs the server.",intro:"The webhook is the project's server side: `src/webhooks/index.ts` and the handler modules that join it run on the platform and hold the project's credentials, which never reach the browser. The platform calls it to sign configurator users in, to fetch backend data, to finalize a configuration and return its result, to publish Admin content and to set up the assistant ([Session setup](../assistant/session-setup.md)). Start from [Webhook entry and environment](entry-and-environment.md), then read only the guide for the hook at hand.",guides:d,notes:["## The examples\n\nThe guides build one quote configurator for a `Chair` with a `label`, a `finish` and a `width`: each example is a file of that project, and the files fit together. Take the pattern, not the names."]}),...d,...h.slice(1)]};
|
|
@@ -25,7 +25,7 @@ export interface PhoenixGuide {
|
|
|
25
25
|
*/
|
|
26
26
|
export type PhxMemberName = `${PhxNamespace}.${string}`;
|
|
27
27
|
/** The namespaces of the `phx` global. */
|
|
28
|
-
export type PhxNamespace = 'frontend' | 'domain' | 'webhooks' | 'applicationTypes';
|
|
28
|
+
export type PhxNamespace = 'frontend' | 'domain' | 'access' | 'webhooks' | 'applicationTypes';
|
|
29
29
|
interface PhoenixGuideHeader {
|
|
30
30
|
readonly path: string;
|
|
31
31
|
readonly title: string;
|
package/dist/application-spec/generate-application/code/templates/skills/sdk-subpath-imports.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const sdkSubpathImportsInGuidance={"@salsita-ai/sdk/domain":["memoEval","Migration","attributeSelectionComponent","sceneEntityRemoteObjectComponent","sceneEntityObjectComponent"],"@salsita-ai/sdk/configurator":["LayoutSlots","FinalizeActions","LayoutDialog","DesktopPreview","MobilePreview","PresetPreviewLayout","PresetSnackbarsRoot","ResetUndoListener","Postprocessing","SelectionOutline","HoverOutline"],"@salsita-ai/sdk/react":["PhoenixHandlerBoundary","useResourceUrl","AttributeCardSelector","MaterialSwatchSelector","DistanceDimensionSlider","DimensionListSelector","TextValueInput","AngleDimensionSlider","ColorPickerInput","SimpleRecipePanel","DeleteEntityButton"],"@salsita-ai/sdk/ui":["PropertyContainer","SceneFab","PhxIcon","ListSelector"],"@salsita-ai/sdk/webhook":["HtmlHelpers","ResourceHelpers","PdfHelpers","EmailHelpers"]};
|
|
1
|
+
export const sdkSubpathImportsInGuidance={"@salsita-ai/sdk/domain":["memoEval","Migration","attributeSelectionComponent","sceneEntityRemoteObjectComponent","sceneEntityObjectComponent"],"@salsita-ai/sdk/configurator":["LayoutSlots","FinalizeActions","LayoutDialog","DesktopPreview","MobilePreview","PresetPreviewLayout","PresetSnackbarsRoot","ResetUndoListener","Postprocessing","SelectionOutline","HoverOutline"],"@salsita-ai/sdk/react":["PhoenixHandlerBoundary","useResourceUrl","AttributeCardSelector","MaterialSwatchSelector","DistanceDimensionSlider","DimensionListSelector","TextValueInput","AngleDimensionSlider","ColorPickerInput","SimpleRecipePanel","DeleteEntityButton"],"@salsita-ai/sdk/ui":["PropertyContainer","SceneFab","PhxIcon","ListSelector"],"@salsita-ai/sdk/webhook":["HtmlHelpers","ResourceHelpers","PdfHelpers","EmailHelpers"],"@salsita-ai/sdk/extras/cognito":["AccountControl","SignInNotice"]};
|
|
@@ -5,8 +5,8 @@ let e=e=>`webhookHandlers${e}`;export const generateApplicationSpecWebhookBuilde
|
|
|
5
5
|
oauthClientId: phx.webhooksEnv.OAUTH_PROVIDER_CLIENT_ID,
|
|
6
6
|
oauthClientSecret: phx.webhooksEnv.OAUTH_PROVIDER_CLIENT_SECRET,
|
|
7
7
|
oauthProviderBaseUrl: phx.webhooksEnv.OAUTH_PROVIDER_BASE_URL,
|
|
8
|
-
},`:"",a=o.map((t,o)=>{let i=e(o),a=t.replace(/\.tsx?$/,".js");return`import ${i} from '../${a}'`}).join("\n"),
|
|
9
|
-
.withHandlers(${
|
|
8
|
+
},`:"",a=o.map((t,o)=>{let i=e(o),a=t.replace(/\.tsx?$/,".js");return`import ${i} from '../${a}'`}).join("\n"),s=o.length>0,r=o.map((t,o)=>`{ origin: '${t}', exports: ${e(o)} }`),n=`[${r.join(", ")}]`,l=s?`
|
|
9
|
+
.withHandlers(${n})`:"";return`// Auto-generated by application-spec pipeline. Do not edit.
|
|
10
10
|
import { createDomainWebhook } from '@salsita-ai/sdk/webhook'
|
|
11
11
|
import type { DeploymentAssistant } from '@salsita-ai/sdk/contracts/assistant'
|
|
12
12
|
|
|
@@ -40,6 +40,7 @@ export const {
|
|
|
40
40
|
assistantStrictThreads: phx.webhooksEnv.ASSISTANT_STRICT_THREADS,
|
|
41
41
|
${i}
|
|
42
42
|
${t.appMetadata.useCognito?" useCognito: true,":""}
|
|
43
|
+
access: '${t.appMetadata.access}',
|
|
43
44
|
})
|
|
44
45
|
|
|
45
46
|
// @ts-ignore - Initialize the globals
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
export interface WebhookIndexOptions {
|
|
3
3
|
/** Whether the project has `src/webhooks/index.ts`; without it the entry holds the built-in webhook. */
|
|
4
4
|
readonly hasWebhookEntry: boolean;
|
|
5
|
-
readonly useCognito: boolean;
|
|
6
5
|
}
|
|
7
|
-
export declare const generateApplicationSpecWebhookIndex: ({ hasWebhookEntry
|
|
6
|
+
export declare const generateApplicationSpecWebhookIndex: ({ hasWebhookEntry }: WebhookIndexOptions) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{autoHeader as e}from"../common/file-headers.js";export const generateApplicationSpecWebhookIndex=({hasWebhookEntry:o
|
|
1
|
+
import{autoHeader as e}from"../common/file-headers.js";export const generateApplicationSpecWebhookIndex=({hasWebhookEntry:o})=>o?`${e("webhook.ts","Webhook entry point — imports builders (sets globalThis.phx.webhooks) then re-exports user handler.")}
|
|
2
2
|
export * as builders from './webhook-builders.js'
|
|
3
3
|
|
|
4
4
|
import implementation from '../src/webhooks/index.js'
|
|
@@ -7,10 +7,6 @@ export const handler = implementation
|
|
|
7
7
|
`:`${e("webhook.ts","Webhook entry point — imports builders (sets globalThis.phx.webhooks) then exports the built-in handler, because the project has no src/webhooks/index.ts.")}
|
|
8
8
|
export * as builders from './webhook-builders.js'
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
const
|
|
12
|
-
.withAnonymousHandler(async () => (${s?"{ success: false }":"{ success: true, data: {}, role: 'anonymous' }"}))
|
|
13
|
-
.build()
|
|
14
|
-
|
|
15
|
-
export const handler = phx.webhooks.webhookBuilder.withAuthHook(authHandler).build()
|
|
10
|
+
// The access mode in spec/application.yaml builds the auth hook, customised by the phx.access handlers in src/handlers/
|
|
11
|
+
export const handler = phx.webhooks.webhookBuilder.build()
|
|
16
12
|
`;
|
|
@@ -18,5 +18,7 @@ export interface WebhookMembershipSplit {
|
|
|
18
18
|
}
|
|
19
19
|
/** Splits component-like files according to their parse-computed webhook membership. */
|
|
20
20
|
export declare const splitWebhookMembership: (files: readonly CategorizedFile[]) => WebhookMembershipSplit;
|
|
21
|
-
/** Selects handlers that are named webhook registrations or explicitly pinned. */
|
|
21
|
+
/** Selects handlers that are named webhook registrations, access handlers or explicitly pinned. */
|
|
22
22
|
export declare const getWebhookHandlerFileNames: (handlers: readonly CategorizedFile[]) => readonly string[];
|
|
23
|
+
/** Selects the handlers the browser bundle imports: every handler except the access handlers, which only the webhook reads. */
|
|
24
|
+
export declare const getFrontendHandlerFileNames: (handlers: readonly CategorizedFile[]) => readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const splitWebhookMembership=e=>({webhookIncluded:e.filter(e=>"pinned"===e.webhookMembership),frontendOnly:e.filter(e=>"pinned"!==e.webhookMembership)});export const getWebhookHandlerFileNames=e=>e.filter(e=>"named-handler"===e.webhookMembership||"pinned"===e.webhookMembership).map(e=>e.file.name);
|
|
1
|
+
export const splitWebhookMembership=e=>({webhookIncluded:e.filter(e=>"pinned"===e.webhookMembership),frontendOnly:e.filter(e=>"pinned"!==e.webhookMembership)});export const getWebhookHandlerFileNames=e=>e.filter(e=>"named-handler"===e.webhookMembership||"webhook-only"===e.webhookMembership||"pinned"===e.webhookMembership).map(e=>e.file.name);export const getFrontendHandlerFileNames=e=>e.filter(e=>"webhook-only"!==e.webhookMembership).map(e=>e.file.name);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AccessMode } from '@salsita-ai/contracts/domain';
|
|
2
|
+
/**
|
|
3
|
+
* A kind of access handler: a `src/handlers/` file that default-exports one `phx.access.create…Handler` registration
|
|
4
|
+
* to customise the sign-in its access mode switches on. Parsing recognises the kind by that call, bundles the file
|
|
5
|
+
* into the webhook, and refuses a kind the project's mode does not allow. The auth handler builder applies the file,
|
|
6
|
+
* so it customises the built-in hook and a deprecated hook built with `phx.webhooks.authHandlerBuilder`; a hook
|
|
7
|
+
* written as a plain function answers on its own.
|
|
8
|
+
*/
|
|
9
|
+
export interface AccessHandlerKind {
|
|
10
|
+
/** The member path of the registration call that marks a file as this kind. */
|
|
11
|
+
readonly registration: string;
|
|
12
|
+
/** The kind's name in diagnostics. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** The access modes in which the kind applies. */
|
|
15
|
+
readonly modes: readonly AccessMode[];
|
|
16
|
+
}
|
|
17
|
+
/** Every access handler kind; the order is the order diagnostics list them in. */
|
|
18
|
+
export declare const ACCESS_HANDLER_KINDS: readonly AccessHandlerKind[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AccessMode as e}from"@salsita-ai/contracts/domain";export const ACCESS_HANDLER_KINDS=[{registration:"phx.access.createChunkScopesHandler",name:"chunk scopes handler",modes:Object.values(e)},{registration:"phx.access.createVisitorHandler",name:"visitor handler",modes:[e.Public,e.PublicWithSignIn]},{registration:"phx.access.createSignedInHandler",name:"signed-in handler",modes:[e.Invited,e.PublicWithSignIn]},{registration:"phx.access.createCodeHandler",name:"code handler",modes:[e.Custom]},{registration:"phx.access.createRefreshHandler",name:"refresh handler",modes:[e.Custom]},{registration:"phx.access.createAnonymousHandler",name:"anonymous handler",modes:[e.Custom]}];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A project code file as the access checks see it: its name and the calls its module analysis found. */
|
|
2
|
+
export interface AnalyzedFile {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly calledMemberPaths: readonly string[];
|
|
5
|
+
/** The calls the file's default export evaluates to. */
|
|
6
|
+
readonly defaultExportedCalls: readonly string[];
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AccessMode } from '@salsita-ai/contracts/domain';
|
|
2
|
+
import type { ParseContext } from '../../core/index.js';
|
|
3
|
+
import type { AnalyzedFile } from './analyzed-file.js';
|
|
4
|
+
interface CheckAccessHandlerFilesProps {
|
|
5
|
+
/** The project's `src/handlers/` files. */
|
|
6
|
+
readonly handlers: readonly AnalyzedFile[];
|
|
7
|
+
/** The project's resolved access mode. */
|
|
8
|
+
readonly access: AccessMode;
|
|
9
|
+
}
|
|
10
|
+
/** Whether a `src/handlers/` file registers a handler of a kind only `custom` allows: its own sign-in. */
|
|
11
|
+
export declare const registersCustomSignIn: (file: AnalyzedFile) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks the project's access handler files against its access mode: a kind the mode does not allow fails, and so
|
|
14
|
+
* does a kind registered by more than one file, because the runtime applies only one, and a registration the file
|
|
15
|
+
* does not default-export, because the runtime never sees it, and a file that default-exports other handlers beside
|
|
16
|
+
* it, because such a file stays out of the browser. Runs on the parse-time module
|
|
17
|
+
* analysis, so `phoenix dev`, deploy and the editor report the same diagnostics.
|
|
18
|
+
*/
|
|
19
|
+
export declare const checkAccessHandlerFiles: (props: CheckAccessHandlerFilesProps, ctx: ParseContext) => void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AccessMode as e}from"@salsita-ai/contracts/domain";import{DiagnosticCode as r,diagnosticMessages as t}from"../../errors/index.js";import{UNRESOLVED_EXPORT as o}from"../categorize/module-analysis.js";import{ACCESS_HANDLER_KINDS as l}from"./access-handler-kinds.js";let s=(e,r)=>e.calledMemberPaths.includes(r.registration);export const registersCustomSignIn=r=>l.some(t=>t.modes.every(r=>r===e.Custom)&&s(r,t));export const checkAccessHandlerFiles=(e,a)=>{let{handlers:n,access:i}=e;for(let e of l){let E=n.filter(r=>s(r,e)).map(e=>e.name);if(0!==E.length){for(let o of n.filter(r=>s(r,e)&&!r.defaultExportedCalls.includes(e.registration)))a.error(r.ACCESS_HANDLER_NOT_EXPORTED,t.ACCESS_HANDLER_NOT_EXPORTED(o.name,e.name,e.registration));for(let s of n.filter(r=>r.defaultExportedCalls.includes(e.registration))){let n=[...new Set(s.defaultExportedCalls.filter(e=>!l.some(r=>r.registration===e)).map(e=>e===o?"a value parsing cannot resolve to a handler call":e))];n.length>0&&a.error(r.ACCESS_HANDLER_NOT_ALONE,t.ACCESS_HANDLER_NOT_ALONE(s.name,e.name,n))}if(!e.modes.includes(i)){for(let o of E)a.error(r.ACCESS_HANDLER_NOT_ALLOWED,t.ACCESS_HANDLER_NOT_ALLOWED(o,e.name,i,e.modes));continue}E.length>1&&a.error(r.ACCESS_HANDLER_DUPLICATE,t.ACCESS_HANDLER_DUPLICATE(e.name,E))}}};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AccessMode } from '@salsita-ai/contracts/domain';
|
|
2
|
+
import type { ParseContext } from '../../core/index.js';
|
|
3
|
+
import type { AnalyzedFile } from './analyzed-file.js';
|
|
4
|
+
interface CheckAuthHookFilesProps {
|
|
5
|
+
/** The project's `src/webhooks/` files. */
|
|
6
|
+
readonly webhooks: readonly AnalyzedFile[];
|
|
7
|
+
/** The project's resolved access mode. */
|
|
8
|
+
readonly access: AccessMode;
|
|
9
|
+
/** Whether the spec declared `access`, rather than the deprecated flags that map to it. */
|
|
10
|
+
readonly accessDeclared: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Checks the project's webhook files for an auth hook of its own. The access mode builds the hook, so a spec that
|
|
14
|
+
* declares a Studio-account mode cannot register one; anywhere else the hook keeps working, deprecated.
|
|
15
|
+
*/
|
|
16
|
+
export declare const checkAuthHookFiles: (props: CheckAuthHookFilesProps, ctx: ParseContext) => void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isStudioAccountMode as o}from"@salsita-ai/contracts/domain";import{DiagnosticCode as e,diagnosticMessages as r}from"../../errors/index.js";let t=o=>o.startsWith("phx.webhooks.authHandlerBuilder.")||"phx.webhooks.webhookBuilder.withAuthHook"===o;export const checkAuthHookFiles=(a,i)=>{let{webhooks:s,access:h,accessDeclared:O}=a;for(let a of s.filter(o=>o.calledMemberPaths.some(t)).map(o=>o.name))O&&o(h)?i.error(e.AUTH_HOOK_NOT_ALLOWED,r.AUTH_HOOK_NOT_ALLOWED(a,h)):i.warning(e.AUTH_HOOK_DEPRECATED,r.AUTH_HOOK_DEPRECATED(a))};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ACCESS_HANDLER_KINDS, type AccessHandlerKind } from './access-handler-kinds.js';
|
|
2
|
+
export { type AnalyzedFile } from './analyzed-file.js';
|
|
3
|
+
export { checkAccessHandlerFiles, registersCustomSignIn } from './check-access-handler-files.js';
|
|
4
|
+
export { checkAuthHookFiles } from './check-auth-hook-files.js';
|
|
5
|
+
export { placesSignInControl } from './sign-in-control.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ACCESS_HANDLER_KINDS}from"./access-handler-kinds.js";export{checkAccessHandlerFiles,registersCustomSignIn}from"./check-access-handler-files.js";export{checkAuthHookFiles}from"./check-auth-hook-files.js";export{placesSignInControl}from"./sign-in-control.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CategorizedFiles } from '../categorize/categorize-files.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether any authored file places a way to sign in: imports the SDK's `AccountControl`, or calls `useSignIn` for a
|
|
4
|
+
* control of its own, on whichever interface the project reaches it through (`phx.frontend`, `configuratorInterface`).
|
|
5
|
+
* Read from each categorized file's module analysis; an import under a local alias counts.
|
|
6
|
+
*/
|
|
7
|
+
export declare const placesSignInControl: (categorizedFiles: CategorizedFiles) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const placesSignInControl=e=>[...e.elements,...e.components,...e.handlers,...e.adminElements,...e.adminComponents,...e.projectFiles,...e.customCode].some(e=>e.analysis?.namedImports.some(e=>"@salsita-ai/sdk/extras/cognito"===e.specifier&&"AccountControl"===e.name)===!0||e.analysis?.calledMemberPaths.some(e=>e.endsWith(".useSignIn"))===!0);
|
|
@@ -15,7 +15,8 @@ export type FileCategory = 'spec' | 'expressions' | 'actions' | 'handlers' | 'el
|
|
|
15
15
|
* `analysis` — syntax-level module analysis (imports, called member paths, directive), present
|
|
16
16
|
* for code files when the parse ran with an injected {@link ModuleAnalyzer}.
|
|
17
17
|
* `webhookMembership` — the explicit webhook classification, derived from `analysis` for the
|
|
18
|
-
* categories that participate in membership (components, admin components, handlers)
|
|
18
|
+
* categories that participate in membership (components, admin components, handlers);
|
|
19
|
+
* see {@link WebhookMembership}.
|
|
19
20
|
*/
|
|
20
21
|
export type CategorizedFile = Branded<'CategorizedFile', {
|
|
21
22
|
readonly file: TextFile;
|