@shelf/global-renderer 0.32.21 → 1.0.0-beta.0

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 (51) hide show
  1. package/CHANGELOG.md +2366 -44
  2. package/lib/DecisionTreeContent/DecisionTreeContent.js +84 -0
  3. package/lib/DecisionTreeContent/DecisionTreeContent.styled.js +225 -0
  4. package/lib/DecisionTreeContent/components/Condition.js +73 -0
  5. package/lib/DecisionTreeContent/components/ContentTable.js +26 -0
  6. package/lib/DecisionTreeContent/components/ExportedMeta.js +29 -0
  7. package/lib/DecisionTreeContent/components/Link.js +18 -0
  8. package/lib/DecisionTreeContent/components/Question.js +55 -0
  9. package/lib/DecisionTreeContent/components/Solution.js +20 -0
  10. package/lib/DecisionTreeContent/components/StepHeader.js +46 -0
  11. package/lib/DecisionTreeContent/components/StepTypeIcon.js +30 -0
  12. package/lib/DecisionTreeContent/helpers.d.ts +3 -3
  13. package/lib/DecisionTreeContent/helpers.js +56 -0
  14. package/lib/DecisionTreeContent/renderDTContent.js +12 -0
  15. package/lib/DecisionTreeDiagram/StaticTreeContainer.js +27 -0
  16. package/lib/DecisionTreeDiagram/renderStaticDTDiagram.js +26 -0
  17. package/lib/_virtual/_commonjsHelpers.js +4 -0
  18. package/lib/_virtual/advancedFormat.js +4 -0
  19. package/lib/_virtual/client.js +4 -0
  20. package/lib/_virtual/dayjs.min.js +4 -0
  21. package/lib/_virtual/index.js +4 -0
  22. package/lib/_virtual/index2.js +4 -0
  23. package/lib/_virtual/localeData.js +4 -0
  24. package/lib/_virtual/localizedFormat.js +4 -0
  25. package/lib/_virtual/react-dom.development.js +4 -0
  26. package/lib/_virtual/react-dom.production.min.js +4 -0
  27. package/lib/_virtual/scheduler.development.js +4 -0
  28. package/lib/_virtual/scheduler.production.min.js +4 -0
  29. package/lib/i18next/index.js +18 -0
  30. package/lib/index.d.ts +3 -0
  31. package/lib/index.js +6 -0
  32. package/lib/node_modules/@shelf/datetime/lib/getDateFormatTemplates.js +15 -0
  33. package/lib/node_modules/@shelf/datetime/lib/getDateWithCustomFormat.js +10 -0
  34. package/lib/node_modules/@shelf/datetime/lib/getTimeFormatTemplates.js +17 -0
  35. package/lib/node_modules/@shelf/datetime/lib/isDate.js +4 -0
  36. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/dayjs.min.js +295 -0
  37. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/advancedFormat.js +54 -0
  38. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/localeData.js +82 -0
  39. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/localizedFormat.js +28 -0
  40. package/lib/node_modules/react-dom/cjs/react-dom.development.js +12880 -0
  41. package/lib/node_modules/react-dom/cjs/react-dom.production.min.js +5643 -0
  42. package/lib/node_modules/react-dom/client.js +28 -0
  43. package/lib/node_modules/react-dom/index.js +17 -0
  44. package/lib/node_modules/scheduler/cjs/scheduler.development.js +278 -0
  45. package/lib/node_modules/scheduler/cjs/scheduler.production.min.js +231 -0
  46. package/lib/node_modules/scheduler/index.js +12 -0
  47. package/package.json +14 -12
  48. package/lib/renderDTContent.js +0 -2
  49. package/lib/renderDTContent.js.LICENSE.txt +0 -57
  50. package/lib/renderStaticDTDiagram.js +0 -2
  51. package/lib/renderStaticDTDiagram.js.LICENSE.txt +0 -63
@@ -0,0 +1,84 @@
1
+ import { DecisionTree as a } from "@shelf/icons";
2
+ import { colors as u } from "@shelf/client-helpers";
3
+ import { I18nextProvider as D } from "react-i18next";
4
+ import { isEmpty as s } from "lodash";
5
+ import { DTContentContainer as C, DTMeta as x, DTIcon as F, DTInternalMeta as S, DTTitle as y, DTDescription as I, CustomFields as M, CustomField as j, FieldName as k, FieldValue as E, DTContent as L } from "./DecisionTreeContent.styled.js";
6
+ import R from "../i18next/index.js";
7
+ import { convertStepToRenderFormat as $ } from "./helpers.js";
8
+ import v from "./components/Question.js";
9
+ import w from "./components/Condition.js";
10
+ import z from "./components/Solution.js";
11
+ import N from "./components/Link.js";
12
+ import P from "./components/ContentTable.js";
13
+ import Q from "./components/ExportedMeta.js";
14
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
15
+ const V = ({
16
+ step: r,
17
+ variables: t
18
+ }) => r.type === "Link" ? /* @__PURE__ */ o(N, {
19
+ step: r
20
+ }) : r.type === "Solution" ? /* @__PURE__ */ o(z, {
21
+ step: r
22
+ }) : r.type === "Condition" ? /* @__PURE__ */ o(w, {
23
+ step: r,
24
+ variables: t
25
+ }) : /* @__PURE__ */ o(v, {
26
+ step: r,
27
+ variables: t
28
+ }), b = ({
29
+ title: r,
30
+ description: t,
31
+ tree: d,
32
+ exportedBy: l,
33
+ exportedAt: p,
34
+ createdBy: f,
35
+ fields: m,
36
+ variables: T
37
+ }) => {
38
+ const c = $(d);
39
+ return /* @__PURE__ */ o(D, {
40
+ i18n: R,
41
+ children: /* @__PURE__ */ e(C, {
42
+ id: "dt-content-container",
43
+ children: [/* @__PURE__ */ o(Q, {
44
+ exportedBy: l,
45
+ exportedAt: p,
46
+ createdBy: f
47
+ }), /* @__PURE__ */ e(x, {
48
+ children: [/* @__PURE__ */ o(F, {
49
+ children: /* @__PURE__ */ o(a, {
50
+ iconSize: 20,
51
+ color: u.$white
52
+ })
53
+ }), /* @__PURE__ */ e(S, {
54
+ children: [/* @__PURE__ */ o(y, {
55
+ children: r
56
+ }), /* @__PURE__ */ o(I, {
57
+ children: t
58
+ })]
59
+ })]
60
+ }), !s(m) && /* @__PURE__ */ o(M, {
61
+ children: m?.map(({
62
+ name: n,
63
+ value: i
64
+ }, h) => /* @__PURE__ */ e(j, {
65
+ children: [/* @__PURE__ */ e(k, {
66
+ children: [n, ": "]
67
+ }), /* @__PURE__ */ o(E, {
68
+ children: i
69
+ })]
70
+ }, h))
71
+ }), /* @__PURE__ */ o(P, {
72
+ tree: c
73
+ }), /* @__PURE__ */ o(L, {
74
+ children: c.map((n, i) => /* @__PURE__ */ o(V, {
75
+ step: n,
76
+ variables: T
77
+ }, i))
78
+ })]
79
+ })
80
+ });
81
+ }, _ = b;
82
+ export {
83
+ _ as default
84
+ };
@@ -0,0 +1,225 @@
1
+ import t from "styled-components";
2
+ import { colors as i } from "@shelf/client-helpers";
3
+ const d = t.div`
4
+ margin: 0;
5
+ font-family: 'Open Sans', Arial, sans-serif;
6
+ color: ${i.$dark};
7
+ font-size: 14px;
8
+ `, a = t.div`
9
+ display: flex;
10
+ `, p = t.div`
11
+ min-width: 40px;
12
+ width: 40px;
13
+ height: 40px;
14
+ background-color: ${i.$colorDecisionTree};
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ margin-right: 10px;
19
+ `, r = t.div`
20
+ display: flex;
21
+ flex-direction: column;
22
+ `, s = t.div`
23
+ font-size: 20px;
24
+ line-height: 1.25;
25
+ padding: 0 5px 5px;
26
+ `, l = t.div`
27
+ font-size: 14px;
28
+ padding: 0 0 10px 5px;
29
+ `, c = t.div`
30
+ float: right;
31
+ max-width: 100%;
32
+ width: 100%;
33
+ `, x = t.div`
34
+ padding-top: 20px;
35
+ `, g = t.div`
36
+ font-size: 14px;
37
+ font-weight: 700;
38
+ display: flex;
39
+ justify-content: center;
40
+ `, h = t.div`
41
+ display: flex;
42
+ padding: 10px 0;
43
+ `, m = t.div`
44
+ page-break-inside: avoid;
45
+ `, v = t.div`
46
+ display: flex;
47
+ width: 20%;
48
+ `, f = t.div`
49
+ width: 20px;
50
+ height: 20px;
51
+ min-width: 20px;
52
+ background-color: ${(e) => e.color || i.$catchyBlue};
53
+ border-radius: 5px;
54
+ `, b = t.div`
55
+ line-height: 20px;
56
+ font-weight: 700;
57
+ padding-left: 10px;
58
+ margin-bottom: 10px;
59
+ margin-right: 50px;
60
+ `, u = t.div`
61
+ font-size: 20px;
62
+ padding-bottom: 10px;
63
+ page-break-inside: avoid;
64
+ `, w = t.div`
65
+ font-size: 14px;
66
+ `, k = t.div`
67
+ background-color: ${i.$greyBlue};
68
+ border-left: 1px solid ${i.$deepBlue};
69
+ padding: 20px 15px 15px;
70
+ margin: 10px 0;
71
+ `, $ = t.div`
72
+ font-weight: bold;
73
+ padding-bottom: 15px;
74
+ line-height: 20px;
75
+ `, y = t.div`
76
+ padding-bottom: 10px;
77
+ `, T = t.div`
78
+ display: flex;
79
+ page-break-inside: avoid;
80
+ padding-bottom: 5px;
81
+ `, C = t.div`
82
+ background-color: ${i.$white};
83
+ padding: 10px 10px 5px;
84
+ border-radius: 5px;
85
+ margin-bottom: 10px;
86
+ line-height: 20px;
87
+ page-break-inside: avoid;
88
+ `, B = t.div`
89
+ padding-right: 5px;
90
+ `, D = t.div`
91
+ display: flex;
92
+ padding-right: 5px;
93
+ align-items: center;
94
+ `, L = t.img`
95
+ width: 14px;
96
+ height: 14px;
97
+ `, S = t.a`
98
+ text-decoration: none;
99
+ color: ${i.$deepBlue};
100
+ page-break-inside: avoid;
101
+ max-width: 90%;
102
+ word-wrap: break-word;
103
+ `, A = t.span`
104
+ ${({
105
+ isDeleted: e
106
+ }) => e ? "text-decoration: line-through" : ""}
107
+ `, I = t.div``, z = t.div`
108
+ padding-bottom: 5px;
109
+ &:last-child {
110
+ padding-bottom: 0;
111
+ }
112
+ `, N = t.a`
113
+ color: ${i.$greyThemeText};
114
+ margin-right: 0;
115
+ margin-left: auto;
116
+ text-decoration: none;
117
+ `, F = t.div`
118
+ color: ${i.$deepBlue};
119
+ margin-right: 0;
120
+ margin-left: auto;
121
+ word-break: break-all;
122
+ align-items: flex-end;
123
+ max-width: 80%;
124
+ `, M = t.a`
125
+ padding: 0 5px;
126
+ text-decoration: none;
127
+ color: ${i.$deepBlue};
128
+ line-height: 20px;
129
+ `, Q = t.a`
130
+ text-decoration: none;
131
+ color: ${i.$deepBlue};
132
+ page-break-inside: avoid;
133
+ word-break: break-all;
134
+ `, j = t.div`
135
+ color: ${i.$dark};
136
+ line-height: 20px;
137
+ margin-right: 0;
138
+ margin-left: auto;
139
+ `, H = t.div`
140
+ display: flex;
141
+ flex-direction: column;
142
+ padding-bottom: 15px;
143
+ float: left;
144
+ max-width: 100%;
145
+ width: 100%;
146
+ margin-top: 10px;
147
+ `, P = t.div`
148
+ line-height: 20px;
149
+ padding-bottom: 5px;
150
+ display: flex;
151
+ page-break-inside: avoid;
152
+ `, V = t.a`
153
+ text-decoration: none;
154
+ color: ${i.$deepBlue};
155
+ line-height: 20px;
156
+ `, O = t.div`
157
+ margin-right: 5px;
158
+ `, R = t.div`
159
+ min-height: 19px;
160
+ min-width: 20px;
161
+ line-height: 20px;
162
+ `, U = t.div`
163
+ padding-bottom: 25px;
164
+ `, W = t.div`
165
+ line-height: 20px;
166
+ padding-bottom: 5px;
167
+ page-break-inside: avoid;
168
+ `, q = t.div`
169
+ margin-bottom: 5px;
170
+ margin-left: 55px;
171
+ `, E = t.div`
172
+ line-height: 24px;
173
+ display: flex;
174
+ padding-bottom: 5px;
175
+ `, G = t.div`
176
+ font-weight: 700;
177
+ `, J = t.div`
178
+ padding-left: 5px;
179
+ `;
180
+ export {
181
+ T as Answer,
182
+ B as AnswerNumber,
183
+ S as AnswerTitle,
184
+ A as AnswerVariable,
185
+ C as AnswerWithAssignments,
186
+ L as AssignmentIcon,
187
+ D as AssignmentIconBlock,
188
+ I as Condition,
189
+ w as Content,
190
+ H as ContentList,
191
+ R as ContentListIcon,
192
+ P as ContentListItem,
193
+ V as ContentListLink,
194
+ O as ContentListNumber,
195
+ u as ContentTitle,
196
+ E as CustomField,
197
+ q as CustomFields,
198
+ c as DTContent,
199
+ d as DTContentContainer,
200
+ l as DTDescription,
201
+ p as DTIcon,
202
+ r as DTInternalMeta,
203
+ a as DTMeta,
204
+ s as DTTitle,
205
+ G as FieldName,
206
+ J as FieldValue,
207
+ Q as LinkUrl,
208
+ W as MataInfo,
209
+ U as MetaBlock,
210
+ j as NoLinks,
211
+ M as ParentLink,
212
+ k as Question,
213
+ y as QuestionDescription,
214
+ $ as QuestionTitle,
215
+ z as Rule,
216
+ x as StepContainer,
217
+ v as StepHeader,
218
+ m as StepHeaderBlock,
219
+ N as StepLink,
220
+ g as StepNumber,
221
+ F as StepParents,
222
+ f as StepType,
223
+ h as StepTypeContainer,
224
+ b as StepTypeTitle
225
+ };
@@ -0,0 +1,73 @@
1
+ import P from "./StepHeader.js";
2
+ import { StepContainer as A, ContentTitle as C, Question as N, AnswerWithAssignments as f, Answer as x, AnswerNumber as m, Condition as u, Rule as D, AnswerTitle as o, AnswerVariable as g, StepLink as v } from "../DecisionTreeContent.styled.js";
3
+ import i from "../../i18next/index.js";
4
+ import { jsxs as t, jsx as e, Fragment as j } from "react/jsx-runtime";
5
+ const I = ({
6
+ step: n,
7
+ variables: w
8
+ }) => {
9
+ const s = {
10
+ eq: "=",
11
+ neq: "\u2260",
12
+ contains: i.t("pdf-viewer.exportDTPDF.contains"),
13
+ not_contains: i.t("pdf-viewer.exportDTPDF.notContains")
14
+ }, a = [...n?.conditions || []];
15
+ return /* @__PURE__ */ t(A, {
16
+ children: [/* @__PURE__ */ e(P, {
17
+ step: n
18
+ }), /* @__PURE__ */ e(C, {
19
+ children: n.title
20
+ }), /* @__PURE__ */ t(N, {
21
+ children: [a?.map((r, S) => {
22
+ const l = r?.expression?.rules, $ = r?.expression?.joiner;
23
+ return l ? /* @__PURE__ */ e(f, {
24
+ children: /* @__PURE__ */ t(x, {
25
+ children: [/* @__PURE__ */ t(m, {
26
+ children: [S + 1, "."]
27
+ }), /* @__PURE__ */ e(u, {
28
+ children: l.map((d) => {
29
+ const p = w?.find((F) => F.id === d.variableId), c = p?.name, h = p?.isDeleted, b = d?.id === l[l.length - 1]?.id, T = h ? ` (${i.t("pdf-viewer.exportDTPDF.deleted")}) [${s[d.operator]}] ${d?.value}` : ` [${s[d.operator]}] ${d?.value}`;
30
+ return /* @__PURE__ */ t(j, {
31
+ children: [/* @__PURE__ */ e(D, {
32
+ children: c && /* @__PURE__ */ t(o, {
33
+ href: `#${r?.nextStep?.id}`,
34
+ children: [/* @__PURE__ */ e(g, {
35
+ isDeleted: h,
36
+ children: c
37
+ }), T]
38
+ })
39
+ }), $ && !b && /* @__PURE__ */ e(o, {
40
+ href: `#${r?.nextStep?.id}`,
41
+ children: i.t("pdf-viewer.exportDTPDF.andOperator")
42
+ })]
43
+ });
44
+ })
45
+ }), r?.nextStep?.number && /* @__PURE__ */ t(v, {
46
+ href: `#${r.nextStep?.id}`,
47
+ children: [i.t("pdf-viewer.exportDTPDF.step"), " ", r.nextStep.number]
48
+ })]
49
+ })
50
+ }, r.id) : null;
51
+ }), /* @__PURE__ */ e(f, {
52
+ children: /* @__PURE__ */ t(x, {
53
+ children: [/* @__PURE__ */ t(m, {
54
+ children: [a.length + 1, "."]
55
+ }), /* @__PURE__ */ e(u, {
56
+ children: /* @__PURE__ */ e(D, {
57
+ children: /* @__PURE__ */ e(o, {
58
+ href: `#${n?.defaultNextStep?.id}`,
59
+ children: i.t("pdf-viewer.exportDTPDF.default")
60
+ })
61
+ })
62
+ }), n?.defaultNextStep?.id && /* @__PURE__ */ t(v, {
63
+ href: `#${n.defaultNextStep?.id}`,
64
+ children: [i.t("pdf-viewer.exportDTPDF.step"), " ", n.defaultNextStep?.number]
65
+ })]
66
+ })
67
+ })]
68
+ })]
69
+ });
70
+ };
71
+ export {
72
+ I as default
73
+ };
@@ -0,0 +1,26 @@
1
+ import { isEmpty as r } from "lodash";
2
+ import { colors as i } from "@shelf/client-helpers";
3
+ import { ContentList as p, ContentListItem as s, ContentListNumber as l, ContentListIcon as c, ContentListLink as m } from "../DecisionTreeContent.styled.js";
4
+ import d from "./StepTypeIcon.js";
5
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
6
+ const a = ({
7
+ tree: n
8
+ }) => /* @__PURE__ */ o(p, {
9
+ children: !r(n) && n.map((t) => /* @__PURE__ */ e(s, {
10
+ children: [/* @__PURE__ */ e(l, {
11
+ children: [t.number, "."]
12
+ }), /* @__PURE__ */ o(c, {
13
+ children: /* @__PURE__ */ o(d, {
14
+ type: t.type,
15
+ iconSize: 12,
16
+ color: i.$deepBlue
17
+ })
18
+ }), /* @__PURE__ */ o(m, {
19
+ href: `#${t.id}`,
20
+ children: t.title || t?.question?.title
21
+ })]
22
+ }, t.id))
23
+ });
24
+ export {
25
+ a as default
26
+ };
@@ -0,0 +1,29 @@
1
+ import { MetaBlock as p, MataInfo as e } from "../DecisionTreeContent.styled.js";
2
+ import { getDateAndTime as n } from "../helpers.js";
3
+ import t from "../../i18next/index.js";
4
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
5
+ const c = ({
6
+ exportedAt: o,
7
+ exportedBy: a,
8
+ createdBy: i
9
+ }) => /* @__PURE__ */ f(p, {
10
+ children: [/* @__PURE__ */ r(e, {
11
+ children: t.t("pdf-viewer.exportDTPDF.exportedInfo", {
12
+ date: n(o),
13
+ exportedBy: a,
14
+ interpolation: {
15
+ escapeValue: !1
16
+ }
17
+ })
18
+ }), /* @__PURE__ */ r(e, {
19
+ children: t.t("pdf-viewer.exportDTPDF.createdInfo", {
20
+ createdBy: i,
21
+ interpolation: {
22
+ escapeValue: !1
23
+ }
24
+ })
25
+ })]
26
+ });
27
+ export {
28
+ c as default
29
+ };
@@ -0,0 +1,18 @@
1
+ import { StepContainer as i, ContentTitle as n, LinkUrl as t } from "../DecisionTreeContent.styled.js";
2
+ import l from "./StepHeader.js";
3
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
4
+ const u = ({
5
+ step: r
6
+ }) => /* @__PURE__ */ o(i, {
7
+ children: [/* @__PURE__ */ e(l, {
8
+ step: r
9
+ }), /* @__PURE__ */ e(n, {
10
+ children: r.title
11
+ }), r.url && /* @__PURE__ */ e(t, {
12
+ href: r.url,
13
+ children: r.url
14
+ })]
15
+ });
16
+ export {
17
+ u as default
18
+ };
@@ -0,0 +1,55 @@
1
+ import h from "./StepHeader.js";
2
+ import { StepContainer as V, ContentTitle as u, Content as g, Question as b, QuestionTitle as T, QuestionDescription as f, AnswerWithAssignments as x, Answer as o, AnswerNumber as D, AnswerTitle as s, StepLink as w, AssignmentIconBlock as M, AssignmentIcon as F, AnswerVariable as L } from "../DecisionTreeContent.styled.js";
3
+ import d from "../../i18next/index.js";
4
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
5
+ const S = "data:image/svg;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAMAAADyHTlpAAAAM1BMVEVHcEwqWJYrV5crVpcrV5crV5crV5cqV5grV5cuWJcrV5crVpUrV5crWJcqVpgrVpcrV5f4E2OkAAAAEHRSTlMAIbdw6Nb2T90Ph0KhyTVaZXFVxwAAAPZJREFUOMvFlMsWgyAMRAVRjID6/19bEqW8QTeaTUm54jCT4zB8XYerPvAMFRNWDaVNcaGyL1O+gLLZLsdwf7d/zKx0Ku1sntzw2b0sYLXrBRwJk23XmlZjG+4aHTYZCsLLHdFwqDtA8pRbBcILZrmzYIntKPl6KeT2R3ciALzaiocb6KXF8GpWqGD9YNU5curODGASf++bKF0+SK2B8lMA76P4+smkEkqopMEjG2QbpaGVpw0za6F+8EgHNFCM1fjb6TpKw8LygcxRFaW0hV2CMhEPXviOBDWp8dwrj1GdxUkR69e+LrdQsWDVKNoUzz/Fd9Gv6weN4h7TPdxgMQAAAABJRU5ErkJggg==", K = ({
6
+ step: n,
7
+ variables: a
8
+ }) => /* @__PURE__ */ r(V, {
9
+ children: [/* @__PURE__ */ e(h, {
10
+ step: n
11
+ }), /* @__PURE__ */ e(u, {
12
+ children: n.title
13
+ }), n.content && /* @__PURE__ */ e(g, {
14
+ className: "fr-view custom-theme",
15
+ dangerouslySetInnerHTML: {
16
+ __html: n.content
17
+ }
18
+ }), /* @__PURE__ */ r(b, {
19
+ children: [/* @__PURE__ */ e(T, {
20
+ children: n?.question?.title
21
+ }), /* @__PURE__ */ e(f, {
22
+ children: n?.question?.description
23
+ }), n?.question?.answers?.map((t, c) => /* @__PURE__ */ r(x, {
24
+ children: [/* @__PURE__ */ r(o, {
25
+ children: [/* @__PURE__ */ r(D, {
26
+ children: [c + 1, "."]
27
+ }), /* @__PURE__ */ e(s, {
28
+ href: `#${t.nextStep?.id}`,
29
+ children: t?.title
30
+ }), t?.nextStep?.number && /* @__PURE__ */ r(w, {
31
+ href: `#${t.nextStep?.id}`,
32
+ children: [d.t("pdf-viewer.exportDTPDF.step"), " ", t.nextStep.number]
33
+ })]
34
+ }), t?.assignments && t?.assignments.map((A, p) => {
35
+ const i = a?.find((m) => m.id === A.variableId), l = i?.isDeleted;
36
+ return i ? /* @__PURE__ */ r(o, {
37
+ children: [/* @__PURE__ */ e(M, {
38
+ children: /* @__PURE__ */ e(F, {
39
+ src: S
40
+ })
41
+ }), /* @__PURE__ */ r(s, {
42
+ href: `#${t.nextStep?.id}`,
43
+ children: [/* @__PURE__ */ e(L, {
44
+ isDeleted: l,
45
+ children: i?.name
46
+ }), l ? ` (${d.t("pdf-viewer.exportDTPDF.deleted")})` : "", " =", ` ${A.value}`]
47
+ })]
48
+ }, p) : null;
49
+ })]
50
+ }, c))]
51
+ })]
52
+ });
53
+ export {
54
+ K as default
55
+ };
@@ -0,0 +1,20 @@
1
+ import { StepContainer as n, ContentTitle as o, Content as r } from "../DecisionTreeContent.styled.js";
2
+ import i from "./StepHeader.js";
3
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
4
+ const s = ({
5
+ step: t
6
+ }) => /* @__PURE__ */ m(n, {
7
+ children: [/* @__PURE__ */ e(i, {
8
+ step: t
9
+ }), /* @__PURE__ */ e(o, {
10
+ children: t.title
11
+ }), t.content && /* @__PURE__ */ e(r, {
12
+ className: "fr-view custom-theme",
13
+ dangerouslySetInnerHTML: {
14
+ __html: t.content
15
+ }
16
+ })]
17
+ });
18
+ export {
19
+ s as default
20
+ };
@@ -0,0 +1,46 @@
1
+ import { toLower as c, get as a, isEmpty as m } from "lodash";
2
+ import { colors as i } from "@shelf/client-helpers";
3
+ import { StepHeaderBlock as h, StepNumber as S, StepTypeContainer as f, StepHeader as u, StepType as D, StepTypeTitle as T, NoLinks as x, StepParents as y, ParentLink as P } from "../DecisionTreeContent.styled.js";
4
+ import t from "../../i18next/index.js";
5
+ import { jsxs as r, jsx as o, Fragment as l } from "react/jsx-runtime";
6
+ const $ = {
7
+ question: i.$catchyBlue,
8
+ solution: i.$dark,
9
+ link: i.$yellow,
10
+ condition: i.$greenCheck
11
+ }, L = ({
12
+ step: e
13
+ }) => {
14
+ const n = c(e.type);
15
+ return /* @__PURE__ */ r(h, {
16
+ id: e.id,
17
+ children: [/* @__PURE__ */ r(S, {
18
+ children: [t.t("pdf-viewer.exportDTPDF.step"), " ", e.number, e.isFirstStep ? ` - ${t.t("pdf-viewer.exportDTPDF.startingPoint")}` : ""]
19
+ }), /* @__PURE__ */ r(f, {
20
+ children: [/* @__PURE__ */ r(u, {
21
+ children: [/* @__PURE__ */ o(D, {
22
+ color: e?.settings?.borderColor || a($, n)
23
+ }), /* @__PURE__ */ o(T, {
24
+ children: t.t(`pdf-viewer.exportDTPDF.${n}`)
25
+ })]
26
+ }), m(e.parentSteps) ? /* @__PURE__ */ o(x, {
27
+ children: t.t("pdf-viewer.exportDTPDF.noLinks")
28
+ }) : /* @__PURE__ */ r(y, {
29
+ children: [t.t("pdf-viewer.exportDTPDF.parentSteps"), ":", e.parentSteps.map((p, d) => {
30
+ const s = d === e.parentSteps.length - 1;
31
+ return /* @__PURE__ */ r(l, {
32
+ children: [/* @__PURE__ */ o(P, {
33
+ href: `#${p.id}`,
34
+ children: p.number
35
+ }, d), !s && /* @__PURE__ */ o(l, {
36
+ children: "|"
37
+ })]
38
+ });
39
+ })]
40
+ })]
41
+ })]
42
+ });
43
+ };
44
+ export {
45
+ L as default
46
+ };
@@ -0,0 +1,30 @@
1
+ import { Solution as o, Question as r, Link as u, Condition as i } from "@shelf/icons";
2
+ import { jsx as t, Fragment as a } from "react/jsx-runtime";
3
+ const s = ({
4
+ type: n,
5
+ ...e
6
+ }) => {
7
+ switch (n) {
8
+ case "Condition":
9
+ return /* @__PURE__ */ t(i, {
10
+ ...e
11
+ });
12
+ case "Link":
13
+ return /* @__PURE__ */ t(u, {
14
+ ...e
15
+ });
16
+ case "Question":
17
+ return /* @__PURE__ */ t(r, {
18
+ ...e
19
+ });
20
+ case "Solution":
21
+ return /* @__PURE__ */ t(o, {
22
+ ...e
23
+ });
24
+ default:
25
+ return /* @__PURE__ */ t(a, {});
26
+ }
27
+ }, d = s;
28
+ export {
29
+ d as default
30
+ };
@@ -6,7 +6,10 @@ export declare const getTreeWithParentSteps: (tree: Omit<DTStep, 'parentSteps'>[
6
6
  number: number;
7
7
  }[];
8
8
  number: number;
9
+ title?: string | undefined;
10
+ url?: string | undefined;
9
11
  id: string;
12
+ type?: import("@shelf/types-ddb/lib/decision-tree").StepType | undefined;
10
13
  question: {
11
14
  id: string;
12
15
  title?: string | undefined;
@@ -21,10 +24,7 @@ export declare const getTreeWithParentSteps: (tree: Omit<DTStep, 'parentSteps'>[
21
24
  assignments?: import("@shelf/types-ddb/lib/decision-tree").Assignment[] | undefined;
22
25
  }[];
23
26
  };
24
- title?: string | undefined;
25
- type?: import("@shelf/types-ddb/lib/decision-tree").StepType | undefined;
26
27
  textS3Key?: string | undefined;
27
- url?: string | undefined;
28
28
  settings?: import("@shelf/types-ddb/lib/decision-tree").StepSettings | undefined;
29
29
  defaultNextStep?: ({
30
30
  id: string;
@@ -0,0 +1,56 @@
1
+ import { isEmpty as d, mapKeys as c, compact as x, uniq as l, sortBy as f } from "lodash";
2
+ import b from "../node_modules/@shelf/datetime/lib/getDateWithCustomFormat.js";
3
+ import T from "../node_modules/@shelf/datetime/lib/getDateFormatTemplates.js";
4
+ import y from "../node_modules/@shelf/datetime/lib/getTimeFormatTemplates.js";
5
+ const g = ["Question", "Condition"], F = (r) => r.map((o) => {
6
+ const m = r.filter(
7
+ (n) => n.linkedSteps?.map((i) => i.id).includes(o.id)
8
+ ), s = l(m.map(({ id: n, number: i }) => ({ id: n, number: i })));
9
+ return {
10
+ ...o,
11
+ parentSteps: f(s, "number")
12
+ };
13
+ }), C = (r) => {
14
+ if (d(r))
15
+ return [];
16
+ const o = r.find(({ isFirstStep: t }) => !!t), s = (o ? [o, ...r.filter(({ isFirstStep: t }) => !t)] : [...r]).map((t, p) => ({
17
+ ...t,
18
+ number: p + 1
19
+ })), n = c(s, "id"), i = s.map((t) => {
20
+ const p = t?.question?.answers, a = t?.conditions;
21
+ if (!g.includes(t?.type) || d(p) && d(a))
22
+ return t;
23
+ const u = p?.map((e) => ({
24
+ ...e,
25
+ nextStep: e?.nextStep?.id && n[e.nextStep.id] ? { ...e.nextStep, number: n[e.nextStep.id]?.number } : e.nextStep
26
+ })), S = a?.map((e) => ({
27
+ ...e,
28
+ nextStep: e?.nextStep?.id && n[e.nextStep.id] ? { ...e.nextStep, number: n[e.nextStep.id]?.number } : e.nextStep
29
+ }));
30
+ return {
31
+ ...t,
32
+ question: { ...t.question, answers: u },
33
+ linkedSteps: x(u?.map((e) => e.nextStep)),
34
+ ...a ? { conditions: S } : {},
35
+ ...t.defaultNextStep && n[t.defaultNextStep?.id] ? {
36
+ defaultNextStep: {
37
+ ...t.defaultNextStep,
38
+ number: n[t.defaultNextStep.id]?.number
39
+ }
40
+ } : {}
41
+ };
42
+ });
43
+ return F(i);
44
+ }, D = (r) => {
45
+ const o = T()?.medium ?? "MMM d, yyyy", m = y()?.short ?? "h:m a";
46
+ return b({
47
+ date: r,
48
+ dateFormat: `${o} ${m}`
49
+ });
50
+ };
51
+ export {
52
+ g as TYPES_TO_LINK,
53
+ C as convertStepToRenderFormat,
54
+ D as getDateAndTime,
55
+ F as getTreeWithParentSteps
56
+ };