@epic-web/workshop-utils 6.50.14 → 6.51.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.
@@ -135,6 +135,7 @@ declare const DataSchema: z.ZodObject<{
135
135
  }, {
136
136
  dismissed?: boolean | undefined;
137
137
  }>>>;
138
+ onboardingComplete: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
138
139
  }, "strip", z.ZodTypeAny, {
139
140
  player: {
140
141
  subtitle: {
@@ -157,6 +158,7 @@ declare const DataSchema: z.ZodObject<{
157
158
  exerciseWarning: {
158
159
  dismissed: boolean;
159
160
  };
161
+ onboardingComplete: string[];
160
162
  playground?: {
161
163
  persist: boolean;
162
164
  } | undefined;
@@ -187,6 +189,7 @@ declare const DataSchema: z.ZodObject<{
187
189
  exerciseWarning?: {
188
190
  dismissed?: boolean | undefined;
189
191
  } | undefined;
192
+ onboardingComplete?: string[] | undefined;
190
193
  }>>>;
191
194
  authInfo: z.ZodOptional<z.ZodObject<{
192
195
  id: z.ZodString;
@@ -285,6 +288,7 @@ declare const DataSchema: z.ZodObject<{
285
288
  exerciseWarning: {
286
289
  dismissed: boolean;
287
290
  };
291
+ onboardingComplete: string[];
288
292
  playground?: {
289
293
  persist: boolean;
290
294
  } | undefined;
@@ -339,6 +343,7 @@ declare const DataSchema: z.ZodObject<{
339
343
  exerciseWarning?: {
340
344
  dismissed?: boolean | undefined;
341
345
  } | undefined;
346
+ onboardingComplete?: string[] | undefined;
342
347
  } | undefined;
343
348
  authInfo?: {
344
349
  id: string;
@@ -391,6 +396,7 @@ export declare function readDb(): Promise<{
391
396
  exerciseWarning: {
392
397
  dismissed: boolean;
393
398
  };
399
+ onboardingComplete: string[];
394
400
  playground?: {
395
401
  persist: boolean;
396
402
  } | undefined;
@@ -487,6 +493,7 @@ export declare function getPreferences(): Promise<{
487
493
  exerciseWarning: {
488
494
  dismissed: boolean;
489
495
  };
496
+ onboardingComplete: string[];
490
497
  playground?: {
491
498
  persist: boolean;
492
499
  } | undefined;
@@ -518,7 +525,47 @@ export declare function setPreferences(preferences: z.input<typeof DataSchema>['
518
525
  persist?: boolean | undefined;
519
526
  } | undefined;
520
527
  fontSize?: number | undefined;
528
+ onboardingComplete?: string[] | undefined;
521
529
  }>;
530
+ /**
531
+ * Mark an onboarding feature as complete.
532
+ * This is used to track which tips/indicators have been dismissed.
533
+ * @param featureId - Unique identifier for the feature (e.g., 'files-popover')
534
+ */
535
+ export declare function markOnboardingComplete(featureId: string): Promise<{
536
+ onboardingComplete: string[];
537
+ player?: {
538
+ subtitle: {
539
+ mode: "disabled" | "hidden" | "showing" | null;
540
+ id: string | null;
541
+ };
542
+ minResolution?: number | undefined;
543
+ maxResolution?: number | undefined;
544
+ volumeRate?: number | undefined;
545
+ playbackRate?: number | undefined;
546
+ autoplay?: boolean | undefined;
547
+ muted?: boolean | undefined;
548
+ theater?: boolean | undefined;
549
+ defaultView?: string | undefined;
550
+ activeSidebarTab?: number | undefined;
551
+ } | undefined;
552
+ presence?: {
553
+ optOut: boolean;
554
+ } | undefined;
555
+ exerciseWarning?: {
556
+ dismissed: boolean;
557
+ } | undefined;
558
+ playground?: {
559
+ persist: boolean;
560
+ } | undefined;
561
+ fontSize?: number | undefined;
562
+ } | undefined>;
563
+ /**
564
+ * Check if a user has completed an onboarding feature.
565
+ * @param featureId - Unique identifier for the feature
566
+ * @returns true if the user has completed this onboarding, false otherwise
567
+ */
568
+ export declare function isOnboardingComplete(featureId: string): Promise<boolean>;
522
569
  export declare function getMutedNotifications(): Promise<string[]>;
523
570
  export declare function muteNotification(id: string): Promise<string[]>;
524
571
  export declare function setFontSizePreference(fontSize: number | undefined): Promise<number | undefined>;
package/dist/db.server.js CHANGED
@@ -68,6 +68,8 @@ const DataSchema = z.object({
68
68
  })
69
69
  .optional()
70
70
  .default({ dismissed: false }),
71
+ // Array of completed onboarding feature IDs (e.g., ['files-popover', 'persist-playground'])
72
+ onboardingComplete: z.array(z.string()).optional().default([]),
71
73
  })
72
74
  .optional()
73
75
  .default({}),
@@ -278,6 +280,37 @@ export async function setPreferences(preferences) {
278
280
  await saveJSON(updatedData);
279
281
  return updatedData.preferences;
280
282
  }
283
+ /**
284
+ * Mark an onboarding feature as complete.
285
+ * This is used to track which tips/indicators have been dismissed.
286
+ * @param featureId - Unique identifier for the feature (e.g., 'files-popover')
287
+ */
288
+ export async function markOnboardingComplete(featureId) {
289
+ const data = await readDb();
290
+ const currentComplete = data?.preferences?.onboardingComplete ?? [];
291
+ // Avoid duplicates
292
+ if (currentComplete.includes(featureId)) {
293
+ return data?.preferences;
294
+ }
295
+ const updatedData = {
296
+ ...data,
297
+ preferences: {
298
+ ...data?.preferences,
299
+ onboardingComplete: [...currentComplete, featureId],
300
+ },
301
+ };
302
+ await saveJSON(updatedData);
303
+ return updatedData.preferences;
304
+ }
305
+ /**
306
+ * Check if a user has completed an onboarding feature.
307
+ * @param featureId - Unique identifier for the feature
308
+ * @returns true if the user has completed this onboarding, false otherwise
309
+ */
310
+ export async function isOnboardingComplete(featureId) {
311
+ const data = await readDb();
312
+ return data?.preferences?.onboardingComplete?.includes(featureId) ?? false;
313
+ }
281
314
  export async function getMutedNotifications() {
282
315
  const data = await readDb();
283
316
  return data?.mutedNotifications ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-utils",
3
- "version": "6.50.14",
3
+ "version": "6.51.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },