@flamingo-stack/openframe-frontend-core 0.0.853 → 0.0.855

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 (214) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{case-study-card-WP5Z234Q.cjs → case-study-card-6VAMNHLU.cjs} +8 -8
  3. package/dist/{chunk-2W22LY3W.cjs → chunk-2JCA7BRK.cjs} +19 -19
  4. package/dist/{chunk-53QPG7SJ.cjs → chunk-2MCPK6AX.cjs} +28 -28
  5. package/dist/{chunk-QOW2GP3V.cjs → chunk-2P72KAG5.cjs} +23 -23
  6. package/dist/{chunk-NMWLXHFH.cjs → chunk-3GJ75OUL.cjs} +183 -183
  7. package/dist/{chunk-P63CRPWI.cjs → chunk-4H3J57AN.cjs} +25 -25
  8. package/dist/{chunk-6GWRPW6B.cjs → chunk-5NK3FUHY.cjs} +4 -4
  9. package/dist/{chunk-DLTPSP5F.cjs → chunk-5TYG5JNB.cjs} +2 -2
  10. package/dist/{chunk-EIACEY2L.cjs → chunk-65NMKAPQ.cjs} +12 -12
  11. package/dist/{chunk-IGVAPIEW.cjs → chunk-6C4OR4MZ.cjs} +2 -2
  12. package/dist/{chunk-GG466XFQ.cjs → chunk-6DMH4GXN.cjs} +30 -5
  13. package/dist/{chunk-EF2FZ7GT.cjs → chunk-6VVQJU76.cjs} +54 -54
  14. package/dist/{chunk-G7GF4PWA.cjs → chunk-77GX573I.cjs} +9 -9
  15. package/dist/{chunk-7RZHSBNX.cjs → chunk-AOOHJLXS.cjs} +90 -90
  16. package/dist/{chunk-O3EKOXFZ.cjs → chunk-AYMY2VNB.cjs} +37 -43
  17. package/dist/{chunk-67CZ2Q5K.cjs → chunk-BSPIGZCC.cjs} +36 -36
  18. package/dist/{chunk-FW7RKWPY.cjs → chunk-D6GEMVHD.cjs} +3 -3
  19. package/dist/{chunk-KEV6F3QN.cjs → chunk-DPNFI5XM.cjs} +100 -100
  20. package/dist/{chunk-6V2M2X3M.cjs → chunk-DTZ6KASI.cjs} +6 -6
  21. package/dist/{chunk-SSKMGH5O.cjs → chunk-DXVGGWLG.cjs} +10 -10
  22. package/dist/{chunk-IO6NN3SL.cjs → chunk-EOUEUYCQ.cjs} +54 -54
  23. package/dist/{chunk-5RMBLOJ5.cjs → chunk-ESGE7CUX.cjs} +14 -14
  24. package/dist/{chunk-ETZFBB7O.cjs → chunk-EXQSIX2I.cjs} +4 -4
  25. package/dist/{chunk-IC4IJJB2.cjs → chunk-F33EAPD2.cjs} +124 -124
  26. package/dist/{chunk-COWMXUHN.cjs → chunk-GK577ZLJ.cjs} +6 -14
  27. package/dist/{chunk-E4MFQKPC.cjs → chunk-GZYRDLJW.cjs} +103 -103
  28. package/dist/{chunk-LFEURIZN.cjs → chunk-HML3JUXF.cjs} +324 -322
  29. package/dist/{chunk-BNHTBLAG.cjs → chunk-J3CFRGZ2.cjs} +17 -17
  30. package/dist/{chunk-USPUZO53.cjs → chunk-KZAQPRTA.cjs} +9 -11
  31. package/dist/{chunk-HTYJUMFB.cjs → chunk-LSLRJJFP.cjs} +2 -2
  32. package/dist/{chunk-TBGQMHCG.cjs → chunk-MINFN3IG.cjs} +8 -8
  33. package/dist/{chunk-KHOB3TES.cjs → chunk-MX52LZ6M.cjs} +6 -6
  34. package/dist/{chunk-OH5TXFRR.cjs → chunk-O4CPT3RK.cjs} +7 -7
  35. package/dist/{chunk-HF3V6WBJ.cjs → chunk-OTHQ2KQW.cjs} +3 -3
  36. package/dist/{chunk-IUDBG3HJ.cjs → chunk-PCQ2HKU3.cjs} +5 -5
  37. package/dist/{chunk-BNG6JOGZ.cjs → chunk-QPHXYE5P.cjs} +27 -27
  38. package/dist/{chunk-UO2EJGRJ.cjs → chunk-QZXCUY36.cjs} +53 -53
  39. package/dist/{chunk-COJG2ATY.cjs → chunk-RIJU4HZ2.cjs} +51 -55
  40. package/dist/{chunk-KKFDRCQF.cjs → chunk-RY7INTYU.cjs} +14 -1
  41. package/dist/{chunk-GI3MMBP3.cjs → chunk-SQ7YHWEP.cjs} +228 -15
  42. package/dist/{chunk-U767P4JU.cjs → chunk-STV6VJ3U.cjs} +21 -21
  43. package/dist/chunk-T54I5ZZY.cjs +62 -0
  44. package/dist/{chunk-UV45EPXN.cjs → chunk-TW5Y4D5I.cjs} +7 -7
  45. package/dist/{chunk-FX35L4Y6.cjs → chunk-XCQ5I27Z.cjs} +3 -3
  46. package/dist/{chunk-AZEO7HBB.cjs → chunk-Y44EF4JW.cjs} +2 -2
  47. package/dist/{chunk-W7OFAROY.cjs → chunk-YSXVRTGT.cjs} +9 -12
  48. package/dist/{chunk-GI6ECCWB.cjs → chunk-ZUGJLCYP.cjs} +1272 -856
  49. package/dist/{chunk-KNN2GCMW.cjs → chunk-ZYAVIRQV.cjs} +25 -25
  50. package/dist/{cloud-tenants-QUL2XPAS.cjs → cloud-tenants-2XFIDDGU.cjs} +28 -29
  51. package/dist/components/case-studies/index.cjs +44 -45
  52. package/dist/components/chat/chat-message-row.d.ts +1 -1
  53. package/dist/components/chat/chat-message-row.d.ts.map +1 -1
  54. package/dist/components/chat/chat-message-row.js +4 -4
  55. package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts +7 -13
  56. package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts.map +1 -1
  57. package/dist/components/chat/entity-cards/use-cover-image-fallback.js +2 -8
  58. package/dist/components/chat/hooks/use-chat-attachment-image-gallery.d.ts.map +1 -1
  59. package/dist/components/chat/hooks/use-chat-attachment-image-gallery.js +8 -4
  60. package/dist/components/chat/index.cjs +22 -23
  61. package/dist/components/contact/index.cjs +29 -30
  62. package/dist/components/docs/index.cjs +32 -33
  63. package/dist/components/embeds/index.cjs +29 -30
  64. package/dist/components/faq/index.cjs +30 -31
  65. package/dist/components/features/cloud-tenants/index.d.ts +7 -5
  66. package/dist/components/features/cloud-tenants/index.d.ts.map +1 -1
  67. package/dist/components/features/cloud-tenants/index.js +8 -1
  68. package/dist/components/features/cloud-tenants/single-customer-tenants-table-view.d.ts +26 -0
  69. package/dist/components/features/cloud-tenants/single-customer-tenants-table-view.d.ts.map +1 -0
  70. package/dist/components/features/cloud-tenants/single-customer-tenants-table-view.js +176 -0
  71. package/dist/components/features/cloud-tenants/tenant-access-cell.d.ts +4 -2
  72. package/dist/components/features/cloud-tenants/tenant-access-cell.d.ts.map +1 -1
  73. package/dist/components/features/cloud-tenants/tenant-access-cell.js +3 -2
  74. package/dist/components/features/cloud-tenants/tenant-customer-cell.d.ts +12 -5
  75. package/dist/components/features/cloud-tenants/tenant-customer-cell.d.ts.map +1 -1
  76. package/dist/components/features/cloud-tenants/tenant-customer-cell.js +38 -7
  77. package/dist/components/features/cloud-tenants/tenant-licenses-cell.d.ts +7 -0
  78. package/dist/components/features/cloud-tenants/tenant-licenses-cell.d.ts.map +1 -0
  79. package/dist/components/features/cloud-tenants/tenant-licenses-cell.js +17 -0
  80. package/dist/components/features/cloud-tenants/tenant-presentation.d.ts +19 -0
  81. package/dist/components/features/cloud-tenants/tenant-presentation.d.ts.map +1 -1
  82. package/dist/components/features/cloud-tenants/tenant-presentation.js +24 -3
  83. package/dist/components/features/cloud-tenants/tenant-row.d.ts +35 -8
  84. package/dist/components/features/cloud-tenants/tenant-row.d.ts.map +1 -1
  85. package/dist/components/features/cloud-tenants/tenants-table-columns.d.ts +9 -3
  86. package/dist/components/features/cloud-tenants/tenants-table-columns.d.ts.map +1 -1
  87. package/dist/components/features/cloud-tenants/tenants-table-columns.js +5 -3
  88. package/dist/components/features/cloud-tenants/tenants-table-view.d.ts +27 -6
  89. package/dist/components/features/cloud-tenants/tenants-table-view.d.ts.map +1 -1
  90. package/dist/components/features/cloud-tenants/tenants-table-view.js +75 -17
  91. package/dist/components/features/devices/device-directory.d.ts +18 -0
  92. package/dist/components/features/devices/device-directory.d.ts.map +1 -0
  93. package/dist/components/features/devices/device-directory.js +35 -0
  94. package/dist/components/features/devices/devices-filter-toolbar.d.ts +3 -1
  95. package/dist/components/features/devices/devices-filter-toolbar.d.ts.map +1 -1
  96. package/dist/components/features/devices/devices-filter-toolbar.js +2 -1
  97. package/dist/components/features/devices/devices-panel-view.d.ts +3 -1
  98. package/dist/components/features/devices/devices-panel-view.d.ts.map +1 -1
  99. package/dist/components/features/devices/devices-panel-view.js +11 -2
  100. package/dist/components/features/devices/devices-table-columns.d.ts +17 -3
  101. package/dist/components/features/devices/devices-table-columns.d.ts.map +1 -1
  102. package/dist/components/features/devices/devices-table-columns.js +80 -10
  103. package/dist/components/features/devices/index.d.ts +1 -0
  104. package/dist/components/features/devices/index.d.ts.map +1 -1
  105. package/dist/components/features/devices/index.js +8 -0
  106. package/dist/components/features/devices/types.d.ts +14 -0
  107. package/dist/components/features/devices/types.d.ts.map +1 -1
  108. package/dist/components/features/devices/use-tag-filter-modal.d.ts +1 -0
  109. package/dist/components/features/devices/use-tag-filter-modal.d.ts.map +1 -1
  110. package/dist/components/features/devices/use-tag-filter-modal.js +13 -8
  111. package/dist/components/features/index.cjs +42 -29
  112. package/dist/components/help-center-pages/index.cjs +134 -135
  113. package/dist/components/index.cjs +126 -113
  114. package/dist/components/meeting-scheduler/index.cjs +102 -103
  115. package/dist/components/navigation/app-layout.js +2 -2
  116. package/dist/components/navigation/index.cjs +31 -32
  117. package/dist/components/onboarding-guides/index.cjs +31 -32
  118. package/dist/components/product-demo/index.cjs +39 -40
  119. package/dist/components/related-content/index.cjs +16 -17
  120. package/dist/components/tickets/index.cjs +35 -36
  121. package/dist/components/ui/date-picker.d.ts +2 -0
  122. package/dist/components/ui/date-picker.d.ts.map +1 -1
  123. package/dist/components/ui/date-picker.js +19 -6
  124. package/dist/components/ui/entity-image.d.ts +1 -2
  125. package/dist/components/ui/entity-image.d.ts.map +1 -1
  126. package/dist/components/ui/entity-image.js +4 -8
  127. package/dist/components/ui/index.cjs +28 -29
  128. package/dist/components/ui/markdown/base-components.d.ts +0 -13
  129. package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
  130. package/dist/components/ui/markdown/base-components.js +7 -7
  131. package/dist/components/ui/square-avatar.d.ts.map +1 -1
  132. package/dist/components/ui/square-avatar.js +3 -8
  133. package/dist/{devices-LNB4CYPP.cjs → devices-O3DYGIZB.cjs} +29 -30
  134. package/dist/embed-shims/index.cjs +3 -2
  135. package/dist/embed-shims/next-image.cjs +3 -2
  136. package/dist/embed-shims/next-image.d.ts +2 -0
  137. package/dist/embed-shims/next-image.d.ts.map +1 -1
  138. package/dist/embed-shims/next-image.js +14 -4
  139. package/dist/{embeddable-chat-SJEEJI4N.cjs → embeddable-chat-QD7NFD2H.cjs} +100 -101
  140. package/dist/hooks/index.cjs +27 -16
  141. package/dist/hooks/index.d.ts +1 -0
  142. package/dist/hooks/index.d.ts.map +1 -1
  143. package/dist/hooks/index.js +1 -0
  144. package/dist/hooks/ui/use-content-breakpoint.d.ts +8 -0
  145. package/dist/hooks/ui/use-content-breakpoint.d.ts.map +1 -1
  146. package/dist/hooks/ui/use-content-breakpoint.js +17 -3
  147. package/dist/hooks/ui/use-media-query.d.ts +1 -0
  148. package/dist/hooks/ui/use-media-query.d.ts.map +1 -1
  149. package/dist/hooks/ui/use-media-query.js +3 -1
  150. package/dist/hooks/use-authed-asset-src.d.ts +77 -2
  151. package/dist/hooks/use-authed-asset-src.d.ts.map +1 -1
  152. package/dist/hooks/use-authed-asset-src.js +185 -73
  153. package/dist/hooks/use-authed-image-src.d.ts +11 -4
  154. package/dist/hooks/use-authed-image-src.d.ts.map +1 -1
  155. package/dist/hooks/use-authed-image-src.js +6 -2
  156. package/dist/hooks/use-image-fallback.d.ts +16 -0
  157. package/dist/hooks/use-image-fallback.d.ts.map +1 -0
  158. package/dist/hooks/use-image-fallback.js +14 -0
  159. package/dist/index.cjs +58 -36
  160. package/dist/{knowledge-UTWKB6XG.cjs → knowledge-K7AFNZNO.cjs} +29 -30
  161. package/dist/{logs-PMXIWMBQ.cjs → logs-MZ3BR2FR.cjs} +35 -36
  162. package/dist/{policies-6DCMFDL7.cjs → policies-XVKQ2W7S.cjs} +32 -33
  163. package/dist/{remote-session-SG44CNOK.cjs → remote-session-VOZJXDM4.cjs} +13 -14
  164. package/dist/{scripts-2G7LXW7Z.cjs → scripts-IBPMBS6G.cjs} +35 -36
  165. package/dist/{software-update-MYLKHDHC.cjs → software-update-PXTANMAO.cjs} +32 -33
  166. package/dist/{tickets-board-SQY2Y6QV.cjs → tickets-board-POYZS7BW.cjs} +16 -17
  167. package/dist/utils/app-origins.d.ts +3 -6
  168. package/dist/utils/app-origins.d.ts.map +1 -1
  169. package/dist/utils/app-origins.js +8 -1
  170. package/dist/utils/embed-authed-fetch.d.ts +46 -26
  171. package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
  172. package/dist/utils/embed-authed-fetch.js +24 -8
  173. package/dist/utils/index.cjs +4 -1
  174. package/dist/utils/presentation-for.d.ts +6 -0
  175. package/dist/utils/presentation-for.d.ts.map +1 -0
  176. package/dist/utils/presentation-for.js +7 -0
  177. package/dist/{video-file-player-XMOB234V.cjs → video-file-player-RIOT24NT.cjs} +3 -4
  178. package/package.json +1 -1
  179. package/src/components/chat/chat-message-row.tsx +8 -7
  180. package/src/components/chat/entity-cards/use-cover-image-fallback.ts +8 -28
  181. package/src/components/chat/hooks/use-chat-attachment-image-gallery.tsx +19 -8
  182. package/src/components/features/cloud-tenants/index.ts +8 -3
  183. package/src/components/features/cloud-tenants/single-customer-tenants-table-view.tsx +234 -0
  184. package/src/components/features/cloud-tenants/tenant-access-cell.tsx +12 -5
  185. package/src/components/features/cloud-tenants/tenant-customer-cell.tsx +48 -12
  186. package/src/components/features/cloud-tenants/tenant-licenses-cell.tsx +28 -0
  187. package/src/components/features/cloud-tenants/tenant-presentation.ts +46 -4
  188. package/src/components/features/cloud-tenants/tenant-row.ts +38 -8
  189. package/src/components/features/cloud-tenants/tenants-table-columns.ts +8 -5
  190. package/src/components/features/cloud-tenants/tenants-table-view.tsx +123 -28
  191. package/src/components/features/devices/device-directory.ts +55 -0
  192. package/src/components/features/devices/devices-filter-toolbar.tsx +4 -1
  193. package/src/components/features/devices/devices-panel-view.tsx +12 -2
  194. package/src/components/features/devices/devices-table-columns.tsx +123 -8
  195. package/src/components/features/devices/index.ts +7 -0
  196. package/src/components/features/devices/types.ts +14 -0
  197. package/src/components/features/devices/use-tag-filter-modal.ts +32 -14
  198. package/src/components/navigation/app-layout.tsx +4 -4
  199. package/src/components/ui/date-picker.tsx +21 -3
  200. package/src/components/ui/entity-image.tsx +4 -12
  201. package/src/components/ui/markdown/base-components.tsx +15 -20
  202. package/src/components/ui/square-avatar.tsx +5 -8
  203. package/src/embed-shims/next-image.tsx +34 -3
  204. package/src/hooks/index.ts +1 -0
  205. package/src/hooks/ui/use-content-breakpoint.ts +21 -2
  206. package/src/hooks/ui/use-media-query.ts +1 -0
  207. package/src/hooks/use-authed-asset-src.ts +323 -107
  208. package/src/hooks/use-authed-image-src.ts +15 -5
  209. package/src/hooks/use-image-fallback.ts +31 -0
  210. package/src/utils/app-origins.ts +12 -7
  211. package/src/utils/embed-authed-fetch.ts +71 -32
  212. package/src/utils/presentation-for.ts +10 -0
  213. package/dist/chunk-UAI4VMEF.cjs +0 -46
  214. package/dist/chunk-YSDB6HGQ.cjs +0 -102
@@ -20,7 +20,7 @@
20
20
  * (e.g. `/api/profile/me`) keep using vanilla `fetch`.
21
21
  */
22
22
 
23
- import { resolveAppOriginUrl } from './app-origins';
23
+ import { isPageOriginUrl, readAppOrigins, resolveAppOriginUrl } from './app-origins';
24
24
  import { readRegisteredAdapter, writeRegisteredAdapter } from './embed-auth-adapter-registry';
25
25
  import { applyProxyAuth } from './embed-proxy-auth-storage';
26
26
 
@@ -129,6 +129,27 @@ export interface EmbedAuthAdapter {
129
129
  * remains the rule, this is the narrow exception.
130
130
  */
131
131
  allowedOrigins?: string[];
132
+ /**
133
+ * Optional: where a picture or other asset URL found in the host's data actually lives. Every asset the lib
134
+ * loads natively (the boxed `Image`, and everything drawn through `useAuthedAsset`) passes its URL through
135
+ * this first. A backend path that the page's origin does not serve, such as `/images/user/1` stored on a
136
+ * record but served at `{gateway}/api/images/user/1`, then loads from the gateway on every host, including a
137
+ * native shell, whose page origin has no server behind it.
138
+ *
139
+ * Must be idempotent. It must return absolute URLs and `data:` / `blob:` URLs unchanged, and leave the host's
140
+ * own static assets alone. Omit it when every URL in the host's data is already loadable as it stands. A host
141
+ * that registers `next/image` with its optimizer on must allow the hosts this returns in its image config.
142
+ */
143
+ resolveAssetUrl?: (url: string) => string;
144
+ /**
145
+ * Optional, side-effect-free: whether `getHeaders()` would carry an `Authorization` header now. Declaring it also
146
+ * says the host authenticates by header: a picture on an origin in `allowedOrigins` then waits for the credential
147
+ * (`assetLoadMode`'s `awaiting-credential`) instead of loading natively into a 401. The lib asks it for every
148
+ * mounted picture and right after every credential change, so a host whose `getHeaders` has per-call side effects
149
+ * needs it to keep classifying from counting as sending.
150
+ * Without it the lib reads `getHeaders()` and never waits.
151
+ */
152
+ hasCredential?: () => boolean;
132
153
  /**
133
154
  * Optional: call `listener` whenever `getHeaders()` starts returning a NEW
134
155
  * credential (a rotation the host ran on its own — e.g. a native shell's
@@ -189,39 +210,45 @@ export function subscribeEmbedCredentialChange(listener: () => void): () => void
189
210
  }
190
211
 
191
212
  /**
192
- * Whether `url` is an asset the browser CANNOT load natively because its
193
- * auth rides in request headers.
194
- *
195
- * Native asset loads (`<img src>`, `<track src>`, CSS `background-image`)
196
- * can't carry custom headers, so a URL this returns `true` for must go
197
- * through `embedAuthedFetch` → blob object-URL instead (see
198
- * `useAuthedAssetSrc` / `useAuthedImageSrc`).
199
- *
200
- * The single signal is the registered adapter: when it supplies an
201
- * `Authorization` header, the host authenticates by HEADER, so nothing the
202
- * browser fetches on its own is authenticated. That holds for BOTH shapes a
203
- * header-auth host takes:
204
- *
205
- * - a cross-origin gateway URL — sanctioned via `allowedOrigins` (native
206
- * shells, whose page origin is `capacitor://` / `tauri://`);
207
- * - a same-origin / relative reverse-proxy path (`/content/api/...`) —
208
- * dev-ticket web, where the token lives in localStorage and there is NO
209
- * session cookie to fall back on. This case used to be excluded on the
210
- * assumption that same-origin implies "cookies work"; true for a cookie
211
- * session, false for every header-auth host, which is exactly when this
212
- * predicate is consulted at all.
213
+ * How the browser has to load an asset URL on this host. Native asset loads (`<img src>`, `<track src>`, CSS
214
+ * `background-image`) can't carry custom headers, so where the host authenticates by HEADER (its adapter has a
215
+ * credential: `hasCredential`, else an `Authorization` from `getHeaders`) nothing the browser fetches on its own is
216
+ * authenticated:
213
217
  *
214
- * Everything else loads natively, unchanged: cookie-auth web (the adapter
215
- * supplies no `Authorization`), no adapter at all (the hub), and third-party
216
- * origins the bearer does NOT belong to (public images) — those stay out of
217
- * reach of the token by the same origin rules `embedAuthedFetch` enforces.
218
+ * - `native`: hand it to the element as it stands. Cookie-auth web (no credential), no adapter at all (the hub), a
219
+ * third-party origin the bearer does NOT belong to (public images: out of the token's reach by the same origin
220
+ * rules `embedAuthedFetch` enforces), or a non-http(s) URL (`data:`, `blob:`, a native shell's own bundle).
221
+ * - `bearer`: fetch it with the adapter's credential (`embedAuthedFetch`) and draw the blob. That covers both shapes
222
+ * a header-auth host takes: a cross-origin gateway sanctioned in `allowedOrigins` (native shells, whose page
223
+ * origin is `capacitor://` / `tauri://`), and a same-origin or relative reverse-proxy path (`/content/api/...`)
224
+ * on dev-ticket web, where the token lives in localStorage and there is NO session cookie to fall back on.
225
+ * - `awaiting-credential`: it lives on a gateway the host sanctioned in `allowedOrigins`, which only the bearer
226
+ * opens, and the host, which declared header auth (`hasCredential`), has no credential yet. A native shell
227
+ * renders before its tokens arrive: a native load at that moment is a guaranteed 401, so the caller waits for
228
+ * `subscribeEmbedCredentialChange` instead.
218
229
  */
219
- export function needsBearerAssetFetch(url: string): boolean {
220
- if (typeof window === 'undefined') return false;
230
+ export type AssetLoadMode = 'native' | 'bearer' | 'awaiting-credential';
231
+
232
+ /** `url`'s `AssetLoadMode` on this host now. Pass the URL after `resolveAssetUrl`. */
233
+ export function assetLoadMode(url: string): AssetLoadMode {
234
+ if (typeof window === 'undefined') return 'native';
221
235
  const adapter = getRegisteredAuthAdapter();
222
- if (!adapter || adapter.getHeaders?.().Authorization === undefined) return false;
223
- const target = resolveAppOriginUrl(url);
224
- return target !== null && (target.protocol === 'http:' || target.protocol === 'https:');
236
+ if (!adapter) return 'native';
237
+ const origins = readAppOrigins();
238
+ const target = resolveAppOriginUrl(url, origins);
239
+ if (!target || (target.protocol !== 'http:' && target.protocol !== 'https:')) return 'native';
240
+ if (!adapter.hasCredential) return adapter.getHeaders?.().Authorization !== undefined ? 'bearer' : 'native';
241
+ if (adapter.hasCredential()) return 'bearer';
242
+ // The page's own origin without a credential: cookie-auth web authenticates there by cookie, and a shell's http(s)
243
+ // page origin (`https://localhost`, `http://tauri.localhost`) is its own bundle. A header-auth web host lacks one
244
+ // there only while signed out, and its next credential change re-classifies the picture.
245
+ return isPageOriginUrl(target, origins) ? 'native' : 'awaiting-credential';
246
+ }
247
+
248
+ /** `url` where the host says it lives (`EmbedAuthAdapter.resolveAssetUrl`); unchanged when no host says. */
249
+ export function resolveAssetUrl(url: string): string {
250
+ const resolve = getRegisteredAuthAdapter()?.resolveAssetUrl;
251
+ return resolve ? resolve(url) : url;
225
252
  }
226
253
 
227
254
  /**
@@ -347,6 +374,16 @@ function dedupedRefresh(): Promise<boolean> {
347
374
  return inFlightRefresh;
348
375
  }
349
376
 
377
+ const answersAfterRefresh = new WeakSet<Response>();
378
+
379
+ /**
380
+ * Whether `response` answered the retry `embedAuthedFetch` sent after refreshing the credential: a 401 here is a
381
+ * refusal of a credential just issued, which another refresh will not lift.
382
+ */
383
+ export function answeredAfterRefresh(response: Response): boolean {
384
+ return answersAfterRefresh.has(response);
385
+ }
386
+
350
387
  /**
351
388
  * Core fetch path: merge proxy-auth + adapter headers, issue the request,
352
389
  * and — on a `401` with a refresh-capable adapter — refresh once and retry
@@ -406,7 +443,9 @@ async function fetchWithRefresh(
406
443
  if (response.status === 401 && !isRetry && adapter?.refresh) {
407
444
  const refreshed = await dedupedRefresh();
408
445
  if (refreshed) {
409
- return fetchWithRefresh(url, init, baseHeaders, true);
446
+ const retried = await fetchWithRefresh(url, init, baseHeaders, true);
447
+ answersAfterRefresh.add(retried);
448
+ return retried;
410
449
  }
411
450
  }
412
451
 
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The entry of a value → presentation table for a value off the wire, `undefined` for one the table does not know.
3
+ * Own keys only: `in` or a bare index would answer `toString` or `constructor` with the prototype's function.
4
+ */
5
+ export function presentationFor<K extends string, V>(
6
+ map: Readonly<Record<K, V>>,
7
+ key: string | null | undefined,
8
+ ): V | undefined {
9
+ return key != null && Object.prototype.hasOwnProperty.call(map, key) ? map[key as K] : undefined;
10
+ }
@@ -1,46 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
-
3
-
4
-
5
-
6
- var _chunkCOWMXUHNcjs = require('./chunk-COWMXUHN.cjs');
7
-
8
- // src/hooks/ui/use-content-breakpoint.ts
9
- var _react = require('react');
10
- var CONTENT_BREAKPOINTS = { md: _chunkCOWMXUHNcjs.LAYOUT_STEPS.md.content, lg: _chunkCOWMXUHNcjs.LAYOUT_STEPS.lg.content };
11
- var ContentAreaWidthContext = _react.createContext.call(void 0, null);
12
- function ViewportBreakpoints({ children }) {
13
- return _react.createElement.call(void 0, ContentAreaWidthContext.Provider, { value: null }, children);
14
- }
15
- function contentBreakpointFor(width) {
16
- if (width >= CONTENT_BREAKPOINTS.lg) return "desktop";
17
- if (width >= CONTENT_BREAKPOINTS.md) return "tablet";
18
- return "mobile";
19
- }
20
- function useContentBreakpoint() {
21
- const width = _react.useContext.call(void 0, ContentAreaWidthContext);
22
- const mdUp = _chunkCOWMXUHNcjs.useMdUp.call(void 0, );
23
- const lgUp = _chunkCOWMXUHNcjs.useLgUp.call(void 0, );
24
- if (width !== null) return contentBreakpointFor(width);
25
- if (mdUp === void 0) return void 0;
26
- if (lgUp) return "desktop";
27
- return mdUp ? "tablet" : "mobile";
28
- }
29
- function useContentMdUp() {
30
- const breakpoint = useContentBreakpoint();
31
- return breakpoint === void 0 ? void 0 : breakpoint !== "mobile";
32
- }
33
- function useContentLgUp() {
34
- const breakpoint = useContentBreakpoint();
35
- return breakpoint === void 0 ? void 0 : breakpoint === "desktop";
36
- }
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- exports.CONTENT_BREAKPOINTS = CONTENT_BREAKPOINTS; exports.ContentAreaWidthContext = ContentAreaWidthContext; exports.ViewportBreakpoints = ViewportBreakpoints; exports.contentBreakpointFor = contentBreakpointFor; exports.useContentBreakpoint = useContentBreakpoint; exports.useContentMdUp = useContentMdUp; exports.useContentLgUp = useContentLgUp;
@@ -1,102 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }"use client";
2
-
3
-
4
-
5
- var _chunkGI3MMBP3cjs = require('./chunk-GI3MMBP3.cjs');
6
-
7
- // src/hooks/ui/use-isomorphic-layout-effect.ts
8
- var _react = require('react');
9
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? _react.useLayoutEffect : _react.useEffect;
10
-
11
- // src/hooks/use-authed-asset-src.ts
12
-
13
- var resolvedCache = /* @__PURE__ */ new Map();
14
- var inFlight = /* @__PURE__ */ new Map();
15
- var cacheGeneration = 0;
16
- var RELEASE_DELAY_MS = 6e4;
17
- var refCounts = /* @__PURE__ */ new Map();
18
- var releaseTimers = /* @__PURE__ */ new Map();
19
- function scheduleRelease(src) {
20
- clearTimeout(releaseTimers.get(src));
21
- releaseTimers.set(
22
- src,
23
- setTimeout(() => {
24
- releaseTimers.delete(src);
25
- if (refCounts.has(src)) return;
26
- const blobUrl = resolvedCache.get(src);
27
- if (blobUrl) URL.revokeObjectURL(blobUrl);
28
- resolvedCache.delete(src);
29
- }, RELEASE_DELAY_MS)
30
- );
31
- }
32
- function acquire(src) {
33
- clearTimeout(releaseTimers.get(src));
34
- releaseTimers.delete(src);
35
- refCounts.set(src, (_nullishCoalesce(refCounts.get(src), () => ( 0))) + 1);
36
- }
37
- function release(src) {
38
- const remaining = (_nullishCoalesce(refCounts.get(src), () => ( 1))) - 1;
39
- if (remaining > 0) {
40
- refCounts.set(src, remaining);
41
- return;
42
- }
43
- refCounts.delete(src);
44
- scheduleRelease(src);
45
- }
46
- function clearAuthedAssetCache() {
47
- cacheGeneration++;
48
- for (const url of resolvedCache.values()) URL.revokeObjectURL(url);
49
- resolvedCache.clear();
50
- inFlight.clear();
51
- for (const timer of releaseTimers.values()) clearTimeout(timer);
52
- releaseTimers.clear();
53
- }
54
- function fetchAsBlobUrl(src, accept) {
55
- let pending = inFlight.get(src);
56
- if (!pending) {
57
- const startedGeneration = cacheGeneration;
58
- pending = _chunkGI3MMBP3cjs.embedAuthedFetch.call(void 0, src, { headers: { Accept: accept } }).then(async (response) => {
59
- if (!response.ok) throw new Error(`asset fetch failed: ${response.status}`);
60
- const blobUrl = URL.createObjectURL(await response.blob());
61
- if (startedGeneration === cacheGeneration) {
62
- resolvedCache.set(src, blobUrl);
63
- if (!refCounts.has(src)) scheduleRelease(src);
64
- } else {
65
- URL.revokeObjectURL(blobUrl);
66
- }
67
- }).finally(() => {
68
- if (inFlight.get(src) === pending) inFlight.delete(src);
69
- });
70
- inFlight.set(src, pending);
71
- }
72
- return pending;
73
- }
74
- function useAuthedAssetSrc(src, accept = "*/*") {
75
- const bearerSrc = src && _chunkGI3MMBP3cjs.needsBearerAssetFetch.call(void 0, src) ? src : null;
76
- const [, rerender] = _react.useReducer.call(void 0, (c) => c + 1, 0);
77
- useIsomorphicLayoutEffect(() => {
78
- if (!bearerSrc) return void 0;
79
- acquire(bearerSrc);
80
- return () => release(bearerSrc);
81
- }, [bearerSrc]);
82
- _react.useEffect.call(void 0, () => {
83
- if (!bearerSrc || resolvedCache.has(bearerSrc)) return void 0;
84
- let cancelled = false;
85
- fetchAsBlobUrl(bearerSrc, accept).catch(() => {
86
- }).finally(() => {
87
- if (!cancelled) rerender();
88
- });
89
- return () => {
90
- cancelled = true;
91
- };
92
- }, [bearerSrc, accept]);
93
- if (!src) return void 0;
94
- if (!bearerSrc) return src;
95
- return resolvedCache.get(bearerSrc);
96
- }
97
-
98
-
99
-
100
-
101
-
102
- exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; exports.clearAuthedAssetCache = clearAuthedAssetCache; exports.useAuthedAssetSrc = useAuthedAssetSrc;