waha-shared 1.0.1 → 1.0.2

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 (293) hide show
  1. package/README.md +2 -2
  2. package/dist/data/bibleAudios.d.ts +8 -0
  3. package/dist/data/bibleAudios.js +8 -0
  4. package/dist/data/bibleAudios.json +394 -0
  5. package/dist/data/bibleResources/bibleBooks.d.ts +3 -0
  6. package/dist/data/bibleResources/bibleBooks.js +7 -0
  7. package/dist/data/bibleResources/bibleBooks.json +6071 -0
  8. package/dist/data/bibleResources/bibleChaptersList.d.ts +2 -0
  9. package/dist/data/bibleResources/bibleChaptersList.js +8 -0
  10. package/dist/data/bibleResources/bibleChaptersList.json +1191 -0
  11. package/dist/data/bibleStatuses.d.ts +7 -0
  12. package/dist/data/bibleStatuses.js +8 -0
  13. package/dist/data/bibleStatuses.json +9196 -0
  14. package/dist/data/bibleTexts.d.ts +16 -0
  15. package/dist/data/bibleTexts.js +8 -0
  16. package/dist/data/bibleTexts.json +527 -0
  17. package/dist/data/countryResources/areas.d.ts +3 -0
  18. package/dist/data/countryResources/areas.js +7 -0
  19. package/dist/data/countryResources/areas.json +74 -0
  20. package/dist/data/countryResources/countries.d.ts +3 -0
  21. package/dist/data/countryResources/countries.js +7 -0
  22. package/dist/data/countryResources/countries.json +3362 -0
  23. package/dist/data/foundationsCurriculums.d.ts +5 -0
  24. package/dist/data/foundationsCurriculums.js +8 -0
  25. package/dist/data/foundationsCurriculums.json +130 -0
  26. package/dist/data/languageResources/countriesAndLanguages.d.ts +13 -0
  27. package/dist/data/languageResources/countriesAndLanguages.js +7 -0
  28. package/dist/data/languageResources/countriesAndLanguages.json +11718 -0
  29. package/dist/data/languageResources/phoneLanguages.d.ts +11 -0
  30. package/dist/data/languageResources/phoneLanguages.js +7 -0
  31. package/dist/data/languageResources/phoneLanguages.json +1532 -0
  32. package/dist/data/languages.d.ts +45 -0
  33. package/dist/data/languages.js +8 -0
  34. package/dist/data/languages.json +7045 -0
  35. package/dist/data/mediaDurations.d.ts +6 -0
  36. package/dist/data/mediaDurations.js +8 -0
  37. package/dist/data/mediaDurations.json +32364 -0
  38. package/dist/data/notification.d.ts +16 -0
  39. package/dist/data/notification.js +8 -0
  40. package/dist/data/notification.json +69 -0
  41. package/dist/data/numeralMaps.d.ts +13 -0
  42. package/dist/data/numeralMaps.js +8 -0
  43. package/dist/data/numeralMaps.json +26 -0
  44. package/dist/data/questions.d.ts +8 -0
  45. package/dist/data/questions.js +8 -0
  46. package/dist/data/questions.json +317 -0
  47. package/dist/data/questionsCurriculums.d.ts +8 -0
  48. package/dist/data/questionsCurriculums.js +8 -0
  49. package/dist/data/questionsCurriculums.json +753 -0
  50. package/dist/data/releaseNotes.d.ts +6 -0
  51. package/dist/data/releaseNotes.js +8 -0
  52. package/dist/data/releaseNotes.json +2381 -0
  53. package/dist/data/screenshots.d.ts +5 -0
  54. package/dist/data/screenshots.js +8 -0
  55. package/dist/data/screenshots.json +17 -0
  56. package/dist/data/sets.d.ts +14 -0
  57. package/dist/data/sets.js +8 -0
  58. package/dist/data/sets.json +12258 -0
  59. package/dist/data/specialIds.d.ts +18 -0
  60. package/dist/data/specialIds.js +7 -0
  61. package/dist/data/specialIds.json +72 -0
  62. package/dist/data/topicsCurriculums.d.ts +5 -0
  63. package/dist/data/topicsCurriculums.js +8 -0
  64. package/dist/data/topicsCurriculums.json +131 -0
  65. package/dist/data/typescript/appTranslations.d.ts +915 -0
  66. package/dist/data/typescript/appTranslations.js +315 -0
  67. package/dist/data/typescript/areas.d.ts +18 -0
  68. package/dist/data/typescript/areas.js +42 -0
  69. package/dist/data/typescript/aslTimestamps.d.ts +43 -0
  70. package/dist/data/typescript/aslTimestamps.js +31 -0
  71. package/dist/data/typescript/bibleAudioAvailableChapters.d.ts +3 -0
  72. package/dist/data/typescript/bibleAudioAvailableChapters.js +36 -0
  73. package/dist/data/typescript/bibleAudios.d.ts +21 -0
  74. package/dist/data/typescript/bibleAudios.js +23 -0
  75. package/dist/data/typescript/bibleBookNames.d.ts +3 -0
  76. package/dist/data/typescript/bibleBookNames.js +98 -0
  77. package/dist/data/typescript/bibleBooks.d.ts +69 -0
  78. package/dist/data/typescript/bibleBooks.js +56 -0
  79. package/dist/data/typescript/bibleChapters.d.ts +49 -0
  80. package/dist/data/typescript/bibleChapters.js +29 -0
  81. package/dist/data/typescript/bibleStatuses.d.ts +28 -0
  82. package/dist/data/typescript/bibleStatuses.js +39 -0
  83. package/dist/data/typescript/bibleTextAvailableChapters.d.ts +3 -0
  84. package/dist/data/typescript/bibleTextAvailableChapters.js +36 -0
  85. package/dist/data/typescript/bibleTexts.d.ts +53 -0
  86. package/dist/data/typescript/bibleTexts.js +54 -0
  87. package/dist/data/typescript/clones.d.ts +36 -0
  88. package/dist/data/typescript/clones.js +28 -0
  89. package/dist/data/typescript/countries.d.ts +98 -0
  90. package/dist/data/typescript/countries.js +149 -0
  91. package/dist/data/typescript/foundationsCurriculums.d.ts +12 -0
  92. package/dist/data/typescript/foundationsCurriculums.js +12 -0
  93. package/dist/data/typescript/introductionTranslations.d.ts +202 -0
  94. package/dist/data/typescript/introductionTranslations.js +53 -0
  95. package/dist/data/typescript/languages.d.ts +148 -0
  96. package/dist/data/typescript/languages.js +302 -0
  97. package/dist/data/typescript/mediaDurations.d.ts +23 -0
  98. package/dist/data/typescript/mediaDurations.js +72 -0
  99. package/dist/data/typescript/notification.d.ts +45 -0
  100. package/dist/data/typescript/notification.js +176 -0
  101. package/dist/data/typescript/numeralMaps.d.ts +58 -0
  102. package/dist/data/typescript/numeralMaps.js +71 -0
  103. package/dist/data/typescript/questionTranslations.d.ts +3 -0
  104. package/dist/data/typescript/questionTranslations.js +5 -0
  105. package/dist/data/typescript/questions.d.ts +21 -0
  106. package/dist/data/typescript/questions.js +18 -0
  107. package/dist/data/typescript/questionsCurriculums.d.ts +27 -0
  108. package/dist/data/typescript/questionsCurriculums.js +19 -0
  109. package/dist/data/typescript/releaseNotes.d.ts +15 -0
  110. package/dist/data/typescript/releaseNotes.js +9 -0
  111. package/dist/data/typescript/screenshots.d.ts +12 -0
  112. package/dist/data/typescript/screenshots.js +49 -0
  113. package/dist/data/typescript/setTranslations.d.ts +27 -0
  114. package/dist/data/typescript/setTranslations.js +32 -0
  115. package/dist/data/typescript/sets.d.ts +49 -0
  116. package/dist/data/typescript/sets.js +88 -0
  117. package/dist/data/typescript/topicsCurriculums.d.ts +12 -0
  118. package/dist/data/typescript/topicsCurriculums.js +12 -0
  119. package/dist/data/youtube/videos.d.ts +2 -0
  120. package/dist/data/youtube/videos.js +7 -0
  121. package/dist/data/youtube/videos.json +262 -0
  122. package/dist/functions/activeCampaign.d.ts +8 -0
  123. package/dist/functions/activeCampaign.js +97 -0
  124. package/dist/functions/bibleChapterUtils.d.ts +15 -0
  125. package/dist/functions/bibleChapterUtils.js +231 -0
  126. package/dist/functions/crowdin.d.ts +24 -0
  127. package/dist/functions/crowdin.js +34 -0
  128. package/dist/functions/languages.d.ts +24 -0
  129. package/dist/functions/languages.js +212 -0
  130. package/dist/functions/scripturePassages.d.ts +47 -0
  131. package/dist/functions/scripturePassages.js +261 -0
  132. package/dist/functions/sets.d.ts +30 -0
  133. package/dist/functions/sets.js +371 -0
  134. package/dist/translations/appTranslations.d.ts +306 -0
  135. package/dist/translations/appTranslations.js +8 -0
  136. package/dist/translations/appTranslations.json +10239 -0
  137. package/dist/translations/introductionTranslations.d.ts +43 -0
  138. package/dist/translations/introductionTranslations.js +8 -0
  139. package/dist/translations/introductionTranslations.json +422 -0
  140. package/dist/translations/questionTranslations.d.ts +2 -0
  141. package/dist/translations/questionTranslations.js +8 -0
  142. package/dist/translations/questionTranslations.json +1472 -0
  143. package/dist/translations/setTranslations.d.ts +10 -0
  144. package/dist/translations/setTranslations.js +8 -0
  145. package/dist/translations/setTranslations.json +30257 -0
  146. package/dist/types/analytics.d.ts +119 -0
  147. package/dist/types/analytics.js +2 -0
  148. package/dist/types/completions.d.ts +8 -0
  149. package/dist/types/completions.js +2 -0
  150. package/dist/types/feedback.d.ts +60 -0
  151. package/dist/types/feedback.js +27 -0
  152. package/dist/types/languages.d.ts +31 -0
  153. package/dist/types/languages.js +2 -0
  154. package/dist/types/notifications.d.ts +128 -0
  155. package/dist/types/notifications.js +30 -0
  156. package/dist/types/sets.d.ts +70 -0
  157. package/dist/types/sets.js +10 -0
  158. package/dist/types/users.d.ts +765 -0
  159. package/dist/types/users.js +137 -0
  160. package/package.json +2 -2
  161. package/.DS_Store +0 -0
  162. package/__init__.py +0 -0
  163. package/copy.ts +0 -37
  164. package/data/README.md +0 -45
  165. package/data/__init__.py +0 -0
  166. package/data/aslTimestamps.json +0 -192788
  167. package/data/bibleAudios.json +0 -394
  168. package/data/bibleAudios.ts +0 -4
  169. package/data/bibleResources/audioBibleLicenses.json +0 -6235
  170. package/data/bibleResources/bibleBooks.json +0 -6071
  171. package/data/bibleResources/bibleBooks.ts +0 -4
  172. package/data/bibleResources/bibleChaptersList.json +0 -1191
  173. package/data/bibleResources/bibleChaptersList.ts +0 -4
  174. package/data/bibleResources/textBibleLicenses.json +0 -14603
  175. package/data/bibleStatuses.json +0 -9196
  176. package/data/bibleStatuses.ts +0 -4
  177. package/data/bibleTexts.json +0 -527
  178. package/data/bibleTexts.ts +0 -4
  179. package/data/clones.json +0 -13
  180. package/data/countryResources/areas.json +0 -74
  181. package/data/countryResources/areas.ts +0 -4
  182. package/data/countryResources/countries.json +0 -3362
  183. package/data/countryResources/countries.ts +0 -4
  184. package/data/foundationsCurriculums.json +0 -130
  185. package/data/foundationsCurriculums.ts +0 -4
  186. package/data/languageResources/countriesAndLanguages.json +0 -11718
  187. package/data/languageResources/countriesAndLanguages.ts +0 -16
  188. package/data/languageResources/crowdinLanguages.json +0 -2172
  189. package/data/languageResources/iosVoiceOverLanguages.json +0 -64
  190. package/data/languageResources/iso6933LanguageCodes.json +0 -7927
  191. package/data/languageResources/mmsLanguages.json +0 -28164
  192. package/data/languageResources/phoneLanguages.json +0 -1532
  193. package/data/languageResources/phoneLanguages.ts +0 -14
  194. package/data/languages.json +0 -7045
  195. package/data/languages.ts +0 -4
  196. package/data/mediaDurations.json +0 -32364
  197. package/data/mediaDurations.ts +0 -4
  198. package/data/notification.json +0 -69
  199. package/data/notification.ts +0 -4
  200. package/data/numeralMaps.json +0 -26
  201. package/data/numeralMaps.ts +0 -4
  202. package/data/orphanedBibleTexts.json +0 -2747
  203. package/data/questions.json +0 -317
  204. package/data/questions.ts +0 -4
  205. package/data/questionsCurriculums.json +0 -753
  206. package/data/questionsCurriculums.ts +0 -4
  207. package/data/releaseNotes.json +0 -2381
  208. package/data/releaseNotes.ts +0 -4
  209. package/data/schemas/appTranslations.schema.json +0 -802
  210. package/data/schemas/areas.schema.json +0 -76
  211. package/data/schemas/aslTimestamps.schema.json +0 -59
  212. package/data/schemas/bibleAudios.schema.json +0 -37
  213. package/data/schemas/bibleBooks.schema.json +0 -112
  214. package/data/schemas/bibleChapters.schema.json +0 -61
  215. package/data/schemas/bibleStatuses.schema.json +0 -41
  216. package/data/schemas/bibleTexts.schema.json +0 -60
  217. package/data/schemas/clones.schema.json +0 -63
  218. package/data/schemas/countries.schema.json +0 -84
  219. package/data/schemas/foundationsCurriculums.schema.json +0 -20
  220. package/data/schemas/introductionTranslations.schema.json +0 -101
  221. package/data/schemas/languages.schema.json +0 -365
  222. package/data/schemas/mediaDurations.schema.json +0 -41
  223. package/data/schemas/notification.schema.json +0 -111
  224. package/data/schemas/numeralMaps.schema.json +0 -57
  225. package/data/schemas/questionTranslations.schema.json +0 -20
  226. package/data/schemas/questions.schema.json +0 -29
  227. package/data/schemas/questionsCurriculums.schema.json +0 -34
  228. package/data/schemas/releaseNotes.schema.json +0 -21
  229. package/data/schemas/screenshots.schema.json +0 -23
  230. package/data/schemas/setTranslations.schema.json +0 -70
  231. package/data/schemas/sets.schema.json +0 -109
  232. package/data/schemas/topicsCurriculums.schema.json +0 -20
  233. package/data/screenshots.json +0 -17
  234. package/data/screenshots.ts +0 -4
  235. package/data/sets.json +0 -12258
  236. package/data/sets.ts +0 -4
  237. package/data/specialIds.json +0 -72
  238. package/data/specialIds.ts +0 -19
  239. package/data/timings/som.json +0 -9150
  240. package/data/topicsCurriculums.json +0 -131
  241. package/data/topicsCurriculums.ts +0 -4
  242. package/data/typescript/appTranslations.ts +0 -322
  243. package/data/typescript/areas.ts +0 -45
  244. package/data/typescript/aslTimestamps.ts +0 -36
  245. package/data/typescript/bibleAudioAvailableChapters.ts +0 -35
  246. package/data/typescript/bibleAudios.ts +0 -32
  247. package/data/typescript/bibleBookNames.ts +0 -97
  248. package/data/typescript/bibleBooks.ts +0 -63
  249. package/data/typescript/bibleChapters.ts +0 -40
  250. package/data/typescript/bibleStatuses.ts +0 -54
  251. package/data/typescript/bibleTextAvailableChapters.ts +0 -35
  252. package/data/typescript/bibleTexts.ts +0 -63
  253. package/data/typescript/clones.ts +0 -35
  254. package/data/typescript/countries.ts +0 -152
  255. package/data/typescript/foundationsCurriculums.ts +0 -15
  256. package/data/typescript/introductionTranslations.ts +0 -60
  257. package/data/typescript/languages.ts +0 -369
  258. package/data/typescript/mediaDurations.ts +0 -89
  259. package/data/typescript/notification.ts +0 -189
  260. package/data/typescript/numeralMaps.ts +0 -74
  261. package/data/typescript/questionTranslations.ts +0 -6
  262. package/data/typescript/questions.ts +0 -25
  263. package/data/typescript/questionsCurriculums.ts +0 -26
  264. package/data/typescript/releaseNotes.ts +0 -10
  265. package/data/typescript/screenshots.ts +0 -52
  266. package/data/typescript/setTranslations.ts +0 -39
  267. package/data/typescript/sets.ts +0 -105
  268. package/data/typescript/topicsCurriculums.ts +0 -15
  269. package/data/youtube/playlists.json +0 -28
  270. package/data/youtube/videos.json +0 -262
  271. package/data/youtube/videos.ts +0 -2
  272. package/functions/activeCampaign.ts +0 -127
  273. package/functions/bibleChapterUtils.ts +0 -241
  274. package/functions/crowdin.ts +0 -51
  275. package/functions/languages.ts +0 -284
  276. package/functions/scripturePassages.ts +0 -368
  277. package/functions/sets.ts +0 -495
  278. package/translations/appTranslations.json +0 -10239
  279. package/translations/appTranslations.ts +0 -4
  280. package/translations/introductionTranslations.json +0 -422
  281. package/translations/introductionTranslations.ts +0 -4
  282. package/translations/questionTranslations.json +0 -1472
  283. package/translations/questionTranslations.ts +0 -4
  284. package/translations/setTranslations.json +0 -30257
  285. package/translations/setTranslations.ts +0 -4
  286. package/translations/spokenQuestionTranslations.json +0 -1472
  287. package/types/analytics.ts +0 -147
  288. package/types/completions.ts +0 -9
  289. package/types/feedback.ts +0 -27
  290. package/types/languages.ts +0 -37
  291. package/types/notifications.ts +0 -37
  292. package/types/sets.ts +0 -84
  293. package/types/users.ts +0 -162
@@ -0,0 +1,24 @@
1
+ import type { AppTranslations } from '../data/typescript/appTranslations';
2
+ import type { Languages } from '../data/typescript/languages';
3
+ import type { BibleInfo, LanguageInfo, MeetTranslations } from '../types/languages';
4
+ export declare function getBibleInfo(bibleId: string | undefined): BibleInfo | undefined;
5
+ export declare function getIsRtl(script: Languages[number]['script']): boolean;
6
+ export declare function getLanguageInfo(languageId: string): LanguageInfo;
7
+ export declare function getInitialAppInterfaceLanguage(userPhoneLanguages: Array<string | null>): Languages[number]['languageId'];
8
+ export declare function isLanguageAvailable(status: Languages[number]['status'], isDev?: boolean): boolean;
9
+ export declare function numerals(text: string, script: Languages[number]['script']): string;
10
+ /**
11
+ * These values are not the name of the font necessarily, but the identifier of
12
+ * the font which can be found by inspecting the font in an app like Font Book.
13
+ */
14
+ export declare const fonts: Record<Languages[number]['script'], 'EudoxusSans' | 'NotoSans' | 'IBMPlexSansArabic' | null | 'KhmerOSContent' | 'Padauk' | 'AnekTelugu' | 'UKIJ Tuz'>;
15
+ /**
16
+ * Get the font family for a given script and weight.
17
+ *
18
+ * @param script The script to get the font family for.
19
+ * @param bold Whether to use the bold variant of the font.
20
+ * @returns The font family for the given script and weight.
21
+ */
22
+ export declare function getFontFamily(script: Languages[number]['script'], bold?: boolean): string;
23
+ export declare function getAppTranslations(appLanguageId?: string): AppTranslations[string];
24
+ export declare function getMeetTranslations(meetLanguageInfo: LanguageInfo): MeetTranslations;
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.fonts = void 0;
7
+ exports.getBibleInfo = getBibleInfo;
8
+ exports.getIsRtl = getIsRtl;
9
+ exports.getLanguageInfo = getLanguageInfo;
10
+ exports.getInitialAppInterfaceLanguage = getInitialAppInterfaceLanguage;
11
+ exports.isLanguageAvailable = isLanguageAvailable;
12
+ exports.numerals = numerals;
13
+ exports.getFontFamily = getFontFamily;
14
+ exports.getAppTranslations = getAppTranslations;
15
+ exports.getMeetTranslations = getMeetTranslations;
16
+ const bibleAudios_1 = __importDefault(require("../data/bibleAudios"));
17
+ const bibleStatuses_1 = __importDefault(require("../data/bibleStatuses"));
18
+ const bibleTexts_1 = __importDefault(require("../data/bibleTexts"));
19
+ const foundationsCurriculums_1 = __importDefault(require("../data/foundationsCurriculums"));
20
+ const phoneLanguages_1 = __importDefault(require("../data/languageResources/phoneLanguages"));
21
+ const languages_1 = __importDefault(require("../data/languages"));
22
+ const numeralMaps_1 = __importDefault(require("../data/numeralMaps"));
23
+ const questionsCurriculums_1 = __importDefault(require("../data/questionsCurriculums"));
24
+ const topicsCurriculums_1 = __importDefault(require("../data/topicsCurriculums"));
25
+ const appTranslations_1 = __importDefault(require("../translations/appTranslations"));
26
+ const introductionTranslations_1 = __importDefault(require("../translations/introductionTranslations"));
27
+ const questionTranslations_1 = __importDefault(require("../translations/questionTranslations"));
28
+ const setTranslations_1 = __importDefault(require("../translations/setTranslations"));
29
+ const bibleChapterUtils_1 = require("./bibleChapterUtils");
30
+ function getBibleInfo(bibleId) {
31
+ const bibleText = bibleTexts_1.default.find((t) => t.bibleTextId === bibleId);
32
+ const bibleAudio = bibleAudios_1.default.find((t) => t.bibleAudioId === bibleText?.audioId ||
33
+ t.bibleAudioId === bibleText?.bibleTextId);
34
+ const language = languages_1.default.find((l) => l.languageId === bibleText?.language);
35
+ return bibleText && bibleAudio
36
+ ? {
37
+ ...bibleText,
38
+ ...bibleAudio,
39
+ language,
40
+ availableTextChapters: (0, bibleChapterUtils_1.getAvailableChapters)(bibleText.bibleTextId, 'text'),
41
+ availableAudioChapters: (0, bibleChapterUtils_1.getAvailableChapters)(bibleAudio.bibleAudioId, 'audio'),
42
+ bookNames: bibleStatuses_1.default[bibleText.bibleTextId]?.bookNames || {},
43
+ fullCopyright: (bibleText.copyright ?? '') + '\n\n' + (bibleAudio.copyright ?? ''),
44
+ }
45
+ : undefined;
46
+ }
47
+ function getIsRtl(script) {
48
+ return script === 'arabic' || script === 'hebrew' || script === 'uyghur';
49
+ }
50
+ function getLanguageInfo(languageId) {
51
+ const defaultReturn = {
52
+ ...languages_1.default[0],
53
+ sets: [...foundationsCurriculums_1.default[0].sets],
54
+ questionSets: questionsCurriculums_1.default[0].questionSets,
55
+ bible: {
56
+ ...bibleTexts_1.default[0],
57
+ ...bibleAudios_1.default[0],
58
+ availableTextChapters: [],
59
+ availableAudioChapters: [],
60
+ language: languages_1.default[0],
61
+ fullCopyright: '',
62
+ bookNames: {},
63
+ },
64
+ bibleFallback: undefined,
65
+ trainingVideoLanguage: '',
66
+ isRtl: false,
67
+ };
68
+ const language = languages_1.default.find((language) => language.languageId === languageId);
69
+ if (!language) {
70
+ console.error(`Can't find language with id ${languageId}`);
71
+ return defaultReturn;
72
+ }
73
+ const questionsCurriculum = questionsCurriculums_1.default.find((questionCurriculum) => questionCurriculum.curriculumId === language.curriculum.questions);
74
+ const foundationsCurriculum = foundationsCurriculums_1.default.find((foundationsCurriculum) => foundationsCurriculum.curriculumId === language.curriculum.foundations);
75
+ const topicsCurriculum = topicsCurriculums_1.default.find((topicsCurriculum) => topicsCurriculum.curriculumId === language?.curriculum.topics);
76
+ let sets = [];
77
+ if (foundationsCurriculum)
78
+ sets.push(...foundationsCurriculum.sets);
79
+ if (topicsCurriculum)
80
+ sets.push(...topicsCurriculum.sets);
81
+ if (language.dmCourseStatus === 'launched' ||
82
+ language.dmCourseStatus === 'testing' ||
83
+ language.videoBridgeLanguage)
84
+ sets.push('03.009');
85
+ if (language.gdmcStatus === 'launched' || language.gdmcStatus === 'testing') {
86
+ sets.push('03.005');
87
+ sets.push('03.006');
88
+ sets.push('03.007');
89
+ }
90
+ if (language.unsupportedDbsSets)
91
+ sets = sets.filter((set) => !language.unsupportedDbsSets?.includes(set));
92
+ const toReturn = {
93
+ ...language,
94
+ isRtl: getIsRtl(language.script),
95
+ sets,
96
+ questionSets: questionsCurriculum?.questionSets ?? defaultReturn.questionSets,
97
+ bible: getBibleInfo(language.bible) || defaultReturn.bible,
98
+ bibleFallback: getBibleInfo(language.bibleFallback),
99
+ trainingVideoLanguage: language.videoBridgeLanguage ?? language.languageId,
100
+ };
101
+ return toReturn;
102
+ }
103
+ function getInitialAppInterfaceLanguage(userPhoneLanguages) {
104
+ for (const userPhoneLanguage of userPhoneLanguages) {
105
+ if (!userPhoneLanguage)
106
+ continue;
107
+ for (const phoneLanguage of phoneLanguages_1.default) {
108
+ // Step 1: find the matching phone language.
109
+ if (phoneLanguage.twoLetterId !== userPhoneLanguage.slice(0, 2))
110
+ continue;
111
+ // Step 2: search through alternatives to find the best option.
112
+ for (const alternative of phoneLanguage.alternatives) {
113
+ // If the alternative is a valid waha app interface language, we've found a match.
114
+ if (languages_1.default.some((wahaLanguage) => wahaLanguage.appInterface !== undefined &&
115
+ isLanguageAvailable(wahaLanguage.status) &&
116
+ wahaLanguage.languageId === alternative.threeLetterId))
117
+ return alternative.threeLetterId;
118
+ }
119
+ }
120
+ }
121
+ return 'eng';
122
+ }
123
+ function isLanguageAvailable(status, isDev) {
124
+ return process.env.EXPO_PUBLIC_APP_ENV === 'language-testing' || isDev
125
+ ? status === 'launched' || status === 'testing'
126
+ : status === 'launched';
127
+ }
128
+ const superscriptToRegular = {
129
+ '⁰': '0',
130
+ '¹': '1',
131
+ '²': '2',
132
+ '³': '3',
133
+ '⁴': '4',
134
+ '⁵': '5',
135
+ '⁶': '6',
136
+ '⁷': '7',
137
+ '⁸': '8',
138
+ '⁹': '9',
139
+ };
140
+ function numerals(text, script) {
141
+ if (script in numeralMaps_1.default) {
142
+ const map = numeralMaps_1.default[script];
143
+ if (!map)
144
+ return text;
145
+ return text
146
+ .split('')
147
+ .map((char) => {
148
+ const regularChar = char in superscriptToRegular ? superscriptToRegular[char] : char;
149
+ if (regularChar in map)
150
+ return map[regularChar];
151
+ return char;
152
+ })
153
+ .join('');
154
+ }
155
+ return text;
156
+ }
157
+ /**
158
+ * These values are not the name of the font necessarily, but the identifier of
159
+ * the font which can be found by inspecting the font in an app like Font Book.
160
+ */
161
+ exports.fonts = {
162
+ arabic: 'IBMPlexSansArabic',
163
+ cyrillic: 'NotoSans',
164
+ chinese: 'NotoSans',
165
+ devanagari: 'NotoSans',
166
+ latin: 'EudoxusSans',
167
+ greek: 'NotoSans',
168
+ japanese: 'NotoSans',
169
+ korean: 'NotoSans',
170
+ thai: 'NotoSans',
171
+ hebrew: 'NotoSans',
172
+ khmer: 'KhmerOSContent',
173
+ bengali: null,
174
+ telugu: 'AnekTelugu',
175
+ burmese: 'Padauk',
176
+ geez: null,
177
+ georgian: null,
178
+ gujarati: null,
179
+ kannada: null,
180
+ malayalam: null,
181
+ tamil: null,
182
+ gurmukhi: null,
183
+ uyghur: 'UKIJ Tuz',
184
+ };
185
+ /**
186
+ * Get the font family for a given script and weight.
187
+ *
188
+ * @param script The script to get the font family for.
189
+ * @param bold Whether to use the bold variant of the font.
190
+ * @returns The font family for the given script and weight.
191
+ */
192
+ function getFontFamily(script, bold) {
193
+ const font = exports.fonts[script];
194
+ if (!font)
195
+ return 'EudoxusSans-Regular'; // Fallback font
196
+ return bold ? `${font}-Bold` : `${font}-Regular`;
197
+ }
198
+ function getAppTranslations(appLanguageId) {
199
+ return (appTranslations_1.default[appLanguageId ?? 'eng'] ??
200
+ appTranslations_1.default.eng);
201
+ }
202
+ function getMeetTranslations(meetLanguageInfo) {
203
+ return {
204
+ sets: setTranslations_1.default[meetLanguageInfo.titles ?? meetLanguageInfo.languageId] ??
205
+ setTranslations_1.default.eng,
206
+ questions: questionTranslations_1.default[meetLanguageInfo.languageId] ??
207
+ questionTranslations_1.default.eng,
208
+ introductions: introductionTranslations_1.default[meetLanguageInfo.introBridge ??
209
+ meetLanguageInfo.titles ??
210
+ meetLanguageInfo.languageId] ?? introductionTranslations_1.default.eng,
211
+ };
212
+ }
@@ -0,0 +1,47 @@
1
+ import { type BibleChapters } from '../data/typescript/bibleChapters';
2
+ import type { LanguageInfo } from '../types/languages';
3
+ type BibleChapter = BibleChapters[number];
4
+ export interface ScripturePassage {
5
+ passageId: string;
6
+ bibleId: string;
7
+ header: string;
8
+ verses: BibleChapter['verses'][number][];
9
+ }
10
+ /**
11
+ * Condenses a list of USFM passage IDs into a readable string format. Groups
12
+ * consecutive passages from the same book together.
13
+ *
14
+ * @example
15
+ * ["GEN.1.1-GEN.1.25"] -> "Genesis 1: 1-25"
16
+ * ["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"
17
+ * ["JHN.1.1"] -> "John 1: 1"
18
+ */
19
+ export declare function getPassagesString(passageIds: string[] | undefined, language: LanguageInfo): string;
20
+ export interface GetChapterParams {
21
+ chapterId: string;
22
+ bibleId: string;
23
+ }
24
+ export type GetChapter = (params: GetChapterParams) => Promise<BibleChapter | undefined>;
25
+ interface GetLessonScriptureParams {
26
+ bibleId: string;
27
+ bibleFallbackId: string | undefined;
28
+ passageIds: string[];
29
+ getChapter: (params: GetChapterParams) => Promise<BibleChapter | undefined>;
30
+ languageInfo: LanguageInfo;
31
+ }
32
+ /**
33
+ * Gets multiple scripture passages efficiently (Future optimization: could
34
+ * batch the chapter fetches)
35
+ */
36
+ export declare function getLessonScripture(params: GetLessonScriptureParams): Promise<Array<ScripturePassage | undefined>>;
37
+ export declare function parseBibleSnapshot(snapshot: any, bible: string): BibleChapters;
38
+ /**
39
+ * Converts a verse number to a superscript string. This is useful for
40
+ * displaying verse numbers in a more visually appealing way. For example, "1"
41
+ * becomes "¹", "2" becomes "²", etc
42
+ *
43
+ * @param num The verse number to convert to superscript.
44
+ * @returns The superscript string representation of the verse number.
45
+ */
46
+ export declare function verseToSuperscript(num: string | undefined): string;
47
+ export {};
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getPassagesString = getPassagesString;
7
+ exports.getLessonScripture = getLessonScripture;
8
+ exports.parseBibleSnapshot = parseBibleSnapshot;
9
+ exports.verseToSuperscript = verseToSuperscript;
10
+ const bibleStatuses_1 = __importDefault(require("../data/bibleStatuses"));
11
+ const bibleChapters_1 = require("../data/typescript/bibleChapters");
12
+ const languages_1 = require("../functions/languages");
13
+ /**
14
+ * Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16" Returns the
15
+ * start and end verse IDs
16
+ */
17
+ function parseVerseRange(passageId) {
18
+ // Handle single verse: "GEN.1.1" -> "GEN.1.1-GEN.1.1"
19
+ const parts = passageId.includes('-')
20
+ ? passageId.split('-')
21
+ : [passageId, passageId];
22
+ const [startBook, startChapter, startVerse] = parts[0].split('.');
23
+ const [endBook, endChapter, endVerse] = parts[1].split('.');
24
+ return {
25
+ startBook,
26
+ startChapter,
27
+ startVerse,
28
+ endBook,
29
+ endChapter,
30
+ endVerse,
31
+ };
32
+ }
33
+ /** Extracts verses from a chapter based on verse numbers */
34
+ function extractVersesFromChapter(chapter, startVerse, endVerse) {
35
+ const verses = chapter.verses.filter((verse) => {
36
+ const verseIdPart = verse.verseId.split('.')[2];
37
+ // Handle verse ranges (e.g., "7-9")
38
+ if (verseIdPart.includes('-')) {
39
+ const [rangeStart, rangeEnd] = verseIdPart
40
+ .split('-')
41
+ .map((v) => parseInt(v));
42
+ // Check if the requested range overlaps with this verse range
43
+ return rangeEnd >= startVerse && rangeStart <= endVerse;
44
+ }
45
+ // Handle single verse numbers
46
+ const verseNum = parseInt(verseIdPart);
47
+ return verseNum >= startVerse && verseNum <= endVerse;
48
+ });
49
+ return verses;
50
+ }
51
+ /**
52
+ * Condenses a list of USFM passage IDs into a readable string format. Groups
53
+ * consecutive passages from the same book together.
54
+ *
55
+ * @example
56
+ * ["GEN.1.1-GEN.1.25"] -> "Genesis 1: 1-25"
57
+ * ["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"
58
+ * ["JHN.1.1"] -> "John 1: 1"
59
+ */
60
+ function getPassagesString(passageIds, language) {
61
+ if (!passageIds || passageIds.length === 0)
62
+ return '';
63
+ const parts = [];
64
+ let currentBook = null;
65
+ for (const passageId of passageIds) {
66
+ const { startBook, startChapter, startVerse, endChapter, endVerse } = parseVerseRange(passageId);
67
+ let bookName =
68
+ // American sign language should use English book names.
69
+ language.languageId === 'ase'
70
+ ? bibleStatuses_1.default.BSB.bookNames[startBook]
71
+ : language.bible.bookNames[startBook];
72
+ if (!bookName) {
73
+ bookName = language.bibleFallback?.bookNames[startBook];
74
+ if (!bookName)
75
+ continue;
76
+ }
77
+ // New book - include book name
78
+ if (currentBook !== startBook) {
79
+ currentBook = startBook;
80
+ // Same chapter
81
+ if (startChapter === endChapter) {
82
+ if (startVerse === endVerse) {
83
+ parts.push(`${bookName} ${startChapter}: ${startVerse}`);
84
+ }
85
+ else {
86
+ parts.push(`${bookName} ${startChapter}: ${startVerse}-${endVerse}`);
87
+ }
88
+ }
89
+ else {
90
+ // Different chapters
91
+ parts.push(`${bookName} ${startChapter}: ${startVerse}-${endChapter}: ${endVerse}`);
92
+ }
93
+ }
94
+ else {
95
+ // Same book - omit book name
96
+ if (startChapter === endChapter) {
97
+ if (startVerse === endVerse) {
98
+ parts.push(`${startChapter}: ${startVerse}`);
99
+ }
100
+ else {
101
+ parts.push(`${startChapter}: ${startVerse}-${endVerse}`);
102
+ }
103
+ }
104
+ else {
105
+ // Different chapters
106
+ parts.push(`${startChapter}: ${startVerse}-${endChapter}: ${endVerse}`);
107
+ }
108
+ }
109
+ }
110
+ return (0, languages_1.numerals)(parts.join(', '), language.script);
111
+ }
112
+ /**
113
+ * Gets a scripture passage by extracting verses from chapters This is the core
114
+ * parsing logic, independent of the data source
115
+ */
116
+ async function getScripturePassage({ bibleId, bibleFallbackId, passageId, getChapter, languageInfo, }) {
117
+ try {
118
+ const { startBook, startChapter, startVerse, endBook, endChapter, endVerse, } = parseVerseRange(passageId);
119
+ const startVerseNum = parseInt(startVerse);
120
+ const endVerseNum = parseInt(endVerse);
121
+ // Same chapter - simple case
122
+ if (startBook === endBook && startChapter === endChapter) {
123
+ const chapterId = `${startBook}.${startChapter}`;
124
+ let chapter = await getChapter({ chapterId, bibleId });
125
+ if (!chapter && bibleFallbackId)
126
+ chapter = await getChapter({ chapterId, bibleId: bibleFallbackId });
127
+ if (!chapter) {
128
+ console.warn(`Chapter not found: ${bibleId}.${chapterId} for passage ${passageId}`);
129
+ return;
130
+ }
131
+ const verses = extractVersesFromChapter(chapter, startVerseNum, endVerseNum);
132
+ if (verses.length === 0) {
133
+ console.warn(`No verses found for passage ${passageId}`);
134
+ return;
135
+ }
136
+ return {
137
+ passageId,
138
+ bibleId,
139
+ header: getPassagesString([passageId], languageInfo),
140
+ verses,
141
+ };
142
+ }
143
+ // Multi-chapter passage (rare but possible)
144
+ // Example: GEN.1.26-GEN.2.3
145
+ const chapters = [];
146
+ // Get all chapters in the range
147
+ const startChapterNum = parseInt(startChapter);
148
+ const endChapterNum = parseInt(endChapter);
149
+ for (let i = startChapterNum; i <= endChapterNum; i++) {
150
+ const chapterId = `${startBook}.${i}`;
151
+ let chapter = await getChapter({ chapterId, bibleId });
152
+ if (!chapter && bibleFallbackId)
153
+ chapter = await getChapter({ chapterId, bibleId: bibleFallbackId });
154
+ if (chapter) {
155
+ chapters.push(chapter);
156
+ }
157
+ else {
158
+ console.warn(`Missing chapter in range: ${bibleId}.${chapterId}`);
159
+ }
160
+ }
161
+ if (chapters.length === 0) {
162
+ return;
163
+ }
164
+ // Extract verses from each chapter
165
+ const allVerses = [];
166
+ chapters.forEach((chapter, index) => {
167
+ if (index === 0) {
168
+ // First chapter - from startVerse to end
169
+ const lastVerse = Math.max(...chapter.verses.map((v) => parseInt(v.verseId.split('.')[2])));
170
+ allVerses.push(...extractVersesFromChapter(chapter, startVerseNum, lastVerse));
171
+ }
172
+ else if (index === chapters.length - 1) {
173
+ // Last chapter - from beginning to endVerse
174
+ allVerses.push(...extractVersesFromChapter(chapter, 1, endVerseNum));
175
+ }
176
+ else {
177
+ // Middle chapters - all verses
178
+ allVerses.push(...chapter.verses);
179
+ }
180
+ });
181
+ return {
182
+ passageId,
183
+ bibleId,
184
+ header: getPassagesString([passageId], languageInfo),
185
+ verses: allVerses,
186
+ };
187
+ }
188
+ catch (error) {
189
+ console.error(`Error getting scripture passage ${passageId} in ${bibleId}`, error);
190
+ return;
191
+ }
192
+ }
193
+ /**
194
+ * Gets multiple scripture passages efficiently (Future optimization: could
195
+ * batch the chapter fetches)
196
+ */
197
+ async function getLessonScripture(params) {
198
+ const passages = await Promise.all(params.passageIds.map((passageId) => getScripturePassage({ ...params, passageId })));
199
+ return passages;
200
+ }
201
+ function parseBibleSnapshot(snapshot, bible) {
202
+ const validChapters = [];
203
+ if (!snapshot) {
204
+ console.warn('No snapshot for', bible);
205
+ return [];
206
+ }
207
+ else if (snapshot.empty) {
208
+ console.warn('Empty snapshot for', bible);
209
+ return [];
210
+ }
211
+ for (const doc of snapshot.docs) {
212
+ const chapterParse = bibleChapters_1.bibleChapters.element.safeParse(doc.data());
213
+ if (!chapterParse.success) {
214
+ console.warn('Skipping invalid bible chapter document', doc.id, chapterParse.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`));
215
+ }
216
+ else {
217
+ validChapters.push(chapterParse.data);
218
+ }
219
+ }
220
+ if (validChapters.length === 0) {
221
+ console.warn('No valid chapters for', bible);
222
+ return [];
223
+ }
224
+ else {
225
+ return validChapters;
226
+ }
227
+ }
228
+ /**
229
+ * Converts a verse number to a superscript string. This is useful for
230
+ * displaying verse numbers in a more visually appealing way. For example, "1"
231
+ * becomes "¹", "2" becomes "²", etc
232
+ *
233
+ * @param num The verse number to convert to superscript.
234
+ * @returns The superscript string representation of the verse number.
235
+ */
236
+ function verseToSuperscript(num) {
237
+ const superscriptObj = {
238
+ '0': '⁰',
239
+ '1': '¹',
240
+ '2': '²',
241
+ '3': '³',
242
+ '4': '⁴',
243
+ '5': '⁵',
244
+ '6': '⁶',
245
+ '7': '⁷',
246
+ '8': '⁸',
247
+ '9': '⁹',
248
+ '-': '⁻',
249
+ };
250
+ if (!num)
251
+ return '';
252
+ return num
253
+ .split('')
254
+ .map((digit) => {
255
+ if (digit in superscriptObj)
256
+ return superscriptObj[digit];
257
+ else
258
+ return digit;
259
+ })
260
+ .join('');
261
+ }
@@ -0,0 +1,30 @@
1
+ import type { AppTranslations } from '../data/typescript/appTranslations';
2
+ import type { LanguageInfo, MeetTranslations } from '../types/languages';
3
+ import { Lesson, LessonInfo, SetInfo, type Section } from '../types/sets';
4
+ export declare const firebaseUrl = "https://firebasestorage.googleapis.com/v0/b/waha-app-db.appspot.com/o/";
5
+ export declare function getSetInfo({ setId, meetLanguageId, sets, t, }: {
6
+ setId: string;
7
+ meetLanguageId: string;
8
+ t: MeetTranslations & AppTranslations[string];
9
+ sets: string[];
10
+ }): SetInfo | undefined;
11
+ export declare function getLessonInfo({ lessonId, meetLanguageInfo, setInfo, t, }: {
12
+ lessonId: Lesson['lessonId'] | undefined;
13
+ meetLanguageInfo: LanguageInfo;
14
+ setInfo?: SetInfo;
15
+ t: MeetTranslations & AppTranslations[string];
16
+ }): LessonInfo | undefined;
17
+ export declare function convertSToString(time: number): string;
18
+ /** Determines whether a lesson should be visible in Waha. */
19
+ export declare function shouldShowLesson(lessonInfo: LessonInfo | undefined, languageInfo: LanguageInfo): boolean;
20
+ /**
21
+ * Calculate start times for each section based on question durations and total
22
+ * audio duration. Must be called after audio is loaded to get accurate total
23
+ * duration.
24
+ *
25
+ * @param sections - The lesson sections to calculate timings for
26
+ * @param totalDuration - Total duration of the lesson audio in seconds
27
+ * @param languageId - The language ID to look up question durations
28
+ * @returns Map of section ID to start time in seconds
29
+ */
30
+ export declare function calculateSectionTimings(sections: Section[], totalDuration: number, languageId: string): Map<string, number>;