@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.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/{lib/typescript → dist/src}/RecommendationScreen.d.ts +68 -82
- package/dist/src/RecommendationScreen.js +522 -0
- package/dist/src/assets/assets/activity/Cyclist.png +0 -0
- package/dist/src/assets/assets/activity/Other.png +0 -0
- package/dist/src/assets/assets/activity/Runner.png +0 -0
- package/dist/src/assets/assets/activity/Swimmer.png +0 -0
- package/dist/src/assets/assets/activity/Walk.png +0 -0
- package/dist/src/assets/assets/fonts/Poppins-Bold.ttf +0 -0
- package/dist/src/assets/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/dist/src/assets/assets/icons/Edit.tsx +22 -0
- package/dist/src/assets/assets/icons/X.tsx +14 -0
- package/dist/src/assets/assets/mood/happy.png +0 -0
- package/dist/src/assets/assets/mood/happy_active.png +0 -0
- package/dist/src/assets/assets/mood/neutral.png +0 -0
- package/dist/src/assets/assets/mood/neutral_active.png +0 -0
- package/dist/src/assets/assets/mood/sad.png +0 -0
- package/dist/src/assets/assets/mood/sad_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy.png +0 -0
- package/dist/src/assets/assets/mood/semi_happy_active.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad.png +0 -0
- package/dist/src/assets/assets/mood/semi_sad_active.png +0 -0
- package/dist/src/assets/icons/Edit.d.ts +4 -0
- package/dist/src/assets/icons/Edit.js +7 -0
- package/dist/src/assets/icons/X.d.ts +4 -0
- package/dist/src/assets/icons/X.js +6 -0
- package/dist/src/components/ForecastInfoBar.d.ts +109 -0
- package/dist/src/components/ForecastInfoBar.js +138 -0
- package/dist/src/components/Header.d.ts +8 -0
- package/dist/src/components/Header.js +54 -0
- package/dist/src/components/Icon.d.ts +20 -0
- package/dist/src/components/Icon.js +43 -0
- package/{lib/typescript → dist/src}/components/InfoBars.d.ts +28 -14
- package/dist/src/components/InfoBars.js +128 -0
- package/{lib/typescript → dist/src}/components/InvisibleNumberInput.d.ts +3 -9
- package/dist/src/components/InvisibleNumberInput.js +121 -0
- package/dist/src/components/LimitationMessage.d.ts +14 -0
- package/dist/src/components/LimitationMessage.js +30 -0
- package/{lib/typescript → dist/src}/components/LineSeparator.d.ts +1 -6
- package/dist/src/components/LineSeparator.js +18 -0
- package/{lib/typescript → dist/src}/components/RecentInsulin.d.ts +1 -3
- package/dist/src/components/RecentInsulin.js +73 -0
- package/{lib/typescript → dist/src}/components/RecommendationModal.d.ts +63 -63
- package/dist/src/components/RecommendationModal.js +226 -0
- package/{lib/typescript → dist/src}/components/RecommendedCarbs.d.ts +0 -3
- package/dist/src/components/RecommendedCarbs.js +251 -0
- package/{lib/typescript → dist/src}/components/RecommendedInsulin.d.ts +1 -2
- package/dist/src/components/RecommendedInsulin.js +180 -0
- package/{lib/typescript → dist/src}/components/Remeasure.d.ts +15 -6
- package/dist/src/components/Remeasure.js +130 -0
- package/{lib/typescript/components/TransferToLogbook.d.ts → dist/src/components/SaveButton.d.ts} +2 -3
- package/dist/src/components/SaveButton.js +71 -0
- package/dist/src/components/TwoOptionModal.d.ts +136 -0
- package/dist/src/components/TwoOptionModal.js +141 -0
- package/{lib/typescript → dist/src}/components/activity/Activity.d.ts +2 -3
- package/dist/src/components/activity/Activity.js +84 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIcon.d.ts +7 -8
- package/dist/src/components/activity/ActivityIcon.js +58 -0
- package/{lib/typescript → dist/src}/components/activity/ActivityIntensity.d.ts +1 -2
- package/dist/src/components/activity/ActivityIntensity.js +58 -0
- package/{lib/typescript → dist/src}/components/mood/Emotion.d.ts +1 -2
- package/dist/src/components/mood/Emotion.js +64 -0
- package/{lib/typescript → dist/src}/components/mood/MoodIcon.d.ts +5 -5
- package/dist/src/components/mood/MoodIcon.js +63 -0
- package/dist/src/components/text/TextBold.d.ts +8 -0
- package/dist/src/components/text/TextBold.js +12 -0
- package/dist/src/components/text/TextRegular.d.ts +8 -0
- package/dist/src/components/text/TextRegular.js +12 -0
- package/dist/src/locale/da/messages.js +1 -0
- package/dist/src/locale/da/messages.po +353 -0
- package/dist/src/locale/de/messages.js +1 -0
- package/dist/src/locale/de/messages.po +353 -0
- package/dist/src/locale/en/messages.js +1 -0
- package/dist/src/locale/en/messages.po +353 -0
- package/dist/src/locale/es/messages.js +1 -0
- package/dist/src/locale/es/messages.po +353 -0
- package/dist/src/locale/fr/messages.js +1 -0
- package/dist/src/locale/fr/messages.po +353 -0
- package/dist/src/locale/i18nUtils.d.ts +18 -0
- package/dist/src/locale/i18nUtils.js +39 -0
- package/dist/src/locale/it/messages.js +1 -0
- package/dist/src/locale/it/messages.po +353 -0
- package/{lib/typescript → dist/src}/types/enum.d.ts +15 -22
- package/dist/src/types/enum.js +145 -0
- package/{lib/typescript → dist/src}/types/types.d.ts +0 -1
- package/dist/src/types/types.js +1 -0
- package/{lib/typescript → dist/src}/utils/AttentionMessages.d.ts +0 -1
- package/dist/src/utils/AttentionMessages.js +118 -0
- package/{lib/typescript → dist/src}/utils/Constants.d.ts +3 -18
- package/{lib/module → dist/src}/utils/Constants.js +21 -79
- package/{lib/typescript → dist/src}/utils/RecommendationError.d.ts +0 -1
- package/dist/src/utils/RecommendationError.js +63 -0
- package/{lib/typescript → dist/src}/utils/RecommendationUtils.d.ts +0 -1
- package/{lib/module → dist/src}/utils/RecommendationUtils.js +88 -90
- package/{lib/typescript → dist/src}/utils/Translations.d.ts +0 -1
- package/{lib/module → dist/src}/utils/Translations.js +5 -7
- package/{lib/typescript → dist/src}/utils/Utils.d.ts +1 -2
- package/dist/src/utils/Utils.js +141 -0
- package/{lib/typescript → dist/src}/utils/Validations.d.ts +1 -2
- package/{lib/module → dist/src}/utils/Validations.js +128 -156
- package/package.json +96 -109
- package/lib/commonjs/RecommendationScreen.js +0 -778
- package/lib/commonjs/RecommendationScreen.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Close.js +0 -20
- package/lib/commonjs/assets/IconsSVG/Close.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js +0 -28
- package/lib/commonjs/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/Edit.js +0 -23
- package/lib/commonjs/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js +0 -43
- package/lib/commonjs/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Running.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js +0 -33
- package/lib/commonjs/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js +0 -48
- package/lib/commonjs/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js +0 -38
- package/lib/commonjs/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js +0 -34
- package/lib/commonjs/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/commonjs/components/ExitModal.js +0 -124
- package/lib/commonjs/components/ExitModal.js.map +0 -1
- package/lib/commonjs/components/InfoBars.js +0 -123
- package/lib/commonjs/components/InfoBars.js.map +0 -1
- package/lib/commonjs/components/InvisibleNumberInput.js +0 -150
- package/lib/commonjs/components/InvisibleNumberInput.js.map +0 -1
- package/lib/commonjs/components/LineSeparator.js +0 -27
- package/lib/commonjs/components/LineSeparator.js.map +0 -1
- package/lib/commonjs/components/RecentInsulin.js +0 -105
- package/lib/commonjs/components/RecentInsulin.js.map +0 -1
- package/lib/commonjs/components/RecommendationModal.js +0 -302
- package/lib/commonjs/components/RecommendationModal.js.map +0 -1
- package/lib/commonjs/components/RecommendedCarbs.js +0 -289
- package/lib/commonjs/components/RecommendedCarbs.js.map +0 -1
- package/lib/commonjs/components/RecommendedInsulin.js +0 -209
- package/lib/commonjs/components/RecommendedInsulin.js.map +0 -1
- package/lib/commonjs/components/Remeasure.js +0 -131
- package/lib/commonjs/components/Remeasure.js.map +0 -1
- package/lib/commonjs/components/Text.js +0 -25
- package/lib/commonjs/components/Text.js.map +0 -1
- package/lib/commonjs/components/TimeoutModal.js +0 -113
- package/lib/commonjs/components/TimeoutModal.js.map +0 -1
- package/lib/commonjs/components/TransferToLogbook.js +0 -83
- package/lib/commonjs/components/TransferToLogbook.js.map +0 -1
- package/lib/commonjs/components/activity/Activity.js +0 -112
- package/lib/commonjs/components/activity/Activity.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIcon.js +0 -86
- package/lib/commonjs/components/activity/ActivityIcon.js.map +0 -1
- package/lib/commonjs/components/activity/ActivityIntensity.js +0 -65
- package/lib/commonjs/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/commonjs/components/mood/Emotion.js +0 -86
- package/lib/commonjs/components/mood/Emotion.js.map +0 -1
- package/lib/commonjs/components/mood/MoodIcon.js +0 -107
- package/lib/commonjs/components/mood/MoodIcon.js.map +0 -1
- package/lib/commonjs/components/styles/fonts.js +0 -160
- package/lib/commonjs/components/styles/fonts.js.map +0 -1
- package/lib/commonjs/index.js +0 -21
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/locales/da/translations.json +0 -82
- package/lib/commonjs/locales/de/translations.json +0 -81
- package/lib/commonjs/locales/en/translations.json +0 -84
- package/lib/commonjs/locales/es/translations.json +0 -81
- package/lib/commonjs/locales/fr/translations.json +0 -81
- package/lib/commonjs/locales/it/translations.json +0 -81
- package/lib/commonjs/locales/translate.js +0 -63
- package/lib/commonjs/locales/translate.js.map +0 -1
- package/lib/commonjs/types/enum.js +0 -179
- package/lib/commonjs/types/enum.js.map +0 -1
- package/lib/commonjs/types/types.js +0 -6
- package/lib/commonjs/types/types.js.map +0 -1
- package/lib/commonjs/utils/AttentionMessages.js +0 -141
- package/lib/commonjs/utils/AttentionMessages.js.map +0 -1
- package/lib/commonjs/utils/Constants.js +0 -138
- package/lib/commonjs/utils/Constants.js.map +0 -1
- package/lib/commonjs/utils/RecommendationError.js +0 -116
- package/lib/commonjs/utils/RecommendationError.js.map +0 -1
- package/lib/commonjs/utils/RecommendationUtils.js +0 -212
- package/lib/commonjs/utils/RecommendationUtils.js.map +0 -1
- package/lib/commonjs/utils/Translations.js +0 -22
- package/lib/commonjs/utils/Translations.js.map +0 -1
- package/lib/commonjs/utils/Utils.js +0 -162
- package/lib/commonjs/utils/Utils.js.map +0 -1
- package/lib/commonjs/utils/Validations.js +0 -468
- package/lib/commonjs/utils/Validations.js.map +0 -1
- package/lib/module/RecommendationScreen.js +0 -768
- package/lib/module/RecommendationScreen.js.map +0 -1
- package/lib/module/assets/IconsSVG/Close.js +0 -11
- package/lib/module/assets/IconsSVG/Close.js.map +0 -1
- package/lib/module/assets/IconsSVG/CloseOutlined.js +0 -19
- package/lib/module/assets/IconsSVG/CloseOutlined.js.map +0 -1
- package/lib/module/assets/IconsSVG/Edit.js +0 -14
- package/lib/module/assets/IconsSVG/Edit.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Cycling.js +0 -34
- package/lib/module/assets/IconsSVG/activity/Cycling.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Running.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Running.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Stretching.js +0 -24
- package/lib/module/assets/IconsSVG/activity/Stretching.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Swimming.js +0 -39
- package/lib/module/assets/IconsSVG/activity/Swimming.js.map +0 -1
- package/lib/module/assets/IconsSVG/activity/Walking.js +0 -29
- package/lib/module/assets/IconsSVG/activity/Walking.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Happy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Happy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Neutral.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Neutral.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/Sad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/Sad.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiHappy.js.map +0 -1
- package/lib/module/assets/IconsSVG/mood/SemiSad.js +0 -25
- package/lib/module/assets/IconsSVG/mood/SemiSad.js.map +0 -1
- package/lib/module/components/ExitModal.js +0 -114
- package/lib/module/components/ExitModal.js.map +0 -1
- package/lib/module/components/InfoBars.js +0 -114
- package/lib/module/components/InfoBars.js.map +0 -1
- package/lib/module/components/InvisibleNumberInput.js +0 -142
- package/lib/module/components/InvisibleNumberInput.js.map +0 -1
- package/lib/module/components/LineSeparator.js +0 -19
- package/lib/module/components/LineSeparator.js.map +0 -1
- package/lib/module/components/RecentInsulin.js +0 -97
- package/lib/module/components/RecentInsulin.js.map +0 -1
- package/lib/module/components/RecommendationModal.js +0 -291
- package/lib/module/components/RecommendationModal.js.map +0 -1
- package/lib/module/components/RecommendedCarbs.js +0 -281
- package/lib/module/components/RecommendedCarbs.js.map +0 -1
- package/lib/module/components/RecommendedInsulin.js +0 -201
- package/lib/module/components/RecommendedInsulin.js.map +0 -1
- package/lib/module/components/Remeasure.js +0 -123
- package/lib/module/components/Remeasure.js.map +0 -1
- package/lib/module/components/Text.js +0 -16
- package/lib/module/components/Text.js.map +0 -1
- package/lib/module/components/TimeoutModal.js +0 -103
- package/lib/module/components/TimeoutModal.js.map +0 -1
- package/lib/module/components/TransferToLogbook.js +0 -75
- package/lib/module/components/TransferToLogbook.js.map +0 -1
- package/lib/module/components/activity/Activity.js +0 -104
- package/lib/module/components/activity/Activity.js.map +0 -1
- package/lib/module/components/activity/ActivityIcon.js +0 -78
- package/lib/module/components/activity/ActivityIcon.js.map +0 -1
- package/lib/module/components/activity/ActivityIntensity.js +0 -57
- package/lib/module/components/activity/ActivityIntensity.js.map +0 -1
- package/lib/module/components/mood/Emotion.js +0 -78
- package/lib/module/components/mood/Emotion.js.map +0 -1
- package/lib/module/components/mood/MoodIcon.js +0 -97
- package/lib/module/components/mood/MoodIcon.js.map +0 -1
- package/lib/module/components/styles/fonts.js +0 -152
- package/lib/module/components/styles/fonts.js.map +0 -1
- package/lib/module/index.js +0 -5
- package/lib/module/index.js.map +0 -1
- package/lib/module/locales/da/translations.json +0 -82
- package/lib/module/locales/de/translations.json +0 -81
- package/lib/module/locales/en/translations.json +0 -84
- package/lib/module/locales/es/translations.json +0 -81
- package/lib/module/locales/fr/translations.json +0 -81
- package/lib/module/locales/it/translations.json +0 -81
- package/lib/module/locales/translate.js +0 -55
- package/lib/module/locales/translate.js.map +0 -1
- package/lib/module/types/enum.js +0 -170
- package/lib/module/types/enum.js.map +0 -1
- package/lib/module/types/types.js +0 -2
- package/lib/module/types/types.js.map +0 -1
- package/lib/module/utils/AttentionMessages.js +0 -131
- package/lib/module/utils/AttentionMessages.js.map +0 -1
- package/lib/module/utils/Constants.js.map +0 -1
- package/lib/module/utils/RecommendationError.js +0 -87
- package/lib/module/utils/RecommendationError.js.map +0 -1
- package/lib/module/utils/RecommendationUtils.js.map +0 -1
- package/lib/module/utils/Translations.js.map +0 -1
- package/lib/module/utils/Utils.js +0 -155
- package/lib/module/utils/Utils.js.map +0 -1
- package/lib/module/utils/Validations.js.map +0 -1
- package/lib/typescript/RecommendationScreen.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Close.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Close.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/CloseOutlined.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/Edit.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/Edit.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Cycling.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Running.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Stretching.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Swimming.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/activity/Walking.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Happy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Neutral.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/Sad.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiHappy.d.ts.map +0 -1
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts +0 -5
- package/lib/typescript/assets/IconsSVG/mood/SemiSad.d.ts.map +0 -1
- package/lib/typescript/components/ExitModal.d.ts +0 -26
- package/lib/typescript/components/ExitModal.d.ts.map +0 -1
- package/lib/typescript/components/InfoBars.d.ts.map +0 -1
- package/lib/typescript/components/InvisibleNumberInput.d.ts.map +0 -1
- package/lib/typescript/components/LineSeparator.d.ts.map +0 -1
- package/lib/typescript/components/RecentInsulin.d.ts.map +0 -1
- package/lib/typescript/components/RecommendationModal.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedCarbs.d.ts.map +0 -1
- package/lib/typescript/components/RecommendedInsulin.d.ts.map +0 -1
- package/lib/typescript/components/Remeasure.d.ts.map +0 -1
- package/lib/typescript/components/Text.d.ts +0 -14
- package/lib/typescript/components/Text.d.ts.map +0 -1
- package/lib/typescript/components/TimeoutModal.d.ts +0 -25
- package/lib/typescript/components/TimeoutModal.d.ts.map +0 -1
- package/lib/typescript/components/TransferToLogbook.d.ts.map +0 -1
- package/lib/typescript/components/activity/Activity.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIcon.d.ts.map +0 -1
- package/lib/typescript/components/activity/ActivityIntensity.d.ts.map +0 -1
- package/lib/typescript/components/mood/Emotion.d.ts.map +0 -1
- package/lib/typescript/components/mood/MoodIcon.d.ts.map +0 -1
- package/lib/typescript/components/styles/fonts.d.ts +0 -151
- package/lib/typescript/components/styles/fonts.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -5
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/locales/translate.d.ts +0 -20
- package/lib/typescript/locales/translate.d.ts.map +0 -1
- package/lib/typescript/types/enum.d.ts.map +0 -1
- package/lib/typescript/types/types.d.ts.map +0 -1
- package/lib/typescript/utils/AttentionMessages.d.ts.map +0 -1
- package/lib/typescript/utils/Constants.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationError.d.ts.map +0 -1
- package/lib/typescript/utils/RecommendationUtils.d.ts.map +0 -1
- package/lib/typescript/utils/Translations.d.ts.map +0 -1
- package/lib/typescript/utils/Utils.d.ts.map +0 -1
- package/lib/typescript/utils/Validations.d.ts.map +0 -1
- package/src/RecommendationScreen.tsx +0 -854
- package/src/assets/IconsSVG/Close.tsx +0 -13
- package/src/assets/IconsSVG/CloseOutlined.tsx +0 -23
- package/src/assets/IconsSVG/Edit.tsx +0 -16
- package/src/assets/IconsSVG/activity/Cycling.tsx +0 -41
- package/src/assets/IconsSVG/activity/Running.tsx +0 -29
- package/src/assets/IconsSVG/activity/Stretching.tsx +0 -29
- package/src/assets/IconsSVG/activity/Swimming.tsx +0 -47
- package/src/assets/IconsSVG/activity/Walking.tsx +0 -35
- package/src/assets/IconsSVG/mood/Happy.tsx +0 -30
- package/src/assets/IconsSVG/mood/Neutral.tsx +0 -30
- package/src/assets/IconsSVG/mood/Sad.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiHappy.tsx +0 -30
- package/src/assets/IconsSVG/mood/SemiSad.tsx +0 -30
- package/src/components/ExitModal.tsx +0 -134
- package/src/components/InfoBars.tsx +0 -122
- package/src/components/InvisibleNumberInput.tsx +0 -170
- package/src/components/LineSeparator.tsx +0 -29
- package/src/components/RecentInsulin.tsx +0 -109
- package/src/components/RecommendationModal.tsx +0 -319
- package/src/components/RecommendedCarbs.tsx +0 -303
- package/src/components/RecommendedInsulin.tsx +0 -220
- package/src/components/Remeasure.tsx +0 -135
- package/src/components/Text.tsx +0 -27
- package/src/components/TimeoutModal.tsx +0 -121
- package/src/components/TransferToLogbook.tsx +0 -92
- package/src/components/activity/Activity.tsx +0 -107
- package/src/components/activity/ActivityIcon.tsx +0 -77
- package/src/components/activity/ActivityIntensity.tsx +0 -67
- package/src/components/mood/Emotion.tsx +0 -97
- package/src/components/mood/MoodIcon.tsx +0 -91
- package/src/components/styles/fonts.ts +0 -151
- package/src/index.ts +0 -5
- package/src/locales/da/translations.json +0 -82
- package/src/locales/de/translations.json +0 -81
- package/src/locales/en/translations.json +0 -84
- package/src/locales/es/translations.json +0 -81
- package/src/locales/fr/translations.json +0 -81
- package/src/locales/it/translations.json +0 -81
- package/src/locales/translate.ts +0 -62
- package/src/types/enum.ts +0 -164
- package/src/types/types.ts +0 -19
- package/src/utils/AttentionMessages.ts +0 -167
- package/src/utils/Constants.ts +0 -77
- package/src/utils/RecommendationError.ts +0 -182
- package/src/utils/RecommendationUtils.ts +0 -232
- package/src/utils/Translations.ts +0 -17
- package/src/utils/Utils.ts +0 -156
- 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:
|
|
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 {
|
|
10
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
158
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
220
|
-
|
|
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
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
267
|
-
|
|
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
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
-
|
|
352
|
-
|
|
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
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
|
-
|
|
380
|
-
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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
|
-
|
|
408
|
-
|
|
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
|
-
|
|
421
|
-
|
|
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
|
-
|
|
434
|
-
|
|
435
|
-
|
|
406
|
+
if (!Utils.isInRange(carbohydrates, CARBOHYDRATES_LIMTS)) {
|
|
407
|
+
throw CarbohydrateLimitError();
|
|
408
|
+
}
|
|
436
409
|
}
|
|
437
|
-
//# sourceMappingURL=Validations.js.map
|