@hedia/recommendation-screen 2.1.75 → 2.2.0-alpha.1

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 (393) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +5 -0
  3. package/{lib/typescript → dist/src}/RecommendationScreen.d.ts +68 -82
  4. package/dist/src/RecommendationScreen.js +522 -0
  5. package/dist/src/assets/assets/activity/Cyclist.png +0 -0
  6. package/dist/src/assets/assets/activity/Other.png +0 -0
  7. package/dist/src/assets/assets/activity/Runner.png +0 -0
  8. package/dist/src/assets/assets/activity/Swimmer.png +0 -0
  9. package/dist/src/assets/assets/activity/Walk.png +0 -0
  10. package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
  11. package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
  12. package/dist/src/assets/assets/icons/Edit.tsx +22 -0
  13. package/dist/src/assets/assets/icons/X.tsx +14 -0
  14. package/dist/src/assets/assets/mood/happy.png +0 -0
  15. package/dist/src/assets/assets/mood/happy_active.png +0 -0
  16. package/dist/src/assets/assets/mood/neutral.png +0 -0
  17. package/dist/src/assets/assets/mood/neutral_active.png +0 -0
  18. package/dist/src/assets/assets/mood/sad.png +0 -0
  19. package/dist/src/assets/assets/mood/sad_active.png +0 -0
  20. package/dist/src/assets/assets/mood/semi_happy.png +0 -0
  21. package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
  22. package/dist/src/assets/assets/mood/semi_sad.png +0 -0
  23. package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
  24. package/dist/src/assets/icons/Edit.d.ts +4 -0
  25. package/dist/src/assets/icons/Edit.js +7 -0
  26. package/dist/src/assets/icons/X.d.ts +4 -0
  27. package/dist/src/assets/icons/X.js +6 -0
  28. package/dist/src/components/ForecastInfoBar.d.ts +109 -0
  29. package/dist/src/components/ForecastInfoBar.js +138 -0
  30. package/dist/src/components/Header.d.ts +8 -0
  31. package/dist/src/components/Header.js +54 -0
  32. package/dist/src/components/Icon.d.ts +20 -0
  33. package/dist/src/components/Icon.js +43 -0
  34. package/{lib/typescript → dist/src}/components/InfoBars.d.ts +28 -14
  35. package/dist/src/components/InfoBars.js +128 -0
  36. package/{lib/typescript → dist/src}/components/InvisibleNumberInput.d.ts +3 -9
  37. package/dist/src/components/InvisibleNumberInput.js +121 -0
  38. package/dist/src/components/LimitationMessage.d.ts +14 -0
  39. package/dist/src/components/LimitationMessage.js +30 -0
  40. package/{lib/typescript → dist/src}/components/LineSeparator.d.ts +1 -6
  41. package/dist/src/components/LineSeparator.js +18 -0
  42. package/{lib/typescript → dist/src}/components/RecentInsulin.d.ts +1 -3
  43. package/dist/src/components/RecentInsulin.js +73 -0
  44. package/{lib/typescript → dist/src}/components/RecommendationModal.d.ts +63 -63
  45. package/dist/src/components/RecommendationModal.js +226 -0
  46. package/{lib/typescript → dist/src}/components/RecommendedCarbs.d.ts +0 -3
  47. package/dist/src/components/RecommendedCarbs.js +251 -0
  48. package/{lib/typescript → dist/src}/components/RecommendedInsulin.d.ts +1 -2
  49. package/dist/src/components/RecommendedInsulin.js +180 -0
  50. package/{lib/typescript → dist/src}/components/Remeasure.d.ts +15 -6
  51. package/dist/src/components/Remeasure.js +130 -0
  52. package/{lib/typescript/components/TransferToLogbook.d.ts → dist/src/components/SaveButton.d.ts} +2 -3
  53. package/dist/src/components/SaveButton.js +71 -0
  54. package/dist/src/components/TwoOptionModal.d.ts +136 -0
  55. package/dist/src/components/TwoOptionModal.js +141 -0
  56. package/{lib/typescript → dist/src}/components/activity/Activity.d.ts +2 -3
  57. package/dist/src/components/activity/Activity.js +84 -0
  58. package/{lib/typescript → dist/src}/components/activity/ActivityIcon.d.ts +7 -8
  59. package/dist/src/components/activity/ActivityIcon.js +58 -0
  60. package/{lib/typescript → dist/src}/components/activity/ActivityIntensity.d.ts +1 -2
  61. package/dist/src/components/activity/ActivityIntensity.js +58 -0
  62. package/{lib/typescript → dist/src}/components/mood/Emotion.d.ts +1 -2
  63. package/dist/src/components/mood/Emotion.js +64 -0
  64. package/{lib/typescript → dist/src}/components/mood/MoodIcon.d.ts +5 -5
  65. package/dist/src/components/mood/MoodIcon.js +63 -0
  66. package/dist/src/components/text/TextBold.d.ts +8 -0
  67. package/dist/src/components/text/TextBold.js +12 -0
  68. package/dist/src/components/text/TextRegular.d.ts +8 -0
  69. package/dist/src/components/text/TextRegular.js +12 -0
  70. package/dist/src/locale/da/messages.js +1 -0
  71. package/dist/src/locale/da/messages.po +353 -0
  72. package/dist/src/locale/de/messages.js +1 -0
  73. package/dist/src/locale/de/messages.po +353 -0
  74. package/dist/src/locale/en/messages.js +1 -0
  75. package/dist/src/locale/en/messages.po +353 -0
  76. package/dist/src/locale/es/messages.js +1 -0
  77. package/dist/src/locale/es/messages.po +353 -0
  78. package/dist/src/locale/fr/messages.js +1 -0
  79. package/dist/src/locale/fr/messages.po +353 -0
  80. package/dist/src/locale/i18nUtils.d.ts +18 -0
  81. package/dist/src/locale/i18nUtils.js +39 -0
  82. package/dist/src/locale/it/messages.js +1 -0
  83. package/dist/src/locale/it/messages.po +353 -0
  84. package/{lib/typescript → dist/src}/types/enum.d.ts +15 -22
  85. package/dist/src/types/enum.js +145 -0
  86. package/{lib/typescript → dist/src}/types/types.d.ts +0 -1
  87. package/dist/src/types/types.js +1 -0
  88. package/{lib/typescript → dist/src}/utils/AttentionMessages.d.ts +0 -1
  89. package/dist/src/utils/AttentionMessages.js +118 -0
  90. package/{lib/typescript → dist/src}/utils/Constants.d.ts +3 -18
  91. package/{lib/module → dist/src}/utils/Constants.js +21 -79
  92. package/{lib/typescript → dist/src}/utils/RecommendationError.d.ts +0 -1
  93. package/dist/src/utils/RecommendationError.js +63 -0
  94. package/{lib/typescript → dist/src}/utils/RecommendationUtils.d.ts +0 -1
  95. package/{lib/module → dist/src}/utils/RecommendationUtils.js +88 -90
  96. package/{lib/typescript → dist/src}/utils/Translations.d.ts +0 -1
  97. package/{lib/module → dist/src}/utils/Translations.js +5 -7
  98. package/{lib/typescript → dist/src}/utils/Utils.d.ts +1 -2
  99. package/dist/src/utils/Utils.js +141 -0
  100. package/{lib/typescript → dist/src}/utils/Validations.d.ts +1 -2
  101. package/{lib/module → dist/src}/utils/Validations.js +128 -156
  102. package/package.json +96 -109
  103. package/lib/commonjs/RecommendationScreen.js +0 -778
  104. package/lib/commonjs/RecommendationScreen.js.map +0 -1
  105. package/lib/commonjs/assets/IconsSVG/Close.js +0 -20
  106. package/lib/commonjs/assets/IconsSVG/Close.js.map +0 -1
  107. package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +0 -28
  108. package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +0 -1
  109. package/lib/commonjs/assets/IconsSVG/Edit.js +0 -23
  110. package/lib/commonjs/assets/IconsSVG/Edit.js.map +0 -1
  111. package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +0 -43
  112. package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +0 -1
  113. package/lib/commonjs/assets/IconsSVG/activity/Running.js +0 -33
  114. package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +0 -1
  115. package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +0 -33
  116. package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +0 -1
  117. package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +0 -48
  118. package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +0 -1
  119. package/lib/commonjs/assets/IconsSVG/activity/Walking.js +0 -38
  120. package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +0 -1
  121. package/lib/commonjs/assets/IconsSVG/mood/Happy.js +0 -34
  122. package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +0 -1
  123. package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +0 -34
  124. package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +0 -1
  125. package/lib/commonjs/assets/IconsSVG/mood/Sad.js +0 -34
  126. package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +0 -1
  127. package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +0 -34
  128. package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
  129. package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +0 -34
  130. package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +0 -1
  131. package/lib/commonjs/components/ExitModal.js +0 -124
  132. package/lib/commonjs/components/ExitModal.js.map +0 -1
  133. package/lib/commonjs/components/InfoBars.js +0 -123
  134. package/lib/commonjs/components/InfoBars.js.map +0 -1
  135. package/lib/commonjs/components/InvisibleNumberInput.js +0 -150
  136. package/lib/commonjs/components/InvisibleNumberInput.js.map +0 -1
  137. package/lib/commonjs/components/LineSeparator.js +0 -27
  138. package/lib/commonjs/components/LineSeparator.js.map +0 -1
  139. package/lib/commonjs/components/RecentInsulin.js +0 -105
  140. package/lib/commonjs/components/RecentInsulin.js.map +0 -1
  141. package/lib/commonjs/components/RecommendationModal.js +0 -302
  142. package/lib/commonjs/components/RecommendationModal.js.map +0 -1
  143. package/lib/commonjs/components/RecommendedCarbs.js +0 -289
  144. package/lib/commonjs/components/RecommendedCarbs.js.map +0 -1
  145. package/lib/commonjs/components/RecommendedInsulin.js +0 -209
  146. package/lib/commonjs/components/RecommendedInsulin.js.map +0 -1
  147. package/lib/commonjs/components/Remeasure.js +0 -131
  148. package/lib/commonjs/components/Remeasure.js.map +0 -1
  149. package/lib/commonjs/components/Text.js +0 -25
  150. package/lib/commonjs/components/Text.js.map +0 -1
  151. package/lib/commonjs/components/TimeoutModal.js +0 -113
  152. package/lib/commonjs/components/TimeoutModal.js.map +0 -1
  153. package/lib/commonjs/components/TransferToLogbook.js +0 -83
  154. package/lib/commonjs/components/TransferToLogbook.js.map +0 -1
  155. package/lib/commonjs/components/activity/Activity.js +0 -112
  156. package/lib/commonjs/components/activity/Activity.js.map +0 -1
  157. package/lib/commonjs/components/activity/ActivityIcon.js +0 -86
  158. package/lib/commonjs/components/activity/ActivityIcon.js.map +0 -1
  159. package/lib/commonjs/components/activity/ActivityIntensity.js +0 -65
  160. package/lib/commonjs/components/activity/ActivityIntensity.js.map +0 -1
  161. package/lib/commonjs/components/mood/Emotion.js +0 -86
  162. package/lib/commonjs/components/mood/Emotion.js.map +0 -1
  163. package/lib/commonjs/components/mood/MoodIcon.js +0 -107
  164. package/lib/commonjs/components/mood/MoodIcon.js.map +0 -1
  165. package/lib/commonjs/components/styles/fonts.js +0 -160
  166. package/lib/commonjs/components/styles/fonts.js.map +0 -1
  167. package/lib/commonjs/index.js +0 -21
  168. package/lib/commonjs/index.js.map +0 -1
  169. package/lib/commonjs/locales/da/translations.json +0 -82
  170. package/lib/commonjs/locales/de/translations.json +0 -81
  171. package/lib/commonjs/locales/en/translations.json +0 -84
  172. package/lib/commonjs/locales/es/translations.json +0 -81
  173. package/lib/commonjs/locales/fr/translations.json +0 -81
  174. package/lib/commonjs/locales/it/translations.json +0 -81
  175. package/lib/commonjs/locales/translate.js +0 -63
  176. package/lib/commonjs/locales/translate.js.map +0 -1
  177. package/lib/commonjs/types/enum.js +0 -179
  178. package/lib/commonjs/types/enum.js.map +0 -1
  179. package/lib/commonjs/types/types.js +0 -6
  180. package/lib/commonjs/types/types.js.map +0 -1
  181. package/lib/commonjs/utils/AttentionMessages.js +0 -141
  182. package/lib/commonjs/utils/AttentionMessages.js.map +0 -1
  183. package/lib/commonjs/utils/Constants.js +0 -138
  184. package/lib/commonjs/utils/Constants.js.map +0 -1
  185. package/lib/commonjs/utils/RecommendationError.js +0 -116
  186. package/lib/commonjs/utils/RecommendationError.js.map +0 -1
  187. package/lib/commonjs/utils/RecommendationUtils.js +0 -212
  188. package/lib/commonjs/utils/RecommendationUtils.js.map +0 -1
  189. package/lib/commonjs/utils/Translations.js +0 -22
  190. package/lib/commonjs/utils/Translations.js.map +0 -1
  191. package/lib/commonjs/utils/Utils.js +0 -162
  192. package/lib/commonjs/utils/Utils.js.map +0 -1
  193. package/lib/commonjs/utils/Validations.js +0 -468
  194. package/lib/commonjs/utils/Validations.js.map +0 -1
  195. package/lib/module/RecommendationScreen.js +0 -768
  196. package/lib/module/RecommendationScreen.js.map +0 -1
  197. package/lib/module/assets/IconsSVG/Close.js +0 -11
  198. package/lib/module/assets/IconsSVG/Close.js.map +0 -1
  199. package/lib/module/assets/IconsSVG/CloseOutlined.js +0 -19
  200. package/lib/module/assets/IconsSVG/CloseOutlined.js.map +0 -1
  201. package/lib/module/assets/IconsSVG/Edit.js +0 -14
  202. package/lib/module/assets/IconsSVG/Edit.js.map +0 -1
  203. package/lib/module/assets/IconsSVG/activity/Cycling.js +0 -34
  204. package/lib/module/assets/IconsSVG/activity/Cycling.js.map +0 -1
  205. package/lib/module/assets/IconsSVG/activity/Running.js +0 -24
  206. package/lib/module/assets/IconsSVG/activity/Running.js.map +0 -1
  207. package/lib/module/assets/IconsSVG/activity/Stretching.js +0 -24
  208. package/lib/module/assets/IconsSVG/activity/Stretching.js.map +0 -1
  209. package/lib/module/assets/IconsSVG/activity/Swimming.js +0 -39
  210. package/lib/module/assets/IconsSVG/activity/Swimming.js.map +0 -1
  211. package/lib/module/assets/IconsSVG/activity/Walking.js +0 -29
  212. package/lib/module/assets/IconsSVG/activity/Walking.js.map +0 -1
  213. package/lib/module/assets/IconsSVG/mood/Happy.js +0 -25
  214. package/lib/module/assets/IconsSVG/mood/Happy.js.map +0 -1
  215. package/lib/module/assets/IconsSVG/mood/Neutral.js +0 -25
  216. package/lib/module/assets/IconsSVG/mood/Neutral.js.map +0 -1
  217. package/lib/module/assets/IconsSVG/mood/Sad.js +0 -25
  218. package/lib/module/assets/IconsSVG/mood/Sad.js.map +0 -1
  219. package/lib/module/assets/IconsSVG/mood/SemiHappy.js +0 -25
  220. package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
  221. package/lib/module/assets/IconsSVG/mood/SemiSad.js +0 -25
  222. package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +0 -1
  223. package/lib/module/components/ExitModal.js +0 -114
  224. package/lib/module/components/ExitModal.js.map +0 -1
  225. package/lib/module/components/InfoBars.js +0 -114
  226. package/lib/module/components/InfoBars.js.map +0 -1
  227. package/lib/module/components/InvisibleNumberInput.js +0 -142
  228. package/lib/module/components/InvisibleNumberInput.js.map +0 -1
  229. package/lib/module/components/LineSeparator.js +0 -19
  230. package/lib/module/components/LineSeparator.js.map +0 -1
  231. package/lib/module/components/RecentInsulin.js +0 -97
  232. package/lib/module/components/RecentInsulin.js.map +0 -1
  233. package/lib/module/components/RecommendationModal.js +0 -291
  234. package/lib/module/components/RecommendationModal.js.map +0 -1
  235. package/lib/module/components/RecommendedCarbs.js +0 -281
  236. package/lib/module/components/RecommendedCarbs.js.map +0 -1
  237. package/lib/module/components/RecommendedInsulin.js +0 -201
  238. package/lib/module/components/RecommendedInsulin.js.map +0 -1
  239. package/lib/module/components/Remeasure.js +0 -123
  240. package/lib/module/components/Remeasure.js.map +0 -1
  241. package/lib/module/components/Text.js +0 -16
  242. package/lib/module/components/Text.js.map +0 -1
  243. package/lib/module/components/TimeoutModal.js +0 -103
  244. package/lib/module/components/TimeoutModal.js.map +0 -1
  245. package/lib/module/components/TransferToLogbook.js +0 -75
  246. package/lib/module/components/TransferToLogbook.js.map +0 -1
  247. package/lib/module/components/activity/Activity.js +0 -104
  248. package/lib/module/components/activity/Activity.js.map +0 -1
  249. package/lib/module/components/activity/ActivityIcon.js +0 -78
  250. package/lib/module/components/activity/ActivityIcon.js.map +0 -1
  251. package/lib/module/components/activity/ActivityIntensity.js +0 -57
  252. package/lib/module/components/activity/ActivityIntensity.js.map +0 -1
  253. package/lib/module/components/mood/Emotion.js +0 -78
  254. package/lib/module/components/mood/Emotion.js.map +0 -1
  255. package/lib/module/components/mood/MoodIcon.js +0 -97
  256. package/lib/module/components/mood/MoodIcon.js.map +0 -1
  257. package/lib/module/components/styles/fonts.js +0 -152
  258. package/lib/module/components/styles/fonts.js.map +0 -1
  259. package/lib/module/index.js +0 -5
  260. package/lib/module/index.js.map +0 -1
  261. package/lib/module/locales/da/translations.json +0 -82
  262. package/lib/module/locales/de/translations.json +0 -81
  263. package/lib/module/locales/en/translations.json +0 -84
  264. package/lib/module/locales/es/translations.json +0 -81
  265. package/lib/module/locales/fr/translations.json +0 -81
  266. package/lib/module/locales/it/translations.json +0 -81
  267. package/lib/module/locales/translate.js +0 -55
  268. package/lib/module/locales/translate.js.map +0 -1
  269. package/lib/module/types/enum.js +0 -170
  270. package/lib/module/types/enum.js.map +0 -1
  271. package/lib/module/types/types.js +0 -2
  272. package/lib/module/types/types.js.map +0 -1
  273. package/lib/module/utils/AttentionMessages.js +0 -131
  274. package/lib/module/utils/AttentionMessages.js.map +0 -1
  275. package/lib/module/utils/Constants.js.map +0 -1
  276. package/lib/module/utils/RecommendationError.js +0 -87
  277. package/lib/module/utils/RecommendationError.js.map +0 -1
  278. package/lib/module/utils/RecommendationUtils.js.map +0 -1
  279. package/lib/module/utils/Translations.js.map +0 -1
  280. package/lib/module/utils/Utils.js +0 -155
  281. package/lib/module/utils/Utils.js.map +0 -1
  282. package/lib/module/utils/Validations.js.map +0 -1
  283. package/lib/typescript/RecommendationScreen.d.ts.map +0 -1
  284. package/lib/typescript/assets/IconsSVG/Close.d.ts +0 -5
  285. package/lib/typescript/assets/IconsSVG/Close.d.ts.map +0 -1
  286. package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts +0 -5
  287. package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +0 -1
  288. package/lib/typescript/assets/IconsSVG/Edit.d.ts +0 -5
  289. package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +0 -1
  290. package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts +0 -5
  291. package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +0 -1
  292. package/lib/typescript/assets/IconsSVG/activity/Running.d.ts +0 -5
  293. package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +0 -1
  294. package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts +0 -5
  295. package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +0 -1
  296. package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts +0 -5
  297. package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +0 -1
  298. package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts +0 -5
  299. package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +0 -1
  300. package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts +0 -5
  301. package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +0 -1
  302. package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts +0 -5
  303. package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +0 -1
  304. package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts +0 -5
  305. package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +0 -1
  306. package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts +0 -5
  307. package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +0 -1
  308. package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts +0 -5
  309. package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +0 -1
  310. package/lib/typescript/components/ExitModal.d.ts +0 -26
  311. package/lib/typescript/components/ExitModal.d.ts.map +0 -1
  312. package/lib/typescript/components/InfoBars.d.ts.map +0 -1
  313. package/lib/typescript/components/InvisibleNumberInput.d.ts.map +0 -1
  314. package/lib/typescript/components/LineSeparator.d.ts.map +0 -1
  315. package/lib/typescript/components/RecentInsulin.d.ts.map +0 -1
  316. package/lib/typescript/components/RecommendationModal.d.ts.map +0 -1
  317. package/lib/typescript/components/RecommendedCarbs.d.ts.map +0 -1
  318. package/lib/typescript/components/RecommendedInsulin.d.ts.map +0 -1
  319. package/lib/typescript/components/Remeasure.d.ts.map +0 -1
  320. package/lib/typescript/components/Text.d.ts +0 -14
  321. package/lib/typescript/components/Text.d.ts.map +0 -1
  322. package/lib/typescript/components/TimeoutModal.d.ts +0 -25
  323. package/lib/typescript/components/TimeoutModal.d.ts.map +0 -1
  324. package/lib/typescript/components/TransferToLogbook.d.ts.map +0 -1
  325. package/lib/typescript/components/activity/Activity.d.ts.map +0 -1
  326. package/lib/typescript/components/activity/ActivityIcon.d.ts.map +0 -1
  327. package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +0 -1
  328. package/lib/typescript/components/mood/Emotion.d.ts.map +0 -1
  329. package/lib/typescript/components/mood/MoodIcon.d.ts.map +0 -1
  330. package/lib/typescript/components/styles/fonts.d.ts +0 -151
  331. package/lib/typescript/components/styles/fonts.d.ts.map +0 -1
  332. package/lib/typescript/index.d.ts +0 -5
  333. package/lib/typescript/index.d.ts.map +0 -1
  334. package/lib/typescript/locales/translate.d.ts +0 -20
  335. package/lib/typescript/locales/translate.d.ts.map +0 -1
  336. package/lib/typescript/types/enum.d.ts.map +0 -1
  337. package/lib/typescript/types/types.d.ts.map +0 -1
  338. package/lib/typescript/utils/AttentionMessages.d.ts.map +0 -1
  339. package/lib/typescript/utils/Constants.d.ts.map +0 -1
  340. package/lib/typescript/utils/RecommendationError.d.ts.map +0 -1
  341. package/lib/typescript/utils/RecommendationUtils.d.ts.map +0 -1
  342. package/lib/typescript/utils/Translations.d.ts.map +0 -1
  343. package/lib/typescript/utils/Utils.d.ts.map +0 -1
  344. package/lib/typescript/utils/Validations.d.ts.map +0 -1
  345. package/src/RecommendationScreen.tsx +0 -854
  346. package/src/assets/IconsSVG/Close.tsx +0 -13
  347. package/src/assets/IconsSVG/CloseOutlined.tsx +0 -23
  348. package/src/assets/IconsSVG/Edit.tsx +0 -16
  349. package/src/assets/IconsSVG/activity/Cycling.tsx +0 -41
  350. package/src/assets/IconsSVG/activity/Running.tsx +0 -29
  351. package/src/assets/IconsSVG/activity/Stretching.tsx +0 -29
  352. package/src/assets/IconsSVG/activity/Swimming.tsx +0 -47
  353. package/src/assets/IconsSVG/activity/Walking.tsx +0 -35
  354. package/src/assets/IconsSVG/mood/Happy.tsx +0 -30
  355. package/src/assets/IconsSVG/mood/Neutral.tsx +0 -30
  356. package/src/assets/IconsSVG/mood/Sad.tsx +0 -30
  357. package/src/assets/IconsSVG/mood/SemiHappy.tsx +0 -30
  358. package/src/assets/IconsSVG/mood/SemiSad.tsx +0 -30
  359. package/src/components/ExitModal.tsx +0 -134
  360. package/src/components/InfoBars.tsx +0 -122
  361. package/src/components/InvisibleNumberInput.tsx +0 -170
  362. package/src/components/LineSeparator.tsx +0 -29
  363. package/src/components/RecentInsulin.tsx +0 -109
  364. package/src/components/RecommendationModal.tsx +0 -319
  365. package/src/components/RecommendedCarbs.tsx +0 -303
  366. package/src/components/RecommendedInsulin.tsx +0 -220
  367. package/src/components/Remeasure.tsx +0 -135
  368. package/src/components/Text.tsx +0 -27
  369. package/src/components/TimeoutModal.tsx +0 -121
  370. package/src/components/TransferToLogbook.tsx +0 -92
  371. package/src/components/activity/Activity.tsx +0 -107
  372. package/src/components/activity/ActivityIcon.tsx +0 -77
  373. package/src/components/activity/ActivityIntensity.tsx +0 -67
  374. package/src/components/mood/Emotion.tsx +0 -97
  375. package/src/components/mood/MoodIcon.tsx +0 -91
  376. package/src/components/styles/fonts.ts +0 -151
  377. package/src/index.ts +0 -5
  378. package/src/locales/da/translations.json +0 -82
  379. package/src/locales/de/translations.json +0 -81
  380. package/src/locales/en/translations.json +0 -84
  381. package/src/locales/es/translations.json +0 -81
  382. package/src/locales/fr/translations.json +0 -81
  383. package/src/locales/it/translations.json +0 -81
  384. package/src/locales/translate.ts +0 -62
  385. package/src/types/enum.ts +0 -164
  386. package/src/types/types.ts +0 -19
  387. package/src/utils/AttentionMessages.ts +0 -167
  388. package/src/utils/Constants.ts +0 -77
  389. package/src/utils/RecommendationError.ts +0 -182
  390. package/src/utils/RecommendationUtils.ts +0 -232
  391. package/src/utils/Translations.ts +0 -17
  392. package/src/utils/Utils.ts +0 -156
  393. package/src/utils/Validations.ts +0 -490
@@ -0,0 +1,141 @@
1
+ import { BloodGlucoseUnit, BloodKetonesUnit, UserSettings } from "@hedia/types";
2
+ import { MGDL_PER_MMOLL_BGL, MGDL_PER_MMOLL_BKL } from "./Constants";
3
+ const InjectionMethod = UserSettings.Enums.InjectionMethod;
4
+ const { PenHalf, PenWhole, Pump } = InjectionMethod;
5
+ /** Helper functions used for displaying data to the user. */
6
+ export class Utils {
7
+ /**
8
+ * Get the inverse of the precision to an insulin amount should be rounded based on the user’s injection method.
9
+ *
10
+ * Steps:
11
+ * 1. Use a switch statement to return the appropriate number depending on the value of the method argument:
12
+ * - If PenWhole, return 1.
13
+ * - If PenHalf, return 2.
14
+ * - If Pump, return 10.
15
+ * - Otherwise throw an exception.
16
+ * @param method The method by which the user injects insulin.
17
+ * @returns The inverse of the precision to which an insulin amount should be rounded based on the user’s injection method.
18
+ */
19
+ static getRounding(method) {
20
+ switch (method) {
21
+ case PenWhole:
22
+ return 1;
23
+ case PenHalf:
24
+ return 2;
25
+ case Pump:
26
+ return 10;
27
+ default:
28
+ throw Error(`Unsupported InjectionMethod: ${method}`);
29
+ }
30
+ }
31
+ /**
32
+ * Round an insulin amount to the precision that is dictated by the user’s injection method.
33
+ *
34
+ * Steps:
35
+ * 1. Get the inverse rounding precision by calling getRounding() with injectMethod as argument.
36
+ * 2. Return the rounded insulin amount calculated by the following operations:
37
+ * - Multiply the insulin value prop by the inverse rounding precision.
38
+ * - Round to the nearest whole number.
39
+ * - Divide by the inverse rounding precision and return the result.
40
+ * @param value The amount of insulin to be rounded.
41
+ * @param injectMethod The method by which the user injects insulin.
42
+ * @returns The rounded insulin amount.
43
+ */
44
+ static roundValue(value, injectMethod) {
45
+ const rounding = Utils.getRounding(injectMethod);
46
+ return Math.round(value * rounding) / rounding;
47
+ }
48
+ /**
49
+ * Determine whether a numerical value is in the given closed interval.
50
+ *
51
+ * Steps:
52
+ * 1. If value is null then return false. (Note that we only need to check explicitly for null comparing it
53
+ * to a number returns true while comparing undefined to a number returns false).
54
+ * 2. Evaluate whether value >= the interval argument’s min property && value <= the interval argument’s max property and return the result.
55
+ * @param value The number that will be checked for membership of the interval.
56
+ * @param interval The interval to compare the value to.
57
+ * @returns Boolean value indicating whether the value is in the closed interval.
58
+ */
59
+ static isInRange(value, interval) {
60
+ if (value === null) {
61
+ return false;
62
+ }
63
+ return value >= interval.min && value <= interval.max;
64
+ }
65
+ /**
66
+ * Convert a blood glucose level value from mmol/L to mg/dL.
67
+ *
68
+ * Steps:
69
+ * 1. Return the result of rounding the product of multiplying value with MGDL_PER_MMOLL_BGL.
70
+ * @param value The blood glucose level value in mmol/L to be converted.
71
+ * @returns The blood glucose value in mg/dL that corresponds to the given value in mmol/L.
72
+ */
73
+ static convertBGLToMGDL(value) {
74
+ return Math.round(value * MGDL_PER_MMOLL_BGL);
75
+ }
76
+ /**
77
+ * Depending on the blood glucose unit passed, returns the value as a string or returns a stringified call to the convertBGLToMGDL method.
78
+ *
79
+ * Steps:
80
+ * 1. Using a ternary operator on the unit argument return the passed value argument in case unit is a MMOL_L.
81
+ * Otherwise, return a call to the convertBGLToMGDL method with the value passed as an argument.
82
+ * @param value The blood glucose level value in mmol/L to be converted.
83
+ * @param unit The blood glucose measurement unit.
84
+ * @returns The blood glucose value that will be displayed to the user.
85
+ */
86
+ static displayedBGLValue(value, unit) {
87
+ return unit === BloodGlucoseUnit.MMOL_L ? value.toFixed(1) : `${Utils.convertBGLToMGDL(value)}`;
88
+ }
89
+ /**
90
+ * Convert a blood ketones concentration from mmol/L to mg/dL.
91
+ * Steps:
92
+ * 1. Return the result of rounding the product of multiplying value with MGDL_PER_MMOLL_BKL.
93
+ * @param value The blood ketones concentration in mmol/L to be converted.
94
+ * @returns The blood ketones concentration in mg/dL that corresponds to the given value in mmol/L.
95
+ */
96
+ static convertBKLToMGDL(value) {
97
+ return Math.round(value * MGDL_PER_MMOLL_BKL);
98
+ }
99
+ /**
100
+ * Depending on the blood ketone unit passed, returns the value as a string or returns a call to the convertBKLToMGDL method.
101
+ *
102
+ * Steps:
103
+ * 1. Using a ternary operator on the unit argument return the passed value argument in case unit is a MMOL_L.
104
+ * Otherwise, return a call to the convertBKLToMGDL method with the value passed as an argument.
105
+ * @param value The blood ketone level value in mmol/L to be converted.
106
+ * @param unit The blood ketone measurement unit.
107
+ * @returns The blood ketone value that will be displayed to the user.
108
+ */
109
+ static displayedBKLValue(value, unit) {
110
+ return unit === BloodKetonesUnit.MMOL_L ? value.toFixed(1) : `${Utils.convertBKLToMGDL(value)}`;
111
+ }
112
+ /**
113
+ * Format a measurement unit for displaying to the user. More concrete, it is used to display the litre symbol with uppercase "L".
114
+ *
115
+ * Steps:
116
+ * 1. Set unitWithoutLastLetter to be unit except for the last character.
117
+ * 2. Set lastLetterUppercase to be the last letter of unit converted to uppercase.
118
+ * 3. Return unitWithoutLastLetter concatenated with lastLetterUppercase.
119
+ * @param unit The measurement unit to format.
120
+ * @returns The measurement unit formatted for displaying to the user.
121
+ */
122
+ static formatUnit = (unit) => {
123
+ const unitWithoutLastLetter = unit.substring(0, unit.length - 1);
124
+ const lastLetterUppercase = unit.substring(unit.length - 1, unit.length).toUpperCase();
125
+ return `${unitWithoutLastLetter}${lastLetterUppercase}`;
126
+ };
127
+ /**
128
+ * Returns the key of key/value object when passing the key value as argument.
129
+ *
130
+ * Steps:
131
+ * 1. Save all the values of the keys object into the values constant
132
+ * 2. From the array of keys, return the one at the index of the first occurence of the value in the values constant
133
+ * @param keys The keys of the T object.
134
+ * @param value The value for the requested key.
135
+ * @returns The key of the passed value.
136
+ */
137
+ static getKeyFromValue(keys, value) {
138
+ const values = Object.values(keys);
139
+ return Object.keys(keys)[values.indexOf(value)];
140
+ }
141
+ }
@@ -42,7 +42,7 @@ export declare function checkBKProps(bloodKetoneUnit: BloodKetonesUnit | null, c
42
42
  * If language is not present in the Languages enum values array, throw a LanguageError.
43
43
  * @param language The user’s preferred language for using the app.
44
44
  */
45
- export declare function checkLanguage(language: keyof typeof Languages): void;
45
+ export declare function checkLanguage(language: Languages): void;
46
46
  /**
47
47
  * Check if the latest logbook from the last 6 hours is valid.
48
48
  *
@@ -248,4 +248,3 @@ export declare function checkInsulinToCarbRatio(insulinToCarbRatio: number): voi
248
248
  * @param carbohydrates The amount of carbohydrates that the user is eating in grams.
249
249
  */
250
250
  export declare function checkCarbohydrates(carbohydrates: number): void;
251
- //# sourceMappingURL=Validations.d.ts.map
@@ -4,19 +4,13 @@
4
4
  * and prevent a recommendation to be shown to the user based on the corrupted data.
5
5
  * @module
6
6
  */
7
-
7
+ import { Activity, BloodGlucoseUnit, BloodKetonesUnit, Languages, UserSettings, } from "@hedia/types";
8
8
  import moment from "moment";
9
- import { Activity, BloodGlucoseUnit, BloodKetonesUnit, Languages, UserSettings } from "@hedia/types";
10
- import { ACTIVITY_BUFFER_MINUTES, ACTIVITY_DURATION_MINUTES_LIMITS, ACTIVITY_SETTINGS_INTERVAL_LIMITS, ACTIVITY_TARGET_BGL_MMOL_LIMITS, BOLUS_SECONDS_PASSED_LIMITS, CARBOHYDRATES_LIMTS, CURRENT_BGL_MMOL_LIMITS, CURRENT_BKL_MMOL_LIMITS, INSULIN_DOSE_LIMITS, INSULIN_SENSITIVITY_MMOL_LIMITS, INSULIN_TO_CARBS_RATIO_LIMITS, ONE_HOUR_MINUTES, REMINDER_HOURS_LIMITS, TARGET_BGL_MMOL_LIMITS } from "./Constants";
11
- import { ActivityDateError, ActivityDurationError, ActivityIntensityError, ActivitySettingsError, ActivityTargetBGLError, ActivityTypeError, BloodGlucoseUnitError, BloodKetonePropsError, BloodKetoneUnitError, BolusInsulinDoseError, BolusInsulinSecondsPassedError, CarbohydrateLimitError, CurrentBGLError, CurrentBKLError, InjectionMethodError, InsulinSensitivityError, InsulinToCarbsRatioError, LanguageError, LatestLogbook6HoursBGLError, RecentBolusError, TargetBGLError, UserReminderError } from "./RecommendationError";
9
+ import { ACTIVITY_BUFFER_MINUTES, ACTIVITY_DURATION_MINUTES_LIMITS, ACTIVITY_SETTINGS_INTERVAL_LIMITS, ACTIVITY_TARGET_BGL_MMOL_LIMITS, BOLUS_SECONDS_PASSED_LIMITS, CARBOHYDRATES_LIMTS, CURRENT_BGL_MMOL_LIMITS, CURRENT_BKL_MMOL_LIMITS, INSULIN_DOSE_LIMITS, INSULIN_SENSITIVITY_MMOL_LIMITS, INSULIN_TO_CARBS_RATIO_LIMITS, ONE_HOUR_MINUTES, REMINDER_HOURS_LIMITS, TARGET_BGL_MMOL_LIMITS, } from "./Constants";
10
+ import { ActivityDateError, ActivityDurationError, ActivityIntensityError, ActivitySettingsError, ActivityTargetBGLError, ActivityTypeError, BloodGlucoseUnitError, BloodKetonePropsError, BloodKetoneUnitError, BolusInsulinDoseError, BolusInsulinSecondsPassedError, CarbohydrateLimitError, CurrentBGLError, CurrentBKLError, InjectionMethodError, InsulinSensitivityError, InsulinToCarbsRatioError, LanguageError, LatestLogbook6HoursBGLError, RecentBolusError, TargetBGLError, UserReminderError, } from "./RecommendationError";
12
11
  import { Utils } from "./Utils";
13
- const {
14
- hard
15
- } = Activity.Enums.ActivityIntensity;
16
- const {
17
- fromFortysix
18
- } = Activity.Enums.ActivityReductionIntervals;
19
-
12
+ const { hard } = Activity.Enums.ActivityIntensity;
13
+ const { fromFortysix } = Activity.Enums.ActivityReductionIntervals;
20
14
  /**
21
15
  * Main function for validating all input properties for the insulin recommendation screen component.
22
16
  * Throws an exception if any of the individual checks fail.
@@ -36,20 +30,19 @@ const {
36
30
  * @param props All the props that were passed in to the RecommendationScreen component.
37
31
  */
38
32
  export function validateParams(props) {
39
- checkCalculatorParams(props.calculatorParams);
40
- checkBGLUnit(props.bloodGlucoseUnit);
41
- checkBKProps(props.bloodKetoneUnit, props.currentBKL);
42
- checkBKLUnit(props.bloodKetoneUnit);
43
- checkBloodKetoneLevel(props.currentBKL);
44
- checkInjectionMethod(props.injectionMethod);
45
- checkUserReminder(props.userReminder);
46
- checkLanguage(props.language);
47
- checkLatestLogbook6Hours(props.latestLogbookFrom6Hours);
48
- if (props?.calculatorParams?.activity && props?.activityDisplayProps) {
49
- checkActivityType(props.activityDisplayProps.activityType);
50
- }
33
+ checkCalculatorParams(props.calculatorParams);
34
+ checkBGLUnit(props.bloodGlucoseUnit);
35
+ checkBKProps(props.bloodKetoneUnit, props.currentBKL);
36
+ checkBKLUnit(props.bloodKetoneUnit);
37
+ checkBloodKetoneLevel(props.currentBKL);
38
+ checkInjectionMethod(props.injectionMethod);
39
+ checkUserReminder(props.userReminder);
40
+ checkLanguage(props.language);
41
+ checkLatestLogbook6Hours(props.latestLogbookFrom6Hours);
42
+ if (props?.calculatorParams?.activity && props?.activityDisplayProps) {
43
+ checkActivityType(props.activityDisplayProps.activityType);
44
+ }
51
45
  }
52
-
53
46
  /**
54
47
  * In case the users is providing a blood ketone current level, check if the blood ketone unit is defined.
55
48
  *
@@ -59,11 +52,10 @@ export function validateParams(props) {
59
52
  * @param currentBKL The users’s current blood ketone level.
60
53
  */
61
54
  export function checkBKProps(bloodKetoneUnit, currentBKL) {
62
- if (currentBKL !== null && bloodKetoneUnit === null) {
63
- throw BloodKetonePropsError();
64
- }
55
+ if (currentBKL !== null && bloodKetoneUnit === null) {
56
+ throw BloodKetonePropsError();
57
+ }
65
58
  }
66
-
67
59
  /**
68
60
  * The user’s preferred language for using the app.
69
61
  *
@@ -73,11 +65,10 @@ export function checkBKProps(bloodKetoneUnit, currentBKL) {
73
65
  * @param language The user’s preferred language for using the app.
74
66
  */
75
67
  export function checkLanguage(language) {
76
- if (!Object.keys(Languages).includes(language)) {
77
- throw LanguageError();
78
- }
68
+ if (!Object.values(Languages).includes(language)) {
69
+ throw LanguageError();
70
+ }
79
71
  }
80
-
81
72
  /**
82
73
  * Check if the latest logbook from the last 6 hours is valid.
83
74
  *
@@ -89,16 +80,15 @@ export function checkLanguage(language) {
89
80
  * @param logbook The user’s latest logbook from the last 6 hours
90
81
  */
91
82
  export function checkLatestLogbook6Hours(logbook) {
92
- if (logbook === undefined) {
93
- throw LatestLogbook6HoursBGLError();
94
- }
95
- if (logbook !== null && logbook.blood_glucose_millimolar !== null) {
96
- if (!Utils.isInRange(logbook.blood_glucose_millimolar, CURRENT_BGL_MMOL_LIMITS)) {
97
- throw LatestLogbook6HoursBGLError();
83
+ if (logbook === undefined) {
84
+ throw LatestLogbook6HoursBGLError();
85
+ }
86
+ if (logbook !== null && logbook.blood_glucose_millimolar !== null) {
87
+ if (!Utils.isInRange(logbook.blood_glucose_millimolar, CURRENT_BGL_MMOL_LIMITS)) {
88
+ throw LatestLogbook6HoursBGLError();
89
+ }
98
90
  }
99
- }
100
91
  }
101
-
102
92
  /**
103
93
  * Check if the injectionMethod parameter is valid.
104
94
  *
@@ -108,12 +98,11 @@ export function checkLatestLogbook6Hours(logbook) {
108
98
  * @param injectionMethod The user’s insulin injection method.
109
99
  */
110
100
  export function checkInjectionMethod(injectionMethod) {
111
- const check = Object.values(UserSettings.Enums.InjectionMethod).some(method => method === injectionMethod);
112
- if (!check) {
113
- throw InjectionMethodError();
114
- }
101
+ const check = Object.values(UserSettings.Enums.InjectionMethod).some((method) => method === injectionMethod);
102
+ if (!check) {
103
+ throw InjectionMethodError();
104
+ }
115
105
  }
116
-
117
106
  /**
118
107
  * Check if the blood glucose unit parameter is valid.
119
108
  * Steps:
@@ -122,12 +111,11 @@ export function checkInjectionMethod(injectionMethod) {
122
111
  * @param unit The user’s preferred blood glucose unit for using the app.
123
112
  */
124
113
  export function checkBGLUnit(unit) {
125
- const check = Object.values(BloodGlucoseUnit).some(enumUnit => enumUnit === unit);
126
- if (!check) {
127
- throw BloodGlucoseUnitError();
128
- }
114
+ const check = Object.values(BloodGlucoseUnit).some((enumUnit) => enumUnit === unit);
115
+ if (!check) {
116
+ throw BloodGlucoseUnitError();
117
+ }
129
118
  }
130
-
131
119
  /**
132
120
  * Check if the blood ketones unit parameter is valid.
133
121
  *
@@ -138,14 +126,13 @@ export function checkBGLUnit(unit) {
138
126
  * It can be null if the user did not choose a measurement unit at the moment of this validation.
139
127
  */
140
128
  export function checkBKLUnit(unit) {
141
- if (unit !== null) {
142
- const check = Object.values(BloodKetonesUnit).some(enumUnit => enumUnit === unit);
143
- if (!check) {
144
- throw BloodKetoneUnitError();
129
+ if (unit !== null) {
130
+ const check = Object.values(BloodKetonesUnit).some((enumUnit) => enumUnit === unit);
131
+ if (!check) {
132
+ throw BloodKetoneUnitError();
133
+ }
145
134
  }
146
- }
147
135
  }
148
-
149
136
  /**
150
137
  * Check if the users preferred default reminder duration is valid by verifying that it is within the allowed range.
151
138
  *
@@ -154,11 +141,10 @@ export function checkBKLUnit(unit) {
154
141
  * @param userReminder The default reminder time in hours from the user’s settings
155
142
  */
156
143
  export function checkUserReminder(userReminder) {
157
- if (!Utils.isInRange(userReminder, REMINDER_HOURS_LIMITS)) {
158
- throw UserReminderError();
159
- }
144
+ if (!Utils.isInRange(userReminder, REMINDER_HOURS_LIMITS)) {
145
+ throw UserReminderError();
146
+ }
160
147
  }
161
-
162
148
  /**
163
149
  * Check validity of the values that are used as input for the actual insulin recommendation calculation.
164
150
  *
@@ -175,17 +161,16 @@ export function checkUserReminder(userReminder) {
175
161
  * @param calculatorParams The inputs for calculation to be checked
176
162
  */
177
163
  export function checkCalculatorParams(calculatorParams) {
178
- checkActivity(calculatorParams.activity);
179
- checkCarbohydrates(calculatorParams.carbohydrates);
180
- checkCurrentBGL(calculatorParams.currentBGL);
181
- checkTargetBGL(calculatorParams.targetBGL);
182
- checkInsulinToCarbRatio(calculatorParams.carbohydrateRatio);
183
- checkInsulinSensitivity(calculatorParams.insulinSensitivity);
184
- checkRecentBolus(calculatorParams.recentBoluses);
185
- checkRecentBolusesInsulinDose(calculatorParams.recentBoluses);
186
- checkRecentBolusesSecondsPassed(calculatorParams.recentBoluses);
164
+ checkActivity(calculatorParams.activity);
165
+ checkCarbohydrates(calculatorParams.carbohydrates);
166
+ checkCurrentBGL(calculatorParams.currentBGL);
167
+ checkTargetBGL(calculatorParams.targetBGL);
168
+ checkInsulinToCarbRatio(calculatorParams.carbohydrateRatio);
169
+ checkInsulinSensitivity(calculatorParams.insulinSensitivity);
170
+ checkRecentBolus(calculatorParams.recentBoluses);
171
+ checkRecentBolusesInsulinDose(calculatorParams.recentBoluses);
172
+ checkRecentBolusesSecondsPassed(calculatorParams.recentBoluses);
187
173
  }
188
-
189
174
  /**
190
175
  * Check the validity of the values inputted for physical activity
191
176
  *
@@ -199,15 +184,14 @@ export function checkCalculatorParams(calculatorParams) {
199
184
  * @param activity The activity that is associated with the calculation, or null if no activity was entered
200
185
  */
201
186
  export function checkActivity(activity) {
202
- if (activity) {
203
- checkActivityDate(activity);
204
- checkActivityDuration(activity.activityDuration);
205
- checkActivityIntensity(activity.activityIntensity);
206
- checkActivitySettings(activity.activitySettings);
207
- checkActivityTargetBGL(activity.activitySettings.target);
208
- }
187
+ if (activity) {
188
+ checkActivityDate(activity);
189
+ checkActivityDuration(activity.activityDuration);
190
+ checkActivityIntensity(activity.activityIntensity);
191
+ checkActivitySettings(activity.activitySettings);
192
+ checkActivityTargetBGL(activity.activitySettings.target);
193
+ }
209
194
  }
210
-
211
195
  /**
212
196
  * Check if the recentBoluses is in the right format.
213
197
  *
@@ -216,11 +200,10 @@ export function checkActivity(activity) {
216
200
  * @param recentBoluses List of all known bolus injections from the past 4 hours including insulin amount and how many seconds has passed since the injection.
217
201
  */
218
202
  export function checkRecentBolus(recentBoluses) {
219
- if (recentBoluses === null || recentBoluses === undefined) {
220
- throw RecentBolusError();
221
- }
203
+ if (recentBoluses === null || recentBoluses === undefined) {
204
+ throw RecentBolusError();
205
+ }
222
206
  }
223
-
224
207
  /**
225
208
  * Check if the insulin dose in each of the given recent insulin injections is valid by verifying that they are within the allowed range.
226
209
  *
@@ -231,13 +214,12 @@ export function checkRecentBolus(recentBoluses) {
231
214
  * @param recentBoluses List of all known bolus injections from the past 4 hours including insulin amount and how many seconds has passed since the injection.
232
215
  */
233
216
  export function checkRecentBolusesInsulinDose(recentBoluses) {
234
- recentBoluses.forEach(bolus => {
235
- if (!Utils.isInRange(bolus.insulinDose, INSULIN_DOSE_LIMITS)) {
236
- throw BolusInsulinDoseError();
237
- }
238
- });
217
+ recentBoluses.forEach((bolus) => {
218
+ if (!Utils.isInRange(bolus.insulinDose, INSULIN_DOSE_LIMITS)) {
219
+ throw BolusInsulinDoseError();
220
+ }
221
+ });
239
222
  }
240
-
241
223
  /**
242
224
  * Check if the amount of time since each recent insulin injection is valid by verifying that they are within the allowed range.
243
225
  *
@@ -248,13 +230,12 @@ export function checkRecentBolusesInsulinDose(recentBoluses) {
248
230
  * @param recentBoluses List of all known bolus injections from the past 4 hours including insulin amount and how many seconds has passed since the injection.
249
231
  */
250
232
  export function checkRecentBolusesSecondsPassed(recentBoluses) {
251
- recentBoluses.forEach(bolus => {
252
- if (!Utils.isInRange(bolus.secondsPassed, BOLUS_SECONDS_PASSED_LIMITS)) {
253
- throw BolusInsulinSecondsPassedError();
254
- }
255
- });
233
+ recentBoluses.forEach((bolus) => {
234
+ if (!Utils.isInRange(bolus.secondsPassed, BOLUS_SECONDS_PASSED_LIMITS)) {
235
+ throw BolusInsulinSecondsPassedError();
236
+ }
237
+ });
256
238
  }
257
-
258
239
  /**
259
240
  * Check if the duration of an entered activity is valid by verifying that it is within the allowed range.
260
241
  *
@@ -263,11 +244,10 @@ export function checkRecentBolusesSecondsPassed(recentBoluses) {
263
244
  * @param activityDuration The duration of an entered physical activity in minutes.
264
245
  */
265
246
  export function checkActivityDuration(activityDuration) {
266
- if (!Utils.isInRange(activityDuration, ACTIVITY_DURATION_MINUTES_LIMITS)) {
267
- throw ActivityDurationError();
268
- }
247
+ if (!Utils.isInRange(activityDuration, ACTIVITY_DURATION_MINUTES_LIMITS)) {
248
+ throw ActivityDurationError();
249
+ }
269
250
  }
270
-
271
251
  /**
272
252
  * Check if the activity intensity parameter is valid.
273
253
  *
@@ -277,12 +257,11 @@ export function checkActivityDuration(activityDuration) {
277
257
  * @param activityIntensity The intensity of the entered activity.
278
258
  */
279
259
  export function checkActivityIntensity(activityIntensity) {
280
- const check = Object.values(Activity.Enums.ActivityIntensity).some(method => method === activityIntensity);
281
- if (!check) {
282
- throw ActivityIntensityError();
283
- }
260
+ const check = Object.values(Activity.Enums.ActivityIntensity).some((method) => method === activityIntensity);
261
+ if (!check) {
262
+ throw ActivityIntensityError();
263
+ }
284
264
  }
285
-
286
265
  /**
287
266
  * Check if the activity type parameter is valid.
288
267
  *
@@ -292,12 +271,11 @@ export function checkActivityIntensity(activityIntensity) {
292
271
  * @param activityType The type of the entered activity.
293
272
  */
294
273
  export function checkActivityType(activityType) {
295
- const check = Object.values(Activity.Enums.ActivityEnum).some(method => method === activityType);
296
- if (!check) {
297
- throw ActivityTypeError();
298
- }
274
+ const check = Object.values(Activity.Enums.ActivityEnum).some((method) => method === activityType);
275
+ if (!check) {
276
+ throw ActivityTypeError();
277
+ }
299
278
  }
300
-
301
279
  /**
302
280
  * Verify that the ending time of the given activity has not been passed by more than 4 hours and 10 minutes.
303
281
  *
@@ -308,12 +286,13 @@ export function checkActivityType(activityType) {
308
286
  * @param activity The activity for which we want to check the date
309
287
  */
310
288
  export function checkActivityDate(activity) {
311
- const maximumDate = moment.utc(activity.activityDate).add(activity.activityDuration + ONE_HOUR_MINUTES * 4 + ACTIVITY_BUFFER_MINUTES, `minutes`);
312
- if (moment.utc().isAfter(maximumDate)) {
313
- throw ActivityDateError();
314
- }
289
+ const maximumDate = moment
290
+ .utc(activity.activityDate)
291
+ .add(activity.activityDuration + ONE_HOUR_MINUTES * 4 + ACTIVITY_BUFFER_MINUTES, `minutes`);
292
+ if (moment.utc().isAfter(maximumDate)) {
293
+ throw ActivityDateError();
294
+ }
315
295
  }
316
-
317
296
  /**
318
297
  * Steps:
319
298
  * 1. Iterate over all combinations of activity intensities and activity duration intervals and for each one:
@@ -324,22 +303,22 @@ export function checkActivityDate(activity) {
324
303
  * @param activitySettings The user’s settings for doing physical activity
325
304
  */
326
305
  export function checkActivitySettings(activitySettings) {
327
- for (const intensity of Object.keys(activitySettings)) {
328
- const reductionIntervals = activitySettings[intensity];
329
- for (const interval of Object.keys(reductionIntervals)) {
330
- const value = activitySettings[intensity][interval];
331
- const isInInterval = Utils.isInRange(value, ACTIVITY_SETTINGS_INTERVAL_LIMITS);
332
- if (intensity === hard && interval === fromFortysix) {
333
- if (!isInInterval && value !== null) {
334
- throw ActivitySettingsError();
306
+ for (const intensity of Object.keys(activitySettings)) {
307
+ const reductionIntervals = activitySettings[intensity];
308
+ for (const interval of Object.keys(reductionIntervals)) {
309
+ const value = activitySettings[intensity][interval];
310
+ const isInInterval = Utils.isInRange(value, ACTIVITY_SETTINGS_INTERVAL_LIMITS);
311
+ if (intensity === hard && interval === fromFortysix) {
312
+ if (!isInInterval && value !== null) {
313
+ throw ActivitySettingsError();
314
+ }
315
+ }
316
+ else if (!isInInterval) {
317
+ throw ActivitySettingsError();
318
+ }
335
319
  }
336
- } else if (!isInInterval) {
337
- throw ActivitySettingsError();
338
- }
339
320
  }
340
- }
341
321
  }
342
-
343
322
  /**
344
323
  * Check if the target blood glucose level for doing exercise is valid by verifying that it is within the allowed range.
345
324
  *
@@ -348,11 +327,10 @@ export function checkActivitySettings(activitySettings) {
348
327
  * @param activitySettingsTargetBGL The target blood glucose level for doing exercise in mmol/L from the user’s settings.
349
328
  */
350
329
  export function checkActivityTargetBGL(activitySettingsTargetBGL) {
351
- if (!Utils.isInRange(activitySettingsTargetBGL, ACTIVITY_TARGET_BGL_MMOL_LIMITS)) {
352
- throw ActivityTargetBGLError();
353
- }
330
+ if (!Utils.isInRange(activitySettingsTargetBGL, ACTIVITY_TARGET_BGL_MMOL_LIMITS)) {
331
+ throw ActivityTargetBGLError();
332
+ }
354
333
  }
355
-
356
334
  /**
357
335
  * Check if the current blood glucose level is valid by verifying that it is either null or within the allowed range.
358
336
  * Steps:
@@ -361,13 +339,12 @@ export function checkActivityTargetBGL(activitySettingsTargetBGL) {
361
339
  * @param currentBGL The current blood glucose level in mmol/L entered by the user, or null to indicate that the value is unknown because it wasn’t given.
362
340
  */
363
341
  export function checkCurrentBGL(currentBGL) {
364
- if (currentBGL !== null) {
365
- if (!Utils.isInRange(currentBGL, CURRENT_BGL_MMOL_LIMITS)) {
366
- throw CurrentBGLError();
342
+ if (currentBGL !== null) {
343
+ if (!Utils.isInRange(currentBGL, CURRENT_BGL_MMOL_LIMITS)) {
344
+ throw CurrentBGLError();
345
+ }
367
346
  }
368
- }
369
347
  }
370
-
371
348
  /**
372
349
  * Check if the target blood glucose level is valid by verifying that it is within the allowed range.
373
350
  *
@@ -376,11 +353,10 @@ export function checkCurrentBGL(currentBGL) {
376
353
  * @param targetBGL The target blood glucose level in mmol/L extracted from the user’s settings depending on the time of day.
377
354
  */
378
355
  export function checkTargetBGL(targetBGL) {
379
- if (!Utils.isInRange(targetBGL, TARGET_BGL_MMOL_LIMITS)) {
380
- throw TargetBGLError();
381
- }
356
+ if (!Utils.isInRange(targetBGL, TARGET_BGL_MMOL_LIMITS)) {
357
+ throw TargetBGLError();
358
+ }
382
359
  }
383
-
384
360
  /**
385
361
  * Check if the current blood ketones concentration is valid by verifying that it is either null or within the allowed range.
386
362
  *
@@ -389,13 +365,12 @@ export function checkTargetBGL(targetBGL) {
389
365
  * @param currentBKL The current blood ketones concentration in mmol/L entered by the user, or null to indicate that the value is unknown because it wasn’t given.
390
366
  */
391
367
  export function checkBloodKetoneLevel(currentBKL) {
392
- if (currentBKL !== null) {
393
- if (!Utils.isInRange(currentBKL, CURRENT_BKL_MMOL_LIMITS)) {
394
- throw CurrentBKLError();
368
+ if (currentBKL !== null) {
369
+ if (!Utils.isInRange(currentBKL, CURRENT_BKL_MMOL_LIMITS)) {
370
+ throw CurrentBKLError();
371
+ }
395
372
  }
396
- }
397
373
  }
398
-
399
374
  /**
400
375
  * Check if the insulin sensitivity is valid by verifying that it is within the allowed range.
401
376
  *
@@ -404,11 +379,10 @@ export function checkBloodKetoneLevel(currentBKL) {
404
379
  * @param insulinSensitivity The insulin sensitivity in (mmol/L)/IU extracted from the user’s settings depending on the time of day.
405
380
  */
406
381
  export function checkInsulinSensitivity(insulinSensitivity) {
407
- if (!Utils.isInRange(insulinSensitivity, INSULIN_SENSITIVITY_MMOL_LIMITS)) {
408
- throw InsulinSensitivityError();
409
- }
382
+ if (!Utils.isInRange(insulinSensitivity, INSULIN_SENSITIVITY_MMOL_LIMITS)) {
383
+ throw InsulinSensitivityError();
384
+ }
410
385
  }
411
-
412
386
  /**
413
387
  * Check if the insulin-to-carbs ratio is valid by verifying that it is within the allowed range.
414
388
  *
@@ -417,11 +391,10 @@ export function checkInsulinSensitivity(insulinSensitivity) {
417
391
  * @param insulinToCarbRatio The insulin-to-carbs ratio in g/IU extracted from the user’s settings depending on the time of day.
418
392
  */
419
393
  export function checkInsulinToCarbRatio(insulinToCarbRatio) {
420
- if (!Utils.isInRange(insulinToCarbRatio, INSULIN_TO_CARBS_RATIO_LIMITS)) {
421
- throw InsulinToCarbsRatioError();
422
- }
394
+ if (!Utils.isInRange(insulinToCarbRatio, INSULIN_TO_CARBS_RATIO_LIMITS)) {
395
+ throw InsulinToCarbsRatioError();
396
+ }
423
397
  }
424
-
425
398
  /**
426
399
  * Check if the entered amount of carbohydrates is valid by verifying that it is within the allowed range.
427
400
  *
@@ -430,8 +403,7 @@ export function checkInsulinToCarbRatio(insulinToCarbRatio) {
430
403
  * @param carbohydrates The amount of carbohydrates that the user is eating in grams.
431
404
  */
432
405
  export function checkCarbohydrates(carbohydrates) {
433
- if (!Utils.isInRange(carbohydrates, CARBOHYDRATES_LIMTS)) {
434
- throw CarbohydrateLimitError();
435
- }
406
+ if (!Utils.isInRange(carbohydrates, CARBOHYDRATES_LIMTS)) {
407
+ throw CarbohydrateLimitError();
408
+ }
436
409
  }
437
- //# sourceMappingURL=Validations.js.map