@speakableio/core 1.0.28 → 1.0.30

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.
@@ -617,6 +617,29 @@ declare const getLabelPage: (pageType: ActivityPageType | undefined) => {
617
617
  long: string;
618
618
  };
619
619
 
620
+ declare function getPageMediaData(page: PageActivityWithId): {
621
+ direction: "left" | "right";
622
+ mode: "single" | "media_area" | "none" | null;
623
+ singleMedia: {
624
+ rawObject: {
625
+ type: "image" | "video";
626
+ url: string;
627
+ };
628
+ type: "image" | "video";
629
+ content: string;
630
+ } | undefined;
631
+ isMediaPage: boolean;
632
+ hasMediaData: boolean;
633
+ };
634
+ declare function getSingleMediaPageData(page: PageActivityWithId): {
635
+ rawObject: {
636
+ type: "image" | "video";
637
+ url: string;
638
+ };
639
+ type: "image" | "video";
640
+ content: string;
641
+ } | undefined;
642
+
620
643
  interface Assignment {
621
644
  name: string;
622
645
  description: string;
@@ -3369,4 +3392,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3369
3392
  };
3370
3393
  };
3371
3394
 
3372
- export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, 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, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
3395
+ export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, 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, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
@@ -617,6 +617,29 @@ declare const getLabelPage: (pageType: ActivityPageType | undefined) => {
617
617
  long: string;
618
618
  };
619
619
 
620
+ declare function getPageMediaData(page: PageActivityWithId): {
621
+ direction: "left" | "right";
622
+ mode: "single" | "media_area" | "none" | null;
623
+ singleMedia: {
624
+ rawObject: {
625
+ type: "image" | "video";
626
+ url: string;
627
+ };
628
+ type: "image" | "video";
629
+ content: string;
630
+ } | undefined;
631
+ isMediaPage: boolean;
632
+ hasMediaData: boolean;
633
+ };
634
+ declare function getSingleMediaPageData(page: PageActivityWithId): {
635
+ rawObject: {
636
+ type: "image" | "video";
637
+ url: string;
638
+ };
639
+ type: "image" | "video";
640
+ content: string;
641
+ } | undefined;
642
+
620
643
  interface Assignment {
621
644
  name: string;
622
645
  description: string;
@@ -3369,4 +3392,4 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
3369
3392
  };
3370
3393
  };
3371
3394
 
3372
- export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, 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, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
3395
+ export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type Organization, type OrganizationAccess, type PageActivity, type PageActivityWithId, type PageScore, 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, createFsClientNative as createFsClient, createSetRepo, creditQueryKeys, debounce, getCardFromCache, getLabelPage, getPageMediaData, getPagePrompt, getPhraseLength, getRespondCardTool, getSetFromCache, getSingleMediaPageData, getTotalCompletedCards, getTranscript, getTranscriptCycle, getWordHash, purify, refsCardsFiresotre, refsSetsFirestore, scoreQueryKeys, setsQueryKeys, updateCardInCache, updateSetInCache, useActivity, useActivityFeedbackAccess, useAssignment, useBaseOpenAI, useCards, useClearScore, useClearScoreV2, useCreateCard, useCreateCards, useCreateNotification, useGetCard, useOrganizationAccess, useScore, useSet, useSpeakableApi, useSpeakableTranscript, useSpeakableTranscriptCycle, useSubmitAssignmentScore, useSubmitPracticeScore, useUpdateCardScore, useUpdateScore, useUpdateStudentVocab, useUserCredits };
@@ -67,10 +67,12 @@ __export(index_native_exports, {
67
67
  debounce: () => debounce,
68
68
  getCardFromCache: () => getCardFromCache,
69
69
  getLabelPage: () => getLabelPage,
70
+ getPageMediaData: () => getPageMediaData,
70
71
  getPagePrompt: () => getPagePrompt,
71
72
  getPhraseLength: () => getPhraseLength,
72
73
  getRespondCardTool: () => getRespondCardTool,
73
74
  getSetFromCache: () => getSetFromCache,
75
+ getSingleMediaPageData: () => getSingleMediaPageData,
74
76
  getTotalCompletedCards: () => getTotalCompletedCards,
75
77
  getTranscript: () => getTranscript,
76
78
  getTranscriptCycle: () => getTranscriptCycle,
@@ -2193,6 +2195,35 @@ var getLabelPage = (pageType) => {
2193
2195
  };
2194
2196
  };
2195
2197
 
2198
+ // src/domains/cards/utils/get-page-media-data.ts
2199
+ function getPageMediaData(page) {
2200
+ var _a, _b;
2201
+ const direction = (_a = page.media_area_layout) != null ? _a : "left";
2202
+ const { isMediaPage } = checkTypePageActivity(page.type);
2203
+ const mode = (_b = page.media_mode) != null ? _b : page.media_area_id ? "media_area" : null;
2204
+ const singleMedia = getSingleMediaPageData(page);
2205
+ const hasMediaData = isMediaPage && singleMedia !== void 0;
2206
+ return {
2207
+ direction,
2208
+ mode,
2209
+ singleMedia,
2210
+ isMediaPage,
2211
+ hasMediaData
2212
+ };
2213
+ }
2214
+ function getSingleMediaPageData(page) {
2215
+ const isSingleMode = page.media_mode === "single";
2216
+ if (!isSingleMode || !page.media) return void 0;
2217
+ const media = {
2218
+ type: page.media.type,
2219
+ content: page.media.url
2220
+ };
2221
+ return {
2222
+ ...media,
2223
+ rawObject: page.media
2224
+ };
2225
+ }
2226
+
2196
2227
  // src/domains/sets/set.hooks.ts
2197
2228
  var import_react_query4 = require("@tanstack/react-query");
2198
2229