@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
@@ -1,768 +0,0 @@
1
- import React from "react";
2
- import { AppState, LogBox, StyleSheet, View } from "react-native";
3
- import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
4
- import * as Calculator from "@hedia/recommendation-calculator";
5
- import { Milliseconds } from "@hedia/types";
6
- import Activity from "./components/activity/Activity";
7
- import ExitModal from "./components/ExitModal";
8
- import InfoBars from "./components/InfoBars";
9
- import Emotion from "./components/mood/Emotion";
10
- import RecentInsulin from "./components/RecentInsulin";
11
- import RecommendationModal from "./components/RecommendationModal";
12
- import RecommendedCarbs from "./components/RecommendedCarbs";
13
- import RecommendedInsulin from "./components/RecommendedInsulin";
14
- import Remeasure from "./components/Remeasure";
15
- import { FONTS } from "./components/styles/fonts";
16
- import Text from "./components/Text";
17
- import TimeoutModal from "./components/TimeoutModal";
18
- import TransferToLogbook from "./components/TransferToLogbook";
19
- import { changeLocale, t } from "./locales/translate";
20
- import { ExitModalActions, Testing, TimeoutModalActions } from "./types/enum";
21
- import { Messages } from "./utils/AttentionMessages";
22
- import { colors } from "./utils/Constants";
23
- import { getAttentionMessage, getBGLevel, getLimitationMessage, getReminder } from "./utils/RecommendationUtils";
24
- import { Utils } from "./utils/Utils";
25
- import { validateParams } from "./utils/Validations";
26
- const {
27
- InfoBarTestIds,
28
- RecommendationScreenTestIds
29
- } = Testing.Id;
30
-
31
- // Ignoring long timer warnings
32
- // https://github.com/facebook/react-native/issues/12981#issuecomment-652745831
33
- LogBox.ignoreLogs([`Setting a timer`]);
34
-
35
- /** Represents both a suggestion by HDA and an actual amount of either insulin or carbohydrates. */
36
-
37
- /**
38
- * The RecommendationScreen is the React component that passes relevant inputs to the recommendation calculation module and presents
39
- * the resulting recommendation along with related messages or warnings to the user.
40
- * The RecommendationScreen component accepts properties with the user’s settings/preferences and other inputs needed for calculating a recommendation.
41
- * @noInheritDoc
42
- */
43
- export class RecommendationScreen extends React.Component {
44
- /** Reference to the timer that prompts the user to make a new calculation after 15 minutes. */
45
-
46
- /**
47
- * The carbohydrate recommendation for the user.
48
- * This value is saved in a member variable because we want to store it unmodified if the logbook entry
49
- * gets saved regardless of what other changes were made on the recommendation screen.
50
- */
51
-
52
- /**
53
- * A guard against displaying wrong or dangerous information to the user.
54
- * If an error has occurred, this variable will be set to true and an empty placeholder will be rendered instead of the normal recommendation screen.
55
- */
56
- hasError = false;
57
- /** The timestamp when the current recommendation was made. For determining if the recommendation is too old and should be hidden from the user. */
58
-
59
- /**
60
- * A reference to the screens scrollview allowing us to programmatically scroll the screen in the handleNoRecentInsulin() method.
61
- * The member is initiated without a value but will be set as soon as the component is being rendered.
62
- */
63
-
64
- /**
65
- * A reference to the eventSubscription that'll be returned by AppState.addEventListener().
66
- * It'll allow us to later remove the subscription.
67
- */
68
-
69
- /**
70
- * Steps:
71
- * 1. Call the super() method with the props.
72
- * 2. Execute the following steps and if an exception is thrown, catch it, set the hasError member variable to true and call the onError callback prop with the caught exception as argument:
73
- * - Call the validateParams() method with the props as argument
74
- * - Set the recommendationDate member to the current date and time
75
- * - Set the language by using the language prop as argument for calling changeLanguage()
76
- * - Unpack recentBoluses from the calculatorParams prop.
77
- * - Use the calculatorParams prop as argument for calling calculateRecommendation() and unpack all of the resulting values.
78
- * - Call the onRecommendationDisplayed() callback prop if the recommendation is visible
79
- * - Copy the carbRecommendation to the suggestedCarbs member variable.
80
- * - Set the following state variables:
81
- * - Set remeasureTime to the return value from calling the getBGLevelRemeasurementReminder() method.
82
- * - Set isRecommendationDisplayed to be false if the length of recentBoluses is 0 or false otherwise.
83
- * - Set insulinRecommendation to be the bolus insulin recommendation rounded using roundValue().
84
- * - Set wasLimited to the wasLimited return value from calling calculateRecommendation() above.
85
- * - Set activityReduction to the reduction returned from the calculation result.
86
- * - Set carbRecommendation to the recommendation returned from the calculation result.
87
- * - Set activeInsulin to the estimation returned from the calculation result.
88
- * - Set enteredCarbs, enteredInsulin, selectedMood to null.
89
- * - Set recommendationModal to be true if wasLimited is true or if carbRecommendation after being rounded is truthy or if the return value from calling the getBGLevelAttentionMessage() method is truthy.
90
- * - Set onlyShowLimitationMessage, showTimeoutModal to be false.
91
- * - Set showExitModal with the value of the showExitModal prop.
92
- * 3. Start a 15 minute timer assigned to the timer member variable using the setTimeout() function. When the timer expires, call the showTimeoutModal() method.
93
- * @param props The data required to initialise the Recommendation Screen
94
- */
95
- constructor(props) {
96
- super(props);
97
- try {
98
- validateParams(props);
99
- changeLocale(props.language);
100
- this.recommendationDate = new Date();
101
- const {
102
- recentBoluses
103
- } = props.calculatorParams;
104
- const {
105
- bolus,
106
- carbRecommendation,
107
- activityReduction,
108
- wasLimited,
109
- activeInsulin
110
- } = Calculator.calculateRecommendation(props.calculatorParams);
111
- this.suggestedCarbs = carbRecommendation;
112
- const isRecommendationDisplayed = recentBoluses?.length !== 0;
113
- if (isRecommendationDisplayed) {
114
- this.props.onRecommendationDisplayed();
115
- }
116
- this.state = {
117
- remeasureTime: this.getBGLevelRemeasurementReminder(),
118
- isRecommendationDisplayed,
119
- insulinRecommendation: Utils.roundValue(bolus, props.injectionMethod),
120
- wasLimited,
121
- activityReduction,
122
- carbRecommendation,
123
- activeInsulin,
124
- enteredCarbs: null,
125
- enteredInsulin: null,
126
- selectedMood: null,
127
- recommendationModal: wasLimited || !!Math.round(carbRecommendation) || !!this.getBGLevelAttentionMessage(),
128
- onlyShowLimitationMessage: false,
129
- showExitModal: props.showExitModal,
130
- showTimeoutModal: false,
131
- timeoutModalAction: null,
132
- exitModalAction: null
133
- };
134
- this.timer = setTimeout(this.showTimeoutModal, Milliseconds.Minute * 15);
135
- } catch (error) {
136
- this.hasError = true;
137
- props.onError(error);
138
- }
139
- }
140
-
141
- /**
142
- * Called immediately after a component is mounted. Setting state here will trigger re-rendering.
143
- *
144
- * Steps:
145
- * 1. If there is no error, create a listener to call the handleAppStateChange() method when the app state changes.
146
- */
147
- componentDidMount() {
148
- if (!this.hasError) {
149
- this.appStateSubscription = AppState.addEventListener(`change`, this.handleAppStateChange);
150
- }
151
- }
152
-
153
- /**
154
- * Called immediately before a component is destroyed.
155
- * Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.
156
- *
157
- * Clear the 15 minute timer that was set in the constructor during initialisation so it doesn't keep running and gets triggered after the recommendation screen was closed.
158
- *
159
- * Steps:
160
- * 1. Call clearTimeout on the timer member variable.
161
- * 2. Remove the listener for app state changes that was set by the componentDidMount() method.
162
- */
163
- componentWillUnmount() {
164
- if (this.timer !== undefined) {
165
- clearTimeout(this.timer);
166
- }
167
- this.appStateSubscription?.remove();
168
- }
169
-
170
- /**
171
- * Called immediately after updating occurs. This method is not called for the initial render.
172
- * Use this as an opportunity to operate on the DOM when the component has been updated.
173
- * Steps:
174
- * 1. If the showExitModal prop is true and it was false before, call the onExit() method.
175
- * @param showExitModal The previous showExitModal props of the component.
176
- */
177
- componentDidUpdate(_ref) {
178
- let {
179
- showExitModal
180
- } = _ref;
181
- if (this.props.showExitModal && showExitModal !== this.props.showExitModal) {
182
- this.onExit();
183
- }
184
- }
185
-
186
- /**
187
- * Steps:
188
- * 1. Evaluate a boolean called isOlderThan15Minutes to indicate whether the recommendationDate member variable represents a time more than 15 minutes ago.
189
- * 2. If nextAppState is ‘active’ and isOlderThan15Minutes is true then call the showTimeoutModal() method.
190
- * @param nextAppState The new state of the app.
191
- */
192
- handleAppStateChange = nextAppState => {
193
- const time = this.recommendationDate.getTime();
194
- const isOlderThan15Minutes = new Date().getTime() - time > Milliseconds.Minute * 15;
195
- if (nextAppState === `active` && isOlderThan15Minutes) {
196
- this.showTimeoutModal();
197
- }
198
- };
199
-
200
- /**
201
- * Steps:
202
- * 1. Set the showTimeoutModal state variable to be true.
203
- * */
204
- showTimeoutModal = () => {
205
- this.setState({
206
- showTimeoutModal: true
207
- });
208
- };
209
-
210
- /**
211
- * Make a new insulin calculation and set the result to be displayed to the user.
212
- *
213
- * Steps:
214
- * 1. Use calculatorParams as an argument for calling calculateRecommendation(). Unpack bolus, wasLimited, and activityReduction from the result.
215
- * 2. Set the following state variables:
216
- * - Set insulinRecommendation to the bolus rounded using the roundValue() function.
217
- * - Set enteredInsulin to be undefined.
218
- * - Set wasLimited to be the value returned from the insulin calculator.
219
- * - Set activityReduction to be the value returned from the insulin calculator.
220
- * - Set showLimitationMessage to be the wasLimited value returned from the insulin calculator.
221
- * @param calculatorParams The input values for the bolus calculator itself.
222
- */
223
- recalculateInsulin = calculatorParams => {
224
- const {
225
- bolus,
226
- wasLimited,
227
- activityReduction
228
- } = Calculator.calculateRecommendation(calculatorParams);
229
- this.setState({
230
- insulinRecommendation: Utils.roundValue(bolus, this.props.injectionMethod),
231
- enteredInsulin: null,
232
- wasLimited,
233
- activityReduction,
234
- onlyShowLimitationMessage: wasLimited
235
- });
236
- };
237
-
238
- /**
239
- * Handle presses on the exit button in the header bar.
240
- *
241
- * Steps:
242
- * 1. If the insulin recommendation is being displayed (the isRecommendationDisplayed state variable is true):
243
- * - Set the showExitModal state variable to true.
244
- * 2. Else:
245
- * - Call the exitCallback prop callback function.
246
- */
247
- onExit = () => {
248
- if (this.state?.isRecommendationDisplayed) {
249
- this.setState({
250
- showExitModal: true
251
- });
252
- } else {
253
- this.props.exitCallback();
254
- }
255
- };
256
-
257
- /**
258
- * Hide the modal that shows attention messages.
259
- *
260
- * Steps:
261
- * 1. Set the recommendationModal state variable to false.
262
- */
263
- hideAttentionModal = () => {
264
- this.setState({
265
- recommendationModal: false,
266
- onlyShowLimitationMessage: false
267
- });
268
- };
269
-
270
- /**
271
- * Handle presses on the transfer button in the exit modal.
272
- */
273
- onPressTransferExitModal = () => {
274
- this.setState({
275
- showExitModal: false,
276
- exitModalAction: ExitModalActions.Transfer
277
- });
278
- };
279
-
280
- /**
281
- * Handle presses on the close calculation button in the exit modal.
282
- */
283
- onPressCloseExitModal = () => {
284
- this.setState({
285
- showExitModal: false,
286
- exitModalAction: ExitModalActions.CloseCalculation
287
- });
288
- };
289
-
290
- /**
291
- * Handle presses on the hide button in the exit modal.
292
- */
293
- onPressHideExitModal = () => {
294
- this.setState({
295
- showExitModal: false,
296
- exitModalAction: ExitModalActions.Hide
297
- });
298
- };
299
-
300
- /**
301
- * Call the chosen modal action on the didHide modal callback .
302
- */
303
- onExitModalDidHide = () => {
304
- switch (this.state.exitModalAction) {
305
- case ExitModalActions.Transfer:
306
- this.handleTransfer();
307
- break;
308
- case ExitModalActions.CloseCalculation:
309
- this.props.closeCalculationCallback();
310
- break;
311
- case ExitModalActions.Hide:
312
- this.props.hideExitModal();
313
- break;
314
- }
315
- };
316
-
317
- /**
318
- * Handle presses on the close calculation button in the timeout modal.
319
- */
320
- onPressCloseCalculationTimeoutModal = () => {
321
- this.setState({
322
- showTimeoutModal: false,
323
- timeoutModalAction: TimeoutModalActions.CloseCalculation
324
- });
325
- };
326
-
327
- /**
328
- * Handle presses on the restart calculation button in the timeout modal.
329
- */
330
- onPressRestartCalculationTimeoutModal = () => {
331
- this.setState({
332
- showTimeoutModal: false,
333
- timeoutModalAction: TimeoutModalActions.RestartCalculation
334
- });
335
- };
336
-
337
- /**
338
- * Handle presses on the transfer button in the timeout modal.
339
- */
340
- onPressTransferTimeoutModal = () => {
341
- this.setState({
342
- showTimeoutModal: false,
343
- timeoutModalAction: TimeoutModalActions.Transfer
344
- });
345
- };
346
-
347
- /**
348
- * Call the chosen modal action on the didHide modal callback .
349
- */
350
- onTimeoutModalDidHide = () => {
351
- switch (this.state.timeoutModalAction) {
352
- case TimeoutModalActions.RestartCalculation:
353
- this.props.restartCalculation();
354
- break;
355
- case TimeoutModalActions.Transfer:
356
- this.props.onSaveToLogbook();
357
- this.handleTransfer();
358
- break;
359
- case TimeoutModalActions.CloseCalculation:
360
- this.props.onReturnToDashboard();
361
- this.props.closeCalculationCallback();
362
- break;
363
- }
364
- };
365
-
366
- /**
367
- * Used as a callback function for the Remeasure component to update the state when the remeasure time slider’s value changes.
368
- *
369
- * Steps:
370
- * 1. Set the remeasureTime state variable to the value of the remeasureTime argument.
371
- * @param remeasureTime The number of hours for which to wait before reminding the user to measure their BGL again. 0 indicates that the user should not be reminded.
372
- */
373
- updateRemeasureTime = remeasureTime => {
374
- this.setState({
375
- remeasureTime
376
- });
377
- };
378
-
379
- /**
380
- * Handle what happens if the user taps “No” to the question about injecting insulin within the last 4 hours.
381
- * The card that prompts the user to answer if they have injected insulin within the last 4 hours shall be hidden and
382
- * the screen shall automatically be scrolled to the bottom so the user can see the now visible “Transfer to logbook” button.
383
- *
384
- * Steps:
385
- * 1. Set the isRecommendationDisplayed state variable to be true.
386
- * 2. Call the onRecommendationDisplayed prop callback function.
387
- * 3. As a callback to the setState() method, define a new anonymous function that calls setTimeout() with a duration of 0 milliseconds.
388
- * When the time expires, call the scrollToEnd() method of the scrollView member, with the animated argument set to true.
389
- * This ensures that the scroll event happens after all other events that get queued to happen at the same time,
390
- * so all relevant elements are visible on the screen and the scroll happens reliably.
391
- */
392
- handleNoRecentInsulin = () => {
393
- this.props.onRecentInsulinNo();
394
- this.setState({
395
- isRecommendationDisplayed: true
396
- }, () => {
397
- this.props.onRecommendationDisplayed();
398
- setTimeout(() => {
399
- this.scrollView?.scrollToEnd(true);
400
- }, 0);
401
- });
402
- };
403
-
404
- /**
405
- * Handle what happens when the user changes the content of the additional carbohydrates input field.
406
- *
407
- * Steps:
408
- * 1. Set the enteredCarbs state variable to the value of the enteredCarbs argument.
409
- * 2. As a callback to the setState() method, define a new anonymous function that calls the recalculateInsulin() function using
410
- * a copy of the calculatorParams prop where the carbohydrates property has been overwritten to be
411
- * the sum of the carbohydrates property of the calculatorParams prop and the enteredCarbs argument.
412
- * @param enteredCarbs The amount of carbohydrates in grams that has been entered in the additional carbohydrates input field.
413
- */
414
- updateCarbRecommendation = enteredCarbs => {
415
- const providedCarbs = this.props.calculatorParams.carbohydrates;
416
- this.setState({
417
- enteredCarbs
418
- }, () => {
419
- this.recalculateInsulin({
420
- ...this.props.calculatorParams,
421
- carbohydrates: providedCarbs + enteredCarbs
422
- });
423
- });
424
- };
425
-
426
- /**
427
- * Handle what happens when the cross button by the additional carbohydrates button is tapped.
428
- *
429
- * Steps:
430
- * 1. Set both the enteredCarbs and the carbRecommendation state variables to null.
431
- * 2. As a callback to the setState() method, define a new anonymous function that calls the recalculateInsulin() function using a copy of the calculatorParams prop.
432
- */
433
- removeCarbRecommendation = () => {
434
- this.setState({
435
- enteredCarbs: null,
436
- carbRecommendation: null
437
- }, () => this.recalculateInsulin({
438
- ...this.props.calculatorParams
439
- }));
440
- };
441
-
442
- /**
443
- * Handle what happens when the user is recommended to eat additional carbohydrates but taps the decline button.
444
- *
445
- * Steps:
446
- * 1. Call the hideAttentionModal() method.
447
- * 2. Call the removeCarbRecommendation() method.
448
- * 3. Call the carbRecommendationAnswer() prop callback function with false as argument.
449
- */
450
- declineCarbRecommendation = () => {
451
- this.hideAttentionModal();
452
- this.removeCarbRecommendation();
453
- this.props.carbRecommendationAnswer(false);
454
- };
455
-
456
- /**
457
- * Handle what happens when the user is recommended to eat additional carbohydrates and they tap the accept button.
458
- *
459
- * Steps:
460
- * 1. Call the hideAttentionModal() method.
461
- * 2. Call the carbRecommendationAnswer() prop callback function with true as argument.
462
- */
463
- acceptCarbRecommendation = () => {
464
- this.hideAttentionModal();
465
- this.props.carbRecommendationAnswer(true);
466
- };
467
-
468
- /**
469
- * Used as a callback function for the Emotion component to update the state when a mood icon is tapped.
470
- *
471
- * Steps:
472
- * 1. Set the selectedMood state variable to the value of the selectedMood argument.
473
- * @param selectedMood he mood that should be selected going forward or null if no mood should be selected.
474
- */
475
- handleMoodSelected = selectedMood => {
476
- this.setState({
477
- selectedMood
478
- });
479
- };
480
-
481
- /**
482
- * Handle what happens when the user changes the content of the insulin input field.
483
- *
484
- * Steps:
485
- * 1. Set the enteredInsulin state variable to the value of the enteredInsulin argument.
486
- * @param enteredInsulin The amount of insulin (in units) that has been entered in the insulin input field.
487
- */
488
- updateInsulinRecommendation = enteredInsulin => {
489
- this.setState({
490
- enteredInsulin
491
- });
492
- };
493
-
494
- /**
495
- * Handle what happens when the “Transfer to Logbook” button is pressed.
496
- * Namely, the entered data should be saved in a logbook entry and the recommendation screen should be closed.
497
- *
498
- * Steps:
499
- * 1. Unpack the enteredCarbs, enteredInsulin, insulinRecommendation, remeasureTime, and showExitModal state variables
500
- * 2. Create an IResult object called carbs consisting of suggestedCarbs and enteredCarbs.
501
- * 3. Create an IResult object called Insulin consisting of insulinRecommendation and enteredInsulin.
502
- * 4. Call the transferToLogbook prop callback function with the following arguments:
503
- * - Set the carbs argument to the carbs IResult object.
504
- * - Set the insulin argument to the insulin IResult object.
505
- * - Set the reminder argument to the remeasureTime state variable.
506
- * - Set the recommendationDate argument to the recommendationDate member variable.
507
- */
508
- handleTransfer = () => {
509
- const {
510
- enteredCarbs,
511
- enteredInsulin,
512
- insulinRecommendation,
513
- remeasureTime,
514
- selectedMood
515
- } = this.state;
516
- const carbs = {
517
- suggested: this.suggestedCarbs,
518
- entered: enteredCarbs
519
- };
520
- const insulin = {
521
- suggested: insulinRecommendation,
522
- entered: enteredInsulin
523
- };
524
- this.props.transferToLogbook(carbs, insulin, remeasureTime, this.recommendationDate, selectedMood);
525
- };
526
-
527
- /**
528
- * Get the attention message that should be displayed for the user to draw their attention to noteworthy circumstances regarding their current blood glucose level.
529
- *
530
- * Steps:
531
- * 1. Unpack calculatorParams and latestLogbookFrom6Hours from the props.
532
- * 2. Unpack currentBGL and activity from calculatorparams.
533
- * 3. Get bgLevel, the categorisation of the blood glucose level, by calling the getBGLevel() function with the currentBGL and latestLogbookFrom6Hours as arguments.
534
- * 4. Return the attention message that is returned when calling getAttentionMessage() using bgLevel and activity as arguments.
535
- * @returns A string describing what the user needs to be aware of regarding their current blood glucose level.
536
- * If there is nothing noteworthy, null will be returned instead.
537
- */
538
- getBGLevelAttentionMessage = () => {
539
- const {
540
- calculatorParams,
541
- latestLogbookFrom6Hours
542
- } = this.props;
543
- const {
544
- currentBGL,
545
- activity
546
- } = calculatorParams;
547
- const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
548
- return getAttentionMessage(bgLevel, activity);
549
- };
550
-
551
- /**
552
- * Get the initial value for the remeasurement reminder time slider depending on the user’s entered information.
553
- *
554
- * Steps:
555
- * 1. Unpack calculatorParams, userReminder, and latestLogbookFrom6Hours from the props.
556
- * 2. Unpack currentBGL, activity, and carbohydrates from calculatorParams.
557
- * 3. Get bgLevel, the categorisation of the blood glucose level, by calling the getBGLevel() function with the currentBGL and latestLogbookFrom6Hours as arguments.
558
- * 4. Return the attention message that is returned when calling getReminder() using bgLevel, carbohydrates, userReminder, and activity as arguments.
559
- * @returns The time interval in hours that should be used as the initial value for the remeasurement reminder time slider.
560
- */
561
- getBGLevelRemeasurementReminder = () => {
562
- const {
563
- calculatorParams,
564
- userReminder,
565
- latestLogbookFrom6Hours
566
- } = this.props;
567
- const {
568
- currentBGL,
569
- activity,
570
- carbohydrates
571
- } = calculatorParams;
572
- const bgLevel = getBGLevel(currentBGL, latestLogbookFrom6Hours);
573
- return getReminder(bgLevel, carbohydrates, userReminder, activity);
574
- };
575
-
576
- /**
577
- * Get the attention message that should be displayed to the user to let them know that the insulin recommendation that
578
- * is being displayed to them was limited by the maximum insulin threshold.
579
- *
580
- * Steps:
581
- * 1. Unpack the wasLimited and activityReduction state variables.
582
- * 2. Return the result from calling getLimitationMessage() with wasLimited and activityReduction as arguments.
583
- * @returns A message to inform the user how the insulin recommendation was limited. If there is no limitation attention message, null will be returned instead.
584
- */
585
- getLimitationAttentionMessage = () => {
586
- const {
587
- wasLimited,
588
- activityReduction
589
- } = this.state;
590
- return getLimitationMessage(wasLimited, activityReduction);
591
- };
592
-
593
- /** Render a JSX element for displaying the insulin recommendation screen. */
594
- render() {
595
- if (this.hasError) {
596
- return /*#__PURE__*/React.createElement(View, {
597
- style: styles.container
598
- });
599
- }
600
- const {
601
- activeInsulin,
602
- recommendationModal,
603
- carbRecommendation: carbRecommendationProp,
604
- enteredCarbs,
605
- enteredInsulin,
606
- insulinRecommendation,
607
- activityReduction,
608
- isRecommendationDisplayed
609
- } = this.state;
610
- const {
611
- BloodGlucose: BGValueTestID,
612
- BloodKetone: BKValueTestID,
613
- ActiveInsulin: ActiveInsulinValueTestID
614
- } = InfoBarTestIds.Value;
615
- const {
616
- ActiveInsulin: ActiveInsulinUnitTestID,
617
- BloodGlucose: BGUnitTestID,
618
- BloodKetone: BKUnitTestID
619
- } = InfoBarTestIds.Unit;
620
- const carbRecommendation = carbRecommendationProp !== null ? Math.round(carbRecommendationProp) : null;
621
- const recommendedCarbs = enteredCarbs ?? carbRecommendation;
622
- const foodBorderColor = recommendedCarbs !== null && recommendedCarbs > 0 ? colors.teal : colors.dustyDarkBlue;
623
- const {
624
- calculatorParams,
625
- bloodGlucoseUnit,
626
- currentBKL,
627
- bloodKetoneUnit
628
- } = this.props;
629
- const {
630
- currentBGL,
631
- carbohydrates: providedCarbs
632
- } = calculatorParams;
633
- const displayedBGL = currentBGL ? Utils.displayedBGLValue(currentBGL, bloodGlucoseUnit) : null;
634
- const displayedBKL = currentBKL !== null && bloodKetoneUnit ? Utils.displayedBKLValue(currentBKL, bloodKetoneUnit) : null;
635
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeyboardAwareScrollView, {
636
- testID: RecommendationScreenTestIds.RecommendationScrollView,
637
- enableResetScrollToCoords: false,
638
- style: styles.container,
639
- ref: view => {
640
- if (view !== null) {
641
- this.scrollView = view;
642
- }
643
- }
644
- }, /*#__PURE__*/React.createElement(Text, {
645
- style: styles.header
646
- }, t(`Insulin recommendation`)), /*#__PURE__*/React.createElement(InfoBars, {
647
- label: t(`Active Insulin`),
648
- value: activeInsulin ? `${activeInsulin.toFixed(1)}` : null,
649
- unit: t(`units`),
650
- showNullAsDash: false,
651
- testID: {
652
- unitID: ActiveInsulinUnitTestID,
653
- valueID: ActiveInsulinValueTestID
654
- }
655
- }), /*#__PURE__*/React.createElement(InfoBars, {
656
- label: t(`Blood Glucose Level`),
657
- value: displayedBGL,
658
- unit: this.props.bloodGlucoseUnit,
659
- showNullAsDash: true,
660
- testID: {
661
- unitID: BGUnitTestID,
662
- valueID: BGValueTestID
663
- }
664
- }), /*#__PURE__*/React.createElement(InfoBars, {
665
- label: t(`Blood Ketone Level`),
666
- value: displayedBKL,
667
- unit: this.props.bloodKetoneUnit,
668
- showNullAsDash: true,
669
- testID: {
670
- unitID: BKUnitTestID,
671
- valueID: BKValueTestID
672
- }
673
- }), /*#__PURE__*/React.createElement(View, {
674
- style: [styles.carbsBorder, {
675
- borderColor: foodBorderColor
676
- }]
677
- }, /*#__PURE__*/React.createElement(RecommendedCarbs, {
678
- enteredCarbs: `${providedCarbs}`,
679
- changedRecommendedCarbs: this.updateCarbRecommendation,
680
- recommendedCarbs: `${recommendedCarbs}`,
681
- removeRecommendedCarbs: this.removeCarbRecommendation
682
- })), this.props.calculatorParams.activity && this.props.activityDisplayProps && /*#__PURE__*/React.createElement(Activity, {
683
- activity: this.props.calculatorParams.activity,
684
- activityType: this.props.activityDisplayProps.activityType,
685
- activityTitle: this.props.activityDisplayProps.activityTitle,
686
- activityReduction: activityReduction
687
- }), /*#__PURE__*/React.createElement(Remeasure, {
688
- onSliderChange: this.updateRemeasureTime,
689
- remeasureTime: this.state.remeasureTime
690
- }), !isRecommendationDisplayed ? /*#__PURE__*/React.createElement(RecentInsulin, {
691
- onRecentInsulinYes: this.props.onRecentInsulinYes,
692
- onRecentInsulinNo: this.handleNoRecentInsulin
693
- }) : /*#__PURE__*/React.createElement(RecommendedInsulin, {
694
- injectionMethod: this.props.injectionMethod,
695
- insulinRecommendation: insulinRecommendation,
696
- enteredInsulin: enteredInsulin,
697
- activityReduction: activityReduction,
698
- updateRecommendedInsulin: this.updateInsulinRecommendation
699
- }), /*#__PURE__*/React.createElement(TransferToLogbook, {
700
- visible: isRecommendationDisplayed,
701
- transfer: this.handleTransfer
702
- }), /*#__PURE__*/React.createElement(Emotion, {
703
- moodSelected: this.handleMoodSelected,
704
- currentMood: this.state.selectedMood
705
- }), /*#__PURE__*/React.createElement(RecommendationModal, {
706
- isVisible: recommendationModal || this.state.onlyShowLimitationMessage,
707
- onlyShowLimitationMessage: this.state.onlyShowLimitationMessage,
708
- suggestedCarbohydrates: carbRecommendationProp,
709
- attentionMessage: this.getBGLevelAttentionMessage(),
710
- limitationMessage: this.getLimitationAttentionMessage(),
711
- onClickOkButton: this.hideAttentionModal,
712
- onAcceptCarbohydrates: this.acceptCarbRecommendation,
713
- onDeclineCarbohydrates: this.declineCarbRecommendation
714
- })), /*#__PURE__*/React.createElement(ExitModal, {
715
- isVisible: this.state.showExitModal,
716
- title: t(`Save data before closing?`),
717
- message: t(`Your saved data will be used for future calculations.`),
718
- textFirstOption: t(`Save to logbook`),
719
- textSecondOption: t(`Close calculation`),
720
- firstOption: this.onPressTransferExitModal,
721
- secondOption: this.onPressCloseExitModal,
722
- onClose: this.onPressHideExitModal,
723
- onModalHide: this.onExitModalDidHide
724
- }), isRecommendationDisplayed ? /*#__PURE__*/React.createElement(TimeoutModal, {
725
- isVisible: this.state.showTimeoutModal,
726
- title: Messages.TimeoutPrompTitle(),
727
- message: Messages.TimeoutRecommendationVisible(this.recommendationDate),
728
- textFirstOption: t(`Yes, save to logbook`),
729
- textSecondOption: t(`No, return to dashboard`),
730
- firstOption: this.onPressTransferTimeoutModal,
731
- secondOption: this.onPressCloseCalculationTimeoutModal,
732
- onModalHide: this.onTimeoutModalDidHide
733
- }) : /*#__PURE__*/React.createElement(TimeoutModal, {
734
- isVisible: this.state.showTimeoutModal,
735
- title: Messages.TimeoutPrompTitle(),
736
- message: Messages.TimeoutRecommendationNotVisible(),
737
- textFirstOption: t(`Start new calculation`),
738
- textSecondOption: t(`Return to dashboard`),
739
- firstOption: this.onPressRestartCalculationTimeoutModal,
740
- secondOption: this.onPressCloseCalculationTimeoutModal,
741
- onModalHide: this.onTimeoutModalDidHide
742
- }));
743
- }
744
- }
745
- const styles = StyleSheet.create({
746
- container: {
747
- flex: 1,
748
- paddingHorizontal: 18,
749
- backgroundColor: colors.darkBlue
750
- },
751
- limitationModalContainer: {
752
- ...StyleSheet.absoluteFillObject,
753
- justifyContent: `center`,
754
- backgroundColor: colors.transparentBlack
755
- },
756
- carbsBorder: {
757
- borderWidth: 1,
758
- borderRadius: 5,
759
- padding: 16
760
- },
761
- header: {
762
- ...FONTS.Poppins.medium_Base,
763
- color: colors.dustyBlue,
764
- marginBottom: 22,
765
- textAlign: `center`
766
- }
767
- });
768
- //# sourceMappingURL=RecommendationScreen.js.map