@speakableio/core 0.1.98 → 0.1.100
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 +9 -1
- package/dist/index.native.d.ts +9 -1
- package/dist/index.native.js +20 -16
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +20 -16
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.web.d.mts +9 -1
- package/dist/index.web.js +20 -16
- package/dist/index.web.js.map +1 -1
- package/package.json +1 -1
package/dist/index.web.d.mts
CHANGED
|
@@ -151,6 +151,7 @@ interface PageActivity {
|
|
|
151
151
|
correct_answer?: string | null;
|
|
152
152
|
limit_attempts?: boolean;
|
|
153
153
|
max_attempts?: number;
|
|
154
|
+
rich_text?: string;
|
|
154
155
|
}
|
|
155
156
|
declare enum ActivityPageType {
|
|
156
157
|
READ_REPEAT = "READ_REPEAT",
|
|
@@ -271,6 +272,7 @@ declare function useCreateCards(): {
|
|
|
271
272
|
correct_answer?: string | null;
|
|
272
273
|
limit_attempts?: boolean;
|
|
273
274
|
max_attempts?: number;
|
|
275
|
+
rich_text?: string;
|
|
274
276
|
}[], Error, {
|
|
275
277
|
cards: PageActivity[];
|
|
276
278
|
}, unknown>;
|
|
@@ -362,6 +364,7 @@ declare const createCardRepo: () => {
|
|
|
362
364
|
correct_answer?: string | null;
|
|
363
365
|
limit_attempts?: boolean;
|
|
364
366
|
max_attempts?: number;
|
|
367
|
+
rich_text?: string;
|
|
365
368
|
}[]>;
|
|
366
369
|
getCard: (params: {
|
|
367
370
|
cardId: string;
|
|
@@ -387,7 +390,9 @@ declare const checkTypePageActivity: (cardType: ActivityPageType | undefined) =>
|
|
|
387
390
|
|
|
388
391
|
declare function getPagePrompt(card: PageActivityWithId | undefined): {
|
|
389
392
|
has: boolean;
|
|
390
|
-
text: string
|
|
393
|
+
text: string;
|
|
394
|
+
rich_text: string;
|
|
395
|
+
isTextEqualToRichText: boolean;
|
|
391
396
|
};
|
|
392
397
|
|
|
393
398
|
declare const getTotalCompletedCards: (pageScores: Score["cards"] | undefined) => number;
|
|
@@ -562,6 +567,7 @@ interface PageScore {
|
|
|
562
567
|
description: string;
|
|
563
568
|
}[];
|
|
564
569
|
target_proficiency_level?: string;
|
|
570
|
+
hint?: string[];
|
|
565
571
|
}
|
|
566
572
|
|
|
567
573
|
declare enum AssignmentAnalyticsType {
|
|
@@ -1141,6 +1147,7 @@ declare function createFsClientBase({ db, helpers, httpsCallable, logEvent, }: {
|
|
|
1141
1147
|
correct_answer?: string | null;
|
|
1142
1148
|
limit_attempts?: boolean;
|
|
1143
1149
|
max_attempts?: number;
|
|
1150
|
+
rich_text?: string;
|
|
1144
1151
|
}[]>;
|
|
1145
1152
|
getCard: (params: {
|
|
1146
1153
|
cardId: string;
|
|
@@ -2816,6 +2823,7 @@ declare const createFsClientWeb: ({ db, httpsCallable, logEvent }: FsClientParam
|
|
|
2816
2823
|
correct_answer?: string | null;
|
|
2817
2824
|
limit_attempts?: boolean;
|
|
2818
2825
|
max_attempts?: number;
|
|
2826
|
+
rich_text?: string;
|
|
2819
2827
|
}[]>;
|
|
2820
2828
|
getCard: (params: {
|
|
2821
2829
|
cardId: string;
|
package/dist/index.web.js
CHANGED
|
@@ -1885,37 +1885,41 @@ var checkTypePageActivity = (cardType) => {
|
|
|
1885
1885
|
};
|
|
1886
1886
|
|
|
1887
1887
|
// src/domains/cards/utils/get-page-prompt.ts
|
|
1888
|
+
function extractTextFromRichText(richText) {
|
|
1889
|
+
if (!richText) return "";
|
|
1890
|
+
return richText.replace(/<[^>]*>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").trim();
|
|
1891
|
+
}
|
|
1888
1892
|
function getPagePrompt(card) {
|
|
1889
|
-
if (!card) return { has: false, text: "" };
|
|
1893
|
+
if (!card) return { has: false, text: "", rich_text: "", isTextEqualToRichText: false };
|
|
1890
1894
|
const { isMC, isRepeat, isRespond, isShortAnswer } = checkTypePageActivity(card == null ? void 0 : card.type);
|
|
1891
1895
|
const hidePrompt = (card == null ? void 0 : card.hidePrompt) === true;
|
|
1892
|
-
|
|
1896
|
+
const createReturnObject = (text, richText) => {
|
|
1897
|
+
const plainText = text || "";
|
|
1898
|
+
const richTextPlain = extractTextFromRichText(richText);
|
|
1893
1899
|
return {
|
|
1894
1900
|
has: true,
|
|
1895
|
-
text:
|
|
1901
|
+
text: plainText,
|
|
1902
|
+
rich_text: richText || "",
|
|
1903
|
+
isTextEqualToRichText: plainText.trim() === richTextPlain.trim()
|
|
1896
1904
|
};
|
|
1905
|
+
};
|
|
1906
|
+
if (isRepeat) {
|
|
1907
|
+
return createReturnObject(card == null ? void 0 : card.target_text, card == null ? void 0 : card.rich_text);
|
|
1897
1908
|
}
|
|
1898
1909
|
if (isRespond && !hidePrompt) {
|
|
1899
|
-
return
|
|
1900
|
-
has: true,
|
|
1901
|
-
text: card == null ? void 0 : card.prompt
|
|
1902
|
-
};
|
|
1910
|
+
return createReturnObject(card == null ? void 0 : card.prompt, card == null ? void 0 : card.rich_text);
|
|
1903
1911
|
}
|
|
1904
1912
|
if (isMC) {
|
|
1905
|
-
return
|
|
1906
|
-
has: true,
|
|
1907
|
-
text: card == null ? void 0 : card.question
|
|
1908
|
-
};
|
|
1913
|
+
return createReturnObject(card == null ? void 0 : card.question, card == null ? void 0 : card.rich_text);
|
|
1909
1914
|
}
|
|
1910
1915
|
if (isShortAnswer && !hidePrompt) {
|
|
1911
|
-
return
|
|
1912
|
-
has: true,
|
|
1913
|
-
text: card == null ? void 0 : card.prompt
|
|
1914
|
-
};
|
|
1916
|
+
return createReturnObject(card == null ? void 0 : card.prompt, card == null ? void 0 : card.rich_text);
|
|
1915
1917
|
}
|
|
1916
1918
|
return {
|
|
1917
1919
|
has: false,
|
|
1918
|
-
text: ""
|
|
1920
|
+
text: "",
|
|
1921
|
+
rich_text: "",
|
|
1922
|
+
isTextEqualToRichText: false
|
|
1919
1923
|
};
|
|
1920
1924
|
}
|
|
1921
1925
|
|