@oxyhq/services 5.12.9 → 5.12.11

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.
@@ -1128,43 +1128,9 @@ export class OxyServices {
1128
1128
  }
1129
1129
 
1130
1130
  // ============================================================================
1131
- // FILE METHODS
1131
+ // FILE METHODS (LEGACY - Using Asset Service)
1132
1132
  // ============================================================================
1133
1133
 
1134
- /**
1135
- * Upload file
1136
- */
1137
- async uploadFile(file: File | FormData, options?: any): Promise<any> {
1138
- try {
1139
- const formData = file instanceof FormData ? file : new FormData();
1140
- if (file instanceof File) {
1141
- formData.append('file', file);
1142
- }
1143
-
1144
- const res = await this.client.post('/api/files/upload', formData, {
1145
- headers: {
1146
- 'Content-Type': 'multipart/form-data',
1147
- },
1148
- ...options
1149
- });
1150
- return res.data;
1151
- } catch (error) {
1152
- throw this.handleError(error);
1153
- }
1154
- }
1155
-
1156
- /**
1157
- * Get file by ID
1158
- */
1159
- async getFile(fileId: string): Promise<any> {
1160
- try {
1161
- const res = await this.client.get(`/api/files/${fileId}`);
1162
- return res.data;
1163
- } catch (error) {
1164
- throw this.handleError(error);
1165
- }
1166
- }
1167
-
1168
1134
  /**
1169
1135
  * Delete file
1170
1136
  */
@@ -1178,9 +1144,6 @@ export class OxyServices {
1178
1144
  }
1179
1145
  }
1180
1146
 
1181
- /**
1182
- * Get file download URL
1183
- */
1184
1147
  /**
1185
1148
  * Get file download URL (API streaming proxy, attaches token for <img src>)
1186
1149
  */
@@ -50,11 +50,16 @@ export interface FileManagementScreenProps extends BaseScreenProps {
50
50
  */
51
51
  afterSelect?: 'close' | 'back' | 'none';
52
52
  allowUploadInSelectMode?: boolean;
53
+ /**
54
+ * Default visibility for uploaded files in this screen
55
+ * Useful for third-party apps that want files to be public (e.g., GIF selector)
56
+ */
57
+ defaultVisibility?: 'private' | 'public' | 'unlisted';
53
58
  }
54
59
 
55
60
  // Add this helper function near the top (after imports):
56
- async function uploadFileRaw(file: File | Blob, userId: string, oxyServices: any) {
57
- return await oxyServices.uploadRawFile(file);
61
+ async function uploadFileRaw(file: File | Blob, userId: string, oxyServices: any, visibility?: 'private' | 'public' | 'unlisted') {
62
+ return await oxyServices.uploadRawFile(file, visibility);
58
63
  }
59
64
 
60
65
  const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
@@ -73,6 +78,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
73
78
  disabledMimeTypes = [],
74
79
  afterSelect = 'close',
75
80
  allowUploadInSelectMode = true,
81
+ defaultVisibility = 'private',
76
82
  }) => {
77
83
  const { user, oxyServices } = useOxy();
78
84
 
@@ -434,7 +440,7 @@ const FileManagementScreen: React.FC<FileManagementScreenProps> = ({
434
440
  variants: [],
435
441
  };
436
442
  useFileStore.getState().addFile(optimisticFile, { prepend: true });
437
- const result = await uploadFileRaw(raw, targetUserId, oxyServices);
443
+ const result = await uploadFileRaw(raw, targetUserId, oxyServices, defaultVisibility);
438
444
  // Attempt to refresh file list incrementally – fetch single file metadata if API allows
439
445
  if (result?.file || result?.files?.[0]) {
440
446
  const f = result.file || result.files[0];