waha-shared 1.0.1 → 1.0.3

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
@@ -1,127 +0,0 @@
1
- import signale from 'signale'
2
-
3
- const listNumbers = {
4
- newsletter: 3,
5
- volunteer: 5,
6
- 'dm-course': 9,
7
- }
8
-
9
- export async function addToACList(
10
- token: string,
11
- baseUrl: string,
12
- email: string,
13
- list: keyof typeof listNumbers,
14
- name?: string
15
- ) {
16
- const headers = { 'Api-Token': token, 'Content-Type': 'application/json' }
17
- const url = `${baseUrl}/api/3`
18
-
19
- const findContact = await fetch(`${url}/contacts?email=${email}`, {
20
- method: 'GET',
21
- headers,
22
- })
23
-
24
- const findContactJson = await findContact.json()
25
-
26
- if (!findContact.ok) {
27
- throw new Error(
28
- `Failed to retrieve contact with ${email}. ${JSON.stringify(findContactJson)}`
29
- )
30
- }
31
-
32
- let contactId: string
33
- if (findContactJson.contacts.length > 0) {
34
- contactId = findContactJson.contacts[0].id
35
- } else {
36
- const createContact = await fetch(`${url}/contacts`, {
37
- method: 'POST',
38
- headers,
39
- body: JSON.stringify({
40
- contact: { email, name },
41
- }),
42
- })
43
- const createContactJson = await createContact.json()
44
-
45
- if (!createContact.ok) {
46
- throw new Error(
47
- `Failed to create new contact with ${email}. ${JSON.stringify(createContactJson)}`
48
- )
49
- }
50
- signale.success(`Created new AC contact with email ${email}.`)
51
- contactId = createContactJson.contact.id
52
- }
53
-
54
- const subscribe = await fetch(`${url}/contactLists`, {
55
- method: 'POST',
56
- headers: { 'Api-Token': token, 'Content-Type': 'application/json' },
57
- body: JSON.stringify({
58
- contactList: {
59
- list: listNumbers[list],
60
- status: 1,
61
- contact: contactId,
62
- },
63
- }),
64
- })
65
- const subscribeJson = await subscribe.json()
66
-
67
- if (!subscribe.ok) {
68
- throw new Error(
69
- `Failed to add contact to list ${list}. Response: ${JSON.stringify(subscribeJson)}`
70
- )
71
- }
72
- signale.success(`${email} added to AC list ${list}.`)
73
- }
74
-
75
- export async function getContactsInList(
76
- token: string,
77
- baseUrl: string,
78
- list: keyof typeof listNumbers,
79
- limit: number = 100
80
- ): Promise<string[]> {
81
- const headers = { 'Api-Token': token, 'Content-Type': 'application/json' }
82
- const url = `${baseUrl}/api/3`
83
-
84
- const allEmails: string[] = []
85
- let lastContactId: string | null = null
86
- let hasMoreContacts = true
87
-
88
- while (hasMoreContacts) {
89
- let requestUrl = `${url}/contacts?listid=${listNumbers[list]}&orders[id]=ASC&limit=${limit}`
90
-
91
- if (lastContactId) {
92
- requestUrl += `&id_greater=${lastContactId}`
93
- }
94
- const response = await fetch(requestUrl, {
95
- method: 'GET',
96
- headers,
97
- })
98
-
99
- const data = await response.json()
100
-
101
- if (!response.ok) {
102
- throw new Error(
103
- `Failed to retrieve contacts in list ${list}. ${JSON.stringify(data)}`
104
- )
105
- }
106
-
107
- const contacts = data.contacts || []
108
-
109
- if (contacts.length === 0) {
110
- hasMoreContacts = false
111
- } else {
112
- // Add emails from this batch
113
- const emails = contacts.map((contact: any) => contact.email)
114
- allEmails.push(...emails)
115
-
116
- // Update the last contact ID for next iteration
117
- lastContactId = contacts[contacts.length - 1].id
118
-
119
- // If we got fewer contacts than the limit, we've reached the end
120
- if (contacts.length < limit) {
121
- hasMoreContacts = false
122
- }
123
- }
124
- }
125
-
126
- return allEmails
127
- }
@@ -1,241 +0,0 @@
1
- import bibleChaptersList from 'shared/data/bibleResources/bibleChaptersList'
2
- import bibleStatuses from 'shared/data/bibleStatuses'
3
- import type { BibleStatuses } from 'shared/data/typescript/bibleStatuses'
4
-
5
- // Old Testament books
6
- export const OLD_TESTAMENT_BOOKS = new Set([
7
- 'GEN',
8
- 'EXO',
9
- 'LEV',
10
- 'NUM',
11
- 'DEU',
12
- 'JOS',
13
- 'JDG',
14
- 'RUT',
15
- '1SA',
16
- '2SA',
17
- '1KI',
18
- '2KI',
19
- '1CH',
20
- '2CH',
21
- 'EZR',
22
- 'NEH',
23
- 'EST',
24
- 'JOB',
25
- 'PSA',
26
- 'PRO',
27
- 'ECC',
28
- 'SNG',
29
- 'ISA',
30
- 'JER',
31
- 'LAM',
32
- 'EZK',
33
- 'DAN',
34
- 'HOS',
35
- 'JOL',
36
- 'AMO',
37
- 'OBA',
38
- 'JON',
39
- 'MIC',
40
- 'NAM',
41
- 'HAB',
42
- 'ZEP',
43
- 'HAG',
44
- 'ZEC',
45
- 'MAL',
46
- ])
47
-
48
- // New Testament books
49
- export const NEW_TESTAMENT_BOOKS = new Set([
50
- 'MAT',
51
- 'MRK',
52
- 'LUK',
53
- 'JHN',
54
- 'ACT',
55
- 'ROM',
56
- '1CO',
57
- '2CO',
58
- 'GAL',
59
- 'EPH',
60
- 'PHP',
61
- 'COL',
62
- '1TH',
63
- '2TH',
64
- '1TI',
65
- '2TI',
66
- 'TIT',
67
- 'PHM',
68
- 'HEB',
69
- 'JAS',
70
- '1PE',
71
- '2PE',
72
- '1JN',
73
- '2JN',
74
- '3JN',
75
- 'JUD',
76
- 'REV',
77
- ])
78
-
79
- const bookLengths = new Map<string, number>([
80
- ['GEN', 50],
81
- ['EXO', 40],
82
- ['LEV', 27],
83
- ['NUM', 36],
84
- ['DEU', 34],
85
- ['JOS', 24],
86
- ['JDG', 21],
87
- ['RUT', 4],
88
- ['1SA', 31],
89
- ['2SA', 24],
90
- ['1KI', 22],
91
- ['2KI', 25],
92
- ['1CH', 29],
93
- ['2CH', 36],
94
- ['EZR', 10],
95
- ['NEH', 13],
96
- ['EST', 10],
97
- ['JOB', 42],
98
- ['PSA', 150],
99
- ['PRO', 31],
100
- ['ECC', 12],
101
- ['SNG', 8],
102
- ['ISA', 66],
103
- ['JER', 52],
104
- ['LAM', 5],
105
- ['EZK', 48],
106
- ['DAN', 12],
107
- ['HOS', 14],
108
- ['JOL', 3],
109
- ['AMO', 9],
110
- ['OBA', 1],
111
- ['JON', 4],
112
- ['MIC', 7],
113
- ['NAM', 3],
114
- ['HAB', 3],
115
- ['ZEP', 3],
116
- ['HAG', 2],
117
- ['ZEC', 14],
118
- ['MAL', 4],
119
- ['MAT', 28],
120
- ['MRK', 16],
121
- ['LUK', 24],
122
- ['JHN', 21],
123
- ['ACT', 28],
124
- ['ROM', 16],
125
- ['1CO', 16],
126
- ['2CO', 13],
127
- ['GAL', 6],
128
- ['EPH', 6],
129
- ['PHP', 4],
130
- ['COL', 4],
131
- ['1TH', 5],
132
- ['2TH', 3],
133
- ['1TI', 6],
134
- ['2TI', 4],
135
- ['TIT', 3],
136
- ['PHM', 1],
137
- ['HEB', 13],
138
- ['JAS', 5],
139
- ['1PE', 5],
140
- ['2PE', 3],
141
- ['1JN', 5],
142
- ['2JN', 1],
143
- ['3JN', 1],
144
- ['JUD', 1],
145
- ['REV', 22],
146
- ])
147
-
148
- /**
149
- * Expands an optimized chapter list back to individual chapters Converts book
150
- * names (e.g., "GEN") back to all chapters (e.g., ["GEN.1", "GEN.2", ..."])
151
- * Converts testament names ("OT", "NT") back to all chapters in that testament
152
- * Leaves individual chapters unchanged
153
- *
154
- * @param optimizedChapters - Array that may contain testament IDs, book IDs, or
155
- * chapter IDs
156
- * @returns Array of individual chapter IDs in canonical order
157
- */
158
- export function getAvailableChapters(
159
- bibleId: string,
160
- type: keyof BibleStatuses[string]
161
- ): string[] {
162
- if (type === 'bookNames') return [] // bookNames do not have chapters
163
-
164
- const optimizedChapters = bibleStatuses[bibleId]?.[type] || []
165
- if (optimizedChapters.length === 0) return []
166
-
167
- // Build a Set of included items for O(1) lookup
168
- const includedSet = new Set(optimizedChapters)
169
-
170
- // Check if we need OT/NT expansion
171
- const hasOT = includedSet.has('OT')
172
- const hasNT = includedSet.has('NT')
173
-
174
- // If we have both OT and NT, we have the complete Bible - just return all chapters
175
- if (hasOT && hasNT) {
176
- return bibleChaptersList.slice()
177
- }
178
-
179
- // Pre-calculate which books to include
180
- const includedBooks = new Set<string>()
181
-
182
- if (hasOT) {
183
- OLD_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book))
184
- }
185
- if (hasNT) {
186
- NEW_TESTAMENT_BOOKS.forEach((book) => includedBooks.add(book))
187
- }
188
-
189
- // Add individual books from the optimized list
190
- for (const entry of optimizedChapters) {
191
- if (entry !== 'OT' && entry !== 'NT' && !entry.includes('.')) {
192
- includedBooks.add(entry)
193
- }
194
- }
195
-
196
- // Filter bibleChaptersList to only include relevant chapters
197
- // This maintains canonical order without needing to sort
198
- const result: string[] = []
199
-
200
- for (const chapter of bibleChaptersList) {
201
- // Check if this specific chapter is included
202
- if (includedSet.has(chapter)) {
203
- result.push(chapter)
204
- continue
205
- }
206
-
207
- // Check if this chapter's book is included
208
- const bookId = chapter.split('.')[0]
209
- if (includedBooks.has(bookId)) {
210
- result.push(chapter)
211
- }
212
- }
213
-
214
- return result
215
- }
216
-
217
- export function getPercentage(
218
- bibleId: string,
219
- type: keyof BibleStatuses[string]
220
- ): number {
221
- if (type === 'bookNames') return 0 // bookNames do not have chapters
222
-
223
- const optimizedChapters = bibleStatuses[bibleId]?.[type] || []
224
- let total = 0
225
- optimizedChapters.forEach((entry) => {
226
- if (entry === 'OT') {
227
- // All Old Testament books
228
- total += 929
229
- } else if (entry === 'NT') {
230
- // All New Testament books
231
- total += 260
232
- } else if (entry.includes('.')) {
233
- // It's already a chapter ID, count as 1
234
- total += 1
235
- } else {
236
- // It's a book ID, add its chapter count
237
- total += bookLengths.get(entry) || 0
238
- }
239
- })
240
- return (total / 1189) * 100
241
- }
@@ -1,51 +0,0 @@
1
- import { spawnSync } from 'node:child_process'
2
-
3
- /**
4
- * Map of project names to their Crowdin ids. Can be retrieved by going to the
5
- * project's dashboard in Crowdin and looking on the right side panel for ID:
6
- * XXXXXX next to "Details".
7
- */
8
- export const crowdinProjectIds = {
9
- website: '698737',
10
- app: '549537',
11
- dmc: '663528',
12
- }
13
-
14
- interface DownloadTranslationsParams {
15
- /** The name of the project to download translations for. */
16
- project: keyof typeof crowdinProjectIds
17
- /**
18
- * The folder where translations are stored. Source translations are assumed
19
- * to be stored in `translationsFolder/eng/*.json`.
20
- */
21
- translationsFolder: string
22
- /** The Crowdin personal access token to use for authentication. */
23
- token: string
24
- }
25
-
26
- /** Downloads translations from Crowdin for a given project ID and source path. */
27
- export function downloadTranslations({
28
- project,
29
- translationsFolder,
30
- token,
31
- }: DownloadTranslationsParams) {
32
- spawnSync(
33
- [
34
- 'npx @crowdin/cli download translations',
35
- `-i ${crowdinProjectIds[project]}`,
36
- `-s eng/*.json`,
37
- // Add Crowdin token present in .env file.
38
- `-T ${token}`,
39
- // Set the base path for which the other paths will be relative to.
40
- `--base-path="${translationsFolder}"`,
41
- // Where to download translations to relative to the base path.
42
- '-t "/%three_letters_code%/%original_file_name%"',
43
- // Skip untranslated files to avoid downloading empty files.
44
- '--skip-untranslated-files',
45
- ].join(' '),
46
- {
47
- shell: true,
48
- stdio: 'inherit',
49
- }
50
- )
51
- }
@@ -1,284 +0,0 @@
1
- import bibleAudios from '../data/bibleAudios'
2
- import bibleStatuses from '../data/bibleStatuses'
3
- import bibleTexts from '../data/bibleTexts'
4
- import foundationsCurriculums from '../data/foundationsCurriculums'
5
- import phoneLanguages from '../data/languageResources/phoneLanguages'
6
- import languages from '../data/languages'
7
- import numeralMaps from '../data/numeralMaps'
8
- import questionsCurriculums from '../data/questionsCurriculums'
9
- import topicsCurriculums from '../data/topicsCurriculums'
10
- import type { AppTranslations } from '../data/typescript/appTranslations'
11
- import type { IntroductionTranslations } from '../data/typescript/introductionTranslations'
12
- import type { Languages } from '../data/typescript/languages'
13
- import type { QuestionTranslations } from '../data/typescript/questionTranslations'
14
- import type { SetTranslations } from '../data/typescript/setTranslations'
15
- import appTranslations from '../translations/appTranslations'
16
- import introductionTranslations from '../translations/introductionTranslations'
17
- import questionTranslations from '../translations/questionTranslations'
18
- import setTranslations from '../translations/setTranslations'
19
- import type {
20
- BibleInfo,
21
- LanguageInfo,
22
- MeetTranslations,
23
- } from '../types/languages'
24
- import { getAvailableChapters } from './bibleChapterUtils'
25
-
26
- export function getBibleInfo(
27
- bibleId: string | undefined
28
- ): BibleInfo | undefined {
29
- const bibleText = bibleTexts.find((t) => t.bibleTextId === bibleId)
30
- const bibleAudio = bibleAudios.find(
31
- (t) =>
32
- t.bibleAudioId === bibleText?.audioId ||
33
- t.bibleAudioId === bibleText?.bibleTextId
34
- )
35
- const language = languages.find((l) => l.languageId === bibleText?.language)!
36
-
37
- return bibleText && bibleAudio
38
- ? {
39
- ...bibleText,
40
- ...bibleAudio,
41
- language,
42
- availableTextChapters: getAvailableChapters(
43
- bibleText.bibleTextId,
44
- 'text'
45
- ),
46
- availableAudioChapters: getAvailableChapters(
47
- bibleAudio.bibleAudioId,
48
- 'audio'
49
- ),
50
- bookNames: bibleStatuses[bibleText.bibleTextId]?.bookNames || {},
51
- fullCopyright:
52
- (bibleText.copyright ?? '') + '\n\n' + (bibleAudio.copyright ?? ''),
53
- }
54
- : undefined
55
- }
56
-
57
- export function getIsRtl(script: Languages[number]['script']): boolean {
58
- return script === 'arabic' || script === 'hebrew' || script === 'uyghur'
59
- }
60
-
61
- export function getLanguageInfo(languageId: string): LanguageInfo {
62
- const defaultReturn: LanguageInfo = {
63
- ...languages[0],
64
- sets: [...foundationsCurriculums[0].sets],
65
- questionSets: questionsCurriculums[0].questionSets,
66
- bible: {
67
- ...bibleTexts[0],
68
- ...bibleAudios[0],
69
- availableTextChapters: [],
70
- availableAudioChapters: [],
71
- language: languages[0],
72
- fullCopyright: '',
73
- bookNames: {},
74
- },
75
- bibleFallback: undefined,
76
- trainingVideoLanguage: '',
77
- isRtl: false,
78
- }
79
-
80
- const language = languages.find(
81
- (language) => language.languageId === languageId
82
- )
83
-
84
- if (!language) {
85
- console.error(`Can't find language with id ${languageId}`)
86
- return defaultReturn
87
- }
88
-
89
- const questionsCurriculum = questionsCurriculums.find(
90
- (questionCurriculum) =>
91
- questionCurriculum.curriculumId === language.curriculum.questions
92
- )
93
-
94
- const foundationsCurriculum = foundationsCurriculums.find(
95
- (foundationsCurriculum) =>
96
- foundationsCurriculum.curriculumId === language.curriculum.foundations
97
- )
98
-
99
- const topicsCurriculum = topicsCurriculums.find(
100
- (topicsCurriculum) =>
101
- topicsCurriculum.curriculumId === language?.curriculum.topics
102
- )
103
-
104
- let sets: string[] = []
105
- if (foundationsCurriculum) sets.push(...foundationsCurriculum.sets)
106
- if (topicsCurriculum) sets.push(...topicsCurriculum.sets)
107
- if (
108
- language.dmCourseStatus === 'launched' ||
109
- language.dmCourseStatus === 'testing' ||
110
- language.videoBridgeLanguage
111
- )
112
- sets.push('03.009')
113
- if (language.gdmcStatus === 'launched' || language.gdmcStatus === 'testing') {
114
- sets.push('03.005')
115
- sets.push('03.006')
116
- sets.push('03.007')
117
- }
118
- if (language.unsupportedDbsSets)
119
- sets = sets.filter((set) => !language.unsupportedDbsSets?.includes(set))
120
-
121
- const toReturn: LanguageInfo = {
122
- ...language,
123
- isRtl: getIsRtl(language.script),
124
- sets,
125
- questionSets:
126
- questionsCurriculum?.questionSets ?? defaultReturn.questionSets,
127
- bible: getBibleInfo(language.bible) || defaultReturn.bible,
128
- bibleFallback: getBibleInfo(language.bibleFallback),
129
- trainingVideoLanguage: language.videoBridgeLanguage ?? language.languageId,
130
- }
131
- return toReturn
132
- }
133
-
134
- export function getInitialAppInterfaceLanguage(
135
- userPhoneLanguages: Array<string | null>
136
- ): Languages[number]['languageId'] {
137
- for (const userPhoneLanguage of userPhoneLanguages) {
138
- if (!userPhoneLanguage) continue
139
-
140
- for (const phoneLanguage of phoneLanguages) {
141
- // Step 1: find the matching phone language.
142
- if (phoneLanguage.twoLetterId !== userPhoneLanguage.slice(0, 2)) continue
143
-
144
- // Step 2: search through alternatives to find the best option.
145
- for (const alternative of phoneLanguage.alternatives) {
146
- // If the alternative is a valid waha app interface language, we've found a match.
147
- if (
148
- languages.some(
149
- (wahaLanguage) =>
150
- wahaLanguage.appInterface !== undefined &&
151
- isLanguageAvailable(wahaLanguage.status) &&
152
- wahaLanguage.languageId === alternative.threeLetterId
153
- )
154
- )
155
- return alternative.threeLetterId
156
- }
157
- }
158
- }
159
-
160
- return 'eng'
161
- }
162
-
163
- export function isLanguageAvailable(
164
- status: Languages[number]['status'],
165
- isDev?: boolean
166
- ) {
167
- return process.env.EXPO_PUBLIC_APP_ENV === 'language-testing' || isDev
168
- ? status === 'launched' || status === 'testing'
169
- : status === 'launched'
170
- }
171
-
172
- const superscriptToRegular: Record<string, string> = {
173
- '⁰': '0',
174
- '¹': '1',
175
- '²': '2',
176
- '³': '3',
177
- '⁴': '4',
178
- '⁵': '5',
179
- '⁶': '6',
180
- '⁷': '7',
181
- '⁸': '8',
182
- '⁹': '9',
183
- }
184
-
185
- export function numerals(text: string, script: Languages[number]['script']) {
186
- if (script in numeralMaps) {
187
- const map = numeralMaps[script]
188
- if (!map) return text
189
- return text
190
- .split('')
191
- .map((char) => {
192
- const regularChar =
193
- char in superscriptToRegular ? superscriptToRegular[char] : char
194
- if (regularChar in map) return map[regularChar as keyof typeof map]
195
- return char
196
- })
197
- .join('')
198
- }
199
- return text
200
- }
201
-
202
- /**
203
- * These values are not the name of the font necessarily, but the identifier of
204
- * the font which can be found by inspecting the font in an app like Font Book.
205
- */
206
- export const fonts: Record<
207
- Languages[number]['script'],
208
- | 'EudoxusSans'
209
- | 'NotoSans'
210
- | 'IBMPlexSansArabic'
211
- | null
212
- | 'KhmerOSContent'
213
- | 'Padauk'
214
- | 'AnekTelugu'
215
- | 'UKIJ Tuz'
216
- > = {
217
- arabic: 'IBMPlexSansArabic',
218
- cyrillic: 'NotoSans',
219
- chinese: 'NotoSans',
220
- devanagari: 'NotoSans',
221
- latin: 'EudoxusSans',
222
- greek: 'NotoSans',
223
- japanese: 'NotoSans',
224
- korean: 'NotoSans',
225
- thai: 'NotoSans',
226
- hebrew: 'NotoSans',
227
- khmer: 'KhmerOSContent',
228
- bengali: null,
229
- telugu: 'AnekTelugu',
230
- burmese: 'Padauk',
231
- geez: null,
232
- georgian: null,
233
- gujarati: null,
234
- kannada: null,
235
- malayalam: null,
236
- tamil: null,
237
- gurmukhi: null,
238
- uyghur: 'UKIJ Tuz',
239
- }
240
-
241
- /**
242
- * Get the font family for a given script and weight.
243
- *
244
- * @param script The script to get the font family for.
245
- * @param bold Whether to use the bold variant of the font.
246
- * @returns The font family for the given script and weight.
247
- */
248
- export function getFontFamily(
249
- script: Languages[number]['script'],
250
- bold?: boolean
251
- ) {
252
- const font = fonts[script]
253
- if (!font) return 'EudoxusSans-Regular' // Fallback font
254
-
255
- return bold ? `${font}-Bold` : `${font}-Regular`
256
- }
257
-
258
- export function getAppTranslations(
259
- appLanguageId?: string
260
- ): AppTranslations[string] {
261
- return (
262
- appTranslations[appLanguageId ?? 'eng'] ??
263
- (appTranslations.eng as AppTranslations[string])
264
- )
265
- }
266
-
267
- export function getMeetTranslations(
268
- meetLanguageInfo: LanguageInfo
269
- ): MeetTranslations {
270
- return {
271
- sets:
272
- setTranslations[meetLanguageInfo.titles ?? meetLanguageInfo.languageId] ??
273
- (setTranslations.eng as SetTranslations[string]),
274
- questions:
275
- questionTranslations[meetLanguageInfo.languageId] ??
276
- (questionTranslations.eng as QuestionTranslations[string]),
277
- introductions:
278
- introductionTranslations[
279
- meetLanguageInfo.introBridge ??
280
- meetLanguageInfo.titles ??
281
- meetLanguageInfo.languageId
282
- ] ?? (introductionTranslations.eng as IntroductionTranslations[string]),
283
- }
284
- }