@speakableio/core 0.1.63 → 0.1.64

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.
@@ -767,6 +767,11 @@ declare const checkTypePageActivity: (cardType: ActivityPageType | undefined) =>
767
767
  isShortAnswer: boolean;
768
768
  };
769
769
 
770
+ declare function getPagePrompt(card: PageActivityWithId | undefined): {
771
+ has: boolean;
772
+ text: string | undefined;
773
+ };
774
+
770
775
  interface SetWithId extends Set {
771
776
  id: string;
772
777
  }
@@ -2704,4 +2709,4 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
2704
2709
  };
2705
2710
  };
2706
2711
 
2707
- export { ActivityPageType, type Assignment, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CardScore, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_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, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientWeb 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 };
2712
+ export { ActivityPageType, type Assignment, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CardScore, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, REPEAT_PAGE_ACTIVITY_TYPES, RESPOND_AUDIO_PAGE_ACTIVITY_TYPES, RESPOND_PAGE_ACTIVITY_TYPES, RESPOND_WRITE_PAGE_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, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientWeb as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getPagePrompt, 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 };
package/dist/index.web.js CHANGED
@@ -1871,6 +1871,41 @@ var checkTypePageActivity = (cardType) => {
1871
1871
  };
1872
1872
  };
1873
1873
 
1874
+ // src/domains/cards/utils/get-page-prompt.ts
1875
+ function getPagePrompt(card) {
1876
+ if (!card) return { has: false, text: "" };
1877
+ const { isMC, isRepeat, isRespond, isShortAnswer } = checkTypePageActivity(card == null ? void 0 : card.type);
1878
+ const hidePrompt = (card == null ? void 0 : card.hidePrompt) === true;
1879
+ if (isRepeat) {
1880
+ return {
1881
+ has: true,
1882
+ text: card == null ? void 0 : card.target_text
1883
+ };
1884
+ }
1885
+ if (isRespond && !hidePrompt) {
1886
+ return {
1887
+ has: true,
1888
+ text: card == null ? void 0 : card.prompt
1889
+ };
1890
+ }
1891
+ if (isMC) {
1892
+ return {
1893
+ has: true,
1894
+ text: card == null ? void 0 : card.question
1895
+ };
1896
+ }
1897
+ if (isShortAnswer && !hidePrompt) {
1898
+ return {
1899
+ has: true,
1900
+ text: card == null ? void 0 : card.prompt
1901
+ };
1902
+ }
1903
+ return {
1904
+ has: false,
1905
+ text: ""
1906
+ };
1907
+ }
1908
+
1874
1909
  // src/domains/sets/set.hooks.ts
1875
1910
  import { useQuery as useQuery4 } from "@tanstack/react-query";
1876
1911
 
@@ -3068,6 +3103,7 @@ export {
3068
3103
  creditQueryKeys,
3069
3104
  debounce,
3070
3105
  getCardFromCache,
3106
+ getPagePrompt,
3071
3107
  getRespondCardTool,
3072
3108
  getSetFromCache,
3073
3109
  getWordHash,