@shelf/global-renderer 1.9.12 → 2.0.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.
- package/README.md +20 -0
- package/lib/DecisionTreeContent/DecisionTreeContent.d.ts +4 -0
- package/lib/DecisionTreeContent/DecisionTreeContent.styled.d.ts +49 -0
- package/lib/DecisionTreeContent/components/Condition.d.ts +8 -0
- package/lib/DecisionTreeContent/components/ContentTable.d.ts +6 -0
- package/lib/DecisionTreeContent/components/ExportedMeta.d.ts +7 -0
- package/lib/DecisionTreeContent/components/Link.d.ts +6 -0
- package/lib/DecisionTreeContent/components/Question.d.ts +8 -0
- package/lib/DecisionTreeContent/components/Solution.d.ts +6 -0
- package/lib/DecisionTreeContent/components/StepHeader.d.ts +6 -0
- package/lib/DecisionTreeContent/components/StepTypeIcon.d.ts +7 -0
- package/lib/DecisionTreeContent/helpers.d.ts +44 -0
- package/lib/DecisionTreeContent/mocks.d.ts +314 -0
- package/lib/DecisionTreeContent/renderDTContent.d.ts +2 -0
- package/lib/DecisionTreeContent/types.d.ts +61 -0
- package/lib/DecisionTreeDiagram/StaticTreeContainer.d.ts +7 -0
- package/lib/DecisionTreeDiagram/renderStaticDTDiagram.d.ts +8 -0
- package/lib/i18next/index.d.ts +3 -0
- package/lib/index.d.ts +1 -0
- package/lib/renderDTContent.js +5 -5
- package/lib/renderStaticDTDiagram.js +269 -269
- package/license +9 -0
- package/package.json +33 -19
- package/CHANGELOG.md +0 -402
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
> @shelf/global-renderer
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$ yarn add @shelf/global-renderer
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Publish
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ git checkout master
|
|
13
|
+
$ yarn version
|
|
14
|
+
$ yarn publish
|
|
15
|
+
$ git push origin master --tags
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
MIT © [Shelf](https://shelf.io)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderDTContentData } from './types';
|
|
3
|
+
declare const DecisionTreeContent: ({ title, description, tree, exportedBy, exportedAt, createdBy, fields, variables, }: RenderDTContentData) => React.JSX.Element;
|
|
4
|
+
export default DecisionTreeContent;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DTContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const DTMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const DTIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const DTInternalMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const DTTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const DTDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const DTContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
+
export declare const StepContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
+
export declare const StepNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const StepTypeContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
+
export declare const StepHeaderBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
+
export declare const StepHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
14
|
+
export declare const StepType: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
+
$color?: string | undefined;
|
|
16
|
+
}>> & string;
|
|
17
|
+
export declare const StepTypeTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
|
+
export declare const ContentTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
+
export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
20
|
+
export declare const Question: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
|
+
export declare const QuestionTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
22
|
+
export declare const QuestionDescription: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
23
|
+
export declare const Answer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
24
|
+
export declare const AnswerWithAssignments: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
25
|
+
export declare const AnswerNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
26
|
+
export declare const AssignmentIconBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
27
|
+
export declare const AssignmentIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
|
|
28
|
+
export declare const AnswerTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
29
|
+
export declare const AnswerVariable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
30
|
+
isDeleted?: boolean | undefined;
|
|
31
|
+
}>> & string;
|
|
32
|
+
export declare const Condition: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
33
|
+
export declare const Rule: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
34
|
+
export declare const StepLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
35
|
+
export declare const StepParents: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
36
|
+
export declare const ParentLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
37
|
+
export declare const LinkUrl: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
38
|
+
export declare const NoLinks: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
39
|
+
export declare const ContentList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
40
|
+
export declare const ContentListItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
41
|
+
export declare const ContentListLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
42
|
+
export declare const ContentListNumber: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
43
|
+
export declare const ContentListIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
44
|
+
export declare const MetaBlock: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
45
|
+
export declare const MataInfo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
46
|
+
export declare const CustomFields: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
47
|
+
export declare const CustomField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
48
|
+
export declare const FieldName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
49
|
+
export declare const FieldValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DecisionTree } from '@shelf/types-ddb';
|
|
3
|
+
import { DTStep } from '../types';
|
|
4
|
+
declare const _default: ({ step, variables, }: {
|
|
5
|
+
step: DTStep;
|
|
6
|
+
variables: Pick<DecisionTree.ContextualVariableDefaults, 'name' | 'id' | 'isDeleted'>[];
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DecisionTree } from '@shelf/types-ddb';
|
|
3
|
+
import { DTStep } from '../types';
|
|
4
|
+
declare const _default: ({ step, variables, }: {
|
|
5
|
+
step: DTStep;
|
|
6
|
+
variables: Pick<DecisionTree.ContextualVariableDefaults, 'name' | 'id' | 'isDeleted'>[];
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DTStep, DTStepFromApi } from './types';
|
|
2
|
+
export declare const TYPES_TO_LINK: string[];
|
|
3
|
+
export declare const getTreeWithParentSteps: (tree: Omit<DTStep, 'parentSteps'>[]) => {
|
|
4
|
+
parentSteps: {
|
|
5
|
+
id: string;
|
|
6
|
+
number: number;
|
|
7
|
+
}[];
|
|
8
|
+
number: number;
|
|
9
|
+
id: string;
|
|
10
|
+
question: {
|
|
11
|
+
id: string;
|
|
12
|
+
title?: string | undefined;
|
|
13
|
+
description?: string | undefined;
|
|
14
|
+
answers: {
|
|
15
|
+
id: string;
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
nextStep?: {
|
|
18
|
+
id?: string | undefined;
|
|
19
|
+
number?: number | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
assignments?: import("@shelf/types-ddb/lib/decision-tree").Assignment[] | undefined;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
type: import("@shelf/types-ddb/lib/decision-tree").StepType;
|
|
25
|
+
title?: string | undefined;
|
|
26
|
+
textS3Key?: string | undefined;
|
|
27
|
+
url?: string | undefined;
|
|
28
|
+
settings?: import("@shelf/types-ddb/lib/decision-tree").StepSettings | undefined;
|
|
29
|
+
defaultNextStep?: ({
|
|
30
|
+
id: string;
|
|
31
|
+
} & {
|
|
32
|
+
id: string;
|
|
33
|
+
number?: string | undefined;
|
|
34
|
+
}) | undefined;
|
|
35
|
+
conditions?: (import("@shelf/types-ddb/lib/decision-tree").Condition[] & import("./types").ConditionType[]) | undefined;
|
|
36
|
+
isFirstStep?: boolean | undefined;
|
|
37
|
+
content?: string | undefined;
|
|
38
|
+
linkedSteps?: {
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
number?: number | undefined;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
}[];
|
|
43
|
+
export declare const convertStepToRenderFormat: (tree: DTStepFromApi[]) => DTStep[];
|
|
44
|
+
export declare const getDateAndTime: (date: string) => string;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
export declare const dtData: {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
exportedAt: string;
|
|
5
|
+
language: string;
|
|
6
|
+
exportedBy: string;
|
|
7
|
+
createdBy: string;
|
|
8
|
+
fields: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[];
|
|
12
|
+
tree: ({
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
settings: {
|
|
17
|
+
position: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
borderColor?: undefined;
|
|
22
|
+
};
|
|
23
|
+
defaultNextStep: {
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
conditions: ({
|
|
27
|
+
id: string;
|
|
28
|
+
nextStep: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
expression: {
|
|
32
|
+
joiner: string;
|
|
33
|
+
rules: {
|
|
34
|
+
id: string;
|
|
35
|
+
variableId: string;
|
|
36
|
+
value: string;
|
|
37
|
+
operator: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
} | {
|
|
41
|
+
id: string;
|
|
42
|
+
expression: {
|
|
43
|
+
rules: {
|
|
44
|
+
id: string;
|
|
45
|
+
variableId: string;
|
|
46
|
+
value: string;
|
|
47
|
+
operator: string;
|
|
48
|
+
}[];
|
|
49
|
+
joiner?: undefined;
|
|
50
|
+
};
|
|
51
|
+
nextStep?: undefined;
|
|
52
|
+
})[];
|
|
53
|
+
content?: undefined;
|
|
54
|
+
url?: undefined;
|
|
55
|
+
question?: undefined;
|
|
56
|
+
isFirstStep?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
type: string;
|
|
61
|
+
content: string;
|
|
62
|
+
url: null;
|
|
63
|
+
settings: {
|
|
64
|
+
borderColor: string;
|
|
65
|
+
position: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
question: {
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
description: string;
|
|
74
|
+
answers: ({
|
|
75
|
+
title: string;
|
|
76
|
+
id: string;
|
|
77
|
+
nextStep: {
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
80
|
+
assignments?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
title: string;
|
|
83
|
+
id: string;
|
|
84
|
+
nextStep: {
|
|
85
|
+
id: string;
|
|
86
|
+
};
|
|
87
|
+
assignments: {
|
|
88
|
+
variableId: string;
|
|
89
|
+
value: string;
|
|
90
|
+
}[];
|
|
91
|
+
})[];
|
|
92
|
+
};
|
|
93
|
+
defaultNextStep?: undefined;
|
|
94
|
+
conditions?: undefined;
|
|
95
|
+
isFirstStep?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
id: string;
|
|
98
|
+
title: string;
|
|
99
|
+
type: string;
|
|
100
|
+
url: string;
|
|
101
|
+
settings: {
|
|
102
|
+
borderColor: null;
|
|
103
|
+
position: {
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
question: null;
|
|
109
|
+
defaultNextStep?: undefined;
|
|
110
|
+
conditions?: undefined;
|
|
111
|
+
content?: undefined;
|
|
112
|
+
isFirstStep?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
id: string;
|
|
115
|
+
isFirstStep: boolean;
|
|
116
|
+
title: string;
|
|
117
|
+
type: string;
|
|
118
|
+
url: null;
|
|
119
|
+
content: string;
|
|
120
|
+
settings: {
|
|
121
|
+
borderColor: string;
|
|
122
|
+
position: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
question: {
|
|
128
|
+
title: string;
|
|
129
|
+
description: string;
|
|
130
|
+
answers: ({
|
|
131
|
+
title: string;
|
|
132
|
+
id: string;
|
|
133
|
+
nextStep: null;
|
|
134
|
+
assignments?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
title: string;
|
|
137
|
+
id: string;
|
|
138
|
+
nextStep: {
|
|
139
|
+
id: string;
|
|
140
|
+
};
|
|
141
|
+
assignments: {
|
|
142
|
+
variableId: string;
|
|
143
|
+
value: string;
|
|
144
|
+
}[];
|
|
145
|
+
})[];
|
|
146
|
+
id?: undefined;
|
|
147
|
+
};
|
|
148
|
+
defaultNextStep?: undefined;
|
|
149
|
+
conditions?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
id: string;
|
|
152
|
+
title: string;
|
|
153
|
+
content: string;
|
|
154
|
+
type: string;
|
|
155
|
+
url: null;
|
|
156
|
+
settings: {
|
|
157
|
+
borderColor: string;
|
|
158
|
+
position: {
|
|
159
|
+
x: number;
|
|
160
|
+
y: number;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
question: {
|
|
164
|
+
id: string;
|
|
165
|
+
title: string;
|
|
166
|
+
description: string;
|
|
167
|
+
answers: ({
|
|
168
|
+
title: string;
|
|
169
|
+
id: string;
|
|
170
|
+
nextStep: {
|
|
171
|
+
id: string;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
title: string;
|
|
175
|
+
id: string;
|
|
176
|
+
nextStep: null;
|
|
177
|
+
})[];
|
|
178
|
+
};
|
|
179
|
+
defaultNextStep?: undefined;
|
|
180
|
+
conditions?: undefined;
|
|
181
|
+
isFirstStep?: undefined;
|
|
182
|
+
} | {
|
|
183
|
+
id: string;
|
|
184
|
+
title: string;
|
|
185
|
+
content: string;
|
|
186
|
+
type: string;
|
|
187
|
+
url: null;
|
|
188
|
+
settings: {
|
|
189
|
+
borderColor: null;
|
|
190
|
+
position: {
|
|
191
|
+
x: number;
|
|
192
|
+
y: number;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
question: null;
|
|
196
|
+
defaultNextStep?: undefined;
|
|
197
|
+
conditions?: undefined;
|
|
198
|
+
isFirstStep?: undefined;
|
|
199
|
+
})[];
|
|
200
|
+
};
|
|
201
|
+
export declare const initialTree: ({
|
|
202
|
+
id: string;
|
|
203
|
+
title: string;
|
|
204
|
+
type: string;
|
|
205
|
+
question: {
|
|
206
|
+
id: string;
|
|
207
|
+
title: string;
|
|
208
|
+
description: string;
|
|
209
|
+
answers: {
|
|
210
|
+
title: string;
|
|
211
|
+
id: string;
|
|
212
|
+
nextStep: {
|
|
213
|
+
id: string;
|
|
214
|
+
};
|
|
215
|
+
}[];
|
|
216
|
+
};
|
|
217
|
+
isFirstStep?: undefined;
|
|
218
|
+
url?: undefined;
|
|
219
|
+
} | {
|
|
220
|
+
id: string;
|
|
221
|
+
title: string;
|
|
222
|
+
type: string;
|
|
223
|
+
isFirstStep: boolean;
|
|
224
|
+
url: null;
|
|
225
|
+
question: {
|
|
226
|
+
id: string;
|
|
227
|
+
title: string;
|
|
228
|
+
description: string;
|
|
229
|
+
answers: {
|
|
230
|
+
title: string;
|
|
231
|
+
id: string;
|
|
232
|
+
nextStep: {
|
|
233
|
+
id: string;
|
|
234
|
+
};
|
|
235
|
+
}[];
|
|
236
|
+
};
|
|
237
|
+
} | {
|
|
238
|
+
id: string;
|
|
239
|
+
title: string;
|
|
240
|
+
type: string;
|
|
241
|
+
url: null;
|
|
242
|
+
question: null;
|
|
243
|
+
isFirstStep?: undefined;
|
|
244
|
+
} | {
|
|
245
|
+
id: string;
|
|
246
|
+
title: string;
|
|
247
|
+
type: string;
|
|
248
|
+
url: string;
|
|
249
|
+
question: null;
|
|
250
|
+
isFirstStep?: undefined;
|
|
251
|
+
})[];
|
|
252
|
+
export declare const treeWithLinkedSteps: ({
|
|
253
|
+
id: string;
|
|
254
|
+
number: number;
|
|
255
|
+
title: string;
|
|
256
|
+
type: string;
|
|
257
|
+
url: null;
|
|
258
|
+
question: {
|
|
259
|
+
id: string;
|
|
260
|
+
title: string;
|
|
261
|
+
description: string;
|
|
262
|
+
answers: {
|
|
263
|
+
title: string;
|
|
264
|
+
id: string;
|
|
265
|
+
nextStep: {
|
|
266
|
+
id: string;
|
|
267
|
+
number: number;
|
|
268
|
+
};
|
|
269
|
+
}[];
|
|
270
|
+
};
|
|
271
|
+
linkedSteps: {
|
|
272
|
+
id: string;
|
|
273
|
+
number: number;
|
|
274
|
+
}[];
|
|
275
|
+
} | {
|
|
276
|
+
id: string;
|
|
277
|
+
number: number;
|
|
278
|
+
title: string;
|
|
279
|
+
type: string;
|
|
280
|
+
question: {
|
|
281
|
+
id: string;
|
|
282
|
+
title: string;
|
|
283
|
+
description: string;
|
|
284
|
+
answers: {
|
|
285
|
+
title: string;
|
|
286
|
+
id: string;
|
|
287
|
+
nextStep: {
|
|
288
|
+
id: string;
|
|
289
|
+
number: number;
|
|
290
|
+
};
|
|
291
|
+
}[];
|
|
292
|
+
};
|
|
293
|
+
linkedSteps: {
|
|
294
|
+
id: string;
|
|
295
|
+
number: number;
|
|
296
|
+
}[];
|
|
297
|
+
url?: undefined;
|
|
298
|
+
} | {
|
|
299
|
+
id: string;
|
|
300
|
+
number: number;
|
|
301
|
+
title: string;
|
|
302
|
+
type: string;
|
|
303
|
+
url: null;
|
|
304
|
+
question: null;
|
|
305
|
+
linkedSteps?: undefined;
|
|
306
|
+
} | {
|
|
307
|
+
id: string;
|
|
308
|
+
number: number;
|
|
309
|
+
title: string;
|
|
310
|
+
type: string;
|
|
311
|
+
url: string;
|
|
312
|
+
question: null;
|
|
313
|
+
linkedSteps?: undefined;
|
|
314
|
+
})[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DecisionTree } from '@shelf/types-ddb';
|
|
2
|
+
import type { L10n } from '@shelf/types';
|
|
3
|
+
export type DTStepFromApi = DecisionTree.Step & {
|
|
4
|
+
content?: string;
|
|
5
|
+
isFirstStep?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type RenderDTContentData = {
|
|
8
|
+
tree: DTStepFromApi[];
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
language: L10n.LanguageCode;
|
|
12
|
+
exportedAt: string;
|
|
13
|
+
exportedBy: string;
|
|
14
|
+
createdBy: string;
|
|
15
|
+
fields?: {
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
variables: Pick<DecisionTree.ContextualVariableDefaults, 'name' | 'id' | 'isDeleted'>[];
|
|
20
|
+
};
|
|
21
|
+
type StepPointer = {
|
|
22
|
+
id?: string;
|
|
23
|
+
number?: number;
|
|
24
|
+
};
|
|
25
|
+
export type ConditionType = {
|
|
26
|
+
id: string;
|
|
27
|
+
expression: {
|
|
28
|
+
joiner?: DecisionTree.Joiners;
|
|
29
|
+
rules: {
|
|
30
|
+
id: string;
|
|
31
|
+
variableId: string;
|
|
32
|
+
operator: DecisionTree.Operators;
|
|
33
|
+
value: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
nextStep?: StepPointer;
|
|
37
|
+
};
|
|
38
|
+
export type DTStep = Omit<DecisionTree.Step, 'question'> & {
|
|
39
|
+
number: number;
|
|
40
|
+
content?: string;
|
|
41
|
+
isFirstStep?: boolean;
|
|
42
|
+
question: {
|
|
43
|
+
id: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
answers: {
|
|
47
|
+
id: string;
|
|
48
|
+
title?: string;
|
|
49
|
+
nextStep?: StepPointer;
|
|
50
|
+
assignments?: DecisionTree.Assignment[];
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
conditions?: ConditionType[];
|
|
54
|
+
linkedSteps?: StepPointer[];
|
|
55
|
+
parentSteps: StepPointer[];
|
|
56
|
+
defaultNextStep?: {
|
|
57
|
+
id: string;
|
|
58
|
+
number?: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DecisionTree } from '@shelf/types-ddb';
|
|
3
|
+
declare const StaticTreeContainer: ({ tree, variables, }: {
|
|
4
|
+
tree: DecisionTree.Step[];
|
|
5
|
+
variables: DecisionTree.ContextualVariableDefaults[];
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default StaticTreeContainer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { L10n } from '@shelf/types';
|
|
2
|
+
import type { DecisionTree } from '@shelf/types-ddb';
|
|
3
|
+
export declare const renderStaticDTDiagram: ({ language, tree, variables, containerSelector, }: {
|
|
4
|
+
language?: L10n.LanguageCode | undefined;
|
|
5
|
+
tree: DecisionTree.Step[];
|
|
6
|
+
variables: DecisionTree.ContextualVariableDefaults[];
|
|
7
|
+
containerSelector?: string | undefined;
|
|
8
|
+
}) => void;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DecisionTreeContent/types';
|