@speakableio/core 1.0.8 → 1.0.9

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.
@@ -183,7 +183,76 @@ declare function useCards({ cardIds, enabled, asObject, }: {
183
183
  }): {
184
184
  cards: PageActivityWithId[];
185
185
  cardsObject: Record<string, PageActivityWithId> | null;
186
- cardsQueries: _tanstack_react_query.UseQueryResult<PageActivityWithId | null, Error>[];
186
+ cardsQueries: _tanstack_react_query.UseQueryResult<{
187
+ id: string;
188
+ data: {
189
+ type: ActivityPageType;
190
+ id: string;
191
+ owners: string[];
192
+ checked?: boolean;
193
+ completed?: boolean;
194
+ media_area_id?: string | null;
195
+ media_area_layout?: "left" | "right" | null;
196
+ score?: number;
197
+ verificationStatus?: VerificationCardStatus;
198
+ native_text?: string;
199
+ repeat?: number;
200
+ language?: string | null;
201
+ image?: {
202
+ path?: string | null;
203
+ url?: string;
204
+ };
205
+ audio?: {
206
+ path?: string | null;
207
+ url?: string;
208
+ } | null;
209
+ notes?: string;
210
+ difficulty?: string;
211
+ default_language?: string;
212
+ target_text?: string;
213
+ grading_criteria?: string;
214
+ scoring_type?: string;
215
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
216
+ feedback_types?: string[];
217
+ rubricId?: string;
218
+ prompt?: string;
219
+ title?: string;
220
+ passing_score?: number;
221
+ maxCharacters?: number;
222
+ answer?: string[];
223
+ choices?: {
224
+ value: string;
225
+ option: string;
226
+ }[];
227
+ MCQType?: string;
228
+ multipleAttemptsAllowed?: boolean;
229
+ allowRetries?: boolean;
230
+ question?: string;
231
+ respondTime?: number;
232
+ hidePrompt?: boolean;
233
+ videoUrl?: string;
234
+ link?: string;
235
+ text?: string;
236
+ isListenAloud?: boolean;
237
+ embedCode?: string;
238
+ attempt?: number;
239
+ correct?: number;
240
+ autoGrade?: boolean;
241
+ points?: number;
242
+ shuffle?: boolean;
243
+ translation?: string;
244
+ includeAIContext?: boolean;
245
+ media_area_context_ref?: string | null;
246
+ standardId?: string;
247
+ target_proficiency_level?: string;
248
+ allowTTS?: boolean;
249
+ feedback_language?: string | null;
250
+ correct_answer?: string | null;
251
+ limit_attempts?: boolean;
252
+ max_attempts?: number;
253
+ rich_text?: string;
254
+ };
255
+ } | null, Error>[];
187
256
  };
188
257
  declare function useCreateCard(): {
189
258
  mutationCreateCard: _tanstack_react_query.UseMutationResult<{
@@ -275,7 +344,76 @@ declare function updateCardInCache({ cardId, card, queryClient, }: {
275
344
  declare function useGetCard({ cardId, enabled }: {
276
345
  cardId: string;
277
346
  enabled?: boolean;
278
- }): _tanstack_react_query.UseQueryResult<PageActivityWithId | null, Error>;
347
+ }): _tanstack_react_query.UseQueryResult<{
348
+ id: string;
349
+ data: {
350
+ type: ActivityPageType;
351
+ id: string;
352
+ owners: string[];
353
+ checked?: boolean;
354
+ completed?: boolean;
355
+ media_area_id?: string | null;
356
+ media_area_layout?: "left" | "right" | null;
357
+ score?: number;
358
+ verificationStatus?: VerificationCardStatus;
359
+ native_text?: string;
360
+ repeat?: number;
361
+ language?: string | null;
362
+ image?: {
363
+ path?: string | null;
364
+ url?: string;
365
+ };
366
+ audio?: {
367
+ path?: string | null;
368
+ url?: string;
369
+ } | null;
370
+ notes?: string;
371
+ difficulty?: string;
372
+ default_language?: string;
373
+ target_text?: string;
374
+ grading_criteria?: string;
375
+ scoring_type?: string;
376
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
377
+ feedback_types?: string[];
378
+ rubricId?: string;
379
+ prompt?: string;
380
+ title?: string;
381
+ passing_score?: number;
382
+ maxCharacters?: number;
383
+ answer?: string[];
384
+ choices?: {
385
+ value: string;
386
+ option: string;
387
+ }[];
388
+ MCQType?: string;
389
+ multipleAttemptsAllowed?: boolean;
390
+ allowRetries?: boolean;
391
+ question?: string;
392
+ respondTime?: number;
393
+ hidePrompt?: boolean;
394
+ videoUrl?: string;
395
+ link?: string;
396
+ text?: string;
397
+ isListenAloud?: boolean;
398
+ embedCode?: string;
399
+ attempt?: number;
400
+ correct?: number;
401
+ autoGrade?: boolean;
402
+ points?: number;
403
+ shuffle?: boolean;
404
+ translation?: string;
405
+ includeAIContext?: boolean;
406
+ media_area_context_ref?: string | null;
407
+ standardId?: string;
408
+ target_proficiency_level?: string;
409
+ allowTTS?: boolean;
410
+ feedback_language?: string | null;
411
+ correct_answer?: string | null;
412
+ limit_attempts?: boolean;
413
+ max_attempts?: number;
414
+ rich_text?: string;
415
+ };
416
+ } | null, Error>;
279
417
 
280
418
  declare const createCardRepo: () => {
281
419
  createCard: (args_0: {
@@ -354,7 +492,76 @@ declare const createCardRepo: () => {
354
492
  }[]>;
355
493
  getCard: (params: {
356
494
  cardId: string;
357
- }) => Promise<PageActivityWithId | null>;
495
+ }) => Promise<{
496
+ id: string;
497
+ data: {
498
+ type: ActivityPageType;
499
+ id: string;
500
+ owners: string[];
501
+ checked?: boolean;
502
+ completed?: boolean;
503
+ media_area_id?: string | null;
504
+ media_area_layout?: "left" | "right" | null;
505
+ score?: number;
506
+ verificationStatus?: VerificationCardStatus;
507
+ native_text?: string;
508
+ repeat?: number;
509
+ language?: string | null;
510
+ image?: {
511
+ path?: string | null;
512
+ url?: string;
513
+ };
514
+ audio?: {
515
+ path?: string | null;
516
+ url?: string;
517
+ } | null;
518
+ notes?: string;
519
+ difficulty?: string;
520
+ default_language?: string;
521
+ target_text?: string;
522
+ grading_criteria?: string;
523
+ scoring_type?: string;
524
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
525
+ feedback_types?: string[];
526
+ rubricId?: string;
527
+ prompt?: string;
528
+ title?: string;
529
+ passing_score?: number;
530
+ maxCharacters?: number;
531
+ answer?: string[];
532
+ choices?: {
533
+ value: string;
534
+ option: string;
535
+ }[];
536
+ MCQType?: string;
537
+ multipleAttemptsAllowed?: boolean;
538
+ allowRetries?: boolean;
539
+ question?: string;
540
+ respondTime?: number;
541
+ hidePrompt?: boolean;
542
+ videoUrl?: string;
543
+ link?: string;
544
+ text?: string;
545
+ isListenAloud?: boolean;
546
+ embedCode?: string;
547
+ attempt?: number;
548
+ correct?: number;
549
+ autoGrade?: boolean;
550
+ points?: number;
551
+ shuffle?: boolean;
552
+ translation?: string;
553
+ includeAIContext?: boolean;
554
+ media_area_context_ref?: string | null;
555
+ standardId?: string;
556
+ target_proficiency_level?: string;
557
+ allowTTS?: boolean;
558
+ feedback_language?: string | null;
559
+ correct_answer?: string | null;
560
+ limit_attempts?: boolean;
561
+ max_attempts?: number;
562
+ rich_text?: string;
563
+ };
564
+ } | null>;
358
565
  };
359
566
 
360
567
  declare function checkIsRepeatPage(cardType: ActivityPageType | undefined): boolean;
@@ -1161,7 +1368,76 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1161
1368
  }[]>;
1162
1369
  getCard: (params: {
1163
1370
  cardId: string;
1164
- }) => Promise<PageActivityWithId | null>;
1371
+ }) => Promise<{
1372
+ id: string;
1373
+ data: {
1374
+ type: ActivityPageType;
1375
+ id: string;
1376
+ owners: string[];
1377
+ checked?: boolean;
1378
+ completed?: boolean;
1379
+ media_area_id?: string | null;
1380
+ media_area_layout?: "left" | "right" | null;
1381
+ score?: number;
1382
+ verificationStatus?: VerificationCardStatus;
1383
+ native_text?: string;
1384
+ repeat?: number;
1385
+ language?: string | null;
1386
+ image?: {
1387
+ path?: string | null;
1388
+ url?: string;
1389
+ };
1390
+ audio?: {
1391
+ path?: string | null;
1392
+ url?: string;
1393
+ } | null;
1394
+ notes?: string;
1395
+ difficulty?: string;
1396
+ default_language?: string;
1397
+ target_text?: string;
1398
+ grading_criteria?: string;
1399
+ scoring_type?: string;
1400
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1401
+ feedback_types?: string[];
1402
+ rubricId?: string;
1403
+ prompt?: string;
1404
+ title?: string;
1405
+ passing_score?: number;
1406
+ maxCharacters?: number;
1407
+ answer?: string[];
1408
+ choices?: {
1409
+ value: string;
1410
+ option: string;
1411
+ }[];
1412
+ MCQType?: string;
1413
+ multipleAttemptsAllowed?: boolean;
1414
+ allowRetries?: boolean;
1415
+ question?: string;
1416
+ respondTime?: number;
1417
+ hidePrompt?: boolean;
1418
+ videoUrl?: string;
1419
+ link?: string;
1420
+ text?: string;
1421
+ isListenAloud?: boolean;
1422
+ embedCode?: string;
1423
+ attempt?: number;
1424
+ correct?: number;
1425
+ autoGrade?: boolean;
1426
+ points?: number;
1427
+ shuffle?: boolean;
1428
+ translation?: string;
1429
+ includeAIContext?: boolean;
1430
+ media_area_context_ref?: string | null;
1431
+ standardId?: string;
1432
+ target_proficiency_level?: string;
1433
+ allowTTS?: boolean;
1434
+ feedback_language?: string | null;
1435
+ correct_answer?: string | null;
1436
+ limit_attempts?: boolean;
1437
+ max_attempts?: number;
1438
+ rich_text?: string;
1439
+ };
1440
+ } | null>;
1165
1441
  };
1166
1442
  };
1167
1443
 
@@ -1334,7 +1610,76 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1334
1610
  };
1335
1611
  cards: {
1336
1612
  data: Record<string, PageActivityWithId> | null;
1337
- query: _tanstack_react_query.UseQueryResult<PageActivityWithId | null, Error>[];
1613
+ query: _tanstack_react_query.UseQueryResult<{
1614
+ id: string;
1615
+ data: {
1616
+ type: ActivityPageType;
1617
+ id: string;
1618
+ owners: string[];
1619
+ checked?: boolean;
1620
+ completed?: boolean;
1621
+ media_area_id?: string | null;
1622
+ media_area_layout?: "left" | "right" | null;
1623
+ score?: number;
1624
+ verificationStatus?: VerificationCardStatus;
1625
+ native_text?: string;
1626
+ repeat?: number;
1627
+ language?: string | null;
1628
+ image?: {
1629
+ path?: string | null;
1630
+ url?: string;
1631
+ };
1632
+ audio?: {
1633
+ path?: string | null;
1634
+ url?: string;
1635
+ } | null;
1636
+ notes?: string;
1637
+ difficulty?: string;
1638
+ default_language?: string;
1639
+ target_text?: string;
1640
+ grading_criteria?: string;
1641
+ scoring_type?: string;
1642
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1643
+ feedback_types?: string[];
1644
+ rubricId?: string;
1645
+ prompt?: string;
1646
+ title?: string;
1647
+ passing_score?: number;
1648
+ maxCharacters?: number;
1649
+ answer?: string[];
1650
+ choices?: {
1651
+ value: string;
1652
+ option: string;
1653
+ }[];
1654
+ MCQType?: string;
1655
+ multipleAttemptsAllowed?: boolean;
1656
+ allowRetries?: boolean;
1657
+ question?: string;
1658
+ respondTime?: number;
1659
+ hidePrompt?: boolean;
1660
+ videoUrl?: string;
1661
+ link?: string;
1662
+ text?: string;
1663
+ isListenAloud?: boolean;
1664
+ embedCode?: string;
1665
+ attempt?: number;
1666
+ correct?: number;
1667
+ autoGrade?: boolean;
1668
+ points?: number;
1669
+ shuffle?: boolean;
1670
+ translation?: string;
1671
+ includeAIContext?: boolean;
1672
+ media_area_context_ref?: string | null;
1673
+ standardId?: string;
1674
+ target_proficiency_level?: string;
1675
+ allowTTS?: boolean;
1676
+ feedback_language?: string | null;
1677
+ correct_answer?: string | null;
1678
+ limit_attempts?: boolean;
1679
+ max_attempts?: number;
1680
+ rich_text?: string;
1681
+ };
1682
+ } | null, Error>[];
1338
1683
  cardsArray: PageActivityWithId[];
1339
1684
  };
1340
1685
  assignment: {
@@ -2841,7 +3186,76 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
2841
3186
  }[]>;
2842
3187
  getCard: (params: {
2843
3188
  cardId: string;
2844
- }) => Promise<PageActivityWithId | null>;
3189
+ }) => Promise<{
3190
+ id: string;
3191
+ data: {
3192
+ type: ActivityPageType;
3193
+ id: string;
3194
+ owners: string[];
3195
+ checked?: boolean;
3196
+ completed?: boolean;
3197
+ media_area_id?: string | null;
3198
+ media_area_layout?: "left" | "right" | null;
3199
+ score?: number;
3200
+ verificationStatus?: VerificationCardStatus;
3201
+ native_text?: string;
3202
+ repeat?: number;
3203
+ language?: string | null;
3204
+ image?: {
3205
+ path?: string | null;
3206
+ url?: string;
3207
+ };
3208
+ audio?: {
3209
+ path?: string | null;
3210
+ url?: string;
3211
+ } | null;
3212
+ notes?: string;
3213
+ difficulty?: string;
3214
+ default_language?: string;
3215
+ target_text?: string;
3216
+ grading_criteria?: string;
3217
+ scoring_type?: string;
3218
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
3219
+ feedback_types?: string[];
3220
+ rubricId?: string;
3221
+ prompt?: string;
3222
+ title?: string;
3223
+ passing_score?: number;
3224
+ maxCharacters?: number;
3225
+ answer?: string[];
3226
+ choices?: {
3227
+ value: string;
3228
+ option: string;
3229
+ }[];
3230
+ MCQType?: string;
3231
+ multipleAttemptsAllowed?: boolean;
3232
+ allowRetries?: boolean;
3233
+ question?: string;
3234
+ respondTime?: number;
3235
+ hidePrompt?: boolean;
3236
+ videoUrl?: string;
3237
+ link?: string;
3238
+ text?: string;
3239
+ isListenAloud?: boolean;
3240
+ embedCode?: string;
3241
+ attempt?: number;
3242
+ correct?: number;
3243
+ autoGrade?: boolean;
3244
+ points?: number;
3245
+ shuffle?: boolean;
3246
+ translation?: string;
3247
+ includeAIContext?: boolean;
3248
+ media_area_context_ref?: string | null;
3249
+ standardId?: string;
3250
+ target_proficiency_level?: string;
3251
+ allowTTS?: boolean;
3252
+ feedback_language?: string | null;
3253
+ correct_answer?: string | null;
3254
+ limit_attempts?: boolean;
3255
+ max_attempts?: number;
3256
+ rich_text?: string;
3257
+ };
3258
+ } | null>;
2845
3259
  };
2846
3260
  };
2847
3261
 
@@ -1617,6 +1617,36 @@ function useSubmitPracticeScore() {
1617
1617
  var import_react_query3 = require("@tanstack/react-query");
1618
1618
  var import_react2 = require("react");
1619
1619
 
1620
+ // src/domains/cards/card.model.ts
1621
+ var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
1622
+ ActivityPageType2["READ_REPEAT"] = "READ_REPEAT";
1623
+ ActivityPageType2["READ_RESPOND"] = "READ_RESPOND";
1624
+ ActivityPageType2["FREE_RESPONSE"] = "FREE_RESPONSE";
1625
+ ActivityPageType2["REPEAT"] = "REPEAT";
1626
+ ActivityPageType2["RESPOND"] = "RESPOND";
1627
+ ActivityPageType2["RESPOND_WRITE"] = "RESPOND_WRITE";
1628
+ ActivityPageType2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
1629
+ ActivityPageType2["MEDIA_PAGE"] = "MEDIA_PAGE";
1630
+ ActivityPageType2["SHORT_ANSWER"] = "SHORT_ANSWER";
1631
+ return ActivityPageType2;
1632
+ })(ActivityPageType || {});
1633
+ var RESPOND_PAGE_ACTIVITY_TYPES = [
1634
+ "READ_RESPOND" /* READ_RESPOND */,
1635
+ "RESPOND" /* RESPOND */,
1636
+ "RESPOND_WRITE" /* RESPOND_WRITE */,
1637
+ "FREE_RESPONSE" /* FREE_RESPONSE */
1638
+ ];
1639
+ var MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES = ["MULTIPLE_CHOICE" /* MULTIPLE_CHOICE */];
1640
+ var REPEAT_PAGE_ACTIVITY_TYPES = ["READ_REPEAT" /* READ_REPEAT */, "REPEAT" /* REPEAT */];
1641
+ var RESPOND_WRITE_PAGE_ACTIVITY_TYPES = [
1642
+ "RESPOND_WRITE" /* RESPOND_WRITE */,
1643
+ "FREE_RESPONSE" /* FREE_RESPONSE */
1644
+ ];
1645
+ var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
1646
+ "RESPOND" /* RESPOND */,
1647
+ "READ_RESPOND" /* READ_RESPOND */
1648
+ ];
1649
+
1620
1650
  // src/domains/cards/card.constants.ts
1621
1651
  var FeedbackTypesCard = /* @__PURE__ */ ((FeedbackTypesCard2) => {
1622
1652
  FeedbackTypesCard2["SuggestedResponse"] = "suggested_response";
@@ -1720,43 +1750,21 @@ async function _getCard(params) {
1720
1750
  const ref = refsCardsFiresotre.card(params.cardId);
1721
1751
  const response = await api.getDoc(ref);
1722
1752
  if (!response.data) return null;
1723
- return response.data;
1753
+ const type = response.data.type || "READ_REPEAT" /* READ_REPEAT */;
1754
+ const cardsMapped = {
1755
+ ...response.data,
1756
+ type
1757
+ };
1758
+ return {
1759
+ id: response.id,
1760
+ data: cardsMapped
1761
+ };
1724
1762
  }
1725
1763
  var getCard = withErrorHandler(_getCard, "getCard");
1726
1764
 
1727
1765
  // src/domains/cards/services/create-card.service.ts
1728
1766
  var import_uuid = require("uuid");
1729
1767
 
1730
- // src/domains/cards/card.model.ts
1731
- var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
1732
- ActivityPageType2["READ_REPEAT"] = "READ_REPEAT";
1733
- ActivityPageType2["READ_RESPOND"] = "READ_RESPOND";
1734
- ActivityPageType2["FREE_RESPONSE"] = "FREE_RESPONSE";
1735
- ActivityPageType2["REPEAT"] = "REPEAT";
1736
- ActivityPageType2["RESPOND"] = "RESPOND";
1737
- ActivityPageType2["RESPOND_WRITE"] = "RESPOND_WRITE";
1738
- ActivityPageType2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
1739
- ActivityPageType2["MEDIA_PAGE"] = "MEDIA_PAGE";
1740
- ActivityPageType2["SHORT_ANSWER"] = "SHORT_ANSWER";
1741
- return ActivityPageType2;
1742
- })(ActivityPageType || {});
1743
- var RESPOND_PAGE_ACTIVITY_TYPES = [
1744
- "READ_RESPOND" /* READ_RESPOND */,
1745
- "RESPOND" /* RESPOND */,
1746
- "RESPOND_WRITE" /* RESPOND_WRITE */,
1747
- "FREE_RESPONSE" /* FREE_RESPONSE */
1748
- ];
1749
- var MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES = ["MULTIPLE_CHOICE" /* MULTIPLE_CHOICE */];
1750
- var REPEAT_PAGE_ACTIVITY_TYPES = ["READ_REPEAT" /* READ_REPEAT */, "REPEAT" /* REPEAT */];
1751
- var RESPOND_WRITE_PAGE_ACTIVITY_TYPES = [
1752
- "RESPOND_WRITE" /* RESPOND_WRITE */,
1753
- "FREE_RESPONSE" /* FREE_RESPONSE */
1754
- ];
1755
- var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
1756
- "RESPOND" /* RESPOND */,
1757
- "READ_RESPOND" /* READ_RESPOND */
1758
- ];
1759
-
1760
1768
  // src/utils/text-utils.ts
1761
1769
  var import_js_sha1 = __toESM(require("js-sha1"));
1762
1770
  var purify = (word) => {