@speakableio/core 1.0.53 → 1.0.55

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.
@@ -675,6 +675,12 @@ declare function getPagePrompt(card: PageActivityWithId | undefined): {
675
675
  text: string;
676
676
  rich_text: string;
677
677
  isTextEqualToRichText: boolean;
678
+ extraText: string;
679
+ } | {
680
+ has: boolean;
681
+ text: string;
682
+ rich_text: string;
683
+ isTextEqualToRichText: boolean;
678
684
  };
679
685
 
680
686
  declare const getTotalCompletedCards: (pageScores: Score["cards"] | undefined) => number;
@@ -2986,6 +2992,44 @@ declare const useUpdateStudentVocab: (page: PageActivityWithId | null) => {
2986
2992
  studentVocabMarkVoiceFail: () => Promise<void>;
2987
2993
  };
2988
2994
 
2995
+ declare const SPEAKABLE_ANALYTICS: {
2996
+ readonly VOICE_SUCCESS: "voice_success";
2997
+ readonly VOICE_FALLBACK_SUCCESS: "voice_fallback_success";
2998
+ readonly VOICE_FALLBACK_FAIL: "voice_fallback_fail";
2999
+ readonly VOICE_FAIL: "voice_fail";
3000
+ readonly RESPOND_CARD_SUCCESS: "respond_card_success";
3001
+ readonly RESPOND_CARD_FAIL: "respond_card_fail";
3002
+ readonly RESPOND_WRITE_CARD_SUCCESS: "respond_write_card_success";
3003
+ readonly RESPOND_WRITE_CARD_FAIL: "respond_write_card_fail";
3004
+ readonly RESPOND_WRITE_CARD_SUBMITTED: "respond_write_card_submitted";
3005
+ readonly RESPOND_WRITE_CARD_ERROR: "respond_write_card_error";
3006
+ readonly RESPOND_CARD_ERROR: "respond_card_error";
3007
+ readonly RESPOND_CARD_SUBMITTED: "respond_card_submitted";
3008
+ readonly RESPOND_FREE_PLAN: "respond_free_plan";
3009
+ readonly RESPOND_WRITE_FREE_PLAN: "respond_write_free_plan";
3010
+ readonly SUBMISSION: "assignment_submitted";
3011
+ readonly ASSIGNMENT_STARTED: "assignment_started";
3012
+ readonly CREATE_ASSIGNMENT: "create_assignment";
3013
+ readonly MC_SUCCESS: "multiple_choice_success";
3014
+ readonly MC_FAIL: "multiple_choice_fail";
3015
+ readonly MC_ERROR: "multiple_choice_error";
3016
+ readonly ACTFL_LEVEL: "actfl_level";
3017
+ readonly WIDA_LEVEL: "wida_level";
3018
+ readonly VIEW_SCORES_MODAL: "view_scores_modal";
3019
+ readonly SHORT_ANSWER_SUCCESS: "short_answer_success";
3020
+ readonly SHORT_ANSWER_FAIL: "short_answer_fail";
3021
+ readonly SHORT_ANSWER_ERROR: "short_answer_error";
3022
+ readonly RETRY: "retry";
3023
+ readonly MESSAGE_SENT: "message_sent";
3024
+ readonly MESSAGE_ERROR: "message_error";
3025
+ readonly VIEW_DETAILS_CLICK: "view_details_click";
3026
+ readonly TABS_CLICK: "tabs_click";
3027
+ readonly VIEW_MEDIA: "view_media";
3028
+ readonly VIEW_SCORES: "view_scores";
3029
+ readonly VIEW_GRADING_METHOD: "view_grading_method";
3030
+ readonly VIEW_FEEDBACK: "view_feedback";
3031
+ };
3032
+
2989
3033
  declare const useBaseOpenAI: ({ onTranscriptSuccess, onTranscriptError, onCompletionSuccess, onCompletionError, aiEnabled, submitAudioResponse, uploadAudioAndGetTranscript, onGetAudioUrlAndTranscript, }: {
2990
3034
  onTranscriptSuccess: (transcript: string) => void;
2991
3035
  onTranscriptError: ({ type, message }: {
@@ -3519,4 +3563,4 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
3519
3563
  };
3520
3564
  };
3521
3565
 
3522
- export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, 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, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientWeb 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 };
3566
+ export { ActivityPageType, type Assignment, type AssignmentAnalyticsType$1 as AssignmentAnalyticsType, type AssignmentWithId, BASE_MULTIPLE_CHOICE_FIELD_VALUES, BASE_REPEAT_FIELD_VALUES, BASE_RESPOND_FIELD_VALUES, CONVERSATION_PAGE_ACTIVITY_TYPES, ConversationPageMode, type CreditContract, FeedbackTypesCard, FsCtx, type InstitutionSubscription, LENIENCY_OPTIONS, LeniencyCard, MULTIPLE_CHOICE_PAGE_ACTIVITY_TYPES, type MediaPageActivity, 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_ANALYTICS, SPEAKABLE_NOTIFICATIONS, STUDENT_LEVELS_OPTIONS, type Score, type ScoreWithId, type Set, type SetWithId, type SpeakableNotificationType, SpeakableNotificationTypes, SpeakableProvider, VerificationCardStatus, assignmentQueryKeys, cardsQueryKeys, checkIsConversationPage, checkIsMCPage, checkIsMediaPage, checkIsRepeatPage, checkIsRespondAudioPage, checkIsRespondPage, checkIsRespondWrittenPage, checkIsShortAnswerPage, checkTypePageActivity, cleanString, createAssignmentRepo, createCardRepo, createFsClientWeb 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 };
package/dist/index.web.js CHANGED
@@ -828,8 +828,10 @@ var logGradingStandardLog = (data) => {
828
828
  };
829
829
 
830
830
  // src/constants/analytics.constants.ts
831
- var ANALYTICS_EVENT_TYPES = {
831
+ var SPEAKABLE_ANALYTICS = {
832
832
  VOICE_SUCCESS: "voice_success",
833
+ VOICE_FALLBACK_SUCCESS: "voice_fallback_success",
834
+ VOICE_FALLBACK_FAIL: "voice_fallback_fail",
833
835
  VOICE_FAIL: "voice_fail",
834
836
  RESPOND_CARD_SUCCESS: "respond_card_success",
835
837
  RESPOND_CARD_FAIL: "respond_card_fail",
@@ -875,20 +877,20 @@ var logOpenActivityPreview = (data = {}) => {
875
877
  var logSubmitAssignment = (data = {}) => {
876
878
  var _a, _b, _c;
877
879
  (_c = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "handleCouresAnalyticsEvent")) == null ? void 0 : _c({
878
- eventType: ANALYTICS_EVENT_TYPES.SUBMISSION,
880
+ eventType: SPEAKABLE_ANALYTICS.SUBMISSION,
879
881
  ...data
880
882
  });
881
- api.logEvent(ANALYTICS_EVENT_TYPES.SUBMISSION, data);
883
+ api.logEvent(SPEAKABLE_ANALYTICS.SUBMISSION, data);
882
884
  };
883
885
  var logStartAssignment = (data = {}) => {
884
886
  var _a, _b, _c;
885
887
  if (data.courseId) {
886
888
  (_c = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "handleCouresAnalyticsEvent")) == null ? void 0 : _c({
887
- eventType: ANALYTICS_EVENT_TYPES.ASSIGNMENT_STARTED,
889
+ eventType: SPEAKABLE_ANALYTICS.ASSIGNMENT_STARTED,
888
890
  ...data
889
891
  });
890
892
  }
891
- api.logEvent(ANALYTICS_EVENT_TYPES.ASSIGNMENT_STARTED, data);
893
+ api.logEvent(SPEAKABLE_ANALYTICS.ASSIGNMENT_STARTED, data);
892
894
  };
893
895
 
894
896
  // src/domains/assignment/utils/create-default-score.ts
@@ -2009,21 +2011,22 @@ function getPagePrompt(card) {
2009
2011
  card == null ? void 0 : card.type
2010
2012
  );
2011
2013
  const hidePrompt = (card == null ? void 0 : card.hidePrompt) === true;
2012
- const createReturnObject = (text, richText) => {
2014
+ const createReturnObject = (text, richText, extraText) => {
2013
2015
  const plainText = text || "";
2014
2016
  const richTextPlain = extractTextFromRichText(richText);
2015
2017
  return {
2016
2018
  has: true,
2017
2019
  text: plainText,
2018
2020
  rich_text: richText || "",
2019
- isTextEqualToRichText: plainText.trim() === richTextPlain.trim()
2021
+ isTextEqualToRichText: plainText.trim() === richTextPlain.trim(),
2022
+ extraText: extraText || ""
2020
2023
  };
2021
2024
  };
2022
2025
  if (isRepeat) {
2023
2026
  return createReturnObject(card == null ? void 0 : card.target_text, card == null ? void 0 : card.rich_text);
2024
2027
  }
2025
2028
  if (isConversation) {
2026
- return createReturnObject(card == null ? void 0 : card.topic, card == null ? void 0 : card.rich_text);
2029
+ return createReturnObject(card == null ? void 0 : card.prompt, card == null ? void 0 : card.rich_text, card == null ? void 0 : card.goal);
2027
2030
  }
2028
2031
  if (isRespond && !hidePrompt) {
2029
2032
  return createReturnObject(card == null ? void 0 : card.prompt, card == null ? void 0 : card.rich_text);
@@ -2038,7 +2041,8 @@ function getPagePrompt(card) {
2038
2041
  has: false,
2039
2042
  text: "",
2040
2043
  rich_text: "",
2041
- isTextEqualToRichText: false
2044
+ isTextEqualToRichText: false,
2045
+ extraText: ""
2042
2046
  };
2043
2047
  }
2044
2048
 
@@ -3797,6 +3801,7 @@ export {
3797
3801
  RESPOND_AUDIO_PAGE_ACTIVITY_TYPES,
3798
3802
  RESPOND_PAGE_ACTIVITY_TYPES,
3799
3803
  RESPOND_WRITE_PAGE_ACTIVITY_TYPES,
3804
+ SPEAKABLE_ANALYTICS,
3800
3805
  SPEAKABLE_NOTIFICATIONS,
3801
3806
  STUDENT_LEVELS_OPTIONS,
3802
3807
  SpeakableNotificationTypes,