@awell-health/ui-library 0.1.114 → 0.1.116

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.js CHANGED
@@ -48924,6 +48924,26 @@ var Kr=[{
48924
48924
  return __assign(__assign({}, question), { visible: visible });
48925
48925
  });
48926
48926
  };
48927
+ var updateVisibilityForTraditionalForm = function (questions, evaluation_results) {
48928
+ if (evaluation_results.length === 0) {
48929
+ return questions.map(function (question) {
48930
+ var _a, _b;
48931
+ return __assign(__assign({}, question), { visible: question.rule === null ||
48932
+ Array.isArray((_a = question.rule) === null || _a === void 0 ? void 0 : _a.conditions) &&
48933
+ ((_b = question.rule) === null || _b === void 0 ? void 0 : _b.conditions.length) === 0 });
48934
+ });
48935
+ } else
48936
+ {
48937
+ return questions.map(function (question) {
48938
+ var result = evaluation_results.find(function (_a) {
48939
+ var question_id = _a.question_id;
48940
+ return question_id === question.id;
48941
+ });
48942
+ var visible = !result ? true : result === null || result === void 0 ? void 0 : result.satisfied;
48943
+ return __assign(__assign({}, question), { visible: visible });
48944
+ });
48945
+ }
48946
+ };
48927
48947
  var isEmpty = function (value) {
48928
48948
  return typeof Array.isArray(value) && value.length === 0 ||
48929
48949
  typeof value === 'string' && value.length === 0 ||
@@ -49104,7 +49124,7 @@ var Kr=[{
49104
49124
  return [4, evaluateDisplayConditions(formValuesInput)];
49105
49125
  case 1:
49106
49126
  evaluationResults = _a.sent();
49107
- updatedQuestions = updateVisibility(questions, evaluationResults).filter(function (e) {return e.visible;});
49127
+ updatedQuestions = updateVisibilityForTraditionalForm(questions, evaluationResults).filter(function (e) {return e.visible;});
49108
49128
  setVisibleQuestions(updatedQuestions);
49109
49129
  return [2, updatedQuestions];}
49110
49130
 
@@ -12,6 +12,7 @@ export declare const convertToAwellInput: (formResponse: any) => {
12
12
  }[];
13
13
  export declare const convertToFormFormat: (answersAsString: string | undefined, questions: Array<Question>) => Record<string, AnswerValue>;
14
14
  export declare const updateVisibility: (questions: Array<Question>, evaluation_results: Array<QuestionRuleResult>) => Array<QuestionWithVisibility>;
15
+ export declare const updateVisibilityForTraditionalForm: (questions: Array<Question>, evaluation_results: Array<QuestionRuleResult>) => Array<QuestionWithVisibility>;
15
16
  export declare const isEmpty: (value: any) => boolean;
16
17
  interface CalculatePercentageCompletedProps {
17
18
  currentQuestionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/ui-library",
3
- "version": "0.1.114",
3
+ "version": "0.1.116",
4
4
  "description": "UI components to integrate with Awell Health",
5
5
  "repository": {
6
6
  "type": "git",