@awell-health/ui-library 0.1.113 → 0.1.115

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
@@ -37355,7 +37355,7 @@ Check the top-level render call using <` + t + ">.");
37355
37355
  var countries = getDefaultCountries(availableCountries, initialCountry);
37356
37356
  var _e = build.exports.usePhoneInput({
37357
37357
  initialCountry: initialCountry,
37358
- value: value,
37358
+ value: value !== null && value !== void 0 ? value : '',
37359
37359
  hideSpaceAfterDialCode: true,
37360
37360
  countries: countries,
37361
37361
  forceDialCode: forceDialCode,
@@ -37364,7 +37364,7 @@ Check the top-level render call using <` + t + ">.");
37364
37364
  onChange({ target: { value: phone } });
37365
37365
  } else
37366
37366
  {
37367
- onChange({ target: { value: undefined } });
37367
+ onChange({ target: { value: '' } });
37368
37368
  }
37369
37369
  } }),
37370
37370
  phone = _e.phone,handlePhoneValueChange = _e.handlePhoneValueChange,inputRef = _e.inputRef,country = _e.country,setCountry = _e.setCountry;
@@ -48668,7 +48668,6 @@ var Kr=[{
48668
48668
  return validation.isValid;
48669
48669
  };
48670
48670
  var numberMatchesAvailableCountries = function (number, availableCountries) {
48671
- var _a;
48672
48671
  try {
48673
48672
  var validation = build.exports.validatePhone(number, {
48674
48673
  countries: getDefaultCountries(availableCountries, undefined),
@@ -48682,11 +48681,11 @@ var Kr=[{
48682
48681
  return false;
48683
48682
  }
48684
48683
  if (typeof availableCountries === 'string') {
48685
- return (_a = availableCountries === validation.country.iso2) !== null && _a !== void 0 ? _a : false;
48684
+ return availableCountries === validation.country.iso2;
48686
48685
  }
48687
48686
  return availableCountries.includes(validation.country.iso2);
48688
48687
  }
48689
- catch (_b) {
48688
+ catch (_a) {
48690
48689
  return false;
48691
48690
  }
48692
48691
  };
@@ -48925,6 +48924,21 @@ var Kr=[{
48925
48924
  return __assign(__assign({}, question), { visible: visible });
48926
48925
  });
48927
48926
  };
48927
+ var updateVisibilityForTraditionalForm = function (questions, evaluation_results) {
48928
+ if (evaluation_results.length === 0) {
48929
+ return questions.map(function (question) {return __assign(__assign({}, question), { visible: question.rule === null });});
48930
+ } else
48931
+ {
48932
+ return questions.map(function (question) {
48933
+ var result = evaluation_results.find(function (_a) {
48934
+ var question_id = _a.question_id;
48935
+ return question_id === question.id;
48936
+ });
48937
+ var visible = !result ? true : result === null || result === void 0 ? void 0 : result.satisfied;
48938
+ return __assign(__assign({}, question), { visible: visible });
48939
+ });
48940
+ }
48941
+ };
48928
48942
  var isEmpty = function (value) {
48929
48943
  return typeof Array.isArray(value) && value.length === 0 ||
48930
48944
  typeof value === 'string' && value.length === 0 ||
@@ -49105,7 +49119,7 @@ var Kr=[{
49105
49119
  return [4, evaluateDisplayConditions(formValuesInput)];
49106
49120
  case 1:
49107
49121
  evaluationResults = _a.sent();
49108
- updatedQuestions = updateVisibility(questions, evaluationResults).filter(function (e) {return e.visible;});
49122
+ updatedQuestions = updateVisibilityForTraditionalForm(questions, evaluationResults).filter(function (e) {return e.visible;});
49109
49123
  setVisibleQuestions(updatedQuestions);
49110
49124
  return [2, updatedQuestions];}
49111
49125
 
@@ -4,9 +4,9 @@ import { CountryIso2 } from 'react-international-phone';
4
4
  export interface PhoneInputFieldProps extends InputHTMLAttributes<HTMLInputElement> {
5
5
  label: string;
6
6
  id: string;
7
- onChange: ({ target: { value }, }: {
7
+ onChange: ({ target: { value } }: {
8
8
  target: {
9
- value: string | undefined;
9
+ value: string;
10
10
  };
11
11
  }) => void;
12
12
  onClick?: MouseEventHandler<HTMLInputElement>;
@@ -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.113",
3
+ "version": "0.1.115",
4
4
  "description": "UI components to integrate with Awell Health",
5
5
  "repository": {
6
6
  "type": "git",