@speakableio/core 1.0.8 → 1.0.10

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,73 @@ 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
+ type: ActivityPageType;
188
+ id: string;
189
+ owners: string[];
190
+ checked?: boolean;
191
+ completed?: boolean;
192
+ media_area_id?: string | null;
193
+ media_area_layout?: "left" | "right" | null;
194
+ score?: number;
195
+ verificationStatus?: VerificationCardStatus;
196
+ native_text?: string;
197
+ repeat?: number;
198
+ language?: string | null;
199
+ image?: {
200
+ path?: string | null;
201
+ url?: string;
202
+ };
203
+ audio?: {
204
+ path?: string | null;
205
+ url?: string;
206
+ } | null;
207
+ notes?: string;
208
+ difficulty?: string;
209
+ default_language?: string;
210
+ target_text?: string;
211
+ grading_criteria?: string;
212
+ scoring_type?: string;
213
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
214
+ feedback_types?: string[];
215
+ rubricId?: string;
216
+ prompt?: string;
217
+ title?: string;
218
+ passing_score?: number;
219
+ maxCharacters?: number;
220
+ answer?: string[];
221
+ choices?: {
222
+ value: string;
223
+ option: string;
224
+ }[];
225
+ MCQType?: string;
226
+ multipleAttemptsAllowed?: boolean;
227
+ allowRetries?: boolean;
228
+ question?: string;
229
+ respondTime?: number;
230
+ hidePrompt?: boolean;
231
+ videoUrl?: string;
232
+ link?: string;
233
+ text?: string;
234
+ isListenAloud?: boolean;
235
+ embedCode?: string;
236
+ attempt?: number;
237
+ correct?: number;
238
+ autoGrade?: boolean;
239
+ points?: number;
240
+ shuffle?: boolean;
241
+ translation?: string;
242
+ includeAIContext?: boolean;
243
+ media_area_context_ref?: string | null;
244
+ standardId?: string;
245
+ target_proficiency_level?: string;
246
+ allowTTS?: boolean;
247
+ feedback_language?: string | null;
248
+ correct_answer?: string | null;
249
+ limit_attempts?: boolean;
250
+ max_attempts?: number;
251
+ rich_text?: string;
252
+ } | null, Error>[];
187
253
  };
188
254
  declare function useCreateCard(): {
189
255
  mutationCreateCard: _tanstack_react_query.UseMutationResult<{
@@ -275,7 +341,73 @@ declare function updateCardInCache({ cardId, card, queryClient, }: {
275
341
  declare function useGetCard({ cardId, enabled }: {
276
342
  cardId: string;
277
343
  enabled?: boolean;
278
- }): _tanstack_react_query.UseQueryResult<PageActivityWithId | null, Error>;
344
+ }): _tanstack_react_query.UseQueryResult<{
345
+ type: ActivityPageType;
346
+ id: string;
347
+ owners: string[];
348
+ checked?: boolean;
349
+ completed?: boolean;
350
+ media_area_id?: string | null;
351
+ media_area_layout?: "left" | "right" | null;
352
+ score?: number;
353
+ verificationStatus?: VerificationCardStatus;
354
+ native_text?: string;
355
+ repeat?: number;
356
+ language?: string | null;
357
+ image?: {
358
+ path?: string | null;
359
+ url?: string;
360
+ };
361
+ audio?: {
362
+ path?: string | null;
363
+ url?: string;
364
+ } | null;
365
+ notes?: string;
366
+ difficulty?: string;
367
+ default_language?: string;
368
+ target_text?: string;
369
+ grading_criteria?: string;
370
+ scoring_type?: string;
371
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
372
+ feedback_types?: string[];
373
+ rubricId?: string;
374
+ prompt?: string;
375
+ title?: string;
376
+ passing_score?: number;
377
+ maxCharacters?: number;
378
+ answer?: string[];
379
+ choices?: {
380
+ value: string;
381
+ option: string;
382
+ }[];
383
+ MCQType?: string;
384
+ multipleAttemptsAllowed?: boolean;
385
+ allowRetries?: boolean;
386
+ question?: string;
387
+ respondTime?: number;
388
+ hidePrompt?: boolean;
389
+ videoUrl?: string;
390
+ link?: string;
391
+ text?: string;
392
+ isListenAloud?: boolean;
393
+ embedCode?: string;
394
+ attempt?: number;
395
+ correct?: number;
396
+ autoGrade?: boolean;
397
+ points?: number;
398
+ shuffle?: boolean;
399
+ translation?: string;
400
+ includeAIContext?: boolean;
401
+ media_area_context_ref?: string | null;
402
+ standardId?: string;
403
+ target_proficiency_level?: string;
404
+ allowTTS?: boolean;
405
+ feedback_language?: string | null;
406
+ correct_answer?: string | null;
407
+ limit_attempts?: boolean;
408
+ max_attempts?: number;
409
+ rich_text?: string;
410
+ } | null, Error>;
279
411
 
280
412
  declare const createCardRepo: () => {
281
413
  createCard: (args_0: {
@@ -354,7 +486,73 @@ declare const createCardRepo: () => {
354
486
  }[]>;
355
487
  getCard: (params: {
356
488
  cardId: string;
357
- }) => Promise<PageActivityWithId | null>;
489
+ }) => Promise<{
490
+ type: ActivityPageType;
491
+ id: string;
492
+ owners: string[];
493
+ checked?: boolean;
494
+ completed?: boolean;
495
+ media_area_id?: string | null;
496
+ media_area_layout?: "left" | "right" | null;
497
+ score?: number;
498
+ verificationStatus?: VerificationCardStatus;
499
+ native_text?: string;
500
+ repeat?: number;
501
+ language?: string | null;
502
+ image?: {
503
+ path?: string | null;
504
+ url?: string;
505
+ };
506
+ audio?: {
507
+ path?: string | null;
508
+ url?: string;
509
+ } | null;
510
+ notes?: string;
511
+ difficulty?: string;
512
+ default_language?: string;
513
+ target_text?: string;
514
+ grading_criteria?: string;
515
+ scoring_type?: string;
516
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
517
+ feedback_types?: string[];
518
+ rubricId?: string;
519
+ prompt?: string;
520
+ title?: string;
521
+ passing_score?: number;
522
+ maxCharacters?: number;
523
+ answer?: string[];
524
+ choices?: {
525
+ value: string;
526
+ option: string;
527
+ }[];
528
+ MCQType?: string;
529
+ multipleAttemptsAllowed?: boolean;
530
+ allowRetries?: boolean;
531
+ question?: string;
532
+ respondTime?: number;
533
+ hidePrompt?: boolean;
534
+ videoUrl?: string;
535
+ link?: string;
536
+ text?: string;
537
+ isListenAloud?: boolean;
538
+ embedCode?: string;
539
+ attempt?: number;
540
+ correct?: number;
541
+ autoGrade?: boolean;
542
+ points?: number;
543
+ shuffle?: boolean;
544
+ translation?: string;
545
+ includeAIContext?: boolean;
546
+ media_area_context_ref?: string | null;
547
+ standardId?: string;
548
+ target_proficiency_level?: string;
549
+ allowTTS?: boolean;
550
+ feedback_language?: string | null;
551
+ correct_answer?: string | null;
552
+ limit_attempts?: boolean;
553
+ max_attempts?: number;
554
+ rich_text?: string;
555
+ } | null>;
358
556
  };
359
557
 
360
558
  declare function checkIsRepeatPage(cardType: ActivityPageType | undefined): boolean;
@@ -1161,7 +1359,73 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
1161
1359
  }[]>;
1162
1360
  getCard: (params: {
1163
1361
  cardId: string;
1164
- }) => Promise<PageActivityWithId | null>;
1362
+ }) => Promise<{
1363
+ type: ActivityPageType;
1364
+ id: string;
1365
+ owners: string[];
1366
+ checked?: boolean;
1367
+ completed?: boolean;
1368
+ media_area_id?: string | null;
1369
+ media_area_layout?: "left" | "right" | null;
1370
+ score?: number;
1371
+ verificationStatus?: VerificationCardStatus;
1372
+ native_text?: string;
1373
+ repeat?: number;
1374
+ language?: string | null;
1375
+ image?: {
1376
+ path?: string | null;
1377
+ url?: string;
1378
+ };
1379
+ audio?: {
1380
+ path?: string | null;
1381
+ url?: string;
1382
+ } | null;
1383
+ notes?: string;
1384
+ difficulty?: string;
1385
+ default_language?: string;
1386
+ target_text?: string;
1387
+ grading_criteria?: string;
1388
+ scoring_type?: string;
1389
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1390
+ feedback_types?: string[];
1391
+ rubricId?: string;
1392
+ prompt?: string;
1393
+ title?: string;
1394
+ passing_score?: number;
1395
+ maxCharacters?: number;
1396
+ answer?: string[];
1397
+ choices?: {
1398
+ value: string;
1399
+ option: string;
1400
+ }[];
1401
+ MCQType?: string;
1402
+ multipleAttemptsAllowed?: boolean;
1403
+ allowRetries?: boolean;
1404
+ question?: string;
1405
+ respondTime?: number;
1406
+ hidePrompt?: boolean;
1407
+ videoUrl?: string;
1408
+ link?: string;
1409
+ text?: string;
1410
+ isListenAloud?: boolean;
1411
+ embedCode?: string;
1412
+ attempt?: number;
1413
+ correct?: number;
1414
+ autoGrade?: boolean;
1415
+ points?: number;
1416
+ shuffle?: boolean;
1417
+ translation?: string;
1418
+ includeAIContext?: boolean;
1419
+ media_area_context_ref?: string | null;
1420
+ standardId?: string;
1421
+ target_proficiency_level?: string;
1422
+ allowTTS?: boolean;
1423
+ feedback_language?: string | null;
1424
+ correct_answer?: string | null;
1425
+ limit_attempts?: boolean;
1426
+ max_attempts?: number;
1427
+ rich_text?: string;
1428
+ } | null>;
1165
1429
  };
1166
1430
  };
1167
1431
 
@@ -1334,7 +1598,73 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
1334
1598
  };
1335
1599
  cards: {
1336
1600
  data: Record<string, PageActivityWithId> | null;
1337
- query: _tanstack_react_query.UseQueryResult<PageActivityWithId | null, Error>[];
1601
+ query: _tanstack_react_query.UseQueryResult<{
1602
+ type: ActivityPageType;
1603
+ id: string;
1604
+ owners: string[];
1605
+ checked?: boolean;
1606
+ completed?: boolean;
1607
+ media_area_id?: string | null;
1608
+ media_area_layout?: "left" | "right" | null;
1609
+ score?: number;
1610
+ verificationStatus?: VerificationCardStatus;
1611
+ native_text?: string;
1612
+ repeat?: number;
1613
+ language?: string | null;
1614
+ image?: {
1615
+ path?: string | null;
1616
+ url?: string;
1617
+ };
1618
+ audio?: {
1619
+ path?: string | null;
1620
+ url?: string;
1621
+ } | null;
1622
+ notes?: string;
1623
+ difficulty?: string;
1624
+ default_language?: string;
1625
+ target_text?: string;
1626
+ grading_criteria?: string;
1627
+ scoring_type?: string;
1628
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
1629
+ feedback_types?: string[];
1630
+ rubricId?: string;
1631
+ prompt?: string;
1632
+ title?: string;
1633
+ passing_score?: number;
1634
+ maxCharacters?: number;
1635
+ answer?: string[];
1636
+ choices?: {
1637
+ value: string;
1638
+ option: string;
1639
+ }[];
1640
+ MCQType?: string;
1641
+ multipleAttemptsAllowed?: boolean;
1642
+ allowRetries?: boolean;
1643
+ question?: string;
1644
+ respondTime?: number;
1645
+ hidePrompt?: boolean;
1646
+ videoUrl?: string;
1647
+ link?: string;
1648
+ text?: string;
1649
+ isListenAloud?: boolean;
1650
+ embedCode?: string;
1651
+ attempt?: number;
1652
+ correct?: number;
1653
+ autoGrade?: boolean;
1654
+ points?: number;
1655
+ shuffle?: boolean;
1656
+ translation?: string;
1657
+ includeAIContext?: boolean;
1658
+ media_area_context_ref?: string | null;
1659
+ standardId?: string;
1660
+ target_proficiency_level?: string;
1661
+ allowTTS?: boolean;
1662
+ feedback_language?: string | null;
1663
+ correct_answer?: string | null;
1664
+ limit_attempts?: boolean;
1665
+ max_attempts?: number;
1666
+ rich_text?: string;
1667
+ } | null, Error>[];
1338
1668
  cardsArray: PageActivityWithId[];
1339
1669
  };
1340
1670
  assignment: {
@@ -2841,7 +3171,73 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
2841
3171
  }[]>;
2842
3172
  getCard: (params: {
2843
3173
  cardId: string;
2844
- }) => Promise<PageActivityWithId | null>;
3174
+ }) => Promise<{
3175
+ type: ActivityPageType;
3176
+ id: string;
3177
+ owners: string[];
3178
+ checked?: boolean;
3179
+ completed?: boolean;
3180
+ media_area_id?: string | null;
3181
+ media_area_layout?: "left" | "right" | null;
3182
+ score?: number;
3183
+ verificationStatus?: VerificationCardStatus;
3184
+ native_text?: string;
3185
+ repeat?: number;
3186
+ language?: string | null;
3187
+ image?: {
3188
+ path?: string | null;
3189
+ url?: string;
3190
+ };
3191
+ audio?: {
3192
+ path?: string | null;
3193
+ url?: string;
3194
+ } | null;
3195
+ notes?: string;
3196
+ difficulty?: string;
3197
+ default_language?: string;
3198
+ target_text?: string;
3199
+ grading_criteria?: string;
3200
+ scoring_type?: string;
3201
+ grading_method?: "simple" | "rubric" | "manual" | "standards_based";
3202
+ feedback_types?: string[];
3203
+ rubricId?: string;
3204
+ prompt?: string;
3205
+ title?: string;
3206
+ passing_score?: number;
3207
+ maxCharacters?: number;
3208
+ answer?: string[];
3209
+ choices?: {
3210
+ value: string;
3211
+ option: string;
3212
+ }[];
3213
+ MCQType?: string;
3214
+ multipleAttemptsAllowed?: boolean;
3215
+ allowRetries?: boolean;
3216
+ question?: string;
3217
+ respondTime?: number;
3218
+ hidePrompt?: boolean;
3219
+ videoUrl?: string;
3220
+ link?: string;
3221
+ text?: string;
3222
+ isListenAloud?: boolean;
3223
+ embedCode?: string;
3224
+ attempt?: number;
3225
+ correct?: number;
3226
+ autoGrade?: boolean;
3227
+ points?: number;
3228
+ shuffle?: boolean;
3229
+ translation?: string;
3230
+ includeAIContext?: boolean;
3231
+ media_area_context_ref?: string | null;
3232
+ standardId?: string;
3233
+ target_proficiency_level?: string;
3234
+ allowTTS?: boolean;
3235
+ feedback_language?: string | null;
3236
+ correct_answer?: string | null;
3237
+ limit_attempts?: boolean;
3238
+ max_attempts?: number;
3239
+ rich_text?: string;
3240
+ } | null>;
2845
3241
  };
2846
3242
  };
2847
3243
 
@@ -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,18 @@ 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 cardsMapped;
1724
1759
  }
1725
1760
  var getCard = withErrorHandler(_getCard, "getCard");
1726
1761
 
1727
1762
  // src/domains/cards/services/create-card.service.ts
1728
1763
  var import_uuid = require("uuid");
1729
1764
 
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
1765
  // src/utils/text-utils.ts
1761
1766
  var import_js_sha1 = __toESM(require("js-sha1"));
1762
1767
  var purify = (word) => {