@speakableio/core 0.1.66 → 0.1.68
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.d.mts +42 -0
- package/dist/analytics.d.ts +42 -0
- package/dist/analytics.js +250 -0
- package/dist/analytics.js.map +1 -0
- package/dist/analytics.mjs +227 -0
- package/dist/analytics.mjs.map +1 -0
- package/dist/index.native.d.mts +2 -6
- package/dist/index.native.d.ts +2734 -0
- package/dist/index.native.native.cjs +3246 -0
- package/dist/index.native.native.cjs.map +1 -0
- package/dist/{index.native.mjs → index.native.native.mjs} +3 -3
- package/dist/{index.native.mjs.map → index.native.native.mjs.map} +1 -1
- package/dist/index.web.d.mts +2 -6
- package/dist/index.web.d.ts +2734 -0
- package/dist/index.web.js +175 -163
- package/dist/index.web.js.map +1 -1
- package/dist/index.web.mjs +3234 -0
- package/dist/index.web.mjs.map +1 -0
- package/package.json +15 -1
package/dist/index.web.js
CHANGED
|
@@ -1,7 +1,110 @@
|
|
|
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
|
+
|
|
1
104
|
// src/providers/SpeakableProvider.tsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var FsCtx = createContext(null);
|
|
105
|
+
var import_react = require("react");
|
|
106
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
107
|
+
var FsCtx = (0, import_react.createContext)(null);
|
|
5
108
|
function SpeakableProvider({
|
|
6
109
|
user,
|
|
7
110
|
children,
|
|
@@ -9,12 +112,12 @@ function SpeakableProvider({
|
|
|
9
112
|
permissions,
|
|
10
113
|
fsClient
|
|
11
114
|
}) {
|
|
12
|
-
const [speakableApi, setSpeakableApi] = useState(null);
|
|
13
|
-
useEffect(() => {
|
|
115
|
+
const [speakableApi, setSpeakableApi] = (0, import_react.useState)(null);
|
|
116
|
+
(0, import_react.useEffect)(() => {
|
|
14
117
|
setSpeakableApi(fsClient);
|
|
15
118
|
}, [fsClient]);
|
|
16
119
|
if (!speakableApi) return null;
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
18
121
|
FsCtx.Provider,
|
|
19
122
|
{
|
|
20
123
|
value: {
|
|
@@ -28,7 +131,7 @@ function SpeakableProvider({
|
|
|
28
131
|
);
|
|
29
132
|
}
|
|
30
133
|
function useSpeakableApi() {
|
|
31
|
-
const ctx = useContext(FsCtx);
|
|
134
|
+
const ctx = (0, import_react.useContext)(FsCtx);
|
|
32
135
|
if (!ctx) throw new Error("useSpeakableApi must be used within a SpeakableProvider");
|
|
33
136
|
return ctx;
|
|
34
137
|
}
|
|
@@ -295,12 +398,12 @@ async function _getAllAssignments() {
|
|
|
295
398
|
var getAllAssignments = withErrorHandler(_getAllAssignments, "getAllAssignments");
|
|
296
399
|
|
|
297
400
|
// src/domains/assignment/utils/check-assignment-availability.ts
|
|
298
|
-
|
|
401
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
299
402
|
var checkAssignmentAvailability = (scheduledTime) => {
|
|
300
403
|
if (!scheduledTime) return true;
|
|
301
|
-
const scheduledDate = typeof scheduledTime === "string" ?
|
|
404
|
+
const scheduledDate = typeof scheduledTime === "string" ? (0, import_dayjs.default)(scheduledTime) : (0, import_dayjs.default)(scheduledTime.toDate());
|
|
302
405
|
if (!scheduledDate.isValid()) return true;
|
|
303
|
-
return
|
|
406
|
+
return (0, import_dayjs.default)().isAfter(scheduledDate);
|
|
304
407
|
};
|
|
305
408
|
|
|
306
409
|
// src/domains/assignment/services/get-assignment.service.ts
|
|
@@ -340,7 +443,7 @@ var createAssignmentRepo = () => {
|
|
|
340
443
|
};
|
|
341
444
|
|
|
342
445
|
// src/domains/assignment/hooks/assignment.hooks.ts
|
|
343
|
-
|
|
446
|
+
var import_react_query = require("@tanstack/react-query");
|
|
344
447
|
var assignmentQueryKeys = {
|
|
345
448
|
all: ["assignments"],
|
|
346
449
|
byId: (id) => [...assignmentQueryKeys.all, id],
|
|
@@ -353,7 +456,7 @@ function useAssignment({
|
|
|
353
456
|
userId
|
|
354
457
|
}) {
|
|
355
458
|
const { speakableApi } = useSpeakableApi();
|
|
356
|
-
return useQuery({
|
|
459
|
+
return (0, import_react_query.useQuery)({
|
|
357
460
|
queryKey: assignmentQueryKeys.byId(assignmentId),
|
|
358
461
|
queryFn: () => speakableApi.assignmentRepo.getAssignment({
|
|
359
462
|
assignmentId,
|
|
@@ -365,7 +468,7 @@ function useAssignment({
|
|
|
365
468
|
}
|
|
366
469
|
|
|
367
470
|
// src/domains/assignment/hooks/score-hooks.ts
|
|
368
|
-
|
|
471
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
369
472
|
|
|
370
473
|
// src/utils/debounce.utils.ts
|
|
371
474
|
function debounce(func, waitFor) {
|
|
@@ -612,7 +715,7 @@ var SpeakableNotificationTypes = {
|
|
|
612
715
|
};
|
|
613
716
|
|
|
614
717
|
// src/domains/notification/services/create-notification.service.ts
|
|
615
|
-
|
|
718
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
616
719
|
|
|
617
720
|
// src/constants/web.constants.ts
|
|
618
721
|
var WEB_BASE_URL = "https://app.speakable.io";
|
|
@@ -693,7 +796,7 @@ var createNewAssignmentNotification = async ({
|
|
|
693
796
|
var _a;
|
|
694
797
|
const { assignment, sendTo } = data;
|
|
695
798
|
const teacherName = profile.displayName || "Your teacher";
|
|
696
|
-
const dueDate = assignment.dueDateTimestamp ?
|
|
799
|
+
const dueDate = assignment.dueDateTimestamp ? (0, import_dayjs2.default)(assignment.dueDateTimestamp.toDate()).format("MMM Do") : null;
|
|
697
800
|
const results = await sendNotification(sendTo, {
|
|
698
801
|
courseId: assignment.courseId,
|
|
699
802
|
type: SPEAKABLE_NOTIFICATIONS.NEW_ASSIGNMENT,
|
|
@@ -1090,7 +1193,7 @@ async function _updateCardScore(params) {
|
|
|
1090
1193
|
var updateCardScore = withErrorHandler(_updateCardScore, "updateCardScore");
|
|
1091
1194
|
|
|
1092
1195
|
// src/domains/assignment/services/clear-score.service.ts
|
|
1093
|
-
|
|
1196
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
1094
1197
|
async function clearScore(params) {
|
|
1095
1198
|
var _a, _b, _c, _d, _e;
|
|
1096
1199
|
const update = {
|
|
@@ -1103,7 +1206,7 @@ async function clearScore(params) {
|
|
|
1103
1206
|
...params.cardScores,
|
|
1104
1207
|
attempts: (_c = params.cardScores.attempts) != null ? _c : 1,
|
|
1105
1208
|
correct: (_d = params.cardScores.correct) != null ? _d : 0,
|
|
1106
|
-
retryTime:
|
|
1209
|
+
retryTime: (0, import_dayjs3.default)().format("YYYY-MM-DD HH:mm:ss"),
|
|
1107
1210
|
history: null
|
|
1108
1211
|
},
|
|
1109
1212
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -1126,7 +1229,7 @@ async function clearScore(params) {
|
|
|
1126
1229
|
}
|
|
1127
1230
|
|
|
1128
1231
|
// src/domains/assignment/services/submit-assignment-score.service.ts
|
|
1129
|
-
|
|
1232
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
1130
1233
|
async function _submitAssignmentScore({
|
|
1131
1234
|
cardIds,
|
|
1132
1235
|
assignment,
|
|
@@ -1195,7 +1298,7 @@ async function submitPracticeScore({
|
|
|
1195
1298
|
scores
|
|
1196
1299
|
}) {
|
|
1197
1300
|
const { serverTimestamp: serverTimestamp2 } = api.accessHelpers();
|
|
1198
|
-
const date =
|
|
1301
|
+
const date = (0, import_dayjs4.default)().format("YYYY-MM-DD-HH-mm");
|
|
1199
1302
|
const ref = refsScoresPractice.practiceScoreHistoryRefDoc({ setId, userId, date });
|
|
1200
1303
|
const fieldsUpdated = {
|
|
1201
1304
|
...scores,
|
|
@@ -1224,7 +1327,7 @@ function useScore({
|
|
|
1224
1327
|
enabled = true,
|
|
1225
1328
|
googleClassroomUserId
|
|
1226
1329
|
}) {
|
|
1227
|
-
return
|
|
1330
|
+
return (0, import_react_query2.useQuery)({
|
|
1228
1331
|
queryFn: () => getScore({
|
|
1229
1332
|
userId,
|
|
1230
1333
|
courseId,
|
|
@@ -1239,7 +1342,7 @@ function useScore({
|
|
|
1239
1342
|
var debounceUpdateScore = debounce(updateScore, 1e3);
|
|
1240
1343
|
function useUpdateScore() {
|
|
1241
1344
|
const { queryClient } = useSpeakableApi();
|
|
1242
|
-
const mutation = useMutation({
|
|
1345
|
+
const mutation = (0, import_react_query2.useMutation)({
|
|
1243
1346
|
mutationFn: debounceUpdateScore,
|
|
1244
1347
|
onMutate: (variables) => {
|
|
1245
1348
|
return handleOptimisticUpdate({
|
|
@@ -1271,7 +1374,7 @@ function useUpdateCardScore({
|
|
|
1271
1374
|
}) {
|
|
1272
1375
|
const { queryClient } = useSpeakableApi();
|
|
1273
1376
|
const queryKey = scoreQueryKeys.byId(activityId);
|
|
1274
|
-
const mutation = useMutation({
|
|
1377
|
+
const mutation = (0, import_react_query2.useMutation)({
|
|
1275
1378
|
mutationFn: async ({ cardId, cardScore }) => {
|
|
1276
1379
|
const previousScores = queryClient.getQueryData(queryKey);
|
|
1277
1380
|
const { progress, score, newScoreUpdated, updatedCardScore } = getScoreUpdated({
|
|
@@ -1379,7 +1482,7 @@ var handleOptimisticScore = ({
|
|
|
1379
1482
|
};
|
|
1380
1483
|
function useClearScore() {
|
|
1381
1484
|
const { queryClient } = useSpeakableApi();
|
|
1382
|
-
const mutation = useMutation({
|
|
1485
|
+
const mutation = (0, import_react_query2.useMutation)({
|
|
1383
1486
|
mutationFn: clearScore,
|
|
1384
1487
|
onSettled: (result) => {
|
|
1385
1488
|
var _a;
|
|
@@ -1400,7 +1503,7 @@ function useSubmitAssignmentScore({
|
|
|
1400
1503
|
const { hasGoogleClassroomGradePassback } = usePermissions_default();
|
|
1401
1504
|
const { submitAssignmentToGoogleClassroom } = useGoogleClassroom();
|
|
1402
1505
|
const { createNotification: createNotification2 } = useCreateNotification();
|
|
1403
|
-
const mutation = useMutation({
|
|
1506
|
+
const mutation = (0, import_react_query2.useMutation)({
|
|
1404
1507
|
mutationFn: async ({
|
|
1405
1508
|
assignment,
|
|
1406
1509
|
userId,
|
|
@@ -1456,7 +1559,7 @@ function useSubmitAssignmentScore({
|
|
|
1456
1559
|
}
|
|
1457
1560
|
function useSubmitPracticeScore() {
|
|
1458
1561
|
const { queryClient } = useSpeakableApi();
|
|
1459
|
-
const mutation = useMutation({
|
|
1562
|
+
const mutation = (0, import_react_query2.useMutation)({
|
|
1460
1563
|
mutationFn: async ({
|
|
1461
1564
|
setId,
|
|
1462
1565
|
userId,
|
|
@@ -1490,8 +1593,8 @@ function useSubmitPracticeScore() {
|
|
|
1490
1593
|
}
|
|
1491
1594
|
|
|
1492
1595
|
// src/domains/cards/card.hooks.ts
|
|
1493
|
-
|
|
1494
|
-
|
|
1596
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1597
|
+
var import_react2 = require("react");
|
|
1495
1598
|
|
|
1496
1599
|
// src/domains/cards/card.constants.ts
|
|
1497
1600
|
var FeedbackTypesCard = /* @__PURE__ */ ((FeedbackTypesCard2) => {
|
|
@@ -1601,7 +1704,7 @@ async function _getCard(params) {
|
|
|
1601
1704
|
var getCard = withErrorHandler(_getCard, "getCard");
|
|
1602
1705
|
|
|
1603
1706
|
// src/domains/cards/services/create-card.service.ts
|
|
1604
|
-
|
|
1707
|
+
var import_uuid = require("uuid");
|
|
1605
1708
|
|
|
1606
1709
|
// src/domains/cards/card.model.ts
|
|
1607
1710
|
var ActivityPageType = /* @__PURE__ */ ((ActivityPageType2) => {
|
|
@@ -1648,7 +1751,7 @@ var RESPOND_AUDIO_PAGE_ACTIVITY_TYPES = [
|
|
|
1648
1751
|
];
|
|
1649
1752
|
|
|
1650
1753
|
// src/utils/text-utils.ts
|
|
1651
|
-
|
|
1754
|
+
var import_js_sha1 = __toESM(require("js-sha1"));
|
|
1652
1755
|
var purify = (word) => {
|
|
1653
1756
|
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();
|
|
1654
1757
|
};
|
|
@@ -1666,7 +1769,7 @@ var cleanString = (words) => {
|
|
|
1666
1769
|
};
|
|
1667
1770
|
var getWordHash = (word, language) => {
|
|
1668
1771
|
const cleanedWord = cleanString(word);
|
|
1669
|
-
const wordHash =
|
|
1772
|
+
const wordHash = (0, import_js_sha1.default)(`${language}-${cleanedWord}`);
|
|
1670
1773
|
console.log("wordHash core library", wordHash);
|
|
1671
1774
|
return wordHash;
|
|
1672
1775
|
};
|
|
@@ -1729,7 +1832,7 @@ async function _createCards({ cards }) {
|
|
|
1729
1832
|
const batch = writeBatch2();
|
|
1730
1833
|
const cardsWithId = [];
|
|
1731
1834
|
for (const card of cards) {
|
|
1732
|
-
const cardId = v4();
|
|
1835
|
+
const cardId = (0, import_uuid.v4)();
|
|
1733
1836
|
const ref = doc2(refsCardsFiresotre.card(cardId));
|
|
1734
1837
|
const newCardObject = {
|
|
1735
1838
|
...card,
|
|
@@ -1757,7 +1860,7 @@ function useCards({
|
|
|
1757
1860
|
enabled = true,
|
|
1758
1861
|
asObject
|
|
1759
1862
|
}) {
|
|
1760
|
-
const queries = useQueries({
|
|
1863
|
+
const queries = (0, import_react_query3.useQueries)({
|
|
1761
1864
|
queries: cardIds.map((cardId) => ({
|
|
1762
1865
|
enabled: enabled && cardIds.length > 0,
|
|
1763
1866
|
queryKey: cardsQueryKeys.one({
|
|
@@ -1767,7 +1870,7 @@ function useCards({
|
|
|
1767
1870
|
}))
|
|
1768
1871
|
});
|
|
1769
1872
|
const cards = queries.map((query2) => query2.data).filter(Boolean);
|
|
1770
|
-
const cardsObject = useMemo(() => {
|
|
1873
|
+
const cardsObject = (0, import_react2.useMemo)(() => {
|
|
1771
1874
|
if (!asObject) return null;
|
|
1772
1875
|
return cards.reduce((acc, card) => {
|
|
1773
1876
|
acc[card.id] = card;
|
|
@@ -1782,7 +1885,7 @@ function useCards({
|
|
|
1782
1885
|
}
|
|
1783
1886
|
function useCreateCard() {
|
|
1784
1887
|
const { queryClient } = useSpeakableApi();
|
|
1785
|
-
const mutationCreateCard =
|
|
1888
|
+
const mutationCreateCard = (0, import_react_query3.useMutation)({
|
|
1786
1889
|
mutationFn: createCard,
|
|
1787
1890
|
onSuccess: (cardCreated) => {
|
|
1788
1891
|
queryClient.invalidateQueries({ queryKey: cardsQueryKeys.one({ cardId: cardCreated.id }) });
|
|
@@ -1793,7 +1896,7 @@ function useCreateCard() {
|
|
|
1793
1896
|
};
|
|
1794
1897
|
}
|
|
1795
1898
|
function useCreateCards() {
|
|
1796
|
-
const mutationCreateCards =
|
|
1899
|
+
const mutationCreateCards = (0, import_react_query3.useMutation)({
|
|
1797
1900
|
mutationFn: createCards
|
|
1798
1901
|
});
|
|
1799
1902
|
return {
|
|
@@ -1814,7 +1917,7 @@ function updateCardInCache({
|
|
|
1814
1917
|
queryClient.setQueryData(cardsQueryKeys.one({ cardId }), card);
|
|
1815
1918
|
}
|
|
1816
1919
|
function useGetCard({ cardId, enabled = true }) {
|
|
1817
|
-
const query2 =
|
|
1920
|
+
const query2 = (0, import_react_query3.useQuery)({
|
|
1818
1921
|
queryKey: cardsQueryKeys.one({ cardId }),
|
|
1819
1922
|
queryFn: () => getCard({ cardId }),
|
|
1820
1923
|
enabled: enabled && !!cardId
|
|
@@ -1915,7 +2018,7 @@ function getPagePrompt(card) {
|
|
|
1915
2018
|
}
|
|
1916
2019
|
|
|
1917
2020
|
// src/domains/sets/set.hooks.ts
|
|
1918
|
-
|
|
2021
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1919
2022
|
|
|
1920
2023
|
// src/domains/sets/set.constants.ts
|
|
1921
2024
|
var SETS_COLLECTION = "sets";
|
|
@@ -1937,7 +2040,7 @@ var setsQueryKeys = {
|
|
|
1937
2040
|
one: (params) => [...setsQueryKeys.all, params.setId]
|
|
1938
2041
|
};
|
|
1939
2042
|
var useSet = ({ setId, enabled }) => {
|
|
1940
|
-
return
|
|
2043
|
+
return (0, import_react_query4.useQuery)({
|
|
1941
2044
|
queryKey: setsQueryKeys.one({ setId }),
|
|
1942
2045
|
queryFn: () => getSet({ setId }),
|
|
1943
2046
|
enabled: setId !== void 0 && setId !== "" && enabled
|
|
@@ -2217,7 +2320,7 @@ var getRespondCardTool = ({
|
|
|
2217
2320
|
};
|
|
2218
2321
|
|
|
2219
2322
|
// src/hooks/useActivity.ts
|
|
2220
|
-
|
|
2323
|
+
var import_react3 = require("react");
|
|
2221
2324
|
|
|
2222
2325
|
// src/services/add-grading-standard.ts
|
|
2223
2326
|
var addGradingStandardLog = async (gradingStandard, userId) => {
|
|
@@ -2227,12 +2330,12 @@ var addGradingStandardLog = async (gradingStandard, userId) => {
|
|
|
2227
2330
|
};
|
|
2228
2331
|
|
|
2229
2332
|
// src/hooks/useActivityTracker.ts
|
|
2230
|
-
|
|
2333
|
+
var import_uuid2 = require("uuid");
|
|
2231
2334
|
function useActivityTracker({ userId }) {
|
|
2232
2335
|
const trackActivity = async ({
|
|
2233
2336
|
activityName,
|
|
2234
2337
|
activityType,
|
|
2235
|
-
id =
|
|
2338
|
+
id = (0, import_uuid2.v4)(),
|
|
2236
2339
|
language = ""
|
|
2237
2340
|
}) => {
|
|
2238
2341
|
if (userId) {
|
|
@@ -2421,7 +2524,7 @@ function useActivity({
|
|
|
2421
2524
|
userId
|
|
2422
2525
|
);
|
|
2423
2526
|
};
|
|
2424
|
-
|
|
2527
|
+
(0, import_react3.useEffect)(() => {
|
|
2425
2528
|
if (isAssignment) {
|
|
2426
2529
|
logOpenAssignment({ assignmentId: id });
|
|
2427
2530
|
} else {
|
|
@@ -2497,7 +2600,7 @@ var useInitActivity = ({
|
|
|
2497
2600
|
objectID: set == null ? void 0 : set.id
|
|
2498
2601
|
});
|
|
2499
2602
|
};
|
|
2500
|
-
|
|
2603
|
+
(0, import_react3.useEffect)(() => {
|
|
2501
2604
|
init();
|
|
2502
2605
|
}, [set]);
|
|
2503
2606
|
};
|
|
@@ -2534,7 +2637,7 @@ var submitLTIScore = async ({
|
|
|
2534
2637
|
};
|
|
2535
2638
|
|
|
2536
2639
|
// src/hooks/useCredits.ts
|
|
2537
|
-
|
|
2640
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
2538
2641
|
var creditQueryKeys = {
|
|
2539
2642
|
userCredits: (uid) => ["userCredits", uid]
|
|
2540
2643
|
};
|
|
@@ -2542,7 +2645,7 @@ var useUserCredits = () => {
|
|
|
2542
2645
|
const { user } = useSpeakableApi();
|
|
2543
2646
|
const email = user.auth.email;
|
|
2544
2647
|
const uid = user.auth.uid;
|
|
2545
|
-
const query2 =
|
|
2648
|
+
const query2 = (0, import_react_query5.useQuery)({
|
|
2546
2649
|
queryKey: creditQueryKeys.userCredits(uid),
|
|
2547
2650
|
queryFn: () => fetchUserCredits({ uid, email }),
|
|
2548
2651
|
enabled: !!uid,
|
|
@@ -2592,11 +2695,11 @@ var fetchUserCredits = async ({ uid, email }) => {
|
|
|
2592
2695
|
};
|
|
2593
2696
|
|
|
2594
2697
|
// src/hooks/useOrganizationAccess.ts
|
|
2595
|
-
|
|
2698
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
2596
2699
|
var useOrganizationAccess = () => {
|
|
2597
2700
|
const { user } = useSpeakableApi();
|
|
2598
2701
|
const email = user.auth.email;
|
|
2599
|
-
const query2 =
|
|
2702
|
+
const query2 = (0, import_react_query6.useQuery)({
|
|
2600
2703
|
queryKey: ["organizationAccess", email],
|
|
2601
2704
|
queryFn: async () => {
|
|
2602
2705
|
if (!email) {
|
|
@@ -2689,8 +2792,8 @@ var useUpdateStudentVocab = (page) => {
|
|
|
2689
2792
|
const currentUserId = user == null ? void 0 : user.auth.uid;
|
|
2690
2793
|
if (!page || !currentUserId || !page.target_text || !page.language) {
|
|
2691
2794
|
return {
|
|
2692
|
-
|
|
2693
|
-
|
|
2795
|
+
studentVocabMarkVoiceSuccess: void 0,
|
|
2796
|
+
studentVocabMarkVoiceFail: void 0
|
|
2694
2797
|
};
|
|
2695
2798
|
}
|
|
2696
2799
|
const getDataObject = () => {
|
|
@@ -2769,7 +2872,7 @@ var useUpdateStudentVocab = (page) => {
|
|
|
2769
2872
|
};
|
|
2770
2873
|
|
|
2771
2874
|
// src/hooks/useActivityFeedbackAccess.ts
|
|
2772
|
-
|
|
2875
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
2773
2876
|
var activityFeedbackAccessQueryKeys = {
|
|
2774
2877
|
activityFeedbackAccess: (args) => ["activityFeedbackAccess", ...Object.values(args)]
|
|
2775
2878
|
};
|
|
@@ -2783,7 +2886,7 @@ var useActivityFeedbackAccess = ({
|
|
|
2783
2886
|
const isTeacher = (_a = user.profile) == null ? void 0 : _a.isTeacher;
|
|
2784
2887
|
const isStudent = (_b = user.profile) == null ? void 0 : _b.isStudent;
|
|
2785
2888
|
const userRoles = ((_c = user.profile) == null ? void 0 : _c.roles) || [];
|
|
2786
|
-
const query2 =
|
|
2889
|
+
const query2 = (0, import_react_query7.useQuery)({
|
|
2787
2890
|
queryKey: activityFeedbackAccessQueryKeys.activityFeedbackAccess({
|
|
2788
2891
|
aiEnabled,
|
|
2789
2892
|
isActivityRoute
|
|
@@ -3088,28 +3191,7 @@ var useBaseOpenAI = ({
|
|
|
3088
3191
|
};
|
|
3089
3192
|
|
|
3090
3193
|
// src/lib/create-firebase-client-web.ts
|
|
3091
|
-
|
|
3092
|
-
getDoc,
|
|
3093
|
-
getDocs,
|
|
3094
|
-
addDoc,
|
|
3095
|
-
setDoc,
|
|
3096
|
-
updateDoc,
|
|
3097
|
-
deleteDoc,
|
|
3098
|
-
runTransaction,
|
|
3099
|
-
writeBatch,
|
|
3100
|
-
doc,
|
|
3101
|
-
collection,
|
|
3102
|
-
query,
|
|
3103
|
-
serverTimestamp,
|
|
3104
|
-
orderBy,
|
|
3105
|
-
limit,
|
|
3106
|
-
startAt,
|
|
3107
|
-
startAfter,
|
|
3108
|
-
endAt,
|
|
3109
|
-
endBefore,
|
|
3110
|
-
where,
|
|
3111
|
-
increment
|
|
3112
|
-
} from "firebase/firestore";
|
|
3194
|
+
var import_firestore = require("firebase/firestore");
|
|
3113
3195
|
|
|
3114
3196
|
// src/lib/create-firebase-client.ts
|
|
3115
3197
|
function createFsClientBase({
|
|
@@ -3138,97 +3220,27 @@ var createFsClientWeb = ({ db, httpsCallable, logEvent }) => {
|
|
|
3138
3220
|
httpsCallable,
|
|
3139
3221
|
logEvent,
|
|
3140
3222
|
helpers: {
|
|
3141
|
-
getDoc,
|
|
3142
|
-
getDocs,
|
|
3143
|
-
addDoc,
|
|
3144
|
-
setDoc,
|
|
3145
|
-
updateDoc,
|
|
3146
|
-
deleteDoc,
|
|
3147
|
-
runTransaction,
|
|
3148
|
-
writeBatch,
|
|
3149
|
-
doc,
|
|
3150
|
-
collection,
|
|
3151
|
-
query,
|
|
3152
|
-
serverTimestamp,
|
|
3153
|
-
orderBy,
|
|
3154
|
-
limit,
|
|
3155
|
-
startAt,
|
|
3156
|
-
startAfter,
|
|
3157
|
-
endAt,
|
|
3158
|
-
endBefore,
|
|
3159
|
-
where,
|
|
3160
|
-
increment
|
|
3223
|
+
getDoc: import_firestore.getDoc,
|
|
3224
|
+
getDocs: import_firestore.getDocs,
|
|
3225
|
+
addDoc: import_firestore.addDoc,
|
|
3226
|
+
setDoc: import_firestore.setDoc,
|
|
3227
|
+
updateDoc: import_firestore.updateDoc,
|
|
3228
|
+
deleteDoc: import_firestore.deleteDoc,
|
|
3229
|
+
runTransaction: import_firestore.runTransaction,
|
|
3230
|
+
writeBatch: import_firestore.writeBatch,
|
|
3231
|
+
doc: import_firestore.doc,
|
|
3232
|
+
collection: import_firestore.collection,
|
|
3233
|
+
query: import_firestore.query,
|
|
3234
|
+
serverTimestamp: import_firestore.serverTimestamp,
|
|
3235
|
+
orderBy: import_firestore.orderBy,
|
|
3236
|
+
limit: import_firestore.limit,
|
|
3237
|
+
startAt: import_firestore.startAt,
|
|
3238
|
+
startAfter: import_firestore.startAfter,
|
|
3239
|
+
endAt: import_firestore.endAt,
|
|
3240
|
+
endBefore: import_firestore.endBefore,
|
|
3241
|
+
where: import_firestore.where,
|
|
3242
|
+
increment: import_firestore.increment
|
|
3161
3243
|
}
|
|
3162
3244
|
});
|
|
3163
3245
|
};
|
|
3164
|
-
export {
|
|
3165
|
-
ActivityPageType,
|
|
3166
|
-
BASE_MULTIPLE_CHOICE_FIELD_VALUES,
|
|
3167
|
-
BASE_REPEAT_FIELD_VALUES,
|
|
3168
|
-
BASE_RESPOND_FIELD_VALUES,
|
|
3169
|
-
FeedbackTypesCard,
|
|
3170
|
-
FsCtx,
|
|
3171
|
-
LENIENCY_OPTIONS,
|
|
3172
|
-
LeniencyCard,
|
|
3173
|
-
MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES,
|
|
3174
|
-
REPEAT_PAGE_ACTIVITY_TYPES,
|
|
3175
|
-
RESPOND_AUDIO_PAGE_ACTIVITY_TYPES,
|
|
3176
|
-
RESPOND_PAGE_ACTIVITY_TYPES,
|
|
3177
|
-
RESPOND_WRITE_PAGE_ACTIVITY_TYPES,
|
|
3178
|
-
SPEAKABLE_NOTIFICATIONS,
|
|
3179
|
-
STUDENT_LEVELS_OPTIONS,
|
|
3180
|
-
SpeakableNotificationTypes,
|
|
3181
|
-
SpeakableProvider,
|
|
3182
|
-
VerificationCardStatus,
|
|
3183
|
-
assignmentQueryKeys,
|
|
3184
|
-
cardsQueryKeys,
|
|
3185
|
-
checkIsMCPage,
|
|
3186
|
-
checkIsMediaPage,
|
|
3187
|
-
checkIsRepeatPage,
|
|
3188
|
-
checkIsRespondAudioPage,
|
|
3189
|
-
checkIsRespondPage,
|
|
3190
|
-
checkIsRespondWrittenPage,
|
|
3191
|
-
checkIsShortAnswerPage,
|
|
3192
|
-
checkTypePageActivity,
|
|
3193
|
-
cleanString,
|
|
3194
|
-
createAssignmentRepo,
|
|
3195
|
-
createCardRepo,
|
|
3196
|
-
createFsClientWeb as createFsClient,
|
|
3197
|
-
createSetRepo,
|
|
3198
|
-
creditQueryKeys,
|
|
3199
|
-
debounce,
|
|
3200
|
-
getCardFromCache,
|
|
3201
|
-
getPagePrompt,
|
|
3202
|
-
getPhraseLength,
|
|
3203
|
-
getRespondCardTool,
|
|
3204
|
-
getSetFromCache,
|
|
3205
|
-
getWordHash,
|
|
3206
|
-
purify,
|
|
3207
|
-
refsCardsFiresotre,
|
|
3208
|
-
refsSetsFirestore,
|
|
3209
|
-
scoreQueryKeys,
|
|
3210
|
-
setsQueryKeys,
|
|
3211
|
-
updateCardInCache,
|
|
3212
|
-
updateSetInCache,
|
|
3213
|
-
useActivity,
|
|
3214
|
-
useActivityFeedbackAccess,
|
|
3215
|
-
useAssignment,
|
|
3216
|
-
useBaseOpenAI,
|
|
3217
|
-
useCards,
|
|
3218
|
-
useClearScore,
|
|
3219
|
-
useCreateCard,
|
|
3220
|
-
useCreateCards,
|
|
3221
|
-
useCreateNotification,
|
|
3222
|
-
useGetCard,
|
|
3223
|
-
useOrganizationAccess,
|
|
3224
|
-
useScore,
|
|
3225
|
-
useSet,
|
|
3226
|
-
useSpeakableApi,
|
|
3227
|
-
useSubmitAssignmentScore,
|
|
3228
|
-
useSubmitPracticeScore,
|
|
3229
|
-
useUpdateCardScore,
|
|
3230
|
-
useUpdateScore,
|
|
3231
|
-
useUpdateStudentVocab,
|
|
3232
|
-
useUserCredits
|
|
3233
|
-
};
|
|
3234
3246
|
//# sourceMappingURL=index.web.js.map
|