@oxyhq/services 22.8.7 → 22.9.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/components/OxyAccountDialog.js +30 -39
- package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +9 -29
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/SurfaceScreen.js +146 -0
- package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +32 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/navigation/bottomSheetManager.js +38 -56
- package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +7 -57
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaceNavStack.js +98 -0
- package/lib/commonjs/ui/navigation/surfaceNavStack.js.map +1 -0
- package/lib/commonjs/ui/navigation/surfaceRegistry.js +108 -0
- package/lib/commonjs/ui/navigation/surfaceRegistry.js.map +1 -0
- package/lib/commonjs/ui/navigation/surfaces.js +219 -0
- package/lib/commonjs/ui/navigation/surfaces.js.map +1 -0
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +9 -7
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/types/surfaceScreen.js +6 -0
- package/lib/commonjs/ui/types/surfaceScreen.js.map +1 -0
- package/lib/module/ui/components/OxyAccountDialog.js +31 -40
- package/lib/module/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +10 -30
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/SurfaceScreen.js +141 -0
- package/lib/module/ui/components/SurfaceScreen.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +32 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/navigation/bottomSheetManager.js +37 -53
- package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +6 -56
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/navigation/surfaceNavStack.js +95 -0
- package/lib/module/ui/navigation/surfaceNavStack.js.map +1 -0
- package/lib/module/ui/navigation/surfaceRegistry.js +102 -0
- package/lib/module/ui/navigation/surfaceRegistry.js.map +1 -0
- package/lib/module/ui/navigation/surfaces.js +207 -0
- package/lib/module/ui/navigation/surfaces.js.map +1 -0
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +8 -7
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/types/surfaceScreen.js +4 -0
- package/lib/module/ui/types/surfaceScreen.js.map +1 -0
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts +29 -27
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts +3 -2
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts +24 -0
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +24 -16
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +2 -60
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts +51 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts +117 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts +79 -0
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/surfaceScreen.d.ts +38 -0
- package/lib/typescript/commonjs/ui/types/surfaceScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts +29 -27
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts +3 -2
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts +24 -0
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +24 -16
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +2 -60
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts +51 -0
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts +117 -0
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/surfaces.d.ts +79 -0
- package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/surfaceScreen.d.ts +38 -0
- package/lib/typescript/module/ui/types/surfaceScreen.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/ui/components/OxyAccountDialog.tsx +32 -38
- package/src/ui/components/OxyProvider.tsx +12 -34
- package/src/ui/components/SurfaceScreen.tsx +166 -0
- package/src/ui/context/OxyContext.tsx +27 -1
- package/src/ui/navigation/__tests__/getSurfaceConfig.test.ts +39 -0
- package/src/ui/navigation/bottomSheetManager.ts +46 -73
- package/src/ui/navigation/routes.ts +7 -106
- package/src/ui/navigation/surfaceNavStack.ts +110 -0
- package/src/ui/navigation/surfaceRegistry.ts +174 -0
- package/src/ui/navigation/surfaces.ts +244 -0
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +9 -7
- package/src/ui/types/surfaceScreen.ts +38 -0
- package/lib/commonjs/ui/components/BottomSheet.js +0 -49
- package/lib/commonjs/ui/components/BottomSheet.js.map +0 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +0 -298
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +0 -1
- package/lib/module/ui/components/BottomSheet.js +0 -45
- package/lib/module/ui/components/BottomSheet.js.map +0 -1
- package/lib/module/ui/components/BottomSheetRouter.js +0 -292
- package/lib/module/ui/components/BottomSheetRouter.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/BottomSheet.d.ts +0 -29
- package/lib/typescript/commonjs/ui/components/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts +0 -9
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/BottomSheet.d.ts +0 -29
- package/lib/typescript/module/ui/components/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts +0 -9
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +0 -1
- package/src/ui/components/BottomSheet.tsx +0 -48
- package/src/ui/components/BottomSheetRouter.tsx +0 -310
- package/src/ui/navigation/__tests__/getSheetConfig.test.ts +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isValidRoute","
|
|
1
|
+
{"version":3,"names":["isValidRoute","getSurfacePresentation","closeAllRouteSurfaces","presentRoute","topRouteSurface","showBottomSheet","screenOrConfig","screen","props","__DEV__","console","warn","top","presentation","navigate","closeBottomSheet","goBack"],"sourceRoot":"../../../../src","sources":["ui/navigation/bottomSheetManager.ts"],"mappings":";;AACA,SAASA,YAAY,QAAQ,aAAU;AACvC,SAASC,sBAAsB,QAAQ,sBAAmB;AAC1D,SAASC,qBAAqB,EAAEC,YAAY,EAAEC,eAAe,QAAQ,eAAY;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,cAEgF,IACvE;EACT,MAAMC,MAAM,GAAG,OAAOD,cAAc,KAAK,QAAQ,GAAGA,cAAc,GAAGA,cAAc,CAACC,MAAM;EAC1F,MAAMC,KAAK,GAAG,OAAOF,cAAc,KAAK,QAAQ,GAAG,CAAC,CAAC,GAAGA,cAAc,CAACE,KAAK,IAAI,CAAC,CAAC;EAElF,IAAI,CAACR,YAAY,CAACO,MAAM,CAAC,EAAE;IACzB,IAAIE,OAAO,EAAEC,OAAO,CAACC,IAAI,CAAC,gCAAgCJ,MAAM,EAAE,CAAC;IACnE;EACF;EAEA,MAAMK,GAAG,GAAGR,eAAe,CAAC,CAAC;EAC7B,IAAIQ,GAAG,IAAIA,GAAG,CAACC,YAAY,KAAKZ,sBAAsB,CAACM,MAAM,EAAEC,KAAK,CAAC,EAAE;IACrEI,GAAG,CAACE,QAAQ,CAACP,MAAM,EAAEC,KAAK,CAAC;EAC7B,CAAC,MAAM;IACLL,YAAY,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC7B;AACF,CAAC;;AAED;AACA,OAAO,MAAMO,gBAAgB,GAAGA,CAAA,KAAY;EAC1Cb,qBAAqB,CAAC,CAAC;AACzB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMc,MAAM,GAAGA,CAAA,KAAe;EACnC,MAAMJ,GAAG,GAAGR,eAAe,CAAC,CAAC;EAC7B,OAAOQ,GAAG,GAAGA,GAAG,CAACI,MAAM,CAAC,CAAC,GAAG,KAAK;AACnC,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// Define all available route names
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// Unified account switcher + sign-in surface (folded OxyAccountDialog body)
|
|
10
10
|
|
|
11
11
|
// Lazy screen loaders - functions that return screen components on-demand
|
|
12
12
|
// This breaks the require cycle by deferring imports until screens are actually needed
|
|
@@ -49,7 +49,11 @@ const screenLoaders = {
|
|
|
49
49
|
AvatarCrop: () => require('../screens/AvatarCropScreen').default,
|
|
50
50
|
Notifications: () => require('../screens/NotificationsScreen').default,
|
|
51
51
|
ConnectedApps: () => require('../screens/ConnectedAppsScreen').default,
|
|
52
|
-
Preferences: () => require('../screens/PreferencesScreen').default
|
|
52
|
+
Preferences: () => require('../screens/PreferencesScreen').default,
|
|
53
|
+
// Unified account switcher + sign-in surface. Its body lives in the
|
|
54
|
+
// `OxyAccountDialog` component (folded from the standalone dialog); the
|
|
55
|
+
// surface stack provides the Dialog chrome around it.
|
|
56
|
+
AccountDialog: () => require('../components/OxyAccountDialog').default
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
// Cache loaded components to avoid re-requiring
|
|
@@ -84,58 +88,4 @@ export const getScreenComponent = routeName => {
|
|
|
84
88
|
export const isValidRoute = routeName => {
|
|
85
89
|
return routeName in screenLoaders;
|
|
86
90
|
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Configuration that BottomSheetRouter applies to the underlying BottomSheet
|
|
90
|
-
* for a given route. Adding new options here is additive — never rename or
|
|
91
|
-
* remove fields without bumping the consumer surface as a breaking change.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Predicate matching FileManagementScreen's internal `isImageOnlyPicker`
|
|
96
|
-
* derivation. When the consumer restricts to image MIME types (no videos,
|
|
97
|
-
* no audio, no documents), FileManagement renders the flagship PhotoPickerView
|
|
98
|
-
* which owns its own FlatList. The sheet must therefore stop scrolling
|
|
99
|
-
* children. Kept in sync with `FileManagementScreen` — both check the same
|
|
100
|
-
* disabled MIME type families.
|
|
101
|
-
*/
|
|
102
|
-
const isFileManagementImageOnlyPicker = props => {
|
|
103
|
-
if (!props.selectMode) return false;
|
|
104
|
-
const disabled = props.disabledMimeTypes;
|
|
105
|
-
if (!Array.isArray(disabled) || disabled.length === 0) return false;
|
|
106
|
-
const has = predicate => disabled.some(mt => typeof mt === 'string' && predicate(mt));
|
|
107
|
-
const blocksVideos = has(mt => mt === 'video/' || mt.startsWith('video/'));
|
|
108
|
-
const blocksAudio = has(mt => mt === 'audio/' || mt.startsWith('audio/'));
|
|
109
|
-
const blocksDocs = has(mt => mt === 'application/pdf' || mt === 'application/' || mt.startsWith('application/'));
|
|
110
|
-
return blocksVideos && blocksAudio && blocksDocs;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/** Defaults shared across all routes — preserves the historical in-tree BS UX. */
|
|
114
|
-
const DEFAULT_SHEET_CONFIG = {
|
|
115
|
-
presentation: 'sheet',
|
|
116
|
-
scrollable: true,
|
|
117
|
-
manualActivation: true,
|
|
118
|
-
dynamicBackdrop: true
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Returns the bottom-sheet configuration for a route. Defaults match the
|
|
123
|
-
* pre-refactor in-tree `BottomSheet` (scrollable, manualActivation,
|
|
124
|
-
* dynamicBackdrop). Routes opt out per-field as needed.
|
|
125
|
-
*/
|
|
126
|
-
export const getSheetConfig = (routeName, screenProps) => {
|
|
127
|
-
if (!routeName) return DEFAULT_SHEET_CONFIG;
|
|
128
|
-
if (routeName === 'FileManagement' && isFileManagementImageOnlyPicker(screenProps)) {
|
|
129
|
-
// The flagship photo picker renders in a responsive Bloom `<Dialog>`
|
|
130
|
-
// (bottom-sheet on narrow, centered card on `md+`) rather than the
|
|
131
|
-
// in-tree BottomSheet — it owns its own FlatList and reads better as a
|
|
132
|
-
// centered panel on wide viewports. The Dialog surface, not this
|
|
133
|
-
// config's `scrollable`, governs its scrolling.
|
|
134
|
-
return {
|
|
135
|
-
...DEFAULT_SHEET_CONFIG,
|
|
136
|
-
presentation: 'dialog'
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return DEFAULT_SHEET_CONFIG;
|
|
140
|
-
};
|
|
141
91
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["screenLoaders","ManageAccount","require","default","AccountVerification","PaymentGateway","Profile","LanguageSelector","PrivacySettings","SearchSettings","FileManagement","HelpSupport","FAQ","Feedback","LegalDocuments","AppInfo","PremiumSubscription","WelcomeNewUser","UserLinks","HistoryView","SavesCollections","EditProfile","EditProfileField","LearnMoreUsernames","TrustCenter","TrustLeaderboard","TrustRewards","TrustRules","AboutTrust","TrustFAQ","FollowersList","FollowingList","CreateAccount","AccountMembers","AccountSettings","AvatarCrop","Notifications","ConnectedApps","Preferences","screenCache","Map","getScreenComponent","routeName","has","get","loader","component","set","error","__DEV__","console","undefined","isValidRoute"
|
|
1
|
+
{"version":3,"names":["screenLoaders","ManageAccount","require","default","AccountVerification","PaymentGateway","Profile","LanguageSelector","PrivacySettings","SearchSettings","FileManagement","HelpSupport","FAQ","Feedback","LegalDocuments","AppInfo","PremiumSubscription","WelcomeNewUser","UserLinks","HistoryView","SavesCollections","EditProfile","EditProfileField","LearnMoreUsernames","TrustCenter","TrustLeaderboard","TrustRewards","TrustRules","AboutTrust","TrustFAQ","FollowersList","FollowingList","CreateAccount","AccountMembers","AccountSettings","AvatarCrop","Notifications","ConnectedApps","Preferences","AccountDialog","screenCache","Map","getScreenComponent","routeName","has","get","loader","component","set","error","__DEV__","console","undefined","isValidRoute"],"sourceRoot":"../../../../src","sources":["ui/navigation/routes.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
|
3
|
+
import { createStore } from 'zustand/vanilla';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Per-surface route history — the NAV-WITHIN axis.
|
|
7
|
+
*
|
|
8
|
+
* Bloom's surface stack owns DEPTH (a surface presented on top of another). This
|
|
9
|
+
* store owns the ORTHOGONAL axis: the route history INSIDE one SDK surface. Each
|
|
10
|
+
* SDK surface holds its own {@link SurfaceNavStack}; `navigate`/`replace`/`goBack`
|
|
11
|
+
* mutate it and the SAME Bloom surface re-renders its content from the new top
|
|
12
|
+
* frame. It is the per-surface reincarnation of the old global
|
|
13
|
+
* `bottomSheetStore`'s `history` + `currentStep`.
|
|
14
|
+
*
|
|
15
|
+
* `closing`/`closeResult` model a pending dismissal: the surface's `SurfaceScreen`
|
|
16
|
+
* watches them and calls the Bloom surface's `dismiss(result)` from an effect —
|
|
17
|
+
* so a dismiss requested BEFORE the surface has mounted still resolves once it
|
|
18
|
+
* does, with no controls-capture race and no render-phase side effect.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** One frame in a surface's route history. */
|
|
22
|
+
|
|
23
|
+
function makeFrame(route, props) {
|
|
24
|
+
const resolved = props ?? {};
|
|
25
|
+
const step = typeof resolved.initialStep === 'number' ? resolved.initialStep : 0;
|
|
26
|
+
return {
|
|
27
|
+
route,
|
|
28
|
+
props: resolved,
|
|
29
|
+
step
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function createSurfaceNavStack(route, props) {
|
|
33
|
+
const store = createStore(() => ({
|
|
34
|
+
frames: [makeFrame(route, props)],
|
|
35
|
+
closing: false,
|
|
36
|
+
closeResult: undefined
|
|
37
|
+
}));
|
|
38
|
+
const getTop = () => {
|
|
39
|
+
const {
|
|
40
|
+
frames
|
|
41
|
+
} = store.getState();
|
|
42
|
+
return frames[frames.length - 1];
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
store,
|
|
46
|
+
getTop,
|
|
47
|
+
navigate(nextRoute, nextProps) {
|
|
48
|
+
store.setState(state => ({
|
|
49
|
+
frames: [...state.frames, makeFrame(nextRoute, nextProps)]
|
|
50
|
+
}));
|
|
51
|
+
},
|
|
52
|
+
replace(nextRoute, nextProps) {
|
|
53
|
+
store.setState(state => ({
|
|
54
|
+
frames: [...state.frames.slice(0, -1), makeFrame(nextRoute, nextProps)]
|
|
55
|
+
}));
|
|
56
|
+
},
|
|
57
|
+
goBack() {
|
|
58
|
+
const {
|
|
59
|
+
frames
|
|
60
|
+
} = store.getState();
|
|
61
|
+
if (frames.length <= 1) return false;
|
|
62
|
+
store.setState({
|
|
63
|
+
frames: frames.slice(0, -1)
|
|
64
|
+
});
|
|
65
|
+
return true;
|
|
66
|
+
},
|
|
67
|
+
canGoBack() {
|
|
68
|
+
const {
|
|
69
|
+
frames
|
|
70
|
+
} = store.getState();
|
|
71
|
+
return frames.length > 1 || (frames[frames.length - 1]?.step ?? 0) > 0;
|
|
72
|
+
},
|
|
73
|
+
setStep(step) {
|
|
74
|
+
store.setState(state => {
|
|
75
|
+
const frames = state.frames.slice();
|
|
76
|
+
const index = frames.length - 1;
|
|
77
|
+
frames[index] = {
|
|
78
|
+
...frames[index],
|
|
79
|
+
step
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
frames
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
requestDismiss(result) {
|
|
87
|
+
if (store.getState().closing) return;
|
|
88
|
+
store.setState({
|
|
89
|
+
closing: true,
|
|
90
|
+
closeResult: result
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=surfaceNavStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createStore","makeFrame","route","props","resolved","step","initialStep","createSurfaceNavStack","store","frames","closing","closeResult","undefined","getTop","getState","length","navigate","nextRoute","nextProps","setState","state","replace","slice","goBack","canGoBack","setStep","index","requestDismiss","result"],"sourceRoot":"../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AAO,EAAE,IAAI;QAAEC,WAAW,EAAEiB;MAAO,CAAC,CAAC;IACxD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The SDK's typed surface registry — the contract layer the SDK stacks on top of
|
|
5
|
+
* Bloom's content-agnostic surface stack (`@oxyhq/bloom/surfaces`). One entry per
|
|
6
|
+
* route describing its `props` (what the presenter must pass) and its `result`
|
|
7
|
+
* (what awaiting `present()` resolves with). Hand-maintained, contract-first:
|
|
8
|
+
* adding a route here is the single edit that types it end to end.
|
|
9
|
+
*
|
|
10
|
+
* For P1 most routes keep permissive `Record<string, unknown>` props + a `void`
|
|
11
|
+
* result — the historical grab-bag `showBottomSheet`/`navigate` props are
|
|
12
|
+
* unchanged. Later phases tighten individual routes without changing this shape.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** One registry entry: the props a route is presented with + its dismissal result. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Compile-time guard: the registry keys must be EXACTLY the route names. If a new
|
|
19
|
+
* `RouteName` is added without a registry entry (or vice-versa) this alias
|
|
20
|
+
* resolves to `never` and the `satisfies` assertion below fails to type-check.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const _registryCoversRoutes = true;
|
|
24
|
+
void _registryCoversRoutes;
|
|
25
|
+
|
|
26
|
+
/** Typed props a route is presented with. */
|
|
27
|
+
|
|
28
|
+
/** What awaiting a route's `present()` resolves with when it is dismissed. */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* How a surface renders — the SDK's presentation taxonomy. Each value maps to a
|
|
32
|
+
* concrete Bloom `Dialog` placement/chrome in `surfaces.ts`:
|
|
33
|
+
*
|
|
34
|
+
* - `'sheet'` → responsive `{ base: 'bottom', md: 'center' }` (the default:
|
|
35
|
+
* a bottom sheet on narrow viewports, a centered card on wide).
|
|
36
|
+
* - `'center'` → a plain centered modal at every width.
|
|
37
|
+
* - `'drawer'` → responsive `{ base: 'bottom', md: 'left' }` side drawer.
|
|
38
|
+
* - `'fullScreen'` → approximated with the shared `Dialog`: a full-height sheet /
|
|
39
|
+
* large centered card, flush (`contentPadding: 0`) content, a
|
|
40
|
+
* black canvas and programmatic-only dismiss (the flagship
|
|
41
|
+
* image picker). A real Bloom `'fullScreen'` placement is a
|
|
42
|
+
* follow-up if the approximation reads wrong on device.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Per-route surface configuration. Merges the historical `SheetRouteConfig`
|
|
47
|
+
* knobs with the new {@link SurfacePresentation}.
|
|
48
|
+
*
|
|
49
|
+
* NOTE: `scrollable` / `manualActivation` / `dynamicBackdrop` / `handleComponent`
|
|
50
|
+
* describe the in-tree bottom-sheet's pan + scroll behaviour. On Bloom's `Dialog`
|
|
51
|
+
* surface those concerns are now owned by the shared `DialogBottomSheet` (it opts
|
|
52
|
+
* pure custom children OUT of its internal ScrollView and manages the pan itself),
|
|
53
|
+
* so for P1 these fields are informational — reserved for a future Bloom
|
|
54
|
+
* bottom-placement passthrough. `presentation` (+ `scrollable` for the picker's
|
|
55
|
+
* flush layout) is what actually drives the surface today.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/** Defaults shared across all routes — the canonical responsive "sheet". */
|
|
59
|
+
const DEFAULT_SURFACE_CONFIG = {
|
|
60
|
+
presentation: 'sheet',
|
|
61
|
+
scrollable: true,
|
|
62
|
+
manualActivation: true,
|
|
63
|
+
dynamicBackdrop: true
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Predicate matching `FileManagementScreen`'s internal `isImageOnlyPicker`
|
|
68
|
+
* derivation. When the consumer restricts to image MIME types (no videos, no
|
|
69
|
+
* audio, no documents), FileManagement renders the flagship `PhotoPickerView`,
|
|
70
|
+
* which owns its own FlatList and reads best as a full-bleed picker. Kept in sync
|
|
71
|
+
* with `FileManagementScreen` — both check the same disabled MIME type families.
|
|
72
|
+
*/
|
|
73
|
+
const isFileManagementImageOnlyPicker = props => {
|
|
74
|
+
if (!props.selectMode) return false;
|
|
75
|
+
const disabled = props.disabledMimeTypes;
|
|
76
|
+
if (!Array.isArray(disabled) || disabled.length === 0) return false;
|
|
77
|
+
const has = predicate => disabled.some(mt => typeof mt === 'string' && predicate(mt));
|
|
78
|
+
const blocksVideos = has(mt => mt === 'video/' || mt.startsWith('video/'));
|
|
79
|
+
const blocksAudio = has(mt => mt === 'audio/' || mt.startsWith('audio/'));
|
|
80
|
+
const blocksDocs = has(mt => mt === 'application/pdf' || mt === 'application/' || mt.startsWith('application/'));
|
|
81
|
+
return blocksVideos && blocksAudio && blocksDocs;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Resolve the surface configuration for a route + props. Defaults to the
|
|
86
|
+
* responsive sheet; the image-only FileManagement picker upgrades to a full-bleed
|
|
87
|
+
* `'fullScreen'` surface that owns its own scrolling.
|
|
88
|
+
*/
|
|
89
|
+
export const getSurfaceConfig = (route, props) => {
|
|
90
|
+
if (route === 'FileManagement' && isFileManagementImageOnlyPicker(props)) {
|
|
91
|
+
return {
|
|
92
|
+
...DEFAULT_SURFACE_CONFIG,
|
|
93
|
+
presentation: 'fullScreen',
|
|
94
|
+
scrollable: false
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return DEFAULT_SURFACE_CONFIG;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** Convenience: just the presentation taxonomy for a route + props. */
|
|
101
|
+
export const getSurfacePresentation = (route, props) => getSurfaceConfig(route, props).presentation;
|
|
102
|
+
//# sourceMappingURL=surfaceRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_registryCoversRoutes","DEFAULT_SURFACE_CONFIG","presentation","scrollable","manualActivation","dynamicBackdrop","isFileManagementImageOnlyPicker","props","selectMode","disabled","disabledMimeTypes","Array","isArray","length","has","predicate","some","mt","blocksVideos","startsWith","blocksAudio","blocksDocs","getSurfaceConfig","route","getSurfacePresentation"],"sourceRoot":"../../../../src","sources":["ui/navigation/surfaceRegistry.ts"],"mappings":";;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AA+CA;AACA;AACA;AACA;AACA;;AAMA,MAAMA,qBAA2C,GAAG,IAAI;AACxD,KAAKA,qBAAqB;;AAE1B;;AAEA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA,MAAMC,sBAA0C,GAAG;EACjDC,YAAY,EAAE,OAAO;EACrBC,UAAU,EAAE,IAAI;EAChBC,gBAAgB,EAAE,IAAI;EACtBC,eAAe,EAAE;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,+BAA+B,GAAIC,KAA8B,IAAc;EACnF,IAAI,CAACA,KAAK,CAACC,UAAU,EAAE,OAAO,KAAK;EACnC,MAAMC,QAAQ,GAAGF,KAAK,CAACG,iBAAiB;EACxC,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,IAAIA,QAAQ,CAACI,MAAM,KAAK,CAAC,EAAE,OAAO,KAAK;EACnE,MAAMC,GAAG,GAAIC,SAAkC,IAC7CN,QAAQ,CAACO,IAAI,CAAEC,EAAE,IAAK,OAAOA,EAAE,KAAK,QAAQ,IAAIF,SAAS,CAACE,EAAE,CAAC,CAAC;EAChE,MAAMC,YAAY,GAAGJ,GAAG,CAAEG,EAAE,IAAKA,EAAE,KAAK,QAAQ,IAAIA,EAAE,CAACE,UAAU,CAAC,QAAQ,CAAC,CAAC;EAC5E,MAAMC,WAAW,GAAGN,GAAG,CAAEG,EAAE,IAAKA,EAAE,KAAK,QAAQ,IAAIA,EAAE,CAACE,UAAU,CAAC,QAAQ,CAAC,CAAC;EAC3E,MAAME,UAAU,GAAGP,GAAG,CACnBG,EAAE,IAAKA,EAAE,KAAK,iBAAiB,IAAIA,EAAE,KAAK,cAAc,IAAIA,EAAE,CAACE,UAAU,CAAC,cAAc,CAC3F,CAAC;EACD,OAAOD,YAAY,IAAIE,WAAW,IAAIC,UAAU;AAClD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAAgB,EAChBhB,KAA8B,KACP;EACvB,IAAIgB,KAAK,KAAK,gBAAgB,IAAIjB,+BAA+B,CAACC,KAAK,CAAC,EAAE;IACxE,OAAO;MAAE,GAAGN,sBAAsB;MAAEC,YAAY,EAAE,YAAY;MAAEC,UAAU,EAAE;IAAM,CAAC;EACrF;EACA,OAAOF,sBAAsB;AAC/B,CAAC;;AAED;AACA,OAAO,MAAMuB,sBAAsB,GAAGA,CACpCD,KAAgB,EAChBhB,KAA8B,KACNe,gBAAgB,CAACC,KAAK,EAAEhB,KAAK,CAAC,CAACL,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
import { surfaces as bloomSurfaces } from '@oxyhq/bloom/surfaces';
|
|
5
|
+
import SurfaceScreen from "../components/SurfaceScreen.js";
|
|
6
|
+
import { getSurfaceConfig, getSurfacePresentation } from "./surfaceRegistry.js";
|
|
7
|
+
import { createSurfaceNavStack } from "./surfaceNavStack.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The SDK's typed surface API — a route registry layered on top of Bloom's
|
|
11
|
+
* content-agnostic surface stack (`@oxyhq/bloom/surfaces`).
|
|
12
|
+
*
|
|
13
|
+
* `present(route)` opens a NEW Bloom surface (the DEPTH axis) whose content is a
|
|
14
|
+
* {@link SurfaceScreen} driven by the route's own {@link SurfaceNavStack} (the
|
|
15
|
+
* NAV-WITHIN axis). Navigating within that surface mutates its nav stack and
|
|
16
|
+
* re-renders the SAME Bloom surface; presenting stacks another surface on top.
|
|
17
|
+
*
|
|
18
|
+
* Bloom coordinates z-order / backdrop / dismiss across every surface (SDK's and
|
|
19
|
+
* apps'), so nothing clashes.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Responsive "sheet": bottom sheet on narrow, centered card on wide. */
|
|
23
|
+
const SHEET_PLACEMENT = {
|
|
24
|
+
base: 'bottom',
|
|
25
|
+
md: 'center'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Full-bleed black canvas for the `'fullScreen'` approximation (image picker). */
|
|
29
|
+
const FULLSCREEN_SURFACE_STYLE = {
|
|
30
|
+
backgroundColor: '#000000',
|
|
31
|
+
overflow: 'hidden'
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Map a route's presentation taxonomy onto concrete Bloom `Dialog` options. */
|
|
35
|
+
function bloomOptionsFor(config) {
|
|
36
|
+
switch (config.presentation) {
|
|
37
|
+
case 'center':
|
|
38
|
+
return {
|
|
39
|
+
placement: 'center'
|
|
40
|
+
};
|
|
41
|
+
case 'drawer':
|
|
42
|
+
return {
|
|
43
|
+
placement: {
|
|
44
|
+
base: 'bottom',
|
|
45
|
+
md: 'left'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
case 'fullScreen':
|
|
49
|
+
// Approximate a full-screen surface with the shared `Dialog`: a tall
|
|
50
|
+
// sheet / large centered card, flush content, a black canvas and
|
|
51
|
+
// programmatic-only dismiss — matching the shipped image-picker Dialog.
|
|
52
|
+
return {
|
|
53
|
+
placement: SHEET_PLACEMENT,
|
|
54
|
+
contentPadding: 0,
|
|
55
|
+
maxWidth: 640,
|
|
56
|
+
maxHeightRatio: 0.9,
|
|
57
|
+
dismissOnBackdrop: false,
|
|
58
|
+
style: FULLSCREEN_SURFACE_STYLE,
|
|
59
|
+
panelStyle: FULLSCREEN_SURFACE_STYLE
|
|
60
|
+
};
|
|
61
|
+
default:
|
|
62
|
+
return {
|
|
63
|
+
placement: SHEET_PLACEMENT
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A live handle to a presented SDK surface. Exposes DEPTH controls (`dismiss`,
|
|
70
|
+
* `result`) and NAV-WITHIN controls (`navigate`/`replace`/`goBack`/`setStep`) that
|
|
71
|
+
* drive this surface's own nav stack. Held by the `showBottomSheet` adapter (base
|
|
72
|
+
* surface) and by `OxyContext` (the AccountDialog surface).
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The type-erased handle the `showBottomSheet` adapter needs from a tracked
|
|
77
|
+
* surface: what it hosts, and how to drive/dismiss it. Kept result-type-free so
|
|
78
|
+
* the (generic) `SurfaceInstance<K>` never has to be widened into a shared array.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Active SDK "route" surfaces (the `showBottomSheet` lineage), bottom → top.
|
|
83
|
+
* `present`/`presentRoute` register here; `presentDetached` (AccountDialog) does
|
|
84
|
+
* NOT, so the base-sheet navigation logic never treats the account modal as a
|
|
85
|
+
* navigable base. Entries self-remove when their surface is dismissed.
|
|
86
|
+
*/
|
|
87
|
+
const activeRouteSurfaces = [];
|
|
88
|
+
function presentInternal(route, props, opts, track) {
|
|
89
|
+
const navStack = createSurfaceNavStack(route, props);
|
|
90
|
+
const config = getSurfaceConfig(route, props);
|
|
91
|
+
const bloomOpts = {
|
|
92
|
+
label: route,
|
|
93
|
+
...bloomOptionsFor(config),
|
|
94
|
+
...opts
|
|
95
|
+
};
|
|
96
|
+
const result = bloomSurfaces.present(surface => /*#__PURE__*/createElement(SurfaceScreen, {
|
|
97
|
+
navStack,
|
|
98
|
+
surface,
|
|
99
|
+
presentation: config.presentation
|
|
100
|
+
}), bloomOpts);
|
|
101
|
+
const instance = {
|
|
102
|
+
route,
|
|
103
|
+
presentation: config.presentation,
|
|
104
|
+
navigate: (nextRoute, nextProps) => navStack.navigate(nextRoute, nextProps),
|
|
105
|
+
replace: (nextRoute, nextProps) => navStack.replace(nextRoute, nextProps),
|
|
106
|
+
goBack: () => navStack.goBack(),
|
|
107
|
+
canGoBack: () => navStack.canGoBack(),
|
|
108
|
+
setStep: step => navStack.setStep(step),
|
|
109
|
+
dismiss: dismissResult => navStack.requestDismiss(dismissResult),
|
|
110
|
+
result
|
|
111
|
+
};
|
|
112
|
+
if (track) {
|
|
113
|
+
const tracked = {
|
|
114
|
+
route: instance.route,
|
|
115
|
+
presentation: instance.presentation,
|
|
116
|
+
navigate: instance.navigate,
|
|
117
|
+
goBack: instance.goBack,
|
|
118
|
+
dismiss: () => instance.dismiss()
|
|
119
|
+
};
|
|
120
|
+
activeRouteSurfaces.push(tracked);
|
|
121
|
+
result.finally(() => {
|
|
122
|
+
const index = activeRouteSurfaces.indexOf(tracked);
|
|
123
|
+
if (index >= 0) activeRouteSurfaces.splice(index, 1);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return instance;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Present a NEW route surface on top of the stack (the DEPTH axis). Resolves with
|
|
131
|
+
* the value the surface is dismissed with. Registered in the route-surface stack.
|
|
132
|
+
*/
|
|
133
|
+
export function present(route, props, opts) {
|
|
134
|
+
return presentInternal(route, props ?? {}, opts, true);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Present a surface that is NOT part of the `showBottomSheet` base-navigation
|
|
139
|
+
* lineage (the AccountDialog modal). Otherwise identical to {@link present}.
|
|
140
|
+
*/
|
|
141
|
+
export function presentDetached(route, props, opts) {
|
|
142
|
+
return presentInternal(route, props ?? {}, opts, false);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Untyped present for the adapter, the nav helpers, and the `SurfaceScreen`
|
|
147
|
+
* binding (where the route is a runtime value and its props are already erased).
|
|
148
|
+
*/
|
|
149
|
+
export function presentRoute(route, props) {
|
|
150
|
+
return presentInternal(route, props ?? {}, undefined, true);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The top-most active route surface, or `undefined` when none are open. */
|
|
154
|
+
export function topRouteSurface() {
|
|
155
|
+
return activeRouteSurfaces[activeRouteSurfaces.length - 1];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Dismiss every active route surface (the whole `showBottomSheet` session). The
|
|
160
|
+
* AccountDialog is untracked, so it is untouched. Iterates a snapshot because
|
|
161
|
+
* `dismiss` mutates `activeRouteSurfaces` asynchronously as surfaces settle.
|
|
162
|
+
*/
|
|
163
|
+
export function closeAllRouteSurfaces() {
|
|
164
|
+
for (const instance of [...activeRouteSurfaces].reverse()) instance.dismiss();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Drill in from a screen: navigate WITHIN the current surface when the target's
|
|
169
|
+
* presentation matches, else present the target as a NEW surface on top (so a
|
|
170
|
+
* sheet screen opening the full-bleed picker gets the right chrome).
|
|
171
|
+
*/
|
|
172
|
+
export function navigateWithinOrPresent(currentPresentation, navStack, route, props) {
|
|
173
|
+
const nextProps = props ?? {};
|
|
174
|
+
if (getSurfacePresentation(route, nextProps) === currentPresentation) {
|
|
175
|
+
navStack.navigate(route, nextProps);
|
|
176
|
+
} else {
|
|
177
|
+
presentRoute(route, nextProps);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Replace variant of {@link navigateWithinOrPresent}. */
|
|
182
|
+
export function replaceWithinOrPresent(currentPresentation, navStack, route, props) {
|
|
183
|
+
const nextProps = props ?? {};
|
|
184
|
+
if (getSurfacePresentation(route, nextProps) === currentPresentation) {
|
|
185
|
+
navStack.replace(route, nextProps);
|
|
186
|
+
} else {
|
|
187
|
+
presentRoute(route, nextProps);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The SDK's imperative surface API (a module singleton). `present` is the typed
|
|
193
|
+
* route presenter; `dismissAll` unwinds the whole session. Not yet exported from
|
|
194
|
+
* the package root — the public `surfaces`/`useSurfaces` API lands in a later
|
|
195
|
+
* phase; for P1 the internal adapters (`showBottomSheet`, `openAccountDialog`)
|
|
196
|
+
* are the only public entry points.
|
|
197
|
+
*/
|
|
198
|
+
export const surfaces = {
|
|
199
|
+
present: (route, props, opts) => present(route, props, opts).result,
|
|
200
|
+
dismissAll: closeAllRouteSurfaces
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/** Hook form of {@link surfaces} (stable singleton). */
|
|
204
|
+
export function useSurfaces() {
|
|
205
|
+
return surfaces;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=surfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElement","surfaces","bloomSurfaces","SurfaceScreen","getSurfaceConfig","getSurfacePresentation","createSurfaceNavStack","SHEET_PLACEMENT","base","md","FULLSCREEN_SURFACE_STYLE","backgroundColor","overflow","bloomOptionsFor","config","presentation","placement","contentPadding","maxWidth","maxHeightRatio","dismissOnBackdrop","style","panelStyle","activeRouteSurfaces","presentInternal","route","props","opts","track","navStack","bloomOpts","label","result","present","surface","instance","navigate","nextRoute","nextProps","replace","goBack","canGoBack","setStep","step","dismiss","dismissResult","requestDismiss","tracked","push","finally","index","indexOf","splice","presentDetached","presentRoute","undefined","topRouteSurface","length","closeAllRouteSurfaces","reverse","navigateWithinOrPresent","currentPresentation","replaceWithinOrPresent","dismissAll","useSurfaces"],"sourceRoot":"../../../../src","sources":["ui/navigation/surfaces.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,OAAO;AAErC,SACEC,QAAQ,IAAIC,aAAa,QAGpB,uBAAuB;AAC9B,OAAOC,aAAa,MAAM,gCAA6B;AAEvD,SACEC,gBAAgB,EAChBC,sBAAsB,QAKjB,sBAAmB;AAC1B,SAASC,qBAAqB,QAA8B,s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AC7B,IAAIrB,sBAAsB,CAACoB,KAAK,EAAEa,SAAS,CAAC,KAAKuB,mBAAmB,EAAE;IACpEhC,QAAQ,CAACO,QAAQ,CAACX,KAAK,EAAEa,SAAS,CAAC;EACrC,CAAC,MAAM;IACLgB,YAAY,CAAC7B,KAAK,EAAEa,SAAS,CAAC;EAChC;AACF;;AAEA;AACA,OAAO,SAASwB,sBAAsBA,CACpCD,mBAAwC,EACxChC,QAAyB,EACzBJ,KAAgB,EAChBC,KAA+B,EACzB;EACN,MAAMY,SAAS,GAAGZ,KAAK,IAAI,CAAC,CAAC;EAC7B,IAAIrB,sBAAsB,CAACoB,KAAK,EAAEa,SAAS,CAAC,KAAKuB,mBAAmB,EAAE;IACpEhC,QAAQ,CAACU,OAAO,CAACd,KAAK,EAAEa,SAAS,CAAC;EACpC,CAAC,MAAM;IACLgB,YAAY,CAAC7B,KAAK,EAAEa,SAAS,CAAC;EAChC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMrC,QAAQ,GAAG;EACtBgC,OAAO,EAAEA,CAAsBR,KAAQ,EAAEC,KAAuB,EAAEC,IAAqB,KACrFM,OAAO,CAACR,KAAK,EAAEC,KAAK,EAAEC,IAAI,CAAC,CAACK,MAAM;EACpC+B,UAAU,EAAEL;AACd,CAAU;;AAEV;AACA,OAAO,SAASM,WAAWA,CAAA,EAAoB;EAC7C,OAAO/D,QAAQ;AACjB","ignoreList":[]}
|
|
@@ -5,6 +5,11 @@ import { toast } from '@oxyhq/bloom';
|
|
|
5
5
|
import { useFileStore } from "../../../stores/fileStore.js";
|
|
6
6
|
import { convertDocumentPickerAssetToFile, formatFileSize } from "../../../utils/fileManagement.js";
|
|
7
7
|
import { createPendingUploadFile, candidateName, candidateSize, candidateType, candidateUri, getErrorMessage, loadDocumentPicker } from "../shared.js";
|
|
8
|
+
function revokePreviewUrl(preview) {
|
|
9
|
+
if (preview?.startsWith('blob:')) {
|
|
10
|
+
URL.revokeObjectURL(preview);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Optimistic-entry metadata. `uploading` flags the placeholder so no asset URL
|
|
@@ -310,9 +315,7 @@ export const useFileUploadState = ({
|
|
|
310
315
|
|
|
311
316
|
// Cleanup preview URLs
|
|
312
317
|
pendingFiles.forEach(pf => {
|
|
313
|
-
|
|
314
|
-
URL.revokeObjectURL(pf.preview);
|
|
315
|
-
}
|
|
318
|
+
revokePreviewUrl(pf.preview);
|
|
316
319
|
});
|
|
317
320
|
setPendingFiles([]);
|
|
318
321
|
|
|
@@ -348,9 +351,7 @@ export const useFileUploadState = ({
|
|
|
348
351
|
const handleCancelUpload = () => {
|
|
349
352
|
// Cleanup preview URLs
|
|
350
353
|
pendingFiles.forEach(pf => {
|
|
351
|
-
|
|
352
|
-
URL.revokeObjectURL(pf.preview);
|
|
353
|
-
}
|
|
354
|
+
revokePreviewUrl(pf.preview);
|
|
354
355
|
});
|
|
355
356
|
setPendingFiles([]);
|
|
356
357
|
setShowUploadPreview(false);
|
|
@@ -359,7 +360,7 @@ export const useFileUploadState = ({
|
|
|
359
360
|
const file = pendingFiles.find(pf => pf.id === id);
|
|
360
361
|
if (!file) return;
|
|
361
362
|
if (file.preview) {
|
|
362
|
-
|
|
363
|
+
revokePreviewUrl(file.preview);
|
|
363
364
|
}
|
|
364
365
|
const updated = pendingFiles.filter(pf => pf.id !== id);
|
|
365
366
|
setPendingFiles(updated);
|