@hedia/recommendation-screen 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/coverage/clover.xml +378 -367
  2. package/coverage/coverage-final.json +18 -18
  3. package/coverage/lcov-report/index.html +15 -15
  4. package/coverage/lcov-report/src/RecommendationScreen.tsx.html +112 -67
  5. package/coverage/lcov-report/src/__tests__/index.html +1 -1
  6. package/coverage/lcov-report/src/__tests__/utils.tsx.html +11 -11
  7. package/coverage/lcov-report/src/components/Header.tsx.html +2 -2
  8. package/coverage/lcov-report/src/components/InfoBars.tsx.html +49 -19
  9. package/coverage/lcov-report/src/components/InvisibleNumberInput.tsx.html +1 -1
  10. package/coverage/lcov-report/src/components/LimitationMessage.tsx.html +1 -1
  11. package/coverage/lcov-report/src/components/LineSeparator.tsx.html +2 -2
  12. package/coverage/lcov-report/src/components/RecentInsulin.tsx.html +1 -1
  13. package/coverage/lcov-report/src/components/RecommendationModal.tsx.html +17 -17
  14. package/coverage/lcov-report/src/components/RecommendedCarbs.tsx.html +13 -13
  15. package/coverage/lcov-report/src/components/RecommendedInsulin.tsx.html +11 -11
  16. package/coverage/lcov-report/src/components/Remeasure.tsx.html +12 -12
  17. package/coverage/lcov-report/src/components/TransferToLogbook.tsx.html +5 -5
  18. package/coverage/lcov-report/src/components/TwoOptionModal.tsx.html +1 -1
  19. package/coverage/lcov-report/src/components/activity/Activity.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/activity/ActivityIcon.tsx.html +1 -1
  21. package/coverage/lcov-report/src/components/activity/ActivityIntensity.tsx.html +1 -1
  22. package/coverage/lcov-report/src/components/activity/index.html +1 -1
  23. package/coverage/lcov-report/src/components/index.html +7 -7
  24. package/coverage/lcov-report/src/components/mood/Emotion.tsx.html +8 -8
  25. package/coverage/lcov-report/src/components/mood/MoodIcon.tsx.html +8 -8
  26. package/coverage/lcov-report/src/components/mood/index.html +1 -1
  27. package/coverage/lcov-report/src/index.html +7 -7
  28. package/coverage/lcov-report/src/locale/i18nUtils.ts.html +5 -5
  29. package/coverage/lcov-report/src/locale/index.html +1 -1
  30. package/coverage/lcov-report/src/utils/AttentionMessages.tsx.html +5 -5
  31. package/coverage/lcov-report/src/utils/Constants.ts.html +1 -1
  32. package/coverage/lcov-report/src/utils/RecommendationError.tsx.html +41 -8
  33. package/coverage/lcov-report/src/utils/RecommendationUtils.ts.html +33 -33
  34. package/coverage/lcov-report/src/utils/Translations.ts.html +1 -1
  35. package/coverage/lcov-report/src/utils/Utils.ts.html +23 -17
  36. package/coverage/lcov-report/src/utils/Validations.ts.html +77 -50
  37. package/coverage/lcov-report/src/utils/index.html +12 -12
  38. package/coverage/lcov.info +821 -794
  39. package/ios/Podfile.lock +1 -1
  40. package/package.json +6 -5
  41. package/src/RecommendationScreen.d.ts +2 -2
  42. package/src/RecommendationScreen.jsx +8 -5
  43. package/src/__tests__/RecommendationScreen.test.jsx +44 -25
  44. package/src/__tests__/Validations.test.js +18 -0
  45. package/src/components/InfoBars.d.ts +7 -2
  46. package/src/components/InfoBars.jsx +11 -3
  47. package/src/locale/da/messages.js +1 -1
  48. package/src/locale/da/messages.po +31 -27
  49. package/src/locale/de/messages.js +1 -1
  50. package/src/locale/de/messages.po +31 -27
  51. package/src/locale/en/messages.js +1 -1
  52. package/src/locale/en/messages.po +31 -27
  53. package/src/locale/es/messages.js +1 -1
  54. package/src/locale/es/messages.po +31 -27
  55. package/src/locale/fr/messages.js +1 -1
  56. package/src/locale/fr/messages.po +31 -27
  57. package/src/locale/it/messages.js +1 -1
  58. package/src/locale/it/messages.po +31 -27
  59. package/src/types/enum.d.ts +20 -2
  60. package/src/types/enum.js +23 -1
  61. package/src/utils/RecommendationError.d.ts +1 -0
  62. package/src/utils/RecommendationError.jsx +3 -1
  63. package/src/utils/RecommendationUtils.d.ts +1 -1
  64. package/src/utils/Utils.d.ts +2 -2
  65. package/src/utils/Utils.js +2 -2
  66. package/src/utils/Validations.d.ts +4 -3
  67. package/src/utils/Validations.js +13 -4
@@ -13,7 +13,7 @@ msgstr ""
13
13
  "Language-Team: \n"
14
14
  "Plural-Forms: \n"
15
15
 
16
- #: src/RecommendationScreen.tsx:195
16
+ #: src/RecommendationScreen.tsx:196
17
17
  msgid "Active Insulin"
18
18
  msgstr "Insulina attiva"
19
19
 
@@ -36,11 +36,11 @@ msgstr "Attenzione"
36
36
  msgid "Based on the selected activity your insulin recommendation is reduced by:"
37
37
  msgstr "In base all'attività selezionata, la prescrizione per l'insulina è ridotta di:"
38
38
 
39
- #: src/RecommendationScreen.tsx:196
39
+ #: src/RecommendationScreen.tsx:200
40
40
  msgid "Blood Glucose Level"
41
41
  msgstr "Livello di glucosio nel sangue"
42
42
 
43
- #: src/RecommendationScreen.tsx:197
43
+ #: src/RecommendationScreen.tsx:204
44
44
  msgid "Blood Ketone Level"
45
45
  msgstr "Livello di chetoni nel sangue"
46
46
 
@@ -48,11 +48,11 @@ msgstr "Livello di chetoni nel sangue"
48
48
  msgid "Carbohydrates"
49
49
  msgstr "Carboidrati"
50
50
 
51
- #: src/RecommendationScreen.tsx:217
51
+ #: src/RecommendationScreen.tsx:227
52
52
  msgid "Close calculation"
53
53
  msgstr "Chiudi calcolo"
54
54
 
55
- #: src/utils/AttentionMessages.tsx:27
55
+ #: src/utils/AttentionMessages.tsx:33
56
56
  msgid "Consider not to initiate physical activity before your blood glucose level is within the recommended ranges prior to physical activity."
57
57
  msgstr "Ricorda di non iniziare l'attività fisica prima che il livello di glucosio nel sangue non sia rientrato negli intervalli raccomandati prima dell'attività fisica."
58
58
 
@@ -136,6 +136,10 @@ msgstr "Errore. Verificare che il valore obiettivo della glicemia sia corretto."
136
136
  msgid "Error. Please verify your notifications settings."
137
137
  msgstr "Errore. Verificare le impostazioni di notifica."
138
138
 
139
+ #: src/utils/RecommendationError.tsx:33
140
+ msgid "Error. Your blood ketone settings are invalid."
141
+ msgstr ""
142
+
139
143
  #: src/components/RecommendedCarbs.tsx:107
140
144
  msgid "Food"
141
145
  msgstr "Cibo"
@@ -156,11 +160,11 @@ msgstr "Hedia Calculator non supporta attività che siano terminate più di 4 or
156
160
  msgid "Hedia Calculator does not support insulin recommendations with more than 300 grams of carbohydrates present."
157
161
  msgstr "Hedia Calculator non supporta le prescrizioni di insulina con più di 300 grammi di carboidrati presenti."
158
162
 
159
- #: src/utils/AttentionMessages.tsx:41
163
+ #: src/utils/AttentionMessages.tsx:47
160
164
  msgid "Hedia does not support more than {SAFETY_INSULIN_LIMIT} units of insulin per calculation."
161
165
  msgstr "Hedia non supporta più di {SAFETY_INSULIN_LIMIT} unità di insulina per ogni calcolo."
162
166
 
163
- #: src/utils/AttentionMessages.tsx:39
167
+ #: src/utils/AttentionMessages.tsx:45
164
168
  msgid "Hedia doesn't support more than {SAFETY_INSULIN_LIMIT} units of insulin per calculation, but because of the physical activity you entered it has been further reduced by {0}% to {1} units for this calculation."
165
169
  msgstr "Hedia non supporta più di {SAFETY_INSULIN_LIMIT} unità di insulina per ogni calcolo, ma, a seguito dell'attività fisica che hai inserito, è stata ulteriormente ridotta del {0}% a {1} unità per questo calcolo."
166
170
 
@@ -172,7 +176,7 @@ msgstr "Come ti senti?"
172
176
  msgid "INSULIN{0}RECOMMENDATION"
173
177
  msgstr "PRESCRIZIONE DI{0}INSULINA"
174
178
 
175
- #: src/utils/AttentionMessages.tsx:26
179
+ #: src/utils/AttentionMessages.tsx:32
176
180
  msgid "If it is possible, postpone your planned exercise."
177
181
  msgstr "Se possibile, posticipa l'allenamento pianificato."
178
182
 
@@ -188,7 +192,7 @@ msgstr "Leggera"
188
192
  msgid "Moderate"
189
193
  msgstr "Moderata"
190
194
 
191
- #: src/utils/AttentionMessages.tsx:42
195
+ #: src/utils/AttentionMessages.tsx:48
192
196
  msgid "More than 15 minutes has passed since this calculation was started."
193
197
  msgstr "Sono passati più di 15 minuti dall'inizio di questo calcolo."
194
198
 
@@ -200,7 +204,7 @@ msgstr "NO"
200
204
  msgid "No"
201
205
  msgstr "No"
202
206
 
203
- #: src/RecommendationScreen.tsx:221
207
+ #: src/RecommendationScreen.tsx:231
204
208
  msgid "No, return to dashboard"
205
209
  msgstr "No, torna al pannello di controllo"
206
210
 
@@ -216,11 +220,11 @@ msgstr "SPENTO"
216
220
  msgid "OK"
217
221
  msgstr "OK"
218
222
 
219
- #: src/utils/AttentionMessages.tsx:43
223
+ #: src/utils/AttentionMessages.tsx:49
220
224
  msgid "Please go through the calculation steps with new measurements to ensure a safe recommendation."
221
225
  msgstr "Completa tutte le fasi del calcolo con nuove misurazioni per assicurare una prescrizione sicura."
222
226
 
223
- #: src/utils/AttentionMessages.tsx:47
227
+ #: src/utils/AttentionMessages.tsx:53
224
228
  msgid "Recommendation from {day} at {time} was not transfered to your logbook.{0}Did you use the recommendation?"
225
229
  msgstr "La prescrizione del {day} alle {time} non è stata trasferita nel tuo diario.{0} Hai usato la prescrizione?"
226
230
 
@@ -237,19 +241,19 @@ msgstr "Quantità prescritta di insulina"
237
241
  msgid "Remind me to remeasure in"
238
242
  msgstr "Ricordami di misurare nuovamente tra"
239
243
 
240
- #: src/RecommendationScreen.tsx:221
244
+ #: src/RecommendationScreen.tsx:231
241
245
  msgid "Return to dashboard"
242
246
  msgstr "Torna al pannello di controllo"
243
247
 
244
- #: src/RecommendationScreen.tsx:217
248
+ #: src/RecommendationScreen.tsx:227
245
249
  msgid "Save data before closing?"
246
250
  msgstr "Salvare i dati prima della chiusura?"
247
251
 
248
- #: src/RecommendationScreen.tsx:217
252
+ #: src/RecommendationScreen.tsx:227
249
253
  msgid "Save to logbook"
250
254
  msgstr "Salva nel diario"
251
255
 
252
- #: src/RecommendationScreen.tsx:221
256
+ #: src/RecommendationScreen.tsx:231
253
257
  msgid "Start new calculation"
254
258
  msgstr "Inizia il nuovo calcolo"
255
259
 
@@ -285,39 +289,39 @@ msgstr "Vuoi aggiungere questo al tuo calcolo corrente?"
285
289
  msgid "Yes"
286
290
  msgstr "Sì"
287
291
 
288
- #: src/RecommendationScreen.tsx:221
292
+ #: src/RecommendationScreen.tsx:231
289
293
  msgid "Yes, save to logbook"
290
294
  msgstr "Sì, salva nel diario"
291
295
 
292
- #: src/utils/AttentionMessages.tsx:28
296
+ #: src/utils/AttentionMessages.tsx:34
293
297
  msgid "You have a high blood glucose level."
294
298
  msgstr "Hai un alto livello di glucosio nel sangue."
295
299
 
296
- #: src/utils/AttentionMessages.tsx:29
300
+ #: src/utils/AttentionMessages.tsx:35
297
301
  msgid "You should take rapid-acting insulin and measure ketones."
298
302
  msgstr "Devi assumere insulina ad azione rapida e misurare i chetoni."
299
303
 
300
- #: src/utils/AttentionMessages.tsx:25
304
+ #: src/utils/AttentionMessages.tsx:31
301
305
  msgid "You will be reminded to measure your blood glucose level in 15 min."
302
306
  msgstr "Ti verrà ricordato di misurare il livello di glucosio nel sangue tra 15 min."
303
307
 
304
- #: src/utils/AttentionMessages.tsx:24
308
+ #: src/utils/AttentionMessages.tsx:30
305
309
  msgid "Your blood glucose level is very low."
306
310
  msgstr "Il livello di glucosio nel sangue è molto basso."
307
311
 
308
- #: src/utils/AttentionMessages.tsx:23
312
+ #: src/utils/AttentionMessages.tsx:29
309
313
  msgid "Your blood glucose level is very low. Take glucagon or eat carbohydrates if possible. Seek medical attention."
310
314
  msgstr "Il livello di glucosio nel sangue è molto basso. Assumi glucagon o ingerisci carboidrati, se possibile. Rivolgiti a un medico."
311
315
 
312
- #: src/utils/AttentionMessages.tsx:32
316
+ #: src/utils/AttentionMessages.tsx:38
313
317
  msgid "Your recommendation would have been higher than {0} units of insulin, but it has been limited for safety reasons.{1} Hedia never recommends more than {SAFETY_INSULIN_LIMIT} units of insulin per calculation, but because of the physical activity you entered it has been further reduced by {2}% to {3}."
314
318
  msgstr "La tua prescrizione sarebbe stata superiore a {0} unità di insulina, ma è stata limitata per motivi di sicurezza.{1} Hedia non prescrive mai più di {SAFETY_INSULIN_LIMIT} unità di insulina per calcolo, ma a seguito dell'attività fisica che hai inserito, questa è stata ulteriormente ridotta del {2}% a {3}."
315
319
 
316
- #: src/utils/AttentionMessages.tsx:30
320
+ #: src/utils/AttentionMessages.tsx:36
317
321
  msgid "Your recommendation would have been higher than {SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons. Hedia never recommends more than {SAFETY_INSULIN_LIMIT} units of insulin per calculation."
318
322
  msgstr "La tua prescrizione sarebbe stata superiore a {SAFETY_INSULIN_LIMIT} unità di insulina, ma è stata limitata per motivi di sicurezza. Hedia non prescrive mai più di {SAFETY_INSULIN_LIMIT} unità di insulina per calcolo."
319
323
 
320
- #: src/RecommendationScreen.tsx:217
324
+ #: src/RecommendationScreen.tsx:227
321
325
  msgid "Your saved data will be used for future calculations."
322
326
  msgstr "I dati salvati saranno utilizzati per calcoli futuri."
323
327
 
@@ -339,7 +343,7 @@ msgstr "ore"
339
343
  msgid "min"
340
344
  msgstr "min"
341
345
 
342
- #: src/components/InfoBars.tsx:19
343
- #: src/RecommendationScreen.tsx:195
346
+ #: src/RecommendationScreen.tsx:196
347
+ #: src/components/InfoBars.tsx:22
344
348
  msgid "units"
345
349
  msgstr "unità"
@@ -41,7 +41,24 @@ export declare enum TwoOptionModalTestIds {
41
41
  FirstOption = "first-option-button",
42
42
  SecondOption = "second-option-button"
43
43
  }
44
- export declare type TestIdEnum = ActivityTestIds | HeaderTestIds | LimitationMessageTestIds | RecentInsulinTestIds | RecommendedCarbsTestIds | RecommendedInsulinTestIds | RecommendationModalTestIds | RemeasureTestIds | TransferToLogbookTestIds | TwoOptionModalTestIds;
44
+ export declare namespace InfoBarTestIds {
45
+ enum Value {
46
+ BloodGlucose = "BloodGlucoseValue",
47
+ BloodKetone = "BloodKetoneValue",
48
+ ActiveInsulin = "ActiveInsulinValue"
49
+ }
50
+ enum Label {
51
+ BloodKetone = "BloodKetoneLabel",
52
+ BloodGlucose = "BloodGlucoseLabel",
53
+ ActiveInsulin = "ActiveInsulinLabel"
54
+ }
55
+ enum Unit {
56
+ BloodKetone = "BloodKetoneUnit",
57
+ BloodGlucose = "BloodGlucoseUnit",
58
+ ActiveInsulin = "ActiveInsulinUnit"
59
+ }
60
+ }
61
+ export declare type TestIdEnum = ActivityTestIds | HeaderTestIds | LimitationMessageTestIds | RecentInsulinTestIds | RecommendedCarbsTestIds | RecommendedInsulinTestIds | RecommendationModalTestIds | RemeasureTestIds | TransferToLogbookTestIds | TwoOptionModalTestIds | InfoBarTestIds.Unit | InfoBarTestIds.Value | InfoBarTestIds.Label;
45
62
  export declare enum RecommendationErrorEnum {
46
63
  ActivityDuration = 0,
47
64
  ActivityTargetBGL = 1,
@@ -63,7 +80,8 @@ export declare enum RecommendationErrorEnum {
63
80
  Language = 17,
64
81
  InjectionMethod = 18,
65
82
  BloodKetoneUnit = 19,
66
- BloodGlucoseUnit = 20
83
+ BloodGlucoseUnit = 20,
84
+ BloodKetoneProps = 21
67
85
  }
68
86
  export declare enum BgLevel {
69
87
  SevereHypoglycemia = 0,
package/src/types/enum.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RecommendationReminders = exports.BgLevel = exports.RecommendationErrorEnum = exports.TwoOptionModalTestIds = exports.TransferToLogbookTestIds = exports.RemeasureTestIds = exports.RecommendationModalTestIds = exports.RecommendedInsulinTestIds = exports.RecommendedCarbsTestIds = exports.RecentInsulinTestIds = exports.LimitationMessageTestIds = exports.HeaderTestIds = exports.ActivityTestIds = void 0;
3
+ exports.RecommendationReminders = exports.BgLevel = exports.RecommendationErrorEnum = exports.InfoBarTestIds = exports.TwoOptionModalTestIds = exports.TransferToLogbookTestIds = exports.RemeasureTestIds = exports.RecommendationModalTestIds = exports.RecommendedInsulinTestIds = exports.RecommendedCarbsTestIds = exports.RecentInsulinTestIds = exports.LimitationMessageTestIds = exports.HeaderTestIds = exports.ActivityTestIds = void 0;
4
4
  var ActivityTestIds;
5
5
  (function (ActivityTestIds) {
6
6
  ActivityTestIds["ActivityReduction"] = "activity-reduction-percentage";
@@ -54,6 +54,27 @@ var TwoOptionModalTestIds;
54
54
  TwoOptionModalTestIds["FirstOption"] = "first-option-button";
55
55
  TwoOptionModalTestIds["SecondOption"] = "second-option-button";
56
56
  })(TwoOptionModalTestIds = exports.TwoOptionModalTestIds || (exports.TwoOptionModalTestIds = {}));
57
+ var InfoBarTestIds;
58
+ (function (InfoBarTestIds) {
59
+ let Value;
60
+ (function (Value) {
61
+ Value["BloodGlucose"] = "BloodGlucoseValue";
62
+ Value["BloodKetone"] = "BloodKetoneValue";
63
+ Value["ActiveInsulin"] = "ActiveInsulinValue";
64
+ })(Value = InfoBarTestIds.Value || (InfoBarTestIds.Value = {}));
65
+ let Label;
66
+ (function (Label) {
67
+ Label["BloodKetone"] = "BloodKetoneLabel";
68
+ Label["BloodGlucose"] = "BloodGlucoseLabel";
69
+ Label["ActiveInsulin"] = "ActiveInsulinLabel";
70
+ })(Label = InfoBarTestIds.Label || (InfoBarTestIds.Label = {}));
71
+ let Unit;
72
+ (function (Unit) {
73
+ Unit["BloodKetone"] = "BloodKetoneUnit";
74
+ Unit["BloodGlucose"] = "BloodGlucoseUnit";
75
+ Unit["ActiveInsulin"] = "ActiveInsulinUnit";
76
+ })(Unit = InfoBarTestIds.Unit || (InfoBarTestIds.Unit = {}));
77
+ })(InfoBarTestIds = exports.InfoBarTestIds || (exports.InfoBarTestIds = {}));
57
78
  var RecommendationErrorEnum;
58
79
  (function (RecommendationErrorEnum) {
59
80
  RecommendationErrorEnum[RecommendationErrorEnum["ActivityDuration"] = 0] = "ActivityDuration";
@@ -77,6 +98,7 @@ var RecommendationErrorEnum;
77
98
  RecommendationErrorEnum[RecommendationErrorEnum["InjectionMethod"] = 18] = "InjectionMethod";
78
99
  RecommendationErrorEnum[RecommendationErrorEnum["BloodKetoneUnit"] = 19] = "BloodKetoneUnit";
79
100
  RecommendationErrorEnum[RecommendationErrorEnum["BloodGlucoseUnit"] = 20] = "BloodGlucoseUnit";
101
+ RecommendationErrorEnum[RecommendationErrorEnum["BloodKetoneProps"] = 21] = "BloodKetoneProps";
80
102
  })(RecommendationErrorEnum = exports.RecommendationErrorEnum || (exports.RecommendationErrorEnum = {}));
81
103
  var BgLevel;
82
104
  (function (BgLevel) {
@@ -24,3 +24,4 @@ export declare const InjectionMethodError: () => RecommendationError;
24
24
  export declare const LanguageError: () => RecommendationError;
25
25
  export declare const BloodKetoneUnitError: () => RecommendationError;
26
26
  export declare const BloodGlucoseUnitError: () => RecommendationError;
27
+ export declare const BloodKetonePropsError: () => RecommendationError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BloodGlucoseUnitError = exports.BloodKetoneUnitError = exports.LanguageError = exports.InjectionMethodError = exports.UserReminderError = exports.RecentBolusError = exports.BolusInsulinSecondsPassedError = exports.BolusInsulinDoseError = exports.TargetBGLError = exports.CurrentBKLError = exports.LatestLogbook6HoursBGLError = exports.CurrentBGLError = exports.InsulinToCarbsRatioError = exports.InsulinSensitivityError = exports.CarbohydrateLimitError = exports.ActivityTargetBGLError = exports.ActivityTypeError = exports.ActivityIntensityError = exports.ActivityDateError = exports.ActivityDurationError = exports.ActivitySettingsError = exports.RecommendationError = void 0;
3
+ exports.BloodKetonePropsError = exports.BloodGlucoseUnitError = exports.BloodKetoneUnitError = exports.LanguageError = exports.InjectionMethodError = exports.UserReminderError = exports.RecentBolusError = exports.BolusInsulinSecondsPassedError = exports.BolusInsulinDoseError = exports.TargetBGLError = exports.CurrentBKLError = exports.LatestLogbook6HoursBGLError = exports.CurrentBGLError = exports.InsulinToCarbsRatioError = exports.InsulinSensitivityError = exports.CarbohydrateLimitError = exports.ActivityTargetBGLError = exports.ActivityTypeError = exports.ActivityIntensityError = exports.ActivityDateError = exports.ActivityDurationError = exports.ActivitySettingsError = exports.RecommendationError = void 0;
4
4
  const types_1 = require("@hedia/types");
5
5
  const macro_1 = require("@lingui/macro");
6
6
  const i18nUtils_1 = require("../locale/i18nUtils");
@@ -55,3 +55,5 @@ const BloodKetoneUnitError = () => new RecommendationError(i18nUtils_1.i18n._(ma
55
55
  exports.BloodKetoneUnitError = BloodKetoneUnitError;
56
56
  const BloodGlucoseUnitError = () => new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Error. Hedia Calculator does not support your current blood glucose unit.`), enum_1.RecommendationErrorEnum.BloodGlucoseUnit);
57
57
  exports.BloodGlucoseUnitError = BloodGlucoseUnitError;
58
+ const BloodKetonePropsError = () => new RecommendationError(i18nUtils_1.i18n._(macro_1.t `Error. Your blood ketone settings are invalid.`), enum_1.RecommendationErrorEnum.BloodKetoneProps);
59
+ exports.BloodKetonePropsError = BloodKetonePropsError;
@@ -1,6 +1,6 @@
1
1
  import { BgLevel } from "../types/enum";
2
2
  import { IActivityParams, logbookEntry } from "../types/types";
3
- export declare function getBGLevel(currentBGL: number, latestLogbookFrom6Hours: logbookEntry | null): BgLevel;
3
+ export declare function getBGLevel(currentBGL: number | null, latestLogbookFrom6Hours: logbookEntry | null): BgLevel;
4
4
  export declare function getReminder(bgLevel: BgLevel, carbohydrates: number, userReminder: number, activity: IActivityParams | null): number;
5
5
  export declare function getAttentionMessage(bgLevel: BgLevel, activity: IActivityParams | null): string | null;
6
6
  export declare function isSevereHyperglycemia(logbook?: logbookEntry | null): boolean;
@@ -5,9 +5,9 @@ export declare class Utils {
5
5
  static roundValue(value: number, injectMethod: UserSettings.Enums.InjectionMethod): number;
6
6
  static isInRange(value: number | null, interval: IInterval): boolean;
7
7
  static convertBGLToMGDL(value: number): number;
8
- static displayedBGLValue(value: number, unit: BloodGlucoseUnit): number;
8
+ static displayedBGLValue(value: number, unit: BloodGlucoseUnit): string;
9
9
  static convertBKLToMGDL(value: number): number;
10
- static displayedBKLValue(value: number, unit: BloodKetonesUnit): number;
10
+ static displayedBKLValue(value: number, unit: BloodKetonesUnit): string;
11
11
  static formatUnit: (unit: BloodGlucoseUnit | BloodKetonesUnit) => string;
12
12
  static getKeyFromValue<T>(keys: T, value: T[keyof T]): keyof T;
13
13
  }
@@ -32,13 +32,13 @@ class Utils {
32
32
  return Math.round(value * Constants_1.MGDL_PER_MMOLL_BGL);
33
33
  }
34
34
  static displayedBGLValue(value, unit) {
35
- return unit === types_1.BloodGlucoseUnit.MMOL_L ? value : Utils.convertBGLToMGDL(value);
35
+ return unit === types_1.BloodGlucoseUnit.MMOL_L ? `${value}` : `${Utils.convertBGLToMGDL(value)}`;
36
36
  }
37
37
  static convertBKLToMGDL(value) {
38
38
  return Math.round(value * Constants_1.MGDL_PER_MMOLL_BKL);
39
39
  }
40
40
  static displayedBKLValue(value, unit) {
41
- return unit === types_1.BloodKetonesUnit.MMOL_L ? value : Utils.convertBKLToMGDL(value);
41
+ return unit === types_1.BloodKetonesUnit.MMOL_L ? `${value}` : `${Utils.convertBKLToMGDL(value)}`;
42
42
  }
43
43
  static getKeyFromValue(keys, value) {
44
44
  const values = Object.values(keys);
@@ -2,11 +2,12 @@ import { Activity, BloodGlucoseUnit, BloodKetonesUnit, Languages, UserSettings }
2
2
  import { IRecommendationProps } from "../RecommendationScreen";
3
3
  import { ActivitySettings, IActivityParams, IRecentBolus, logbookEntry } from "../types/types";
4
4
  export declare function validateParams(props: IRecommendationProps): void;
5
+ export declare function checkBKProps(bloodKetoneUnit: BloodKetonesUnit | null, currentBKL: number | null): void;
5
6
  export declare function checkLanguage(language: Languages): void;
6
7
  export declare function checkLatestLogbook6Hours(logbook: logbookEntry | null): void;
7
8
  export declare function checkInjectionMethod(injectionMethod: UserSettings.Enums.InjectionMethod): void;
8
9
  export declare function checkBGLUnit(unit: BloodGlucoseUnit): void;
9
- export declare function checkBKLUnit(unit: BloodKetonesUnit): void;
10
+ export declare function checkBKLUnit(unit: BloodKetonesUnit | null): void;
10
11
  export declare function checkUserReminder(userReminder: number): void;
11
12
  export declare function checkActivity(activity: IActivityParams | null): void;
12
13
  export declare function checkRecentBolus(recentBoluses: Array<IRecentBolus>): void;
@@ -18,9 +19,9 @@ export declare function checkActivityType(activityType: Activity.Enums.ActivityE
18
19
  export declare function checkActivityDate(activity: IActivityParams): void;
19
20
  export declare function checkActivitySettings(activitySettings: ActivitySettings): void;
20
21
  export declare function checkActivityTargetBGL(activitySettingsTargetBGL: number): void;
21
- export declare function checkCurrentBGL(currentBGL: number): void;
22
+ export declare function checkCurrentBGL(currentBGL: number | null): void;
22
23
  export declare function checkTargetBGL(targetBGL: number): void;
23
- export declare function checkBloodKetoneLevel(currentBKL: number): void;
24
+ export declare function checkBloodKetoneLevel(currentBKL: number | null): void;
24
25
  export declare function checkInsulinSensitivity(insulinSensitivity: number): void;
25
26
  export declare function checkInsulinToCarbRatio(insulinToCarbRatio: number): void;
26
27
  export declare function checkCarbohydrates(carbohydrates: number): void;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkCarbohydrates = exports.checkInsulinToCarbRatio = exports.checkInsulinSensitivity = exports.checkBloodKetoneLevel = exports.checkTargetBGL = exports.checkCurrentBGL = exports.checkActivityTargetBGL = exports.checkActivitySettings = exports.checkActivityDate = exports.checkActivityType = exports.checkActivityIntensity = exports.checkActivityDuration = exports.checkRecentBolusesSecondsPassed = exports.checkRecentBolusesInsulinDose = exports.checkRecentBolus = exports.checkActivity = exports.checkUserReminder = exports.checkBKLUnit = exports.checkBGLUnit = exports.checkInjectionMethod = exports.checkLatestLogbook6Hours = exports.checkLanguage = exports.validateParams = void 0;
6
+ exports.checkCarbohydrates = exports.checkInsulinToCarbRatio = exports.checkInsulinSensitivity = exports.checkBloodKetoneLevel = exports.checkTargetBGL = exports.checkCurrentBGL = exports.checkActivityTargetBGL = exports.checkActivitySettings = exports.checkActivityDate = exports.checkActivityType = exports.checkActivityIntensity = exports.checkActivityDuration = exports.checkRecentBolusesSecondsPassed = exports.checkRecentBolusesInsulinDose = exports.checkRecentBolus = exports.checkActivity = exports.checkUserReminder = exports.checkBKLUnit = exports.checkBGLUnit = exports.checkInjectionMethod = exports.checkLatestLogbook6Hours = exports.checkLanguage = exports.checkBKProps = exports.validateParams = void 0;
7
7
  const types_1 = require("@hedia/types");
8
8
  const moment_1 = __importDefault(require("moment"));
9
9
  const Constants_1 = require("./Constants");
@@ -14,6 +14,7 @@ const { fromFortysix } = types_1.Activity.Enums.ActivityReductionIntervals;
14
14
  function validateParams(props) {
15
15
  checkCalculatorParams(props.calculatorParams);
16
16
  checkBGLUnit(props.bloodGlucoseUnit);
17
+ checkBKProps(props.bloodKetoneUnit, props.currentBKL);
17
18
  checkBKLUnit(props.bloodKetoneUnit);
18
19
  checkBloodKetoneLevel(props.currentBKL);
19
20
  checkInjectionMethod(props.injectionMethod);
@@ -25,6 +26,12 @@ function validateParams(props) {
25
26
  }
26
27
  }
27
28
  exports.validateParams = validateParams;
29
+ function checkBKProps(bloodKetoneUnit, currentBKL) {
30
+ if (currentBKL !== null && bloodKetoneUnit === null) {
31
+ throw RecommendationError_1.BloodKetonePropsError();
32
+ }
33
+ }
34
+ exports.checkBKProps = checkBKProps;
28
35
  function checkLanguage(language) {
29
36
  if (!Object.values(types_1.Languages).includes(language)) {
30
37
  throw RecommendationError_1.LanguageError();
@@ -57,9 +64,11 @@ function checkBGLUnit(unit) {
57
64
  }
58
65
  exports.checkBGLUnit = checkBGLUnit;
59
66
  function checkBKLUnit(unit) {
60
- const check = Object.values(types_1.BloodKetonesUnit).some((enumUnit) => enumUnit === unit);
61
- if (!check) {
62
- throw RecommendationError_1.BloodKetoneUnitError();
67
+ if (unit !== null) {
68
+ const check = Object.values(types_1.BloodKetonesUnit).some((enumUnit) => enumUnit === unit);
69
+ if (!check) {
70
+ throw RecommendationError_1.BloodKetoneUnitError();
71
+ }
63
72
  }
64
73
  }
65
74
  exports.checkBKLUnit = checkBKLUnit;