@vertesia/ui 1.6.0-dev.20260918.090710Z → 1.6.0-dev.20260923.085325Z

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 (288) hide show
  1. package/lib/boot/branding.d.ts +13 -0
  2. package/lib/boot/branding.d.ts.map +1 -1
  3. package/lib/boot/branding.js +7 -0
  4. package/lib/boot/branding.js.map +1 -1
  5. package/lib/boot/index.d.ts +1 -1
  6. package/lib/boot/index.d.ts.map +1 -1
  7. package/lib/boot/index.js +5 -23
  8. package/lib/boot/index.js.map +1 -1
  9. package/lib/boot/loading.d.ts +4 -0
  10. package/lib/boot/loading.d.ts.map +1 -0
  11. package/lib/boot/loading.js +28 -0
  12. package/lib/boot/loading.js.map +1 -0
  13. package/lib/core/components/SelectList.d.ts.map +1 -1
  14. package/lib/core/components/SelectList.js +3 -3
  15. package/lib/core/components/SelectList.js.map +1 -1
  16. package/lib/core/components/SidePanel.d.ts.map +1 -1
  17. package/lib/core/components/SidePanel.js +2 -1
  18. package/lib/core/components/SidePanel.js.map +1 -1
  19. package/lib/core/components/shadcn/theme/ThemeProvider.d.ts.map +1 -1
  20. package/lib/core/components/shadcn/theme/ThemeProvider.js +21 -5
  21. package/lib/core/components/shadcn/theme/ThemeProvider.js.map +1 -1
  22. package/lib/env/index.d.ts +11 -0
  23. package/lib/env/index.d.ts.map +1 -1
  24. package/lib/env/index.js +16 -3
  25. package/lib/env/index.js.map +1 -1
  26. package/lib/features/agent/chat/ModernAgentConversation.js +4 -1
  27. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  28. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +5 -1
  29. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
  30. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +9 -2
  31. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  32. package/lib/features/magic-pdf/GroundedExtractionView.js +3 -3
  33. package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -1
  34. package/lib/features/media-viewer/AudioPanel.d.ts +10 -2
  35. package/lib/features/media-viewer/AudioPanel.d.ts.map +1 -1
  36. package/lib/features/media-viewer/AudioPanel.js +78 -13
  37. package/lib/features/media-viewer/AudioPanel.js.map +1 -1
  38. package/lib/features/oauth/McpConnectionsButton.d.ts +2 -2
  39. package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
  40. package/lib/features/oauth/McpConnectionsButton.js +9 -7
  41. package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
  42. package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -1
  43. package/lib/features/oauth/McpConnectionsDialog.js +7 -3
  44. package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
  45. package/lib/features/oauth/useMcpConnections.d.ts +4 -2
  46. package/lib/features/oauth/useMcpConnections.d.ts.map +1 -1
  47. package/lib/features/oauth/useMcpConnections.js +15 -9
  48. package/lib/features/oauth/useMcpConnections.js.map +1 -1
  49. package/lib/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
  50. package/lib/features/store/objects/selection/ObjectsActionContext.js +2 -0
  51. package/lib/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
  52. package/lib/features/store/objects/selection/SelectionActions.d.ts +4 -2
  53. package/lib/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
  54. package/lib/features/store/objects/selection/SelectionActions.js +6 -3
  55. package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
  56. package/lib/features/store/objects/selection/actions/StartWorkflowAction.d.ts +4 -0
  57. package/lib/features/store/objects/selection/actions/StartWorkflowAction.d.ts.map +1 -0
  58. package/lib/features/store/objects/selection/actions/StartWorkflowAction.js +81 -0
  59. package/lib/features/store/objects/selection/actions/StartWorkflowAction.js.map +1 -0
  60. package/lib/features/store/objects/selection/actions/index.d.ts +1 -0
  61. package/lib/features/store/objects/selection/actions/index.d.ts.map +1 -1
  62. package/lib/features/store/objects/selection/actions/index.js +1 -0
  63. package/lib/features/store/objects/selection/actions/index.js.map +1 -1
  64. package/lib/features/store/types/TypeRegistry.d.ts +345 -155
  65. package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
  66. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +345 -155
  67. package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
  68. package/lib/i18n/locales/ar.json +10 -2
  69. package/lib/i18n/locales/de.json +6 -2
  70. package/lib/i18n/locales/en.json +6 -2
  71. package/lib/i18n/locales/es.json +6 -2
  72. package/lib/i18n/locales/fr.json +7 -2
  73. package/lib/i18n/locales/it.json +6 -2
  74. package/lib/i18n/locales/ja.json +6 -2
  75. package/lib/i18n/locales/ko.json +6 -2
  76. package/lib/i18n/locales/pt.json +6 -2
  77. package/lib/i18n/locales/ru.json +8 -2
  78. package/lib/i18n/locales/tr.json +6 -2
  79. package/lib/i18n/locales/zh-TW.json +6 -2
  80. package/lib/i18n/locales/zh.json +6 -2
  81. package/lib/session/UserSession.d.ts +3 -0
  82. package/lib/session/UserSession.d.ts.map +1 -1
  83. package/lib/session/UserSession.js +18 -8
  84. package/lib/session/UserSession.js.map +1 -1
  85. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  86. package/lib/session/UserSessionProvider.js +34 -24
  87. package/lib/session/UserSessionProvider.js.map +1 -1
  88. package/lib/session/auth/authRoundTrip.d.ts +8 -0
  89. package/lib/session/auth/authRoundTrip.d.ts.map +1 -0
  90. package/lib/session/auth/authRoundTrip.js +22 -0
  91. package/lib/session/auth/authRoundTrip.js.map +1 -0
  92. package/lib/session/auth/composable.d.ts.map +1 -1
  93. package/lib/session/auth/composable.js +9 -7
  94. package/lib/session/auth/composable.js.map +1 -1
  95. package/lib/session/auth/domainRouting.d.ts +13 -6
  96. package/lib/session/auth/domainRouting.d.ts.map +1 -1
  97. package/lib/session/auth/domainRouting.js +2 -21
  98. package/lib/session/auth/domainRouting.js.map +1 -1
  99. package/lib/session/auth/oauth.d.ts +6 -1
  100. package/lib/session/auth/oauth.d.ts.map +1 -1
  101. package/lib/session/auth/oauth.js +145 -8
  102. package/lib/session/auth/oauth.js.map +1 -1
  103. package/lib/session/auth/tokenIssuer.d.ts +3 -0
  104. package/lib/session/auth/tokenIssuer.d.ts.map +1 -0
  105. package/lib/session/auth/tokenIssuer.js +27 -0
  106. package/lib/session/auth/tokenIssuer.js.map +1 -0
  107. package/lib/session/auth/vertesiaHosts.d.ts +47 -0
  108. package/lib/session/auth/vertesiaHosts.d.ts.map +1 -0
  109. package/lib/session/auth/vertesiaHosts.js +79 -0
  110. package/lib/session/auth/vertesiaHosts.js.map +1 -0
  111. package/lib/session/index.d.ts +1 -0
  112. package/lib/session/index.d.ts.map +1 -1
  113. package/lib/session/index.js +1 -0
  114. package/lib/session/index.js.map +1 -1
  115. package/lib/shell/AuthScreenPreview.d.ts +1 -1
  116. package/lib/shell/AuthScreenPreview.d.ts.map +1 -1
  117. package/lib/shell/AuthScreenPreview.js +2 -5
  118. package/lib/shell/AuthScreenPreview.js.map +1 -1
  119. package/lib/shell/BrandedAuthScreens.d.ts +1 -4
  120. package/lib/shell/BrandedAuthScreens.d.ts.map +1 -1
  121. package/lib/shell/BrandedAuthScreens.js +5 -26
  122. package/lib/shell/BrandedAuthScreens.js.map +1 -1
  123. package/lib/shell/BrandedLoadingIndicator.d.ts +11 -0
  124. package/lib/shell/BrandedLoadingIndicator.d.ts.map +1 -0
  125. package/lib/shell/BrandedLoadingIndicator.js +27 -0
  126. package/lib/shell/BrandedLoadingIndicator.js.map +1 -0
  127. package/lib/shell/SplashScreen.d.ts.map +1 -1
  128. package/lib/shell/SplashScreen.js +2 -1
  129. package/lib/shell/SplashScreen.js.map +1 -1
  130. package/lib/shell/apps/AppInstallationProvider.d.ts +16 -4
  131. package/lib/shell/apps/AppInstallationProvider.d.ts.map +1 -1
  132. package/lib/shell/apps/iframe-auth.d.ts +2 -0
  133. package/lib/shell/apps/iframe-auth.d.ts.map +1 -1
  134. package/lib/shell/apps/iframe-auth.js +6 -2
  135. package/lib/shell/apps/iframe-auth.js.map +1 -1
  136. package/lib/shell/index.d.ts +1 -0
  137. package/lib/shell/index.d.ts.map +1 -1
  138. package/lib/shell/index.js +1 -0
  139. package/lib/shell/index.js.map +1 -1
  140. package/lib/shell/login/SignInAuthPending.js +2 -2
  141. package/lib/shell/login/SignInAuthPending.js.map +1 -1
  142. package/lib/shell/login/SignInEmailStep.d.ts.map +1 -1
  143. package/lib/shell/login/SignInEmailStep.js +2 -2
  144. package/lib/shell/login/SignInEmailStep.js.map +1 -1
  145. package/lib/shell/login/TerminalLogin.d.ts.map +1 -1
  146. package/lib/shell/login/TerminalLogin.js +28 -21
  147. package/lib/shell/login/TerminalLogin.js.map +1 -1
  148. package/lib/vertesia-ui-boot.js +33 -29
  149. package/lib/vertesia-ui-boot.js.map +1 -1
  150. package/lib/vertesia-ui-core.js +34 -34
  151. package/lib/vertesia-ui-core.js.map +1 -1
  152. package/lib/vertesia-ui-env.js +1 -1
  153. package/lib/vertesia-ui-env.js.map +1 -1
  154. package/lib/vertesia-ui-features.js +163 -163
  155. package/lib/vertesia-ui-features.js.map +1 -1
  156. package/lib/vertesia-ui-i18n.Bl8KeZUK.chunk.js +5 -0
  157. package/lib/vertesia-ui-i18n.Bl8KeZUK.chunk.js.map +1 -0
  158. package/lib/vertesia-ui-i18n.BmT06XFI.chunk.js +5 -0
  159. package/lib/vertesia-ui-i18n.BmT06XFI.chunk.js.map +1 -0
  160. package/lib/vertesia-ui-i18n.Ch-Jjj0L.chunk.js +5 -0
  161. package/lib/vertesia-ui-i18n.Ch-Jjj0L.chunk.js.map +1 -0
  162. package/lib/vertesia-ui-i18n.CjhloW9s.chunk.js +5 -0
  163. package/lib/vertesia-ui-i18n.CjhloW9s.chunk.js.map +1 -0
  164. package/lib/vertesia-ui-i18n.CkfHdQzY.chunk.js +5 -0
  165. package/lib/vertesia-ui-i18n.CkfHdQzY.chunk.js.map +1 -0
  166. package/lib/vertesia-ui-i18n.DFuKfTe1.chunk.js +5 -0
  167. package/lib/vertesia-ui-i18n.DFuKfTe1.chunk.js.map +1 -0
  168. package/lib/vertesia-ui-i18n.DHqNVekZ.chunk.js +5 -0
  169. package/lib/vertesia-ui-i18n.DHqNVekZ.chunk.js.map +1 -0
  170. package/lib/vertesia-ui-i18n.DOaKbmaj.chunk.js +5 -0
  171. package/lib/vertesia-ui-i18n.DOaKbmaj.chunk.js.map +1 -0
  172. package/lib/vertesia-ui-i18n.Dge3Gl-h.chunk.js +5 -0
  173. package/lib/vertesia-ui-i18n.Dge3Gl-h.chunk.js.map +1 -0
  174. package/lib/vertesia-ui-i18n.GLt-10Lx.chunk.js +5 -0
  175. package/lib/vertesia-ui-i18n.GLt-10Lx.chunk.js.map +1 -0
  176. package/lib/vertesia-ui-i18n.T-XtAGbw.chunk.js +5 -0
  177. package/lib/vertesia-ui-i18n.T-XtAGbw.chunk.js.map +1 -0
  178. package/lib/vertesia-ui-i18n.VOJyTpMM.chunk.js +5 -0
  179. package/lib/vertesia-ui-i18n.VOJyTpMM.chunk.js.map +1 -0
  180. package/lib/vertesia-ui-i18n.js +3 -3
  181. package/lib/vertesia-ui-i18n.js.map +1 -1
  182. package/lib/vertesia-ui-layout.js +15 -15
  183. package/lib/vertesia-ui-layout.js.map +1 -1
  184. package/lib/vertesia-ui-rich-text.js +44 -44
  185. package/lib/vertesia-ui-rich-text.js.map +1 -1
  186. package/lib/vertesia-ui-session.js +1 -1
  187. package/lib/vertesia-ui-session.js.map +1 -1
  188. package/lib/vertesia-ui-shell.js +72 -48
  189. package/lib/vertesia-ui-shell.js.map +1 -1
  190. package/lib/vertesia-ui-widgets.js +51 -51
  191. package/lib/vertesia-ui-widgets.js.map +1 -1
  192. package/package.json +19 -19
  193. package/src/boot/branding.ts +8 -0
  194. package/src/boot/index.ts +6 -23
  195. package/src/boot/loading.ts +27 -0
  196. package/src/core/components/SelectList.tsx +5 -2
  197. package/src/core/components/SidePanel.tsx +65 -60
  198. package/src/core/components/shadcn/theme/ThemeProvider.test.tsx +101 -0
  199. package/src/core/components/shadcn/theme/ThemeProvider.tsx +21 -9
  200. package/src/env/index.test.ts +21 -0
  201. package/src/env/index.ts +33 -2
  202. package/src/features/agent/chat/ModernAgentConversation.test.tsx +81 -0
  203. package/src/features/agent/chat/ModernAgentConversation.tsx +5 -0
  204. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +17 -1
  205. package/src/features/magic-pdf/GroundedExtractionView.tsx +3 -3
  206. package/src/features/media-viewer/AudioPanel.test.ts +84 -0
  207. package/src/features/media-viewer/AudioPanel.tsx +97 -14
  208. package/src/features/oauth/McpConnectionsButton.test.tsx +56 -0
  209. package/src/features/oauth/McpConnectionsButton.tsx +9 -6
  210. package/src/features/oauth/McpConnectionsDialog.tsx +14 -5
  211. package/src/features/oauth/useMcpConnections.test.ts +10 -0
  212. package/src/features/oauth/useMcpConnections.ts +18 -10
  213. package/src/features/store/objects/selection/ObjectsActionContext.tsx +2 -0
  214. package/src/features/store/objects/selection/SelectionActions.tsx +13 -6
  215. package/src/features/store/objects/selection/actions/StartWorkflowAction.tsx +162 -0
  216. package/src/features/store/objects/selection/actions/index.ts +1 -0
  217. package/src/i18n/locales/ar.json +10 -2
  218. package/src/i18n/locales/de.json +6 -2
  219. package/src/i18n/locales/en.json +6 -2
  220. package/src/i18n/locales/es.json +6 -2
  221. package/src/i18n/locales/fr.json +7 -2
  222. package/src/i18n/locales/it.json +6 -2
  223. package/src/i18n/locales/ja.json +6 -2
  224. package/src/i18n/locales/ko.json +6 -2
  225. package/src/i18n/locales/pt.json +6 -2
  226. package/src/i18n/locales/ru.json +8 -2
  227. package/src/i18n/locales/tr.json +6 -2
  228. package/src/i18n/locales/zh-TW.json +6 -2
  229. package/src/i18n/locales/zh.json +6 -2
  230. package/src/session/UserSession.test.ts +48 -3
  231. package/src/session/UserSession.ts +20 -8
  232. package/src/session/UserSessionProvider.handoff.test.tsx +103 -0
  233. package/src/session/UserSessionProvider.iframe.test.tsx +178 -0
  234. package/src/session/UserSessionProvider.state-mismatch.test.tsx +43 -0
  235. package/src/session/UserSessionProvider.tsx +35 -23
  236. package/src/session/auth/auth-flow.md +18 -5
  237. package/src/session/auth/authRoundTrip.ts +24 -0
  238. package/src/session/auth/composable.test.ts +23 -1
  239. package/src/session/auth/composable.ts +10 -8
  240. package/src/session/auth/domainRouting.ts +4 -25
  241. package/src/session/auth/oauth.test.ts +121 -4
  242. package/src/session/auth/oauth.ts +172 -11
  243. package/src/session/auth/tokenIssuer.test.ts +25 -0
  244. package/src/session/auth/tokenIssuer.ts +25 -0
  245. package/src/session/auth/vertesiaHosts.test.ts +26 -0
  246. package/src/session/auth/vertesiaHosts.ts +85 -0
  247. package/src/session/index.ts +1 -0
  248. package/src/shell/AuthScreenPreview.tsx +2 -6
  249. package/src/shell/BrandedAuthScreens.test.tsx +26 -0
  250. package/src/shell/BrandedAuthScreens.tsx +4 -40
  251. package/src/shell/BrandedLoadingIndicator.tsx +42 -0
  252. package/src/shell/SplashScreen.tsx +4 -4
  253. package/src/shell/apps/iframe-auth.test.ts +8 -11
  254. package/src/shell/apps/iframe-auth.ts +10 -1
  255. package/src/shell/index.tsx +1 -0
  256. package/src/shell/login/SignInAuthPending.tsx +2 -2
  257. package/src/shell/login/SignInEmailStep.tsx +4 -2
  258. package/src/shell/login/TerminalLogin.test.tsx +111 -0
  259. package/src/shell/login/TerminalLogin.tsx +61 -37
  260. package/lib/features/store/objects/selection/actions/StartWorkflowButton.d.ts +0 -7
  261. package/lib/features/store/objects/selection/actions/StartWorkflowButton.d.ts.map +0 -1
  262. package/lib/features/store/objects/selection/actions/StartWorkflowButton.js +0 -51
  263. package/lib/features/store/objects/selection/actions/StartWorkflowButton.js.map +0 -1
  264. package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js +0 -5
  265. package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js.map +0 -1
  266. package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js +0 -5
  267. package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js.map +0 -1
  268. package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js +0 -5
  269. package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js.map +0 -1
  270. package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js +0 -5
  271. package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js.map +0 -1
  272. package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js +0 -5
  273. package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js.map +0 -1
  274. package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js +0 -5
  275. package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js.map +0 -1
  276. package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js +0 -5
  277. package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js.map +0 -1
  278. package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js +0 -5
  279. package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js.map +0 -1
  280. package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js +0 -5
  281. package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js.map +0 -1
  282. package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js +0 -5
  283. package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js.map +0 -1
  284. package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js +0 -5
  285. package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js.map +0 -1
  286. package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js +0 -5
  287. package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js.map +0 -1
  288. package/src/features/store/objects/selection/actions/StartWorkflowButton.tsx +0 -104
@@ -1,2 +1,2 @@
1
- function e(){if(typeof window>`u`)return;let e=window.__VERTESIA_RUNTIME_CONFIG__;if(e?.authMode===`central`)return e;if(e?.authMode!==`firebase`)return;let t=e.firebase;if(t?.apiKey&&t.authDomain&&t.projectId&&t.appId)return e}function t(e){if(!e)return;let t=t=>typeof e[t]==`string`?e[t].trim():``,n=t(`VITE_AUTH_MODE`);if(n&&n!==`firebase`&&n!==`central`)throw Error(`VITE_AUTH_MODE must be firebase or central`);if(!n)return;if(n===`central`)return{authMode:`central`};let r={apiKey:`VITE_FIREBASE_API_KEY`,authDomain:`VITE_FIREBASE_AUTH_DOMAIN`,projectId:`VITE_FIREBASE_PROJECT_ID`,appId:`VITE_FIREBASE_APP_ID`},i=Object.values(r).filter(e=>!t(e));if(i.length)throw Error(`Firebase authentication requires: ${i.join(`, `)}`);return{authMode:`firebase`,firebase:{apiKey:t(r.apiKey),authDomain:t(r.authDomain),projectId:t(r.projectId),appId:t(r.appId)}}}var n=class{_props;constructor(e){this._props=e}init(n,r){let i=e()??t(r),a=i?.authMode===`firebase`?i.firebase:void 0;this._props=n&&a&&!n.firebase?{...n,firebase:a}:n;let o=i?.authMode===`central`?i.authUrl?.trim():void 0;this._props&&o&&(this._props={...this._props,endpoints:{...this._props.endpoints,auth:o}});let s=typeof r?.VITE_FIREBASE_TENANT_ID==`string`?r.VITE_FIREBASE_TENANT_ID.trim():``;if(this._props?.firebase&&s&&!this._props.firebase.tenantId&&(this._props={...this._props,firebase:{...this._props.firebase,tenantId:s}}),this._props&&this._props.defaultAuthSelection===void 0&&r){let e=typeof r.VITE_VERTESIA_ACCOUNT_ID==`string`&&r.VITE_VERTESIA_ACCOUNT_ID.trim()||void 0,t=typeof r.VITE_VERTESIA_PROJECT_ID==`string`&&r.VITE_VERTESIA_PROJECT_ID.trim()||void 0;(e||t)&&(this._props={...this._props,defaultAuthSelection:{accountId:e,projectId:t}})}return i&&typeof window<`u`&&window.AUTH_MODE===void 0&&(window.AUTH_MODE=i.authMode),this}prop(e){if(!this._props)throw Error(`VertesiaEnvironment was not initialized`);return this._props[e]}get version(){return this.prop(`version`)}get commitTimestamp(){return this._props?.commitTimestamp}get sdkVersion(){return this._props?.sdkVersion}get name(){return this.prop(`name`)}get type(){return this.prop(`type`)}get isProd(){return this.type===`production`||this.type===`preview`}get isDev(){return!this.isProd}get isLocalDev(){return this.prop(`isLocalDev`)}get isDocker(){return this.prop(`isDocker`)}get endpoints(){return this.prop(`endpoints`)}get firebase(){return this.prop(`firebase`)}get region(){return this._props?.region}get datadog(){return this.datadogRum}get datadogRum(){return this._props?.datadogRum??!1}get datadogLogs(){return this._props?.datadogLogs??!1}get devAuthToken(){return this._props?.devAuthToken}get defaultAuthSelection(){return this._props?.defaultAuthSelection}get oauth(){return this._props?.oauth}get authTokenProvider(){return this._props?.authTokenProvider}get logger(){return this._props?.logger??console}onLogin(e){this._props?.onLogin?.(e)}onLogout(){this._props?.onLogout?.()}};const r=new n;export{r as Env,n as VertesiaEnvironment};
1
+ const e=/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,t=`[a-z0-9](?:[a-z0-9-]*[a-z0-9])?`,n=`(?:${t}\\.)?`,r=[RegExp(`^cloud\\.${n}vertesia\\.io$`),RegExp(`^${t}\\.cloud\\.${n}vertesia\\.io$`),RegExp(`^${t}\\.ui\\.${t}\\.vertesia\\.io$`)],i=[RegExp(`^apps(?:-preview|-preprod)?\\.${n}vertesia\\.io$`),RegExp(`^app-gateway-${t}\\.api\\.${t}\\.vertesia\\.io$`)];function a(t){return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`?!0:e.test(t)}function o(e){return e.toLowerCase().replace(/\.$/,``)}const s=[RegExp(`^auth\\.${n}vertesia\\.io$`)];function c(e,t={}){try{let n=new URL(e),r=o(n.hostname);return n.username||n.password||n.search||n.hash||n.pathname!==`/`?!1:t.allowLoopback&&a(r)?n.protocol===`http:`||n.protocol===`https:`:n.protocol===`https:`&&!n.port&&s.some(e=>e.test(r))}catch{return!1}}function l(){if(typeof window>`u`)return;let e=window.__VERTESIA_RUNTIME_CONFIG__;if(e?.authMode===`central`)return e;if(e?.authMode!==`firebase`)return;let t=e.firebase;if(t?.apiKey&&t.authDomain&&t.projectId&&t.appId)return e}function u(e){if(!e)return;let t=t=>typeof e[t]==`string`?e[t].trim():``,n=t(`VITE_AUTH_MODE`);if(n&&n!==`firebase`&&n!==`central`)throw Error(`VITE_AUTH_MODE must be firebase or central`);if(!n)return;if(n===`central`)return{authMode:`central`};let r={apiKey:`VITE_FIREBASE_API_KEY`,authDomain:`VITE_FIREBASE_AUTH_DOMAIN`,projectId:`VITE_FIREBASE_PROJECT_ID`,appId:`VITE_FIREBASE_APP_ID`},i=Object.values(r).filter(e=>!t(e));if(i.length)throw Error(`Firebase authentication requires: ${i.join(`, `)}`);return{authMode:`firebase`,firebase:{apiKey:t(r.apiKey),authDomain:t(r.authDomain),projectId:t(r.projectId),appId:t(r.appId)}}}var d=class{_props;constructor(e){this._props=e}init(e,t){let n=l()??u(t),r=n?.authMode===`firebase`?n.firebase:void 0;this._props=e&&r&&!e.firebase?{...e,firebase:r}:e;let i=n?.authMode===`central`?n.authUrl?.trim():void 0;this._props&&i&&c(i,{allowLoopback:this._props.isLocalDev})&&(this._props={...this._props,endpoints:{...this._props.endpoints,auth:i}}),this._props&&n?.authMode===`central`&&n.oauth&&(this._props={...this._props,oauth:n.oauth,endpoints:{...this._props.endpoints,...n.endpoints}}),this._props&&n?.allowLegacyIframeAuth!==void 0&&(this._props={...this._props,allowLegacyIframeAuth:n.allowLegacyIframeAuth});let a=typeof t?.VITE_FIREBASE_TENANT_ID==`string`?t.VITE_FIREBASE_TENANT_ID.trim():``;if(this._props?.firebase&&a&&!this._props.firebase.tenantId&&(this._props={...this._props,firebase:{...this._props.firebase,tenantId:a}}),this._props&&this._props.defaultAuthSelection===void 0&&t){let e=typeof t.VITE_VERTESIA_ACCOUNT_ID==`string`&&t.VITE_VERTESIA_ACCOUNT_ID.trim()||void 0,n=typeof t.VITE_VERTESIA_PROJECT_ID==`string`&&t.VITE_VERTESIA_PROJECT_ID.trim()||void 0;(e||n)&&(this._props={...this._props,defaultAuthSelection:{accountId:e,projectId:n}})}return n&&typeof window<`u`&&window.AUTH_MODE===void 0&&(window.AUTH_MODE=n.authMode),this}prop(e){if(!this._props)throw Error(`VertesiaEnvironment was not initialized`);return this._props[e]}get version(){return this.prop(`version`)}get commitTimestamp(){return this._props?.commitTimestamp}get sdkVersion(){return this._props?.sdkVersion}get name(){return this.prop(`name`)}get type(){return this.prop(`type`)}get isProd(){return this.type===`production`||this.type===`preview`}get isDev(){return!this.isProd}get isLocalDev(){return this.prop(`isLocalDev`)}get isDocker(){return this.prop(`isDocker`)}get endpoints(){return this.prop(`endpoints`)}get firebase(){return this.prop(`firebase`)}get region(){return this._props?.region}get datadog(){return this.datadogRum}get datadogRum(){return this._props?.datadogRum??!1}get datadogLogs(){return this._props?.datadogLogs??!1}get devAuthToken(){return this._props?.devAuthToken}get defaultAuthSelection(){return this._props?.defaultAuthSelection}get allowLegacyIframeAuth(){return this._props?.allowLegacyIframeAuth??!1}get oauth(){return this._props?.oauth}get authTokenProvider(){return this._props?.authTokenProvider}get logger(){return this._props?.logger??console}onLogin(e){this._props?.onLogin?.(e)}onLogout(){this._props?.onLogout?.()}};const f=new d;export{f as Env,r as FIRST_PARTY_HOST_PATTERNS,i as GATEWAY_HOST_PATTERNS,d as VertesiaEnvironment,a as isLoopbackHostname,c as isTrustedAuthBrokerUrl,o as normalizeHostname};
2
2
  //# sourceMappingURL=vertesia-ui-env.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vertesia-ui-env.js","names":[],"sources":["env/index.js"],"sourcesContent":["// hook to initialize the environment and auth session\n// the main app must call this hook before rendering the page.\nfunction injectedRuntimeConfig() {\n if (typeof window === 'undefined')\n return undefined;\n const runtimeConfig = window.__VERTESIA_RUNTIME_CONFIG__;\n if (runtimeConfig?.authMode === 'central')\n return runtimeConfig;\n if (runtimeConfig?.authMode !== 'firebase')\n return undefined;\n const firebase = runtimeConfig.firebase;\n if (!firebase?.apiKey || !firebase.authDomain || !firebase.projectId || !firebase.appId)\n return undefined;\n return runtimeConfig;\n}\nfunction buildRuntimeConfig(env) {\n if (!env)\n return undefined;\n const value = (name) => (typeof env[name] === 'string' ? env[name].trim() : '');\n const mode = value('VITE_AUTH_MODE');\n if (mode && mode !== 'firebase' && mode !== 'central') {\n throw new Error('VITE_AUTH_MODE must be firebase or central');\n }\n // Firebase build settings are only consumed after an explicit opt-in.\n if (!mode)\n return undefined;\n if (mode === 'central')\n return { authMode: 'central' };\n const fields = {\n apiKey: 'VITE_FIREBASE_API_KEY',\n authDomain: 'VITE_FIREBASE_AUTH_DOMAIN',\n projectId: 'VITE_FIREBASE_PROJECT_ID',\n appId: 'VITE_FIREBASE_APP_ID',\n };\n const missing = Object.values(fields).filter((name) => !value(name));\n if (missing.length) {\n throw new Error(`Firebase authentication requires: ${missing.join(', ')}`);\n }\n return {\n authMode: 'firebase',\n firebase: {\n apiKey: value(fields.apiKey),\n authDomain: value(fields.authDomain),\n projectId: value(fields.projectId),\n appId: value(fields.appId),\n },\n };\n}\nexport class VertesiaEnvironment {\n _props;\n constructor(_props) {\n this._props = _props;\n }\n init(props, buildEnv) {\n // Host runtime configuration takes precedence over static deployment defaults.\n const runtimeConfig = injectedRuntimeConfig() ?? buildRuntimeConfig(buildEnv);\n const runtimeFirebase = runtimeConfig?.authMode === 'firebase' ? runtimeConfig.firebase : undefined;\n this._props = props && runtimeFirebase && !props.firebase ? { ...props, firebase: runtimeFirebase } : props;\n const authUrl = runtimeConfig?.authMode === 'central' ? runtimeConfig.authUrl?.trim() : undefined;\n if (this._props && authUrl) {\n this._props = { ...this._props, endpoints: { ...this._props.endpoints, auth: authUrl } };\n }\n const tenantId = typeof buildEnv?.VITE_FIREBASE_TENANT_ID === 'string' ? buildEnv.VITE_FIREBASE_TENANT_ID.trim() : '';\n if (this._props?.firebase && tenantId && !this._props.firebase.tenantId) {\n this._props = { ...this._props, firebase: { ...this._props.firebase, tenantId } };\n }\n if (this._props && this._props.defaultAuthSelection === undefined && buildEnv) {\n const accountId = typeof buildEnv.VITE_VERTESIA_ACCOUNT_ID === 'string'\n ? buildEnv.VITE_VERTESIA_ACCOUNT_ID.trim() || undefined\n : undefined;\n const projectId = typeof buildEnv.VITE_VERTESIA_PROJECT_ID === 'string'\n ? buildEnv.VITE_VERTESIA_PROJECT_ID.trim() || undefined\n : undefined;\n if (accountId || projectId)\n this._props = { ...this._props, defaultAuthSelection: { accountId, projectId } };\n }\n if (runtimeConfig && typeof window !== 'undefined' && window.AUTH_MODE === undefined) {\n window.AUTH_MODE = runtimeConfig.authMode;\n }\n return this;\n }\n prop(name) {\n if (!this._props) {\n throw new Error('VertesiaEnvironment was not initialized');\n }\n return this._props[name];\n }\n get version() {\n return this.prop('version');\n }\n get commitTimestamp() {\n return this._props?.commitTimestamp;\n }\n get sdkVersion() {\n return this._props?.sdkVersion;\n }\n get name() {\n return this.prop('name');\n }\n get type() {\n return this.prop('type');\n }\n get isProd() {\n return this.type === 'production' || this.type === 'preview';\n }\n get isDev() {\n return !this.isProd;\n }\n get isLocalDev() {\n return this.prop('isLocalDev');\n }\n get isDocker() {\n return this.prop('isDocker');\n }\n get endpoints() {\n return this.prop('endpoints');\n }\n get firebase() {\n return this.prop('firebase');\n }\n get region() {\n return this._props?.region;\n }\n /**\n * @deprecated Use datadogRum and datadogLogs instead for more granular control. This will be removed in a future release. Is an alias for DatadogRUM\n *\n */\n get datadog() {\n return this.datadogRum;\n }\n get datadogRum() {\n return this._props?.datadogRum ?? false;\n }\n get datadogLogs() {\n return this._props?.datadogLogs ?? false;\n }\n get devAuthToken() {\n return this._props?.devAuthToken;\n }\n get defaultAuthSelection() {\n return this._props?.defaultAuthSelection;\n }\n get oauth() {\n return this._props?.oauth;\n }\n get authTokenProvider() {\n return this._props?.authTokenProvider;\n }\n get logger() {\n return this._props?.logger ?? console;\n }\n /**\n * Callback to notify the host app when the user logs in.\n */\n onLogin(token) {\n this._props?.onLogin?.(token);\n }\n /**\n * Callback to notify the host app when the user logs out\n */\n onLogout() {\n this._props?.onLogout?.();\n }\n}\nconst Env = new Vertesia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ACvD,CACA,IAAI,OAAQ,CACR,MAAO,CAAC,KAAK,MACjB,CACA,IAAI,YAAa,CACb,OAAO,KAAK,KAAK,YAAY,CACjC,CACA,IAAI,UAAW,CACX,OAAO,KAAK,KAAK,UAAU,CAC/B,CACA,IAAI,WAAY,CACZ,OAAO,KAAK,KAAK,WAAW,CAChC,CACA,IAAI,UAAW,CACX,OAAO,KAAK,KAAK,UAAU,CAC/B,CACA,IAAI,QAAS,CACT,OAAO,KAAK,QAAQ,MACxB,CAKA,IAAI,SAAU,CACV,OAAO,KAAK,UAChB,CACA,IAAI,YAAa,CACb,OAAO,KAAK,QAAQ,YAAc,EACtC,CACA,IAAI,aAAc,CACd,OAAO,KAAK,QAAQ,aAAe,EACvC,CACA,IAAI,cAAe,CACf,OAAO,KAAK,QAAQ,YACxB,CACA,IAAI,sBAAuB,CACvB,OAAO,KAAK,QAAQ,oBACxB,CACA,IAAI,OAAQ,CACR,OAAO,KAAK,QAAQ,KACxB,CACA,IAAI,mBAAoB,CACpB,OAAO,KAAK,QAAQ,iBACxB,CACA,IAAI,QAAS,CACT,OAAO,KAAK,QAAQ,QAAU,OAClC,CAIA,QAAQ,EAAO,CACX,KAAK,QAAQ,UAAU,CAAK,CAChC,CAIA,UAAW,CACP,KAAK,QAAQ,WAAW,CAC5B,CACJ,EACA,MAAM,EAAM,IAAI"}
1
+ {"version":3,"file":"vertesia-ui-env.js","names":[],"sources":["session/auth/vertesiaHosts.js","env/index.js"],"sourcesContent":["const LOOPBACK_IPV4 = /^127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;\n/** A single DNS label: alphanumeric, inner hyphens allowed. */\nexport const LABEL = '[a-z0-9](?:[a-z0-9-]*[a-z0-9])?';\n/** The region label is optional throughout, because each regional host has a global US alias. */\nexport const REGION = `(?:${LABEL}\\\\.)?`;\n/**\n * Hostnames served by the UI backend — Vertesia's own code, not merely a Vertesia-owned name:\n * `cloud.vertesia.io`, `cloud.us1.vertesia.io` — the Cloud UI\n * `preprod.cloud.vertesia.io`, `preview.cloud.us1.vertesia.io` — its preview/preprod tiers\n * `acme.cloud.us1.vertesia.io` — per-IdP-tenant branded hosts\n * `dev-feat-x.ui.dev1.vertesia.io` — dynamic per-branch dev envs\n *\n * Mirrors the load-balancer host rules (region-lb/main.tf: `cloud.${var.domain}`,\n * `*.cloud.${var.domain}`, `*.ui.${var.domain}`) rather than the DNS zone, so a name we merely own\n * is not trusted for what serves it.\n */\nexport const FIRST_PARTY_HOST_PATTERNS = [\n new RegExp(`^cloud\\\\.${REGION}vertesia\\\\.io$`),\n new RegExp(`^${LABEL}\\\\.cloud\\\\.${REGION}vertesia\\\\.io$`),\n new RegExp(`^${LABEL}\\\\.ui\\\\.${LABEL}\\\\.vertesia\\\\.io$`),\n];\n/**\n * Public app-gateway origins. Stable tiers use the `apps*` browser-facing host, while development\n * environments reach the gateway through its `*.api.*` Cloud Run route:\n * `apps.us1.vertesia.io`, `apps-preview.us1.vertesia.io`\n * `app-gateway-dev1.api.dev1.vertesia.io`, `app-gateway-us3.api.us3.vertesia.io`\n *\n * The second label is deliberately unconstrained. Branch environments do NOT each get a gateway —\n * they share their region's (`detectGatewayUrl` in packages/server-common/src/env/ServerEnv.ts:444\n * and `getAppgenServerBaseUrl` in packages/workflows/.../app_workspace/workspace-utils.ts), so the\n * host published to browsers is region-scoped, while the per-branch `app-gateway-dev-<branch>`\n * shape in the infrastructure README also exists. Matching `app-gateway-<anything>` covers both,\n * and every Cloud Run service named that way *is* a gateway (region-compute/main.tf:373).\n *\n * These serve every tenant's published application from one shared origin, and published assets\n * need no authentication — so this is generated, low-trust code sitting on a Vertesia-owned\n * hostname. Owning the domain is not the test; which backend serves the origin is.\n *\n * Two load-balancer variables can map further hostnames onto the same backend —\n * `appgen_host_aliases` and `appgen_preview_host_aliases` in\n * infrastructure/terraform/modules/region-lb/variables.tf. Both are empty in every region today; if\n * one is ever set, add the alias here too, or it silently falls through to the permissive branch of\n * Policy L and becomes an origin that may receive a token at any path.\n */\nexport const GATEWAY_HOST_PATTERNS = [\n new RegExp(`^apps(?:-preview|-preprod)?\\\\.${REGION}vertesia\\\\.io$`),\n new RegExp(`^app-gateway-${LABEL}\\\\.api\\\\.${LABEL}\\\\.vertesia\\\\.io$`),\n];\nexport function isLoopbackHostname(hostname) {\n if (hostname === 'localhost' || hostname.endsWith('.localhost')) {\n return true;\n }\n if (hostname === '::1' || hostname === '[::1]') {\n return true;\n }\n return LOOPBACK_IPV4.test(hostname);\n}\nexport function normalizeHostname(hostname) {\n return hostname.toLowerCase().replace(/\\.$/, '');\n}\nexport const AUTH_BROKER_HOST_PATTERNS = [new RegExp(`^auth\\\\.${REGION}vertesia\\\\.io$`)];\nexport function isTrustedAuthBrokerUrl(value, options = {}) {\n try {\n const url = new URL(value);\n const hostname = normalizeHostname(url.hostname);\n if (url.username || url.password || url.search || url.hash || url.pathname !== '/')\n return false;\n if (options.allowLoopback && isLoopbackHostname(hostname)) {\n return url.protocol === 'http:' || url.protocol === 'https:';\n }\n return (url.protocol === 'https:' &&\n !url.port &&\n AUTH_BROKER_HOST_PATTERNS.some((pattern) => pattern.test(hostname)));\n }\n catch {\n return false;\n }\n}\n//# sourceMappingURL=vertesiaHosts.js.map","import { isTrustedAuthBrokerUrl } from '../session/auth/vertesiaHosts.js';\nexport { FIRST_PARTY_HOST_PATTERNS, GATEWAY_HOST_PATTERNS, isLoopbackHostname, isTrustedAuthBrokerUrl, normalizeHostname, } from '../session/auth/vertesiaHosts.js';\nfunction injectedRuntimeConfig() {\n if (typeof window === 'undefined')\n return undefined;\n const runtimeConfig = window.__VERTESIA_RUNTIME_CONFIG__;\n if (runtimeConfig?.authMode === 'central')\n return runtimeConfig;\n if (runtimeConfig?.authMode !== 'firebase')\n return undefined;\n const firebase = runtimeConfig.firebase;\n if (!firebase?.apiKey || !firebase.authDomain || !firebase.projectId || !firebase.appId)\n return undefined;\n return runtimeConfig;\n}\nfunction buildRuntimeConfig(env) {\n if (!env)\n return undefined;\n const value = (name) => (typeof env[name] === 'string' ? env[name].trim() : '');\n const mode = value('VITE_AUTH_MODE');\n if (mode && mode !== 'firebase' && mode !== 'central') {\n throw new Error('VITE_AUTH_MODE must be firebase or central');\n }\n // Firebase build settings are only consumed after an explicit opt-in.\n if (!mode)\n return undefined;\n if (mode === 'central')\n return { authMode: 'central' };\n const fields = {\n apiKey: 'VITE_FIREBASE_API_KEY',\n authDomain: 'VITE_FIREBASE_AUTH_DOMAIN',\n projectId: 'VITE_FIREBASE_PROJECT_ID',\n appId: 'VITE_FIREBASE_APP_ID',\n };\n const missing = Object.values(fields).filter((name) => !value(name));\n if (missing.length) {\n throw new Error(`Firebase authentication requires: ${missing.join(', ')}`);\n }\n return {\n authMode: 'firebase',\n firebase: {\n apiKey: value(fields.apiKey),\n authDomain: value(fields.authDomain),\n projectId: value(fields.projectId),\n appId: value(fields.appId),\n },\n };\n}\nexport class VertesiaEnvironment {\n _props;\n constructor(_props) {\n this._props = _props;\n }\n init(props, buildEnv) {\n // Host runtime configuration takes precedence over static deployment defaults.\n const runtimeConfig = injectedRuntimeConfig() ?? buildRuntimeConfig(buildEnv);\n const runtimeFirebase = runtimeConfig?.authMode === 'firebase' ? runtimeConfig.firebase : undefined;\n this._props = props && runtimeFirebase && !props.firebase ? { ...props, firebase: runtimeFirebase } : props;\n const authUrl = runtimeConfig?.authMode === 'central' ? runtimeConfig.authUrl?.trim() : undefined;\n if (this._props && authUrl && isTrustedAuthBrokerUrl(authUrl, { allowLoopback: this._props.isLocalDev })) {\n this._props = { ...this._props, endpoints: { ...this._props.endpoints, auth: authUrl } };\n }\n if (this._props && runtimeConfig?.authMode === 'central' && runtimeConfig.oauth) {\n this._props = {\n ...this._props,\n oauth: runtimeConfig.oauth,\n endpoints: { ...this._props.endpoints, ...runtimeConfig.endpoints },\n };\n }\n if (this._props && runtimeConfig?.allowLegacyIframeAuth !== undefined) {\n this._props = { ...this._props, allowLegacyIframeAuth: runtimeConfig.allowLegacyIframeAuth };\n }\n const tenantId = typeof buildEnv?.VITE_FIREBASE_TENANT_ID === 'string' ? buildEnv.VITE_FIREBASE_TENANT_ID.trim() : '';\n if (this._props?.firebase && tenantId && !this._props.firebase.tenantId) {\n this._props = { ...this._props, firebase: { ...this._props.firebase, tenantId } };\n }\n if (this._props && this._props.defaultAuthSelection === undefined && buildEnv) {\n const accountId = typeof buildEnv.VITE_VERTESIA_ACCOUNT_ID === 'string'\n ? buildEnv.VITE_VERTESIA_ACCOUNT_ID.trim() || undefined\n : undefined;\n const projectId = typeof buildEnv.VITE_VERTESIA_PROJECT_ID === 'string'\n ? buildEnv.VITE_VERTESIA_PROJECT_ID.trim() || undefined\n : undefined;\n if (accountId || projectId)\n this._props = { ...this._props, defaultAuthSelection: { accountId, projectId } };\n }\n if (runtimeConfig && typeof window !== 'undefined' && window.AUTH_MODE === undefined) {\n window.AUTH_MODE = runtimeConfig.authMode;\n }\n return this;\n }\n prop(name) {\n if (!this._props) {\n throw new Error('VertesiaEnvironment was not initialized');\n }\n return this._props[name];\n }\n get version() {\n return this.prop('version');\n }\n get commitTimestamp() {\n return this._props?.commitTimestamp;\n }\n get sdkVersion() {\n return this._props?.sdkVersion;\n }\n get name() {\n return this.prop('name');\n }\n get type() {\n return this.prop('type');\n }\n get isProd() {\n return this.type === 'production' || this.type === 'preview';\n }\n get isDev() {\n return !this.isProd;\n }\n get isLocalDev() {\n return this.prop('isLocalDev');\n }\n get isDocker() {\n return this.prop('isDocker');\n }\n get endpoints() {\n return this.prop('endpoints');\n }\n get firebase() {\n return this.prop('firebase');\n }\n get region() {\n return this._props?.region;\n }\n /**\n * @deprecated Use datadogRum and datadogLogs instead for more granular control. This will be removed in a future release. Is an alias for DatadogRUM\n *\n */\n get datadog() {\n return this.datadogRum;\n }\n get datadogRum() {\n return this._props?.datadogRum ?? false;\n }\n get datadogLogs() {\n return this._props?.datadogLogs ?? false;\n }\n get devAuthToken() {\n return this._props?.devAuthToken;\n }\n get defaultAuthSelection() {\n return this._props?.defaultAuthSelection;\n }\n get allowLegacyIframeAuth() {\n return this._props?.allowLegacyIframeAuth ?? false;\n }\n get oauth() {\n return this._props?.oauth;\n }\n get authTokenProvider() {\n return this._props?.authTokenProvider;\n }\n get logger() {\n return this._props?.logger ?? console;\n }\n /**\n * Callback to notify the host app when the user logs in.\n */\n onLogin(token) {\n this._props?.onLogin?.(token);\n }\n /**\n * Callback to notify the host app when the user logs out\n */\n onLogout() {\n this._props?.onLogout?.();\n }\n}\nconst Env = new VertesiaEnvironment();\nexport { Env };\n//# sourceMappingURL=index.js.map"],"mappings":"AAAA,MAAM,EAAgB,mCAET,EAAQ,kCAER,EAAS,MAAM,EAAM,OAYrB,EAA4B,CACjC,OAAO,YAAY,EAAO,eAAe,EACzC,OAAO,IAAI,EAAM,aAAa,EAAO,eAAe,EACpD,OAAO,IAAI,EAAM,UAAU,EAAM,kBAAkB,CAC3D,EAwBa,EAAwB,CAC7B,OAAO,iCAAiC,EAAO,eAAe,EAC9D,OAAO,gBAAgB,EAAM,WAAW,EAAM,kBAAkB,CACxE,EACA,SAAgB,EAAmB,EAAU,CAOzC,OANI,IAAa,aAAe,EAAS,SAAS,YAAY,GAG1D,IAAa,OAAS,IAAa,QAC5B,GAEJ,EAAc,KAAK,CAAQ,CACtC,CACA,SAAgB,EAAkB,EAAU,CACxC,OAAO,EAAS,YAAY,CAAC,CAAC,QAAQ,MAAO,EAAE,CACnD,CACA,MAAa,EAA4B,CAAK,OAAO,WAAW,EAAO,eAAe,CAAC,EACvF,SAAgB,EAAuB,EAAO,EAAU,CAAC,EAAG,CACxD,GAAI,CACA,IAAM,EAAM,IAAI,IAAI,CAAK,EACnB,EAAW,EAAkB,EAAI,QAAQ,EAM/C,OALI,EAAI,UAAY,EAAI,UAAY,EAAI,QAAU,EAAI,MAAQ,EAAI,WAAa,IACpE,GACP,EAAQ,eAAiB,EAAmB,CAAQ,EAC7C,EAAI,WAAa,SAAW,EAAI,WAAa,SAEhD,EAAI,WAAa,UACrB,CAAC,EAAI,M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