@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 createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
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
 
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,18 @@ 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 cardsMapped;
1619
1654
  }
1620
1655
  var getCard = withErrorHandler(_getCard, "getCard");
1621
1656
 
1622
1657
  // src/domains/cards/services/create-card.service.ts
1623
1658
  import { v4 } from "uuid";
1624
1659
 
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
1660
  // src/utils/text-utils.ts
1656
1661
  import sha1 from "js-sha1";
1657
1662
  var purify = (word) => {