@adriansteffan/reactive 0.2.3 → 0.2.4

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.
@@ -1,4 +1,4 @@
1
- import { W as P, b as x, E } from "./mod-kduyZSvT.js";
1
+ import { W as P, b as x, E } from "./mod-Cx6xH-XQ.js";
2
2
  function m(w) {
3
3
  const e = w.split("/").filter((t) => t !== "."), r = [];
4
4
  return e.forEach((t) => {
@@ -1,4 +1,4 @@
1
- import { W as e } from "./mod-kduyZSvT.js";
1
+ import { W as e } from "./mod-Cx6xH-XQ.js";
2
2
  class s extends e {
3
3
  async enable() {
4
4
  console.log("Immersive mode is only available on Android");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansteffan/reactive",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -318,17 +318,18 @@ export default function Upload({
318
318
  });
319
319
 
320
320
  try {
321
+ if (shouldDownload) {
322
+ await downloadFiles(files);
323
+ }
324
+
325
+ // Filter out eagerly uploaded files for the server upload (they're already there)
326
+ const filesToUpload = files.filter((f) => !f._alreadyUploaded);
321
327
  const payload: UploadPayload = {
322
328
  sessionId: sessionIDUpload,
323
- // Include _uploadId so the backend can rename the eager-upload folder
324
329
  ...(store?._uploadId && store._uploadId !== sessionIDUpload ? { _uploadId: store._uploadId } : {}),
325
- files: files.map((file) => ({ ...file, encoding: file.encoding ?? 'utf8' })),
330
+ files: filesToUpload.map((file) => ({ ...file, encoding: file.encoding ?? 'utf8' })),
326
331
  };
327
332
 
328
- if (shouldDownload) {
329
- await downloadFiles(files);
330
- }
331
-
332
333
  if (!shouldUpload) {
333
334
  next({});
334
335
  return;
@@ -36,6 +36,8 @@ export interface FileUpload {
36
36
  filename: string;
37
37
  content: string;
38
38
  encoding?: 'base64' | 'utf8';
39
+ /** Internal flag: file was already eagerly uploaded, skip in upload but include in download. */
40
+ _alreadyUploaded?: boolean;
39
41
  }
40
42
 
41
43
  export interface ExperimentConfig {
@@ -199,16 +199,15 @@ function extractAudioRecordings(data: any[]): FileUpload[] {
199
199
  const files: FileUpload[] = [];
200
200
 
201
201
  const processRecording = (obj: any, nameHint: string) => {
202
- if (obj?.type === 'audiorecording') {
203
- if (obj._audioPreUploaded && obj._audioPreUploadedFilename) {
204
- // Already uploaded eagerly -> just record the filename reference
205
- obj.audioFile = obj._audioPreUploadedFilename;
206
- } else if (obj.data64) {
207
- // Not pre-uploaded —> extract as a file for the final upload
208
- const filename = generateAudioFilename(nameHint);
209
- files.push({ filename, content: obj.data64, encoding: 'base64' });
210
- obj.audioFile = filename;
211
- }
202
+ if (obj?.type === 'audiorecording' && obj.data64) {
203
+ const filename = obj._audioPreUploadedFilename ?? generateAudioFilename(nameHint);
204
+ files.push({
205
+ filename,
206
+ content: obj.data64,
207
+ encoding: 'base64' as const,
208
+ _alreadyUploaded: !!obj._audioPreUploaded,
209
+ });
210
+ obj.audioFile = filename;
212
211
  delete obj.data64;
213
212
  delete obj.blob;
214
213
  delete obj.url;