@awell-health/ui-library 0.1.123 → 0.1.126

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 (2) hide show
  1. package/dist/index.js +15 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -48256,6 +48256,9 @@ var Kr=[{
48256
48256
  if (lodash.exports.isNil(attachment) || lodash.exports.isNil(attachment.contentType)) {
48257
48257
  return !required;
48258
48258
  }
48259
+ if (acceptedFileTypes.includes('*') || acceptedFileTypes.includes('*/*')) {
48260
+ return true;
48261
+ }
48259
48262
  return acceptedFileTypes.includes(attachment.contentType);
48260
48263
  };
48261
48264
 
@@ -48265,6 +48268,13 @@ var Kr=[{
48265
48268
  var question = _a.question,control = _a.control,getValues = _a.getValues,labels = _a.labels,_m = _a.inputAutoFocus,inputAutoFocus = _m === void 0 ? false : _m,_o = _a.submitAndMoveToNextQuestion,submitAndMoveToNextQuestion = _o === void 0 ? lodash.exports.noop : _o,_p = _a.onAnswerChange,onAnswerChange = _p === void 0 ? lodash.exports.noop : _p,_q = _a.shouldAutoProgress,shouldAutoProgress = _q === void 0 ? function () {return false;} : _q,onFileUpload = _a.onFileUpload;
48266
48269
  var config = question === null || question === void 0 ? void 0 : question.questionConfig;
48267
48270
  var _r = useICDClassificationList(question.id),icdClassificationOptions = _r.options,optionsLoading = _r.loading,onIcdClassificationSearchChange = _r.onIcdClassificationSearchChange;
48271
+ var getAcceptedFileTypes = function () {
48272
+ var _a, _b, _c, _d;
48273
+ if ((_b = (_a = config === null || config === void 0 ? void 0 : config.file_storage) === null || _a === void 0 ? void 0 : _a.accepted_file_types) === null || _b === void 0 ? void 0 : _b.includes('document/*')) {
48274
+ return ['*/*'];
48275
+ }
48276
+ return (_d = (_c = config === null || config === void 0 ? void 0 : config.file_storage) === null || _c === void 0 ? void 0 : _c.accepted_file_types) !== null && _d !== void 0 ? _d : ['*/*'];
48277
+ };
48268
48278
  switch (question.userQuestionType) {
48269
48279
  case exports.UserQuestionType.YesNo:
48270
48280
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: "", rules: { required: config === null || config === void 0 ? void 0 : config.mandatory }, render: function (_a) {
@@ -48449,42 +48459,21 @@ var Kr=[{
48449
48459
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
48450
48460
  required: config === null || config === void 0 ? void 0 : config.mandatory,
48451
48461
  validate: function (value) {
48452
- var _a, _b, _c;
48462
+ var _a;
48453
48463
  return isAttachmentValid({
48454
48464
  attachmentsValue: value,
48455
- acceptedFileTypes: (_b = (_a = config === null || config === void 0 ? void 0 : config.file_storage) === null || _a === void 0 ? void 0 : _a.accepted_file_types) !== null && _b !== void 0 ? _b : [
48456
- 'application/pdf',
48457
- 'application/msword',
48458
- 'application/json',
48459
- 'application/xml',
48460
- 'application/csv',
48461
- 'application/zip',
48462
- 'document/json',
48463
- 'document/xml',
48464
- 'document/csv',
48465
- 'document/zip'],
48466
-
48467
- required: (_c = config === null || config === void 0 ? void 0 : config.mandatory) !== null && _c !== void 0 ? _c : false });
48465
+ acceptedFileTypes: getAcceptedFileTypes(),
48466
+ required: (_a = config === null || config === void 0 ? void 0 : config.mandatory) !== null && _a !== void 0 ? _a : false });
48468
48467
 
48469
48468
  } },
48470
48469
  render: function (_a) {
48471
48470
  var _b, _c, _d;
48472
48471
  var _e = _a.field,onControllerChange = _e.onChange,onBlur = _e.onBlur,value = _e.value;
48473
48472
  return jsxRuntime.exports.jsx(SingleFileInputField, { id: question.id, value: custom_json_parser(value, ''), onChange: function (attachment) {
48473
+ console.log('attachment', attachment === null || attachment === void 0 ? void 0 : attachment.contentType);
48474
48474
  onControllerChange(JSON.stringify(attachment));
48475
48475
  onAnswerChange();
48476
- }, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : [
48477
- 'application/pdf',
48478
- 'application/msword',
48479
- 'application/json',
48480
- 'application/xml',
48481
- 'application/csv',
48482
- 'application/zip',
48483
- 'document/json',
48484
- 'document/xml',
48485
- 'document/csv',
48486
- 'document/zip'],
48487
- configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory });
48476
+ }, onBlur: onBlur, accept: (_c = (_b = config === null || config === void 0 ? void 0 : config.file_storage) === null || _b === void 0 ? void 0 : _b.accepted_file_types) !== null && _c !== void 0 ? _c : undefined, configSlug: (_d = config === null || config === void 0 ? void 0 : config.file_storage) === null || _d === void 0 ? void 0 : _d.file_storage_config_slug, onFileUpload: onFileUpload, label: question.title, mandatory: config === null || config === void 0 ? void 0 : config.mandatory });
48488
48477
  } });
48489
48478
  case exports.UserQuestionType.Image:
48490
48479
  return jsxRuntime.exports.jsx(Controller, { name: question.id, control: control, defaultValue: [], rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/ui-library",
3
- "version": "0.1.123",
3
+ "version": "0.1.126",
4
4
  "description": "UI components to integrate with Awell Health",
5
5
  "repository": {
6
6
  "type": "git",