@speakableio/core 0.1.9 → 0.1.10
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.js +9 -10
- package/dist/index.mjs +1 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55,8 +55,7 @@ var FirebaseAPI = class _FirebaseAPI {
|
|
|
55
55
|
return this.config.helpers;
|
|
56
56
|
}
|
|
57
57
|
httpsCallable(functionName) {
|
|
58
|
-
|
|
59
|
-
return this.config.httpsCallable(functionName);
|
|
58
|
+
return _optionalChain([this, 'access', _ => _.config, 'optionalAccess', _2 => _2.httpsCallable, 'call', _3 => _3(functionName)]);
|
|
60
59
|
}
|
|
61
60
|
accessQueryConstraints() {
|
|
62
61
|
const { query, orderBy, limit, startAt, startAfter, endAt, endBefore } = this.helpers;
|
|
@@ -496,7 +495,7 @@ var purify = (word) => {
|
|
|
496
495
|
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();
|
|
497
496
|
};
|
|
498
497
|
var cleanString = (words) => {
|
|
499
|
-
const splitWords = _optionalChain([words, 'optionalAccess',
|
|
498
|
+
const splitWords = _optionalChain([words, 'optionalAccess', _4 => _4.split, 'call', _5 => _5("+")]);
|
|
500
499
|
if (splitWords && splitWords.length === 1) {
|
|
501
500
|
const newWord = purify(words);
|
|
502
501
|
return newWord;
|
|
@@ -516,7 +515,7 @@ var getWordHash = (word, language) => {
|
|
|
516
515
|
// src/domains/cards/services/get-card-verification-status.service.ts
|
|
517
516
|
var charactarLanguages = ["zh", "ja", "ko"];
|
|
518
517
|
var getVerificationStatus = async (target_text, language) => {
|
|
519
|
-
if (_optionalChain([target_text, 'optionalAccess',
|
|
518
|
+
if (_optionalChain([target_text, 'optionalAccess', _6 => _6.length]) < 3 && !charactarLanguages.includes(language)) {
|
|
520
519
|
return "NOT_RECOMMENDED" /* NOT_RECOMMENDED */;
|
|
521
520
|
}
|
|
522
521
|
const hash = getWordHash(target_text, language);
|
|
@@ -834,7 +833,7 @@ var createNewAssignmentNotification = async ({
|
|
|
834
833
|
link: `${WEB_BASE_URL}/assignment/${assignment.id}`,
|
|
835
834
|
messagePreview: `A new assignment "${assignment.name}" is now available. ${dueDate ? `Due ${dueDate}` : ""}`,
|
|
836
835
|
title: "New Assignment Available!",
|
|
837
|
-
imageUrl: _optionalChain([profile, 'access',
|
|
836
|
+
imageUrl: _optionalChain([profile, 'access', _7 => _7.image, 'optionalAccess', _8 => _8.url])
|
|
838
837
|
});
|
|
839
838
|
return results;
|
|
840
839
|
};
|
|
@@ -851,7 +850,7 @@ var createAssessmentSubmissionNotification = async ({
|
|
|
851
850
|
title: `Assessment Submitted!`,
|
|
852
851
|
senderName: studentName,
|
|
853
852
|
messagePreview: `${studentName} has submitted the assessment "${assignment.name}"`,
|
|
854
|
-
imageUrl: _optionalChain([profile, 'access',
|
|
853
|
+
imageUrl: _optionalChain([profile, 'access', _9 => _9.image, 'optionalAccess', _10 => _10.url])
|
|
855
854
|
});
|
|
856
855
|
return results;
|
|
857
856
|
};
|
|
@@ -869,13 +868,13 @@ var createAssessmentScoredNotification = async ({
|
|
|
869
868
|
link: `${WEB_BASE_URL}/assignment/${assignment.id}`,
|
|
870
869
|
title,
|
|
871
870
|
messagePreview,
|
|
872
|
-
imageUrl: _optionalChain([profile, 'access',
|
|
871
|
+
imageUrl: _optionalChain([profile, 'access', _11 => _11.image, 'optionalAccess', _12 => _12.url]),
|
|
873
872
|
senderName: teacherName
|
|
874
873
|
});
|
|
875
874
|
await SpeakableFirebaseFunctions.sendAssessmentScoredEmail({
|
|
876
875
|
assessmentTitle: assignment.name,
|
|
877
876
|
link: `${WEB_BASE_URL}/assignment/${assignment.id}`,
|
|
878
|
-
senderImage: _optionalChain([profile, 'access',
|
|
877
|
+
senderImage: _optionalChain([profile, 'access', _13 => _13.image, 'optionalAccess', _14 => _14.url]) || "",
|
|
879
878
|
studentId: sendTo[0],
|
|
880
879
|
teacherName: profile.displayName
|
|
881
880
|
});
|
|
@@ -893,11 +892,11 @@ var useCreateNotification = () => {
|
|
|
893
892
|
const result = await createNotification({
|
|
894
893
|
type,
|
|
895
894
|
userId: user.auth.uid,
|
|
896
|
-
profile: _nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
895
|
+
profile: _nullishCoalesce(_optionalChain([user, 'optionalAccess', _15 => _15.profile]), () => ( {})),
|
|
897
896
|
data
|
|
898
897
|
});
|
|
899
898
|
queryClient.invalidateQueries({
|
|
900
|
-
queryKey: notificationQueryKeys.byId(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
899
|
+
queryKey: notificationQueryKeys.byId(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _16 => _16.auth, 'access', _17 => _17.uid]), () => ( "")))
|
|
901
900
|
});
|
|
902
901
|
return result;
|
|
903
902
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -55,8 +55,7 @@ var FirebaseAPI = class _FirebaseAPI {
|
|
|
55
55
|
return this.config.helpers;
|
|
56
56
|
}
|
|
57
57
|
httpsCallable(functionName) {
|
|
58
|
-
|
|
59
|
-
return this.config.httpsCallable(functionName);
|
|
58
|
+
return this.config?.httpsCallable(functionName);
|
|
60
59
|
}
|
|
61
60
|
accessQueryConstraints() {
|
|
62
61
|
const { query, orderBy, limit, startAt, startAfter, endAt, endBefore } = this.helpers;
|