@speakableio/core 0.1.59 → 0.1.61

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.
@@ -671,8 +671,9 @@ declare function updateCardInCache({ cardId, card, queryClient, }: {
671
671
  card: CardActivityWithId | null;
672
672
  queryClient: QueryClient;
673
673
  }): void;
674
- declare function useGetCard({ cardId }: {
674
+ declare function useGetCard({ cardId, enabled }: {
675
675
  cardId: string;
676
+ enabled?: boolean;
676
677
  }): _tanstack_react_query.UseQueryResult<CardActivityWithId | null, Error>;
677
678
 
678
679
  declare const createCardRepo: () => {
@@ -750,6 +751,23 @@ declare const createCardRepo: () => {
750
751
  }) => Promise<CardActivityWithId | null>;
751
752
  };
752
753
 
754
+ declare function checkIsRepeatCard(cardType: CardActivityType | undefined): boolean;
755
+ declare function checkIsMCCard(cardType: CardActivityType | undefined): boolean;
756
+ declare function checkIsRespondCard(cardType: CardActivityType | undefined): boolean;
757
+ declare function checkIsRespondWrittenCard(cardType: CardActivityType | undefined): boolean;
758
+ declare function checkIsRespondAudioCard(cardType: CardActivityType | undefined): boolean;
759
+ declare const checkIsMediaPageCard: (cardType: CardActivityType | undefined) => boolean;
760
+ declare const checkIsShortAnswerCard: (cardType: CardActivityType | undefined) => boolean;
761
+ declare const checkTypeCardActivity: (cardType: CardActivityType | undefined) => {
762
+ isRespondAudio: boolean;
763
+ isRespondWritten: boolean;
764
+ isRespond: boolean;
765
+ isMC: boolean;
766
+ isRepeat: boolean;
767
+ isMediaPage: boolean;
768
+ isShortAnswer: boolean;
769
+ };
770
+
753
771
  interface SetWithId extends Set {
754
772
  id: string;
755
773
  }
@@ -2687,4 +2705,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
2687
2705
  };
2688
2706
  };
2689
2707
 
2690
- 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, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUserCredits };
2708
+ 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, checkIsMCCard, checkIsMediaPageCard, checkIsRepeatCard, checkIsRespondAudioCard, checkIsRespondCard, checkIsRespondWrittenCard, checkIsShortAnswerCard, checkTypeCardActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getRespondCardTool, getSetFromCache, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUserCredits };
@@ -1814,10 +1814,11 @@ function updateCardInCache({
1814
1814
  }) {
1815
1815
  queryClient.setQueryData(cardsQueryKeys.one({ cardId }), card);
1816
1816
  }
1817
- function useGetCard({ cardId }) {
1817
+ function useGetCard({ cardId, enabled = true }) {
1818
1818
  const query2 = useQuery3({
1819
1819
  queryKey: cardsQueryKeys.one({ cardId }),
1820
- queryFn: () => getCard({ cardId })
1820
+ queryFn: () => getCard({ cardId }),
1821
+ enabled: enabled && !!cardId
1821
1822
  });
1822
1823
  return query2;
1823
1824
  }
@@ -1831,6 +1832,54 @@ var createCardRepo = () => {
1831
1832
  };
1832
1833
  };
1833
1834
 
1835
+ // src/domains/cards/utils/check-page-type.ts
1836
+ function checkIsRepeatCard(cardType) {
1837
+ if (cardType === void 0) return false;
1838
+ return REPEAT_CARD_ACTIVITY_TYPES.includes(cardType);
1839
+ }
1840
+ function checkIsMCCard(cardType) {
1841
+ if (cardType === void 0) return false;
1842
+ return MULTIPLE_CHOICE_CARD_ACTIVITY_TYPES.includes(cardType);
1843
+ }
1844
+ function checkIsRespondCard(cardType) {
1845
+ if (cardType === void 0) return false;
1846
+ return RESPOND_CARD_ACTIVITY_TYPES.includes(cardType);
1847
+ }
1848
+ function checkIsRespondWrittenCard(cardType) {
1849
+ if (cardType === void 0) return false;
1850
+ return RESPOND_WRITE_CARD_ACTIVITY_TYPES.includes(cardType);
1851
+ }
1852
+ function checkIsRespondAudioCard(cardType) {
1853
+ if (cardType === void 0) return false;
1854
+ return RESPOND_AUDIO_CARD_ACTIVITY_TYPES.includes(cardType);
1855
+ }
1856
+ var checkIsMediaPageCard = (cardType) => {
1857
+ if (cardType === void 0) return false;
1858
+ return cardType === "MEDIA_PAGE" /* MEDIA_PAGE */;
1859
+ };
1860
+ var checkIsShortAnswerCard = (cardType) => {
1861
+ if (cardType === void 0) return false;
1862
+ return cardType === "SHORT_ANSWER" /* SHORT_ANSWER */;
1863
+ };
1864
+ var checkTypeCardActivity = (cardType) => {
1865
+ const isRespondAudio = checkIsRespondAudioCard(cardType);
1866
+ const isRespondWritten = checkIsRespondWrittenCard(cardType);
1867
+ const isRespond = checkIsRespondCard(cardType);
1868
+ const isMC = checkIsMCCard(cardType);
1869
+ const isRepeat = checkIsRepeatCard(cardType);
1870
+ const isMediaPage = checkIsMediaPageCard(cardType);
1871
+ const isShortAnswer = checkIsShortAnswerCard(cardType);
1872
+ return {
1873
+ isRespondAudio,
1874
+ isRespondWritten,
1875
+ isRespond,
1876
+ isMC,
1877
+ isRepeat,
1878
+ isMediaPage,
1879
+ isShortAnswer
1880
+ };
1881
+ };
1882
+
1834
1883
  // src/domains/sets/set.hooks.ts
1835
1884
  import { useQuery as useQuery4 } from "@tanstack/react-query";
1836
1885
 
@@ -3013,6 +3062,14 @@ export {
3013
3062
  VerificationCardStatus,
3014
3063
  assignmentQueryKeys,
3015
3064
  cardsQueryKeys,
3065
+ checkIsMCCard,
3066
+ checkIsMediaPageCard,
3067
+ checkIsRepeatCard,
3068
+ checkIsRespondAudioCard,
3069
+ checkIsRespondCard,
3070
+ checkIsRespondWrittenCard,
3071
+ checkIsShortAnswerCard,
3072
+ checkTypeCardActivity,
3016
3073
  cleanString,
3017
3074
  createAssignmentRepo,
3018
3075
  createCardRepo,