@oxyhq/services 22.4.2 → 22.6.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/LICENSE +661 -21
- package/README.md +1 -1
- package/lib/commonjs/index.js +20 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/client.js +1 -1
- package/lib/commonjs/ui/components/FontLoader.js +18 -145
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
- package/lib/commonjs/ui/components/FontLoader.native.js +88 -0
- package/lib/commonjs/ui/components/FontLoader.native.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +16 -27
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/styles.js +1 -225
- package/lib/commonjs/ui/components/fileManagement/styles.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +5 -2
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +7 -0
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +14 -5
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +286 -0
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -0
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +23 -8
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFileDownloadUrl.js +7 -21
- package/lib/commonjs/ui/hooks/useFileDownloadUrl.js.map +1 -1
- package/lib/commonjs/ui/hooks/useResolvedFileUrls.js +163 -0
- package/lib/commonjs/ui/hooks/useResolvedFileUrls.js.map +1 -0
- package/lib/commonjs/ui/index.js +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +51 -22
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +216 -203
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +26 -9
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/photoGridLayout.js +44 -0
- package/lib/commonjs/ui/screens/fileManagement/photoGridLayout.js.map +1 -0
- package/lib/commonjs/ui/session/tokenTransport.js +21 -10
- package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -40
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/index.js +7 -1
- package/lib/module/index.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/components/FontLoader.js +18 -146
- package/lib/module/ui/components/FontLoader.js.map +1 -1
- package/lib/module/ui/components/FontLoader.native.js +83 -0
- package/lib/module/ui/components/FontLoader.native.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +1 -1
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +16 -27
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/fileManagement/styles.js +0 -224
- package/lib/module/ui/components/fileManagement/styles.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +5 -2
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +7 -0
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +14 -5
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +282 -0
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -0
- package/lib/module/ui/hooks/useAvatarPicker.js +23 -8
- package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/module/ui/hooks/useFileDownloadUrl.js +7 -21
- package/lib/module/ui/hooks/useFileDownloadUrl.js.map +1 -1
- package/lib/module/ui/hooks/useResolvedFileUrls.js +157 -0
- package/lib/module/ui/hooks/useResolvedFileUrls.js.map +1 -0
- package/lib/module/ui/index.js +1 -1
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +52 -23
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +218 -205
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +26 -9
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/photoGridLayout.js +39 -0
- package/lib/module/ui/screens/fileManagement/photoGridLayout.js.map +1 -0
- package/lib/module/ui/session/tokenTransport.js +21 -10
- package/lib/module/ui/session/tokenTransport.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -39
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +14 -5
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts +13 -0
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/styles.d.ts +0 -218
- package/lib/typescript/commonjs/ui/components/fileManagement/styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +96 -0
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useResolvedFileUrls.d.ts +48 -0
- package/lib/typescript/commonjs/ui/hooks/useResolvedFileUrls.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/photoGridLayout.d.ts +37 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/photoGridLayout.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +15 -8
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +4 -11
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -1
- package/lib/typescript/module/index.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/components/FontLoader.d.ts +14 -5
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts +13 -0
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/styles.d.ts +0 -218
- package/lib/typescript/module/ui/components/fileManagement/styles.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +96 -0
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/useFileDownloadUrl.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useResolvedFileUrls.d.ts +48 -0
- package/lib/typescript/module/ui/hooks/useResolvedFileUrls.d.ts.map +1 -0
- package/lib/typescript/module/ui/index.d.ts +1 -1
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/photoGridLayout.d.ts +37 -0
- package/lib/typescript/module/ui/screens/fileManagement/photoGridLayout.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/tokenTransport.d.ts +15 -8
- package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +4 -11
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +6 -11
- package/src/index.ts +8 -0
- package/src/ui/components/FontLoader.native.tsx +88 -0
- package/src/ui/components/FontLoader.tsx +16 -151
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +17 -18
- package/src/ui/components/fileManagement/UploadPreview.tsx +1 -1
- package/src/ui/components/fileManagement/styles.ts +0 -225
- package/src/ui/context/hooks/useAuthOperations.ts +5 -2
- package/src/ui/context/useOxyAccountGraph.ts +5 -0
- package/src/ui/hooks/queries/__tests__/userCache.test.ts +361 -0
- package/src/ui/hooks/queries/useAccountQueries.ts +14 -5
- package/src/ui/hooks/queries/userCache.ts +308 -0
- package/src/ui/hooks/useAvatarPicker.ts +27 -7
- package/src/ui/hooks/useFileDownloadUrl.ts +7 -23
- package/src/ui/hooks/useResolvedFileUrls.ts +170 -0
- package/src/ui/screens/FileManagementScreen.tsx +55 -27
- package/src/ui/screens/__tests__/photoGridLayout.test.ts +57 -0
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +215 -213
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +27 -3
- package/src/ui/screens/fileManagement/photoGridLayout.ts +45 -0
- package/src/ui/session/__tests__/tokenTransport.test.ts +25 -10
- package/src/ui/session/tokenTransport.ts +21 -10
- package/src/ui/utils/fileManagement.ts +3 -46
- package/lib/typescript/types/expo-vector-icons.d.ts +0 -22
- package/src/types/expo-vector-icons.d.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhotoPickerSection.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/PhotoPickerSection.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PhotoPickerSection.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/PhotoPickerSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAqBjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA6FhD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,CAAC;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,cAAc,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;CACtE;AAoJD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA+TnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileUploadState.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/fileManagement/hooks/useFileUploadState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iDAA8C,CAAC;AAElF,OAAO,EACH,KAAK,iBAAiB,EAQzB,MAAM,cAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"useFileUploadState.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/screens/fileManagement/hooks/useFileUploadState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iDAA8C,CAAC;AAElF,OAAO,EACH,KAAK,iBAAiB,EAQzB,MAAM,cAAW,CAAC;AAanB,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IACrD,iBAAiB,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAClE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtF,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;CACtE;AAED,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACrC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,sKAchC,wBAAwB,KAAG,wBAyb7B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column / tile geometry for the "Choose photo" grid.
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: the grid MUST size its tiles from the width of the bottom-sheet
|
|
5
|
+
* container it actually renders in — NOT the device screen. On wide viewports
|
|
6
|
+
* the sheet is centered and narrower than the screen (Bloom `<Dialog>` centers
|
|
7
|
+
* on `md+`), so deriving columns/tiles from `Dimensions.get('window').width`
|
|
8
|
+
* (or `useWindowDimensions`) overflows / mis-sizes the tiles. The caller
|
|
9
|
+
* therefore measures the grid container (`onLayout` on a `style`-only wrapper —
|
|
10
|
+
* RN-Web does not fire `onLayout` for `className`'d nodes) and passes that
|
|
11
|
+
* measured width here.
|
|
12
|
+
*
|
|
13
|
+
* Pure and side-effect free so it is unit-testable in Jest (which cannot catch
|
|
14
|
+
* layout bugs in the rendered tree).
|
|
15
|
+
*/
|
|
16
|
+
/** Inter-tile gutter, in px. Apple Photos-style hairline gap. */
|
|
17
|
+
export declare const PHOTO_GRID_GUTTER = 2;
|
|
18
|
+
/** Container width (px) at/above which the grid switches to 4 columns. */
|
|
19
|
+
export declare const PHOTO_GRID_WIDE_BREAKPOINT = 600;
|
|
20
|
+
export interface PhotoGridLayout {
|
|
21
|
+
/** Number of columns for the current container width. */
|
|
22
|
+
columns: number;
|
|
23
|
+
/**
|
|
24
|
+
* Square tile edge in px. Floored so a full row (columns tiles + gutters)
|
|
25
|
+
* never exceeds the container width.
|
|
26
|
+
*/
|
|
27
|
+
cellSize: number;
|
|
28
|
+
/** Inter-tile gutter used to derive `cellSize`. */
|
|
29
|
+
gutter: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Derive the column count + square tile size from the measured grid-container
|
|
33
|
+
* width. Returns `cellSize: 0` for a not-yet-measured (`<= 0`) width so callers
|
|
34
|
+
* can gate rendering until a real measurement arrives.
|
|
35
|
+
*/
|
|
36
|
+
export declare function computePhotoGridLayout(containerWidth: number): PhotoGridLayout;
|
|
37
|
+
//# sourceMappingURL=photoGridLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"photoGridLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/screens/fileManagement/photoGridLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC5B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,eAAe,CAK9E"}
|
|
@@ -3,14 +3,21 @@ import { type OxyServices, type TokenTransport } from '@oxyhq/core';
|
|
|
3
3
|
* Platform `TokenTransport` for `SessionClient` (device-first model).
|
|
4
4
|
*
|
|
5
5
|
* `ensureActiveToken` is the fallback the client uses when a `session_state`
|
|
6
|
-
* push arrived WITHOUT an embedded `activeToken` and the
|
|
7
|
-
*
|
|
8
|
-
* request-time preflight, and the 401
|
|
9
|
-
* `oxyServices.httpService.refreshAccessToken(...)` — which runs
|
|
10
|
-
* refresh handler (present the persisted zero-cookie `deviceId` +
|
|
11
|
-
* at `POST /session/device/token
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* push arrived WITHOUT an embedded `activeToken` and the planted bearer does not
|
|
7
|
+
* already belong to the state's active account. It mints one through the ONE
|
|
8
|
+
* unified single-flight the scheduler, the request-time preflight, and the 401
|
|
9
|
+
* retry all use — `oxyServices.httpService.refreshAccessToken(...)` — which runs
|
|
10
|
+
* the installed refresh handler (present the persisted zero-cookie `deviceId` +
|
|
11
|
+
* `deviceSecret` at `POST /session/device/token`, which mints for the device's
|
|
12
|
+
* CURRENT active account). Routing through the SAME entry point means this lane
|
|
13
|
+
* can never double-rotate the device secret against the others: it has NO
|
|
14
|
+
* private single-flight of its own.
|
|
15
|
+
*
|
|
16
|
+
* The short-circuit compares the planted bearer's ACCOUNT against
|
|
17
|
+
* `state.activeAccountId`, not mere token presence: a bearer for the PREVIOUS
|
|
18
|
+
* account (an account switch) must still mint the new account's token — skipping
|
|
19
|
+
* on presence alone would leave a subscriber observing the new active account
|
|
20
|
+
* under the old account's bearer (the account-switch 404 race).
|
|
14
21
|
*
|
|
15
22
|
* A failure is logged and swallowed: this method must never throw out (it runs
|
|
16
23
|
* inside the socket state handler).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5E
|
|
1
|
+
{"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,cAAc,CA8B7E"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import type { AssetUploadInput, RNFileDescriptor } from '@oxyhq/core';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
2
4
|
import type { RouteName } from '../navigation/routes.js';
|
|
3
5
|
/**
|
|
4
6
|
* Extended File interface that includes a `uri` property for mobile preview support.
|
|
@@ -32,7 +34,7 @@ export declare function formatFileSize(bytes: number): string;
|
|
|
32
34
|
/**
|
|
33
35
|
* Get icon name for file based on content type
|
|
34
36
|
*/
|
|
35
|
-
export declare function getFileIcon(contentType: string):
|
|
37
|
+
export declare function getFileIcon(contentType: string): ComponentProps<typeof Ionicons>['name'];
|
|
36
38
|
/**
|
|
37
39
|
* Convert a document/image picker asset into a value that
|
|
38
40
|
* `OxyServices.assetUpload` can accept.
|
|
@@ -46,15 +48,6 @@ export declare function getFileIcon(contentType: string): string;
|
|
|
46
48
|
* 'ArrayBuffer' and 'ArrayBufferView' are not supported").
|
|
47
49
|
*/
|
|
48
50
|
export declare function convertDocumentPickerAssetToFile(doc: PickerAsset, index: number): Promise<FileWithUri | RNFileDescriptor | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Helper to safely request a thumbnail variant only for image mime types.
|
|
51
|
-
* Prevents backend warnings: "Variant thumb not supported for mime application/pdf".
|
|
52
|
-
*
|
|
53
|
-
* @param file - File metadata
|
|
54
|
-
* @param variant - Variant type (default: 'thumb')
|
|
55
|
-
* @param getFileDownloadUrl - Function to get download URL from oxyServices
|
|
56
|
-
*/
|
|
57
|
-
export declare function getSafeDownloadUrl(file: FileMetadata, variant: string, getFileDownloadUrl: (fileId: string, variant?: string) => string): string;
|
|
58
51
|
/**
|
|
59
52
|
* Upload file raw - helper function for file uploads
|
|
60
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileManagement.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/fileManagement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"fileManagement.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/fileManagement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAsB,CAAC;AAGtD;;;;GAIG;AACH,UAAU,WAAY,SAAQ,IAAI;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAO5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CASxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gCAAgC,CAClD,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAAC,CA4DhD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,EAEd,WAAW,EAAE,GAAG,EAChB,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,gBAGjD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACxE,2BAA2B;IAE3B,WAAW,EAAE,GAAG,CAAC;IACjB,mDAAmD;IACnD,qBAAqB,EAAE;QACnB,WAAW,EAAE,CAAC,OAAO,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAClE,CAAC;IACF,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,gCAAgC;IAChC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACvC,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,IAAI,CA8ChF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.6.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",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"directory": "packages/services"
|
|
92
92
|
},
|
|
93
93
|
"author": "OxyHQ",
|
|
94
|
-
"license": "
|
|
94
|
+
"license": "AGPL-3.0-only",
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=18.0.0"
|
|
97
97
|
},
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@oxyhq/contracts": "0.17.0",
|
|
130
|
-
"@oxyhq/core": "^12.
|
|
130
|
+
"@oxyhq/core": "^12.6.0",
|
|
131
131
|
"@simplewebauthn/browser": "^13.3.0",
|
|
132
132
|
"color": "^4.2.3"
|
|
133
133
|
},
|
|
@@ -135,7 +135,8 @@
|
|
|
135
135
|
"@biomejs/biome": "^1.9.4",
|
|
136
136
|
"@commitlint/cli": "^17.6.5",
|
|
137
137
|
"@commitlint/config-conventional": "^17.6.5",
|
|
138
|
-
"@
|
|
138
|
+
"@expo/vector-icons": "^15.0.3",
|
|
139
|
+
"@oxyhq/core": "12.6.0",
|
|
139
140
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
140
141
|
"@react-native-community/netinfo": "^11.4.1",
|
|
141
142
|
"@react-native/babel-preset": "^0.86.0",
|
|
@@ -176,7 +177,7 @@
|
|
|
176
177
|
"peerDependencies": {
|
|
177
178
|
"@expo/vector-icons": "^15.0.3",
|
|
178
179
|
"@oxyhq/bloom": ">=0.16.0",
|
|
179
|
-
"@oxyhq/core": "^12.
|
|
180
|
+
"@oxyhq/core": "^12.6.0",
|
|
180
181
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
181
182
|
"@react-native-community/netinfo": "^11.4.1",
|
|
182
183
|
"@tanstack/query-async-storage-persister": "^5.101",
|
|
@@ -213,9 +214,6 @@
|
|
|
213
214
|
"expo-modules-core": {
|
|
214
215
|
"optional": true
|
|
215
216
|
},
|
|
216
|
-
"@expo/vector-icons": {
|
|
217
|
-
"optional": true
|
|
218
|
-
},
|
|
219
217
|
"@types/react-native": {
|
|
220
218
|
"optional": true
|
|
221
219
|
},
|
|
@@ -225,9 +223,6 @@
|
|
|
225
223
|
"react-native-keyboard-controller": {
|
|
226
224
|
"optional": true
|
|
227
225
|
},
|
|
228
|
-
"react-native-qrcode-svg": {
|
|
229
|
-
"optional": true
|
|
230
|
-
},
|
|
231
226
|
"expo": {
|
|
232
227
|
"optional": true
|
|
233
228
|
},
|
package/src/index.ts
CHANGED
|
@@ -170,6 +170,14 @@ export {
|
|
|
170
170
|
invalidateAuthMethodsQueries,
|
|
171
171
|
} from './ui/hooks/queries/queryKeys';
|
|
172
172
|
|
|
173
|
+
// Canonical user-cache upsert. MERGE-upserts a (possibly partial) user into the
|
|
174
|
+
// SDK's user query cache under both keys it owns (by-id + viewer-scoped
|
|
175
|
+
// by-username). Consumers route ALL cache seeds (feed / list / search / profile
|
|
176
|
+
// hydration) through this so a sparse source can never strip a field an
|
|
177
|
+
// authoritative fetch already stored.
|
|
178
|
+
export { upsertCachedUser, upsertCachedUsers } from './ui/hooks/queries/userCache';
|
|
179
|
+
export type { CacheableUser } from './ui/hooks/queries/userCache';
|
|
180
|
+
|
|
173
181
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
174
182
|
export { useMutationStatus } from './ui/hooks/useMutationStatus';
|
|
175
183
|
export type { MutationStatus } from './ui/hooks/useMutationStatus';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import * as Font from 'expo-font';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the Inter font sources for native environments.
|
|
7
|
+
* Loads all static Inter weights bundled with this package.
|
|
8
|
+
*/
|
|
9
|
+
const getInterFonts = () => {
|
|
10
|
+
try {
|
|
11
|
+
return {
|
|
12
|
+
'Inter-Light': require('../../assets/fonts/Inter/Inter_18pt-Light.ttf'),
|
|
13
|
+
'Inter-Regular': require('../../assets/fonts/Inter/Inter_18pt-Regular.ttf'),
|
|
14
|
+
'Inter-Medium': require('../../assets/fonts/Inter/Inter_18pt-Medium.ttf'),
|
|
15
|
+
'Inter-SemiBold': require('../../assets/fonts/Inter/Inter_18pt-SemiBold.ttf'),
|
|
16
|
+
'Inter-Bold': require('../../assets/fonts/Inter/Inter_18pt-Bold.ttf'),
|
|
17
|
+
'Inter-ExtraBold': require('../../assets/fonts/Inter/Inter_18pt-ExtraBold.ttf'),
|
|
18
|
+
'Inter-Black': require('../../assets/fonts/Inter/Inter_18pt-Black.ttf'),
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (__DEV__) {
|
|
22
|
+
console.warn('Failed to load Inter fonts:', error);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* FontLoader — loads custom fonts in the background while rendering children
|
|
30
|
+
* immediately with system fonts as fallback until the custom fonts are ready.
|
|
31
|
+
*/
|
|
32
|
+
export const FontLoader = ({
|
|
33
|
+
children,
|
|
34
|
+
}: {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}) => {
|
|
37
|
+
const [fontState, setFontState] = useState<'loading' | 'loaded' | 'error'>('loading');
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const loadFonts = async () => {
|
|
41
|
+
try {
|
|
42
|
+
const interFonts = getInterFonts();
|
|
43
|
+
|
|
44
|
+
if (!interFonts) {
|
|
45
|
+
throw new Error('Inter font files not found');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await Font.loadAsync(interFonts);
|
|
49
|
+
setFontState('loaded');
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (__DEV__) {
|
|
52
|
+
console.error('Error loading fonts:', error);
|
|
53
|
+
}
|
|
54
|
+
setFontState('error');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
loadFonts();
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
if (fontState === 'error' && __DEV__) {
|
|
62
|
+
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return <>{children}</>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Setup fonts for applications consuming this package on native.
|
|
70
|
+
*/
|
|
71
|
+
export const setupFonts = async (): Promise<boolean> => {
|
|
72
|
+
try {
|
|
73
|
+
const interFonts = getInterFonts();
|
|
74
|
+
|
|
75
|
+
if (!interFonts) {
|
|
76
|
+
throw new Error('Inter font files not found');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await Font.loadAsync(interFonts);
|
|
80
|
+
return true;
|
|
81
|
+
} catch (error: unknown) {
|
|
82
|
+
if (__DEV__) {
|
|
83
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
84
|
+
console.warn('Error setting up fonts:', errorMessage);
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
@@ -1,162 +1,27 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import * as Font from 'expo-font';
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'Inter-Bold': require('../../assets/fonts/Inter/Inter_18pt-Bold.ttf'),
|
|
20
|
-
'Inter-ExtraBold': require('../../assets/fonts/Inter/Inter_18pt-ExtraBold.ttf'),
|
|
21
|
-
'Inter-Black': require('../../assets/fonts/Inter/Inter_18pt-Black.ttf'),
|
|
22
|
-
};
|
|
23
|
-
} catch (error) {
|
|
24
|
-
if (__DEV__) {
|
|
25
|
-
console.warn('Failed to load Inter fonts:', error);
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* FontLoader component that loads custom fonts in the background while rendering children immediately
|
|
33
|
-
* This works in both the package development and when consumed as an npm package
|
|
34
|
-
* Children render immediately with system fonts as fallback until custom fonts are loaded
|
|
4
|
+
* Font loading — clean default (web, SSR, and any bundler that does not pick a
|
|
5
|
+
* platform variant).
|
|
6
|
+
*
|
|
7
|
+
* Web fonts are Bloom's job: `applyFontFaces()` in `@oxyhq/bloom` injects the
|
|
8
|
+
* Inter / BlomusModernus / Geist Mono `@font-face` rules as self-contained
|
|
9
|
+
* base64 data URLs, so there is nothing for this package to load off native.
|
|
10
|
+
* The real implementation lives in `FontLoader.native.tsx`.
|
|
11
|
+
*
|
|
12
|
+
* Keeping this module free of `expo-font` is load-bearing, not incidental:
|
|
13
|
+
* `expo-font/build/serverContext.web.js` imports `node:async_hooks`, which
|
|
14
|
+
* every browser bundler externalizes. A top-level `expo-font` import here
|
|
15
|
+
* therefore throws at module-evaluation time on web and React never mounts.
|
|
35
16
|
*/
|
|
36
17
|
export const FontLoader = ({
|
|
37
18
|
children,
|
|
38
19
|
}: {
|
|
39
20
|
children: React.ReactNode;
|
|
40
|
-
}) => {
|
|
41
|
-
const [fontState, setFontState] = useState<'loading' | 'loaded' | 'error'>('loading');
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
const loadFonts = async () => {
|
|
45
|
-
try {
|
|
46
|
-
// Get all the font weights
|
|
47
|
-
const interFonts = getInterFonts();
|
|
48
|
-
|
|
49
|
-
if (!interFonts) {
|
|
50
|
-
throw new Error('Inter font files not found');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Load all the static Inter fonts with their respective weights
|
|
54
|
-
await Font.loadAsync(interFonts);
|
|
55
|
-
|
|
56
|
-
setFontState('loaded');
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (__DEV__) {
|
|
59
|
-
console.error('Error loading fonts:', error);
|
|
60
|
-
}
|
|
61
|
-
setFontState('error');
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
loadFonts();
|
|
66
|
-
}, []);
|
|
67
|
-
|
|
68
|
-
// Always render children immediately - fonts will load in background
|
|
69
|
-
// If fonts aren't loaded yet, the app will use system fonts as fallback
|
|
70
|
-
if (fontState === 'error' && __DEV__) {
|
|
71
|
-
console.warn('Fonts failed to load. Using system fonts instead.');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Render children immediately, even while fonts are loading
|
|
75
|
-
// Fonts will apply when they're ready, otherwise system fonts are used
|
|
76
|
-
return <>{children}</>;
|
|
77
|
-
};
|
|
21
|
+
}) => <>{children}</>;
|
|
78
22
|
|
|
79
23
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
24
|
+
* No-op off native. Returns `true` because setup genuinely succeeded — there is
|
|
25
|
+
* simply nothing to do here — so callers do not log a spurious failure.
|
|
82
26
|
*/
|
|
83
|
-
export const setupFonts = async () =>
|
|
84
|
-
try {
|
|
85
|
-
const interFonts = getInterFonts();
|
|
86
|
-
|
|
87
|
-
if (!interFonts) {
|
|
88
|
-
throw new Error('Inter font files not found');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (Platform.OS === 'web') {
|
|
92
|
-
// For web platform, dynamically inject CSS to load the fonts
|
|
93
|
-
if (typeof document !== 'undefined') {
|
|
94
|
-
// Create a style element
|
|
95
|
-
const style = document.createElement('style');
|
|
96
|
-
|
|
97
|
-
// Define @font-face rules for each font weight
|
|
98
|
-
const fontFaceRules = `
|
|
99
|
-
@font-face {
|
|
100
|
-
font-family: 'Inter';
|
|
101
|
-
src: url(${interFonts['Inter-Light']}) format('truetype');
|
|
102
|
-
font-weight: 300;
|
|
103
|
-
font-style: normal;
|
|
104
|
-
}
|
|
105
|
-
@font-face {
|
|
106
|
-
font-family: 'Inter';
|
|
107
|
-
src: url(${interFonts['Inter-Regular']}) format('truetype');
|
|
108
|
-
font-weight: 400;
|
|
109
|
-
font-style: normal;
|
|
110
|
-
}
|
|
111
|
-
@font-face {
|
|
112
|
-
font-family: 'Inter';
|
|
113
|
-
src: url(${interFonts['Inter-Medium']}) format('truetype');
|
|
114
|
-
font-weight: 500;
|
|
115
|
-
font-style: normal;
|
|
116
|
-
}
|
|
117
|
-
@font-face {
|
|
118
|
-
font-family: 'Inter';
|
|
119
|
-
src: url(${interFonts['Inter-SemiBold']}) format('truetype');
|
|
120
|
-
font-weight: 600;
|
|
121
|
-
font-style: normal;
|
|
122
|
-
}
|
|
123
|
-
@font-face {
|
|
124
|
-
font-family: 'Inter';
|
|
125
|
-
src: url(${interFonts['Inter-Bold']}) format('truetype');
|
|
126
|
-
font-weight: 700;
|
|
127
|
-
font-style: normal;
|
|
128
|
-
}
|
|
129
|
-
@font-face {
|
|
130
|
-
font-family: 'Inter';
|
|
131
|
-
src: url(${interFonts['Inter-ExtraBold']}) format('truetype');
|
|
132
|
-
font-weight: 800;
|
|
133
|
-
font-style: normal;
|
|
134
|
-
}
|
|
135
|
-
@font-face {
|
|
136
|
-
font-family: 'Inter';
|
|
137
|
-
src: url(${interFonts['Inter-Black']}) format('truetype');
|
|
138
|
-
font-weight: 900;
|
|
139
|
-
font-style: normal;
|
|
140
|
-
}
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
|
-
style.textContent = fontFaceRules;
|
|
144
|
-
document.head.appendChild(style);
|
|
145
|
-
if (__DEV__) {
|
|
146
|
-
console.info('All Inter web fonts have been dynamically loaded');
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
} else {
|
|
150
|
-
// Attempt to load the fonts anyway (this works if the consumer has linked the assets)
|
|
151
|
-
await Font.loadAsync(interFonts);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return true;
|
|
155
|
-
} catch (error: unknown) {
|
|
156
|
-
if (__DEV__) {
|
|
157
|
-
const errorMessage = error instanceof Error ? (error instanceof Error ? error.message : null) : String(error);
|
|
158
|
-
console.warn('Error setting up fonts:', errorMessage);
|
|
159
|
-
}
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
27
|
+
export const setupFonts = async (): Promise<boolean> => true;
|
|
@@ -5,7 +5,6 @@ import { Dialog, type DialogControlProps } from '@oxyhq/bloom';
|
|
|
5
5
|
import { useTheme } from '@oxyhq/bloom/theme';
|
|
6
6
|
import type { FileMetadata } from '@oxyhq/core';
|
|
7
7
|
import { formatFileSize, getFileIcon } from '../../utils/fileManagement';
|
|
8
|
-
import { fileManagementStyles } from './styles';
|
|
9
8
|
|
|
10
9
|
interface FileDetailsModalProps {
|
|
11
10
|
control: DialogControlProps;
|
|
@@ -56,53 +55,53 @@ export const FileDetailsModal: React.FC<FileDetailsModalProps> = ({
|
|
|
56
55
|
label="File Details"
|
|
57
56
|
actions={actions}
|
|
58
57
|
>
|
|
59
|
-
<View className="bg-secondary border-border"
|
|
60
|
-
<View
|
|
58
|
+
<View className="bg-secondary border-border p-[18px] rounded-[14px] border items-center">
|
|
59
|
+
<View className="mb-space-16">
|
|
61
60
|
<Ionicons
|
|
62
|
-
name={getFileIcon(file.contentType)
|
|
61
|
+
name={getFileIcon(file.contentType)}
|
|
63
62
|
size={64}
|
|
64
63
|
color={colors.primary}
|
|
65
64
|
/>
|
|
66
65
|
</View>
|
|
67
66
|
|
|
68
|
-
<Text className="text-text"
|
|
67
|
+
<Text className="text-text text-[20px] font-bold text-center mb-space-24">
|
|
69
68
|
{file.filename}
|
|
70
69
|
</Text>
|
|
71
70
|
|
|
72
|
-
<View
|
|
73
|
-
<View
|
|
74
|
-
<Text className="text-text-secondary"
|
|
71
|
+
<View className="w-full mb-space-32">
|
|
72
|
+
<View className="flex-row justify-between items-start mb-space-12 flex-wrap">
|
|
73
|
+
<Text className="text-text-secondary text-[16px] font-medium flex-1 min-w-[100px]">
|
|
75
74
|
Size:
|
|
76
75
|
</Text>
|
|
77
|
-
<Text className="text-text"
|
|
76
|
+
<Text className="text-text text-[16px] flex-[2] text-right">
|
|
78
77
|
{formatFileSize(file.length)}
|
|
79
78
|
</Text>
|
|
80
79
|
</View>
|
|
81
80
|
|
|
82
|
-
<View
|
|
83
|
-
<Text className="text-text-secondary"
|
|
81
|
+
<View className="flex-row justify-between items-start mb-space-12 flex-wrap">
|
|
82
|
+
<Text className="text-text-secondary text-[16px] font-medium flex-1 min-w-[100px]">
|
|
84
83
|
Type:
|
|
85
84
|
</Text>
|
|
86
|
-
<Text className="text-text"
|
|
85
|
+
<Text className="text-text text-[16px] flex-[2] text-right">
|
|
87
86
|
{file.contentType}
|
|
88
87
|
</Text>
|
|
89
88
|
</View>
|
|
90
89
|
|
|
91
|
-
<View
|
|
92
|
-
<Text className="text-text-secondary"
|
|
90
|
+
<View className="flex-row justify-between items-start mb-space-12 flex-wrap">
|
|
91
|
+
<Text className="text-text-secondary text-[16px] font-medium flex-1 min-w-[100px]">
|
|
93
92
|
Uploaded:
|
|
94
93
|
</Text>
|
|
95
|
-
<Text className="text-text"
|
|
94
|
+
<Text className="text-text text-[16px] flex-[2] text-right">
|
|
96
95
|
{new Date(file.uploadDate).toLocaleString()}
|
|
97
96
|
</Text>
|
|
98
97
|
</View>
|
|
99
98
|
|
|
100
99
|
{file.metadata?.description && (
|
|
101
|
-
<View
|
|
102
|
-
<Text className="text-text-secondary"
|
|
100
|
+
<View className="flex-row justify-between items-start mb-space-12 flex-wrap">
|
|
101
|
+
<Text className="text-text-secondary text-[16px] font-medium flex-1 min-w-[100px]">
|
|
103
102
|
Description:
|
|
104
103
|
</Text>
|
|
105
|
-
<Text className="text-text"
|
|
104
|
+
<Text className="text-text text-[16px] flex-[2] text-right">
|
|
106
105
|
{file.metadata.description}
|
|
107
106
|
</Text>
|
|
108
107
|
</View>
|
|
@@ -70,7 +70,7 @@ const UploadPreviewContent: React.FC<{
|
|
|
70
70
|
) : (
|
|
71
71
|
<View style={[fileManagementStyles.uploadPreviewIconContainer, { backgroundColor: colors.backgroundSecondary }]}>
|
|
72
72
|
<Ionicons
|
|
73
|
-
name={getFileIcon(pendingFile.type)
|
|
73
|
+
name={getFileIcon(pendingFile.type)}
|
|
74
74
|
size={32}
|
|
75
75
|
color={colors.primary}
|
|
76
76
|
/>
|