@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.
Files changed (240) hide show
  1. package/dist/admin/common/admin-interface.d.ts +11 -1
  2. package/dist/admin/common/admin-interface.js +1 -1
  3. package/dist/admin/ui/layout/UserProfile.d.ts +1 -1
  4. package/dist/admin/ui/layout/UserProfile.js +1 -1
  5. package/dist/admin/ui/maintenance/ImportPresets.js +1 -1
  6. package/dist/application/mount-application.js +1 -1
  7. package/dist/application/mount-configurator.js +1 -1
  8. package/dist/application/studio-embedding.d.ts +6 -0
  9. package/dist/application/studio-embedding.js +1 -0
  10. package/dist/application-spec/core/enhanced-json-schema.d.ts +5 -6
  11. package/dist/application-spec/core/enhanced-json-schema.js +1 -1
  12. package/dist/application-spec/core/markers/index.d.ts +1 -0
  13. package/dist/application-spec/core/markers/index.js +1 -1
  14. package/dist/application-spec/core/markers/set-in-studio-marker.d.ts +15 -0
  15. package/dist/application-spec/core/markers/set-in-studio-marker.js +1 -0
  16. package/dist/application-spec/errors/diagnostic-codes.d.ts +14 -0
  17. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  18. package/dist/application-spec/errors/diagnostic-messages.d.ts +14 -0
  19. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  20. package/dist/application-spec/generate-application/code/domain-runtime-files.d.ts +3 -3
  21. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  22. package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +0 -12
  23. package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
  24. package/dist/application-spec/generate-application/code/templates/admin-config.d.ts +5 -1
  25. package/dist/application-spec/generate-application/code/templates/admin-config.js +4 -4
  26. package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -6
  27. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.d.ts +1 -1
  28. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +19 -0
  29. package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
  30. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +12 -12
  31. package/dist/application-spec/generate-application/code/templates/globals.js +21 -12
  32. package/dist/application-spec/generate-application/code/templates/sign-in-page-options.d.ts +5 -0
  33. package/dist/application-spec/generate-application/code/templates/sign-in-page-options.js +1 -0
  34. package/dist/application-spec/generate-application/code/templates/skills/core/cli.js +1 -1
  35. package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/custom-layout.js +2 -2
  36. package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.d.ts +3 -0
  37. package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.js +19 -0
  38. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.d.ts +1 -1
  39. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.js +32 -26
  40. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.js +1 -3
  41. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.js +1 -1
  42. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.d.ts +3 -0
  43. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.js +1 -0
  44. package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/webhooks.js +1 -1
  45. package/dist/application-spec/generate-application/code/templates/skills/guide.d.ts +1 -1
  46. package/dist/application-spec/generate-application/code/templates/skills/sdk-subpath-imports.js +1 -1
  47. package/dist/application-spec/generate-application/code/templates/webhook-builders.js +3 -2
  48. package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +1 -2
  49. package/dist/application-spec/generate-application/code/templates/webhook-index.js +3 -7
  50. package/dist/application-spec/generate-application/code/webhook-safe-files.d.ts +3 -1
  51. package/dist/application-spec/generate-application/code/webhook-safe-files.js +1 -1
  52. package/dist/application-spec/parse-application-files/access/access-handler-kinds.d.ts +18 -0
  53. package/dist/application-spec/parse-application-files/access/access-handler-kinds.js +1 -0
  54. package/dist/application-spec/parse-application-files/access/analyzed-file.d.ts +7 -0
  55. package/dist/application-spec/parse-application-files/access/analyzed-file.js +1 -0
  56. package/dist/application-spec/parse-application-files/access/check-access-handler-files.d.ts +20 -0
  57. package/dist/application-spec/parse-application-files/access/check-access-handler-files.js +1 -0
  58. package/dist/application-spec/parse-application-files/access/check-auth-hook-files.d.ts +17 -0
  59. package/dist/application-spec/parse-application-files/access/check-auth-hook-files.js +1 -0
  60. package/dist/application-spec/parse-application-files/access/index.d.ts +5 -0
  61. package/dist/application-spec/parse-application-files/access/index.js +1 -0
  62. package/dist/application-spec/parse-application-files/access/sign-in-control.d.ts +7 -0
  63. package/dist/application-spec/parse-application-files/access/sign-in-control.js +1 -0
  64. package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +2 -1
  65. package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
  66. package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +30 -4
  67. package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
  68. package/dist/application-spec/parse-application-files/categorize/webhook-safety.js +1 -1
  69. package/dist/application-spec/parse-application-files/merge/merged-app-metadata.d.ts +14 -1
  70. package/dist/application-spec/parse-application-files/merge/merged-app-metadata.js +1 -1
  71. package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +7 -1
  72. package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
  73. package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
  74. package/dist/application-spec/parse-application-files/parse-common-admin-spec.js +1 -1
  75. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +6 -0
  76. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
  77. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +6 -0
  78. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  79. package/dist/application-spec/parse-application-files/spec/model/index.d.ts +2 -1
  80. package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
  81. package/dist/application-spec/parse-application-files/spec/model/session-data-schema.d.ts +5 -2
  82. package/dist/application-spec/parse-application-files/spec/model/session-data-schema.js +1 -1
  83. package/dist/application-spec/parse-application-files/spec/model/session-fields/index.d.ts +1 -0
  84. package/dist/application-spec/parse-application-files/spec/model/session-fields/index.js +1 -0
  85. package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.d.ts +15 -0
  86. package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.js +1 -0
  87. package/dist/application-spec/parse-application-files/spec/sections/app-metadata.js +1 -1
  88. package/dist/client/authenticated-client.d.ts +5 -1
  89. package/dist/client/authenticated-client.js +1 -1
  90. package/dist/client/authorized-client.d.ts +3 -1
  91. package/dist/client/authorized-client.js +1 -1
  92. package/dist/client/base-client.d.ts +15 -1
  93. package/dist/client/base-client.js +1 -1
  94. package/dist/client/contract.d.ts +25 -0
  95. package/dist/client/contract.js +1 -1
  96. package/dist/client/index.d.ts +1 -1
  97. package/dist/client/index.js +1 -1
  98. package/dist/client/phoenix-api.d.ts +941 -8
  99. package/dist/client/unauthenticated-client.d.ts +1 -0
  100. package/dist/client/unauthenticated-client.js +1 -1
  101. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +9 -3
  102. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  103. package/dist/configurator/common/configurator-interface.d.ts +11 -1
  104. package/dist/configurator/common/configurator-interface.js +1 -1
  105. package/dist/docs/index.json +1 -1
  106. package/dist/docs/phoenix/admin.mdx +5 -40
  107. package/dist/docs/phoenix/clerk-sign-in.mdx +9 -5
  108. package/dist/docs/phoenix/data-sources.mdx +25 -29
  109. package/dist/docs/phoenix/deployments.mdx +3 -3
  110. package/dist/docs/phoenix/finalization.mdx +0 -1
  111. package/dist/docs/phoenix/integration/authentication-external.mdx +5 -5
  112. package/dist/docs/phoenix/integration/authentication-internal.mdx +1 -1
  113. package/dist/docs/phoenix/integration/finalization-internal.mdx +1 -4
  114. package/dist/docs/phoenix/integration/integration-modes-internal.mdx +9 -0
  115. package/dist/docs/phoenix/phoenix-cli.mdx +4 -4
  116. package/dist/docs/phoenix/project-structure.mdx +13 -8
  117. package/dist/docs/phoenix/publishing.mdx +21 -28
  118. package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
  119. package/dist/docs/phoenix/sessions-and-access.mdx +169 -163
  120. package/dist/docs/phoenix/webhook-membership.mdx +3 -0
  121. package/dist/docs/phoenix/webhooks.mdx +90 -113
  122. package/dist/domain/application/access/access-handlers.d.ts +19 -0
  123. package/dist/domain/application/access/access-handlers.js +1 -0
  124. package/dist/domain/application/access/anonymous-handler.d.ts +16 -0
  125. package/dist/domain/application/access/anonymous-handler.js +1 -0
  126. package/dist/domain/application/access/chunk-scopes-handler.d.ts +27 -0
  127. package/dist/domain/application/access/chunk-scopes-handler.js +1 -0
  128. package/dist/domain/application/access/code-handler.d.ts +16 -0
  129. package/dist/domain/application/access/code-handler.js +1 -0
  130. package/dist/domain/application/access/index.d.ts +7 -0
  131. package/dist/domain/application/access/index.js +1 -0
  132. package/dist/domain/application/access/refresh-handler.d.ts +16 -0
  133. package/dist/domain/application/access/refresh-handler.js +1 -0
  134. package/dist/domain/application/access/signed-in-handler.d.ts +44 -0
  135. package/dist/domain/application/access/signed-in-handler.js +1 -0
  136. package/dist/domain/application/access/visitor-handler.d.ts +23 -0
  137. package/dist/domain/application/access/visitor-handler.js +1 -0
  138. package/dist/domain/application/application-config.d.ts +29 -0
  139. package/dist/domain/application/configurator-builder.d.ts +2 -0
  140. package/dist/domain/application/configurator-builder.js +1 -1
  141. package/dist/domain/application/index.d.ts +2 -1
  142. package/dist/domain/application/index.js +1 -1
  143. package/dist/domain/application/standard-properties.d.ts +1 -1
  144. package/dist/domain/application/standard-properties.js +1 -1
  145. package/dist/domain/core/domain-factory.d.ts +6 -0
  146. package/dist/domain/core/domain-factory.js +1 -1
  147. package/dist/domain/core/fit-session-data.d.ts +16 -0
  148. package/dist/domain/core/fit-session-data.js +1 -0
  149. package/dist/domain/domain-runtime/domain-context/actions.d.ts +4 -0
  150. package/dist/domain/domain-runtime/domain-context/actions.js +1 -1
  151. package/dist/domain/domain-runtime/domain-context/domain-context.d.ts +8 -0
  152. package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
  153. package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
  154. package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
  155. package/dist/domain/domain-runtime/domain-context/types.d.ts +8 -4
  156. package/dist/domain/domain-runtime/domain-runtime.d.ts +8 -0
  157. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +4 -0
  158. package/dist/domain/spec/sections/app-metadata.d.ts +10 -0
  159. package/dist/editor/domain-editors/use-implementation-files.js +1 -1
  160. package/dist/extras/clerk/index.d.ts +6 -0
  161. package/dist/extras/cognito/AccountAvatar.d.ts +7 -0
  162. package/dist/extras/cognito/AccountAvatar.js +1 -0
  163. package/dist/extras/cognito/AccountControl.d.ts +13 -0
  164. package/dist/extras/cognito/AccountControl.js +1 -0
  165. package/dist/extras/cognito/AdminSignInPage.d.ts +26 -0
  166. package/dist/extras/cognito/AdminSignInPage.js +1 -0
  167. package/dist/extras/cognito/CognitoSignInPage.d.ts +8 -2
  168. package/dist/extras/cognito/CognitoSignInPage.js +1 -1
  169. package/dist/extras/cognito/ConfiguratorSignInPage.d.ts +19 -0
  170. package/dist/extras/cognito/ConfiguratorSignInPage.js +1 -0
  171. package/dist/extras/cognito/SignInFailurePage.d.ts +11 -0
  172. package/dist/extras/cognito/SignInFailurePage.js +1 -0
  173. package/dist/extras/cognito/SignInGateLayout.d.ts +25 -0
  174. package/dist/extras/cognito/SignInGateLayout.js +1 -0
  175. package/dist/extras/cognito/SignInNotice.d.ts +8 -0
  176. package/dist/extras/cognito/SignInNotice.js +1 -0
  177. package/dist/extras/cognito/index.d.ts +4 -0
  178. package/dist/extras/cognito/index.js +1 -1
  179. package/dist/i18n/locales/cs/messages.js +1 -1
  180. package/dist/i18n/locales/da/messages.js +1 -1
  181. package/dist/i18n/locales/de/messages.js +1 -1
  182. package/dist/i18n/locales/de-AT/messages.js +1 -1
  183. package/dist/i18n/locales/en/messages.js +1 -1
  184. package/dist/i18n/locales/en-AU/messages.js +1 -1
  185. package/dist/i18n/locales/en-GB/messages.js +1 -1
  186. package/dist/i18n/locales/es/messages.js +1 -1
  187. package/dist/i18n/locales/fr/messages.js +1 -1
  188. package/dist/i18n/locales/hu/messages.js +1 -1
  189. package/dist/i18n/locales/it/messages.js +1 -1
  190. package/dist/i18n/locales/nl/messages.js +1 -1
  191. package/dist/i18n/locales/pl/messages.js +1 -1
  192. package/dist/i18n/locales/pt/messages.js +1 -1
  193. package/dist/i18n/locales/ro/messages.js +1 -1
  194. package/dist/i18n/locales/sk/messages.js +1 -1
  195. package/dist/i18n/locales/tr/messages.js +1 -1
  196. package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +10 -3
  197. package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
  198. package/dist/phoenix/commands/deps/deps.js +2 -2
  199. package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
  200. package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
  201. package/dist/phoenix/services/prepare-development-environment.js +2 -2
  202. package/dist/phoenix/services/variant-file-session.js +1 -1
  203. package/dist/react-sdk/application-runtime/common-services/selectors.js +1 -1
  204. package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.d.ts +6 -0
  205. package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.js +1 -1
  206. package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +2 -2
  207. package/dist/react-sdk/application-runtime/integration/integration-mode.d.ts +30 -0
  208. package/dist/react-sdk/application-runtime/integration/integration-mode.js +1 -1
  209. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +20 -6
  210. package/dist/react-sdk/application-runtime/session/actions.d.ts +2 -1
  211. package/dist/react-sdk/application-runtime/session/actions.js +1 -1
  212. package/dist/react-sdk/application-runtime/session/initialize.js +1 -1
  213. package/dist/react-sdk/application-runtime/session/selectors.d.ts +2 -0
  214. package/dist/react-sdk/application-runtime/session/selectors.js +1 -1
  215. package/dist/react-sdk/application-runtime/session/session-service.d.ts +34 -1
  216. package/dist/react-sdk/application-runtime/session/session-service.js +1 -1
  217. package/dist/react-sdk/application-runtime/session/session-token.d.ts +8 -0
  218. package/dist/react-sdk/application-runtime/session/session-token.js +1 -1
  219. package/dist/react-sdk/application-runtime/session/types.d.ts +6 -1
  220. package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
  221. package/dist/react-sdk/preset-selection/PresetSelectionProvider.js +1 -1
  222. package/dist/react-sdk/session/AccessDeniedAdminPage.d.ts +13 -0
  223. package/dist/react-sdk/session/AccessDeniedAdminPage.js +1 -0
  224. package/dist/react-sdk/session/AccessDeniedPage.d.ts +20 -0
  225. package/dist/react-sdk/session/AccessDeniedPage.js +1 -0
  226. package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
  227. package/dist/react-sdk/session/index.d.ts +3 -0
  228. package/dist/react-sdk/session/index.js +1 -1
  229. package/dist/react-sdk/session/sign-in-address.d.ts +13 -0
  230. package/dist/react-sdk/session/sign-in-address.js +1 -0
  231. package/dist/react-sdk/session/studio-frame.d.ts +7 -0
  232. package/dist/react-sdk/session/studio-frame.js +1 -0
  233. package/dist/react-sdk/session/use-sign-in.d.ts +50 -0
  234. package/dist/react-sdk/session/use-sign-in.js +1 -0
  235. package/dist/webhook/builders/auth-handler-builder.d.ts +21 -1
  236. package/dist/webhook/builders/auth-handler-builder.js +1 -1
  237. package/dist/webhook/builders/common.d.ts +9 -0
  238. package/dist/webhook/builders/webhook-builder.d.ts +13 -0
  239. package/dist/webhook/builders/webhook-builder.js +1 -1
  240. package/package.json +4 -4
@@ -28,11 +28,19 @@ When a user enters the Phoenix application, the session service begins by checki
28
28
 
29
29
  These _one-time codes_ are particularly important as they're generated server-side and correspond to data stored in Redis, including third-party access tokens from OAuth providers that shouldn't be exposed to the client.
30
30
 
31
- The authentication behavior depends on your deployment's **`useAuthHook` configuration**:
31
+ Who can open the configurator and who signs its users in is the project's **`access` setting** in `spec/application.yaml`:
32
32
 
33
- - **When webhooks are enabled** (`useAuthHook: true`) - The server retrieves cached tokens from Redis and calls your webhook handlers with this data. Handlers process authentication, determine user roles, and generate session data according to your custom logic. This enables OAuth integration and fine-grained access control.
33
+ | `access` | Configurator | Who signs configurator users in |
34
+ | --------------------- | ---------------------------------- | ------------------------------- |
35
+ | `public` (default) | Everyone opens it as a visitor | Nobody |
36
+ | `invited` | Only signed-in people open it | Studio accounts |
37
+ | `public-with-sign-in` | Visitors open it and may sign in | Studio accounts |
38
+ | `custom` | Decided by your webhook code | Your own auth handlers |
39
+ | `legacy-clerk` | Decided by the built-in Clerk flow | The workspace's Clerk |
34
40
 
35
- - **When webhooks are disabled** (`useAuthHook: false`) - The server generates anonymous session tokens directly, which works well for simple public configurators that don't require user authentication.
41
+ In every mode each session, visitors included, starts with a call to your webhook's auth handlers: the server retrieves cached tokens from Redis and calls the handlers with this data. Handlers process authentication, determine user roles, and generate session data. In `public` and `public-with-sign-in` a webhook that registers no auth handler, or an auth handler without an anonymous handler, lets visitors in. `public`, `invited` and `public-with-sign-in` work in a workspace with Studio accounts; in a workspace that signs people in with Clerk, use `legacy-clerk` or `custom`.
42
+
43
+ `useAuthHook`, `useClerk` and `useCognito` are deprecated and replaced by `access`; a spec that still sets them keeps working and parsing reports the mode it works as. A project that has auth-hook code but never switched the hook on (no flag, `useAuthHook: false`, or `useClerk: true` with `useAuthHook: false`) now runs that hook for every session. Such a spec works as `public`, where the server refuses a visitor session the hook's anonymous handler gives another role than `anonymous` and refuses its code and refresh handlers; the Clerk case works as `legacy-clerk` and needs an anonymous handler to keep admitting visitors. Deployments registered by an SDK older than `access` keep their behavior: without `useAuthHook` the server generates anonymous session tokens directly, without calling the webhook.
36
44
 
37
45
  **Configuration-specific access validation** occurs only when users navigate to a specific configuration (not on general pages like presets). The access service validates permissions by checking for an **access token** — either from the URL parameter (`ca`), from the `route` web component property, or from localStorage/sessionStorage (depending on the [integration mode](?path=/docs/phoenix-integration-integration-modes-internal--docs)). This JWT specifies whether the user can view or edit that specific configuration, and optionally locks them to a particular revision for read-only viewing.
38
46
 
@@ -83,7 +91,7 @@ Configurator and admin session tokens can carry a `sub` claim naming the user th
83
91
 
84
92
  | `sub` | When |
85
93
  | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
86
- | `clerk-<id>` | The auth handler builder's Clerk handlers signed the user in; `<id>` is the Clerk user id. |
94
+ | `clerk-<id>` | The built-in Clerk handlers signed the user in; `<id>` is the Clerk user id. |
87
95
  | `phoenix-<id>` | The shared Cognito flow resolved a Phoenix account and current project grant; `<id>` is its stable account UUID. |
88
96
  | `custom-<id>` | Any other auth handler returned `userId`; `<id>` is that value. |
89
97
  | `anonymous-<uuid>` | No auth hook, or the handler returned no `userId`; `<uuid>` is the browser's anonymous id. |
@@ -91,13 +99,51 @@ Configurator and admin session tokens can carry a `sub` claim naming the user th
91
99
 
92
100
  The browser's anonymous id is a random UUID the SDK keeps under the localStorage key `configurator-user-id` and sends with every session authentication, so one browser is one anonymous user. It is separate from the analytics `user_id`. When storage is unavailable, the id lasts for the page's lifetime.
93
101
 
94
- For shared Cognito sign-in, provider configuration, role gates and revocation, see **[Webhooks — Cognito configurator sign-in](?path=/docs/phoenix-webhooks--docs#cognito-configurator-sign-in)**.
102
+ For Studio-account sign-in, role gates and revocation, see **[Webhooks — Studio-account sign-in](?path=/docs/phoenix-webhooks--docs#studio-account-sign-in)**.
95
103
 
96
104
  A signed-in user therefore keeps the same identity across browsers, while an anonymous one is tied to the browser. A custom refresh handler must return `userId` again, or the renewed session becomes the browser's anonymous user. Return `userId` from your handlers as shown in **[Webhooks - Custom auth handlers](?path=/docs/phoenix-webhooks--docs#custom-auth-handlers)**.
97
105
 
106
+ ### Account control for Public with sign-in
107
+
108
+ In `access: public-with-sign-in` visitors use the configurator and sign in only by choice, so place the SDK's account control in your layout, such as in its toolbar. Without it, or a control of your own built on `phx.frontend.useSignIn()`, parsing warns with `SIGN_IN_CONTROL_NOT_PLACED`.
109
+
110
+ ```tsx
111
+ import { AccountControl, SignInNotice } from '@salsita-ai/sdk/extras/cognito'
112
+
113
+ // The control tells a visitor under its button when a sign-in did not finish or the account isn't invited
114
+ const Toolbar = () => <AccountControl />
115
+
116
+ // Or show that note as a banner in the page, and switch the control's own off
117
+ const ToolbarWithBanner = () => <AccountControl notice={false} />
118
+ const PageTop = () => <SignInNotice />
119
+ ```
120
+
121
+ ### Session fields set in Studio
122
+
123
+ In `access: invited` and `access: public-with-sign-in`, 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 called a user setting. A property marked `setInStudio: false` stays out of Studio; a signed-in handler may fill it, and in `public-with-sign-in` a visitor handler may fill it for visitors. In `public`, `custom` and `legacy-clerk` nothing is a session field, and `setInStudio: true` fails parsing with `SESSION_FIELD_ACCESS_MODE`.
124
+
125
+ ```yaml
126
+ # spec/session.yaml
127
+ sessionData:
128
+ type: object
129
+ properties:
130
+ priceList:
131
+ title: Price list
132
+ type: string
133
+ enum: [retail, dealer]
134
+ default: retail
135
+ portalId:
136
+ type: string
137
+ setInStudio: false # filled by the signed-in handler
138
+ ```
139
+
140
+ A session field is `type: string` (at most 500 characters), `type: number` or `type: integer`, `type: boolean`, `type: string` with a string `enum`, or `type: array` with `uniqueItems: true` and string `enum` `items`, with only `title`, `description` and `default` besides. A project has at most 30 fields and 100 values per list, and a person at most 4 KB of stored values per project. Parsing reports `SESSION_FIELD_UNSUPPORTED`, `SESSION_FIELD_DEFAULT`, `SESSION_FIELD_IDENTITY_KEY` and `SESSION_FIELD_LIMIT`.
141
+
142
+ The stored value arrives in the session data of every Studio-account sign-in and refresh, next to the identity fields; read it there like any session property. A person with no stored value gets the field's `default`, or no property. Nothing is migrated when a deployment changes a field: a stored value the build's field no longer allows gets the `default` instead, or is left out, and an any-of value keeps the choices the field still allows; Studio marks the person **Needs review**. Values of a renamed or removed field are ignored and flag nobody. When a person's values change while the configurator is open, the server refuses the next request and the configurator refreshes its session once by itself and sends it again.
143
+
98
144
  ### Studio Embedded Admin Sessions
99
145
 
100
- Studio manages embedded-admin authentication as the host application. It loads the deployed embedded module, reads every unique scope from its YAML-generated `config.chunks`, and requests both Configurator and Admin session tokens containing that complete `chunkScopes` set. This lets authenticated Studio admins manage all chunks without invoking the project's `withPublishedChunkScopes()` resolver.
146
+ Studio manages embedded-admin authentication as the host application. It loads the deployed embedded module, reads every unique scope from its YAML-generated `config.chunks`, and requests both Configurator and Admin session tokens containing that complete `chunkScopes` set. This lets authenticated Studio admins manage all chunks without invoking the project's chunk scopes handler.
101
147
 
102
148
  The session service automatically handles several key responsibilities:
103
149
 
@@ -156,9 +202,9 @@ The session service requests a session token to establish user identity, checkin
156
202
  - **Stored refresh token** for session renewal
157
203
  - **Anonymous authentication** as fallback
158
204
 
159
- ### 2. Webhook Processing (when `useAuthHook: true`)
205
+ ### 2. Webhook Processing
160
206
 
161
- For deployments with auth webhooks enabled:
207
+ In every access mode:
162
208
 
163
209
  - Server retrieves **cached tokens from Redis** and includes them in webhook payload
164
210
  - **Code handler** - Receives and processes access and ID tokens
@@ -195,114 +241,101 @@ Finally, Phoenix creates an **authorized API client** that:
195
241
 
196
242
  ## Auth Webhook Handlers
197
243
 
198
- Authentication logic is implemented through **webhook handlers** when the deployment is configured with **`useAuthHook: true`**. These handlers:
199
-
200
- - **Run in AWS Lambda** - Serverless execution environment; under `phoenix dev` they run on the developer's machine through the development webhook tunnel
201
- - **Control user roles** - Determine superadmin, admin, user, or anonymous access
202
- - **Generate session data** - Custom data attached to user sessions
203
- - **Manage token generation** - Control session and refresh token creation
244
+ Authentication runs in the webhook's **auth hook**, which every access mode calls. It:
204
245
 
205
- If **`useAuthHook` is false**, the server generates _anonymous session tokens_ directly without calling webhooks.
246
+ - **Runs in AWS Lambda** - Serverless execution environment; under `phoenix dev` it runs on the developer's machine through the development webhook tunnel
247
+ - **Controls user roles** - Determines superadmin, admin, user, or anonymous access
248
+ - **Generates session data** - Custom data attached to user sessions
249
+ - **Manages token generation** - Controls session and refresh token creation
206
250
 
207
- To enable webhook authentication, configure your `spec/application.yaml`:
251
+ The access mode in `spec/application.yaml` builds the hook, with or without `src/webhooks/index.ts`:
208
252
 
209
253
  ```yaml
210
254
  # spec/application.yaml
211
- useAuthHook: true # Enable webhook authentication
255
+ access: public # The default: visitors get in, the admin signs in with a Studio account
212
256
  # OR
213
- useClerk: true # Enables Clerk + sets useAuthHook automatically
257
+ access: invited # Only people invited to the project sign in, with Studio accounts
258
+ # OR
259
+ access: public-with-sign-in # Visitors get in, and invited people sign in with Studio accounts
260
+ # OR
261
+ access: legacy-clerk # The built-in Clerk handlers sign people in, visitors get in
262
+ # OR
263
+ access: custom # Your own handlers decide who gets in
214
264
  ```
215
265
 
216
- The webhook entry is the default export of `src/webhooks/index.ts`. The builders and their types are generated from your spec configuration into `.phoenix/webhook-builders.ts`, which sets the `phx.webhooks` global, so project code never imports builders from `.phoenix/`.
266
+ In `public`, `invited` and `public-with-sign-in` the server decides every role other than `anonymous` from the person's Studio-account grant; project code cannot sign anyone in or grant a role. Only `custom` signs people in with the project's own code.
217
267
 
218
- The auth handler builder provides a fluent API for configuring authentication methods. You can combine multiple handlers to support different authentication scenarios. The builder is accessed through the `phx.webhooks` global namespace:
219
-
220
- ```typescript
221
- // src/webhooks/index.ts
222
- const authHandler = phx.webhooks.authHandlerBuilder
223
- // Built-in Clerk integration for SSO/OAuth
224
- .withClerkCodeHandler()
225
- .withClerkRefreshHandler()
226
- // Allow anonymous access
227
- .withAnonymousHandler(async () => {
228
- return {
229
- success: true,
230
- data: {
231
- tags: [],
232
- },
233
- role: 'anonymous',
234
- }
235
- })
236
- .build()
268
+ The project customises the hook with files in `src/handlers/`, each default-exporting one `phx.access` handler, which the generated `.phoenix/` code sets as a global, so project code never imports from `.phoenix/`:
237
269
 
238
- export default phx.webhooks.webhookBuilder.withAuthHook(authHandler).build()
239
- ```
270
+ - **Chunk scopes handler** (`phx.access.createChunkScopesHandler`), every mode - the published-data chunk scopes a session may read
271
+ - **Visitor handler** (`phx.access.createVisitorHandler`), `public` and `public-with-sign-in` - session data for people who are not signed in
272
+ - **Signed-in handler** (`phx.access.createSignedInHandler`), `invited` and `public-with-sign-in` - session data for, or a refusal of, a person signed in with a Studio account, at sign-in and each refresh
273
+ - **Code handler** (`phx.access.createCodeHandler`), `custom` - processes authentication for _third-party integrations_, where the server retrieves cached tokens from Redis and passes them to your handler
274
+ - **Refresh handler** (`phx.access.createRefreshHandler`), `custom` - renews expired sessions using _refresh tokens_
275
+ - **Anonymous handler** (`phx.access.createAnonymousHandler`), `custom` - decides about visitors
240
276
 
241
- For custom third-party integrations (not SSO - use Clerk handlers for that), you can use `withCodeHandler`:
277
+ A `custom` project with a code handler and an anonymous handler:
242
278
 
243
279
  ```typescript
244
- // src/webhooks/index.ts
245
- const authHandler = phx.webhooks.authHandlerBuilder
246
- .withCodeHandler(async ({ accessToken }, { logger }) => {
247
- // The platform already redeemed the one-time code, so the payload holds
248
- // { type: 'code', accessToken, refreshToken?, idToken? } and no code.
249
- // PARTNER_API_URL is declared under `env.webhook` in a spec file
250
- const response = await fetch(`${phx.webhooksEnv.PARTNER_API_URL}/me`, {
251
- headers: { authorization: `Bearer ${accessToken}` },
252
- })
253
-
254
- if (!response.ok) {
255
- logger.warn(`The partner API refused the access token with status ${response.status}.`)
256
-
257
- return { success: false }
258
- }
259
-
260
- const userData: {
261
- readonly id: string
262
- readonly email: string
263
- readonly permissions: string[]
264
- readonly isAdmin: boolean
265
- } = await response.json()
266
-
267
- return {
268
- success: true,
269
- data: {
270
- email: userData.email,
271
- tags: userData.permissions,
272
- },
273
- role: userData.isAdmin ? 'admin' : 'user',
274
- // The session user, a top-level field rather than part of the session data
275
- userId: userData.id,
276
- // An absolute Unix timestamp in seconds; three hours from now when omitted
277
- expirationTime: Math.floor(Date.now() / 1000) + 3600,
278
- }
279
- })
280
- .withAnonymousHandler(async () => {
281
- return {
282
- success: true,
283
- data: {
284
- tags: [],
285
- },
286
- role: 'anonymous',
287
- expirationTime: Math.floor(Date.now() / 1000) + 900,
288
- }
280
+ // src/handlers/code.ts
281
+ export default phx.access.createCodeHandler(async ({ accessToken }) => {
282
+ // The platform already redeemed the one-time code, so the payload holds
283
+ // { type: 'code', accessToken, refreshToken?, idToken? } and no code.
284
+ // PARTNER_API_URL is declared under `env.webhook` in a spec file
285
+ const response = await fetch(`${phx.webhooksEnv.PARTNER_API_URL}/me`, {
286
+ headers: { authorization: `Bearer ${accessToken}` },
289
287
  })
290
- .build()
291
288
 
292
- export default phx.webhooks.webhookBuilder.withAuthHook(authHandler).build()
289
+ if (!response.ok) {
290
+ console.warn(`The partner API refused the access token with status ${response.status}.`)
291
+
292
+ return { success: false }
293
+ }
294
+
295
+ const userData: {
296
+ readonly id: string
297
+ readonly email: string
298
+ readonly permissions: string[]
299
+ readonly isAdmin: boolean
300
+ } = await response.json()
301
+
302
+ return {
303
+ success: true,
304
+ data: {
305
+ email: userData.email,
306
+ tags: userData.permissions,
307
+ },
308
+ role: userData.isAdmin ? 'admin' : 'user',
309
+ // The session user, a top-level field rather than part of the session data
310
+ userId: userData.id,
311
+ // An absolute Unix timestamp in seconds; three hours from now when omitted
312
+ expirationTime: Math.floor(Date.now() / 1000) + 3600,
313
+ }
314
+ })
293
315
  ```
294
316
 
295
- Each handler receives the authentication payload and returns session data, user role, and token metadata. A handler refuses the session with `{ success: false }`; log the reason with the `logger`, because the response carries no error message. The session data you return becomes available throughout the application and can include any custom fields declared in the spec's `sessionData` schema, which declares no required properties.
317
+ ```typescript
318
+ // src/handlers/anonymous.ts
319
+ export default phx.access.createAnonymousHandler(async () => {
320
+ return {
321
+ success: true,
322
+ data: {
323
+ tags: [],
324
+ },
325
+ role: 'anonymous',
326
+ expirationTime: Math.floor(Date.now() / 1000) + 900,
327
+ }
328
+ })
329
+ ```
296
330
 
297
- Phoenix supports several types of authentication handlers:
331
+ Each handler receives the authentication payload and returns session data, user role, and token metadata. A handler refuses the session with `{ success: false }`; log the reason, because the response carries no error message. The session data you return becomes available throughout the application and can include any custom fields declared in the spec's `sessionData` schema, which declares no required properties.
298
332
 
299
- - **Clerk handlers** (`withClerkCodeHandler`, `withClerkRefreshHandler`) - Handle _SSO and OAuth authentication_ through Clerk's identity platform, ideal for standard user authentication needs
300
- - **Custom code handlers** (`withCodeHandler`) - Process authentication for _third-party integrations_ where the server retrieves cached tokens from Redis and passes them to your handler (not meant for SSO - use Clerk handlers instead)
301
- - **Refresh handlers** (`withRefreshHandler`) - Renew expired sessions using _refresh tokens_
302
- - **Anonymous handlers** (`withAnonymousHandler`) - Provide _limited access_ without authentication
333
+ `phx.webhooks.authHandlerBuilder` and `withAuthHook` are deprecated; see [Webhooks - Auth Hook](?path=/docs/phoenix-webhooks--docs#auth-hook) for the migration.
303
334
 
304
335
  ## Clerk Integration
305
336
 
337
+ > **Legacy.** Clerk is the `legacy-clerk` mode for workspaces Salsita set up with Clerk. A workspace with Studio accounts uses `invited` or `public-with-sign-in` instead (see [Webhooks — Studio-account sign-in](?path=/docs/phoenix-webhooks--docs#studio-account-sign-in)).
338
+
306
339
  **Clerk** provides a ready-to-use authentication solution with:
307
340
 
308
341
  - **Built-in UI** - Pre-designed authentication components
@@ -319,30 +352,12 @@ To enable Clerk authentication:
319
352
 
320
353
  ```yaml
321
354
  # spec/application.yaml
322
- useClerk: true # Enables Clerk auth and sets useAuthHook automatically
355
+ access: legacy-clerk # Signs people in with the workspace's Clerk
323
356
  ```
324
357
 
325
358
  **2. Configure Clerk for the workspace in Studio.** The Clerk credentials come from the workspace's Clerk settings in Studio and reach the webhook as generated variables (`CLERK_API_KEY`, `JWT_SECRET_BASE64`, `OAUTH_PROVIDER_CLIENT_ID`, `OAUTH_PROVIDER_CLIENT_SECRET`, `OAUTH_PROVIDER_BASE_URL`, `FRONTEND_URL` and `RESOURCES_URL`). The project neither declares them nor keeps them in its `.env`. See [Clerk Sign-In](?path=/docs/phoenix-clerk-sign-in--docs).
326
359
 
327
- **3. Use Clerk handlers** in your webhook (`phx.webhooks` is set by the generated `.phoenix/webhook-builders.ts`):
328
-
329
- ```typescript
330
- // src/webhooks/index.ts
331
- const authHandler = phx.webhooks.authHandlerBuilder
332
- .withClerkSessionHandler()
333
- .withClerkCodeHandler()
334
- .withClerkRefreshHandler()
335
- .withAnonymousHandler(async () => {
336
- return {
337
- success: true,
338
- data: { tags: [] },
339
- role: 'anonymous',
340
- }
341
- })
342
- .build()
343
-
344
- export default phx.webhooks.webhookBuilder.withAuthHook(authHandler).build()
345
- ```
360
+ **3. No webhook code is needed:** with `access: legacy-clerk` the webhook's auth hook uses the built-in Clerk session, code and refresh handlers and lets visitors in.
346
361
 
347
362
  The Clerk handlers automatically:
348
363
 
@@ -352,7 +367,7 @@ The Clerk handlers automatically:
352
367
  - **Map organizations to Phoenix tags** - For permission control
353
368
  - **Handle token refresh** - Through Clerk's OAuth endpoints
354
369
 
355
- **Important**: When `useClerk` is enabled, your `sessionData` schema must declare the complete payload the Clerk handlers return — application-spec parsing rejects the spec with a `CLERK_SESSION_DATA_INCOMPATIBLE` diagnostic otherwise. Declare all five built-in properties with exactly these types, keep `required: []` so anonymous and Admin-issued sessions stay valid, and add any project-specific properties alongside them:
370
+ **Important**: With `access: legacy-clerk`, your `sessionData` schema must declare the complete payload the Clerk handlers return — application-spec parsing rejects the spec with a `CLERK_SESSION_DATA_INCOMPATIBLE` diagnostic otherwise. Declare all five built-in properties with exactly these types, keep `required: []` so anonymous and Admin-issued sessions stay valid, and add any project-specific properties alongside them:
356
371
 
357
372
  ```yaml
358
373
  sessionData:
@@ -486,67 +501,58 @@ Session tokens provide additional security through domain-specific validation of
486
501
 
487
502
  ### Simple Public Configurator (No Auth Webhook)
488
503
 
489
- For configurators that don't require user authentication, disable webhook authentication to let the server handle anonymous sessions directly.
504
+ For configurators that don't require user authentication, keep the default access mode.
490
505
 
491
506
  ```yaml
492
507
  # spec/application.yaml
493
- useAuthHook: false # Server generates anonymous tokens directly
508
+ access: public # The default: everyone opens the configurator as a visitor
494
509
  ```
495
510
 
496
- This approach is simpler to deploy and maintain when you don't need custom authentication logic. No webhook implementation is required—the server handles anonymous session generation automatically.
511
+ This approach is simpler to deploy and maintain when you don't need custom authentication logic. No webhook implementation is required: with or without `src/webhooks/index.ts` the auth hook lets every visitor in, and the admin signs in with a Studio account.
497
512
 
498
513
  ### Custom Third-Party Integrations
499
514
 
500
- Use custom code handlers for third-party integrations. The server handles Redis caching and passes retrieved tokens to your webhook. For SSO and OAuth authentication, use Clerk handlers instead.
515
+ Use `access: custom` with a code handler for third-party integrations. The server handles Redis caching and passes retrieved tokens to your handler. For SSO and OAuth authentication, use Studio accounts or Clerk instead.
501
516
 
502
517
  ```typescript
503
- // src/webhooks/index.ts
504
- const authHandler = phx.webhooks.authHandlerBuilder
505
- .withCodeHandler(async ({ accessToken }, { logger }) => {
506
- // Server already retrieved tokens from Redis and passed them here
507
-
508
- // Verify the third-party token; INTEGRATION_API_URL is declared under `env.webhook` in a spec file
509
- const response = await fetch(`${phx.webhooksEnv.INTEGRATION_API_URL}/tokens/verify`, {
510
- headers: { authorization: `Bearer ${accessToken}` },
511
- })
512
-
513
- if (!response.ok) {
514
- logger.warn(`The integration rejected the access token with status ${response.status}.`)
515
-
516
- return { success: false }
517
- }
518
-
519
- const integrationUser: {
520
- readonly id: string
521
- readonly email: string
522
- readonly permissions?: string[]
523
- readonly isAdmin: boolean
524
- } = await response.json()
525
-
526
- // Map third-party data to Phoenix session
527
- return {
528
- success: true,
529
- data: {
530
- email: integrationUser.email,
531
- tags: integrationUser.permissions ?? [],
532
- },
533
- role: integrationUser.isAdmin ? 'admin' : 'user',
534
- userId: integrationUser.id,
535
- expirationTime: Math.floor(Date.now() / 1000) + 3600,
536
- }
537
- })
538
- .withAnonymousHandler(async () => {
539
- return {
540
- success: true,
541
- data: { tags: [] },
542
- role: 'anonymous',
543
- }
518
+ // src/handlers/code.ts
519
+ export default phx.access.createCodeHandler(async ({ accessToken }) => {
520
+ // Server already retrieved tokens from Redis and passed them here
521
+
522
+ // Verify the third-party token; INTEGRATION_API_URL is declared under `env.webhook` in a spec file
523
+ const response = await fetch(`${phx.webhooksEnv.INTEGRATION_API_URL}/tokens/verify`, {
524
+ headers: { authorization: `Bearer ${accessToken}` },
544
525
  })
545
- .build()
546
526
 
547
- export default phx.webhooks.webhookBuilder.withAuthHook(authHandler).build()
527
+ if (!response.ok) {
528
+ console.warn(`The integration rejected the access token with status ${response.status}.`)
529
+
530
+ return { success: false }
531
+ }
532
+
533
+ const integrationUser: {
534
+ readonly id: string
535
+ readonly email: string
536
+ readonly permissions?: string[]
537
+ readonly isAdmin: boolean
538
+ } = await response.json()
539
+
540
+ // Map third-party data to Phoenix session
541
+ return {
542
+ success: true,
543
+ data: {
544
+ email: integrationUser.email,
545
+ tags: integrationUser.permissions ?? [],
546
+ },
547
+ role: integrationUser.isAdmin ? 'admin' : 'user',
548
+ userId: integrationUser.id,
549
+ expirationTime: Math.floor(Date.now() / 1000) + 3600,
550
+ }
551
+ })
548
552
  ```
549
553
 
554
+ Add `phx.access.createAnonymousHandler` in another file to let visitors in as well.
555
+
550
556
  ### Embedded Configurator with Pre-Authenticated Session
551
557
 
552
558
  When embedding a Phoenix configurator in an application that already handles authentication, pass session tokens directly to skip the authentication flow entirely.
@@ -594,7 +600,7 @@ Phoenix's authentication system provides the foundation for building secure, sca
594
600
  Now that you understand authentication and access control, explore these related topics:
595
601
 
596
602
  - **[Webhooks](?path=/docs/phoenix-webhooks--docs)** - Learn how to implement auth webhook handlers for custom authentication logic and integrate with third-party identity providers
597
- - **[Deployments](?path=/docs/phoenix-deployments--docs)** - Understand how to configure deployment settings including `useAuthHook` and manage different environments
603
+ - **[Deployments](?path=/docs/phoenix-deployments--docs)** - Understand how to configure deployment settings including the access mode and manage different environments
598
604
  - **[Admin](?path=/docs/phoenix-admin--docs)** - Explore the Admin application that uses separate authentication tokens for managing deployments and configurations
599
605
  - **[Domain Model](?path=/docs/phoenix-domain-model--docs)** - Define SessionData types and understand how authentication data flows through your domain model
600
606
 
@@ -11,6 +11,7 @@ Build component controls with React and browser SDKs without pulling them into t
11
11
  | Ordinary handler | Yes | No |
12
12
  | Published-data, validator or assistant setup handler | Yes | Yes |
13
13
  | Any other handler with `'use webhook'` | Yes | Yes |
14
+ | Access handler (`phx.access.create…Handler`) | No | Yes |
14
15
  | File under `src/webhooks/` | No | Yes |
15
16
 
16
17
  Published-data, validator and assistant setup handlers are detected when they register one of these APIs:
@@ -21,6 +22,8 @@ Published-data, validator and assistant setup handlers are detected when they re
21
22
  - `createSheetValidatorHandler`
22
23
  - `phx.domain.createAssistantSetupHandler` (see [Per-session Setup](?path=/docs/phoenix-assistant-per-session-setup--docs))
23
24
 
25
+ An access handler customises the sign-in, which runs only in the webhook, so its file stays out of the browser bundle, also with `'use webhook'`, and may import server-only modules. The file holds only access handlers: a file that default-exports anything else beside them fails parsing with `ACCESS_HANDLER_NOT_ALONE`. See [Webhooks](?path=/docs/phoenix-webhooks--docs).
26
+
24
27
  ## Pin a Server-Safe Component
25
28
 
26
29
  Add the directive as the first statement. License headers and other leading comments may appear before it.