@influenzanet/case-web-app-core 2.7.5-staging.4 → 2.7.5-staging.6

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/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,30 +13332,26 @@ 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;
13081
13350
  var updatedProfiles = state.currentUser.profiles.map(function (profile) {
13082
13351
  return profile.id === profileId
13083
- ? __assign(__assign({}, profile), { studies: union$1(profile.studies, studyKey) }) : profile;
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
  });
@@ -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,14 +33310,14 @@ 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
33316
  var defaultStudies_1, _a, profilesStudiesMap_1, _b;
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;
@@ -33098,8 +33362,8 @@ var DefaultStudiesManager = function () {
33098
33362
  });
33099
33363
  }); };
33100
33364
  initialize();
33101
- }, [currentUser.id, dispatch]);
33102
- return jsx(Fragment, {}, void 0);
33365
+ }, [currentUserId, dispatch]);
33366
+ return null;
33103
33367
  };
33104
33368
 
33105
33369
  var AppCore = function (props) {