@speakableio/core 1.0.24 → 1.0.26

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.
@@ -777,6 +777,7 @@ interface PageScore {
777
777
  fileName?: string | null;
778
778
  transcript?: string | null;
779
779
  } | null;
780
+ transcriptModel?: 'gemini' | 'assemblyai' | 'whisper';
780
781
  }
781
782
 
782
783
  declare enum AssignmentAnalyticsType {
@@ -1520,7 +1521,7 @@ declare function SpeakableProvider({ user, children, queryClient, permissions, f
1520
1521
  }): react_jsx_runtime.JSX.Element | null;
1521
1522
  declare function useSpeakableApi(): FsContext;
1522
1523
 
1523
- declare function getTranscript(model: 'gemini' | 'assemblyai', args: {
1524
+ declare function getTranscript(model: 'gemini' | 'assemblyai' | 'whisper', args: {
1524
1525
  language: string;
1525
1526
  audioUrl: string;
1526
1527
  prompt?: string;
@@ -1899,6 +1900,7 @@ declare const useUserCredits: () => {
1899
1900
  isPaused: boolean;
1900
1901
  isRefetching: boolean;
1901
1902
  isStale: boolean;
1903
+ isEnabled: boolean;
1902
1904
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
1903
1905
  id: string;
1904
1906
  userId: string;
@@ -2042,6 +2044,7 @@ declare const useUserCredits: () => {
2042
2044
  isPaused: boolean;
2043
2045
  isRefetching: boolean;
2044
2046
  isStale: boolean;
2047
+ isEnabled: boolean;
2045
2048
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
2046
2049
  id: string;
2047
2050
  userId: string;
@@ -2146,6 +2149,7 @@ declare const useUserCredits: () => {
2146
2149
  isPaused: boolean;
2147
2150
  isRefetching: boolean;
2148
2151
  isStale: boolean;
2152
+ isEnabled: boolean;
2149
2153
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
2150
2154
  id: string;
2151
2155
  userId: string;
@@ -2250,6 +2254,7 @@ declare const useUserCredits: () => {
2250
2254
  isPaused: boolean;
2251
2255
  isRefetching: boolean;
2252
2256
  isStale: boolean;
2257
+ isEnabled: boolean;
2253
2258
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
2254
2259
  id: string;
2255
2260
  userId: string;
@@ -2354,6 +2359,7 @@ declare const useUserCredits: () => {
2354
2359
  isPaused: boolean;
2355
2360
  isRefetching: boolean;
2356
2361
  isStale: boolean;
2362
+ isEnabled: boolean;
2357
2363
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
2358
2364
  id: string;
2359
2365
  userId: string;
@@ -2497,6 +2503,7 @@ declare const useUserCredits: () => {
2497
2503
  isPaused: boolean;
2498
2504
  isRefetching: boolean;
2499
2505
  isStale: boolean;
2506
+ isEnabled: boolean;
2500
2507
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
2501
2508
  id: string;
2502
2509
  userId: string;
@@ -2626,6 +2633,7 @@ declare const useOrganizationAccess: () => {
2626
2633
  isPaused: boolean;
2627
2634
  isRefetching: boolean;
2628
2635
  isStale: boolean;
2636
+ isEnabled: boolean;
2629
2637
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2630
2638
  fetchStatus: _tanstack_react_query.FetchStatus;
2631
2639
  promise: Promise<OrganizationAccess>;
@@ -2652,6 +2660,7 @@ declare const useOrganizationAccess: () => {
2652
2660
  isPaused: boolean;
2653
2661
  isRefetching: boolean;
2654
2662
  isStale: boolean;
2663
+ isEnabled: boolean;
2655
2664
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2656
2665
  fetchStatus: _tanstack_react_query.FetchStatus;
2657
2666
  promise: Promise<OrganizationAccess>;
@@ -2678,6 +2687,7 @@ declare const useOrganizationAccess: () => {
2678
2687
  isPaused: boolean;
2679
2688
  isRefetching: boolean;
2680
2689
  isStale: boolean;
2690
+ isEnabled: boolean;
2681
2691
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2682
2692
  fetchStatus: _tanstack_react_query.FetchStatus;
2683
2693
  promise: Promise<OrganizationAccess>;
@@ -2704,6 +2714,7 @@ declare const useOrganizationAccess: () => {
2704
2714
  isPaused: boolean;
2705
2715
  isRefetching: boolean;
2706
2716
  isStale: boolean;
2717
+ isEnabled: boolean;
2707
2718
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2708
2719
  fetchStatus: _tanstack_react_query.FetchStatus;
2709
2720
  promise: Promise<OrganizationAccess>;
@@ -2730,6 +2741,7 @@ declare const useOrganizationAccess: () => {
2730
2741
  isPaused: boolean;
2731
2742
  isRefetching: boolean;
2732
2743
  isStale: boolean;
2744
+ isEnabled: boolean;
2733
2745
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2734
2746
  fetchStatus: _tanstack_react_query.FetchStatus;
2735
2747
  promise: Promise<OrganizationAccess>;
@@ -2756,6 +2768,7 @@ declare const useOrganizationAccess: () => {
2756
2768
  isPaused: boolean;
2757
2769
  isRefetching: boolean;
2758
2770
  isStale: boolean;
2771
+ isEnabled: boolean;
2759
2772
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<OrganizationAccess, Error>>;
2760
2773
  fetchStatus: _tanstack_react_query.FetchStatus;
2761
2774
  promise: Promise<OrganizationAccess>;
@@ -2763,7 +2776,7 @@ declare const useOrganizationAccess: () => {
2763
2776
 
2764
2777
  declare function useSpeakableTranscript(): {
2765
2778
  mutation: _tanstack_react_query.UseMutationResult<string | null, Error, {
2766
- model: "gemini" | "assemblyai";
2779
+ model: "gemini" | "assemblyai" | "whisper";
2767
2780
  audioUrl: string;
2768
2781
  language: string;
2769
2782
  prompt?: string;
@@ -2878,6 +2891,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
2878
2891
  isPaused: boolean;
2879
2892
  isRefetching: boolean;
2880
2893
  isStale: boolean;
2894
+ isEnabled: boolean;
2881
2895
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
2882
2896
  fetchStatus: _tanstack_react_query.FetchStatus;
2883
2897
  promise: Promise<ActivityFeedbackAccess>;
@@ -2904,6 +2918,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
2904
2918
  isPaused: boolean;
2905
2919
  isRefetching: boolean;
2906
2920
  isStale: boolean;
2921
+ isEnabled: boolean;
2907
2922
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
2908
2923
  fetchStatus: _tanstack_react_query.FetchStatus;
2909
2924
  promise: Promise<ActivityFeedbackAccess>;
@@ -2930,6 +2945,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
2930
2945
  isPaused: boolean;
2931
2946
  isRefetching: boolean;
2932
2947
  isStale: boolean;
2948
+ isEnabled: boolean;
2933
2949
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
2934
2950
  fetchStatus: _tanstack_react_query.FetchStatus;
2935
2951
  promise: Promise<ActivityFeedbackAccess>;
@@ -2956,6 +2972,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
2956
2972
  isPaused: boolean;
2957
2973
  isRefetching: boolean;
2958
2974
  isStale: boolean;
2975
+ isEnabled: boolean;
2959
2976
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
2960
2977
  fetchStatus: _tanstack_react_query.FetchStatus;
2961
2978
  promise: Promise<ActivityFeedbackAccess>;
@@ -2982,6 +2999,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
2982
2999
  isPaused: boolean;
2983
3000
  isRefetching: boolean;
2984
3001
  isStale: boolean;
3002
+ isEnabled: boolean;
2985
3003
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
2986
3004
  fetchStatus: _tanstack_react_query.FetchStatus;
2987
3005
  promise: Promise<ActivityFeedbackAccess>;
@@ -3008,6 +3026,7 @@ declare const useActivityFeedbackAccess: ({ aiEnabled, isActivityRoute, }: {
3008
3026
  isPaused: boolean;
3009
3027
  isRefetching: boolean;
3010
3028
  isStale: boolean;
3029
+ isEnabled: boolean;
3011
3030
  refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ActivityFeedbackAccess, Error>>;
3012
3031
  fetchStatus: _tanstack_react_query.FetchStatus;
3013
3032
  promise: Promise<ActivityFeedbackAccess>;
package/dist/index.web.js CHANGED
@@ -1729,7 +1729,7 @@ var getCard = withErrorHandler(_getCard, "getCard");
1729
1729
  import { v4 } from "uuid";
1730
1730
 
1731
1731
  // src/utils/text-utils.ts
1732
- import sha1 from "js-sha1";
1732
+ import { sha1 } from "js-sha1";
1733
1733
  var purify = (word) => {
1734
1734
  return word.normalize("NFD").replace(/\/([^" "]*)/g, "").replace(/\([^()]*\)/g, "").replace(/([^()]*)/g, "").replace(/[\u0300-\u036f]/g, "").replace(/[-]/g, " ").replace(/[.,/#!¡¿?؟。,.?$%^&*;:{}=\-_`~()’'…\s]/g, "").replace(/\s\s+/g, " ").toLowerCase().trim();
1735
1735
  };
@@ -2136,9 +2136,22 @@ var createSetRepo = () => {
2136
2136
 
2137
2137
  // src/utils/ai/get-transcript.ts
2138
2138
  async function getTranscript(model, args) {
2139
- var _a, _b, _c, _d;
2139
+ var _a, _b, _c, _d, _e, _f;
2140
2140
  const getGeminiTranscript = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getGeminiTranscript");
2141
2141
  const getAssemblyAITranscript = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "transcribeAssemblyAIAudio");
2142
+ const getWhisperTranscript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "transcribeAudio");
2143
+ if (model === "whisper") {
2144
+ try {
2145
+ const { data } = await (getWhisperTranscript == null ? void 0 : getWhisperTranscript({
2146
+ audioUrl: args.audioUrl,
2147
+ language: args.language
2148
+ }));
2149
+ return data;
2150
+ } catch (error) {
2151
+ console.error("Error getting transcript from Whisper:", error);
2152
+ throw error;
2153
+ }
2154
+ }
2142
2155
  if (model === "gemini") {
2143
2156
  try {
2144
2157
  const { data } = await (getGeminiTranscript == null ? void 0 : getGeminiTranscript({
@@ -3120,9 +3133,22 @@ var useBaseOpenAI = ({
3120
3133
  aiEnabled
3121
3134
  });
3122
3135
  const getTranscript2 = async (audioUrl, language, prompt) => {
3123
- var _a, _b, _c, _d;
3136
+ var _a, _b, _c, _d, _e, _f;
3124
3137
  const getGeminiTranscript = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getGeminiTranscript");
3125
3138
  const getAssemblyAITranscript = (_d = (_c = api).httpsCallable) == null ? void 0 : _d.call(_c, "transcribeAssemblyAIAudio");
3139
+ const getWhisperTranscript = (_f = (_e = api).httpsCallable) == null ? void 0 : _f.call(_e, "transcribeAudio");
3140
+ try {
3141
+ const { data } = await (getWhisperTranscript == null ? void 0 : getWhisperTranscript({
3142
+ audioUrl,
3143
+ language
3144
+ }));
3145
+ const transcript = data;
3146
+ if (transcript) {
3147
+ return transcript;
3148
+ }
3149
+ } catch (error) {
3150
+ console.log("Whisper transcript failed, trying Gemini fallback:", error);
3151
+ }
3126
3152
  try {
3127
3153
  const { data } = await (getGeminiTranscript == null ? void 0 : getGeminiTranscript({
3128
3154
  audioUrl,