@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 createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
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
 
package/dist/index.web.js CHANGED
@@ -1512,6 +1512,36 @@ function useSubmitPracticeScore() {
1512
1512
  import { useMutation as useMutation2, useQueries, useQuery as useQuery3 } from "@tanstack/react-query";
1513
1513
  import { useMemo } from "react";
1514
1514
 
1515
+ // src/domains/cards/card.model.ts
1516
+ var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
1517
+ ActivityPageType2["READ_REPEAT"] = "READ_REPEAT";
1518
+ ActivityPageType2["READ_RESPOND"] = "READ_RESPOND";
1519
+ ActivityPageType2["FREE_RESPONSE"] = "FREE_RESPONSE";
1520
+ ActivityPageType2["REPEAT"] = "REPEAT";
1521
+ ActivityPageType2["RESPOND"] = "RESPOND";
1522
+ ActivityPageType2["RESPOND_WRITE"] = "RESPOND_WRITE";
1523
+ ActivityPageType2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
1524
+ ActivityPageType2["MEDIA_PAGE"] = "MEDIA_PAGE";
1525
+ ActivityPageType2["SHORT_ANSWER"] = "SHORT_ANSWER";
1526
+ return ActivityPageType2;
1527
+ })(ActivityPageType || {});
1528
+ var RESPOND_PAGE_ACTIVITY_TYPES = [
1529
+ "READ_RESPOND" /* READ_RESPOND */,
1530
+ "RESPOND" /* RESPOND */,
1531
+ "RESPOND_WRITE" /* RESPOND_WRITE */,
1532
+ "FREE_RESPONSE" /* FREE_RESPONSE */
1533
+ ];
1534
+ var MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES = ["MULTIPLE_CHOICE" /* MULTIPLE_CHOICE */];
1535
+ var REPEAT_PAGE_ACTIVITY_TYPES = ["READ_REPEAT" /* READ_REPEAT */, "REPEAT" /* REPEAT */];
1536
+ var RESPOND_WRITE_PAGE_ACTIVITY_TYPES = [
1537
+ "RESPOND_WRITE" /* RESPOND_WRITE */,
1538
+ "FREE_RESPONSE" /* FREE_RESPONSE */
1539
+ ];
1540
+ var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
1541
+ "RESPOND" /* RESPOND */,
1542
+ "READ_RESPOND" /* READ_RESPOND */
1543
+ ];
1544
+
1515
1545
  // src/domains/cards/card.constants.ts
1516
1546
  var FeedbackTypesCard = /* @__PURE__ */ ((FeedbackTypesCard2) => {
1517
1547
  FeedbackTypesCard2["SuggestedResponse"] = "suggested_response";
@@ -1615,43 +1645,21 @@ async function _getCard(params) {
1615
1645
  const ref = refsCardsFiresotre.card(params.cardId);
1616
1646
  const response = await api.getDoc(ref);
1617
1647
  if (!response.data) return null;
1618
- return response.data;
1648
+ const type = response.data.type || "READ_REPEAT" /* READ_REPEAT */;
1649
+ const cardsMapped = {
1650
+ ...response.data,
1651
+ type
1652
+ };
1653
+ return {
1654
+ id: response.id,
1655
+ data: cardsMapped
1656
+ };
1619
1657
  }
1620
1658
  var getCard = withErrorHandler(_getCard, "getCard");
1621
1659
 
1622
1660
  // src/domains/cards/services/create-card.service.ts
1623
1661
  import { v4 } from "uuid";
1624
1662
 
1625
- // src/domains/cards/card.model.ts
1626
- var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
1627
- ActivityPageType2["READ_REPEAT"] = "READ_REPEAT";
1628
- ActivityPageType2["READ_RESPOND"] = "READ_RESPOND";
1629
- ActivityPageType2["FREE_RESPONSE"] = "FREE_RESPONSE";
1630
- ActivityPageType2["REPEAT"] = "REPEAT";
1631
- ActivityPageType2["RESPOND"] = "RESPOND";
1632
- ActivityPageType2["RESPOND_WRITE"] = "RESPOND_WRITE";
1633
- ActivityPageType2["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
1634
- ActivityPageType2["MEDIA_PAGE"] = "MEDIA_PAGE";
1635
- ActivityPageType2["SHORT_ANSWER"] = "SHORT_ANSWER";
1636
- return ActivityPageType2;
1637
- })(ActivityPageType || {});
1638
- var RESPOND_PAGE_ACTIVITY_TYPES = [
1639
- "READ_RESPOND" /* READ_RESPOND */,
1640
- "RESPOND" /* RESPOND */,
1641
- "RESPOND_WRITE" /* RESPOND_WRITE */,
1642
- "FREE_RESPONSE" /* FREE_RESPONSE */
1643
- ];
1644
- var MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES = ["MULTIPLE_CHOICE" /* MULTIPLE_CHOICE */];
1645
- var REPEAT_PAGE_ACTIVITY_TYPES = ["READ_REPEAT" /* READ_REPEAT */, "REPEAT" /* REPEAT */];
1646
- var RESPOND_WRITE_PAGE_ACTIVITY_TYPES = [
1647
- "RESPOND_WRITE" /* RESPOND_WRITE */,
1648
- "FREE_RESPONSE" /* FREE_RESPONSE */
1649
- ];
1650
- var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
1651
- "RESPOND" /* RESPOND */,
1652
- "READ_RESPOND" /* READ_RESPOND */
1653
- ];
1654
-
1655
1663
  // src/utils/text-utils.ts
1656
1664
  import sha1 from "js-sha1";
1657
1665
  var purify = (word) => {