@powerhousedao/connect 6.2.3-dev.66 → 6.2.3-dev.67

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 (248) hide show
  1. package/CUSTOMIZING.md +77 -0
  2. package/README.md +18 -91
  3. package/RUNTIME-CONFIG.md +472 -0
  4. package/dist/{AddDriveModal-D_3jDwjp.js → AddDriveModal-BjgmiHJr.js} +6 -6
  5. package/dist/AddDriveModal-BjgmiHJr.js.map +1 -0
  6. package/dist/{ClearStorageModal-zZ8XzwmR.js → ClearStorageModal-_03VgDb5.js} +6 -6
  7. package/dist/ClearStorageModal-_03VgDb5.js.map +1 -0
  8. package/dist/{ConfirmDocumentUpgradeModal-CrU2Z1CL.js → ConfirmDocumentUpgradeModal-CoixS60F.js} +5 -5
  9. package/dist/ConfirmDocumentUpgradeModal-CoixS60F.js.map +1 -0
  10. package/dist/{CookiesPolicyModal-DQwsgDI9.js → CookiesPolicyModal-BpFjYc7T.js} +4 -4
  11. package/dist/{CookiesPolicyModal-DQwsgDI9.js.map → CookiesPolicyModal-BpFjYc7T.js.map} +1 -1
  12. package/dist/{CreateDocumentModal-Cf1APibL.js → CreateDocumentModal-B-cXzeOA.js} +10 -10
  13. package/dist/CreateDocumentModal-B-cXzeOA.js.map +1 -0
  14. package/dist/{DebugSettingsModal-DIc5C2lI.js → DebugSettingsModal-CGScJ_r2.js} +8 -8
  15. package/dist/DebugSettingsModal-CGScJ_r2.js.map +1 -0
  16. package/dist/{DeleteDriveModal-lE9eCBua.js → DeleteDriveModal-1pAIayG_.js} +5 -5
  17. package/dist/DeleteDriveModal-1pAIayG_.js.map +1 -0
  18. package/dist/{DeleteItemModal-BFgcGsm3.js → DeleteItemModal-BUpqmFxS.js} +5 -5
  19. package/dist/DeleteItemModal-BUpqmFxS.js.map +1 -0
  20. package/dist/{DisclaimerModal-CF6JkIIu.js → DisclaimerModal-TIJXRYLF.js} +5 -5
  21. package/dist/DisclaimerModal-TIJXRYLF.js.map +1 -0
  22. package/dist/{DocumentVersionUnsupportedModal-Cm9Jb9W7.js → DocumentVersionUnsupportedModal-DH9Zzsyw.js} +5 -5
  23. package/dist/DocumentVersionUnsupportedModal-DH9Zzsyw.js.map +1 -0
  24. package/dist/{DownloadDocumentWithErrorsModal-CShKhfEQ.js → DownloadDocumentWithErrorsModal-Beh-xw8B.js} +5 -5
  25. package/dist/DownloadDocumentWithErrorsModal-Beh-xw8B.js.map +1 -0
  26. package/dist/{DriveAuthRequiredModal-CMwPUyZf.js → DriveAuthRequiredModal-XTcoJKvj.js} +6 -6
  27. package/dist/DriveAuthRequiredModal-XTcoJKvj.js.map +1 -0
  28. package/dist/{DriveSettingsModal-BSImj4BH.js → DriveSettingsModal-DZKawN7w.js} +5 -5
  29. package/dist/DriveSettingsModal-DZKawN7w.js.map +1 -0
  30. package/dist/{InspectorModal-Dr8-gj6u.js → InspectorModal-DA_TGmM6.js} +16 -16
  31. package/dist/InspectorModal-DA_TGmM6.js.map +1 -0
  32. package/dist/{LoginModal-DT_05uva.js → LoginModal-O06ZvWFI.js} +6 -6
  33. package/dist/LoginModal-O06ZvWFI.js.map +1 -0
  34. package/dist/{OpenFileDocumentsModal-X9GnX2Bk.js → OpenFileDocumentsModal-BNHD0vg9.js} +6 -6
  35. package/dist/OpenFileDocumentsModal-BNHD0vg9.js.map +1 -0
  36. package/dist/{UpgradeDriveModal-DvM-PNWe.js → UpgradeDriveModal-CCWKp5yn.js} +5 -5
  37. package/dist/UpgradeDriveModal-CCWKp5yn.js.map +1 -0
  38. package/dist/{app-loader-DrViXipO.js → app-loader-CEN_4I3I.js} +149 -196
  39. package/dist/app-loader-CEN_4I3I.js.map +1 -0
  40. package/dist/app-loader-Cj2p8L1I.js +4 -0
  41. package/dist/{app-skeleton-gzg8cRzm.js → app-skeleton-BFjvlTWd.js} +11 -11
  42. package/dist/app-skeleton-BFjvlTWd.js.map +1 -0
  43. package/dist/{app-skeleton-DYLZ7npI.js → app-skeleton-DFg65Rxa.js} +3 -3
  44. package/dist/{boot-CC_DgQKX.js → boot-JTGLJtmJ.js} +6 -6
  45. package/dist/boot-JTGLJtmJ.js.map +1 -0
  46. package/dist/{build-info-DMrToXJe.js → build-info-DkY9PU7c.js} +5 -5
  47. package/dist/{build-info-DMrToXJe.js.map → build-info-DkY9PU7c.js.map} +1 -1
  48. package/dist/{components-CjF9XjxP.js → components-2wvJ3_Ho.js} +11 -10
  49. package/dist/{components-CjF9XjxP.js.map → components-2wvJ3_Ho.js.map} +1 -1
  50. package/dist/{connect.config-uZF-gnvV.js → connect.config-D1pGNmaF.js} +4 -4
  51. package/dist/connect.config-D1pGNmaF.js.map +1 -0
  52. package/dist/{connection-state-C_477Kr_.js → connection-state-B6fleM37.js} +6 -6
  53. package/dist/connection-state-B6fleM37.js.map +1 -0
  54. package/dist/{cookie-banner-HPgyuHM5.js → cookie-banner-CAvd3PC3.js} +6 -6
  55. package/dist/{cookie-banner-HPgyuHM5.js.map → cookie-banner-CAvd3PC3.js.map} +1 -1
  56. package/dist/document-editor-container-BnEjlmaN.js +307 -0
  57. package/dist/document-editor-container-BnEjlmaN.js.map +1 -0
  58. package/dist/document-editor-container-kgS38mkb.js +4 -0
  59. package/dist/error-boundary-BsUBww61.js +155 -0
  60. package/dist/error-boundary-BsUBww61.js.map +1 -0
  61. package/dist/generic.d.ts +116 -0
  62. package/dist/generic.d.ts.map +1 -0
  63. package/dist/generic.js +31 -0
  64. package/dist/generic.js.map +1 -0
  65. package/dist/{i18n-CTgT1HG-.js → i18n-D9WYPgk9.js} +4 -4
  66. package/dist/{i18n-CTgT1HG-.js.map → i18n-D9WYPgk9.js.map} +1 -1
  67. package/dist/index-B4g8swZG.d.ts +4 -0
  68. package/dist/layout-BOX6fL5v.js +5 -0
  69. package/dist/layout.d.ts +2 -28
  70. package/dist/layout.js +4 -6
  71. package/dist/{load--K_UgzUy.js → load-CCCHqC0d.js} +11 -11
  72. package/dist/{load--K_UgzUy.js.map → load-CCCHqC0d.js.map} +1 -1
  73. package/dist/load-runtime-config-Dhy-b5wT.js +14 -0
  74. package/dist/load-runtime-config-Dhy-b5wT.js.map +1 -0
  75. package/dist/main.js +2 -2
  76. package/dist/{open-file-uploads-BcyWmUZn.js → open-file-uploads-B5pr1sA2.js} +4 -4
  77. package/dist/{open-file-uploads-BcyWmUZn.js.map → open-file-uploads-B5pr1sA2.js.map} +1 -1
  78. package/dist/{package-manager-BkFRzovd.js → package-manager-x_fK8Hzm.js} +92 -60
  79. package/dist/package-manager-x_fK8Hzm.js.map +1 -0
  80. package/dist/{pglite-seed-BsEPByVM.js → pglite-seed-eGzXMld2.js} +4 -4
  81. package/dist/{pglite-seed-BsEPByVM.js.map → pglite-seed-eGzXMld2.js.map} +1 -1
  82. package/dist/{plugin-host--lBWChr9.js → plugins-B9VBgzio.js} +75 -83
  83. package/dist/plugins-B9VBgzio.js.map +1 -0
  84. package/dist/{preferences-store-DANUajdg.js → preferences-store-CSqauT9V.js} +5 -5
  85. package/dist/preferences-store-CSqauT9V.js.map +1 -0
  86. package/dist/prerender.d.ts +38 -0
  87. package/dist/prerender.d.ts.map +1 -0
  88. package/dist/prerender.js +177 -0
  89. package/dist/prerender.js.map +1 -0
  90. package/dist/{prerendered-shell-DxCUDEXL.js → prerendered-shell-peKE7AqI.js} +10 -4
  91. package/dist/prerendered-shell-peKE7AqI.js.map +1 -0
  92. package/dist/{reactor-5nod7BfF.js → reactor-BmI-D8O-.js} +25 -156
  93. package/dist/reactor-BmI-D8O-.js.map +1 -0
  94. package/dist/{registerServiceWorker-CkVxA2KC.js → registerServiceWorker-APlHkrmH.js} +4 -4
  95. package/dist/{registerServiceWorker-CkVxA2KC.js.map → registerServiceWorker-APlHkrmH.js.map} +1 -1
  96. package/dist/root-B1Pq9x6S.js +24 -0
  97. package/dist/root-B1Pq9x6S.js.map +1 -0
  98. package/dist/route-tree.d.ts +147 -156
  99. package/dist/route-tree.d.ts.map +1 -1
  100. package/dist/route-tree.js +93 -169
  101. package/dist/route-tree.js.map +1 -1
  102. package/dist/route-views-BF0p-4Fi.js +60 -0
  103. package/dist/route-views-BF0p-4Fi.js.map +1 -0
  104. package/dist/route-views-CTARvT5N.js +55 -0
  105. package/dist/route-views-CTARvT5N.js.map +1 -0
  106. package/dist/route-views-D8I-1PWU.js +4 -0
  107. package/dist/route-views.d.ts +7 -0
  108. package/dist/route-views.d.ts.map +1 -0
  109. package/dist/route-views.js +4 -0
  110. package/dist/router-BguOMBUh.js +4 -0
  111. package/dist/router-L9X9U-97.js +46 -0
  112. package/dist/router-L9X9U-97.js.map +1 -0
  113. package/dist/router.d.ts +1 -3
  114. package/dist/router.js +3 -7
  115. package/dist/sentry-Cuc_Nbba.js +22 -0
  116. package/dist/sentry-Cuc_Nbba.js.map +1 -0
  117. package/dist/{settings-DkLhRfEI.js → settings-DjQfTrBe.js} +488 -22
  118. package/dist/settings-DjQfTrBe.js.map +1 -0
  119. package/dist/settings-tabs-iTlo2pYz.js +365 -0
  120. package/dist/settings-tabs-iTlo2pYz.js.map +1 -0
  121. package/dist/shell-core-head.html +2 -0
  122. package/dist/shell-core.html +1 -0
  123. package/dist/shell-head.html +2 -1
  124. package/dist/shell-plugins.json +1 -0
  125. package/dist/shell.html +1 -1
  126. package/dist/start-connect.d.ts +5 -9
  127. package/dist/start-connect.d.ts.map +1 -1
  128. package/dist/start-connect.js +5 -6
  129. package/dist/start-connect.js.map +1 -1
  130. package/dist/style.css +3127 -4014
  131. package/dist/ui-b6sMhi5V.js +66 -0
  132. package/dist/ui-b6sMhi5V.js.map +1 -0
  133. package/dist/{use-renown-login-BzOSQETV.js → use-renown-login-dPpDOYq5.js} +4 -4
  134. package/dist/use-renown-login-dPpDOYq5.js.map +1 -0
  135. package/docs/customizing/data-and-navigation.md +177 -0
  136. package/docs/customizing/hosts-and-plugins.md +65 -0
  137. package/docs/customizing/layout.md +149 -0
  138. package/docs/customizing/modals.md +78 -0
  139. package/docs/customizing/overrides.md +113 -0
  140. package/docs/customizing/packages.md +38 -0
  141. package/docs/customizing/pages.md +136 -0
  142. package/docs/customizing/styles-and-branding.md +41 -0
  143. package/docs/customizing/types-and-troubleshooting.md +44 -0
  144. package/package.json +41 -18
  145. package/scripts/prerender-shell.ts +35 -84
  146. package/skills/customize-connect/SKILL.md +74 -0
  147. package/src/route-tree.ts +3 -0
  148. package/src/routeTree.gen.ts +134 -192
  149. package/src/router/index.ts +2 -51
  150. package/src/router/register.ts +1 -1
  151. package/src/routes/__root.tsx +8 -24
  152. package/src/routes/_app/$.tsx +13 -0
  153. package/src/routes/_app/d/$driveSlug/{-$nodeSlug}.tsx +13 -0
  154. package/src/routes/_app/d/$driveSlug.tsx +13 -0
  155. package/src/routes/_app/index.tsx +13 -0
  156. package/src/routes/_app/settings/appearance.tsx +13 -0
  157. package/src/routes/_app/settings/packages.tsx +13 -0
  158. package/src/routes/_app/settings.tsx +13 -0
  159. package/src/routes/_app.tsx +13 -0
  160. package/style.css +5 -22
  161. package/tailwind.css +12 -0
  162. package/dist/AddDriveModal-D_3jDwjp.js.map +0 -1
  163. package/dist/ClearStorageModal-zZ8XzwmR.js.map +0 -1
  164. package/dist/ConfirmDocumentUpgradeModal-CrU2Z1CL.js.map +0 -1
  165. package/dist/CreateDocumentModal-Cf1APibL.js.map +0 -1
  166. package/dist/DebugSettingsModal-DIc5C2lI.js.map +0 -1
  167. package/dist/DeleteDriveModal-lE9eCBua.js.map +0 -1
  168. package/dist/DeleteItemModal-BFgcGsm3.js.map +0 -1
  169. package/dist/DisclaimerModal-CF6JkIIu.js.map +0 -1
  170. package/dist/DocumentVersionUnsupportedModal-Cm9Jb9W7.js.map +0 -1
  171. package/dist/DownloadDocumentWithErrorsModal-CShKhfEQ.js.map +0 -1
  172. package/dist/DriveAuthRequiredModal-CMwPUyZf.js.map +0 -1
  173. package/dist/DriveSettingsModal-BSImj4BH.js.map +0 -1
  174. package/dist/InspectorModal-Dr8-gj6u.js.map +0 -1
  175. package/dist/LoginModal-DT_05uva.js.map +0 -1
  176. package/dist/MissingPackageModal-DtISKgub.js +0 -49
  177. package/dist/MissingPackageModal-DtISKgub.js.map +0 -1
  178. package/dist/OpenFileDocumentsModal-X9GnX2Bk.js.map +0 -1
  179. package/dist/UpgradeDriveModal-DvM-PNWe.js.map +0 -1
  180. package/dist/app-layout-BIq-ZW-6.js +0 -394
  181. package/dist/app-layout-BIq-ZW-6.js.map +0 -1
  182. package/dist/app-loader-CWAH-WxW.js +0 -4
  183. package/dist/app-loader-DrViXipO.js.map +0 -1
  184. package/dist/app-skeleton-gzg8cRzm.js.map +0 -1
  185. package/dist/boot-CC_DgQKX.js.map +0 -1
  186. package/dist/connect-router-KmNBGS0G.js +0 -434
  187. package/dist/connect-router-KmNBGS0G.js.map +0 -1
  188. package/dist/connect.config-uZF-gnvV.js.map +0 -1
  189. package/dist/connection-state-C_477Kr_.js.map +0 -1
  190. package/dist/index-UrZFqSgm.d.ts +0 -166
  191. package/dist/index-UrZFqSgm.d.ts.map +0 -1
  192. package/dist/layout.d.ts.map +0 -1
  193. package/dist/multi-reactor-fSKpLBjT.js +0 -220
  194. package/dist/multi-reactor-fSKpLBjT.js.map +0 -1
  195. package/dist/package-manager-BkFRzovd.js.map +0 -1
  196. package/dist/plugin-host--lBWChr9.js.map +0 -1
  197. package/dist/preferences-store-DANUajdg.js.map +0 -1
  198. package/dist/prerendered-shell-DxCUDEXL.js.map +0 -1
  199. package/dist/reactor-5nod7BfF.js.map +0 -1
  200. package/dist/route-components-BkztQruF.js +0 -148
  201. package/dist/route-components-BkztQruF.js.map +0 -1
  202. package/dist/router-8RIbbf6v.js +0 -4
  203. package/dist/router-C37yATTD.js +0 -604
  204. package/dist/router-C37yATTD.js.map +0 -1
  205. package/dist/runtime-config-DdN1Frg7.js +0 -34
  206. package/dist/runtime-config-DdN1Frg7.js.map +0 -1
  207. package/dist/runtime-flag-B8IYhkz-.js +0 -4
  208. package/dist/runtime-flag-CT5OKujT.js +0 -45
  209. package/dist/runtime-flag-CT5OKujT.js.map +0 -1
  210. package/dist/sentry-CJb7--mu.js +0 -18
  211. package/dist/sentry-CJb7--mu.js.map +0 -1
  212. package/dist/settings-CjvK8OKA.js +0 -91
  213. package/dist/settings-CjvK8OKA.js.map +0 -1
  214. package/dist/settings-DkLhRfEI.js.map +0 -1
  215. package/dist/sidebar-BXf8OEwm.d.ts +0 -34
  216. package/dist/sidebar-BXf8OEwm.d.ts.map +0 -1
  217. package/dist/sidebar-lAVFRsni.js +0 -31
  218. package/dist/sidebar-lAVFRsni.js.map +0 -1
  219. package/dist/use-renown-login-BzOSQETV.js.map +0 -1
  220. package/dist/useIsEmbedded-BWJ0qb7w.js +0 -26
  221. package/dist/useIsEmbedded-BWJ0qb7w.js.map +0 -1
  222. package/dist/useRegistryPackages-BqIWwXV-.js +0 -452
  223. package/dist/useRegistryPackages-BqIWwXV-.js.map +0 -1
  224. package/scripts/critical-css.ts +0 -243
  225. package/src/router/connect-router.ts +0 -170
  226. package/src/router/drive-route-loader.ts +0 -116
  227. package/src/router/navigation.ts +0 -230
  228. package/src/router/perf-marks.test.tsx +0 -98
  229. package/src/router/perf-marks.ts +0 -97
  230. package/src/router/route-components.tsx +0 -98
  231. package/src/router/route-tree.ts +0 -88
  232. package/src/router/scroll.ts +0 -69
  233. package/src/router/search.ts +0 -66
  234. package/src/router/settings.ts +0 -120
  235. package/src/router/sidebar.ts +0 -55
  236. package/src/router/titles.test.ts +0 -24
  237. package/src/router/titles.ts +0 -33
  238. package/src/routes/core/_app/$.tsx +0 -13
  239. package/src/routes/core/_app/_content/d/$driveSlug/{-$nodeSlug}.tsx +0 -52
  240. package/src/routes/core/_app/_content/index.tsx +0 -3
  241. package/src/routes/core/_app/_content.tsx +0 -9
  242. package/src/routes/core/_app/settings/about.tsx +0 -20
  243. package/src/routes/core/_app/settings/ai-assistant.tsx +0 -20
  244. package/src/routes/core/_app/settings/danger-zone.tsx +0 -21
  245. package/src/routes/core/_app/settings/default-editors.tsx +0 -20
  246. package/src/routes/core/_app/settings/package-manager.tsx +0 -20
  247. package/src/routes/core/_app/settings.tsx +0 -35
  248. package/src/routes/core/_app.tsx +0 -10
@@ -0,0 +1,472 @@
1
+ # Connect Runtime Configuration
2
+
3
+ How runtime values reach the Connect SPA, where they're defined, who can change them, and how the SPA picks them up.
4
+
5
+ ## TL;DR
6
+
7
+ Connect's runtime configuration lives in a single JSON file: `powerhouse.config.json`. The file exists in two places — a hand-edited _source_ in the project root, and a built _dist_ that Connect actually serves at runtime. The SPA reads it once at boot via `fetch()` and never looks at environment variables for its own settings. Operators set values by editing the source file, passing CLI flags, running `ph connect config`, or — at deploy time — setting environment variables that a Docker entrypoint translates into the dist file.
8
+
9
+ ```
10
+ ┌──────────── ways to set a value ────────────┐
11
+ │
12
+ ph init (scaffold defaults) │
13
+ edit powerhouse.config.json by hand │
14
+ ph connect config --<field> <value> │
15
+ ph connect build --<field> <value> │
16
+ ph install --registry <url> │
17
+ PH_CONNECT_CONFIG_JSON env (deploy-time) │
18
+ │
19
+ └──────────────────────┬───────────────────────┘
20
+ │
21
+ ▼
22
+ powerhouse.config.json (dist)
23
+ │
24
+ │ fetch('/powerhouse.config.json')
25
+ ▼
26
+ Connect SPA — ConfigLoader cached at boot
27
+ │
28
+ getRuntimeConfig() / getConnectConfig()
29
+ ▼
30
+ consumed by Package Manager, Renown,
31
+ drive sidebar, router basename, etc.
32
+ ```
33
+
34
+ ## The file
35
+
36
+ Schema lives in `packages/builder-tools/connect-utils/runtime-config-schema.ts`. Shape (simplified):
37
+
38
+ ```jsonc
39
+ {
40
+ "$schema": "...",
41
+ "schemaVersion": 2,
42
+
43
+ // Top-level — project-wide, also read by ph-cli + Switchboard:
44
+ "packages": [
45
+ { "packageName": "@scope/pkg", "version": "1.0.0", "provider": "registry" }
46
+ ],
47
+ "packageRegistryUrl": "https://registry.vetra.io",
48
+ "localPackage": { "name": "...", "version": "..." } | null,
49
+
50
+ // Connect-only runtime values:
51
+ "connect": {
52
+ "branding": { "appName": "...", "homeBackground": "..." | null },
53
+ "app": { "logLevel": "info", "basePath": "/", "offline": true },
54
+ "renown": { "url": "...", "networkId": "eip155", "chainId": 1, "switchboardUrl": "..." | undefined, "adapters": {...} | undefined },
55
+ "drives": { "allowAddDrive": true, "defaultDrives": [...], "preserveStrategy": "...", "sections": {...} },
56
+ "packages": { "externalEnabled": true },
57
+ "sentry": { "dsn": null, "env": "dev", "tracing": false },
58
+ "openPanel": { "clientId": "", "apiUrl": "..." | undefined, "trackUiEvents": true, "trackOperations": true },
59
+ "reactor": { "featureFlags": { "documentDecisions": false, "authEnforcement": false, "authGroups": false, "authConditions": false }, "createSignaturePolicy": "v2-required", "unsupportedStoredDocuments": "refuse" },
60
+ "pwa": { ... } // build-time only, see below
61
+ }
62
+ }
63
+ ```
64
+
65
+ The defaults for the `connect.*` block are defined once in `packages/shared/connect/runtime-config.ts` as `DEFAULT_CONNECT_CONFIG`. They are the floor of the precedence ladder, the scaffolded template for new projects, and the merge base that guarantees the SPA never sees a partially-populated `connect.*` block.
66
+
67
+ ### Renown in-page sign-in (`connect.renown.switchboardUrl` + `adapters`)
68
+
69
+ By default Connect authenticates by **redirecting** to the Renown portal (`connect.renown.url`). Setting `connect.renown.switchboardUrl` enables **in-page** sign-in — the user signs a Renown credential inside Connect and it is written/logged in via that switchboard, with no redirect. If it isn't set, or no adapter can produce a wallet session, Connect falls back to the redirect flow automatically.
70
+
71
+ `connect.renown.adapters` selects which wallet adapters power in-page sign-in. Presence of a key enables that adapter. Connect ships with every adapter's peer dependencies installed, so operators need only edit the config; each adapter's libraries are still lazy-loaded on the first login click, so a privy-only deployment never downloads the RainbowKit chunk. (Standalone apps embedding `RenownWalletProvider` install peers per adapter they import — see the [Renown SDK README](../../packages/renown/README.md#wallet-adapters-in-page-sign-in).) Connect's config-to-adapter mapping lives in `src/components/renown-adapter-descriptors.ts`.
72
+
73
+ ```jsonc
74
+ "renown": {
75
+ "url": "https://www.renown.id", // redirect fallback
76
+ "switchboardUrl": "https://switchboard.example/graphql", // enables in-page auth
77
+ "adapters": {
78
+ "rainbow": { "walletConnectProjectId": "..." }, // external wallets
79
+ "privy": { "appId": "...", "methods": ["google", "email"] } // social / email
80
+ }
81
+ }
82
+ ```
83
+
84
+ Only **public** identifiers belong here (`walletConnectProjectId`, Privy `appId`/`clientId`). Never place a Privy **App Secret** in this file — it is server-only and this file is fetched by the browser. Each configured social/email method must also be enabled in the Privy dashboard, and Connect's origin allowlisted there.
85
+
86
+ `switchboardUrl` can be overridden at build time with `ph connect config --renown-switchboard-url <url>` (or the `PH_CONNECT_CONFIG_JSON` env override); `adapters` is set via the config file / `PH_CONNECT_CONFIG_JSON`.
87
+
88
+ `chainId` (default `1`) is the chain Renown issues credentials on. It is part of the user's DID, so the same wallet on another chain is a different user, and sign-in from a wallet on a different chain is rejected. Setting it moves three things together: the credential, the bearer token — including the reactor worker's, which builds its own crypto and receives the chain through its construct message since it cannot read runtime config — and the chain the wallet UI offers, so the user is prompted to switch rather than rejected at the end of the flow.
89
+
90
+ Only chains Connect bundles can be offered (`1`, `11155111`, `137`, `10`, `42161`, `8453`); any other id logs an error and leaves in-page sign-in unusable. `networkId` remains unread — `did:pkh` identities here are always `eip155`.
91
+
92
+ ### Reactor enforcement flags (`connect.reactor.featureFlags`)
93
+
94
+ The reactor Connect runs in the browser takes the same four enforcement flags a
95
+ switchboard does: `documentDecisions`, `authEnforcement`, `authGroups`,
96
+ `authConditions`. Each requires the one before it, and the reactor refuses to
97
+ build a set that skips one. All default `false`.
98
+
99
+ ```jsonc
100
+ "reactor": {
101
+ "featureFlags": {
102
+ "documentDecisions": true,
103
+ "authEnforcement": true,
104
+ "authGroups": true,
105
+ "authConditions": true
106
+ }
107
+ }
108
+ ```
109
+
110
+ These are the one part of `connect.*` that is not a local preference. A flag
111
+ changes how stored history is replayed, and a replay verdict is a consensus
112
+ outcome, so **a Connect must carry the same flags as the fleet it syncs with**.
113
+ A flags-off Connect syncing an enforcing switchboard applies operations that
114
+ switchboard denied and the two diverge. Set them per fleet, alongside the
115
+ switchboard's `REACTOR_*` env vars (see `apps/switchboard/README.md`).
116
+
117
+ Both reactor hosts read them: the main-thread reactor takes the value from this
118
+ file directly, and the SharedWorker gets it in its construct message, for the
119
+ same reason it gets `renown.chainId` — a worker has no runtime config of its
120
+ own. There is deliberately no query-param or localStorage override, unlike
121
+ `connect.instance.reactorWorker`: a per-tab flag would be a per-node flag.
122
+
123
+ The flag set is part of the worker's version fingerprint, so a flip is picked up
124
+ even though it isn't a rebuild. A tab whose flags differ from the running
125
+ worker's is told to reload onto a fresh worker, exactly as it would be after a
126
+ new build — without that, the worker would keep enforcing the flags it booted
127
+ with while the tab believed the new set was live. Other tabs still on the old
128
+ worker reload as they refresh.
129
+
130
+ With `authEnforcement` on, both hosts install the Renown trust policy that
131
+ switchboard installs under `REACTOR_AUTH_ENFORCEMENT`: a signed write is
132
+ accepted when a Renown credential binds its key to the wallet it claims, and
133
+ the logged-in user's own key is accepted without a lookup. Credentials are
134
+ read from `connect.renown.switchboardUrl`, or the switchboard `connect.renown.url`
135
+ advertises, else Renown's REST API at `connect.renown.url`, so that endpoint must
136
+ be reachable from the browser. With neither set, the reactor fails to build
137
+ rather than refuse every signed write. The worker gets both URLs in its construct
138
+ message and keeps the ones the first tab booted it with.
139
+
140
+ ### Creation signature policy (`connect.reactor.createSignaturePolicy`)
141
+
142
+ What the documents and drives Connect creates are born as: `"v2-required"`
143
+ (the default) or `"legacy"`. A v2-required document accepts only v2 action
144
+ signatures and takes a content-addressed id. Set `"legacy"` while any reactor
145
+ Connect syncs with predates v2-required documents; existing documents keep
146
+ their policy either way, and the setting does not change what Connect accepts.
147
+
148
+ ```jsonc
149
+ "reactor": { "createSignaturePolicy": "legacy" }
150
+ ```
151
+
152
+ The main-thread reactor reads it from this file; the SharedWorker gets it in its
153
+ construct message and keeps the value the first tab booted it with. It is not
154
+ part of the worker's version fingerprint.
155
+
156
+ ### Stored documents this build does not run (`connect.reactor.unsupportedStoredDocuments`)
157
+
158
+ A reactor refuses to boot when the browser's store holds documents created at a
159
+ protocol version the build does not run, for example after rolling Connect back
160
+ to a release that predates one. Connect then shows "Connect cannot open this
161
+ browser's documents" with the versions and document count, instead of the app.
162
+ There are two ways forward: serve a Connect build that runs those versions, or
163
+ accept them read-only:
164
+
165
+ ```jsonc
166
+ "reactor": { "unsupportedStoredDocuments": "read-only" }
167
+ ```
168
+
169
+ `"refuse"` is the default. With `"read-only"` the reactor boots, logs a warning,
170
+ and refuses every write into those documents and every operation received for
171
+ them; the rest of the store works as usual. Connect has no in-app button for it:
172
+ the setting is the operator's choice, so it goes in this file (or
173
+ `PH_CONNECT_CONFIG_JSON`), and the boot screen's Reload picks up the change.
174
+ Both reactor hosts read it; the SharedWorker gets it in its construct message.
175
+ A worker that refused retries the build on the next tab's connect, so the new
176
+ value takes effect without closing other tabs.
177
+
178
+ ### Multi-reactor routing (`connect.instance.multiReactor`)
179
+
180
+ Experimental, optional, default `false`. When on, Connect reads and writes
181
+ through a router over its own reactor and the Switchboard of the first remote
182
+ default drive (`drives.defaultDrives[].url`), and its reactor gains a local sync
183
+ channel.
184
+
185
+ ```jsonc
186
+ "instance": { "multiReactor": true }
187
+ ```
188
+
189
+ It is part of the worker's version fingerprint, so like the enforcement flags
190
+ it is set in this file only, with no query-param or localStorage override.
191
+
192
+ ## Setting values — the precedence ladder
193
+
194
+ When `ph connect build` runs, the _dist_ `powerhouse.config.json` is produced by deep-merging in this order (lowest → highest):
195
+
196
+ ```
197
+ DEFAULT_CONNECT_CONFIG < source.connect < CLI flag overrides
198
+ ```
199
+
200
+ Plus the top-level field:
201
+
202
+ ```
203
+ packageRegistryUrl = cliPackageRegistryUrl ?? source.packageRegistryUrl ?? null
204
+ ```
205
+
206
+ Each layer can supply a partial value; missing leaves fall back to the layer below. Arrays replace (they don't append), and `undefined` in a patch means "leave alone".
207
+
208
+ Two fields interact with the service worker and deserve a caveat:
209
+
210
+ - **`connect.branding.favicon` is build-time only.** A file relative to the project, served by `ph connect studio` and built as `icon.ico` by `ph connect build`; the dist file leaves it out.
211
+ - **`connect.pwa` (the project's own block) is build-time only.** `ph connect build` merges it (together with build-time package `pwa` fragments) into the base `manifest.webmanifest` and the injectManifest `service-worker.js` — including the manifest's `icons`, `file_handlers` (the built-in `.phd`/`.phdm` OS file association plus any contributed types) and `launch_handler`. The manifest's `categories` is not authored here — it is derived from the top-level `category` field of every contributing `powerhouse.manifest.json` (project + packages), unioned. It is carried along in the dist file for transparency, but the SPA never reads the project block — editing the dist copy or injecting it via `PH_CONNECT_CONFIG_JSON` has no effect. See the Academy page "Configure the PWA" for the merge semantics.
212
+ - **Packages installed AT RUNTIME extend the PWA config the same way build-time packages do.** The service worker serves `manifest.webmanifest` dynamically and reads its runtime-caching / navigate-fallback contributions from IndexedDB `ph-pwa` (mirrored by `BrowserPackageManager.#syncPwaFragments`), so a runtime package's manifest members, overridden scalars, `runtimeCaching` rules and `navigateFallbackDenylist` patterns all apply without a rebuild. Two guardrails vs. build-time: the manifest merge is fragment-wins **except `start_url`/`scope`** (protected, so an end-user-installed package can't re-scope the app), and `.phd`/`.phdm` stay first-registered. Timing caveats (not build-vs-runtime): `file_handlers`/`launch_handler` are captured by the OS at PWA install time (Chrome re-reads on its own periodic manifest check — never mid-session; content-based routing opens `.phd`/`.phdm` regardless), and `runtimeCaching`/`navigateFallbackDenylist` are read at worker startup (full effect on the worker's next activation). Only `globPatterns`/`globIgnores`/`maximumFileSizeToCacheInBytes` stay build-time only — they drive the workbox precache list baked at build.
213
+ - **`connect.app.offline` is hybrid.** At build time it decides whether a precaching worker or a self-destroying one is emitted; at boot the SPA reads it to register or unregister the worker (`apps/connect/src/components/app.tsx`, default `true`). Flipping it to `false` at deploy time therefore unregisters the worker on the next load, but flipping it to `true` cannot conjure a worker the build didn't emit.
214
+
215
+ ### The five ways to feed a value into a layer
216
+
217
+ | Way | Lands in | When to use |
218
+ | ----------------------------------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------- |
219
+ | `ph init` template | source file | Initial scaffold; gives every project a working default |
220
+ | Manual edit of `<project>/powerhouse.config.json` | source file | Local dev tweaks; checked into git |
221
+ | `ph connect config --<field> <value>` (or `--json '{...}'`) | source **and** dist (dual-write) | Quick CLI edit that takes effect on next refresh, without rebuilding |
222
+ | `ph connect build --<field> <value>` (or `--json '{...}'`) | dist (CLI override layer) | One-off override at build time, e.g. CI baking a different `--base` |
223
+ | Docker entrypoint env var `PH_CONNECT_CONFIG_JSON` | dist file at container start, **operator-wins** | Per-deployment knobs without rebuilding the image |
224
+
225
+ Two special-case writers also exist:
226
+
227
+ - `ph install --registry <url>` writes the top-level `packageRegistryUrl` (overwrites when `--registry` is explicit, otherwise preserves existing).
228
+ - `ph vetra` passes a programmatic `callerOverride` to `ph connect studio` so default drives don't have to be tipped on every invocation.
229
+
230
+ ### Notes on each method
231
+
232
+ **Manual edit.** The source `powerhouse.config.json` lives in the project root next to `package.json`. It carries top-level keys for other tooling too (`studio.port`, `reactor.*`, `auth.*`, `documentModelsDir`, etc.); those keys pass through Connect's loader untouched.
233
+
234
+ **`ph connect config`.** Four modes (mutually exclusive — positional, `--get`, `--json`, and field flags cannot be combined):
235
+
236
+ - No args → list mode: prints the effective `connect.*` block (defaults + source).
237
+ - `<key>` (positional) or `--get <dotted.path>` → prints a single value at the dotted path (also works for top-level `packageRegistryUrl`).
238
+ - `<key> <value>` (positional) or `--<field> <value>` → set mode: Ajv-validates the value against the schema at that path and dual-writes to source and dist (dist is skipped silently if no build has happened yet). Coercion is JSON-aware — `true`/`false`/numbers parse correctly; arrays and objects should go through `--json` instead.
239
+ - `--json '{...}'` → bulk-set mode: validates the full patch and dual-writes.
240
+
241
+ **`--json` payload shape.** Both `ph connect config --json` and `ph connect build --json` take the `connect.*` block **without** the `connect` wrapper, as nested objects (not dotted keys). A top-level `packageRegistryUrl` is also accepted. The payload is Ajv-validated against the runtime schema: an unknown key, a `{"connect":{...}}` wrapper, a dotted key such as `"app.workflowsEnabled"`, or a wrong type fails the command instead of being dropped.
242
+
243
+ ```bash
244
+ # Enables workflows and adds a default drive.
245
+ ph connect build --json '{"app":{"workflowsEnabled":true},"drives":{"defaultDrives":[{"url":"http://localhost:4001/d/my-workflows","name":"My workflows"}]}}'
246
+ ```
247
+
248
+ **`ph connect build` overrides.** Three combinable forms (last wins on collision): `<key> <value>` positional, `--<field> <value>` per-field flag, or `--json '{...}'` bulk. The same shared spec drives both `build` and `config`, so the positional grammar matches. **`--base` IS available here** (build-time field). The 4 flags inherited from `commonArgs` (`--base`, `--log-level`, `--default-drives-url`, `--drive-preserve-strategy`) carry cmd-ts defaults, so they're gated through `wasFlagExplicitlyPassed` — if the user didn't type the flag, the source value wins. CLI overrides beat source. Build has no read mode; passing only `<key>` without `<value>` errors with a pointer to `ph connect config <key>`.
249
+
250
+ **`--base` is build-time only.** `ph connect build --base /foo` writes `connect.app.basePath` AND bakes the value into the Vite bundle's asset URLs AND templates the nginx config. `ph connect config --base /foo` would only write the first one, leaving the SPA's router and the deployed assets disagreeing — so `ph connect config` rejects `--base` up front with an actionable error pointing at `ph connect build --base`.
251
+
252
+ **Docker entrypoint.** `docker/connect-entrypoint.sh` runs at container start and accepts a single env var, `PH_CONNECT_CONFIG_JSON`, carrying a full `powerhouse.config.json` payload, with the `connect` wrapper (unlike `--json`, which takes the `connect.*` block alone). It deep-merges that JSON into the dist file with **operator-wins semantics**: a concrete value in the env JSON (including `false`/`""`/`[]`/`0`) overwrites whatever the build baked; a `null` leaf (or an omitted key) keeps the file's value, so baked defaults only apply where the operator expressed no opinion. One exception: `connect.app.basePath` is stripped from the payload — the base path is baked into the bundled asset URLs and cannot be changed at runtime (rebuild with `--base`, or use `--dynamic-base`). This is the only env-var path still active — the SPA itself does not read env vars. Operators get the deployment-time knob without env vars leaking into runtime behaviour.
253
+
254
+ ```bash
255
+ docker run \
256
+ -e PH_CONNECT_CONFIG_JSON='{"connect":{"renown":{"url":"https://renown.staging"},"app":{"logLevel":"debug"}}}' \
257
+ connect:latest
258
+ ```
259
+
260
+ Invalid JSON (parse error or non-object payload) aborts startup with a clear stderr message rather than silently dropping the operator payload. The shell layer keeps `PH_CONNECT_BASE_PATH` separate because nginx needs it for URL templating before any JSON is touched.
261
+
262
+ ## How Connect reads the file at boot
263
+
264
+ `apps/connect/main.tsx`:
265
+
266
+ ```tsx
267
+ import { createRoot } from "react-dom/client";
268
+ import { loadRuntimeConfig } from "./src/runtime-config.js";
269
+
270
+ if (!window.ph) window.ph = {};
271
+
272
+ // Bootstrap the runtime config BEFORE AppLoader's transitive imports
273
+ await loadRuntimeConfig();
274
+ const { AppLoader } = await import("./src/components/app-loader.js");
275
+
276
+ createRoot(document.getElementById("root")!).render(<AppLoader />);
277
+ ```
278
+
279
+ Two ordering tricks:
280
+
281
+ 1. **Top-level await** on `loadRuntimeConfig()` blocks module evaluation until the fetch resolves.
282
+ 2. **Dynamic import** of `AppLoader` so any module that calls `getRuntimeConfig()` at import time (synchronous read from the cache) only runs _after_ step 1.
283
+
284
+ Together these prevent a cache-empty race where the SPA would have to fall back to defaults or throw.
285
+
286
+ `loadRuntimeConfig` (in `apps/connect/src/runtime-config.ts`) is a 4-line wrapper around the shared loader:
287
+
288
+ ```ts
289
+ const loader = new ConfigLoader(
290
+ new JsonConfigAdapter({
291
+ path: `${import.meta.env.BASE_URL}powerhouse.config.json`,
292
+ }),
293
+ );
294
+ ```
295
+
296
+ - `ConfigLoader` (in `packages/shared/connect/config-loader.ts`) wraps any `ConfigAdapter` with deep-merge-against-defaults and in-process caching.
297
+ - `JsonConfigAdapter` reads via `fetch()` when `window` is defined, via `fs` in Node.
298
+ - After `loadRuntimeConfig()` resolves once, any synchronous `getRuntimeConfig()` call returns the cached payload immediately.
299
+
300
+ Downstream consumers inside the SPA:
301
+
302
+ | File | Reads |
303
+ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
304
+ | `apps/connect/src/connect.config.ts` | Re-exports the cached config behind getters (`getConnectConfig()`) so the rest of the SPA reads typed accessors instead of dotted paths |
305
+ | `apps/connect/src/hooks/useRegistryPackages.ts` | `getRuntimeConfig().packageRegistryUrl` |
306
+ | `apps/connect/src/store/reactor.ts` | Passes `packageRegistryUrl` to `BrowserPackageManager`; reads `connect.reactor.featureFlags`, `createSignaturePolicy` and `unsupportedStoredDocuments` for both reactor hosts |
307
+ | Renown auth flow | Reads `connect.renown.*` |
308
+ | Drives sidebar | Reads `connect.drives.*` |
309
+ | Router | Reads `connect.app.basePath` |
310
+ | `apps/connect/src/components/app.tsx` | Reads `connect.app.offline` to register or unregister the service worker |
311
+
312
+ A hard refresh in the browser tears down the module graph; the next module evaluation runs `loadRuntimeConfig()` again and the SPA picks up whatever the dist file holds now. This is the path operators use after `ph connect config --renown-url X`: write the new value, refresh the tab.
313
+
314
+ ## Other consumers of the same file
315
+
316
+ The dist `powerhouse.config.json` is not a Connect-private artefact:
317
+
318
+ - **Switchboard** (Node) reads `packages[]` and `packageRegistryUrl` at startup via the same `ConfigLoader` + `JsonConfigAdapter` (Node branch).
319
+ - **`ph install` / `ph publish`** use `resolveRegistryUrl` to pick a registry with priority `--flag > PH_REGISTRY_URL env > config.packageRegistryUrl > DEFAULT_REGISTRY_URL`.
320
+
321
+ This is why `packageRegistryUrl` lives at the top level rather than nested under `connect.*` — it's a project-wide setting, not Connect-only.
322
+
323
+ ## Common operator workflows
324
+
325
+ **"I just want to point Connect at a different registry."**
326
+ Edit the project's `powerhouse.config.json`, set `"packageRegistryUrl": "https://my.registry"`, refresh Connect. Or `ph connect config --packages-registry https://my.registry`.
327
+
328
+ **"I want a subpath deploy (`/connect` instead of `/`)."**
329
+ `ph connect build --base /connect`. The CLI override lands in the dist `connect.app.basePath` and the bundled assets pick it up.
330
+
331
+ **"I want default drives to load automatically."**
332
+ `ph connect config --default-drives-url https://drive-a, https://drive-b`. The CSV is parsed into `connect.drives.defaultDrives[]` objects.
333
+
334
+ **"I want my project to boot with a preconfigured local drive."**
335
+ Add a local entry to `connect.drives.defaultDrives` in `powerhouse.config.json`:
336
+ `{"local": true, "id": "my-drive", "name": "My Drive", "icon": "https://…", "app": "powerhouse/generic-drive-explorer"}`.
337
+ On first boot Connect creates the drive in the user's local reactor with that id and opens the given app on it; later boots skip it (idempotent by id). The `--default-drives-url` flag only produces remote entries.
338
+
339
+ **"I'm deploying the docker image to a new environment and need to override renown."**
340
+ Set `PH_CONNECT_CONFIG_JSON='{"connect":{"renown":{"url":"https://renown.staging.example"}}}'` on the container. The entrypoint script deep-merges the JSON into the dist file before nginx starts (operator-wins); the SPA serves the new value on the very first request.
341
+
342
+ **"I need a different Sentry DSN per environment."**
343
+ Sentry config lives in `connect.sentry.*` of `powerhouse.config.json`. The DSN, environment label, and tracing flag are all runtime — one Docker image serves staging + prod by switching the env-supplied JSON:
344
+
345
+ ```bash
346
+ docker run -e PH_CONNECT_CONFIG_JSON='{
347
+ "connect": {
348
+ "sentry": { "dsn": "https://prod-key@sentry.io/1", "env": "prod", "tracing": true }
349
+ }
350
+ }' connect:latest
351
+ ```
352
+
353
+ `dsn: null` (the default) disables Sentry — the SPA never loads the Sentry SDK chunk. The Sentry **release** tag, in contrast, stays build-time (stamped via Vite's `define` from `WORKSPACE_VERSION`) so it always matches the sourcemap upload tag CI used.
354
+
355
+ **"I want OpenPanel analytics on this deployment."**
356
+ Set `connect.openPanel.clientId` (and `apiUrl` for a self-hosted OpenPanel):
357
+
358
+ ```bash
359
+ docker run -e PH_CONNECT_CONFIG_JSON='{
360
+ "connect": {
361
+ "openPanel": { "clientId": "<client-id>", "apiUrl": "https://openpanel.example/api" }
362
+ }
363
+ }' connect:latest
364
+ ```
365
+
366
+ An empty `clientId` (the default) keeps OpenPanel off, and events are only sent after the user accepts analytics cookies. The runtime values take precedence over the build-time `PH_CONNECT_OPENPANEL_*` env vars, which remain a fallback for builds that bake them.
367
+
368
+ **"I'm turning auth enforcement on for this fleet."**
369
+ Set the whole flag set on the container, matching the switchboard's `REACTOR_*` env vars exactly:
370
+
371
+ ```bash
372
+ docker run -e PH_CONNECT_CONFIG_JSON='{
373
+ "connect": {
374
+ "reactor": { "featureFlags": {
375
+ "documentDecisions": true, "authEnforcement": true,
376
+ "authGroups": true, "authConditions": true
377
+ } }
378
+ }
379
+ }' connect:latest
380
+ ```
381
+
382
+ Partial sets are rejected at boot — `authConditions` requires `authGroups`, which requires `authEnforcement`, which requires `documentDecisions`. In worker mode, confirm what the running worker actually enforces in the inspector modal's worker panel ("Enforcement flags").
383
+
384
+ **"I want to verify what Connect will actually use without booting it."**
385
+ `ph connect config` (no args) prints the effective `connect.*` block (defaults merged with source). `ph connect config connect.renown.url` (or the equivalent `--get connect.renown.url`) prints a single value.
386
+
387
+ ## Adding or changing a config field (developers)
388
+
389
+ A `connect.*` field has five artefacts that must stay in lockstep. The TS
390
+ constants are the source of truth; the two committed `*.schema.json` files are
391
+ generated from them. Miss a step and the schemas silently drift from the types.
392
+
393
+ 1. **Type** — `packages/shared/clis/types.ts`. Add the field to the relevant
394
+ `PHConnect*` type (e.g. `PHConnectPackages`).
395
+ 2. **Default** — `packages/shared/connect/runtime-config.ts`. Add the field's
396
+ default to `DEFAULT_CONNECT_CONFIG` so the SPA never sees it undefined.
397
+ 3. **Schema fragment** — `packages/shared/connect/schema-fragments.ts`. Declare
398
+ the field (type, description, `default`) in `phConnectRuntimeConfigSchema`.
399
+ Both committed schemas import this fragment, so declaring it once keeps the
400
+ source-config and runtime-config schemas in sync by construction.
401
+ 4. **Rebuild** the source-of-truth packages so the emit script sees the change:
402
+ ```bash
403
+ pnpm --filter=@powerhousedao/shared --filter=@powerhousedao/builder-tools build
404
+ ```
405
+ 5. **Regenerate** the committed JSON schemas:
406
+ ```bash
407
+ pnpm tsx scripts/emit-schemas.ts
408
+ ```
409
+ This rewrites `packages/builder-tools/connect-utils/runtime-config.schema.json`
410
+ and `packages/shared/clis/source-config.schema.json`. Commit both.
411
+
412
+ **`connect.pwa.*` fields have a sixth artefact.** The zod `PwaConfigSchema` /
413
+ `PwaManifestOverrideSchema` in `packages/shared/document-model/schemas.ts` is
414
+ the validator `ph connect build` actually runs against `connect.pwa` (via
415
+ `validateProjectPwaConfig`), and it is hand-maintained: `emit-schemas.ts` does
416
+ not regenerate it, and the coverage test below does not cover it (there is no
417
+ `pwa` default). The `z.ZodType<PHConnectPwa>` annotation only pins it to the TS
418
+ type, not to the schema fragment, and does not force it to gain a newly-added
419
+ optional field. So when you add a `connect.pwa.*` field, declare it there too —
420
+ the objects are strict (`z.strictObject`), so a field the schema doesn't know
421
+ fails the build as an unrecognized key rather than being silently dropped.
422
+
423
+ Then consume it in the SPA via `getRuntimeConfig().connect?.<block>?.<field>`
424
+ (or add a typed accessor in `apps/connect/src/connect.config.ts`).
425
+
426
+ Optional, depending on the field:
427
+
428
+ - **CLI flag** — to expose `ph connect config/build --<field>`, wire it through
429
+ `packages/shared/clis/args/connect.ts` and `clis/ph-cli/src/utils/cli-connect-override.ts`
430
+ (see `externalEnabled` → `--external-packages` for the pattern).
431
+ - **Scaffold default** — if new projects should ship the field, add it to the
432
+ `ph init` template at `packages/codegen/src/templates/boilerplate/powerhouse.config.json.ts`.
433
+
434
+ The `runtime-config-schema.test.ts` coverage test asserts every key emitted from
435
+ `DEFAULT_CONNECT_CONFIG` has a matching schema declaration — it fails loudly if
436
+ you add a default (step 2) but skip the schema fragment (step 3).
437
+
438
+ ## Reference: key files
439
+
440
+ ```
441
+ packages/shared/connect/
442
+ ├ runtime-config.ts DEFAULT_CONNECT_CONFIG, types, buildRuntimeConfig
443
+ ├ config-loader.ts ConfigLoader, ConfigAdapter, deepMerge
444
+ └ json-adapter.ts JsonConfigAdapter (browser fetch | Node fs)
445
+
446
+ packages/builder-tools/connect-utils/
447
+ ├ runtime-config-schema.ts JSON Schema (Ajv)
448
+ └ vite-plugins/ph-config.ts Emits dist file & serves /powerhouse.config.json in dev
449
+
450
+ clis/ph-cli/src/
451
+ ├ utils/cli-connect-override.ts buildConnectFlagPatch, wasFlagExplicitlyPassed, buildCliConnectOverride
452
+ ├ utils/connect-config-validation.ts validateConnectPatch (Ajv)
453
+ ├ services/connect-config.ts `ph connect config` handler
454
+ ├ services/connect-studio.ts `ph connect studio` (accepts callerOverride)
455
+ ├ services/vetra.ts `ph vetra` (constructs callerOverride)
456
+ ├ commands/install.ts `ph install` (writes packageRegistryUrl)
457
+ └ utils.ts updateConfigFile
458
+
459
+ apps/connect/
460
+ ├ main.tsx top-level await + dynamic import (boot race fix)
461
+ └ src/runtime-config.ts loadRuntimeConfig, getRuntimeConfig
462
+
463
+ packages/codegen/src/templates/boilerplate/powerhouse.config.json.ts
464
+ └ `ph init` boilerplate template
465
+
466
+ docker/connect-entrypoint.sh
467
+ └ PH_CONNECT_CONFIG_JSON → dist overrides (jq deep-merge, operator-wins)
468
+ ```
469
+
470
+ ## Design principle, in one line
471
+
472
+ The SPA never reads `process.env`; it reads one JSON file. Everything an operator or developer wants to configure — by CLI, env, manual edit, scaffolding, or programmatic API — ends up in that file, with a single, clear precedence: `defaults < source < CLI override < PH_CONNECT_CONFIG_JSON` (the deploy-time env var wins wherever it supplies a concrete value).
@@ -1,11 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="54c6a1de-fb7e-598d-906c-a90c32cdc7d7")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cb114064-0090-5da7-a317-5056a3e9d8b7")}catch(e){}}();
3
3
  import { r as toast } from "./toast-C6WW-_O-.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { addDrive, addRemoteDrive, closePHModal, extractDriveSlugFromPath, fetchDriveInfo, getDrives, getFullReactorClient, getPHNavigation, getPHStore, setSelectedDrive, useAppModules, usePHModal, waitForDocumentReady } from "@powerhousedao/reactor-browser";
6
5
  import { AddDriveModal as AddDriveModal$1 } from "@powerhousedao/design-system/connect";
6
+ import { addDrive, addRemoteDrive, closePHModal, extractDriveSlugFromPath, fetchDriveInfo, getDrives, getFullReactorClient, getPHNavigation, getPHStore, setSelectedDrive, useAppModules, usePHModal, waitForDocumentReady } from "@powerhousedao/reactor-browser";
7
7
  import { t } from "i18next";
8
- //#region src/utils/create-drive-app-options.ts
8
+ //#region src/generic/pages/create-drive-app-options.ts
9
9
  const DRIVE_APP_RANK = {
10
10
  GenericDriveExplorer: 1,
11
11
  "vetra-drive-app": 2
@@ -20,7 +20,7 @@ function getCreateDriveAppOptions(appModules) {
20
20
  })).sort((a, b) => (DRIVE_APP_RANK[a.id] ?? 0) - (DRIVE_APP_RANK[b.id] ?? 0));
21
21
  }
22
22
  //#endregion
23
- //#region src/components/modal/modals/AddDriveModal.tsx
23
+ //#region src/generic/modals/AddDriveModal.tsx
24
24
  const REMOTE_DRIVE_NAV_TIMEOUT_MS = 3e4;
25
25
  function AddDriveModal() {
26
26
  const open = usePHModal()?.type === "addDrive";
@@ -94,5 +94,5 @@ function AddDriveModal() {
94
94
  //#endregion
95
95
  export { AddDriveModal };
96
96
 
97
- //# sourceMappingURL=AddDriveModal-D_3jDwjp.js.map
98
- //# debugId=54c6a1de-fb7e-598d-906c-a90c32cdc7d7
97
+ //# sourceMappingURL=AddDriveModal-BjgmiHJr.js.map
98
+ //# debugId=cb114064-0090-5da7-a317-5056a3e9d8b7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddDriveModal-BjgmiHJr.js","sources":["../src/generic/pages/create-drive-app-options.ts","../src/generic/modals/AddDriveModal.tsx"],"sourcesContent":["import type { AppOptions } from \"@powerhousedao/design-system/connect\";\nimport type { EditorModule } from \"document-model\";\n\n// Create Drive picker order: installed/custom apps first (rank 0), then the\n// generic explorer, then the vetra drive app last.\nconst DRIVE_APP_RANK: Record<string, number> = {\n GenericDriveExplorer: 1,\n \"vetra-drive-app\": 2,\n};\n\nexport function getCreateDriveAppOptions(\n appModules: EditorModule[] | undefined,\n): AppOptions[] {\n if (!appModules?.length) {\n return [];\n }\n\n return appModules\n .map((pkg) => ({\n id: pkg.config.id,\n name: pkg.config.name,\n sharingType: \"LOCAL\" as const,\n availableOffline: false,\n }))\n .sort((a, b) => (DRIVE_APP_RANK[a.id] ?? 0) - (DRIVE_APP_RANK[b.id] ?? 0));\n}\n","import { toast } from \"@powerhousedao/connect/services\";\nimport type {\n AddRemoteDriveInput,\n AppOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport { AddDriveModal as ConnectAddLocalDriveModal } from \"@powerhousedao/design-system/connect\";\nimport {\n addDrive,\n addRemoteDrive,\n closePHModal,\n extractDriveSlugFromPath,\n fetchDriveInfo,\n getFullReactorClient,\n getDrives,\n getPHNavigation,\n setSelectedDrive,\n useAppModules,\n usePHModal,\n waitForDocumentReady,\n getPHStore,\n} from \"@powerhousedao/reactor-browser\";\nimport { t } from \"i18next\";\nimport { getCreateDriveAppOptions } from \"../pages/create-drive-app-options.js\";\n\n// Max wait for a remote drive's initial sync before skipping navigation.\n// Safe to be generous: navigation only fires if the user is still on home.\nconst REMOTE_DRIVE_NAV_TIMEOUT_MS = 30_000;\n\nexport function AddDriveModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"addDrive\";\n const appModules = useAppModules();\n const onAddLocalDrive = async (data: AppOptions) => {\n try {\n const app = appModules?.find((a) => a.config.id === data.id);\n const newDrive = await addDrive(\n {\n id: \"\",\n slug: \"\",\n global: {\n name: data.name,\n icon: null,\n },\n local: {\n availableOffline: data.availableOffline,\n sharingType: data.sharingType.toLowerCase(),\n listeners: [],\n triggers: [],\n },\n },\n app?.config.id,\n );\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n if (!newDrive) {\n return;\n }\n\n setSelectedDrive(newDrive);\n } catch (e) {\n console.error(e);\n }\n };\n\n const onAddRemoteDrive = async (data: AddRemoteDriveInput) => {\n try {\n const driveId = await addRemoteDrive(data.url, data.id);\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n // Navigate into the drive if its initial sync lands in time.\n // Not awaited so the modal closes immediately.\n // waiting for the drive and listing drives both need the full reactor client\n const reactorClient = getFullReactorClient();\n // Only a still unselected, un-pinned (home) view gets pulled into the\n // new drive — the user may have navigated elsewhere meanwhile.\n const stillOnHome = () =>\n !getPHStore()?.selectedDriveId &&\n !extractDriveSlugFromPath(getPHNavigation().location().pathname);\n void (async () => {\n try {\n if (!reactorClient) {\n return;\n }\n await waitForDocumentReady(reactorClient, driveId, {\n timeoutMs: REMOTE_DRIVE_NAV_TIMEOUT_MS,\n });\n const drives = await getDrives(reactorClient);\n const drive = drives.find((d) => d.header.id === driveId);\n if (drive && stillOnHome()) {\n setSelectedDrive(drive);\n }\n } catch {\n // sync still in flight — the drive shows up on home once it lands\n }\n })();\n } catch (e) {\n console.error(e);\n }\n };\n async function onAddLocalDriveSubmit(data: AppOptions) {\n await onAddLocalDrive(data);\n closePHModal();\n }\n\n async function onAddRemoteDriveSubmit(data: AddRemoteDriveInput) {\n await onAddRemoteDrive(data);\n closePHModal();\n }\n\n const ready = !!appModules?.length;\n\n return (\n <ConnectAddLocalDriveModal\n open={open && ready}\n onAddLocalDrive={(data) => {\n void onAddLocalDriveSubmit(data);\n }}\n onAddRemoteDrive={(data) => {\n void onAddRemoteDriveSubmit(data);\n }}\n requestPublicDrive={(url: string) => fetchDriveInfo(url)}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n appOptions={getCreateDriveAppOptions(appModules)}\n />\n );\n}\n"],"names":["ConnectAddLocalDriveModal"],"mappings":";;;;;;;;AAKA,MAAM,iBAAyC;CAC7C,sBAAsB;CACtB,mBAAmB;AACrB;AAEA,SAAgB,yBACd,YACc;CACd,IAAI,CAAC,YAAY,QACf,OAAO,CAAC;CAGV,OAAO,WACJ,KAAK,SAAS;EACb,IAAI,IAAI,OAAO;EACf,MAAM,IAAI,OAAO;EACjB,aAAa;EACb,kBAAkB;CACpB,EAAE,CAAC,CACF,MAAM,GAAG,OAAO,eAAe,EAAE,OAAO,MAAM,eAAe,EAAE,OAAO,EAAE;AAC7E;;;ACCA,MAAM,8BAA8B;AAEpC,SAAgB,gBAAgB;CAE9B,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAC/B,MAAM,aAAa,cAAc;CACjC,MAAM,kBAAkB,OAAO,SAAqB;EAClD,IAAI;GACF,MAAM,MAAM,YAAY,MAAM,MAAM,EAAE,OAAO,OAAO,KAAK,EAAE;GAC3D,MAAM,WAAW,MAAM,SACrB;IACE,IAAI;IACJ,MAAM;IACN,QAAQ;KACN,MAAM,KAAK;KACX,MAAM;IACR;IACA,OAAO;KACL,kBAAkB,KAAK;KACvB,aAAa,KAAK,YAAY,YAAY;KAC1C,WAAW,CAAC;KACZ,UAAU,CAAC;IACb;GACF,GACA,KAAK,OAAO,EACd;GAEA,MAAM,EAAE,+BAA+B,GAAG,EACxC,MAAM,kBACR,CAAC;GAED,IAAI,CAAC,UACH;GAGF,iBAAiB,QAAQ;EAC3B,SAAS,GAAG;GACV,QAAQ,MAAM,CAAC;EACjB;CACF;CAEA,MAAM,mBAAmB,OAAO,SAA8B;EAC5D,IAAI;GACF,MAAM,UAAU,MAAM,eAAe,KAAK,KAAK,KAAK,EAAE;GAEtD,MAAM,EAAE,+BAA+B,GAAG,EACxC,MAAM,kBACR,CAAC;GAKD,MAAM,gBAAgB,qBAAqB;GAG3C,MAAM,oBACJ,CAAC,WAAW,CAAC,EAAE,mBACf,CAAC,yBAAyB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ;GACjE,CAAM,YAAY;IAChB,IAAI;KACF,IAAI,CAAC,eACH;KAEF,MAAM,qBAAqB,eAAe,SAAS,EACjD,WAAW,4BACb,CAAC;KAED,MAAM,SAAQ,MADO,UAAU,aAAa,EAAA,CACvB,MAAM,MAAM,EAAE,OAAO,OAAO,OAAO;KACxD,IAAI,SAAS,YAAY,GACvB,iBAAiB,KAAK;IAE1B,QAAQ,CAER;GACF,EAAA,CAAG;EACL,SAAS,GAAG;GACV,QAAQ,MAAM,CAAC;EACjB;CACF;CACA,eAAe,sBAAsB,MAAkB;EACrD,MAAM,gBAAgB,IAAI;EAC1B,aAAa;CACf;CAEA,eAAe,uBAAuB,MAA2B;EAC/D,MAAM,iBAAiB,IAAI;EAC3B,aAAa;CACf;CAEA,MAAM,QAAQ,CAAC,CAAC,YAAY;CAE5B,OACE,oBAACA,iBAAD;EACE,MAAM,QAAQ;EACd,kBAAkB,SAAS;GACzB,sBAA2B,IAAI;EACjC;EACA,mBAAmB,SAAS;GAC1B,uBAA4B,IAAI;EAClC;EACA,qBAAqB,QAAgB,eAAe,GAAG;EACvD,eAAe,WAAW;GACxB,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,YAAY,yBAAyB,UAAU;CAChD,CAAA;AAEL","debug_id":"cb114064-0090-5da7-a317-5056a3e9d8b7"}
@@ -1,13 +1,13 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ee03771-ff8c-5e4d-9619-b890425a6534")}catch(e){}}();
3
- import { t as clearReactorStorage } from "./reactor-5nod7BfF.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d765eb1f-b4cc-5c8f-b96a-d93ba937d787")}catch(e){}}();
3
+ import { t as clearReactorStorage } from "./reactor-BmI-D8O-.js";
4
4
  import { useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { closePHModal, getTargetHref, usePHModal } from "@powerhousedao/reactor-browser";
7
6
  import { ConnectConfirmationModal } from "@powerhousedao/design-system/connect";
7
+ import { closePHModal, getTargetHref, usePHModal } from "@powerhousedao/reactor-browser";
8
8
  import { childLogger } from "document-model";
9
9
  import { useTranslation } from "react-i18next";
10
- //#region src/components/modal/modals/ClearStorageModal.tsx
10
+ //#region src/generic/modals/ClearStorageModal.tsx
11
11
  const logger$1 = childLogger(["ClearStorage"]);
12
12
  function ClearStorageModal() {
13
13
  const open = usePHModal()?.type === "clearStorage";
@@ -40,5 +40,5 @@ function ClearStorageModal() {
40
40
  //#endregion
41
41
  export { ClearStorageModal };
42
42
 
43
- //# sourceMappingURL=ClearStorageModal-zZ8XzwmR.js.map
44
- //# debugId=9ee03771-ff8c-5e4d-9619-b890425a6534
43
+ //# sourceMappingURL=ClearStorageModal-_03VgDb5.js.map
44
+ //# debugId=d765eb1f-b4cc-5c8f-b96a-d93ba937d787
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClearStorageModal-_03VgDb5.js","sources":["../src/generic/modals/ClearStorageModal.tsx"],"sourcesContent":["import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n getTargetHref,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nconst logger = childLogger([\"ClearStorage\"]);\n\nexport function ClearStorageModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"clearStorage\";\n const { t } = useTranslation();\n const [loading, setLoading] = useState(false);\n\n function clearStorage() {\n setLoading(true);\n clearReactorStorage()\n .then(() => {\n logger.info(\"Storage cleared\");\n // A router writes the URL a tick later; load home directly instead.\n window.location.assign(getTargetHref(undefined));\n })\n .catch((error) => {\n logger.error(\"Error clearing storage: @error\", error);\n setLoading(false);\n });\n }\n\n return (\n <ConnectConfirmationModal\n open={open}\n header={t(\"modals.connectSettings.clearStorage.confirmation.title\")}\n body={t(\"modals.connectSettings.clearStorage.confirmation.body\")}\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\n \"modals.connectSettings.clearStorage.confirmation.clearButton\",\n )}\n onCancel={() => closePHModal()}\n onContinue={clearStorage}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n continueDisabled={loading}\n />\n );\n}\n"],"names":["logger"],"mappings":";;;;;;;;;;AAWA,MAAMA,WAAS,YAAY,CAAC,cAAc,CAAC;AAE3C,SAAgB,oBAAoB;CAElC,MAAM,OADU,WACG,CAAC,EAAE,SAAS;CAC/B,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,SAAS,eAAe;EACtB,WAAW,IAAI;EACf,oBAAoB,CAAC,CAClB,WAAW;GACV,SAAO,KAAK,iBAAiB;GAE7B,OAAO,SAAS,OAAO,cAAc,KAAA,CAAS,CAAC;EACjD,CAAC,CAAC,CACD,OAAO,UAAU;GAChB,SAAO,MAAM,kCAAkC,KAAK;GACpD,WAAW,KAAK;EAClB,CAAC;CACL;CAEA,OACE,oBAAC,0BAAD;EACQ;EACN,QAAQ,EAAE,wDAAwD;EAClE,MAAM,EAAE,uDAAuD;EAC/D,aAAa,EAAE,eAAe;EAC9B,eAAe,EACb,8DACF;EACA,gBAAgB,aAAa;EAC7B,YAAY;EACZ,eAAe,WAAoB;GACjC,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EACA,kBAAkB;CACnB,CAAA;AAEL","debug_id":"d765eb1f-b4cc-5c8f-b96a-d93ba937d787"}
@@ -1,12 +1,12 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3698fc5a-6f8d-5f1b-b024-4ee1db0dff2f")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13e2410d-aea1-51c6-968d-ad7c79f2f593")}catch(e){}}();
3
3
  import { r as toast } from "./toast-C6WW-_O-.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
- import { closePHModal, getDocumentUpgradePreview, upgradeDocument, useDocumentById, useModelRegistry, usePHModal } from "@powerhousedao/reactor-browser";
6
5
  import { ModalButton } from "@powerhousedao/design-system/connect";
6
+ import { closePHModal, getDocumentUpgradePreview, upgradeDocument, useDocumentById, useModelRegistry, usePHModal } from "@powerhousedao/reactor-browser";
7
7
  import { Modal } from "@powerhousedao/design-system";
8
8
  import { childLogger } from "document-model";
9
- //#region src/components/modal/modals/ConfirmDocumentUpgradeModal.tsx
9
+ //#region src/generic/modals/ConfirmDocumentUpgradeModal.tsx
10
10
  const logger$1 = childLogger(["ConfirmDocumentUpgradeModal"]);
11
11
  const compactButtonStyle = "min-h-0 min-w-0 flex-none rounded-lg px-6 py-1.5 text-sm whitespace-nowrap";
12
12
  function stripScope(fieldPath) {
@@ -111,5 +111,5 @@ function ConfirmDocumentUpgradeModal() {
111
111
  //#endregion
112
112
  export { ConfirmDocumentUpgradeModal };
113
113
 
114
- //# sourceMappingURL=ConfirmDocumentUpgradeModal-CrU2Z1CL.js.map
115
- //# debugId=3698fc5a-6f8d-5f1b-b024-4ee1db0dff2f
114
+ //# sourceMappingURL=ConfirmDocumentUpgradeModal-CoixS60F.js.map
115
+ //# debugId=13e2410d-aea1-51c6-968d-ad7c79f2f593
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDocumentUpgradeModal-CoixS60F.js","sources":["../src/generic/modals/ConfirmDocumentUpgradeModal.tsx"],"sourcesContent":["import { Modal } from \"@powerhousedao/design-system\";\nimport { ModalButton } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n getDocumentUpgradePreview,\n upgradeDocument,\n useDocumentById,\n useModelRegistry,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\nimport { toast } from \"@powerhousedao/connect/services\";\n\nconst logger = childLogger([\"ConfirmDocumentUpgradeModal\"]);\n\nconst compactButtonStyle =\n \"min-h-0 min-w-0 flex-none rounded-lg px-6 py-1.5 text-sm whitespace-nowrap\";\n\nfunction stripScope(fieldPath: string): string {\n const separatorIndex = fieldPath.indexOf(\".\");\n return separatorIndex === -1\n ? fieldPath\n : fieldPath.slice(separatorIndex + 1);\n}\n\nfunction FieldList({ label, fields }: { label: string; fields: string[] }) {\n return (\n <div className=\"mt-3\">\n <p className=\"mb-1.5\">{label}</p>\n <div className=\"flex flex-col items-start gap-1\">\n {fields.map((field) => (\n <span\n className=\"rounded-md bg-muted px-2 py-0.5 font-mono text-xs text-foreground\"\n key={field}\n >\n {stripScope(field)}\n </span>\n ))}\n </div>\n </div>\n );\n}\n\nexport function ConfirmDocumentUpgradeModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"confirmDocumentUpgrade\";\n const documentId = open ? phModal.documentId : undefined;\n const [document] = useDocumentById(documentId);\n const registry = useModelRegistry();\n const preview = document\n ? getDocumentUpgradePreview(document, registry)\n : undefined;\n\n if (!document || !preview) {\n return null;\n }\n\n const { fromVersion, toVersion, steps, addedFields, removedFields } = preview;\n\n const onContinue = () => {\n upgradeDocument(document.header.id).catch((error) => {\n logger.error(\"Error upgrading document: @error\", error);\n toast(\"The document could not be updated.\", { type: \"connect-warning\" });\n });\n closePHModal();\n };\n\n return (\n <Modal\n open={open}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n >\n <div className=\"w-[400px] p-6\">\n <div className=\"pb-2 text-2xl font-bold text-foreground\">\n Update document\n </div>\n <div className=\"my-4 rounded-md bg-background p-4 text-left text-sm text-foreground\">\n <p>\n This document will be updated from version {fromVersion} to version{\" \"}\n {toVersion}. Update required for the latest features.\n </p>\n {steps\n .filter((step) => step.description)\n .map((step) => (\n <p className=\"mt-2\" key={step.toVersion}>\n v{step.toVersion}: {step.description}\n </p>\n ))}\n {addedFields.length > 0 && (\n <FieldList fields={addedFields} label=\"New fields:\" />\n )}\n {removedFields.length > 0 && (\n <FieldList fields={removedFields} label=\"Removed fields:\" />\n )}\n <p className=\"mt-3\">\n Your existing content is preserved and migrated automatically. This\n update cannot be undone.\n </p>\n </div>\n <div className=\"mt-4 flex justify-between gap-3\">\n <ModalButton\n className={compactButtonStyle}\n variant=\"cancel\"\n onClick={() => closePHModal()}\n >\n Cancel\n </ModalButton>\n <ModalButton\n className={compactButtonStyle}\n variant=\"confirm\"\n onClick={onContinue}\n >\n Update document\n </ModalButton>\n </div>\n </div>\n </Modal>\n );\n}\n"],"names":["logger"],"mappings":";;;;;;;;;AAaA,MAAMA,WAAS,YAAY,CAAC,6BAA6B,CAAC;AAE1D,MAAM,qBACJ;AAEF,SAAS,WAAW,WAA2B;CAC7C,MAAM,iBAAiB,UAAU,QAAQ,GAAG;CAC5C,OAAO,mBAAmB,KACtB,YACA,UAAU,MAAM,iBAAiB,CAAC;AACxC;AAEA,SAAS,UAAU,EAAE,OAAO,UAA+C;CACzE,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,KAAD;GAAG,WAAU;GAAU,UAAA;EAAS,CAAA,GAChC,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,OAAO,KAAK,UACX,oBAAC,QAAD;IACE,WAAU;IAGT,UAAA,WAAW,KAAK;GACb,GAHC,KAGD,CACP;EACE,CAAA,CACF;;AAET;AAEA,SAAgB,8BAA8B;CAC5C,MAAM,UAAU,WAAW;CAC3B,MAAM,OAAO,SAAS,SAAS;CAC/B,MAAM,aAAa,OAAO,QAAQ,aAAa,KAAA;CAC/C,MAAM,CAAC,YAAY,gBAAgB,UAAU;CAC7C,MAAM,WAAW,iBAAiB;CAClC,MAAM,UAAU,WACZ,0BAA0B,UAAU,QAAQ,IAC5C,KAAA;CAEJ,IAAI,CAAC,YAAY,CAAC,SAChB,OAAO;CAGT,MAAM,EAAE,aAAa,WAAW,OAAO,aAAa,kBAAkB;CAEtE,MAAM,mBAAmB;EACvB,gBAAgB,SAAS,OAAO,EAAE,CAAC,CAAC,OAAO,UAAU;GACnD,SAAO,MAAM,oCAAoC,KAAK;GACtD,MAAM,sCAAsC,EAAE,MAAM,kBAAkB,CAAC;EACzE,CAAC;EACD,aAAa;CACf;CAEA,OACE,oBAAC,OAAD;EACQ;EACN,eAAe,WAAoB;GACjC,IAAI,CAAC,QAAQ,OAAO,aAAa;EACnC;EAEA,UAAA,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,oBAAC,OAAD;KAAK,WAAU;KAA0C,UAAA;IAEpD,CAAA;IACL,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,qBAAC,KAAD,EAAA,UAAA;OAAG;OAC2C;OAAY;OAAY;OACnE;OAAU;MACV,EAAA,CAAA;MACF,MACE,QAAQ,SAAS,KAAK,WAAW,CAAC,CAClC,KAAK,SACJ,qBAAC,KAAD;OAAG,WAAU;OAAb,UAAA;QAAyC;QACrC,KAAK;QAAU;QAAG,KAAK;OACxB;MAFsB,GAAA,KAAK,SAE3B,CACJ;MACF,YAAY,SAAS,KACpB,oBAAC,WAAD;OAAW,QAAQ;OAAa,OAAM;MAAe,CAAA;MAEtD,cAAc,SAAS,KACtB,oBAAC,WAAD;OAAW,QAAQ;OAAe,OAAM;MAAmB,CAAA;MAE7D,oBAAC,KAAD;OAAG,WAAU;OAAO,UAAA;MAGjB,CAAA;KACA;;IACL,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,aAAD;MACE,WAAW;MACX,SAAQ;MACR,eAAe,aAAa;MAC7B,UAAA;KAEY,CAAA,GACb,oBAAC,aAAD;MACE,WAAW;MACX,SAAQ;MACR,SAAS;MACV,UAAA;KAEY,CAAA,CACV;;GACF;;CACA,CAAA;AAEX","debug_id":"13e2410d-aea1-51c6-968d-ad7c79f2f593"}
@@ -1,8 +1,8 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0216c04d-1650-57da-b6df-6c89e48eb12c")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="89c4d494-7246-5ca4-bc1f-469a97842c7d")}catch(e){}}();
3
3
  import { jsx } from "react/jsx-runtime";
4
- import { closePHModal, usePHModal } from "@powerhousedao/reactor-browser";
5
4
  import { ReadRequiredModal } from "@powerhousedao/design-system/connect";
5
+ import { closePHModal, usePHModal } from "@powerhousedao/reactor-browser";
6
6
  import { Trans, useTranslation } from "react-i18next";
7
7
  //#region src/components/modal/modals/CookiesPolicyModal.tsx
8
8
  const CookiesPolicyModal = () => {
@@ -29,5 +29,5 @@ const CookiesPolicyModal = () => {
29
29
  //#endregion
30
30
  export { CookiesPolicyModal };
31
31
 
32
- //# sourceMappingURL=CookiesPolicyModal-DQwsgDI9.js.map
33
- //# debugId=0216c04d-1650-57da-b6df-6c89e48eb12c
32
+ //# sourceMappingURL=CookiesPolicyModal-BpFjYc7T.js.map
33
+ //# debugId=89c4d494-7246-5ca4-bc1f-469a97842c7d