@oxy.so/services 13.2.0 → 13.4.0

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 (30) hide show
  1. package/lib/commonjs/ui/client.js +13 -0
  2. package/lib/commonjs/ui/client.js.map +1 -1
  3. package/lib/commonjs/ui/hooks/useAccountTheme.js +182 -0
  4. package/lib/commonjs/ui/hooks/useAccountTheme.js.map +1 -0
  5. package/lib/commonjs/ui/hooks/useFileDownloadUrl.js +64 -44
  6. package/lib/commonjs/ui/hooks/useFileDownloadUrl.js.map +1 -1
  7. package/lib/module/ui/client.js +1 -0
  8. package/lib/module/ui/client.js.map +1 -1
  9. package/lib/module/ui/hooks/useAccountTheme.js +178 -0
  10. package/lib/module/ui/hooks/useAccountTheme.js.map +1 -0
  11. package/lib/module/ui/hooks/useFileDownloadUrl.js +64 -44
  12. package/lib/module/ui/hooks/useFileDownloadUrl.js.map +1 -1
  13. package/lib/typescript/commonjs/ui/client.d.ts +2 -0
  14. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/ui/hooks/useAccountTheme.d.ts +47 -0
  16. package/lib/typescript/commonjs/ui/hooks/useAccountTheme.d.ts.map +1 -0
  17. package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts +10 -4
  18. package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
  19. package/lib/typescript/module/ui/client.d.ts +2 -0
  20. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  21. package/lib/typescript/module/ui/hooks/useAccountTheme.d.ts +47 -0
  22. package/lib/typescript/module/ui/hooks/useAccountTheme.d.ts.map +1 -0
  23. package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts +10 -4
  24. package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
  25. package/package.json +4 -4
  26. package/plugins/withOxyReleaseSigning.js +277 -0
  27. package/plugins/withOxySharedPermissions.js +8 -1
  28. package/src/ui/client.ts +2 -0
  29. package/src/ui/hooks/useAccountTheme.ts +177 -0
  30. package/src/ui/hooks/useFileDownloadUrl.ts +59 -49
@@ -1,63 +1,83 @@
1
1
  "use strict";
2
2
 
3
3
  import { useEffect, useState } from 'react';
4
+ import { useOptionalOxy } from "../context/oxyRuntimeContext.js";
5
+ function isAbsoluteUrl(ref) {
6
+ return ref.startsWith('http://') || ref.startsWith('https://');
7
+ }
8
+
4
9
  /**
5
- * Hook to resolve a file's download URL asynchronously.
10
+ * Resolve a file's download URL for the current caller.
11
+ *
12
+ * A URL `assets.url` already resolved is answered in the FIRST render from
13
+ * core's identity-scoped cache (`assets.cachedUrl`): no request, no loading
14
+ * frame. Only a miss resolves asynchronously, through `assets.url`, which
15
+ * returns a scoped media-token stream URL for a private asset. There is no
16
+ * public-CDN fallback: `assets.publicUrl` 404s for private uploads. A
17
+ * reference that is already an absolute `http(s)` URL is returned unchanged.
6
18
  *
7
- * Uses `getFileDownloadUrlAsync`, which returns a scoped media-token stream URL
8
- * for private assets. There is no sync CDN fallback — the synchronous
9
- * `getFileDownloadUrl` is public-CDN-only and 404s for private uploads.
19
+ * For a synchronous, render-only answer (an image resolver, a list row) use
20
+ * `oxyServices.assets.renderUrl`, which reads the same cache.
10
21
  */
11
22
  export const useFileDownloadUrl = (oxyServices, fileId, options) => {
12
- const [url, setUrl] = useState(null);
13
- const [loading, setLoading] = useState(false);
14
- const [error, setError] = useState(null);
15
23
  const variant = options?.variant;
16
24
  const expiresIn = options?.expiresIn;
25
+ // A resolved URL can carry the viewer's scoped media token, so the viewer is
26
+ // part of what was asked: an account switch never shows the previous one's.
27
+ const viewerId = useOptionalOxy()?.user?.id ?? '';
28
+ const request = fileId ? `${viewerId}|${fileId}|${variant ?? ''}|${expiresIn ?? ''}` : null;
29
+ const immediate = !fileId ? null : isAbsoluteUrl(fileId) ? fileId : oxyServices?.assets.cachedUrl(fileId, variant, expiresIn) ?? null;
30
+ const needsResolve = !!fileId && !!oxyServices && immediate === null;
31
+ const [settled, setSettled] = useState(null);
17
32
  useEffect(() => {
18
- if (!fileId) {
19
- setUrl(null);
20
- setLoading(false);
21
- setError(null);
22
- return;
23
- }
24
- if (!oxyServices) {
25
- setUrl(null);
26
- setLoading(false);
27
- setError(new Error('OxyServices instance not configured for useFileDownloadUrl'));
28
- return;
29
- }
33
+ if (!needsResolve || !fileId || !oxyServices || !request) return;
30
34
  let cancelled = false;
31
- const instance = oxyServices;
32
- const targetFileId = fileId;
33
- const load = async () => {
34
- setLoading(true);
35
- setError(null);
36
- try {
37
- const resolvedUrl = await instance.assets.url(targetFileId, variant, expiresIn);
38
- if (!cancelled) {
39
- setUrl(resolvedUrl || null);
40
- }
41
- } catch (err) {
42
- if (!cancelled) {
43
- setUrl(null);
44
- setError(err instanceof Error ? err : new Error(String(err)));
45
- }
46
- } finally {
47
- if (!cancelled) {
48
- setLoading(false);
49
- }
35
+ oxyServices.assets.url(fileId, variant, expiresIn).then(url => {
36
+ if (!cancelled) setSettled({
37
+ request,
38
+ url: url || null,
39
+ error: null
40
+ });
41
+ }, err => {
42
+ if (!cancelled) {
43
+ setSettled({
44
+ request,
45
+ url: null,
46
+ error: err instanceof Error ? err : new Error(String(err))
47
+ });
50
48
  }
51
- };
52
- load();
49
+ });
53
50
  return () => {
54
51
  cancelled = true;
55
52
  };
56
- }, [fileId, oxyServices, variant, expiresIn]);
53
+ }, [needsResolve, fileId, oxyServices, variant, expiresIn, request]);
54
+ if (!fileId) return {
55
+ url: null,
56
+ loading: false,
57
+ error: null
58
+ };
59
+ if (immediate !== null) return {
60
+ url: immediate,
61
+ loading: false,
62
+ error: null
63
+ };
64
+ if (!oxyServices) {
65
+ return {
66
+ url: null,
67
+ loading: false,
68
+ error: new Error('OxyServices instance not configured for useFileDownloadUrl')
69
+ };
70
+ }
71
+ // A result settled for another file, variant or expiry is never shown.
72
+ if (settled?.request !== request) return {
73
+ url: null,
74
+ loading: true,
75
+ error: null
76
+ };
57
77
  return {
58
- url,
59
- loading,
60
- error
78
+ url: settled.url,
79
+ loading: false,
80
+ error: settled.error
61
81
  };
62
82
  };
63
83
  //# sourceMappingURL=useFileDownloadUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","useFileDownloadUrl","oxyServices","fileId","options","url","setUrl","loading","setLoading","error","setError","variant","expiresIn","Error","cancelled","instance","targetFileId","load","resolvedUrl","assets","err","String"],"sourceRoot":"../../../../src","sources":["ui/hooks/useFileDownloadUrl.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAc3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAChCC,WAA2C,EAC3CC,MAAiC,EACjCC,OAAmC,KACN;EAC7B,MAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAAgB,IAAI,CAAC;EACnD,MAAM,CAACO,OAAO,EAAEC,UAAU,CAAC,GAAGR,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAAM,CAACS,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAAe,IAAI,CAAC;EAEtD,MAAMW,OAAO,GAAGP,OAAO,EAAEO,OAAO;EAChC,MAAMC,SAAS,GAAGR,OAAO,EAAEQ,SAAS;EAEpCb,SAAS,CAAC,MAAM;IACd,IAAI,CAACI,MAAM,EAAE;MACXG,MAAM,CAAC,IAAI,CAAC;MACZE,UAAU,CAAC,KAAK,CAAC;MACjBE,QAAQ,CAAC,IAAI,CAAC;MACd;IACF;IAEA,IAAI,CAACR,WAAW,EAAE;MAChBI,MAAM,CAAC,IAAI,CAAC;MACZE,UAAU,CAAC,KAAK,CAAC;MACjBE,QAAQ,CAAC,IAAIG,KAAK,CAAC,4DAA4D,CAAC,CAAC;MACjF;IACF;IAEA,IAAIC,SAAS,GAAG,KAAK;IACrB,MAAMC,QAAQ,GAAGb,WAAW;IAC5B,MAAMc,YAAY,GAAGb,MAAM;IAE3B,MAAMc,IAAI,GAAG,MAAAA,CAAA,KAAY;MACvBT,UAAU,CAAC,IAAI,CAAC;MAChBE,QAAQ,CAAC,IAAI,CAAC;MAEd,IAAI;QACF,MAAMQ,WAAW,GAAG,MAAMH,QAAQ,CAACI,MAAM,CAACd,GAAG,CAACW,YAAY,EAAEL,OAAO,EAAEC,SAAS,CAAC;QAE/E,IAAI,CAACE,SAAS,EAAE;UACdR,MAAM,CAACY,WAAW,IAAI,IAAI,CAAC;QAC7B;MACF,CAAC,CAAC,OAAOE,GAAY,EAAE;QACrB,IAAI,CAACN,SAAS,EAAE;UACdR,MAAM,CAAC,IAAI,CAAC;UACZI,QAAQ,CAACU,GAAG,YAAYP,KAAK,GAAGO,GAAG,GAAG,IAAIP,KAAK,CAACQ,MAAM,CAACD,GAAG,CAAC,CAAC,CAAC;QAC/D;MACF,CAAC,SAAS;QACR,IAAI,CAACN,SAAS,EAAE;UACdN,UAAU,CAAC,KAAK,CAAC;QACnB;MACF;IACF,CAAC;IAEDS,IAAI,CAAC,CAAC;IAEN,OAAO,MAAM;MACXH,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CAACX,MAAM,EAAED,WAAW,EAAES,OAAO,EAAEC,SAAS,CAAC,CAAC;EAE7C,OAAO;IAAEP,GAAG;IAAEE,OAAO;IAAEE;EAAM,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useState","useOptionalOxy","isAbsoluteUrl","ref","startsWith","useFileDownloadUrl","oxyServices","fileId","options","variant","expiresIn","viewerId","user","id","request","immediate","assets","cachedUrl","needsResolve","settled","setSettled","cancelled","url","then","error","err","Error","String","loading"],"sourceRoot":"../../../../src","sources":["ui/hooks/useFileDownloadUrl.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,cAAc,QAAQ,iCAA8B;AAmB7D,SAASC,aAAaA,CAACC,GAAW,EAAW;EAC3C,OAAOA,GAAG,C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';
36
36
  export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyContext';
37
37
  export { useAuth } from './hooks/useAuth';
38
38
  export { useAccountColor, useAccountColorSave, resolveAccountColor, entitledAccountColors, } from './hooks/useAccountColor';
39
+ export { useAccountTheme, useAccountThemeControls } from './hooks/useAccountTheme';
40
+ export type { AccountThemeControls, ThemeSource } from './hooks/useAccountTheme';
39
41
  export { useAppAssertion, AppAssertionProviderMissingError, } from './appAssertion/AppAssertionContext';
40
42
  export type { UseAppAssertionResult } from './appAssertion/AppAssertionContext';
41
43
  export type { AppAssertionSnapshot, AppAssertionStatus } from './appAssertion/appAssertionManager';
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/ui/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,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AAM,2BAA2B,CAAC;AACnC,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * useAccountTheme / useAccountThemeControls
3
+ *
4
+ * The Oxy account carries a portable theme (`user.themePreference`: a mode and
5
+ * a colour preset) that every Oxy app can wear. The COLOUR is the account
6
+ * colour and always applies (`useAccountColor`). Whether an app also follows
7
+ * the account's MODE is the viewer's choice per device: the theme SOURCE.
8
+ *
9
+ * - `account` (the default): the account's mode is applied to Bloom, and a mode
10
+ * chosen here is written back to the account for the other Oxy apps.
11
+ * - `app`: the mode stays on this device; nothing is written to the account.
12
+ *
13
+ * The source is a local preference, never sent anywhere. On web it is read
14
+ * synchronously, so the first paint already knows it; on native it resolves
15
+ * from AsyncStorage right after mount. Bloom's own persistence still paints the
16
+ * last theme instantly on cold boot, so the account theme lands without a flash
17
+ * once the session resolves.
18
+ */
19
+ import { type AppColorName, type ThemeMode } from '@oxy.so/bloom/theme';
20
+ /** Where the app's theme MODE comes from on this device. */
21
+ export type ThemeSource = 'app' | 'account';
22
+ /**
23
+ * Apply the account theme to Bloom: the colour always (through
24
+ * `useAccountColor`, which `canUse` can narrow), the mode while this device's
25
+ * source is `account`. Mount ONCE, inside `OxyProvider` and Bloom's theme
26
+ * provider.
27
+ */
28
+ export declare function useAccountTheme({ canUse, }?: {
29
+ canUse?: (name: AppColorName) => boolean;
30
+ }): void;
31
+ export interface AccountThemeControls {
32
+ /** The effective source: `app` whenever no session can reach the account. */
33
+ source: ThemeSource;
34
+ /** Switch this device's source; enabling `account` seeds an account with no theme yet. */
35
+ changeThemeSource: (source: ThemeSource) => void;
36
+ /** Change the mode now; on the `account` source, also write it to the account. */
37
+ changeThemeMode: (mode: ThemeMode) => Promise<void>;
38
+ }
39
+ /**
40
+ * Source-aware theme mode changes for a settings screen. Bloom changes at once;
41
+ * on the `account` source the account's portable theme follows. Without a
42
+ * usable session the effective source is `app`, so changes stay local, and the
43
+ * stored choice applies again once signed in. The colour is chosen with
44
+ * `useAccountColorSave`.
45
+ */
46
+ export declare function useAccountThemeControls(): AccountThemeControls;
47
+ //# sourceMappingURL=useAccountTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAccountTheme.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMvF,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;AA4D5C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,CAiBZ;AAED,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,MAAM,EAAE,WAAW,CAAC;IACpB,0FAA0F;IAC1F,iBAAiB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,kFAAkF;IAClF,eAAe,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,CA0C9D"}
@@ -9,11 +9,17 @@ export interface UseFileDownloadUrlResult {
9
9
  error: Error | null;
10
10
  }
11
11
  /**
12
- * Hook to resolve a file's download URL asynchronously.
12
+ * Resolve a file's download URL for the current caller.
13
13
  *
14
- * Uses `getFileDownloadUrlAsync`, which returns a scoped media-token stream URL
15
- * for private assets. There is no sync CDN fallback — the synchronous
16
- * `getFileDownloadUrl` is public-CDN-only and 404s for private uploads.
14
+ * A URL `assets.url` already resolved is answered in the FIRST render from
15
+ * core's identity-scoped cache (`assets.cachedUrl`): no request, no loading
16
+ * frame. Only a miss resolves asynchronously, through `assets.url`, which
17
+ * returns a scoped media-token stream URL for a private asset. There is no
18
+ * public-CDN fallback: `assets.publicUrl` 404s for private uploads. A
19
+ * reference that is already an absolute `http(s)` URL is returned unchanged.
20
+ *
21
+ * For a synchronous, render-only answer (an image resolver, a list row) use
22
+ * `oxyServices.assets.renderUrl`, which reads the same cache.
17
23
  */
18
24
  export declare const useFileDownloadUrl: (oxyServices: OxyServices | null | undefined, fileId: string | null | undefined, options?: UseFileDownloadUrlOptions) => UseFileDownloadUrlResult;
19
25
  //# sourceMappingURL=useFileDownloadUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDownloadUrl.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFileDownloadUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,GAAG,IAAI,GAAG,SAAS,EAC3C,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,yBAAyB,KAClC,wBAyDF,CAAC"}
1
+ {"version":3,"file":"useFileDownloadUrl.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFileDownloadUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAYD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,GAAG,IAAI,GAAG,SAAS,EAC3C,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,yBAAyB,KAClC,wBAkDF,CAAC"}
@@ -36,6 +36,8 @@ export type { OxyPayButtonProps } from './components/OxyPayButton.js';
36
36
  export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyContext.js';
37
37
  export { useAuth } from './hooks/useAuth.js';
38
38
  export { useAccountColor, useAccountColorSave, resolveAccountColor, entitledAccountColors, } from './hooks/useAccountColor.js';
39
+ export { useAccountTheme, useAccountThemeControls } from './hooks/useAccountTheme.js';
40
+ export type { AccountThemeControls, ThemeSource } from './hooks/useAccountTheme.js';
39
41
  export { useAppAssertion, AppAssertionProviderMissingError, } from './appAssertion/AppAssertionContext.js';
40
42
  export type { UseAppAssertionResult } from './appAssertion/AppAssertionContext.js';
41
43
  export type { AppAssertionSnapshot, AppAssertionStatus } from './appAssertion/appAssertionManager.js';
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/ui/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,wBAAqB,CAAC;AAG7B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,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E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAsC,CAAC;AAC/E,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AAM9E,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,6BAA0B,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA0B,CAAC;AAG/E,OAAO,EACL,SAAS,EACT,wBAAwB,EACxB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,8BAA2B,CAAC;AACnC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,8BAA8B,EAC9B,8BAA8B,GAC/B,MAAM,8BAA2B,CAAC;AACnC,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,8BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAoB,CAAC;AAGlD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,0BAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAAuB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * useAccountTheme / useAccountThemeControls
3
+ *
4
+ * The Oxy account carries a portable theme (`user.themePreference`: a mode and
5
+ * a colour preset) that every Oxy app can wear. The COLOUR is the account
6
+ * colour and always applies (`useAccountColor`). Whether an app also follows
7
+ * the account's MODE is the viewer's choice per device: the theme SOURCE.
8
+ *
9
+ * - `account` (the default): the account's mode is applied to Bloom, and a mode
10
+ * chosen here is written back to the account for the other Oxy apps.
11
+ * - `app`: the mode stays on this device; nothing is written to the account.
12
+ *
13
+ * The source is a local preference, never sent anywhere. On web it is read
14
+ * synchronously, so the first paint already knows it; on native it resolves
15
+ * from AsyncStorage right after mount. Bloom's own persistence still paints the
16
+ * last theme instantly on cold boot, so the account theme lands without a flash
17
+ * once the session resolves.
18
+ */
19
+ import { type AppColorName, type ThemeMode } from '@oxy.so/bloom/theme';
20
+ /** Where the app's theme MODE comes from on this device. */
21
+ export type ThemeSource = 'app' | 'account';
22
+ /**
23
+ * Apply the account theme to Bloom: the colour always (through
24
+ * `useAccountColor`, which `canUse` can narrow), the mode while this device's
25
+ * source is `account`. Mount ONCE, inside `OxyProvider` and Bloom's theme
26
+ * provider.
27
+ */
28
+ export declare function useAccountTheme({ canUse, }?: {
29
+ canUse?: (name: AppColorName) => boolean;
30
+ }): void;
31
+ export interface AccountThemeControls {
32
+ /** The effective source: `app` whenever no session can reach the account. */
33
+ source: ThemeSource;
34
+ /** Switch this device's source; enabling `account` seeds an account with no theme yet. */
35
+ changeThemeSource: (source: ThemeSource) => void;
36
+ /** Change the mode now; on the `account` source, also write it to the account. */
37
+ changeThemeMode: (mode: ThemeMode) => Promise<void>;
38
+ }
39
+ /**
40
+ * Source-aware theme mode changes for a settings screen. Bloom changes at once;
41
+ * on the `account` source the account's portable theme follows. Without a
42
+ * usable session the effective source is `app`, so changes stay local, and the
43
+ * stored choice applies again once signed in. The colour is chosen with
44
+ * `useAccountColorSave`.
45
+ */
46
+ export declare function useAccountThemeControls(): AccountThemeControls;
47
+ //# sourceMappingURL=useAccountTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAccountTheme.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMvF,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;AA4D5C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,CAiBZ;AAED,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,MAAM,EAAE,WAAW,CAAC;IACpB,0FAA0F;IAC1F,iBAAiB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,kFAAkF;IAClF,eAAe,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,oBAAoB,CA0C9D"}
@@ -9,11 +9,17 @@ export interface UseFileDownloadUrlResult {
9
9
  error: Error | null;
10
10
  }
11
11
  /**
12
- * Hook to resolve a file's download URL asynchronously.
12
+ * Resolve a file's download URL for the current caller.
13
13
  *
14
- * Uses `getFileDownloadUrlAsync`, which returns a scoped media-token stream URL
15
- * for private assets. There is no sync CDN fallback — the synchronous
16
- * `getFileDownloadUrl` is public-CDN-only and 404s for private uploads.
14
+ * A URL `assets.url` already resolved is answered in the FIRST render from
15
+ * core's identity-scoped cache (`assets.cachedUrl`): no request, no loading
16
+ * frame. Only a miss resolves asynchronously, through `assets.url`, which
17
+ * returns a scoped media-token stream URL for a private asset. There is no
18
+ * public-CDN fallback: `assets.publicUrl` 404s for private uploads. A
19
+ * reference that is already an absolute `http(s)` URL is returned unchanged.
20
+ *
21
+ * For a synchronous, render-only answer (an image resolver, a list row) use
22
+ * `oxyServices.assets.renderUrl`, which reads the same cache.
17
23
  */
18
24
  export declare const useFileDownloadUrl: (oxyServices: OxyServices | null | undefined, fileId: string | null | undefined, options?: UseFileDownloadUrlOptions) => UseFileDownloadUrlResult;
19
25
  //# sourceMappingURL=useFileDownloadUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDownloadUrl.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFileDownloadUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,GAAG,IAAI,GAAG,SAAS,EAC3C,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,yBAAyB,KAClC,wBAyDF,CAAC"}
1
+ {"version":3,"file":"useFileDownloadUrl.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFileDownloadUrl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAYD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,WAAW,GAAG,IAAI,GAAG,SAAS,EAC3C,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,yBAAyB,KAClC,wBAkDF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/services",
3
- "version": "13.2.0",
3
+ "version": "13.4.0",
4
4
  "description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -160,7 +160,7 @@
160
160
  "@commitlint/config-conventional": "^21.2.0",
161
161
  "@expo/app-integrity": "~58.0.2",
162
162
  "@expo/vector-icons": "^15.0.3",
163
- "@oxy.so/core": "7.1.0",
163
+ "@oxy.so/core": "7.2.0",
164
164
  "@react-native-async-storage/async-storage": "^2.0.0",
165
165
  "@react-native-community/netinfo": "^12.0.1",
166
166
  "@react-native/babel-preset": "^0.88.0",
@@ -209,13 +209,13 @@
209
209
  "expo-video": "~58.0.12"
210
210
  },
211
211
  "//@oxy.so/bloom": "Bloom 11.1.0 adds the shared grouped sections, usage card, subscription plans, frame appearance and overlay navigation APIs used by this SDK. First-party Bloom peers remain open above this tested minimum.",
212
- "//@oxy.so/core": "Core 6.16.0 supplies `requireServerVerdict` and `onHolderRejected`, with which the cold boot checks a session it painted from the cache; 6.13.0 supplies the `accounts.settings.*` strings (picture, categories) the account settings speak in every language; 6.12.0 supplies `fileManagement.contentLost` and the `lost` file status a lost file is listed with; 6.11.0 supplies the `follow.errors.*` strings the follow error codes are worded with; 6.4.0 the `follow.*` strings the follow buttons read for every verb and language; 6.1.0 the `oxy.auth.email.{startChange,change,remove}` and `oxy.auth.password.remove` the sign-in & security panels call. Keep one Core instance per app; raise this floor with the root catalogue when new runtime APIs are required.",
212
+ "//@oxy.so/core": "Core 7.2.0 supplies `assets.cachedUrl`, with which `useFileDownloadUrl` answers an already-resolved URL in its first render; 6.16.0 supplies `requireServerVerdict` and `onHolderRejected`, with which the cold boot checks a session it painted from the cache; 6.13.0 supplies the `accounts.settings.*` strings (picture, categories) the account settings speak in every language; 6.12.0 supplies `fileManagement.contentLost` and the `lost` file status a lost file is listed with; 6.11.0 supplies the `follow.errors.*` strings the follow error codes are worded with; 6.4.0 the `follow.*` strings the follow buttons read for every verb and language; 6.1.0 the `oxy.auth.email.{startChange,change,remove}` and `oxy.auth.password.remove` the sign-in & security panels call. Keep one Core instance per app; raise this floor with the root catalogue when new runtime APIs are required.",
213
213
  "//react-native": "React Native 0.81 to 0.88, React 19.1+ and Expo SDK 54 to 58. The floors are the Expo SDK 54 stack (react-native 0.81.6, react 19.1.4, react-native-web 0.21.4, expo 54.0.38 and the module versions its bundledNativeModules.json pins), which compat/expo-54 installs as an external consumer and checks on every CI run (`bun check.mjs`): every peer here admits that stack, services' published src typechecks against its types, and <OxyProvider> mounts and settles its cold boot on iOS (React Native 0.81), web (react-native-web 0.21) and react-native-macos 0.81 with the native modules macOS lacks absent. Astro, Oxy's browser, runs react-native-macos 0.81 (0.83 is its latest release), which is why the floor is not 0.85. The SDK 56 floors these replaced were the versions current when the ranges were first written, not measurements.",
214
214
  "peerDependencies": {
215
215
  "@expo/app-integrity": ">=0.1.10 <59.0.0",
216
216
  "@expo/vector-icons": "^15.0.3",
217
217
  "@oxy.so/bloom": ">=11.1.0",
218
- "@oxy.so/core": "^7.0.0",
218
+ "@oxy.so/core": "^7.2.0",
219
219
  "@react-native-async-storage/async-storage": "^2.0.0",
220
220
  "@react-native-community/netinfo": ">=11.4.1 <13.0.0",
221
221
  "@tanstack/query-async-storage-persister": "^5.101",