@oxy.so/services 12.8.0 → 12.10.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.
- package/lib/commonjs/ui/client.js +12 -0
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAccountColor.js +75 -0
- package/lib/commonjs/ui/hooks/useAccountColor.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +20 -10
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/trashActions.js +5 -2
- package/lib/commonjs/ui/screens/fileManagement/trashActions.js.map +1 -1
- package/lib/module/ui/client.js +1 -1
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/module/ui/hooks/useAccountColor.js +74 -1
- package/lib/module/ui/hooks/useAccountColor.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +20 -10
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/trashActions.js +5 -2
- package/lib/module/ui/screens/fileManagement/trashActions.js.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAccountColor.d.ts +23 -0
- package/lib/typescript/commonjs/ui/hooks/useAccountColor.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/trashActions.d.ts +4 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/trashActions.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +1 -1
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAccountColor.d.ts +23 -0
- package/lib/typescript/module/ui/hooks/useAccountColor.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/trashActions.d.ts +4 -1
- package/lib/typescript/module/ui/screens/fileManagement/trashActions.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/ui/client.ts +6 -1
- package/src/ui/hooks/queries/useFileQueries.ts +4 -1
- package/src/ui/hooks/useAccountColor.ts +71 -1
- package/src/ui/screens/FileManagementScreen.tsx +33 -21
- package/src/ui/screens/fileManagement/trashActions.ts +5 -2
|
@@ -22,4 +22,27 @@ export declare function resolveAccountColor(user: Pick<User, 'color' | 'themePre
|
|
|
22
22
|
export declare function useAccountColor({ canUse, }?: {
|
|
23
23
|
canUse?: (name: AppColorName) => boolean;
|
|
24
24
|
}): void;
|
|
25
|
+
type EntitlementSubject = Pick<User, 'username' | 'personalization'> | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The presets this account may choose, from the contract's own gate table: a
|
|
28
|
+
* free preset, the one named after the account's handle (`oxy`, `faircoin`), and
|
|
29
|
+
* `mono` while the account holds the benefit that grants it. The API enforces
|
|
30
|
+
* the same rule when it stores the value; this only keeps a picker from offering
|
|
31
|
+
* what it would refuse.
|
|
32
|
+
*/
|
|
33
|
+
export declare function entitledAccountColors(user: EntitlementSubject, now?: number): readonly AppColorName[];
|
|
34
|
+
/**
|
|
35
|
+
* Choose the account's colour: one `updateMe` writes `color` and the portable
|
|
36
|
+
* `themePreference.colorPreset` together (the mode already on the account is
|
|
37
|
+
* kept), the Bloom theme follows at once, and the session user is updated
|
|
38
|
+
* optimistically so `useAccountColor` agrees with it. `colors` is what the
|
|
39
|
+
* picker should list.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useAccountColorSave(): {
|
|
42
|
+
colors: readonly AppColorName[];
|
|
43
|
+
value: AppColorName;
|
|
44
|
+
saveColor: (name: AppColorName) => Promise<void>;
|
|
45
|
+
saving: boolean;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
25
48
|
//# sourceMappingURL=useAccountColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAW1F,2EAA2E;AAC3E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/D,YAAY,GAAG,IAAI,CAGrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,CAUZ;AAED,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAExF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,GAAG,GAAE,MAAmB,GACvB,SAAS,YAAY,EAAE,CAYzB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,OAAO,CAAC;CACjB,CA4BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileManagementScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/FileManagementScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA6CzE,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"FileManagementScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/FileManagementScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA6CzE,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA69C7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -24,7 +24,10 @@ export interface TrashAssetsApi {
|
|
|
24
24
|
}
|
|
25
25
|
/** What removing a file from the library does to it. */
|
|
26
26
|
export type LibraryRemoval = 'trash' | 'delete';
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* A `blocked` file is deleted (it cannot go to trash), and so is a `lost` one
|
|
29
|
+
* (ADR 0043 D13: nothing is left to restore); every other is trashed.
|
|
30
|
+
*/
|
|
28
31
|
export declare function libraryRemovalFor(file: Pick<FileMetadata, 'status'>): LibraryRemoval;
|
|
29
32
|
/** The HTTP status of a failed asset call, when it carries one. */
|
|
30
33
|
export declare function errorStatus(error: unknown): number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trashActions.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/trashActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAED,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"trashActions.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/trashActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAED,wDAAwD;AACxD,MAAM,MAAM,cAAc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O,CAAC,oBAAoB,CAAC,CAwB/B"}
|
|
@@ -35,7 +35,7 @@ export { default as OxyPayButton } from './components/OxyPayButton.js';
|
|
|
35
35
|
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
|
-
export { useAccountColor, resolveAccountColor } from './hooks/useAccountColor.js';
|
|
38
|
+
export { useAccountColor, useAccountColorSave, resolveAccountColor, entitledAccountColors, } from './hooks/useAccountColor.js';
|
|
39
39
|
export { useAppAssertion, AppAssertionProviderMissingError, } from './appAssertion/AppAssertionContext.js';
|
|
40
40
|
export type { UseAppAssertionResult } from './appAssertion/AppAssertionContext.js';
|
|
41
41
|
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,IAAI,eAAe,EAAE,MAAM,iCAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,+BAA4B,CAAC;AACtE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA4B,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8BAA2B,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,8BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,o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AY,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useFileQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIxE,8BAA8B;AAC9B,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACn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E,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,GACpB,IAAI,CAIN;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,IAAI,CAYN;AAID;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,iBAAc,mFAS9D,CAAC;AAEF,+FAA+F;AAC/F,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GACpB,qBAAqB,EAAE,GAAG,SAAS,CAUrC"}
|
|
@@ -22,4 +22,27 @@ export declare function resolveAccountColor(user: Pick<User, 'color' | 'themePre
|
|
|
22
22
|
export declare function useAccountColor({ canUse, }?: {
|
|
23
23
|
canUse?: (name: AppColorName) => boolean;
|
|
24
24
|
}): void;
|
|
25
|
+
type EntitlementSubject = Pick<User, 'username' | 'personalization'> | null | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The presets this account may choose, from the contract's own gate table: a
|
|
28
|
+
* free preset, the one named after the account's handle (`oxy`, `faircoin`), and
|
|
29
|
+
* `mono` while the account holds the benefit that grants it. The API enforces
|
|
30
|
+
* the same rule when it stores the value; this only keeps a picker from offering
|
|
31
|
+
* what it would refuse.
|
|
32
|
+
*/
|
|
33
|
+
export declare function entitledAccountColors(user: EntitlementSubject, now?: number): readonly AppColorName[];
|
|
34
|
+
/**
|
|
35
|
+
* Choose the account's colour: one `updateMe` writes `color` and the portable
|
|
36
|
+
* `themePreference.colorPreset` together (the mode already on the account is
|
|
37
|
+
* kept), the Bloom theme follows at once, and the session user is updated
|
|
38
|
+
* optimistically so `useAccountColor` agrees with it. `colors` is what the
|
|
39
|
+
* picker should list.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useAccountColorSave(): {
|
|
42
|
+
colors: readonly AppColorName[];
|
|
43
|
+
value: AppColorName;
|
|
44
|
+
saveColor: (name: AppColorName) => Promise<void>;
|
|
45
|
+
saving: boolean;
|
|
46
|
+
};
|
|
47
|
+
export {};
|
|
25
48
|
//# sourceMappingURL=useAccountColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAW1F,2EAA2E;AAC3E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/D,YAAY,GAAG,IAAI,CAGrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,CAUZ;AAED,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAExF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,GAAG,GAAE,MAAmB,GACvB,SAAS,YAAY,EAAE,CAYzB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,OAAO,CAAC;CACjB,CA4BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileManagementScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/FileManagementScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAAyB,CAAC;AA6CzE,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"FileManagementScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/FileManagementScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAAyB,CAAC;AA6CzE,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA69C7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -24,7 +24,10 @@ export interface TrashAssetsApi {
|
|
|
24
24
|
}
|
|
25
25
|
/** What removing a file from the library does to it. */
|
|
26
26
|
export type LibraryRemoval = 'trash' | 'delete';
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* A `blocked` file is deleted (it cannot go to trash), and so is a `lost` one
|
|
29
|
+
* (ADR 0043 D13: nothing is left to restore); every other is trashed.
|
|
30
|
+
*/
|
|
28
31
|
export declare function libraryRemovalFor(file: Pick<FileMetadata, 'status'>): LibraryRemoval;
|
|
29
32
|
/** The HTTP status of a failed asset call, when it carries one. */
|
|
30
33
|
export declare function errorStatus(error: unknown): number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trashActions.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/trashActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAED,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD
|
|
1
|
+
{"version":3,"file":"trashActions.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/trashActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CA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EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GACrE,OAAO,CAAC,oBAAoB,CAAC,CAwB/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxy.so/services",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.10.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",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"prepublishOnly": "node ../../scripts/assert-bun-publish.mjs && bun run typescript && bun run test && bun run build"
|
|
152
152
|
},
|
|
153
153
|
"dependencies": {
|
|
154
|
-
"@oxy.so/contracts": "^5.
|
|
154
|
+
"@oxy.so/contracts": "^5.7.0",
|
|
155
155
|
"color": "^5.0.3",
|
|
156
156
|
"@peable.to/sdk": "0.4.1"
|
|
157
157
|
},
|
|
@@ -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": "6.
|
|
163
|
+
"@oxy.so/core": "6.12.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",
|
|
@@ -210,12 +210,12 @@
|
|
|
210
210
|
"expo-video": "~58.0.11"
|
|
211
211
|
},
|
|
212
212
|
"//@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.",
|
|
213
|
-
"//@oxy.so/core": "Core 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
|
+
"//@oxy.so/core": "Core 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.",
|
|
214
214
|
"peerDependencies": {
|
|
215
215
|
"@expo/app-integrity": ">=56.0.0 <59.0.0",
|
|
216
216
|
"@expo/vector-icons": "^15.0.3",
|
|
217
217
|
"@oxy.so/bloom": ">=11.1.0",
|
|
218
|
-
"@oxy.so/core": "^6.
|
|
218
|
+
"@oxy.so/core": "^6.12.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",
|
package/src/ui/client.ts
CHANGED
|
@@ -47,7 +47,12 @@ export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyCo
|
|
|
47
47
|
|
|
48
48
|
// Hooks
|
|
49
49
|
export { useAuth } from './hooks/useAuth';
|
|
50
|
-
export {
|
|
50
|
+
export {
|
|
51
|
+
useAccountColor,
|
|
52
|
+
useAccountColorSave,
|
|
53
|
+
resolveAccountColor,
|
|
54
|
+
entitledAccountColors,
|
|
55
|
+
} from './hooks/useAccountColor';
|
|
51
56
|
// This app's Oxy-signed assertion of which app it is (ADR 0045), for an SDK
|
|
52
57
|
// that attaches it to its own requests without pulling in the account screens.
|
|
53
58
|
export {
|
|
@@ -60,7 +60,10 @@ export function mapRawFileToMetadata(raw: RawUserFile): FileMetadata {
|
|
|
60
60
|
chunkSize: 0,
|
|
61
61
|
uploadDate: raw.createdAt ?? '',
|
|
62
62
|
...(typeof raw.inUse === 'boolean' ? { inUse: raw.inUse } : {}),
|
|
63
|
-
...(raw.status === 'active' ||
|
|
63
|
+
...(raw.status === 'active' ||
|
|
64
|
+
raw.status === 'trash' ||
|
|
65
|
+
raw.status === 'blocked' ||
|
|
66
|
+
raw.status === 'lost'
|
|
64
67
|
? { status: raw.status }
|
|
65
68
|
: {}),
|
|
66
69
|
...(typeof raw.trashedAt === 'string' ? { trashedAt: raw.trashedAt } : {}),
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
* default instead of a colour the viewer is not entitled to.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { useEffect } from 'react';
|
|
19
|
+
import { useCallback, useEffect, useMemo } from 'react';
|
|
20
20
|
import type { User } from '@oxy.so/core';
|
|
21
21
|
import { APP_COLOR_PRESETS, useBloomTheme, type AppColorName } from '@oxy.so/bloom/theme';
|
|
22
|
+
import { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS } from '@oxy.so/contracts/client';
|
|
22
23
|
import { useAuth } from './useAuth';
|
|
24
|
+
import { useUpdateProfile } from './mutations/useAccountMutations';
|
|
23
25
|
|
|
24
26
|
function isAppColorName(value: unknown): value is AppColorName {
|
|
25
27
|
return (
|
|
@@ -50,3 +52,71 @@ export function useAccountColor({
|
|
|
50
52
|
setColorPreset(accountColor);
|
|
51
53
|
}, [isAuthenticated, accountColor, allowed, colorPreset, setColorPreset]);
|
|
52
54
|
}
|
|
55
|
+
|
|
56
|
+
type EntitlementSubject = Pick<User, 'username' | 'personalization'> | null | undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The presets this account may choose, from the contract's own gate table: a
|
|
60
|
+
* free preset, the one named after the account's handle (`oxy`, `faircoin`), and
|
|
61
|
+
* `mono` while the account holds the benefit that grants it. The API enforces
|
|
62
|
+
* the same rule when it stores the value; this only keeps a picker from offering
|
|
63
|
+
* what it would refuse.
|
|
64
|
+
*/
|
|
65
|
+
export function entitledAccountColors(
|
|
66
|
+
user: EntitlementSubject,
|
|
67
|
+
now: number = Date.now(),
|
|
68
|
+
): readonly AppColorName[] {
|
|
69
|
+
const handle = user?.username?.trim().toLowerCase();
|
|
70
|
+
const grant = user?.personalization?.mentionMono;
|
|
71
|
+
const expires = grant?.expiresAt === null ? Infinity : Date.parse(grant?.expiresAt ?? '');
|
|
72
|
+
const hasMono = grant?.allowed === true && expires > now;
|
|
73
|
+
const supported = new Set<string>(USER_PROFILE_COLOR_PRESETS);
|
|
74
|
+
return USER_PROFILE_COLORS.filter(({ name, gate }) => {
|
|
75
|
+
if (!supported.has(name) || !isAppColorName(name)) return false;
|
|
76
|
+
if (gate === null) return true;
|
|
77
|
+
if (gate === 'handle') return name === handle;
|
|
78
|
+
return name === 'mono' && hasMono;
|
|
79
|
+
}).map(({ name }) => name as AppColorName);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Choose the account's colour: one `updateMe` writes `color` and the portable
|
|
84
|
+
* `themePreference.colorPreset` together (the mode already on the account is
|
|
85
|
+
* kept), the Bloom theme follows at once, and the session user is updated
|
|
86
|
+
* optimistically so `useAccountColor` agrees with it. `colors` is what the
|
|
87
|
+
* picker should list.
|
|
88
|
+
*/
|
|
89
|
+
export function useAccountColorSave(): {
|
|
90
|
+
colors: readonly AppColorName[];
|
|
91
|
+
value: AppColorName;
|
|
92
|
+
saveColor: (name: AppColorName) => Promise<void>;
|
|
93
|
+
saving: boolean;
|
|
94
|
+
} {
|
|
95
|
+
const { user } = useAuth();
|
|
96
|
+
const { mode, colorPreset, setColorPreset } = useBloomTheme();
|
|
97
|
+
const { mutateAsync, isPending } = useUpdateProfile();
|
|
98
|
+
const colors = useMemo(() => entitledAccountColors(user), [user]);
|
|
99
|
+
const saveColor = useCallback(
|
|
100
|
+
async (name: AppColorName) => {
|
|
101
|
+
if (!colors.includes(name)) throw new Error('Color is not available for this account');
|
|
102
|
+
const previous = colorPreset;
|
|
103
|
+
setColorPreset(name);
|
|
104
|
+
try {
|
|
105
|
+
await mutateAsync({
|
|
106
|
+
color: name,
|
|
107
|
+
themePreference: {
|
|
108
|
+
mode:
|
|
109
|
+
user?.themePreference?.mode ??
|
|
110
|
+
(mode === 'light' || mode === 'dark' ? mode : 'system'),
|
|
111
|
+
colorPreset: name,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
} catch (error) {
|
|
115
|
+
setColorPreset(previous);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
[colors, colorPreset, setColorPreset, mutateAsync, user, mode],
|
|
120
|
+
);
|
|
121
|
+
return { colors, value: colorPreset, saveColor, saving: isPending };
|
|
122
|
+
}
|
|
@@ -150,10 +150,13 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
150
150
|
// Derived filtered and sorted files (avoid setState loops)
|
|
151
151
|
const filteredFiles = useMemo(() => {
|
|
152
152
|
let filteredByMode = files;
|
|
153
|
+
// A lost file (ADR 0043 D13) has no media to show: it is listed under
|
|
154
|
+
// "all" and "documents" only, as lost, never as a broken thumbnail.
|
|
155
|
+
const withMedia = files.filter((file) => file.status !== 'lost');
|
|
153
156
|
if (viewMode === 'photos') {
|
|
154
|
-
filteredByMode =
|
|
157
|
+
filteredByMode = withMedia.filter((file) => file.contentType.startsWith('image/'));
|
|
155
158
|
} else if (viewMode === 'videos') {
|
|
156
|
-
filteredByMode =
|
|
159
|
+
filteredByMode = withMedia.filter((file) => file.contentType.startsWith('video/'));
|
|
157
160
|
} else if (viewMode === 'documents') {
|
|
158
161
|
filteredByMode = files.filter(
|
|
159
162
|
(file) =>
|
|
@@ -167,7 +170,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
167
170
|
file.contentType.includes('powerpoint'),
|
|
168
171
|
);
|
|
169
172
|
} else if (viewMode === 'audio') {
|
|
170
|
-
filteredByMode =
|
|
173
|
+
filteredByMode = withMedia.filter((file) => file.contentType.startsWith('audio/'));
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
let filtered = filteredByMode;
|
|
@@ -721,6 +724,8 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
721
724
|
toggleSelect(file);
|
|
722
725
|
return;
|
|
723
726
|
}
|
|
727
|
+
// Nothing to open: its bytes are gone (ADR 0043 D13). The row says so.
|
|
728
|
+
if (file.status === 'lost') return;
|
|
724
729
|
try {
|
|
725
730
|
setLoadingFileContent(true);
|
|
726
731
|
setOpenedFile(file);
|
|
@@ -865,7 +870,8 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
865
870
|
const isImage = file.contentType.startsWith('image/');
|
|
866
871
|
const isPDF = file.contentType.includes('pdf');
|
|
867
872
|
const isVideo = file.contentType.startsWith('video/');
|
|
868
|
-
const
|
|
873
|
+
const isLost = file.status === 'lost';
|
|
874
|
+
const hasPreview = !isLost && (isImage || isPDF || isVideo);
|
|
869
875
|
const isSelected = selectedIds.has(file.id);
|
|
870
876
|
|
|
871
877
|
// Create icon for preview thumbnails (36x36)
|
|
@@ -948,7 +954,9 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
948
954
|
id: file.id,
|
|
949
955
|
icon:
|
|
950
956
|
fileIcon ??
|
|
951
|
-
(
|
|
957
|
+
(isLost ? (
|
|
958
|
+
<Ionicons name="cloud-offline-outline" size={20} color={colors.error} />
|
|
959
|
+
) : !hasPreview ? (
|
|
952
960
|
<Ionicons name={getFileIcon(file.contentType)} size={20} color={colors.primary} />
|
|
953
961
|
) : undefined),
|
|
954
962
|
title: file.filename,
|
|
@@ -958,9 +966,11 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
958
966
|
description: `${formatFileSize(file.length)} • ${new Date(file.uploadDate).toLocaleDateString()}${
|
|
959
967
|
file.status === 'blocked'
|
|
960
968
|
? ` • ${t('fileManagement.removedAfterClaim')}`
|
|
961
|
-
:
|
|
962
|
-
? ` • ${t('fileManagement.
|
|
963
|
-
:
|
|
969
|
+
: isLost
|
|
970
|
+
? ` • ${t('fileManagement.contentLost')}`
|
|
971
|
+
: file.inUse === false
|
|
972
|
+
? ` • ${t('fileManagement.notInUse')}`
|
|
973
|
+
: ''
|
|
964
974
|
}`,
|
|
965
975
|
onPress: () => {
|
|
966
976
|
// Support selection in regular mode with long press or if already selecting
|
|
@@ -975,7 +985,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
975
985
|
rightElement:
|
|
976
986
|
!selectMode && selectedIds.size === 0 ? (
|
|
977
987
|
<View className="flex-row items-center gap-1.5 ml-3">
|
|
978
|
-
{
|
|
988
|
+
{hasPreview ? (
|
|
979
989
|
<Button
|
|
980
990
|
appearance="subtle"
|
|
981
991
|
tone="neutral"
|
|
@@ -987,16 +997,18 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
987
997
|
icon={<Ionicons name="eye" size={18} color={colors.text} />}
|
|
988
998
|
/>
|
|
989
999
|
) : null}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
+
{isLost ? null : (
|
|
1001
|
+
<Button
|
|
1002
|
+
appearance="subtle"
|
|
1003
|
+
tone="neutral"
|
|
1004
|
+
size="sm"
|
|
1005
|
+
iconOnly
|
|
1006
|
+
stopPropagation
|
|
1007
|
+
accessibilityLabel={`Download ${file.filename}`}
|
|
1008
|
+
onPress={() => handleFileDownload(file.id, file.filename)}
|
|
1009
|
+
icon={<Ionicons name="download" size={18} color={colors.text} />}
|
|
1010
|
+
/>
|
|
1011
|
+
)}
|
|
1000
1012
|
<Button
|
|
1001
1013
|
appearance="subtle"
|
|
1002
1014
|
tone="danger"
|
|
@@ -1005,7 +1017,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
1005
1017
|
stopPropagation
|
|
1006
1018
|
loading={deletingId === file.id}
|
|
1007
1019
|
accessibilityLabel={t(
|
|
1008
|
-
file
|
|
1020
|
+
libraryRemovalFor(file) === 'delete'
|
|
1009
1021
|
? 'fileManagement.a11y.deleteFile'
|
|
1010
1022
|
: 'fileManagement.a11y.moveToTrash',
|
|
1011
1023
|
{ name: file.filename },
|
|
@@ -1308,7 +1320,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
|
|
|
1308
1320
|
onDownload={handleFileDownload}
|
|
1309
1321
|
onDelete={confirmFileDelete}
|
|
1310
1322
|
deleteLabel={
|
|
1311
|
-
openedFile
|
|
1323
|
+
libraryRemovalFor(openedFile) === 'delete'
|
|
1312
1324
|
? t('fileManagement.deleteFile')
|
|
1313
1325
|
: t('fileManagement.moveToTrash')
|
|
1314
1326
|
}
|
|
@@ -25,9 +25,12 @@ export interface TrashAssetsApi {
|
|
|
25
25
|
/** What removing a file from the library does to it. */
|
|
26
26
|
export type LibraryRemoval = 'trash' | 'delete';
|
|
27
27
|
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* A `blocked` file is deleted (it cannot go to trash), and so is a `lost` one
|
|
30
|
+
* (ADR 0043 D13: nothing is left to restore); every other is trashed.
|
|
31
|
+
*/
|
|
29
32
|
export function libraryRemovalFor(file: Pick<FileMetadata, 'status'>): LibraryRemoval {
|
|
30
|
-
return file.status === 'blocked' ? 'delete' : 'trash';
|
|
33
|
+
return file.status === 'blocked' || file.status === 'lost' ? 'delete' : 'trash';
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
/** The HTTP status of a failed asset call, when it carries one. */
|