fhir-react 2.0.1-beta.9 → 2.1.1-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-react",
3
- "version": "2.0.1-beta.9",
3
+ "version": "2.1.1-beta.1",
4
4
  "description": "React component library for displaying FHIR Resources ",
5
5
  "main": "build/index.js",
6
6
  "peerDependencies": {
@@ -125,7 +125,8 @@
125
125
  "stylelint": "^14.5.3",
126
126
  "stylelint-config-standard": "^25.0.0",
127
127
  "webpack": "^4.41.2",
128
- "webpack-cli": "^3.3.10"
128
+ "webpack-cli": "^3.3.10",
129
+ "webpack-node-externals": "^3.0.0"
129
130
  },
130
131
  "overrides": {
131
132
  "react": "^18.3.1",
@@ -9,7 +9,16 @@ const Markdown = props => {
9
9
  let html = null;
10
10
  try {
11
11
  const unsafeHTML = marked(markdown, { gfm: true });
12
- html = DOMPurify.sanitize(unsafeHTML);
12
+ html = DOMPurify.sanitize(unsafeHTML, {
13
+ ALLOWED_TAGS: [
14
+ 'p', 'br', 'strong', 'em', 'b', 'i', 'u', 's',
15
+ 'code', 'pre', 'blockquote',
16
+ 'ul', 'ol', 'li',
17
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
18
+ 'a', 'hr', 'table', 'thead', 'tbody', 'tr', 'th', 'td',
19
+ ],
20
+ ALLOWED_ATTR: ['href', 'title', 'target', 'rel', 'class', 'id'],
21
+ });
13
22
  } catch {}
14
23
 
15
24
  const dangerouslySetInnerHTML = html ? { __html: html } : null;
@@ -48,7 +48,7 @@ const dstu2DTO = fhirResource => {
48
48
  _get(fhirResource, 'payee.person');
49
49
  const careTeam = [];
50
50
  const priorityCoding = _get(fhirResource, 'priority');
51
- const diagnosis = _get(fhirResource, 'diagnosis', []).map(diagnosis => {
51
+ const diagnosis = _get(fhirResource, 'diagnosis', [])?.map(diagnosis => {
52
52
  const coding = _get(diagnosis, 'diagnosis');
53
53
  const reference = null;
54
54
  const typeCoding = null;
@@ -61,7 +61,7 @@ const dstu2DTO = fhirResource => {
61
61
  accidentCoding || accidentDate
62
62
  ? { coding: accidentCoding, date: accidentDate }
63
63
  : null;
64
- const insurance = _get(fhirResource, 'coverage', []).map(insurance => {
64
+ const insurance = _get(fhirResource, 'coverage', [])?.map(insurance => {
65
65
  const focal = insurance.focal;
66
66
  const coverage = insurance.coverage;
67
67
  const businessArrangement = insurance.businessArrangement;
@@ -82,13 +82,13 @@ const dstu2DTO = fhirResource => {
82
82
  if (level === 0) subItemProperty = 'detail';
83
83
  else if (level === 1) subItemProperty = 'subDetail';
84
84
  const subItems = subItemProperty
85
- ? _get(item, subItemProperty, []).map(subItem =>
85
+ ? _get(item, subItemProperty, [])?.map(subItem =>
86
86
  mapItem(subItem, level + 1),
87
87
  )
88
88
  : [];
89
89
  return { sequence, service, quantity, factor, unitPrice, net, subItems };
90
90
  }
91
- const items = _get(fhirResource, 'item').map(item => mapItem(item, 0));
91
+ const items = _get(fhirResource, 'item')?.map(item => mapItem(item, 0));
92
92
  return {
93
93
  status,
94
94
  typeCoding,
@@ -112,14 +112,14 @@ const stu3DTO = fhirResource => {
112
112
  const insurer = _get(fhirResource, 'insurer');
113
113
  const payeeCoding = _get(fhirResource, 'payee.type.coding[0]');
114
114
  const payeeParty = _get(fhirResource, 'payee.party');
115
- const careTeam = _get(fhirResource, 'careTeam', []).map(team => {
115
+ const careTeam = _get(fhirResource, 'careTeam', [])?.map(team => {
116
116
  const provider = team.provider;
117
117
  const role = _get(team, 'role.coding[0]');
118
118
  const qualification = _get(team, 'role.coding[0]');
119
119
  return { provider, role, qualification };
120
120
  });
121
121
  const priorityCoding = _get(fhirResource, 'priority.coding[0]');
122
- const diagnosis = _get(fhirResource, 'diagnosis', []).map(diagnosis => {
122
+ const diagnosis = _get(fhirResource, 'diagnosis', [])?.map(diagnosis => {
123
123
  const coding = _get(diagnosis, 'diagnosisCodeableConcept.coding[0]');
124
124
  const reference = _get(diagnosis, 'diagnosisReference');
125
125
  const typeCoding = _get(diagnosis, 'type[0].coding[0]');
@@ -132,7 +132,7 @@ const stu3DTO = fhirResource => {
132
132
  accidentCoding || accidentDate
133
133
  ? { coding: accidentCoding, date: accidentDate }
134
134
  : null;
135
- const insurance = _get(fhirResource, 'insurance', []).map(insurance => {
135
+ const insurance = _get(fhirResource, 'insurance', [])?.map(insurance => {
136
136
  const focal = insurance.focal;
137
137
  const coverage = insurance.coverage;
138
138
  const businessArrangement = insurance.businessArrangement;
@@ -166,13 +166,13 @@ const stu3DTO = fhirResource => {
166
166
  if (level === 0) subItemProperty = 'detail';
167
167
  else if (level === 1) subItemProperty = 'subDetail';
168
168
  const subItems = subItemProperty
169
- ? _get(item, subItemProperty, []).map(subItem =>
169
+ ? _get(item, subItemProperty, [])?.map(subItem =>
170
170
  mapItem(subItem, level + 1),
171
171
  )
172
172
  : [];
173
173
  return { sequence, service, quantity, factor, unitPrice, net, subItems };
174
174
  }
175
- const items = _get(fhirResource, 'item').map(item => mapItem(item, 0));
175
+ const items = _get(fhirResource, 'item')?.map(item => mapItem(item, 0));
176
176
  return {
177
177
  status,
178
178
  typeCoding,
@@ -196,14 +196,14 @@ const r4DTO = fhirResource => {
196
196
  const insurer = _get(fhirResource, 'insurer');
197
197
  const payeeCoding = _get(fhirResource, 'payee.type.coding[0]');
198
198
  const payeeParty = _get(fhirResource, 'payee.party');
199
- const careTeam = _get(fhirResource, 'careTeam', []).map(team => {
199
+ const careTeam = _get(fhirResource, 'careTeam', [])?.map(team => {
200
200
  const provider = team.provider;
201
201
  const role = _get(team, 'role.coding[0]');
202
202
  const qualification = _get(team, 'role.coding[0]');
203
203
  return { provider, role, qualification };
204
204
  });
205
205
  const priorityCoding = _get(fhirResource, 'priority.coding[0]');
206
- const diagnosis = _get(fhirResource, 'diagnosis', []).map(diagnosis => {
206
+ const diagnosis = _get(fhirResource, 'diagnosis', [])?.map(diagnosis => {
207
207
  const coding = _get(diagnosis, 'diagnosisCodeableConcept.coding[0]');
208
208
  const reference = _get(diagnosis, 'diagnosisReference');
209
209
  const typeCoding = _get(diagnosis, 'type[0].coding[0]');
@@ -216,7 +216,7 @@ const r4DTO = fhirResource => {
216
216
  accidentCoding || accidentDate
217
217
  ? { coding: accidentCoding, date: accidentDate }
218
218
  : null;
219
- const insurance = _get(fhirResource, 'insurance', []).map(insurance => {
219
+ const insurance = _get(fhirResource, 'insurance', [])?.map(insurance => {
220
220
  const focal = insurance.focal;
221
221
  const coverage = insurance.coverage;
222
222
  const businessArrangement = insurance.businessArrangement;
@@ -250,13 +250,13 @@ const r4DTO = fhirResource => {
250
250
  if (level === 0) subItemProperty = 'detail';
251
251
  else if (level === 1) subItemProperty = 'subDetail';
252
252
  const subItems = subItemProperty
253
- ? _get(item, subItemProperty, []).map(subItem =>
253
+ ? _get(item, subItemProperty, [])?.map(subItem =>
254
254
  mapItem(subItem, level + 1),
255
255
  )
256
256
  : [];
257
257
  return { sequence, service, quantity, factor, unitPrice, net, subItems };
258
258
  }
259
- const items = _get(fhirResource, 'item').map(item => mapItem(item, 0));
259
+ const items = _get(fhirResource, 'item')?.map(item => mapItem(item, 0));
260
260
  return {
261
261
  status,
262
262
  typeCoding,
@@ -13,8 +13,7 @@ const Group = ({ data, prepareItems, isChild = false }) => {
13
13
  return data.map(prepareItems).map((item, i) => {
14
14
  const title =
15
15
  _get(item, 'title') ||
16
- _get(item, 'text') ||
17
- _get(item, '_linkId.fhir_comments.0');
16
+ _get(item, 'text');
18
17
 
19
18
  return (
20
19
  <ul
package/webpack.config.js CHANGED
@@ -1,10 +1,11 @@
1
1
  const path = require('path');
2
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
3
3
  const CopyWebpackPlugin = require('copy-webpack-plugin');
4
+ const nodeExternals = require('webpack-node-externals');
4
5
 
5
6
  module.exports = {
6
7
  mode: process.env.NODE_ENV ?? 'production',
7
- entry: ['./src/index.js'],
8
+ entry: './src/index.js',
8
9
  output: {
9
10
  path: path.resolve(__dirname, 'build'),
10
11
  filename: 'index.js',
@@ -48,6 +49,23 @@ module.exports = {
48
49
  },
49
50
  ],
50
51
  },
52
+ externals: [
53
+ nodeExternals({
54
+ allowlist: [
55
+ /^@nivo/,
56
+ /^lodash/,
57
+ /^bootstrap/,
58
+ '@popperjs/core',
59
+ 'dompurify',
60
+ 'marked',
61
+ 'md5',
62
+ 'pretty-bytes',
63
+ 'prop-types',
64
+ 'svg-url-loader',
65
+ 'd3-shape',
66
+ ],
67
+ }),
68
+ ],
51
69
  plugins: [
52
70
  new MiniCssExtractPlugin({
53
71
  filename: 'style.css',