@speakableio/core 1.0.31 → 1.0.33
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.
- package/dist/index.native.d.mts +16 -16
- package/dist/index.native.d.ts +16 -16
- package/dist/index.native.js +42 -8
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +42 -8
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.d.mts +16 -16
- package/dist/index.web.js +42 -8
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.native.d.mts
CHANGED
|
@@ -95,7 +95,7 @@ interface PageActivity {
|
|
|
95
95
|
media_area_layout?: 'left' | 'right' | null;
|
|
96
96
|
media_mode?: 'single' | 'media_area' | 'none' | null;
|
|
97
97
|
media?: {
|
|
98
|
-
type: 'image' | 'video';
|
|
98
|
+
type: 'image' | 'video' | 'link';
|
|
99
99
|
url: string;
|
|
100
100
|
} | null;
|
|
101
101
|
score?: number;
|
|
@@ -198,7 +198,7 @@ declare function useCards({ cardIds, enabled, asObject, }: {
|
|
|
198
198
|
media_area_layout?: "left" | "right" | null;
|
|
199
199
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
200
200
|
media?: {
|
|
201
|
-
type: "image" | "video";
|
|
201
|
+
type: "image" | "video" | "link";
|
|
202
202
|
url: string;
|
|
203
203
|
} | null;
|
|
204
204
|
score?: number;
|
|
@@ -278,7 +278,7 @@ declare function useCreateCards(): {
|
|
|
278
278
|
media_area_layout?: "left" | "right" | null;
|
|
279
279
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
280
280
|
media?: {
|
|
281
|
-
type: "image" | "video";
|
|
281
|
+
type: "image" | "video" | "link";
|
|
282
282
|
url: string;
|
|
283
283
|
} | null;
|
|
284
284
|
score?: number;
|
|
@@ -366,7 +366,7 @@ declare function useGetCard({ cardId, enabled }: {
|
|
|
366
366
|
media_area_layout?: "left" | "right" | null;
|
|
367
367
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
368
368
|
media?: {
|
|
369
|
-
type: "image" | "video";
|
|
369
|
+
type: "image" | "video" | "link";
|
|
370
370
|
url: string;
|
|
371
371
|
} | null;
|
|
372
372
|
score?: number;
|
|
@@ -446,7 +446,7 @@ declare const createCardRepo: () => {
|
|
|
446
446
|
media_area_layout?: "left" | "right" | null;
|
|
447
447
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
448
448
|
media?: {
|
|
449
|
-
type: "image" | "video";
|
|
449
|
+
type: "image" | "video" | "link";
|
|
450
450
|
url: string;
|
|
451
451
|
} | null;
|
|
452
452
|
score?: number;
|
|
@@ -521,7 +521,7 @@ declare const createCardRepo: () => {
|
|
|
521
521
|
media_area_layout?: "left" | "right" | null;
|
|
522
522
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
523
523
|
media?: {
|
|
524
|
-
type: "image" | "video";
|
|
524
|
+
type: "image" | "video" | "link";
|
|
525
525
|
url: string;
|
|
526
526
|
} | null;
|
|
527
527
|
score?: number;
|
|
@@ -622,21 +622,21 @@ declare function getPageMediaData(page: PageActivityWithId): {
|
|
|
622
622
|
mode: "single" | "media_area" | "none" | null;
|
|
623
623
|
singleMedia: {
|
|
624
624
|
rawObject: {
|
|
625
|
-
type: "image" | "video";
|
|
625
|
+
type: "image" | "video" | "link";
|
|
626
626
|
url: string;
|
|
627
627
|
};
|
|
628
|
-
type: "image" | "video";
|
|
628
|
+
type: "image" | "video" | "link";
|
|
629
629
|
content: string;
|
|
630
630
|
} | undefined;
|
|
631
631
|
isMediaPage: boolean;
|
|
632
|
-
hasMediaData: boolean;
|
|
632
|
+
hasMediaData: string | boolean;
|
|
633
633
|
};
|
|
634
634
|
declare function getSingleMediaPageData(page: PageActivityWithId): {
|
|
635
635
|
rawObject: {
|
|
636
|
-
type: "image" | "video";
|
|
636
|
+
type: "image" | "video" | "link";
|
|
637
637
|
url: string;
|
|
638
638
|
};
|
|
639
|
-
type: "image" | "video";
|
|
639
|
+
type: "image" | "video" | "link";
|
|
640
640
|
content: string;
|
|
641
641
|
} | undefined;
|
|
642
642
|
|
|
@@ -1373,7 +1373,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
|
|
|
1373
1373
|
media_area_layout?: "left" | "right" | null;
|
|
1374
1374
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1375
1375
|
media?: {
|
|
1376
|
-
type: "image" | "video";
|
|
1376
|
+
type: "image" | "video" | "link";
|
|
1377
1377
|
url: string;
|
|
1378
1378
|
} | null;
|
|
1379
1379
|
score?: number;
|
|
@@ -1448,7 +1448,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
|
|
|
1448
1448
|
media_area_layout?: "left" | "right" | null;
|
|
1449
1449
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1450
1450
|
media?: {
|
|
1451
|
-
type: "image" | "video";
|
|
1451
|
+
type: "image" | "video" | "link";
|
|
1452
1452
|
url: string;
|
|
1453
1453
|
} | null;
|
|
1454
1454
|
score?: number;
|
|
@@ -1706,7 +1706,7 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
|
|
|
1706
1706
|
media_area_layout?: "left" | "right" | null;
|
|
1707
1707
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1708
1708
|
media?: {
|
|
1709
|
-
type: "image" | "video";
|
|
1709
|
+
type: "image" | "video" | "link";
|
|
1710
1710
|
url: string;
|
|
1711
1711
|
} | null;
|
|
1712
1712
|
score?: number;
|
|
@@ -3252,7 +3252,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3252
3252
|
media_area_layout?: "left" | "right" | null;
|
|
3253
3253
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
3254
3254
|
media?: {
|
|
3255
|
-
type: "image" | "video";
|
|
3255
|
+
type: "image" | "video" | "link";
|
|
3256
3256
|
url: string;
|
|
3257
3257
|
} | null;
|
|
3258
3258
|
score?: number;
|
|
@@ -3327,7 +3327,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3327
3327
|
media_area_layout?: "left" | "right" | null;
|
|
3328
3328
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
3329
3329
|
media?: {
|
|
3330
|
-
type: "image" | "video";
|
|
3330
|
+
type: "image" | "video" | "link";
|
|
3331
3331
|
url: string;
|
|
3332
3332
|
} | null;
|
|
3333
3333
|
score?: number;
|
package/dist/index.native.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ interface PageActivity {
|
|
|
95
95
|
media_area_layout?: 'left' | 'right' | null;
|
|
96
96
|
media_mode?: 'single' | 'media_area' | 'none' | null;
|
|
97
97
|
media?: {
|
|
98
|
-
type: 'image' | 'video';
|
|
98
|
+
type: 'image' | 'video' | 'link';
|
|
99
99
|
url: string;
|
|
100
100
|
} | null;
|
|
101
101
|
score?: number;
|
|
@@ -198,7 +198,7 @@ declare function useCards({ cardIds, enabled, asObject, }: {
|
|
|
198
198
|
media_area_layout?: "left" | "right" | null;
|
|
199
199
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
200
200
|
media?: {
|
|
201
|
-
type: "image" | "video";
|
|
201
|
+
type: "image" | "video" | "link";
|
|
202
202
|
url: string;
|
|
203
203
|
} | null;
|
|
204
204
|
score?: number;
|
|
@@ -278,7 +278,7 @@ declare function useCreateCards(): {
|
|
|
278
278
|
media_area_layout?: "left" | "right" | null;
|
|
279
279
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
280
280
|
media?: {
|
|
281
|
-
type: "image" | "video";
|
|
281
|
+
type: "image" | "video" | "link";
|
|
282
282
|
url: string;
|
|
283
283
|
} | null;
|
|
284
284
|
score?: number;
|
|
@@ -366,7 +366,7 @@ declare function useGetCard({ cardId, enabled }: {
|
|
|
366
366
|
media_area_layout?: "left" | "right" | null;
|
|
367
367
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
368
368
|
media?: {
|
|
369
|
-
type: "image" | "video";
|
|
369
|
+
type: "image" | "video" | "link";
|
|
370
370
|
url: string;
|
|
371
371
|
} | null;
|
|
372
372
|
score?: number;
|
|
@@ -446,7 +446,7 @@ declare const createCardRepo: () => {
|
|
|
446
446
|
media_area_layout?: "left" | "right" | null;
|
|
447
447
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
448
448
|
media?: {
|
|
449
|
-
type: "image" | "video";
|
|
449
|
+
type: "image" | "video" | "link";
|
|
450
450
|
url: string;
|
|
451
451
|
} | null;
|
|
452
452
|
score?: number;
|
|
@@ -521,7 +521,7 @@ declare const createCardRepo: () => {
|
|
|
521
521
|
media_area_layout?: "left" | "right" | null;
|
|
522
522
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
523
523
|
media?: {
|
|
524
|
-
type: "image" | "video";
|
|
524
|
+
type: "image" | "video" | "link";
|
|
525
525
|
url: string;
|
|
526
526
|
} | null;
|
|
527
527
|
score?: number;
|
|
@@ -622,21 +622,21 @@ declare function getPageMediaData(page: PageActivityWithId): {
|
|
|
622
622
|
mode: "single" | "media_area" | "none" | null;
|
|
623
623
|
singleMedia: {
|
|
624
624
|
rawObject: {
|
|
625
|
-
type: "image" | "video";
|
|
625
|
+
type: "image" | "video" | "link";
|
|
626
626
|
url: string;
|
|
627
627
|
};
|
|
628
|
-
type: "image" | "video";
|
|
628
|
+
type: "image" | "video" | "link";
|
|
629
629
|
content: string;
|
|
630
630
|
} | undefined;
|
|
631
631
|
isMediaPage: boolean;
|
|
632
|
-
hasMediaData: boolean;
|
|
632
|
+
hasMediaData: string | boolean;
|
|
633
633
|
};
|
|
634
634
|
declare function getSingleMediaPageData(page: PageActivityWithId): {
|
|
635
635
|
rawObject: {
|
|
636
|
-
type: "image" | "video";
|
|
636
|
+
type: "image" | "video" | "link";
|
|
637
637
|
url: string;
|
|
638
638
|
};
|
|
639
|
-
type: "image" | "video";
|
|
639
|
+
type: "image" | "video" | "link";
|
|
640
640
|
content: string;
|
|
641
641
|
} | undefined;
|
|
642
642
|
|
|
@@ -1373,7 +1373,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
|
|
|
1373
1373
|
media_area_layout?: "left" | "right" | null;
|
|
1374
1374
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1375
1375
|
media?: {
|
|
1376
|
-
type: "image" | "video";
|
|
1376
|
+
type: "image" | "video" | "link";
|
|
1377
1377
|
url: string;
|
|
1378
1378
|
} | null;
|
|
1379
1379
|
score?: number;
|
|
@@ -1448,7 +1448,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
|
|
|
1448
1448
|
media_area_layout?: "left" | "right" | null;
|
|
1449
1449
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1450
1450
|
media?: {
|
|
1451
|
-
type: "image" | "video";
|
|
1451
|
+
type: "image" | "video" | "link";
|
|
1452
1452
|
url: string;
|
|
1453
1453
|
} | null;
|
|
1454
1454
|
score?: number;
|
|
@@ -1706,7 +1706,7 @@ declare function useActivity({ id, isAssignment, onAssignmentSubmitted, ltiData,
|
|
|
1706
1706
|
media_area_layout?: "left" | "right" | null;
|
|
1707
1707
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
1708
1708
|
media?: {
|
|
1709
|
-
type: "image" | "video";
|
|
1709
|
+
type: "image" | "video" | "link";
|
|
1710
1710
|
url: string;
|
|
1711
1711
|
} | null;
|
|
1712
1712
|
score?: number;
|
|
@@ -3252,7 +3252,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3252
3252
|
media_area_layout?: "left" | "right" | null;
|
|
3253
3253
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
3254
3254
|
media?: {
|
|
3255
|
-
type: "image" | "video";
|
|
3255
|
+
type: "image" | "video" | "link";
|
|
3256
3256
|
url: string;
|
|
3257
3257
|
} | null;
|
|
3258
3258
|
score?: number;
|
|
@@ -3327,7 +3327,7 @@ declare const createFsClientNative: ({ db, httpsCallable, logEvent }: FsClientPa
|
|
|
3327
3327
|
media_area_layout?: "left" | "right" | null;
|
|
3328
3328
|
media_mode?: "single" | "media_area" | "none" | null;
|
|
3329
3329
|
media?: {
|
|
3330
|
-
type: "image" | "video";
|
|
3330
|
+
type: "image" | "video" | "link";
|
|
3331
3331
|
url: string;
|
|
3332
3332
|
} | null;
|
|
3333
3333
|
score?: number;
|
package/dist/index.native.js
CHANGED
|
@@ -2202,7 +2202,7 @@ function getPageMediaData(page) {
|
|
|
2202
2202
|
const { isMediaPage } = checkTypePageActivity(page.type);
|
|
2203
2203
|
const mode = (_b = page.media_mode) != null ? _b : page.media_area_id ? "media_area" : null;
|
|
2204
2204
|
const singleMedia = getSingleMediaPageData(page);
|
|
2205
|
-
const hasMediaData =
|
|
2205
|
+
const hasMediaData = !!page.media_area_id || page.media_area_context_ref || singleMedia !== void 0;
|
|
2206
2206
|
return {
|
|
2207
2207
|
direction,
|
|
2208
2208
|
mode,
|
|
@@ -3680,11 +3680,45 @@ var useBaseOpenAI = ({
|
|
|
3680
3680
|
throw new Error(error);
|
|
3681
3681
|
}
|
|
3682
3682
|
};
|
|
3683
|
-
const
|
|
3684
|
-
|
|
3683
|
+
const onGetGeminiFeedback = async ({
|
|
3684
|
+
cardId,
|
|
3685
|
+
studentId,
|
|
3686
|
+
studentResponse
|
|
3687
|
+
}) => {
|
|
3688
|
+
var _a, _b;
|
|
3685
3689
|
try {
|
|
3686
3690
|
const getGeminiFeedback = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "callGetFeedback");
|
|
3687
|
-
|
|
3691
|
+
return await (getGeminiFeedback == null ? void 0 : getGeminiFeedback({
|
|
3692
|
+
cardId,
|
|
3693
|
+
studentId,
|
|
3694
|
+
studentResponse
|
|
3695
|
+
}));
|
|
3696
|
+
} catch (error) {
|
|
3697
|
+
console.error("Error getting Gemini feedback:", error);
|
|
3698
|
+
return {};
|
|
3699
|
+
}
|
|
3700
|
+
};
|
|
3701
|
+
const onGetProficiencyEstimate = async ({
|
|
3702
|
+
cardId,
|
|
3703
|
+
studentId,
|
|
3704
|
+
studentResponse
|
|
3705
|
+
}) => {
|
|
3706
|
+
var _a, _b;
|
|
3707
|
+
try {
|
|
3708
|
+
const getProficiencyEstimate = (_b = (_a = api).httpsCallable) == null ? void 0 : _b.call(_a, "getProficiencyEstimate");
|
|
3709
|
+
return await (getProficiencyEstimate == null ? void 0 : getProficiencyEstimate({
|
|
3710
|
+
cardId,
|
|
3711
|
+
studentId,
|
|
3712
|
+
studentResponse
|
|
3713
|
+
}));
|
|
3714
|
+
} catch (error) {
|
|
3715
|
+
console.error("Error getting proficiency estimate:", error);
|
|
3716
|
+
return {};
|
|
3717
|
+
}
|
|
3718
|
+
};
|
|
3719
|
+
const getAIResponse = async ({ cardId, transcript }) => {
|
|
3720
|
+
var _a;
|
|
3721
|
+
try {
|
|
3688
3722
|
const card = getCardFromCache({
|
|
3689
3723
|
cardId,
|
|
3690
3724
|
queryClient
|
|
@@ -3694,12 +3728,12 @@ var useBaseOpenAI = ({
|
|
|
3694
3728
|
if (card && card.grading_method === "manual") {
|
|
3695
3729
|
} else if (card && card.grading_method !== "standards_based") {
|
|
3696
3730
|
const [geminiResult, proficiencyResult] = await Promise.all([
|
|
3697
|
-
|
|
3731
|
+
onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
|
|
3698
3732
|
cardId,
|
|
3699
3733
|
studentId: currentUserId,
|
|
3700
3734
|
studentResponse: transcript
|
|
3701
3735
|
}),
|
|
3702
|
-
|
|
3736
|
+
onGetProficiencyEstimate == null ? void 0 : onGetProficiencyEstimate({
|
|
3703
3737
|
cardId,
|
|
3704
3738
|
studentId: currentUserId,
|
|
3705
3739
|
studentResponse: transcript
|
|
@@ -3707,12 +3741,12 @@ var useBaseOpenAI = ({
|
|
|
3707
3741
|
]);
|
|
3708
3742
|
proficiencyData = (proficiencyResult == null ? void 0 : proficiencyResult.data) || {};
|
|
3709
3743
|
feedbackData = {
|
|
3710
|
-
...(
|
|
3744
|
+
...(_a = geminiResult == null ? void 0 : geminiResult.data) != null ? _a : {},
|
|
3711
3745
|
// @ts-ignore
|
|
3712
3746
|
proficiency_level: (proficiencyData == null ? void 0 : proficiencyData.proficiency_level) || null
|
|
3713
3747
|
};
|
|
3714
3748
|
} else {
|
|
3715
|
-
const geminiResult = await (
|
|
3749
|
+
const geminiResult = await (onGetGeminiFeedback == null ? void 0 : onGetGeminiFeedback({
|
|
3716
3750
|
cardId,
|
|
3717
3751
|
studentId: currentUserId,
|
|
3718
3752
|
studentResponse: transcript
|