@speakableio/core 0.1.56 → 0.1.58
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/index.native.d.mts +4 -1
- package/dist/index.native.mjs +22 -30
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.d.mts +4 -1
- package/dist/index.web.js +22 -30
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.native.d.mts
CHANGED
|
@@ -582,6 +582,9 @@ declare function updateCardInCache({ cardId, card, queryClient, }: {
|
|
|
582
582
|
card: CardActivityWithId | null;
|
|
583
583
|
queryClient: QueryClient;
|
|
584
584
|
}): void;
|
|
585
|
+
declare function useGetCard({ cardId }: {
|
|
586
|
+
cardId: string;
|
|
587
|
+
}): _tanstack_react_query.UseQueryResult<CardActivityWithId | null, Error>;
|
|
585
588
|
|
|
586
589
|
declare const createCardRepo: () => {
|
|
587
590
|
createCard: (args_0: {
|
|
@@ -2595,4 +2598,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
2595
2598
|
};
|
|
2596
2599
|
};
|
|
2597
2600
|
|
|
2598
|
-
export { ALLOWED_CARD_ACTIVITY_TYPES_FOR_SUMMARY, type Assignment, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CardActivity, CardActivityType, type CardActivityWithId, type CardScore, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_CARD_ACTIVITY_TYPES, type Organization, type OrganizationAccess, REPEAT_CARD_ACTIVITY_TYPES, RESPOND_AUDIO_CARD_ACTIVITY_TYPES, RESPOND_CARD_ACTIVITY_TYPES, RESPOND_WRITE_CARD_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getRespondCardTool, getSetFromCache, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useCreateCard, useCreateCards, useCreateNotification, useOrganizationAccess, useSet, useSpeakableApi, useUserCredits };
|
|
2601
|
+
export { ALLOWED_CARD_ACTIVITY_TYPES_FOR_SUMMARY, type Assignment, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CardActivity, CardActivityType, type CardActivityWithId, type CardScore, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_CARD_ACTIVITY_TYPES, type Organization, type OrganizationAccess, REPEAT_CARD_ACTIVITY_TYPES, RESPOND_AUDIO_CARD_ACTIVITY_TYPES, RESPOND_CARD_ACTIVITY_TYPES, RESPOND_WRITE_CARD_ACTIVITY_TYPES, type RefsCardsFiresotre, type RefsSetsFirestore, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getRespondCardTool, getSetFromCache, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useSet, useSpeakableApi, useUserCredits };
|
package/dist/index.native.mjs
CHANGED
|
@@ -121,14 +121,6 @@ var FirebaseAPI = class _FirebaseAPI {
|
|
|
121
121
|
const { getDoc: getDoc2, doc: doc2 } = this.helpers;
|
|
122
122
|
const docRef = doc2(this.db, path);
|
|
123
123
|
const docSnap = await getDoc2(docRef);
|
|
124
|
-
console.log("debug get doc api", {
|
|
125
|
-
path,
|
|
126
|
-
db: this.db,
|
|
127
|
-
doc: doc2,
|
|
128
|
-
getDoc: getDoc2,
|
|
129
|
-
docRef,
|
|
130
|
-
docSnap
|
|
131
|
-
});
|
|
132
124
|
const data = docSnap.exists() ? {
|
|
133
125
|
...docSnap.data(),
|
|
134
126
|
id: docSnap.id
|
|
@@ -147,15 +139,6 @@ var FirebaseAPI = class _FirebaseAPI {
|
|
|
147
139
|
data: doc2.data(),
|
|
148
140
|
id: doc2.id
|
|
149
141
|
}));
|
|
150
|
-
console.log("debug get docs api", {
|
|
151
|
-
path,
|
|
152
|
-
db: this.db,
|
|
153
|
-
query: query2,
|
|
154
|
-
collection: collection2,
|
|
155
|
-
collectionRef,
|
|
156
|
-
q,
|
|
157
|
-
querySnapshot
|
|
158
|
-
});
|
|
159
142
|
return {
|
|
160
143
|
data,
|
|
161
144
|
querySnapshot,
|
|
@@ -381,7 +364,7 @@ function useAssignment({
|
|
|
381
364
|
}
|
|
382
365
|
|
|
383
366
|
// src/domains/cards/card.hooks.ts
|
|
384
|
-
import { useMutation, useQueries } from "@tanstack/react-query";
|
|
367
|
+
import { useMutation, useQueries, useQuery as useQuery2 } from "@tanstack/react-query";
|
|
385
368
|
import { useMemo } from "react";
|
|
386
369
|
|
|
387
370
|
// src/domains/cards/card.constants.ts
|
|
@@ -706,6 +689,13 @@ function updateCardInCache({
|
|
|
706
689
|
}) {
|
|
707
690
|
queryClient.setQueryData(cardsQueryKeys.one({ cardId }), card);
|
|
708
691
|
}
|
|
692
|
+
function useGetCard({ cardId }) {
|
|
693
|
+
const query2 = useQuery2({
|
|
694
|
+
queryKey: cardsQueryKeys.one({ cardId }),
|
|
695
|
+
queryFn: () => getCard({ cardId })
|
|
696
|
+
});
|
|
697
|
+
return query2;
|
|
698
|
+
}
|
|
709
699
|
|
|
710
700
|
// src/domains/cards/card.repo.ts
|
|
711
701
|
var createCardRepo = () => {
|
|
@@ -717,7 +707,7 @@ var createCardRepo = () => {
|
|
|
717
707
|
};
|
|
718
708
|
|
|
719
709
|
// src/domains/sets/set.hooks.ts
|
|
720
|
-
import { useQuery as
|
|
710
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
721
711
|
|
|
722
712
|
// src/domains/sets/set.constants.ts
|
|
723
713
|
var SETS_COLLECTION = "sets";
|
|
@@ -739,7 +729,7 @@ var setsQueryKeys = {
|
|
|
739
729
|
one: (params) => [...setsQueryKeys.all, params.setId]
|
|
740
730
|
};
|
|
741
731
|
var useSet = ({ setId, enabled }) => {
|
|
742
|
-
return
|
|
732
|
+
return useQuery3({
|
|
743
733
|
queryKey: setsQueryKeys.one({ setId }),
|
|
744
734
|
queryFn: () => getSet({ setId }),
|
|
745
735
|
enabled: setId !== void 0 && setId !== "" && enabled
|
|
@@ -1226,7 +1216,7 @@ function debounce(func, waitFor) {
|
|
|
1226
1216
|
}
|
|
1227
1217
|
|
|
1228
1218
|
// src/domains/assignment/hooks/score-hooks.ts
|
|
1229
|
-
import { useMutation as useMutation2, useQuery as
|
|
1219
|
+
import { useMutation as useMutation2, useQuery as useQuery4 } from "@tanstack/react-query";
|
|
1230
1220
|
|
|
1231
1221
|
// src/lib/tanstack/handle-optimistic-update-query.ts
|
|
1232
1222
|
var handleOptimisticUpdate = async ({
|
|
@@ -1878,7 +1868,7 @@ function useScore({
|
|
|
1878
1868
|
enabled = true,
|
|
1879
1869
|
googleClassroomUserId
|
|
1880
1870
|
}) {
|
|
1881
|
-
return
|
|
1871
|
+
return useQuery4({
|
|
1882
1872
|
queryFn: () => getScore({
|
|
1883
1873
|
userId,
|
|
1884
1874
|
courseId,
|
|
@@ -2323,7 +2313,7 @@ function useActivity({
|
|
|
2323
2313
|
gradingStandard,
|
|
2324
2314
|
type
|
|
2325
2315
|
}) => {
|
|
2326
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
2316
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
2327
2317
|
const card = cardsObject == null ? void 0 : cardsObject[cardId];
|
|
2328
2318
|
const scoresObject = queryClient.getQueryData(scoreQueryKeys.byId(activityId));
|
|
2329
2319
|
const cardScore = (_a2 = scoresObject == null ? void 0 : scoresObject.cards) == null ? void 0 : _a2[cardId];
|
|
@@ -2342,7 +2332,8 @@ function useActivity({
|
|
|
2342
2332
|
prompt: (_h = card == null ? void 0 : card.prompt) != null ? _h : "",
|
|
2343
2333
|
responseType: (card == null ? void 0 : card.type) === "RESPOND_WRITE" /* RESPOND_WRITE */ ? "written" : "spoken",
|
|
2344
2334
|
type,
|
|
2345
|
-
dateMade: serverTimestamp2()
|
|
2335
|
+
dateMade: serverTimestamp2(),
|
|
2336
|
+
language: (_i = card == null ? void 0 : card.language) != null ? _i : ""
|
|
2346
2337
|
},
|
|
2347
2338
|
userId
|
|
2348
2339
|
);
|
|
@@ -2460,7 +2451,7 @@ var submitLTIScore = async ({
|
|
|
2460
2451
|
};
|
|
2461
2452
|
|
|
2462
2453
|
// src/hooks/useCredits.ts
|
|
2463
|
-
import { useQuery as
|
|
2454
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
2464
2455
|
var creditQueryKeys = {
|
|
2465
2456
|
userCredits: (uid) => ["userCredits", uid]
|
|
2466
2457
|
};
|
|
@@ -2468,7 +2459,7 @@ var useUserCredits = () => {
|
|
|
2468
2459
|
const { user } = useSpeakableApi();
|
|
2469
2460
|
const email = user.auth.email;
|
|
2470
2461
|
const uid = user.auth.uid;
|
|
2471
|
-
const query2 =
|
|
2462
|
+
const query2 = useQuery5({
|
|
2472
2463
|
queryKey: creditQueryKeys.userCredits(uid),
|
|
2473
2464
|
queryFn: () => fetchUserCredits({ uid, email }),
|
|
2474
2465
|
enabled: !!uid,
|
|
@@ -2518,11 +2509,11 @@ var fetchUserCredits = async ({ uid, email }) => {
|
|
|
2518
2509
|
};
|
|
2519
2510
|
|
|
2520
2511
|
// src/hooks/useOrganizationAccess.ts
|
|
2521
|
-
import { useQuery as
|
|
2512
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
2522
2513
|
var useOrganizationAccess = () => {
|
|
2523
2514
|
const { user } = useSpeakableApi();
|
|
2524
2515
|
const email = user.auth.email;
|
|
2525
|
-
const query2 =
|
|
2516
|
+
const query2 = useQuery6({
|
|
2526
2517
|
queryKey: ["organizationAccess", email],
|
|
2527
2518
|
queryFn: async () => {
|
|
2528
2519
|
if (!email) {
|
|
@@ -2610,7 +2601,7 @@ var getOrganizationAccess = async (email) => {
|
|
|
2610
2601
|
};
|
|
2611
2602
|
|
|
2612
2603
|
// src/hooks/useActivityFeedbackAccess.ts
|
|
2613
|
-
import { useQuery as
|
|
2604
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
2614
2605
|
var activityFeedbackAccessQueryKeys = {
|
|
2615
2606
|
activityFeedbackAccess: (args) => ["activityFeedbackAccess", ...Object.values(args)]
|
|
2616
2607
|
};
|
|
@@ -2624,7 +2615,7 @@ var useActivityFeedbackAccess = ({
|
|
|
2624
2615
|
const isTeacher = (_a = user.profile) == null ? void 0 : _a.isTeacher;
|
|
2625
2616
|
const isStudent = (_b = user.profile) == null ? void 0 : _b.isStudent;
|
|
2626
2617
|
const userRoles = ((_c = user.profile) == null ? void 0 : _c.roles) || [];
|
|
2627
|
-
const query2 =
|
|
2618
|
+
const query2 = useQuery7({
|
|
2628
2619
|
queryKey: activityFeedbackAccessQueryKeys.activityFeedbackAccess({
|
|
2629
2620
|
aiEnabled,
|
|
2630
2621
|
isActivityRoute
|
|
@@ -3047,6 +3038,7 @@ export {
|
|
|
3047
3038
|
useCreateCard,
|
|
3048
3039
|
useCreateCards,
|
|
3049
3040
|
useCreateNotification,
|
|
3041
|
+
useGetCard,
|
|
3050
3042
|
useOrganizationAccess,
|
|
3051
3043
|
useSet,
|
|
3052
3044
|
useSpeakableApi,
|