@speakableio/core 0.1.78 → 0.1.80
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.
- package/dist/analytics.js +23 -46
- package/dist/analytics.js.map +1 -1
- package/dist/{index.native.native.cjs → index.native.js} +1 -1
- package/dist/{index.native.native.mjs → index.native.mjs} +1 -1
- package/dist/index.web.js +161 -173
- package/dist/index.web.js.map +1 -1
- package/package.json +2 -1
- package/dist/analytics.d.ts +0 -88
- package/dist/analytics.mjs +0 -353
- package/dist/analytics.mjs.map +0 -1
- package/dist/index.web.d.ts +0 -2763
- package/dist/index.web.mjs +0 -3239
- package/dist/index.web.mjs.map +0 -1
- /package/dist/{index.native.native.cjs.map → index.native.js.map} +0 -0
- /package/dist/{index.native.native.mjs.map → index.native.mjs.map} +0 -0
package/dist/index.web.js
CHANGED
|
@@ -1,110 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/entry-points/index.web.ts
|
|
31
|
-
var index_web_exports = {};
|
|
32
|
-
__export(index_web_exports, {
|
|
33
|
-
ActivityPageType: () => ActivityPageType,
|
|
34
|
-
BASE_MULTIPLE_CHOICE_FIELD_VALUES: () => BASE_MULTIPLE_CHOICE_FIELD_VALUES,
|
|
35
|
-
BASE_REPEAT_FIELD_VALUES: () => BASE_REPEAT_FIELD_VALUES,
|
|
36
|
-
BASE_RESPOND_FIELD_VALUES: () => BASE_RESPOND_FIELD_VALUES,
|
|
37
|
-
FeedbackTypesCard: () => FeedbackTypesCard,
|
|
38
|
-
FsCtx: () => FsCtx,
|
|
39
|
-
LENIENCY_OPTIONS: () => LENIENCY_OPTIONS,
|
|
40
|
-
LeniencyCard: () => LeniencyCard,
|
|
41
|
-
MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES: () => MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES,
|
|
42
|
-
REPEAT_PAGE_ACTIVITY_TYPES: () => REPEAT_PAGE_ACTIVITY_TYPES,
|
|
43
|
-
RESPOND_AUDIO_PAGE_ACTIVITY_TYPES: () => RESPOND_AUDIO_PAGE_ACTIVITY_TYPES,
|
|
44
|
-
RESPOND_PAGE_ACTIVITY_TYPES: () => RESPOND_PAGE_ACTIVITY_TYPES,
|
|
45
|
-
RESPOND_WRITE_PAGE_ACTIVITY_TYPES: () => RESPOND_WRITE_PAGE_ACTIVITY_TYPES,
|
|
46
|
-
SPEAKABLE_NOTIFICATIONS: () => SPEAKABLE_NOTIFICATIONS,
|
|
47
|
-
STUDENT_LEVELS_OPTIONS: () => STUDENT_LEVELS_OPTIONS,
|
|
48
|
-
SpeakableNotificationTypes: () => SpeakableNotificationTypes,
|
|
49
|
-
SpeakableProvider: () => SpeakableProvider,
|
|
50
|
-
VerificationCardStatus: () => VerificationCardStatus,
|
|
51
|
-
assignmentQueryKeys: () => assignmentQueryKeys,
|
|
52
|
-
cardsQueryKeys: () => cardsQueryKeys,
|
|
53
|
-
checkIsMCPage: () => checkIsMCPage,
|
|
54
|
-
checkIsMediaPage: () => checkIsMediaPage,
|
|
55
|
-
checkIsRepeatPage: () => checkIsRepeatPage,
|
|
56
|
-
checkIsRespondAudioPage: () => checkIsRespondAudioPage,
|
|
57
|
-
checkIsRespondPage: () => checkIsRespondPage,
|
|
58
|
-
checkIsRespondWrittenPage: () => checkIsRespondWrittenPage,
|
|
59
|
-
checkIsShortAnswerPage: () => checkIsShortAnswerPage,
|
|
60
|
-
checkTypePageActivity: () => checkTypePageActivity,
|
|
61
|
-
cleanString: () => cleanString,
|
|
62
|
-
createAssignmentRepo: () => createAssignmentRepo,
|
|
63
|
-
createCardRepo: () => createCardRepo,
|
|
64
|
-
createFsClient: () => createFsClientWeb,
|
|
65
|
-
createSetRepo: () => createSetRepo,
|
|
66
|
-
creditQueryKeys: () => creditQueryKeys,
|
|
67
|
-
debounce: () => debounce,
|
|
68
|
-
getCardFromCache: () => getCardFromCache,
|
|
69
|
-
getPagePrompt: () => getPagePrompt,
|
|
70
|
-
getPhraseLength: () => getPhraseLength,
|
|
71
|
-
getRespondCardTool: () => getRespondCardTool,
|
|
72
|
-
getSetFromCache: () => getSetFromCache,
|
|
73
|
-
getWordHash: () => getWordHash,
|
|
74
|
-
purify: () => purify,
|
|
75
|
-
refsCardsFiresotre: () => refsCardsFiresotre,
|
|
76
|
-
refsSetsFirestore: () => refsSetsFirestore,
|
|
77
|
-
scoreQueryKeys: () => scoreQueryKeys,
|
|
78
|
-
setsQueryKeys: () => setsQueryKeys,
|
|
79
|
-
updateCardInCache: () => updateCardInCache,
|
|
80
|
-
updateSetInCache: () => updateSetInCache,
|
|
81
|
-
useActivity: () => useActivity,
|
|
82
|
-
useActivityFeedbackAccess: () => useActivityFeedbackAccess,
|
|
83
|
-
useAssignment: () => useAssignment,
|
|
84
|
-
useBaseOpenAI: () => useBaseOpenAI,
|
|
85
|
-
useCards: () => useCards,
|
|
86
|
-
useClearScore: () => useClearScore,
|
|
87
|
-
useCreateCard: () => useCreateCard,
|
|
88
|
-
useCreateCards: () => useCreateCards,
|
|
89
|
-
useCreateNotification: () => useCreateNotification,
|
|
90
|
-
useGetCard: () => useGetCard,
|
|
91
|
-
useOrganizationAccess: () => useOrganizationAccess,
|
|
92
|
-
useScore: () => useScore,
|
|
93
|
-
useSet: () => useSet,
|
|
94
|
-
useSpeakableApi: () => useSpeakableApi,
|
|
95
|
-
useSubmitAssignmentScore: () => useSubmitAssignmentScore,
|
|
96
|
-
useSubmitPracticeScore: () => useSubmitPracticeScore,
|
|
97
|
-
useUpdateCardScore: () => useUpdateCardScore,
|
|
98
|
-
useUpdateScore: () => useUpdateScore,
|
|
99
|
-
useUpdateStudentVocab: () => useUpdateStudentVocab,
|
|
100
|
-
useUserCredits: () => useUserCredits
|
|
101
|
-
});
|
|
102
|
-
module.exports = __toCommonJS(index_web_exports);
|
|
103
|
-
|
|
104
1
|
// src/providers/SpeakableProvider.tsx
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var FsCtx =
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var FsCtx = createContext(null);
|
|
108
5
|
function SpeakableProvider({
|
|
109
6
|
user,
|
|
110
7
|
children,
|
|
@@ -112,12 +9,12 @@ function SpeakableProvider({
|
|
|
112
9
|
permissions,
|
|
113
10
|
fsClient
|
|
114
11
|
}) {
|
|
115
|
-
const [speakableApi, setSpeakableApi] =
|
|
116
|
-
|
|
12
|
+
const [speakableApi, setSpeakableApi] = useState(null);
|
|
13
|
+
useEffect(() => {
|
|
117
14
|
setSpeakableApi(fsClient);
|
|
118
15
|
}, [fsClient]);
|
|
119
16
|
if (!speakableApi) return null;
|
|
120
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
121
18
|
FsCtx.Provider,
|
|
122
19
|
{
|
|
123
20
|
value: {
|
|
@@ -131,7 +28,7 @@ function SpeakableProvider({
|
|
|
131
28
|
);
|
|
132
29
|
}
|
|
133
30
|
function useSpeakableApi() {
|
|
134
|
-
const ctx =
|
|
31
|
+
const ctx = useContext(FsCtx);
|
|
135
32
|
if (!ctx) throw new Error("useSpeakableApi must be used within a SpeakableProvider");
|
|
136
33
|
return ctx;
|
|
137
34
|
}
|
|
@@ -398,12 +295,12 @@ async function _getAllAssignments() {
|
|
|
398
295
|
var getAllAssignments = withErrorHandler(_getAllAssignments, "getAllAssignments");
|
|
399
296
|
|
|
400
297
|
// src/domains/assignment/utils/check-assignment-availability.ts
|
|
401
|
-
|
|
298
|
+
import dayjs from "dayjs";
|
|
402
299
|
var checkAssignmentAvailability = (scheduledTime) => {
|
|
403
300
|
if (!scheduledTime) return true;
|
|
404
|
-
const scheduledDate = typeof scheduledTime === "string" ? (
|
|
301
|
+
const scheduledDate = typeof scheduledTime === "string" ? dayjs(scheduledTime) : dayjs(scheduledTime.toDate());
|
|
405
302
|
if (!scheduledDate.isValid()) return true;
|
|
406
|
-
return (
|
|
303
|
+
return dayjs().isAfter(scheduledDate);
|
|
407
304
|
};
|
|
408
305
|
|
|
409
306
|
// src/domains/assignment/services/get-assignment.service.ts
|
|
@@ -443,7 +340,7 @@ var createAssignmentRepo = () => {
|
|
|
443
340
|
};
|
|
444
341
|
|
|
445
342
|
// src/domains/assignment/hooks/assignment.hooks.ts
|
|
446
|
-
|
|
343
|
+
import { useQuery } from "@tanstack/react-query";
|
|
447
344
|
var assignmentQueryKeys = {
|
|
448
345
|
all: ["assignments"],
|
|
449
346
|
byId: (id) => [...assignmentQueryKeys.all, id],
|
|
@@ -456,7 +353,7 @@ function useAssignment({
|
|
|
456
353
|
userId
|
|
457
354
|
}) {
|
|
458
355
|
const { speakableApi } = useSpeakableApi();
|
|
459
|
-
return
|
|
356
|
+
return useQuery({
|
|
460
357
|
queryKey: assignmentQueryKeys.byId(assignmentId),
|
|
461
358
|
queryFn: () => speakableApi.assignmentRepo.getAssignment({
|
|
462
359
|
assignmentId,
|
|
@@ -468,7 +365,7 @@ function useAssignment({
|
|
|
468
365
|
}
|
|
469
366
|
|
|
470
367
|
// src/domains/assignment/hooks/score-hooks.ts
|
|
471
|
-
|
|
368
|
+
import { useMutation, useQuery as useQuery2 } from "@tanstack/react-query";
|
|
472
369
|
|
|
473
370
|
// src/utils/debounce.utils.ts
|
|
474
371
|
function debounce(func, waitFor) {
|
|
@@ -715,7 +612,7 @@ var SpeakableNotificationTypes = {
|
|
|
715
612
|
};
|
|
716
613
|
|
|
717
614
|
// src/domains/notification/services/create-notification.service.ts
|
|
718
|
-
|
|
615
|
+
import dayjs2 from "dayjs";
|
|
719
616
|
|
|
720
617
|
// src/constants/web.constants.ts
|
|
721
618
|
var WEB_BASE_URL = "https://app.speakable.io";
|
|
@@ -796,7 +693,7 @@ var createNewAssignmentNotification = async ({
|
|
|
796
693
|
var _a;
|
|
797
694
|
const { assignment, sendTo } = data;
|
|
798
695
|
const teacherName = profile.displayName || "Your teacher";
|
|
799
|
-
const dueDate = assignment.dueDateTimestamp ? (
|
|
696
|
+
const dueDate = assignment.dueDateTimestamp ? dayjs2(assignment.dueDateTimestamp.toDate()).format("MMM Do") : null;
|
|
800
697
|
const results = await sendNotification(sendTo, {
|
|
801
698
|
courseId: assignment.courseId,
|
|
802
699
|
type: SPEAKABLE_NOTIFICATIONS.NEW_ASSIGNMENT,
|
|
@@ -1198,7 +1095,7 @@ async function _updateCardScore(params) {
|
|
|
1198
1095
|
var updateCardScore = withErrorHandler(_updateCardScore, "updateCardScore");
|
|
1199
1096
|
|
|
1200
1097
|
// src/domains/assignment/services/clear-score.service.ts
|
|
1201
|
-
|
|
1098
|
+
import dayjs3 from "dayjs";
|
|
1202
1099
|
async function clearScore(params) {
|
|
1203
1100
|
var _a, _b, _c, _d, _e;
|
|
1204
1101
|
const update = {
|
|
@@ -1211,7 +1108,7 @@ async function clearScore(params) {
|
|
|
1211
1108
|
...params.cardScores,
|
|
1212
1109
|
attempts: (_c = params.cardScores.attempts) != null ? _c : 1,
|
|
1213
1110
|
correct: (_d = params.cardScores.correct) != null ? _d : 0,
|
|
1214
|
-
retryTime: (
|
|
1111
|
+
retryTime: dayjs3().format("YYYY-MM-DD HH:mm:ss"),
|
|
1215
1112
|
history: null
|
|
1216
1113
|
},
|
|
1217
1114
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -1234,7 +1131,7 @@ async function clearScore(params) {
|
|
|
1234
1131
|
}
|
|
1235
1132
|
|
|
1236
1133
|
// src/domains/assignment/services/submit-assignment-score.service.ts
|
|
1237
|
-
|
|
1134
|
+
import dayjs4 from "dayjs";
|
|
1238
1135
|
async function _submitAssignmentScore({
|
|
1239
1136
|
cardIds,
|
|
1240
1137
|
assignment,
|
|
@@ -1303,7 +1200,7 @@ async function submitPracticeScore({
|
|
|
1303
1200
|
scores
|
|
1304
1201
|
}) {
|
|
1305
1202
|
const { serverTimestamp: serverTimestamp2 } = api.accessHelpers();
|
|
1306
|
-
const date = (
|
|
1203
|
+
const date = dayjs4().format("YYYY-MM-DD-HH-mm");
|
|
1307
1204
|
const ref = refsScoresPractice.practiceScoreHistoryRefDoc({ setId, userId, date });
|
|
1308
1205
|
const fieldsUpdated = {
|
|
1309
1206
|
...scores,
|
|
@@ -1332,7 +1229,7 @@ function useScore({
|
|
|
1332
1229
|
enabled = true,
|
|
1333
1230
|
googleClassroomUserId
|
|
1334
1231
|
}) {
|
|
1335
|
-
return (
|
|
1232
|
+
return useQuery2({
|
|
1336
1233
|
queryFn: () => getScore({
|
|
1337
1234
|
userId,
|
|
1338
1235
|
courseId,
|
|
@@ -1347,7 +1244,7 @@ function useScore({
|
|
|
1347
1244
|
var debounceUpdateScore = debounce(updateScore, 1e3);
|
|
1348
1245
|
function useUpdateScore() {
|
|
1349
1246
|
const { queryClient } = useSpeakableApi();
|
|
1350
|
-
const mutation =
|
|
1247
|
+
const mutation = useMutation({
|
|
1351
1248
|
mutationFn: debounceUpdateScore,
|
|
1352
1249
|
onMutate: (variables) => {
|
|
1353
1250
|
return handleOptimisticUpdate({
|
|
@@ -1379,7 +1276,7 @@ function useUpdateCardScore({
|
|
|
1379
1276
|
}) {
|
|
1380
1277
|
const { queryClient } = useSpeakableApi();
|
|
1381
1278
|
const queryKey = scoreQueryKeys.byId(activityId);
|
|
1382
|
-
const mutation =
|
|
1279
|
+
const mutation = useMutation({
|
|
1383
1280
|
mutationFn: async ({ cardId, cardScore }) => {
|
|
1384
1281
|
const previousScores = queryClient.getQueryData(queryKey);
|
|
1385
1282
|
const { progress, score, newScoreUpdated, updatedCardScore } = getScoreUpdated({
|
|
@@ -1487,7 +1384,7 @@ var handleOptimisticScore = ({
|
|
|
1487
1384
|
};
|
|
1488
1385
|
function useClearScore() {
|
|
1489
1386
|
const { queryClient } = useSpeakableApi();
|
|
1490
|
-
const mutation =
|
|
1387
|
+
const mutation = useMutation({
|
|
1491
1388
|
mutationFn: clearScore,
|
|
1492
1389
|
onSettled: (result) => {
|
|
1493
1390
|
var _a;
|
|
@@ -1508,7 +1405,7 @@ function useSubmitAssignmentScore({
|
|
|
1508
1405
|
const { hasGoogleClassroomGradePassback } = usePermissions_default();
|
|
1509
1406
|
const { submitAssignmentToGoogleClassroom } = useGoogleClassroom();
|
|
1510
1407
|
const { createNotification: createNotification2 } = useCreateNotification();
|
|
1511
|
-
const mutation =
|
|
1408
|
+
const mutation = useMutation({
|
|
1512
1409
|
mutationFn: async ({
|
|
1513
1410
|
assignment,
|
|
1514
1411
|
userId,
|
|
@@ -1564,7 +1461,7 @@ function useSubmitAssignmentScore({
|
|
|
1564
1461
|
}
|
|
1565
1462
|
function useSubmitPracticeScore() {
|
|
1566
1463
|
const { queryClient } = useSpeakableApi();
|
|
1567
|
-
const mutation =
|
|
1464
|
+
const mutation = useMutation({
|
|
1568
1465
|
mutationFn: async ({
|
|
1569
1466
|
setId,
|
|
1570
1467
|
userId,
|
|
@@ -1598,8 +1495,8 @@ function useSubmitPracticeScore() {
|
|
|
1598
1495
|
}
|
|
1599
1496
|
|
|
1600
1497
|
// src/domains/cards/card.hooks.ts
|
|
1601
|
-
|
|
1602
|
-
|
|
1498
|
+
import { useMutation as useMutation2, useQueries, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1499
|
+
import { useMemo } from "react";
|
|
1603
1500
|
|
|
1604
1501
|
// src/domains/cards/card.constants.ts
|
|
1605
1502
|
var FeedbackTypesCard = /* @__PURE__ */ ((FeedbackTypesCard2) => {
|
|
@@ -1709,7 +1606,7 @@ async function _getCard(params) {
|
|
|
1709
1606
|
var getCard = withErrorHandler(_getCard, "getCard");
|
|
1710
1607
|
|
|
1711
1608
|
// src/domains/cards/services/create-card.service.ts
|
|
1712
|
-
|
|
1609
|
+
import { v4 } from "uuid";
|
|
1713
1610
|
|
|
1714
1611
|
// src/domains/cards/card.model.ts
|
|
1715
1612
|
var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
|
|
@@ -1756,7 +1653,7 @@ var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
|
|
|
1756
1653
|
];
|
|
1757
1654
|
|
|
1758
1655
|
// src/utils/text-utils.ts
|
|
1759
|
-
|
|
1656
|
+
import sha1 from "js-sha1";
|
|
1760
1657
|
var purify = (word) => {
|
|
1761
1658
|
return word.normalize("NFD").replace(/\/([^" "]*)/g, "").replace(/\([^()]*\)/g, "").replace(/([^()]*)/g, "").replace(/[\u0300-\u036f]/g, "").replace(/[-]/g, " ").replace(/[.,/#!¡¿?؟。,.?$%^&*;:{}=\-_`~()’'…\s]/g, "").replace(/\s\s+/g, " ").toLowerCase().trim();
|
|
1762
1659
|
};
|
|
@@ -1774,7 +1671,7 @@ var cleanString = (words) => {
|
|
|
1774
1671
|
};
|
|
1775
1672
|
var getWordHash = (word, language) => {
|
|
1776
1673
|
const cleanedWord = cleanString(word);
|
|
1777
|
-
const wordHash = (
|
|
1674
|
+
const wordHash = sha1(`${language}-${cleanedWord}`);
|
|
1778
1675
|
console.log("wordHash core library", wordHash);
|
|
1779
1676
|
return wordHash;
|
|
1780
1677
|
};
|
|
@@ -1837,7 +1734,7 @@ async function _createCards({ cards }) {
|
|
|
1837
1734
|
const batch = writeBatch2();
|
|
1838
1735
|
const cardsWithId = [];
|
|
1839
1736
|
for (const card of cards) {
|
|
1840
|
-
const cardId =
|
|
1737
|
+
const cardId = v4();
|
|
1841
1738
|
const ref = doc2(refsCardsFiresotre.card(cardId));
|
|
1842
1739
|
const newCardObject = {
|
|
1843
1740
|
...card,
|
|
@@ -1865,7 +1762,7 @@ function useCards({
|
|
|
1865
1762
|
enabled = true,
|
|
1866
1763
|
asObject
|
|
1867
1764
|
}) {
|
|
1868
|
-
const queries =
|
|
1765
|
+
const queries = useQueries({
|
|
1869
1766
|
queries: cardIds.map((cardId) => ({
|
|
1870
1767
|
enabled: enabled && cardIds.length > 0,
|
|
1871
1768
|
queryKey: cardsQueryKeys.one({
|
|
@@ -1875,7 +1772,7 @@ function useCards({
|
|
|
1875
1772
|
}))
|
|
1876
1773
|
});
|
|
1877
1774
|
const cards = queries.map((query2) => query2.data).filter(Boolean);
|
|
1878
|
-
const cardsObject =
|
|
1775
|
+
const cardsObject = useMemo(() => {
|
|
1879
1776
|
if (!asObject) return null;
|
|
1880
1777
|
return cards.reduce((acc, card) => {
|
|
1881
1778
|
acc[card.id] = card;
|
|
@@ -1890,7 +1787,7 @@ function useCards({
|
|
|
1890
1787
|
}
|
|
1891
1788
|
function useCreateCard() {
|
|
1892
1789
|
const { queryClient } = useSpeakableApi();
|
|
1893
|
-
const mutationCreateCard = (
|
|
1790
|
+
const mutationCreateCard = useMutation2({
|
|
1894
1791
|
mutationFn: createCard,
|
|
1895
1792
|
onSuccess: (cardCreated) => {
|
|
1896
1793
|
queryClient.invalidateQueries({ queryKey: cardsQueryKeys.one({ cardId: cardCreated.id }) });
|
|
@@ -1901,7 +1798,7 @@ function useCreateCard() {
|
|
|
1901
1798
|
};
|
|
1902
1799
|
}
|
|
1903
1800
|
function useCreateCards() {
|
|
1904
|
-
const mutationCreateCards = (
|
|
1801
|
+
const mutationCreateCards = useMutation2({
|
|
1905
1802
|
mutationFn: createCards
|
|
1906
1803
|
});
|
|
1907
1804
|
return {
|
|
@@ -1922,7 +1819,7 @@ function updateCardInCache({
|
|
|
1922
1819
|
queryClient.setQueryData(cardsQueryKeys.one({ cardId }), card);
|
|
1923
1820
|
}
|
|
1924
1821
|
function useGetCard({ cardId, enabled = true }) {
|
|
1925
|
-
const query2 = (
|
|
1822
|
+
const query2 = useQuery3({
|
|
1926
1823
|
queryKey: cardsQueryKeys.one({ cardId }),
|
|
1927
1824
|
queryFn: () => getCard({ cardId }),
|
|
1928
1825
|
enabled: enabled && !!cardId
|
|
@@ -2023,7 +1920,7 @@ function getPagePrompt(card) {
|
|
|
2023
1920
|
}
|
|
2024
1921
|
|
|
2025
1922
|
// src/domains/sets/set.hooks.ts
|
|
2026
|
-
|
|
1923
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2027
1924
|
|
|
2028
1925
|
// src/domains/sets/set.constants.ts
|
|
2029
1926
|
var SETS_COLLECTION = "sets";
|
|
@@ -2045,7 +1942,7 @@ var setsQueryKeys = {
|
|
|
2045
1942
|
one: (params) => [...setsQueryKeys.all, params.setId]
|
|
2046
1943
|
};
|
|
2047
1944
|
var useSet = ({ setId, enabled }) => {
|
|
2048
|
-
return (
|
|
1945
|
+
return useQuery4({
|
|
2049
1946
|
queryKey: setsQueryKeys.one({ setId }),
|
|
2050
1947
|
queryFn: () => getSet({ setId }),
|
|
2051
1948
|
enabled: setId !== void 0 && setId !== "" && enabled
|
|
@@ -2325,7 +2222,7 @@ var getRespondCardTool = ({
|
|
|
2325
2222
|
};
|
|
2326
2223
|
|
|
2327
2224
|
// src/hooks/useActivity.ts
|
|
2328
|
-
|
|
2225
|
+
import { useEffect as useEffect2 } from "react";
|
|
2329
2226
|
|
|
2330
2227
|
// src/services/add-grading-standard.ts
|
|
2331
2228
|
var addGradingStandardLog = async (gradingStandard, userId) => {
|
|
@@ -2335,12 +2232,12 @@ var addGradingStandardLog = async (gradingStandard, userId) => {
|
|
|
2335
2232
|
};
|
|
2336
2233
|
|
|
2337
2234
|
// src/hooks/useActivityTracker.ts
|
|
2338
|
-
|
|
2235
|
+
import { v4 as v42 } from "uuid";
|
|
2339
2236
|
function useActivityTracker({ userId }) {
|
|
2340
2237
|
const trackActivity = async ({
|
|
2341
2238
|
activityName,
|
|
2342
2239
|
activityType,
|
|
2343
|
-
id = (
|
|
2240
|
+
id = v42(),
|
|
2344
2241
|
language = ""
|
|
2345
2242
|
}) => {
|
|
2346
2243
|
if (userId) {
|
|
@@ -2529,7 +2426,7 @@ function useActivity({
|
|
|
2529
2426
|
userId
|
|
2530
2427
|
);
|
|
2531
2428
|
};
|
|
2532
|
-
(
|
|
2429
|
+
useEffect2(() => {
|
|
2533
2430
|
if (isAssignment) {
|
|
2534
2431
|
logOpenAssignment({ assignmentId: id });
|
|
2535
2432
|
} else {
|
|
@@ -2605,7 +2502,7 @@ var useInitActivity = ({
|
|
|
2605
2502
|
objectID: set == null ? void 0 : set.id
|
|
2606
2503
|
});
|
|
2607
2504
|
};
|
|
2608
|
-
(
|
|
2505
|
+
useEffect2(() => {
|
|
2609
2506
|
init();
|
|
2610
2507
|
}, [set]);
|
|
2611
2508
|
};
|
|
@@ -2642,7 +2539,7 @@ var submitLTIScore = async ({
|
|
|
2642
2539
|
};
|
|
2643
2540
|
|
|
2644
2541
|
// src/hooks/useCredits.ts
|
|
2645
|
-
|
|
2542
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
2646
2543
|
var creditQueryKeys = {
|
|
2647
2544
|
userCredits: (uid) => ["userCredits", uid]
|
|
2648
2545
|
};
|
|
@@ -2650,7 +2547,7 @@ var useUserCredits = () => {
|
|
|
2650
2547
|
const { user } = useSpeakableApi();
|
|
2651
2548
|
const email = user.auth.email;
|
|
2652
2549
|
const uid = user.auth.uid;
|
|
2653
|
-
const query2 = (
|
|
2550
|
+
const query2 = useQuery5({
|
|
2654
2551
|
queryKey: creditQueryKeys.userCredits(uid),
|
|
2655
2552
|
queryFn: () => fetchUserCredits({ uid, email }),
|
|
2656
2553
|
enabled: !!uid,
|
|
@@ -2700,11 +2597,11 @@ var fetchUserCredits = async ({ uid, email }) => {
|
|
|
2700
2597
|
};
|
|
2701
2598
|
|
|
2702
2599
|
// src/hooks/useOrganizationAccess.ts
|
|
2703
|
-
|
|
2600
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2704
2601
|
var useOrganizationAccess = () => {
|
|
2705
2602
|
const { user } = useSpeakableApi();
|
|
2706
2603
|
const email = user.auth.email;
|
|
2707
|
-
const query2 = (
|
|
2604
|
+
const query2 = useQuery6({
|
|
2708
2605
|
queryKey: ["organizationAccess", email],
|
|
2709
2606
|
queryFn: async () => {
|
|
2710
2607
|
if (!email) {
|
|
@@ -2877,7 +2774,7 @@ var useUpdateStudentVocab = (page) => {
|
|
|
2877
2774
|
};
|
|
2878
2775
|
|
|
2879
2776
|
// src/hooks/useActivityFeedbackAccess.ts
|
|
2880
|
-
|
|
2777
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
2881
2778
|
var activityFeedbackAccessQueryKeys = {
|
|
2882
2779
|
activityFeedbackAccess: (args) => ["activityFeedbackAccess", ...Object.values(args)]
|
|
2883
2780
|
};
|
|
@@ -2891,7 +2788,7 @@ var useActivityFeedbackAccess = ({
|
|
|
2891
2788
|
const isTeacher = (_a = user.profile) == null ? void 0 : _a.isTeacher;
|
|
2892
2789
|
const isStudent = (_b = user.profile) == null ? void 0 : _b.isStudent;
|
|
2893
2790
|
const userRoles = ((_c = user.profile) == null ? void 0 : _c.roles) || [];
|
|
2894
|
-
const query2 = (
|
|
2791
|
+
const query2 = useQuery7({
|
|
2895
2792
|
queryKey: activityFeedbackAccessQueryKeys.activityFeedbackAccess({
|
|
2896
2793
|
aiEnabled,
|
|
2897
2794
|
isActivityRoute
|
|
@@ -3196,7 +3093,28 @@ var useBaseOpenAI = ({
|
|
|
3196
3093
|
};
|
|
3197
3094
|
|
|
3198
3095
|
// src/lib/create-firebase-client-web.ts
|
|
3199
|
-
|
|
3096
|
+
import {
|
|
3097
|
+
getDoc,
|
|
3098
|
+
getDocs,
|
|
3099
|
+
addDoc,
|
|
3100
|
+
setDoc,
|
|
3101
|
+
updateDoc,
|
|
3102
|
+
deleteDoc,
|
|
3103
|
+
runTransaction,
|
|
3104
|
+
writeBatch,
|
|
3105
|
+
doc,
|
|
3106
|
+
collection,
|
|
3107
|
+
query,
|
|
3108
|
+
serverTimestamp,
|
|
3109
|
+
orderBy,
|
|
3110
|
+
limit,
|
|
3111
|
+
startAt,
|
|
3112
|
+
startAfter,
|
|
3113
|
+
endAt,
|
|
3114
|
+
endBefore,
|
|
3115
|
+
where,
|
|
3116
|
+
increment
|
|
3117
|
+
} from "firebase/firestore";
|
|
3200
3118
|
|
|
3201
3119
|
// src/lib/create-firebase-client.ts
|
|
3202
3120
|
function createFsClientBase({
|
|
@@ -3225,27 +3143,97 @@ var createFsClientWeb = ({ db, httpsCallable, logEvent }) => {
|
|
|
3225
3143
|
httpsCallable,
|
|
3226
3144
|
logEvent,
|
|
3227
3145
|
helpers: {
|
|
3228
|
-
getDoc
|
|
3229
|
-
getDocs
|
|
3230
|
-
addDoc
|
|
3231
|
-
setDoc
|
|
3232
|
-
updateDoc
|
|
3233
|
-
deleteDoc
|
|
3234
|
-
runTransaction
|
|
3235
|
-
writeBatch
|
|
3236
|
-
doc
|
|
3237
|
-
collection
|
|
3238
|
-
query
|
|
3239
|
-
serverTimestamp
|
|
3240
|
-
orderBy
|
|
3241
|
-
limit
|
|
3242
|
-
startAt
|
|
3243
|
-
startAfter
|
|
3244
|
-
endAt
|
|
3245
|
-
endBefore
|
|
3246
|
-
where
|
|
3247
|
-
increment
|
|
3146
|
+
getDoc,
|
|
3147
|
+
getDocs,
|
|
3148
|
+
addDoc,
|
|
3149
|
+
setDoc,
|
|
3150
|
+
updateDoc,
|
|
3151
|
+
deleteDoc,
|
|
3152
|
+
runTransaction,
|
|
3153
|
+
writeBatch,
|
|
3154
|
+
doc,
|
|
3155
|
+
collection,
|
|
3156
|
+
query,
|
|
3157
|
+
serverTimestamp,
|
|
3158
|
+
orderBy,
|
|
3159
|
+
limit,
|
|
3160
|
+
startAt,
|
|
3161
|
+
startAfter,
|
|
3162
|
+
endAt,
|
|
3163
|
+
endBefore,
|
|
3164
|
+
where,
|
|
3165
|
+
increment
|
|
3248
3166
|
}
|
|
3249
3167
|
});
|
|
3250
3168
|
};
|
|
3169
|
+
export {
|
|
3170
|
+
ActivityPageType,
|
|
3171
|
+
BASE_MULTIPLE_CHOICE_FIELD_VALUES,
|
|
3172
|
+
BASE_REPEAT_FIELD_VALUES,
|
|
3173
|
+
BASE_RESPOND_FIELD_VALUES,
|
|
3174
|
+
FeedbackTypesCard,
|
|
3175
|
+
FsCtx,
|
|
3176
|
+
LENIENCY_OPTIONS,
|
|
3177
|
+
LeniencyCard,
|
|
3178
|
+
MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES,
|
|
3179
|
+
REPEAT_PAGE_ACTIVITY_TYPES,
|
|
3180
|
+
RESPOND_AUDIO_PAGE_ACTIVITY_TYPES,
|
|
3181
|
+
RESPOND_PAGE_ACTIVITY_TYPES,
|
|
3182
|
+
RESPOND_WRITE_PAGE_ACTIVITY_TYPES,
|
|
3183
|
+
SPEAKABLE_NOTIFICATIONS,
|
|
3184
|
+
STUDENT_LEVELS_OPTIONS,
|
|
3185
|
+
SpeakableNotificationTypes,
|
|
3186
|
+
SpeakableProvider,
|
|
3187
|
+
VerificationCardStatus,
|
|
3188
|
+
assignmentQueryKeys,
|
|
3189
|
+
cardsQueryKeys,
|
|
3190
|
+
checkIsMCPage,
|
|
3191
|
+
checkIsMediaPage,
|
|
3192
|
+
checkIsRepeatPage,
|
|
3193
|
+
checkIsRespondAudioPage,
|
|
3194
|
+
checkIsRespondPage,
|
|
3195
|
+
checkIsRespondWrittenPage,
|
|
3196
|
+
checkIsShortAnswerPage,
|
|
3197
|
+
checkTypePageActivity,
|
|
3198
|
+
cleanString,
|
|
3199
|
+
createAssignmentRepo,
|
|
3200
|
+
createCardRepo,
|
|
3201
|
+
createFsClientWeb as createFsClient,
|
|
3202
|
+
createSetRepo,
|
|
3203
|
+
creditQueryKeys,
|
|
3204
|
+
debounce,
|
|
3205
|
+
getCardFromCache,
|
|
3206
|
+
getPagePrompt,
|
|
3207
|
+
getPhraseLength,
|
|
3208
|
+
getRespondCardTool,
|
|
3209
|
+
getSetFromCache,
|
|
3210
|
+
getWordHash,
|
|
3211
|
+
purify,
|
|
3212
|
+
refsCardsFiresotre,
|
|
3213
|
+
refsSetsFirestore,
|
|
3214
|
+
scoreQueryKeys,
|
|
3215
|
+
setsQueryKeys,
|
|
3216
|
+
updateCardInCache,
|
|
3217
|
+
updateSetInCache,
|
|
3218
|
+
useActivity,
|
|
3219
|
+
useActivityFeedbackAccess,
|
|
3220
|
+
useAssignment,
|
|
3221
|
+
useBaseOpenAI,
|
|
3222
|
+
useCards,
|
|
3223
|
+
useClearScore,
|
|
3224
|
+
useCreateCard,
|
|
3225
|
+
useCreateCards,
|
|
3226
|
+
useCreateNotification,
|
|
3227
|
+
useGetCard,
|
|
3228
|
+
useOrganizationAccess,
|
|
3229
|
+
useScore,
|
|
3230
|
+
useSet,
|
|
3231
|
+
useSpeakableApi,
|
|
3232
|
+
useSubmitAssignmentScore,
|
|
3233
|
+
useSubmitPracticeScore,
|
|
3234
|
+
useUpdateCardScore,
|
|
3235
|
+
useUpdateScore,
|
|
3236
|
+
useUpdateStudentVocab,
|
|
3237
|
+
useUserCredits
|
|
3238
|
+
};
|
|
3251
3239
|
//# sourceMappingURL=index.web.js.map
|