waha-shared 1.0.306 → 1.0.307
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/data/areas/areas.json +50 -48
- package/dist/data/areas/areas.schema.json +2 -2
- package/dist/data/areas/areas.zod.d.ts +1 -1
- package/dist/data/areas/areas.zod.js +1 -1
- package/dist/data/areas/index.d.ts +1 -1
- package/dist/data/bibleAudios/bibleAudios.json +581 -314
- package/dist/data/bibleAudios/bibleAudios.schema.json +17 -8
- package/dist/data/bibleAudios/bibleAudios.zod.d.ts +43 -2
- package/dist/data/bibleAudios/bibleAudios.zod.js +16 -7
- package/dist/data/bibleAudios/index.d.ts +2 -1
- package/dist/data/bibleBooks/bibleBooks.json +792 -790
- package/dist/data/bibleStatuses/bibleStatuses.json +7981 -8480
- package/dist/data/bibleStatuses/bibleStatuses.schema.json +6 -0
- package/dist/data/bibleStatuses/bibleStatuses.zod.d.ts +1 -0
- package/dist/data/bibleStatuses/bibleStatuses.zod.js +4 -0
- package/dist/data/bibleStatuses/index.d.ts +1 -0
- package/dist/data/bibleTexts/bibleTexts.json +269 -184
- package/dist/data/bibleTexts/bibleTexts.schema.json +7 -0
- package/dist/data/bibleTexts/bibleTexts.zod.d.ts +28 -0
- package/dist/data/bibleTexts/bibleTexts.zod.js +10 -3
- package/dist/data/bibleTexts/index.d.ts +2 -0
- package/dist/data/clones/clones.json +2 -0
- package/dist/data/countries/countries.json +480 -480
- package/dist/data/countriesAndLanguages/countriesAndLanguages.json +6812 -6810
- package/dist/data/crowdinLanguages/crowdinLanguages.json +1440 -1438
- package/dist/data/crowdinLanguages/crowdinLanguages.schema.json +3 -3
- package/dist/data/crowdinLanguages/crowdinLanguages.zod.d.ts +2 -2
- package/dist/data/crowdinLanguages/crowdinLanguages.zod.js +2 -2
- package/dist/data/crowdinLanguages/index.d.ts +2 -2
- package/dist/data/curriculumFoundations/curriculumFoundations.json +86 -69
- package/dist/data/curriculumQuestions/curriculumQuestions.json +194 -192
- package/dist/data/curriculumTopics/curriculumTopics.json +51 -8
- package/dist/data/dblAudioLicenses/dblAudioLicenses.json +36 -7
- package/dist/data/dblTextLicenses/dblTextLicenses.json +4 -4
- package/dist/data/firebase.d.ts +1 -0
- package/dist/data/firebase.js +4 -0
- package/dist/data/iosVoiceOverLanguages/iosVoiceOverLanguages.json +1 -1
- package/dist/data/iso6933LanguageCodes/iso6933LanguageCodes.json +1 -1
- package/dist/data/languages/index.d.ts +20 -10
- package/dist/data/languages/languages.json +2983 -2008
- package/dist/data/languages/languages.schema.json +93 -47
- package/dist/data/languages/languages.zod.d.ts +93 -30
- package/dist/data/languages/languages.zod.js +59 -37
- package/dist/data/lessonPauses/index.d.ts +0 -1
- package/dist/data/lessonPauses/lessonPauses.json +2 -3
- package/dist/data/lessonPauses/lessonPauses.schema.json +1 -11
- package/dist/data/lessonPauses/lessonPauses.zod.d.ts +0 -1
- package/dist/data/lessonPauses/lessonPauses.zod.js +0 -3
- package/dist/data/mediaDurations/mediaDurations.json +35291 -6076
- package/dist/data/mediaDurations/mediaDurations.schema.json +1 -1
- package/dist/data/mediaDurations/mediaDurations.zod.js +1 -1
- package/dist/data/notification/index.d.ts +1 -1
- package/dist/data/notification/notification.json +93 -169
- package/dist/data/phoneLanguages/phoneLanguages.json +637 -635
- package/dist/data/questions/questions.json +149 -147
- package/dist/data/releaseNotes/releaseNotes.json +126 -124
- package/dist/data/screenshots/screenshots.json +1 -1
- package/dist/data/scripts/scripts.json +6 -1
- package/dist/data/sets/index.d.ts +3 -3
- package/dist/data/sets/sets.json +1770 -480
- package/dist/data/sets/sets.schema.json +1 -1
- package/dist/data/sets/sets.zod.d.ts +3 -3
- package/dist/data/sets/sets.zod.js +3 -6
- package/dist/data/translationsApp/index.d.ts +1 -0
- package/dist/data/translationsApp/translationsApp.json +1776 -1568
- package/dist/data/translationsApp/translationsApp.schema.json +1 -0
- package/dist/data/translationsApp/translationsApp.zod.d.ts +2 -0
- package/dist/data/translationsApp/translationsApp.zod.js +1 -0
- package/dist/data/translationsFtb/translationsFtb.json +120 -664
- package/dist/data/translationsIntroduction/translationsIntroduction.json +1 -1
- package/dist/data/translationsQuestion/translationsQuestion.json +65 -33
- package/dist/data/translationsSet/translationsSet.json +30155 -19418
- package/dist/data/translationsSet/translationsSet.schema.json +3 -4
- package/dist/data/translationsSet/translationsSet.zod.js +4 -4
- package/dist/data/translationsSolarSpeaker/translationsSolarSpeaker.json +1 -1
- package/dist/data/translationsSpokenQuestion/translationsSpokenQuestion.json +65 -33
- package/dist/data/youtubePlaylists/youtubePlaylists.json +10 -10
- package/dist/data/youtubeVideos/youtubeVideos.json +82 -82
- package/dist/functions/bibleBooks.d.ts +16 -0
- package/dist/functions/bibleBooks.js +101 -0
- package/dist/functions/bibles.d.ts +44 -0
- package/dist/functions/bibles.js +291 -0
- package/dist/functions/languages.d.ts +6 -7
- package/dist/functions/languages.js +51 -53
- package/dist/functions/scripturePassages.d.ts +34 -49
- package/dist/functions/scripturePassages.js +167 -304
- package/dist/functions/sets.d.ts +13 -52
- package/dist/functions/sets.js +193 -205
- package/dist/functions/utils.d.ts +2 -0
- package/dist/functions/utils.js +8 -0
- package/dist/types/bibleChapters.d.ts +2 -2
- package/dist/types/bibleChapters.js +1 -1
- package/dist/types/languages.d.ts +39 -9
- package/dist/types/languages.js +2 -0
- package/dist/types/sets.d.ts +21 -11
- package/package.json +1 -1
- package/dist/data/languageAssets/index.d.ts +0 -1
- package/dist/data/languageAssets/index.js +0 -7
- package/dist/data/languageAssets/languageAssets.json +0 -45406
- package/dist/data/languageAssets/languageAssets.schema.json +0 -19
- package/dist/data/languageAssets/languageAssets.zod.d.ts +0 -3
- package/dist/data/languageAssets/languageAssets.zod.js +0 -7
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OLD_TESTAMENT_BOOKS = exports.NEW_TESTAMENT_BOOKS = exports.OPTIONAL_CHAPTERS = void 0;
|
|
4
|
+
exports.getBibleInfo = getBibleInfo;
|
|
5
|
+
exports.replaceBibleWith = replaceBibleWith;
|
|
6
|
+
exports.shouldConcatBibleWith = shouldConcatBibleWith;
|
|
7
|
+
exports.getAllBibleIds = getAllBibleIds;
|
|
8
|
+
exports.getAvailableChapters = getAvailableChapters;
|
|
9
|
+
exports.getPercentage = getPercentage;
|
|
10
|
+
exports.getBibleForPassage = getBibleForPassage;
|
|
11
|
+
const bibleAudios_1 = require("../data/bibleAudios");
|
|
12
|
+
const bibleChaptersList_1 = require("../data/bibleChaptersList");
|
|
13
|
+
const bibleStatuses_1 = require("../data/bibleStatuses");
|
|
14
|
+
const bibleTexts_1 = require("../data/bibleTexts");
|
|
15
|
+
const languages_1 = require("../data/languages");
|
|
16
|
+
const scripts_1 = require("../data/scripts");
|
|
17
|
+
const bibleBooks_1 = require("./bibleBooks");
|
|
18
|
+
const bibleInfoCache = new Map();
|
|
19
|
+
function getBibleInfo(bibleId) {
|
|
20
|
+
const cached = bibleInfoCache.get(bibleId);
|
|
21
|
+
if (cached !== undefined)
|
|
22
|
+
return cached;
|
|
23
|
+
if (bibleInfoCache.has(bibleId))
|
|
24
|
+
return undefined;
|
|
25
|
+
const bibleStatus = bibleStatuses_1.bibleStatuses[bibleId];
|
|
26
|
+
if (!bibleStatus) {
|
|
27
|
+
bibleInfoCache.set(bibleId, undefined);
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const bibleText = bibleTexts_1.bibleTexts.find((t) => t.bibleTextId === bibleId);
|
|
31
|
+
const bibleAudio = bibleAudios_1.bibleAudios.find((t) => t.bibleAudioId === bibleText?.audioId ||
|
|
32
|
+
t.bibleAudioId === bibleText?.bibleTextId);
|
|
33
|
+
const language = languages_1.languages.find((l) => l.languageId === bibleText?.languageId);
|
|
34
|
+
const script = scripts_1.scripts.find((s) => s.name === language?.script) ?? scripts_1.scripts[0];
|
|
35
|
+
const result = bibleText && bibleAudio && language
|
|
36
|
+
? {
|
|
37
|
+
...bibleText,
|
|
38
|
+
...bibleAudio,
|
|
39
|
+
language,
|
|
40
|
+
script,
|
|
41
|
+
availableTextChapters: getAvailableChapters(bibleText.bibleTextId, 'text'),
|
|
42
|
+
availableAudioChapters: getAvailableChapters(bibleAudio.bibleAudioId, 'audio'),
|
|
43
|
+
availableTimingsChapters: getAvailableChapters(bibleAudio.bibleAudioId, 'timings'),
|
|
44
|
+
bookNames: {
|
|
45
|
+
...(bibleText.bookNameFallback
|
|
46
|
+
? (bibleStatuses_1.bibleStatuses[bibleText.bookNameFallback]?.bookNames ?? {})
|
|
47
|
+
: {}),
|
|
48
|
+
...bibleStatus.bookNames,
|
|
49
|
+
},
|
|
50
|
+
fullCopyright: (bibleText.copyright ?? '') + '\n\n' + (bibleAudio.copyright ?? ''),
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
bibleInfoCache.set(bibleId, result);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
function replaceBibleWith({ modifiers, lessonCategory, passageId, }) {
|
|
57
|
+
for (const modifier of modifiers) {
|
|
58
|
+
if (modifier.action === 'concat')
|
|
59
|
+
continue;
|
|
60
|
+
/**
|
|
61
|
+
* If our modifier matches the lesson category or passage testament, then we
|
|
62
|
+
* want to replace the bible id.
|
|
63
|
+
*/
|
|
64
|
+
if (modifier.scope === lessonCategory ||
|
|
65
|
+
modifier.scope === (0, bibleBooks_1.parseVerseRange)(passageId).testament)
|
|
66
|
+
return modifier.bibleId;
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
/** Determines whether a lesson/passage meet the requirements for concatenating. */
|
|
71
|
+
function shouldConcatBibleWith({ modifier, lessonCategory, passageId, }) {
|
|
72
|
+
if (modifier.action === 'replace')
|
|
73
|
+
return false;
|
|
74
|
+
/**
|
|
75
|
+
* If our modifier matches the lesson category or passage testament, then we
|
|
76
|
+
* are good to concat.
|
|
77
|
+
*/
|
|
78
|
+
if (modifier.scope === lessonCategory ||
|
|
79
|
+
modifier.scope === (0, bibleBooks_1.parseVerseRange)(passageId).testament)
|
|
80
|
+
return true;
|
|
81
|
+
else
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
/** Returns a deduplicated list of all bible IDs referenced by a language. */
|
|
85
|
+
function getAllBibleIds(language) {
|
|
86
|
+
const ids = new Set();
|
|
87
|
+
if (typeof language.bible === 'object')
|
|
88
|
+
ids.add(language.bible.bibleTextId);
|
|
89
|
+
else if (language.bible)
|
|
90
|
+
ids.add(language.bible);
|
|
91
|
+
for (const fallback of language.bibleFallbacks ?? []) {
|
|
92
|
+
if (typeof fallback === 'object')
|
|
93
|
+
ids.add(fallback.bibleTextId);
|
|
94
|
+
else
|
|
95
|
+
ids.add(fallback);
|
|
96
|
+
}
|
|
97
|
+
for (const modifier of language.bibleModifiers ?? []) {
|
|
98
|
+
ids.add(modifier.bibleId);
|
|
99
|
+
}
|
|
100
|
+
return [...ids];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Chapters that can be missing without affecting book/testament completeness.
|
|
104
|
+
* MAL.4 is optional because the Hebrew Bible includes its content within
|
|
105
|
+
* MAL.3.
|
|
106
|
+
*/
|
|
107
|
+
exports.OPTIONAL_CHAPTERS = new Set(['MAL.4']);
|
|
108
|
+
var bibleBooks_2 = require("./bibleBooks");
|
|
109
|
+
Object.defineProperty(exports, "NEW_TESTAMENT_BOOKS", { enumerable: true, get: function () { return bibleBooks_2.NEW_TESTAMENT_BOOKS; } });
|
|
110
|
+
Object.defineProperty(exports, "OLD_TESTAMENT_BOOKS", { enumerable: true, get: function () { return bibleBooks_2.OLD_TESTAMENT_BOOKS; } });
|
|
111
|
+
const bookLengths = new Map([
|
|
112
|
+
['GEN', 50],
|
|
113
|
+
['EXO', 40],
|
|
114
|
+
['LEV', 27],
|
|
115
|
+
['NUM', 36],
|
|
116
|
+
['DEU', 34],
|
|
117
|
+
['JOS', 24],
|
|
118
|
+
['JDG', 21],
|
|
119
|
+
['RUT', 4],
|
|
120
|
+
['1SA', 31],
|
|
121
|
+
['2SA', 24],
|
|
122
|
+
['1KI', 22],
|
|
123
|
+
['2KI', 25],
|
|
124
|
+
['1CH', 29],
|
|
125
|
+
['2CH', 36],
|
|
126
|
+
['EZR', 10],
|
|
127
|
+
['NEH', 13],
|
|
128
|
+
['EST', 10],
|
|
129
|
+
['JOB', 42],
|
|
130
|
+
['PSA', 150],
|
|
131
|
+
['PRO', 31],
|
|
132
|
+
['ECC', 12],
|
|
133
|
+
['SNG', 8],
|
|
134
|
+
['ISA', 66],
|
|
135
|
+
['JER', 52],
|
|
136
|
+
['LAM', 5],
|
|
137
|
+
['EZK', 48],
|
|
138
|
+
['DAN', 12],
|
|
139
|
+
['HOS', 14],
|
|
140
|
+
['JOL', 3],
|
|
141
|
+
['AMO', 9],
|
|
142
|
+
['OBA', 1],
|
|
143
|
+
['JON', 4],
|
|
144
|
+
['MIC', 7],
|
|
145
|
+
['NAM', 3],
|
|
146
|
+
['HAB', 3],
|
|
147
|
+
['ZEP', 3],
|
|
148
|
+
['HAG', 2],
|
|
149
|
+
['ZEC', 14],
|
|
150
|
+
['MAL', 3],
|
|
151
|
+
['MAT', 28],
|
|
152
|
+
['MRK', 16],
|
|
153
|
+
['LUK', 24],
|
|
154
|
+
['JHN', 21],
|
|
155
|
+
['ACT', 28],
|
|
156
|
+
['ROM', 16],
|
|
157
|
+
['1CO', 16],
|
|
158
|
+
['2CO', 13],
|
|
159
|
+
['GAL', 6],
|
|
160
|
+
['EPH', 6],
|
|
161
|
+
['PHP', 4],
|
|
162
|
+
['COL', 4],
|
|
163
|
+
['1TH', 5],
|
|
164
|
+
['2TH', 3],
|
|
165
|
+
['1TI', 6],
|
|
166
|
+
['2TI', 4],
|
|
167
|
+
['TIT', 3],
|
|
168
|
+
['PHM', 1],
|
|
169
|
+
['HEB', 13],
|
|
170
|
+
['JAS', 5],
|
|
171
|
+
['1PE', 5],
|
|
172
|
+
['2PE', 3],
|
|
173
|
+
['1JN', 5],
|
|
174
|
+
['2JN', 1],
|
|
175
|
+
['3JN', 1],
|
|
176
|
+
['JUD', 1],
|
|
177
|
+
['REV', 22],
|
|
178
|
+
]);
|
|
179
|
+
/**
|
|
180
|
+
* Expands an optimized chapter list back to individual chapters Converts book
|
|
181
|
+
* names (e.g., "GEN") back to all chapters (e.g., ["GEN.1", "GEN.2", ..."])
|
|
182
|
+
* Converts testament names ("OT", "NT") back to all chapters in that testament
|
|
183
|
+
* Leaves individual chapters unchanged
|
|
184
|
+
*
|
|
185
|
+
* @param optimizedChapters - Array that may contain testament IDs, book IDs, or
|
|
186
|
+
* chapter IDs
|
|
187
|
+
* @returns Array of individual chapter IDs in canonical order
|
|
188
|
+
*/
|
|
189
|
+
function getAvailableChapters(bibleId, type) {
|
|
190
|
+
if (!bibleId)
|
|
191
|
+
return [];
|
|
192
|
+
const optimizedChapters = bibleStatuses_1.bibleStatuses[bibleId]?.[type] || [];
|
|
193
|
+
if (optimizedChapters.length === 0)
|
|
194
|
+
return [];
|
|
195
|
+
// Build a Set of included items for O(1) lookup
|
|
196
|
+
const includedSet = new Set(optimizedChapters);
|
|
197
|
+
// Check if we need OT/NT expansion
|
|
198
|
+
const hasOT = includedSet.has('OT');
|
|
199
|
+
const hasNT = includedSet.has('NT');
|
|
200
|
+
// If we have both OT and NT, return all chapters but exclude optional
|
|
201
|
+
// chapters unless they are explicitly listed in the optimized list
|
|
202
|
+
if (hasOT && hasNT) {
|
|
203
|
+
return bibleChaptersList_1.bibleChaptersList.filter((c) => !exports.OPTIONAL_CHAPTERS.has(c) || includedSet.has(c));
|
|
204
|
+
}
|
|
205
|
+
// Pre-calculate which books to include
|
|
206
|
+
const includedBooks = new Set();
|
|
207
|
+
if (hasOT) {
|
|
208
|
+
bibleBooks_1.OLD_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book));
|
|
209
|
+
}
|
|
210
|
+
if (hasNT) {
|
|
211
|
+
bibleBooks_1.NEW_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book));
|
|
212
|
+
}
|
|
213
|
+
// Add individual books from the optimized list
|
|
214
|
+
for (const entry of optimizedChapters) {
|
|
215
|
+
if (entry !== 'OT' && entry !== 'NT' && !entry.includes('.')) {
|
|
216
|
+
includedBooks.add(entry);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Filter bibleChaptersList to only include relevant chapters
|
|
220
|
+
// This maintains canonical order without needing to sort
|
|
221
|
+
const result = [];
|
|
222
|
+
for (const chapter of bibleChaptersList_1.bibleChaptersList) {
|
|
223
|
+
// Check if this specific chapter is included
|
|
224
|
+
if (includedSet.has(chapter)) {
|
|
225
|
+
result.push(chapter);
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// Skip optional chapters unless explicitly listed
|
|
229
|
+
if (exports.OPTIONAL_CHAPTERS.has(chapter))
|
|
230
|
+
continue;
|
|
231
|
+
// Check if this chapter's book is included
|
|
232
|
+
const bookId = chapter.split('.')[0];
|
|
233
|
+
if (includedBooks.has(bookId)) {
|
|
234
|
+
result.push(chapter);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
function getPercentage(bibleId, type) {
|
|
240
|
+
const optimizedChapters = bibleStatuses_1.bibleStatuses[bibleId]?.[type] || [];
|
|
241
|
+
let total = 0;
|
|
242
|
+
optimizedChapters.forEach((entry) => {
|
|
243
|
+
if (entry === 'OT') {
|
|
244
|
+
// All Old Testament books (excluding optional chapters like MAL.4)
|
|
245
|
+
total += 928;
|
|
246
|
+
}
|
|
247
|
+
else if (entry === 'NT') {
|
|
248
|
+
// All New Testament books
|
|
249
|
+
total += 260;
|
|
250
|
+
}
|
|
251
|
+
else if (entry.includes('.')) {
|
|
252
|
+
// It's already a chapter ID, count as 1
|
|
253
|
+
total += 1;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
// It's a book ID, add its chapter count
|
|
257
|
+
total += bookLengths.get(entry) || 0;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
return (total / 1188) * 100;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Determines the appropriate bible for a given passage based on the language's
|
|
264
|
+
* bible, bible modifiers, and fallback bible.
|
|
265
|
+
*/
|
|
266
|
+
function getBibleForPassage({ languageInfo, lessonCategory, passageId, }) {
|
|
267
|
+
let bibleId = replaceBibleWith({
|
|
268
|
+
modifiers: languageInfo.bibleModifiers ?? [],
|
|
269
|
+
lessonCategory,
|
|
270
|
+
passageId,
|
|
271
|
+
}) ?? languageInfo.bible.bibleTextId;
|
|
272
|
+
const passageInfo = (0, bibleBooks_1.parseVerseRange)(passageId);
|
|
273
|
+
const bibleInfo = getBibleInfo(bibleId);
|
|
274
|
+
/**
|
|
275
|
+
* A bible can provide a passage either via full chapter audio (we'll extract
|
|
276
|
+
* the verse range using timings) or via a custom recording keyed by the exact
|
|
277
|
+
* passageId. The latter is essential for bibles like WAHA_QAK that have no
|
|
278
|
+
* chapter audio at all and only ship hand-recorded passages.
|
|
279
|
+
*/
|
|
280
|
+
const hasPassage = (id, info) => info.availableAudioChapters.includes(passageInfo.chapterId) ||
|
|
281
|
+
bibleStatuses_1.bibleStatuses[id]?.customPassages?.[passageId] !== undefined;
|
|
282
|
+
if (bibleInfo && !hasPassage(bibleId, bibleInfo)) {
|
|
283
|
+
for (const fallback of languageInfo.bibleFallbacks) {
|
|
284
|
+
if (hasPassage(fallback.bibleTextId, fallback)) {
|
|
285
|
+
bibleId = fallback.bibleTextId;
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return bibleId;
|
|
291
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Language } from '../data/languages/languages.zod';
|
|
2
2
|
import type { TranslationsApp } from '../data/translationsApp/translationsApp.zod';
|
|
3
|
-
import type {
|
|
4
|
-
export declare function getBibleInfo(bibleId: string | undefined): BibleInfo | undefined;
|
|
3
|
+
import type { LanguageInfo, MeetTranslations } from '../types/languages';
|
|
5
4
|
export declare function getLanguageInfo(languageId: string, options?: {
|
|
6
5
|
includeInProgressDmcSets?: boolean;
|
|
7
6
|
}): LanguageInfo;
|
|
8
|
-
export declare function getInitialAppInterfaceLanguage(userPhoneLanguages: Array<string | null>):
|
|
9
|
-
export declare function isLanguageAvailable(status:
|
|
10
|
-
export declare function numerals(text: string,
|
|
7
|
+
export declare function getInitialAppInterfaceLanguage(userPhoneLanguages: Array<string | null>): Language['languageId'];
|
|
8
|
+
export declare function isLanguageAvailable(status: Language['status'], isDev?: boolean): boolean;
|
|
9
|
+
export declare function numerals(text: string, scriptName: string): string;
|
|
11
10
|
/**
|
|
12
11
|
* These values are not the name of the font necessarily, but the identifier of
|
|
13
12
|
* the font which can be found by inspecting the font in an app like Font Book.
|
|
14
13
|
*/
|
|
15
|
-
export declare function getAppTranslations(appLanguageId
|
|
14
|
+
export declare function getAppTranslations(appLanguageId: string): TranslationsApp[string];
|
|
16
15
|
export declare function getMeetTranslations(meetLanguageInfo: LanguageInfo): MeetTranslations;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBibleInfo = getBibleInfo;
|
|
4
3
|
exports.getLanguageInfo = getLanguageInfo;
|
|
5
4
|
exports.getInitialAppInterfaceLanguage = getInitialAppInterfaceLanguage;
|
|
6
5
|
exports.isLanguageAvailable = isLanguageAvailable;
|
|
@@ -8,12 +7,12 @@ exports.numerals = numerals;
|
|
|
8
7
|
exports.getAppTranslations = getAppTranslations;
|
|
9
8
|
exports.getMeetTranslations = getMeetTranslations;
|
|
10
9
|
const bibleAudios_1 = require("../data/bibleAudios");
|
|
11
|
-
const bibleStatuses_1 = require("../data/bibleStatuses");
|
|
12
10
|
const bibleTexts_1 = require("../data/bibleTexts");
|
|
13
11
|
const curriculumFoundations_1 = require("../data/curriculumFoundations");
|
|
14
12
|
const curriculumQuestions_1 = require("../data/curriculumQuestions");
|
|
15
13
|
const curriculumTopics_1 = require("../data/curriculumTopics");
|
|
16
14
|
const languages_1 = require("../data/languages");
|
|
15
|
+
const lessonPauses_1 = require("../data/lessonPauses");
|
|
17
16
|
const numeralMaps_1 = require("../data/numeralMaps");
|
|
18
17
|
const phoneLanguages_1 = require("../data/phoneLanguages");
|
|
19
18
|
const scripts_1 = require("../data/scripts");
|
|
@@ -24,27 +23,7 @@ const translationsIntroduction_1 = require("../data/translationsIntroduction");
|
|
|
24
23
|
const translationsQuestion_1 = require("../data/translationsQuestion");
|
|
25
24
|
const translationsSet_1 = require("../data/translationsSet");
|
|
26
25
|
const translationsSpokenQuestion_1 = require("../data/translationsSpokenQuestion");
|
|
27
|
-
const
|
|
28
|
-
function getBibleInfo(bibleId) {
|
|
29
|
-
const bibleText = bibleTexts_1.bibleTexts.find((t) => t.bibleTextId === bibleId);
|
|
30
|
-
const bibleAudio = bibleAudios_1.bibleAudios.find((t) => t.bibleAudioId === bibleText?.audioId ||
|
|
31
|
-
t.bibleAudioId === bibleText?.bibleTextId);
|
|
32
|
-
const language = languages_1.languages.find((l) => l.languageId === bibleText?.languageId) ??
|
|
33
|
-
languages_1.languages[0];
|
|
34
|
-
const script = scripts_1.scripts.find((s) => s.name === language?.script) ?? scripts_1.scripts[0];
|
|
35
|
-
return bibleText && bibleAudio
|
|
36
|
-
? {
|
|
37
|
-
...bibleText,
|
|
38
|
-
...bibleAudio,
|
|
39
|
-
language,
|
|
40
|
-
script,
|
|
41
|
-
availableTextChapters: (0, bibleChapterUtils_1.getAvailableChapters)(bibleText.bibleTextId, 'text'),
|
|
42
|
-
availableAudioChapters: (0, bibleChapterUtils_1.getAvailableChapters)(bibleAudio.bibleAudioId, 'audio'),
|
|
43
|
-
bookNames: bibleStatuses_1.bibleStatuses[bibleText.bibleTextId]?.bookNames || {},
|
|
44
|
-
fullCopyright: (bibleText.copyright ?? '') + '\n\n' + (bibleAudio.copyright ?? ''),
|
|
45
|
-
}
|
|
46
|
-
: undefined;
|
|
47
|
-
}
|
|
26
|
+
const bibles_1 = require("./bibles");
|
|
48
27
|
function getLanguageInfo(languageId, options) {
|
|
49
28
|
const defaultReturn = {
|
|
50
29
|
...languages_1.languages[0],
|
|
@@ -55,14 +34,24 @@ function getLanguageInfo(languageId, options) {
|
|
|
55
34
|
...bibleAudios_1.bibleAudios[0],
|
|
56
35
|
availableTextChapters: [],
|
|
57
36
|
availableAudioChapters: [],
|
|
37
|
+
availableTimingsChapters: [],
|
|
58
38
|
language: languages_1.languages[0],
|
|
59
39
|
fullCopyright: '',
|
|
60
40
|
bookNames: {},
|
|
61
41
|
script: scripts_1.scripts[0],
|
|
62
42
|
},
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
bibleFallbacks: [],
|
|
44
|
+
contentLanguages: {
|
|
45
|
+
ftbs: 'eng',
|
|
46
|
+
intros: 'eng',
|
|
47
|
+
titles: 'eng',
|
|
48
|
+
trainingVideos: 'eng',
|
|
49
|
+
questionAudio: 'eng',
|
|
50
|
+
questionText: 'eng',
|
|
51
|
+
},
|
|
65
52
|
script: scripts_1.scripts[0],
|
|
53
|
+
lessonPauses: lessonPauses_1.lessonPauses,
|
|
54
|
+
allBibleIds: [],
|
|
66
55
|
};
|
|
67
56
|
const language = languages_1.languages.find((language) => language.languageId === languageId);
|
|
68
57
|
if (!language) {
|
|
@@ -77,34 +66,45 @@ function getLanguageInfo(languageId, options) {
|
|
|
77
66
|
const questionsCurriculum = curriculumQuestions_1.curriculumQuestions.find((questionCurriculum) => questionCurriculum.curriculumId === language.curriculum.questions);
|
|
78
67
|
const foundationsCurriculum = curriculumFoundations_1.curriculumFoundations.find((foundationsCurriculum) => foundationsCurriculum.curriculumId === language.curriculum.foundations);
|
|
79
68
|
const topicsCurriculum = curriculumTopics_1.curriculumTopics.find((topicsCurriculum) => topicsCurriculum.curriculumId === language?.curriculum.topics);
|
|
80
|
-
|
|
69
|
+
const setIds = [];
|
|
81
70
|
if (foundationsCurriculum)
|
|
82
71
|
setIds.push(...foundationsCurriculum.sets);
|
|
83
72
|
if (topicsCurriculum)
|
|
84
73
|
setIds.push(...topicsCurriculum.sets);
|
|
85
|
-
if (language.
|
|
86
|
-
language.
|
|
87
|
-
language.
|
|
88
|
-
(language.
|
|
74
|
+
if (language.status.trainingVideos === 'launched' ||
|
|
75
|
+
language.status.trainingVideos === 'testing' ||
|
|
76
|
+
language.bridgeLanguages?.trainingVideos ||
|
|
77
|
+
(language.status.trainingVideos === 'inProgress' &&
|
|
89
78
|
options?.includeInProgressDmcSets))
|
|
90
79
|
setIds.push(specialIds_1.specialIds.dmCourseSetId);
|
|
91
|
-
if (language.
|
|
92
|
-
language.
|
|
93
|
-
(language.
|
|
80
|
+
if (language.status.gdmc === 'launched' ||
|
|
81
|
+
language.status.gdmc === 'testing' ||
|
|
82
|
+
(language.status.gdmc === 'inProgress' && options?.includeInProgressDmcSets)) {
|
|
94
83
|
for (const gdmcSetId of specialIds_1.specialIds.growingAsDmcSetIds) {
|
|
95
84
|
setIds.push(gdmcSetId);
|
|
96
85
|
}
|
|
97
86
|
}
|
|
98
|
-
if (language.unsupportedDbsSets)
|
|
99
|
-
setIds = setIds.filter((set) => !language.unsupportedDbsSets?.includes(set));
|
|
100
87
|
const toReturn = {
|
|
101
88
|
...language,
|
|
102
89
|
setIds: setIds,
|
|
103
90
|
questionSets: questionsCurriculum?.questionSets ?? defaultReturn.questionSets,
|
|
104
|
-
bible:
|
|
105
|
-
|
|
106
|
-
|
|
91
|
+
bible: language.bible
|
|
92
|
+
? (0, bibles_1.getBibleInfo)(language.bible) || defaultReturn.bible
|
|
93
|
+
: defaultReturn.bible,
|
|
94
|
+
bibleFallbacks: (language.bibleFallbacks ?? [])
|
|
95
|
+
.map(bibles_1.getBibleInfo)
|
|
96
|
+
.filter((b) => b != null),
|
|
97
|
+
contentLanguages: {
|
|
98
|
+
trainingVideos: language.bridgeLanguages?.trainingVideos ?? language.languageId,
|
|
99
|
+
ftbs: language.bridgeLanguages?.ftbs ?? language.languageId,
|
|
100
|
+
intros: language.bridgeLanguages?.intros ?? language.languageId,
|
|
101
|
+
titles: language.bridgeLanguages?.titles ?? language.languageId,
|
|
102
|
+
questionAudio: language.bridgeLanguages?.questionAudio ?? language.languageId,
|
|
103
|
+
questionText: language.bridgeLanguages?.questionText ?? language.languageId,
|
|
104
|
+
},
|
|
107
105
|
script,
|
|
106
|
+
lessonPauses: lessonPauses_1.lessonPauses,
|
|
107
|
+
allBibleIds: (0, bibles_1.getAllBibleIds)(language),
|
|
108
108
|
};
|
|
109
109
|
return toReturn;
|
|
110
110
|
}
|
|
@@ -130,8 +130,8 @@ function getInitialAppInterfaceLanguage(userPhoneLanguages) {
|
|
|
130
130
|
}
|
|
131
131
|
function isLanguageAvailable(status, isDev) {
|
|
132
132
|
return process.env.EXPO_PUBLIC_APP_ENV === 'language-testing' || isDev
|
|
133
|
-
? status === 'launched' || status === 'testing'
|
|
134
|
-
: status === 'launched';
|
|
133
|
+
? status.dbs === 'launched' || status.dbs === 'testing'
|
|
134
|
+
: status.dbs === 'launched';
|
|
135
135
|
}
|
|
136
136
|
const superscriptToRegular = {
|
|
137
137
|
'⁰': '0',
|
|
@@ -145,9 +145,9 @@ const superscriptToRegular = {
|
|
|
145
145
|
'⁸': '8',
|
|
146
146
|
'⁹': '9',
|
|
147
147
|
};
|
|
148
|
-
function numerals(text,
|
|
149
|
-
if (
|
|
150
|
-
const map = numeralMaps_1.numeralMaps[
|
|
148
|
+
function numerals(text, scriptName) {
|
|
149
|
+
if (scriptName in numeralMaps_1.numeralMaps) {
|
|
150
|
+
const map = numeralMaps_1.numeralMaps[scriptName];
|
|
151
151
|
if (!map)
|
|
152
152
|
return text;
|
|
153
153
|
return text
|
|
@@ -167,20 +167,18 @@ function numerals(text, script) {
|
|
|
167
167
|
* the font which can be found by inspecting the font in an app like Font Book.
|
|
168
168
|
*/
|
|
169
169
|
function getAppTranslations(appLanguageId) {
|
|
170
|
-
return
|
|
171
|
-
translationsApp_1.translationsApp.eng);
|
|
170
|
+
return translationsApp_1.translationsApp[appLanguageId] ?? translationsApp_1.translationsApp.eng;
|
|
172
171
|
}
|
|
173
172
|
function getMeetTranslations(meetLanguageInfo) {
|
|
174
173
|
return {
|
|
175
|
-
sets: translationsSet_1.translationsSet[meetLanguageInfo.titles
|
|
174
|
+
sets: translationsSet_1.translationsSet[meetLanguageInfo.contentLanguages.titles] ??
|
|
176
175
|
translationsSet_1.translationsSet.eng,
|
|
177
|
-
|
|
176
|
+
ftbs: translationsFtb_1.translationsFtb[meetLanguageInfo.contentLanguages.ftbs] ??
|
|
177
|
+
translationsFtb_1.translationsFtb.eng,
|
|
178
|
+
introductions: translationsIntroduction_1.translationsIntroduction[meetLanguageInfo.contentLanguages.intros] ??
|
|
179
|
+
translationsIntroduction_1.translationsIntroduction.eng,
|
|
180
|
+
questions: translationsQuestion_1.translationsQuestion[meetLanguageInfo.contentLanguages.questionText] ??
|
|
178
181
|
translationsQuestion_1.translationsQuestion.eng,
|
|
179
|
-
questionsSpoken: translationsSpokenQuestion_1.translationsSpokenQuestion[meetLanguageInfo.
|
|
180
|
-
translationsSpokenQuestion_1.translationsSpokenQuestion.eng,
|
|
181
|
-
ftbs: translationsFtb_1.translationsFtb[meetLanguageInfo.languageId] ?? translationsFtb_1.translationsFtb.eng,
|
|
182
|
-
introductions: translationsIntroduction_1.translationsIntroduction[meetLanguageInfo.introBridge ??
|
|
183
|
-
meetLanguageInfo.titles ??
|
|
184
|
-
meetLanguageInfo.languageId] ?? translationsIntroduction_1.translationsIntroduction.eng,
|
|
182
|
+
questionsSpoken: translationsSpokenQuestion_1.translationsSpokenQuestion[meetLanguageInfo.contentLanguages.questionText] ?? translationsSpokenQuestion_1.translationsSpokenQuestion.eng,
|
|
185
183
|
};
|
|
186
184
|
}
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BibleChapter, BibleChapters } from '../types/bibleChapters';
|
|
3
|
-
import type { LanguageInfo } from '../types/languages';
|
|
1
|
+
import { BibleChapter } from '../types/bibleChapters';
|
|
4
2
|
import { ScripturePassage } from '../types/scripturePassages';
|
|
5
|
-
import { DbsInfo, VideoInfo } from '../types/sets';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
startChapter: string;
|
|
9
|
-
startVerse: string;
|
|
10
|
-
endBook: string;
|
|
11
|
-
endChapter: string;
|
|
12
|
-
endVerse: string;
|
|
13
|
-
startChapterId: string;
|
|
14
|
-
endChapterId: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16" or "REV.22"
|
|
18
|
-
* Returns the start and end verse IDs
|
|
19
|
-
*/
|
|
20
|
-
export declare function parseVerseRange(passageId: string): VerseRangeInfo;
|
|
3
|
+
import { DbsInfo, EnrichedSection, LessonInfo, Section, VideoInfo } from '../types/sets';
|
|
4
|
+
export { parseVerseRange } from './bibleBooks';
|
|
5
|
+
export type { VerseRangeInfo } from './bibleBooks';
|
|
21
6
|
type GetChapterUrlParams = {
|
|
22
7
|
bibleAudioId: string;
|
|
23
8
|
passageId: string;
|
|
24
9
|
} | {
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
book: string;
|
|
11
|
+
chapter: string;
|
|
27
12
|
bibleAudioId: string;
|
|
28
13
|
};
|
|
29
14
|
export declare function getChapterUrl(params: GetChapterUrlParams): string;
|
|
@@ -36,7 +21,10 @@ export declare function getChapterUrl(params: GetChapterUrlParams): string;
|
|
|
36
21
|
* ["GEN.1.1-GEN.1.25", "GEN.2.4-GEN.2.7", "EXO.3.3-EXO.3.25"] -> "Genesis 1: 1-25, 2: 4-7, Exodus 3: 3-25"
|
|
37
22
|
* ["JHN.1.1"] -> "John 1: 1"
|
|
38
23
|
*/
|
|
39
|
-
export declare function getPassagesString(
|
|
24
|
+
export declare function getPassagesString(passages: Array<{
|
|
25
|
+
passageId: string;
|
|
26
|
+
bibleId: string;
|
|
27
|
+
}>): string;
|
|
40
28
|
export interface GetChapterParams {
|
|
41
29
|
chapterId: string;
|
|
42
30
|
bibleId: string;
|
|
@@ -44,26 +32,18 @@ export interface GetChapterParams {
|
|
|
44
32
|
export type GetChapter = (params: GetChapterParams) => Promise<BibleChapter | undefined>;
|
|
45
33
|
interface GetScripturePassageParams {
|
|
46
34
|
bibleId: string;
|
|
47
|
-
bibleFallbackId: string | undefined;
|
|
48
35
|
passageId: string;
|
|
49
36
|
getChapter: GetChapter;
|
|
50
|
-
|
|
37
|
+
noTextAvailableString: string;
|
|
51
38
|
}
|
|
52
39
|
/** Gets a scripture passage by extracting verses from chapters documents. */
|
|
53
|
-
export declare function getScripturePassage({ bibleId,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
passageIds: string[];
|
|
40
|
+
export declare function getScripturePassage({ bibleId, passageId, getChapter, noTextAvailableString, }: GetScripturePassageParams): Promise<ScripturePassage>;
|
|
41
|
+
/** Gets all scripture passages for a lesson. */
|
|
42
|
+
export declare function getLessonScripture({ getChapter, lessonInfo, noTextAvailableString, }: {
|
|
43
|
+
lessonInfo: LessonInfo;
|
|
58
44
|
getChapter: (params: GetChapterParams) => Promise<BibleChapter | undefined>;
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Gets multiple scripture passages efficiently (Future optimization: could
|
|
63
|
-
* batch the chapter fetches)
|
|
64
|
-
*/
|
|
65
|
-
export declare function getLessonScripture(params: GetLessonScriptureParams): Promise<Array<ScripturePassage | undefined>>;
|
|
66
|
-
export declare function parseBibleSnapshot(snapshot: any, bible: string): BibleChapters;
|
|
45
|
+
noTextAvailableString: string;
|
|
46
|
+
}): Promise<Array<ScripturePassage>>;
|
|
67
47
|
/**
|
|
68
48
|
* Converts a verse number to a superscript string. This is useful for
|
|
69
49
|
* displaying verse numbers in a more visually appealing way. For example, "1"
|
|
@@ -73,18 +53,23 @@ export declare function parseBibleSnapshot(snapshot: any, bible: string): BibleC
|
|
|
73
53
|
* @returns The superscript string representation of the verse number.
|
|
74
54
|
*/
|
|
75
55
|
export declare function verseToSuperscript(num: string | undefined): string;
|
|
76
|
-
/** Returns the correct lesson pauses for a given language. */
|
|
77
|
-
export declare function getLessonPauses(languageId: string): LessonPauses;
|
|
78
56
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
57
|
+
* Returns the FTB audio duration + afterFtb pause for a section, or 0 if the
|
|
58
|
+
* section has no FTB.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getFtbDuration(section: Section, lessonInfo: DbsInfo | VideoInfo): number;
|
|
61
|
+
/**
|
|
62
|
+
* Fills in `length` (for verse-timed story sections) and `startTime` (for all
|
|
63
|
+
* sections) by accumulating forward through the lesson. After this, every
|
|
64
|
+
* section has both fields set.
|
|
65
|
+
*/
|
|
66
|
+
export declare function enrichSections(lessonInfo: DbsInfo | VideoInfo, scripture: Array<ScripturePassage>): EnrichedSection[];
|
|
67
|
+
/**
|
|
68
|
+
* Converts verse timings from chapter-relative to lesson-relative using each
|
|
69
|
+
* section's `startTime` (set by {@link enrichSections}).
|
|
85
70
|
*/
|
|
86
|
-
export declare function normalizeVerseTimings({
|
|
87
|
-
|
|
71
|
+
export declare function normalizeVerseTimings({ enrichedSections, scripture, lessonInfo, }: {
|
|
72
|
+
enrichedSections: EnrichedSection[];
|
|
73
|
+
scripture: Array<ScripturePassage>;
|
|
88
74
|
lessonInfo: DbsInfo | VideoInfo;
|
|
89
|
-
}): Array<ScripturePassage
|
|
90
|
-
export {};
|
|
75
|
+
}): Array<ScripturePassage>;
|