waha-shared 1.0.308 → 1.0.309

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