@influenzanet/case-web-app-core 2.7.5-staging.5 → 2.7.5-staging.7

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.
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import { FooterConfig } from './types/footerConfig';
3
- import { AppConfig } from './types/appConfig';
4
- import { HeaderConfig } from './types/headerConfig';
5
- import { NavbarConfig } from './types/navbarConfig';
6
- import { PagesConfig } from './types/pagesConfig';
7
- import { CustomSurveyResponseComponent } from '@influenzanet/case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent';
1
+ import React from "react";
2
+ import { FooterConfig } from "./types/footerConfig";
3
+ import { AppConfig } from "./types/appConfig";
4
+ import { HeaderConfig } from "./types/headerConfig";
5
+ import { NavbarConfig } from "./types/navbarConfig";
6
+ import { PagesConfig } from "./types/pagesConfig";
7
+ import { CustomSurveyResponseComponent } from "@influenzanet/case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent";
8
8
  export interface Extension {
9
9
  name: string;
10
10
  component: React.FunctionComponent<any>;
package/build/index.d.ts CHANGED
@@ -6,6 +6,11 @@ import * as userAPI from "./api/userAPI";
6
6
  import { useAuthTokenCheck } from "./hooks/useAuthTokenCheck";
7
7
  import PreventAccidentalNavigationPrompt from "./components/misc/PreventAccidentalNavigationPrompt";
8
8
  import InternalNavigator from "./components/misc/InternalNavigator";
9
+ import { AppConfig } from "./types/appConfig";
10
+ import { HeaderConfig } from './types/headerConfig';
11
+ import { FooterConfig } from './types/footerConfig';
12
+ import { NavbarConfig } from './types/navbarConfig';
13
+ import { PageConfig } from './types/pagesConfig';
9
14
  declare const coreReduxActions: {
10
15
  appActions: import("@reduxjs/toolkit").CaseReducerActions<{
11
16
  reset: (state: import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>) => import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>;
@@ -80,4 +85,4 @@ declare const coreReduxActions: {
80
85
  declare const coreReduxThunks: {
81
86
  enterStudyThunk: import("@reduxjs/toolkit").AsyncThunk<import("./store/actions/studiesActions").EnterStudyPayload, import("./store/thunks/studiesThunks").EnterStudyRequest, {}>;
82
87
  };
83
- export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, coreReduxThunks, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator, };
88
+ export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, coreReduxThunks, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator, type AppConfig, type HeaderConfig, type FooterConfig, type NavbarConfig, type PageConfig };
package/build/index.es.js CHANGED
@@ -5445,13 +5445,13 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
5445
5445
  *
5446
5446
  * @returns {Object} Result of all merge properties
5447
5447
  */
5448
- function merge(/* obj1, obj2, obj3, ... */) {
5448
+ function merge$2(/* obj1, obj2, obj3, ... */) {
5449
5449
  const result = {};
5450
5450
  const assignValue = (val, key) => {
5451
5451
  if (isPlainObject$1(result[key]) && isPlainObject$1(val)) {
5452
- result[key] = merge(result[key], val);
5452
+ result[key] = merge$2(result[key], val);
5453
5453
  } else if (isPlainObject$1(val)) {
5454
- result[key] = merge({}, val);
5454
+ result[key] = merge$2({}, val);
5455
5455
  } else if (isArray$2(val)) {
5456
5456
  result[key] = val.slice();
5457
5457
  } else {
@@ -5753,7 +5753,7 @@ var utils = {
5753
5753
  isTypedArray: isTypedArray$2,
5754
5754
  isFileList,
5755
5755
  forEach,
5756
- merge,
5756
+ merge: merge$2,
5757
5757
  extend,
5758
5758
  trim,
5759
5759
  stripBOM,
@@ -9230,6 +9230,63 @@ function isArrayLike(value) {
9230
9230
  return value != null && isLength(value.length) && !isFunction(value);
9231
9231
  }
9232
9232
 
9233
+ /**
9234
+ * Checks if the given arguments are from an iteratee call.
9235
+ *
9236
+ * @private
9237
+ * @param {*} value The potential iteratee value argument.
9238
+ * @param {*} index The potential iteratee index or key argument.
9239
+ * @param {*} object The potential iteratee object argument.
9240
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
9241
+ * else `false`.
9242
+ */
9243
+ function isIterateeCall(value, index, object) {
9244
+ if (!isObject(object)) {
9245
+ return false;
9246
+ }
9247
+ var type = typeof index;
9248
+ if (type == 'number'
9249
+ ? (isArrayLike(object) && isIndex(index, object.length))
9250
+ : (type == 'string' && index in object)
9251
+ ) {
9252
+ return eq(object[index], value);
9253
+ }
9254
+ return false;
9255
+ }
9256
+
9257
+ /**
9258
+ * Creates a function like `_.assign`.
9259
+ *
9260
+ * @private
9261
+ * @param {Function} assigner The function to assign values.
9262
+ * @returns {Function} Returns the new assigner function.
9263
+ */
9264
+ function createAssigner(assigner) {
9265
+ return baseRest(function(object, sources) {
9266
+ var index = -1,
9267
+ length = sources.length,
9268
+ customizer = length > 1 ? sources[length - 1] : undefined,
9269
+ guard = length > 2 ? sources[2] : undefined;
9270
+
9271
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
9272
+ ? (length--, customizer)
9273
+ : undefined;
9274
+
9275
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
9276
+ customizer = length < 3 ? undefined : customizer;
9277
+ length = 1;
9278
+ }
9279
+ object = Object(object);
9280
+ while (++index < length) {
9281
+ var source = sources[index];
9282
+ if (source) {
9283
+ assigner(object, source, index, customizer);
9284
+ }
9285
+ }
9286
+ return object;
9287
+ });
9288
+ }
9289
+
9233
9290
  /** Used for built-in method references. */
9234
9291
  var objectProto$c = Object.prototype;
9235
9292
 
@@ -12476,6 +12533,22 @@ function debounce$1(func, wait, options) {
12476
12533
  return debounced;
12477
12534
  }
12478
12535
 
12536
+ /**
12537
+ * This function is like `assignValue` except that it doesn't assign
12538
+ * `undefined` values.
12539
+ *
12540
+ * @private
12541
+ * @param {Object} object The object to modify.
12542
+ * @param {string} key The key of the property to assign.
12543
+ * @param {*} value The value to assign.
12544
+ */
12545
+ function assignMergeValue(object, key, value) {
12546
+ if ((value !== undefined && !eq(object[key], value)) ||
12547
+ (value === undefined && !(key in object))) {
12548
+ baseAssignValue(object, key, value);
12549
+ }
12550
+ }
12551
+
12479
12552
  /**
12480
12553
  * This method is like `_.isArrayLike` except that it also checks if `value`
12481
12554
  * is an object.
@@ -12505,6 +12578,164 @@ function isArrayLikeObject(value) {
12505
12578
  return isObjectLike(value) && isArrayLike(value);
12506
12579
  }
12507
12580
 
12581
+ /**
12582
+ * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
12583
+ *
12584
+ * @private
12585
+ * @param {Object} object The object to query.
12586
+ * @param {string} key The key of the property to get.
12587
+ * @returns {*} Returns the property value.
12588
+ */
12589
+ function safeGet(object, key) {
12590
+ if (key === 'constructor' && typeof object[key] === 'function') {
12591
+ return;
12592
+ }
12593
+
12594
+ if (key == '__proto__') {
12595
+ return;
12596
+ }
12597
+
12598
+ return object[key];
12599
+ }
12600
+
12601
+ /**
12602
+ * Converts `value` to a plain object flattening inherited enumerable string
12603
+ * keyed properties of `value` to own properties of the plain object.
12604
+ *
12605
+ * @static
12606
+ * @memberOf _
12607
+ * @since 3.0.0
12608
+ * @category Lang
12609
+ * @param {*} value The value to convert.
12610
+ * @returns {Object} Returns the converted plain object.
12611
+ * @example
12612
+ *
12613
+ * function Foo() {
12614
+ * this.b = 2;
12615
+ * }
12616
+ *
12617
+ * Foo.prototype.c = 3;
12618
+ *
12619
+ * _.assign({ 'a': 1 }, new Foo);
12620
+ * // => { 'a': 1, 'b': 2 }
12621
+ *
12622
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
12623
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
12624
+ */
12625
+ function toPlainObject(value) {
12626
+ return copyObject(value, keysIn(value));
12627
+ }
12628
+
12629
+ /**
12630
+ * A specialized version of `baseMerge` for arrays and objects which performs
12631
+ * deep merges and tracks traversed objects enabling objects with circular
12632
+ * references to be merged.
12633
+ *
12634
+ * @private
12635
+ * @param {Object} object The destination object.
12636
+ * @param {Object} source The source object.
12637
+ * @param {string} key The key of the value to merge.
12638
+ * @param {number} srcIndex The index of `source`.
12639
+ * @param {Function} mergeFunc The function to merge values.
12640
+ * @param {Function} [customizer] The function to customize assigned values.
12641
+ * @param {Object} [stack] Tracks traversed source values and their merged
12642
+ * counterparts.
12643
+ */
12644
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
12645
+ var objValue = safeGet(object, key),
12646
+ srcValue = safeGet(source, key),
12647
+ stacked = stack.get(srcValue);
12648
+
12649
+ if (stacked) {
12650
+ assignMergeValue(object, key, stacked);
12651
+ return;
12652
+ }
12653
+ var newValue = customizer
12654
+ ? customizer(objValue, srcValue, (key + ''), object, source, stack)
12655
+ : undefined;
12656
+
12657
+ var isCommon = newValue === undefined;
12658
+
12659
+ if (isCommon) {
12660
+ var isArr = isArray$1(srcValue),
12661
+ isBuff = !isArr && isBuffer$1(srcValue),
12662
+ isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
12663
+
12664
+ newValue = srcValue;
12665
+ if (isArr || isBuff || isTyped) {
12666
+ if (isArray$1(objValue)) {
12667
+ newValue = objValue;
12668
+ }
12669
+ else if (isArrayLikeObject(objValue)) {
12670
+ newValue = copyArray(objValue);
12671
+ }
12672
+ else if (isBuff) {
12673
+ isCommon = false;
12674
+ newValue = cloneBuffer(srcValue, true);
12675
+ }
12676
+ else if (isTyped) {
12677
+ isCommon = false;
12678
+ newValue = cloneTypedArray(srcValue, true);
12679
+ }
12680
+ else {
12681
+ newValue = [];
12682
+ }
12683
+ }
12684
+ else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
12685
+ newValue = objValue;
12686
+ if (isArguments$1(objValue)) {
12687
+ newValue = toPlainObject(objValue);
12688
+ }
12689
+ else if (!isObject(objValue) || isFunction(objValue)) {
12690
+ newValue = initCloneObject(srcValue);
12691
+ }
12692
+ }
12693
+ else {
12694
+ isCommon = false;
12695
+ }
12696
+ }
12697
+ if (isCommon) {
12698
+ // Recursively merge objects and arrays (susceptible to call stack limits).
12699
+ stack.set(srcValue, newValue);
12700
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
12701
+ stack['delete'](srcValue);
12702
+ }
12703
+ assignMergeValue(object, key, newValue);
12704
+ }
12705
+
12706
+ /**
12707
+ * The base implementation of `_.merge` without support for multiple sources.
12708
+ *
12709
+ * @private
12710
+ * @param {Object} object The destination object.
12711
+ * @param {Object} source The source object.
12712
+ * @param {number} srcIndex The index of `source`.
12713
+ * @param {Function} [customizer] The function to customize merged values.
12714
+ * @param {Object} [stack] Tracks traversed source values and their merged
12715
+ * counterparts.
12716
+ */
12717
+ function baseMerge(object, source, srcIndex, customizer, stack) {
12718
+ if (object === source) {
12719
+ return;
12720
+ }
12721
+ baseFor$1(source, function(srcValue, key) {
12722
+ stack || (stack = new Stack);
12723
+ if (isObject(srcValue)) {
12724
+ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
12725
+ }
12726
+ else {
12727
+ var newValue = customizer
12728
+ ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
12729
+ : undefined;
12730
+
12731
+ if (newValue === undefined) {
12732
+ newValue = srcValue;
12733
+ }
12734
+ assignMergeValue(object, key, newValue);
12735
+ }
12736
+ }, keysIn);
12737
+ }
12738
+
12508
12739
  /**
12509
12740
  * This function is like `arrayIncludes` except that it accepts a comparator.
12510
12741
  *
@@ -12756,6 +12987,43 @@ function mapValues(object, iteratee) {
12756
12987
  return result;
12757
12988
  }
12758
12989
 
12990
+ /**
12991
+ * This method is like `_.assign` except that it recursively merges own and
12992
+ * inherited enumerable string keyed properties of source objects into the
12993
+ * destination object. Source properties that resolve to `undefined` are
12994
+ * skipped if a destination value exists. Array and plain object properties
12995
+ * are merged recursively. Other objects and value types are overridden by
12996
+ * assignment. Source objects are applied from left to right. Subsequent
12997
+ * sources overwrite property assignments of previous sources.
12998
+ *
12999
+ * **Note:** This method mutates `object`.
13000
+ *
13001
+ * @static
13002
+ * @memberOf _
13003
+ * @since 0.5.0
13004
+ * @category Object
13005
+ * @param {Object} object The destination object.
13006
+ * @param {...Object} [sources] The source objects.
13007
+ * @returns {Object} Returns `object`.
13008
+ * @example
13009
+ *
13010
+ * var object = {
13011
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
13012
+ * };
13013
+ *
13014
+ * var other = {
13015
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
13016
+ * };
13017
+ *
13018
+ * _.merge(object, other);
13019
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
13020
+ */
13021
+ var merge = createAssigner(function(object, source, srcIndex) {
13022
+ baseMerge(object, source, srcIndex);
13023
+ });
13024
+
13025
+ var merge$1 = merge;
13026
+
12759
13027
  /**
12760
13028
  * The base implementation of `_.unset`.
12761
13029
  *
@@ -13049,7 +13317,10 @@ var userSlice = createSlice({
13049
13317
  action.payload.preferredLanguage;
13050
13318
  },
13051
13319
  setUser: function (state, action) {
13052
- state.currentUser = action.payload;
13320
+ state.currentUser = __assign(__assign({}, action.payload), { profiles: action.payload.profiles.map(function (profile) {
13321
+ var existingProfile = state.currentUser.profiles.find(function (p) { return p.id === profile.id; });
13322
+ return merge$1({}, existingProfile !== null && existingProfile !== void 0 ? existingProfile : {}, profile);
13323
+ }) });
13053
13324
  },
13054
13325
  setUserID: function (state, action) {
13055
13326
  state.currentUser.account.accountId = action.payload;
@@ -13061,20 +13332,18 @@ var userSlice = createSlice({
13061
13332
  extraReducers: function (builder) {
13062
13333
  builder.addCase(initializeUserStudies, function (state, action) {
13063
13334
  var updatedProfiles = state.currentUser.profiles.map(function (profile) {
13064
- return __assign(__assign({}, profile), { studies: action.payload[profile.id] });
13335
+ profile.studies = action.payload[profile.id];
13336
+ return profile;
13065
13337
  });
13066
- if (!isEqual(updatedProfiles, state.currentUser.profiles)) {
13067
- state.currentUser.profiles = updatedProfiles;
13068
- }
13338
+ state.currentUser.profiles = updatedProfiles;
13069
13339
  });
13070
13340
  builder.addCase(initializeActiveSurveys, function (state, action) {
13071
13341
  var updatedProfiles = state.currentUser.profiles.map(function (profile) {
13072
13342
  var surveysForProfile = action.payload[profile.id] || [];
13073
- return __assign(__assign({}, profile), { activeSurveys: surveysForProfile });
13343
+ profile.activeSurveys = surveysForProfile;
13344
+ return profile;
13074
13345
  });
13075
- if (!isEqual(state.currentUser.profiles, updatedProfiles)) {
13076
- state.currentUser.profiles = updatedProfiles;
13077
- }
13346
+ state.currentUser.profiles = updatedProfiles;
13078
13347
  });
13079
13348
  builder.addCase(enterStudy, function (state, action) {
13080
13349
  var _a = action.payload, profileId = _a.profileId, studyKey = _a.studyKey;
@@ -13082,9 +13351,7 @@ var userSlice = createSlice({
13082
13351
  return profile.id === profileId
13083
13352
  ? __assign(__assign({}, profile), { studies: union$1(profile.studies, [studyKey]) }) : profile;
13084
13353
  });
13085
- if (!isEqual(updatedProfiles, state.currentUser.profiles)) {
13086
- state.currentUser.profiles = updatedProfiles;
13087
- }
13354
+ state.currentUser.profiles = updatedProfiles;
13088
13355
  });
13089
13356
  },
13090
13357
  });
@@ -21711,11 +21978,11 @@ var enterStudyThunk = createAsyncThunk("studies/enterStudy", function (_a, _b) {
21711
21978
  })];
21712
21979
  case 1:
21713
21980
  _c.sent();
21981
+ payload = { profileId: profileId, studyKey: studyKey };
21982
+ dispatch(enterStudy(payload));
21714
21983
  return [4 /*yield*/, dispatch(initializeActiveSurveysThunk())];
21715
21984
  case 2:
21716
21985
  _c.sent();
21717
- payload = { profileId: profileId, studyKey: studyKey };
21718
- dispatch(enterStudy(payload));
21719
21986
  return [2 /*return*/, payload];
21720
21987
  }
21721
21988
  });
@@ -21786,7 +22053,6 @@ var EditProfile = function (props) {
21786
22053
  return [4 /*yield*/, getUserReq()];
21787
22054
  case 4:
21788
22055
  user = (_a.sent()).data;
21789
- dispatch(userActions.setUser(user));
21790
22056
  // if the profile creation is successful, enter the default studies
21791
22057
  if (defaultStudies.length > 0) {
21792
22058
  defaultStudies.forEach(function (studyKey) {
@@ -21796,6 +22062,7 @@ var EditProfile = function (props) {
21796
22062
  }));
21797
22063
  });
21798
22064
  }
22065
+ dispatch(userActions.setUser(user));
21799
22066
  setLoading(false);
21800
22067
  close();
21801
22068
  return [3 /*break*/, 6];
@@ -23392,9 +23659,6 @@ var SurveyList = function (props) {
23392
23659
  var history = useHistory();
23393
23660
  var profiles = useSelector(function (state) { return state.user.currentUser.profiles; });
23394
23661
  var activeSurveyInfos = useSelector(function (state) { return state.studies.activeSurveyInfos; });
23395
- useEffect(function () {
23396
- window.scrollTo(0, 0);
23397
- });
23398
23662
  var cardInfos = [];
23399
23663
  var _loop_1 = function (assignedSurvey) {
23400
23664
  var profile = profiles.find(function (p) { return p.id === assignedSurvey.profileId; });
@@ -33046,19 +33310,19 @@ initializeUserStudiesThunk.pending; initializeUserStudiesThunk.fulfilled; initia
33046
33310
 
33047
33311
  var DefaultStudiesManager = function () {
33048
33312
  var dispatch = useDispatch();
33049
- var currentUser = useSelector(function (state) { return state.user.currentUser; });
33313
+ var currentUserId = useSelector(function (state) { return state.user.currentUser.id; });
33050
33314
  useEffect(function () {
33051
33315
  var initialize = function () { return __awaiter(void 0, void 0, void 0, function () {
33052
- var defaultStudies_1, _a, profilesStudiesMap_1, _b;
33316
+ var defaultStudies_1, _a, profilesStudiesMap_1, _b, enterStudyReqs_1;
33053
33317
  return __generator$1(this, function (_d) {
33054
33318
  switch (_d.label) {
33055
33319
  case 0:
33056
- if (!currentUser.id) {
33320
+ if (!currentUserId) {
33057
33321
  return [2 /*return*/];
33058
33322
  }
33059
33323
  _d.label = 1;
33060
33324
  case 1:
33061
- _d.trys.push([1, 5, , 6]);
33325
+ _d.trys.push([1, 7, , 8]);
33062
33326
  _a = unwrapResult;
33063
33327
  return [4 /*yield*/, dispatch(initializeDefaultStudiesThunk())];
33064
33328
  case 2:
@@ -33067,13 +33331,7 @@ var DefaultStudiesManager = function () {
33067
33331
  return [4 /*yield*/, dispatch(initializeUserStudiesThunk())];
33068
33332
  case 3:
33069
33333
  profilesStudiesMap_1 = _b.apply(void 0, [_d.sent()]);
33070
- /**
33071
- * Backward compatibility with the functionality once present
33072
- * in the SurveyList component
33073
- *
33074
- * We check whether all the default studies are assigned
33075
- * to all profiles and if not, we try entering the study
33076
- */
33334
+ enterStudyReqs_1 = [];
33077
33335
  Object.keys(profilesStudiesMap_1).forEach(function (profileId) {
33078
33336
  var profileStudies = profilesStudiesMap_1[profileId];
33079
33337
  if (!profileStudies) {
@@ -33082,24 +33340,38 @@ var DefaultStudiesManager = function () {
33082
33340
  var missingDefaultStudies = defaultStudies_1.filter(function (study) { return !profileStudies.includes(study); });
33083
33341
  if (missingDefaultStudies.length > 0) {
33084
33342
  missingDefaultStudies.forEach(function (studyKey) {
33085
- dispatch(enterStudyThunk({ profileId: profileId, studyKey: studyKey }));
33343
+ enterStudyReqs_1.push({ profileId: profileId, studyKey: studyKey });
33086
33344
  });
33087
33345
  }
33088
33346
  });
33089
- return [4 /*yield*/, dispatch(initializeActiveSurveysThunk())];
33347
+ if (!(enterStudyReqs_1.length > 0)) return [3 /*break*/, 6];
33348
+ return [4 /*yield*/, Promise.all(enterStudyReqs_1.map(function (req) { return __awaiter(void 0, void 0, void 0, function () {
33349
+ return __generator$1(this, function (_a) {
33350
+ switch (_a.label) {
33351
+ case 0: return [4 /*yield*/, dispatch(enterStudyThunk(req))];
33352
+ case 1:
33353
+ _a.sent();
33354
+ return [2 /*return*/];
33355
+ }
33356
+ });
33357
+ }); }))];
33090
33358
  case 4:
33091
33359
  _d.sent();
33092
- return [3 /*break*/, 6];
33360
+ return [4 /*yield*/, dispatch(initializeActiveSurveysThunk())];
33093
33361
  case 5:
33094
33362
  _d.sent();
33095
- return [3 /*break*/, 6];
33096
- case 6: return [2 /*return*/];
33363
+ _d.label = 6;
33364
+ case 6: return [3 /*break*/, 8];
33365
+ case 7:
33366
+ _d.sent();
33367
+ return [3 /*break*/, 8];
33368
+ case 8: return [2 /*return*/];
33097
33369
  }
33098
33370
  });
33099
33371
  }); };
33100
33372
  initialize();
33101
- }, [currentUser.id, dispatch]);
33102
- return jsx(Fragment, {}, void 0);
33373
+ }, [currentUserId, dispatch]);
33374
+ return null;
33103
33375
  };
33104
33376
 
33105
33377
  var AppCore = function (props) {
@@ -33108,19 +33380,23 @@ var AppCore = function (props) {
33108
33380
  var i18n = useTranslation().i18n;
33109
33381
  var accessToken = useSelector(function (state) { var _a; return (_a = state.app.auth) === null || _a === void 0 ? void 0 : _a.accessToken; });
33110
33382
  /*
33111
- * In order to solve the issue https://github.com/coneno/case-web-app-core/issues/5, now Dialogs also need to know the application level default routes,
33112
- * but removing the defaultRoutes field from the PagesConfig interface and make it available at a higher level would be a breaking change for all the existing frontends.
33113
- *
33114
- * From now on, all components under AppCore that need to be aware of the application level default routes, can use a prop directly initialized with the const below.
33115
- *
33116
- * See how it is handled in the Pages and GlobalDialog components
33117
- */
33118
- var defaultRoutes = ((_a = props.pagesConfig) === null || _a === void 0 ? void 0 : _a.defaultRoutes) ? props.pagesConfig.defaultRoutes : BasicRoutes;
33383
+ * In order to solve the issue https://github.com/coneno/case-web-app-core/issues/5, now Dialogs also need to know the application level default routes,
33384
+ * but removing the defaultRoutes field from the PagesConfig interface and make it available at a higher level would be a breaking change for all the existing frontends.
33385
+ *
33386
+ * From now on, all components under AppCore that need to be aware of the application level default routes, can use a prop directly initialized with the const below.
33387
+ *
33388
+ * See how it is handled in the Pages and GlobalDialog components
33389
+ */
33390
+ var defaultRoutes = ((_a = props.pagesConfig) === null || _a === void 0 ? void 0 : _a.defaultRoutes)
33391
+ ? props.pagesConfig.defaultRoutes
33392
+ : BasicRoutes;
33119
33393
  if (accessToken) {
33120
33394
  setDefaultAccessTokenHeader(accessToken);
33121
33395
  }
33122
33396
  useEffect(function () {
33123
- var language = loadLastSelectedLanguage(process.env.REACT_APP_DEFAULT_LANGUAGE ? process.env.REACT_APP_DEFAULT_LANGUAGE : 'en');
33397
+ var language = loadLastSelectedLanguage(process.env.REACT_APP_DEFAULT_LANGUAGE
33398
+ ? process.env.REACT_APP_DEFAULT_LANGUAGE
33399
+ : "en");
33124
33400
  i18n.changeLanguage(language);
33125
33401
  }, [i18n]);
33126
33402
  useEffect(function () {
@@ -33128,7 +33404,7 @@ var AppCore = function (props) {
33128
33404
  }, [i18n.language]);
33129
33405
  useEffect(function () {
33130
33406
  var _a, _b;
33131
- dispatch(appConfig.updateInstanceID(((_a = props.appConfig) === null || _a === void 0 ? void 0 : _a.instanceId) ? (_b = props.appConfig) === null || _b === void 0 ? void 0 : _b.instanceId : 'default'));
33407
+ dispatch(appConfig.updateInstanceID(((_a = props.appConfig) === null || _a === void 0 ? void 0 : _a.instanceId) ? (_b = props.appConfig) === null || _b === void 0 ? void 0 : _b.instanceId : "default"));
33132
33408
  }, [dispatch, (_b = props.appConfig) === null || _b === void 0 ? void 0 : _b.instanceId]);
33133
33409
  useEffect(function () {
33134
33410
  if (props.appConfig) {
@@ -33140,7 +33416,9 @@ var AppCore = function (props) {
33140
33416
  console.log("Changing language to: ".concat(code));
33141
33417
  i18n.changeLanguage(code);
33142
33418
  };
33143
- return (jsxs(q, { children: [jsx(LocalStorage, {}, void 0), jsxs(BrowserRouter, __assign({ basename: process.env.NODE_ENV === 'production' ? process.env.PUBLIC_URL : undefined }, { children: [jsx(ScrollToTop, {}, void 0), jsx(DefaultStudiesManager, {}, void 0), props.customHeader ? props.customHeader : null, !props.hideDefaultHeader ? jsx(HeaderRenderer, { config: props.headerConfig, onChangeLanguage: handleLanguageChange, onOpenExternalPage: handleOpenExternalPage }, void 0) : null, jsx(Navbar, { loading: props.navbarConfig === undefined, content: props.navbarConfig, onOpenExternalPage: handleOpenExternalPage }, void 0), jsx(Pages, { config: props.pagesConfig, onOpenExternalPage: handleOpenExternalPage, extensions: props.extensions, customResponseComponents: props.customSurveyResponseComponents, dateLocales: props.dateLocales, defaultRoutes: defaultRoutes }, void 0), !props.hideDefaultFooter ? jsx(FooterRenderer, { footerConfig: props.footerConfig, onChangeLanguage: handleLanguageChange, onOpenExternalPage: handleOpenExternalPage }, void 0) : null, props.customFooter ? props.customFooter : null, jsx(GlobalDialogs, { defaultRoutes: defaultRoutes, onChangeLanguage: handleLanguageChange }, void 0)] }), void 0)] }, void 0));
33419
+ return (jsxs(q, { children: [jsx(LocalStorage, {}, void 0), jsx(DefaultStudiesManager, {}, void 0), jsxs(BrowserRouter, __assign({ basename: process.env.NODE_ENV === "production"
33420
+ ? process.env.PUBLIC_URL
33421
+ : undefined }, { children: [jsx(ScrollToTop, {}, void 0), props.customHeader ? props.customHeader : null, !props.hideDefaultHeader ? (jsx(HeaderRenderer, { config: props.headerConfig, onChangeLanguage: handleLanguageChange, onOpenExternalPage: handleOpenExternalPage }, void 0)) : null, jsx(Navbar, { loading: props.navbarConfig === undefined, content: props.navbarConfig, onOpenExternalPage: handleOpenExternalPage }, void 0), jsx(Pages, { config: props.pagesConfig, onOpenExternalPage: handleOpenExternalPage, extensions: props.extensions, customResponseComponents: props.customSurveyResponseComponents, dateLocales: props.dateLocales, defaultRoutes: defaultRoutes }, void 0), !props.hideDefaultFooter ? (jsx(FooterRenderer, { footerConfig: props.footerConfig, onChangeLanguage: handleLanguageChange, onOpenExternalPage: handleOpenExternalPage }, void 0)) : null, props.customFooter ? props.customFooter : null, jsx(GlobalDialogs, { defaultRoutes: defaultRoutes, onChangeLanguage: handleLanguageChange }, void 0)] }), void 0)] }, void 0));
33144
33422
  };
33145
33423
 
33146
33424
  var InternalNavigator = function (props) {