@speakableio/core 1.0.35 → 1.0.37

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.
@@ -97,6 +97,7 @@ interface PageActivity {
97
97
  media?: {
98
98
  type: 'image' | 'video' | 'link';
99
99
  url: string;
100
+ transcript?: string | null;
100
101
  } | null;
101
102
  score?: number;
102
103
  verificationStatus?: VerificationCardStatus;
@@ -157,6 +158,8 @@ interface PageActivity {
157
158
  limit_attempts?: boolean;
158
159
  max_attempts?: number;
159
160
  rich_text?: string;
161
+ feedbackOff?: boolean;
162
+ correct_answer_exact_match?: boolean;
160
163
  }
161
164
  declare const enum ActivityPageType {
162
165
  READ_REPEAT = "READ_REPEAT",
@@ -200,6 +203,7 @@ declare function useCards({ cardIds, enabled, asObject, }: {
200
203
  media?: {
201
204
  type: "image" | "video" | "link";
202
205
  url: string;
206
+ transcript?: string | null;
203
207
  } | null;
204
208
  score?: number;
205
209
  verificationStatus?: VerificationCardStatus;
@@ -259,6 +263,8 @@ declare function useCards({ cardIds, enabled, asObject, }: {
259
263
  limit_attempts?: boolean;
260
264
  max_attempts?: number;
261
265
  rich_text?: string;
266
+ feedbackOff?: boolean;
267
+ correct_answer_exact_match?: boolean;
262
268
  } | null, Error>[];
263
269
  };
264
270
  declare function useCreateCard(): {
@@ -280,6 +286,7 @@ declare function useCreateCards(): {
280
286
  media?: {
281
287
  type: "image" | "video" | "link";
282
288
  url: string;
289
+ transcript?: string | null;
283
290
  } | null;
284
291
  score?: number;
285
292
  verificationStatus?: VerificationCardStatus;
@@ -340,6 +347,8 @@ declare function useCreateCards(): {
340
347
  limit_attempts?: boolean;
341
348
  max_attempts?: number;
342
349
  rich_text?: string;
350
+ feedbackOff?: boolean;
351
+ correct_answer_exact_match?: boolean;
343
352
  }[], Error, {
344
353
  cards: PageActivity[];
345
354
  }, unknown>;
@@ -368,6 +377,7 @@ declare function useGetCard({ cardId, enabled }: {
368
377
  media?: {
369
378
  type: "image" | "video" | "link";
370
379
  url: string;
380
+ transcript?: string | null;
371
381
  } | null;
372
382
  score?: number;
373
383
  verificationStatus?: VerificationCardStatus;
@@ -427,6 +437,8 @@ declare function useGetCard({ cardId, enabled }: {
427
437
  limit_attempts?: boolean;
428
438
  max_attempts?: number;
429
439
  rich_text?: string;
440
+ feedbackOff?: boolean;
441
+ correct_answer_exact_match?: boolean;
430
442
  } | null, Error>;
431
443
 
432
444
  declare const createCardRepo: () => {
@@ -448,6 +460,7 @@ declare const createCardRepo: () => {
448
460
  media?: {
449
461
  type: "image" | "video" | "link";
450
462
  url: string;
463
+ transcript?: string | null;
451
464
  } | null;
452
465
  score?: number;
453
466
  verificationStatus?: VerificationCardStatus;
@@ -508,6 +521,8 @@ declare const createCardRepo: () => {
508
521
  limit_attempts?: boolean;
509
522
  max_attempts?: number;
510
523
  rich_text?: string;
524
+ feedbackOff?: boolean;
525
+ correct_answer_exact_match?: boolean;
511
526
  }[]>;
512
527
  getCard: (params: {
513
528
  cardId: string;
@@ -523,6 +538,7 @@ declare const createCardRepo: () => {
523
538
  media?: {
524
539
  type: "image" | "video" | "link";
525
540
  url: string;
541
+ transcript?: string | null;
526
542
  } | null;
527
543
  score?: number;
528
544
  verificationStatus?: VerificationCardStatus;
@@ -582,6 +598,8 @@ declare const createCardRepo: () => {
582
598
  limit_attempts?: boolean;
583
599
  max_attempts?: number;
584
600
  rich_text?: string;
601
+ feedbackOff?: boolean;
602
+ correct_answer_exact_match?: boolean;
585
603
  } | null>;
586
604
  };
587
605
 
@@ -617,6 +635,18 @@ declare const getLabelPage: (pageType: ActivityPageType | undefined) => {
617
635
  long: string;
618
636
  };
619
637
 
638
+ /**
639
+ * Get the media data for a page
640
+ * @param page - The page to get the media data for
641
+ * @returns The media data for the page
642
+
643
+ * - direction: The direction of the media area
644
+ * - mode: The mode of the media area
645
+ * - singleMedia: The single media data for the page
646
+ * - isMediaPage: Whether the page is a media page
647
+ * - hasMediaData: Whether the page has some kind of media data
648
+ * - mediaAreaId: The id of the media area
649
+ */
620
650
  declare function getPageMediaData(page: PageActivityWithId): {
621
651
  direction: "left" | "right";
622
652
  mode: "single" | "media_area" | "none" | null;
@@ -624,17 +654,21 @@ declare function getPageMediaData(page: PageActivityWithId): {
624
654
  rawObject: {
625
655
  type: "image" | "video" | "link";
626
656
  url: string;
657
+ transcript?: string | null;
627
658
  };
628
659
  type: "image" | "video" | "link";
629
660
  content: string;
630
661
  } | undefined;
631
662
  isMediaPage: boolean;
632
- hasMediaData: string | boolean;
663
+ hasMediaData: boolean;
664
+ mediaAreaId: string | undefined;
665
+ shouldRenderMediaArea: boolean;
633
666
  };
634
667
  declare function getSingleMediaPageData(page: PageActivityWithId): {
635
668
  rawObject: {
636
669
  type: "image" | "video" | "link";
637
670
  url: string;
671
+ transcript?: string | null;
638
672
  };
639
673
  type: "image" | "video" | "link";
640
674
  content: string;
@@ -1375,6 +1409,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1375
1409
  media?: {
1376
1410
  type: "image" | "video" | "link";
1377
1411
  url: string;
1412
+ transcript?: string | null;
1378
1413
  } | null;
1379
1414
  score?: number;
1380
1415
  verificationStatus?: VerificationCardStatus;
@@ -1435,6 +1470,8 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1435
1470
  limit_attempts?: boolean;
1436
1471
  max_attempts?: number;
1437
1472
  rich_text?: string;
1473
+ feedbackOff?: boolean;
1474
+ correct_answer_exact_match?: boolean;
1438
1475
  }[]>;
1439
1476
  getCard: (params: {
1440
1477
  cardId: string;
@@ -1450,6 +1487,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1450
1487
  media?: {
1451
1488
  type: "image" | "video" | "link";
1452
1489
  url: string;
1490
+ transcript?: string | null;
1453
1491
  } | null;
1454
1492
  score?: number;
1455
1493
  verificationStatus?: VerificationCardStatus;
@@ -1509,6 +1547,8 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1509
1547
  limit_attempts?: boolean;
1510
1548
  max_attempts?: number;
1511
1549
  rich_text?: string;
1550
+ feedbackOff?: boolean;
1551
+ correct_answer_exact_match?: boolean;
1512
1552
  } | null>;
1513
1553
  };
1514
1554
  };
@@ -1708,6 +1748,7 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1708
1748
  media?: {
1709
1749
  type: "image" | "video" | "link";
1710
1750
  url: string;
1751
+ transcript?: string | null;
1711
1752
  } | null;
1712
1753
  score?: number;
1713
1754
  verificationStatus?: VerificationCardStatus;
@@ -1767,6 +1808,8 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1767
1808
  limit_attempts?: boolean;
1768
1809
  max_attempts?: number;
1769
1810
  rich_text?: string;
1811
+ feedbackOff?: boolean;
1812
+ correct_answer_exact_match?: boolean;
1770
1813
  } | null, Error>[];
1771
1814
  cardsArray: PageActivityWithId[];
1772
1815
  };
@@ -3254,6 +3297,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3254
3297
  media?: {
3255
3298
  type: "image" | "video" | "link";
3256
3299
  url: string;
3300
+ transcript?: string | null;
3257
3301
  } | null;
3258
3302
  score?: number;
3259
3303
  verificationStatus?: VerificationCardStatus;
@@ -3314,6 +3358,8 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3314
3358
  limit_attempts?: boolean;
3315
3359
  max_attempts?: number;
3316
3360
  rich_text?: string;
3361
+ feedbackOff?: boolean;
3362
+ correct_answer_exact_match?: boolean;
3317
3363
  }[]>;
3318
3364
  getCard: (params: {
3319
3365
  cardId: string;
@@ -3329,6 +3375,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3329
3375
  media?: {
3330
3376
  type: "image" | "video" | "link";
3331
3377
  url: string;
3378
+ transcript?: string | null;
3332
3379
  } | null;
3333
3380
  score?: number;
3334
3381
  verificationStatus?: VerificationCardStatus;
@@ -3388,6 +3435,8 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3388
3435
  limit_attempts?: boolean;
3389
3436
  max_attempts?: number;
3390
3437
  rich_text?: string;
3438
+ feedbackOff?: boolean;
3439
+ correct_answer_exact_match?: boolean;
3391
3440
  } | null>;
3392
3441
  };
3393
3442
  };
@@ -97,6 +97,7 @@ interface PageActivity {
97
97
  media?: {
98
98
  type: 'image' | 'video' | 'link';
99
99
  url: string;
100
+ transcript?: string | null;
100
101
  } | null;
101
102
  score?: number;
102
103
  verificationStatus?: VerificationCardStatus;
@@ -157,6 +158,8 @@ interface PageActivity {
157
158
  limit_attempts?: boolean;
158
159
  max_attempts?: number;
159
160
  rich_text?: string;
161
+ feedbackOff?: boolean;
162
+ correct_answer_exact_match?: boolean;
160
163
  }
161
164
  declare const enum ActivityPageType {
162
165
  READ_REPEAT = "READ_REPEAT",
@@ -200,6 +203,7 @@ declare function useCards({ cardIds, enabled, asObject, }: {
200
203
  media?: {
201
204
  type: "image" | "video" | "link";
202
205
  url: string;
206
+ transcript?: string | null;
203
207
  } | null;
204
208
  score?: number;
205
209
  verificationStatus?: VerificationCardStatus;
@@ -259,6 +263,8 @@ declare function useCards({ cardIds, enabled, asObject, }: {
259
263
  limit_attempts?: boolean;
260
264
  max_attempts?: number;
261
265
  rich_text?: string;
266
+ feedbackOff?: boolean;
267
+ correct_answer_exact_match?: boolean;
262
268
  } | null, Error>[];
263
269
  };
264
270
  declare function useCreateCard(): {
@@ -280,6 +286,7 @@ declare function useCreateCards(): {
280
286
  media?: {
281
287
  type: "image" | "video" | "link";
282
288
  url: string;
289
+ transcript?: string | null;
283
290
  } | null;
284
291
  score?: number;
285
292
  verificationStatus?: VerificationCardStatus;
@@ -340,6 +347,8 @@ declare function useCreateCards(): {
340
347
  limit_attempts?: boolean;
341
348
  max_attempts?: number;
342
349
  rich_text?: string;
350
+ feedbackOff?: boolean;
351
+ correct_answer_exact_match?: boolean;
343
352
  }[], Error, {
344
353
  cards: PageActivity[];
345
354
  }, unknown>;
@@ -368,6 +377,7 @@ declare function useGetCard({ cardId, enabled }: {
368
377
  media?: {
369
378
  type: "image" | "video" | "link";
370
379
  url: string;
380
+ transcript?: string | null;
371
381
  } | null;
372
382
  score?: number;
373
383
  verificationStatus?: VerificationCardStatus;
@@ -427,6 +437,8 @@ declare function useGetCard({ cardId, enabled }: {
427
437
  limit_attempts?: boolean;
428
438
  max_attempts?: number;
429
439
  rich_text?: string;
440
+ feedbackOff?: boolean;
441
+ correct_answer_exact_match?: boolean;
430
442
  } | null, Error>;
431
443
 
432
444
  declare const createCardRepo: () => {
@@ -448,6 +460,7 @@ declare const createCardRepo: () => {
448
460
  media?: {
449
461
  type: "image" | "video" | "link";
450
462
  url: string;
463
+ transcript?: string | null;
451
464
  } | null;
452
465
  score?: number;
453
466
  verificationStatus?: VerificationCardStatus;
@@ -508,6 +521,8 @@ declare const createCardRepo: () => {
508
521
  limit_attempts?: boolean;
509
522
  max_attempts?: number;
510
523
  rich_text?: string;
524
+ feedbackOff?: boolean;
525
+ correct_answer_exact_match?: boolean;
511
526
  }[]>;
512
527
  getCard: (params: {
513
528
  cardId: string;
@@ -523,6 +538,7 @@ declare const createCardRepo: () => {
523
538
  media?: {
524
539
  type: "image" | "video" | "link";
525
540
  url: string;
541
+ transcript?: string | null;
526
542
  } | null;
527
543
  score?: number;
528
544
  verificationStatus?: VerificationCardStatus;
@@ -582,6 +598,8 @@ declare const createCardRepo: () => {
582
598
  limit_attempts?: boolean;
583
599
  max_attempts?: number;
584
600
  rich_text?: string;
601
+ feedbackOff?: boolean;
602
+ correct_answer_exact_match?: boolean;
585
603
  } | null>;
586
604
  };
587
605
 
@@ -617,6 +635,18 @@ declare const getLabelPage: (pageType: ActivityPageType | undefined) => {
617
635
  long: string;
618
636
  };
619
637
 
638
+ /**
639
+ * Get the media data for a page
640
+ * @param page - The page to get the media data for
641
+ * @returns The media data for the page
642
+
643
+ * - direction: The direction of the media area
644
+ * - mode: The mode of the media area
645
+ * - singleMedia: The single media data for the page
646
+ * - isMediaPage: Whether the page is a media page
647
+ * - hasMediaData: Whether the page has some kind of media data
648
+ * - mediaAreaId: The id of the media area
649
+ */
620
650
  declare function getPageMediaData(page: PageActivityWithId): {
621
651
  direction: "left" | "right";
622
652
  mode: "single" | "media_area" | "none" | null;
@@ -624,17 +654,21 @@ declare function getPageMediaData(page: PageActivityWithId): {
624
654
  rawObject: {
625
655
  type: "image" | "video" | "link";
626
656
  url: string;
657
+ transcript?: string | null;
627
658
  };
628
659
  type: "image" | "video" | "link";
629
660
  content: string;
630
661
  } | undefined;
631
662
  isMediaPage: boolean;
632
- hasMediaData: string | boolean;
663
+ hasMediaData: boolean;
664
+ mediaAreaId: string | undefined;
665
+ shouldRenderMediaArea: boolean;
633
666
  };
634
667
  declare function getSingleMediaPageData(page: PageActivityWithId): {
635
668
  rawObject: {
636
669
  type: "image" | "video" | "link";
637
670
  url: string;
671
+ transcript?: string | null;
638
672
  };
639
673
  type: "image" | "video" | "link";
640
674
  content: string;
@@ -1375,6 +1409,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1375
1409
  media?: {
1376
1410
  type: "image" | "video" | "link";
1377
1411
  url: string;
1412
+ transcript?: string | null;
1378
1413
  } | null;
1379
1414
  score?: number;
1380
1415
  verificationStatus?: VerificationCardStatus;
@@ -1435,6 +1470,8 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1435
1470
  limit_attempts?: boolean;
1436
1471
  max_attempts?: number;
1437
1472
  rich_text?: string;
1473
+ feedbackOff?: boolean;
1474
+ correct_answer_exact_match?: boolean;
1438
1475
  }[]>;
1439
1476
  getCard: (params: {
1440
1477
  cardId: string;
@@ -1450,6 +1487,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1450
1487
  media?: {
1451
1488
  type: "image" | "video" | "link";
1452
1489
  url: string;
1490
+ transcript?: string | null;
1453
1491
  } | null;
1454
1492
  score?: number;
1455
1493
  verificationStatus?: VerificationCardStatus;
@@ -1509,6 +1547,8 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1509
1547
  limit_attempts?: boolean;
1510
1548
  max_attempts?: number;
1511
1549
  rich_text?: string;
1550
+ feedbackOff?: boolean;
1551
+ correct_answer_exact_match?: boolean;
1512
1552
  } | null>;
1513
1553
  };
1514
1554
  };
@@ -1708,6 +1748,7 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1708
1748
  media?: {
1709
1749
  type: "image" | "video" | "link";
1710
1750
  url: string;
1751
+ transcript?: string | null;
1711
1752
  } | null;
1712
1753
  score?: number;
1713
1754
  verificationStatus?: VerificationCardStatus;
@@ -1767,6 +1808,8 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1767
1808
  limit_attempts?: boolean;
1768
1809
  max_attempts?: number;
1769
1810
  rich_text?: string;
1811
+ feedbackOff?: boolean;
1812
+ correct_answer_exact_match?: boolean;
1770
1813
  } | null, Error>[];
1771
1814
  cardsArray: PageActivityWithId[];
1772
1815
  };
@@ -3254,6 +3297,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3254
3297
  media?: {
3255
3298
  type: "image" | "video" | "link";
3256
3299
  url: string;
3300
+ transcript?: string | null;
3257
3301
  } | null;
3258
3302
  score?: number;
3259
3303
  verificationStatus?: VerificationCardStatus;
@@ -3314,6 +3358,8 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3314
3358
  limit_attempts?: boolean;
3315
3359
  max_attempts?: number;
3316
3360
  rich_text?: string;
3361
+ feedbackOff?: boolean;
3362
+ correct_answer_exact_match?: boolean;
3317
3363
  }[]>;
3318
3364
  getCard: (params: {
3319
3365
  cardId: string;
@@ -3329,6 +3375,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3329
3375
  media?: {
3330
3376
  type: "image" | "video" | "link";
3331
3377
  url: string;
3378
+ transcript?: string | null;
3332
3379
  } | null;
3333
3380
  score?: number;
3334
3381
  verificationStatus?: VerificationCardStatus;
@@ -3388,6 +3435,8 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3388
3435
  limit_attempts?: boolean;
3389
3436
  max_attempts?: number;
3390
3437
  rich_text?: string;
3438
+ feedbackOff?: boolean;
3439
+ correct_answer_exact_match?: boolean;
3391
3440
  } | null>;
3392
3441
  };
3393
3442
  };
@@ -2221,18 +2221,22 @@ var getLabelPage = (pageType) => {
2221
2221
 
2222
2222
  // src/domains/cards/utils/get-page-media-data.ts
2223
2223
  function getPageMediaData(page) {
2224
- var _a, _b;
2224
+ var _a, _b, _c, _d;
2225
2225
  const direction = (_a = page.media_area_layout) != null ? _a : "left";
2226
2226
  const { isMediaPage } = checkTypePageActivity(page.type);
2227
2227
  const mode = (_b = page.media_mode) != null ? _b : page.media_area_id ? "media_area" : null;
2228
2228
  const singleMedia = getSingleMediaPageData(page);
2229
- const hasMediaData = !!page.media_area_id || page.media_area_context_ref || singleMedia !== void 0;
2229
+ const mediaAreaId = (_d = (_c = page.media_area_id) != null ? _c : page.media_area_context_ref) != null ? _d : void 0;
2230
+ const shouldRenderMediaArea = isMediaPage || mode === "media_area" || !(page == null ? void 0 : page.media_mode) && mediaAreaId != null;
2231
+ const hasMediaData = !!page.media_area_id || !!page.media_area_context_ref || singleMedia !== void 0;
2230
2232
  return {
2231
2233
  direction,
2232
2234
  mode,
2233
2235
  singleMedia,
2234
2236
  isMediaPage,
2235
- hasMediaData
2237
+ hasMediaData,
2238
+ mediaAreaId,
2239
+ shouldRenderMediaArea
2236
2240
  };
2237
2241
  }
2238
2242
  function getSingleMediaPageData(page) {