case-editor-tools 1.0.0-beta.9 → 1.0.2

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 (75) hide show
  1. package/constants/key-definitions.d.ts +3 -0
  2. package/constants/key-definitions.js +7 -1
  3. package/constants/key-definitions.js.map +1 -1
  4. package/exporter/index.d.ts +2 -0
  5. package/exporter/index.js +128 -0
  6. package/exporter/index.js.map +1 -0
  7. package/expression-utils/expressionGen.d.ts +1 -1
  8. package/expression-utils/studyEngineExpressions.d.ts +94 -13
  9. package/expression-utils/studyEngineExpressions.js +215 -19
  10. package/expression-utils/studyEngineExpressions.js.map +1 -1
  11. package/{item-editor-cb5ebc1a.js → item-editor-59f51ecc.js} +67 -46
  12. package/item-editor-59f51ecc.js.map +1 -0
  13. package/logger/index.d.ts +1 -0
  14. package/logger/index.js +10 -0
  15. package/logger/index.js.map +1 -0
  16. package/package.json +5 -5
  17. package/surveys/index.d.ts +1 -0
  18. package/surveys/index.js +9 -1
  19. package/surveys/index.js.map +1 -1
  20. package/surveys/responseTypeGenerators/likertGroupComponents.d.ts +27 -0
  21. package/surveys/responseTypeGenerators/likertGroupComponents.js +350 -0
  22. package/surveys/responseTypeGenerators/likertGroupComponents.js.map +1 -0
  23. package/surveys/responseTypeGenerators/matrixGroupComponent.d.ts +49 -0
  24. package/surveys/responseTypeGenerators/matrixGroupComponent.js +100 -0
  25. package/surveys/responseTypeGenerators/matrixGroupComponent.js.map +1 -0
  26. package/surveys/responseTypeGenerators/optionGroupComponents.d.ts +7 -0
  27. package/surveys/responseTypeGenerators/optionGroupComponents.js +129 -0
  28. package/surveys/responseTypeGenerators/optionGroupComponents.js.map +1 -0
  29. package/surveys/survey-editor/component-editor.d.ts +1 -1
  30. package/surveys/survey-editor/data-types.d.ts +1 -1
  31. package/surveys/survey-editor/item-editor.d.ts +2 -1
  32. package/surveys/survey-editor/item-editor.js +2 -1
  33. package/surveys/survey-editor/item-editor.js.map +1 -1
  34. package/surveys/survey-editor/survey-editor.d.ts +6 -1
  35. package/surveys/survey-editor/survey-editor.js +13 -6
  36. package/surveys/survey-editor/survey-editor.js.map +1 -1
  37. package/surveys/survey-engine-expressions.d.ts +12 -2
  38. package/surveys/survey-engine-expressions.js +43 -2
  39. package/surveys/survey-engine-expressions.js.map +1 -1
  40. package/surveys/survey-items.d.ts +33 -227
  41. package/surveys/survey-items.js +215 -780
  42. package/surveys/survey-items.js.map +1 -1
  43. package/surveys/types/group.d.ts +1 -1
  44. package/surveys/types/group.js +2 -1
  45. package/surveys/types/group.js.map +1 -1
  46. package/surveys/types/index.js +3 -1
  47. package/surveys/types/index.js.map +1 -1
  48. package/surveys/types/item-properties.d.ts +206 -2
  49. package/surveys/types/item-properties.js +7 -0
  50. package/surveys/types/item-properties.js.map +1 -1
  51. package/surveys/types/item.d.ts +1 -1
  52. package/surveys/types/survey-definition.d.ts +7 -3
  53. package/surveys/types/survey-definition.js +11 -2
  54. package/surveys/types/survey-definition.js.map +1 -1
  55. package/surveys/utils/componentGenerators.d.ts +2 -13
  56. package/surveys/utils/componentGenerators.js +1 -34
  57. package/surveys/utils/componentGenerators.js.map +1 -1
  58. package/surveys/utils/optionDefGenerators.d.ts +84 -0
  59. package/surveys/utils/optionDefGenerators.js +211 -0
  60. package/surveys/utils/optionDefGenerators.js.map +1 -0
  61. package/surveys/utils/simple-generators.d.ts +4 -3
  62. package/surveys/utils/simple-generators.js +29 -0
  63. package/surveys/utils/simple-generators.js.map +1 -1
  64. package/surveys/utils/simple-question-editor.d.ts +5 -5
  65. package/surveys/utils/simple-question-editor.js +5 -2
  66. package/surveys/utils/simple-question-editor.js.map +1 -1
  67. package/types/expression.d.ts +1 -1
  68. package/types/messageConfig.d.ts +49 -0
  69. package/types/messageConfig.js +23 -0
  70. package/types/messageConfig.js.map +1 -0
  71. package/types/study.d.ts +3 -1
  72. package/types/studyRules.d.ts +3 -2
  73. package/types/studyRules.js +5 -1
  74. package/types/studyRules.js.map +1 -1
  75. package/item-editor-cb5ebc1a.js.map +0 -1
@@ -0,0 +1,211 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var surveys_surveyEngineExpressions = require('../survey-engine-expressions.js');
6
+ var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
7
+ require('../../constants/key-definitions.js');
8
+ require('../../types/duration.js');
9
+ require('../../expression-utils/expressionGen.js');
10
+
11
+ const option = (key, content, extraProps) => {
12
+ const styles = [];
13
+ if ((extraProps === null || extraProps === void 0 ? void 0 : extraProps.className) !== undefined) {
14
+ styles.push({
15
+ key: 'className', value: extraProps.className
16
+ });
17
+ }
18
+ return {
19
+ key: key,
20
+ role: 'option',
21
+ content: !Array.isArray(content) ? content : undefined,
22
+ items: Array.isArray(content) ? content : undefined,
23
+ displayCondition: extraProps === null || extraProps === void 0 ? void 0 : extraProps.displayCondition,
24
+ disabled: extraProps === null || extraProps === void 0 ? void 0 : extraProps.disabled,
25
+ style: styles,
26
+ };
27
+ };
28
+ const multipleChoiceOptionSubtitle = (props) => {
29
+ const styles = [];
30
+ if (props.className !== undefined) {
31
+ styles.push({
32
+ key: 'className', value: props.className
33
+ });
34
+ }
35
+ return {
36
+ key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
37
+ role: 'text',
38
+ content: !Array.isArray(props.content) ? props.content : undefined,
39
+ displayCondition: props.displayCondition,
40
+ style: styles,
41
+ };
42
+ };
43
+ const markdown = (props) => {
44
+ const styles = [];
45
+ if (props.className !== undefined) {
46
+ styles.push({
47
+ key: 'className', value: props.className
48
+ });
49
+ }
50
+ return {
51
+ key: props.key ? props.key : surveys_utils_randomKeyGenerator.generateRandomKey(6),
52
+ role: 'markdown',
53
+ content: !Array.isArray(props.content) ? props.content : undefined,
54
+ displayCondition: props.displayCondition,
55
+ style: styles,
56
+ };
57
+ };
58
+ const textInput = (props) => {
59
+ const style = [];
60
+ if (props.maxLength !== undefined) {
61
+ style.push({ key: 'maxLength', value: props.maxLength.toFixed(0) });
62
+ }
63
+ if (props.className !== undefined) {
64
+ style.push({ key: 'className', value: props.className });
65
+ }
66
+ if (props.inputMaxWidth !== undefined) {
67
+ style.push({ key: 'inputMaxWidth', value: props.inputMaxWidth });
68
+ }
69
+ return {
70
+ key: props.key,
71
+ role: 'input',
72
+ content: props.inputLabel,
73
+ description: props.placeholderText,
74
+ displayCondition: props.displayCondition,
75
+ disabled: props.disabled,
76
+ style: style.length > 0 ? style : undefined,
77
+ };
78
+ };
79
+ const numberInput = (props) => {
80
+ var _a, _b, _c, _d;
81
+ const style = [];
82
+ if (props.inputMaxWidth !== undefined) {
83
+ style.push({ key: 'inputMaxWidth', value: props.inputMaxWidth });
84
+ }
85
+ if (props.labelBehindInput) {
86
+ style.push({ key: 'labelPlacement', value: 'after' });
87
+ }
88
+ return {
89
+ key: props.key,
90
+ role: 'numberInput',
91
+ content: props.inputLabel,
92
+ displayCondition: props.displayCondition,
93
+ disabled: props.disabled,
94
+ optionProps: {
95
+ min: ((_a = props.componentProperties) === null || _a === void 0 ? void 0 : _a.min) !== undefined ? (typeof (props.componentProperties.min) === 'number' ? { dtype: 'num', num: props.componentProperties.min } : props.componentProperties.min) : undefined,
96
+ max: ((_b = props.componentProperties) === null || _b === void 0 ? void 0 : _b.max) !== undefined ? (typeof ((_c = props.componentProperties) === null || _c === void 0 ? void 0 : _c.max) === 'number' ? { dtype: 'num', num: props.componentProperties.max } : props.componentProperties.max) : undefined,
97
+ stepSize: ((_d = props.componentProperties) === null || _d === void 0 ? void 0 : _d.stepSize) ? (typeof (props.componentProperties.stepSize) === 'number' ? { dtype: 'num', num: props.componentProperties.stepSize } : props.componentProperties.stepSize) : undefined,
98
+ },
99
+ style: style.length > 0 ? style : undefined,
100
+ };
101
+ };
102
+ const dateInput = (props) => {
103
+ return {
104
+ key: props.key,
105
+ role: 'dateInput',
106
+ optionProps: {
107
+ dateInputMode: { str: props.dateInputMode },
108
+ min: props.minRelativeDate ? {
109
+ dtype: 'exp', exp: surveys_surveyEngineExpressions.SurveyEngine.timestampWithOffset(props.minRelativeDate.delta, props.minRelativeDate.reference)
110
+ } : undefined,
111
+ max: props.maxRelativeDate ? {
112
+ dtype: 'exp', exp: surveys_surveyEngineExpressions.SurveyEngine.timestampWithOffset(props.maxRelativeDate.delta, props.maxRelativeDate.reference ? props.maxRelativeDate.reference : undefined)
113
+ } : undefined,
114
+ },
115
+ content: props.inputLabelText,
116
+ displayCondition: props.displayCondition,
117
+ };
118
+ };
119
+ const timeInput = (props) => {
120
+ const style = [];
121
+ if (props.minTime) {
122
+ style.push({
123
+ key: 'minTime', value: props.minTime,
124
+ });
125
+ }
126
+ if (props.maxTime) {
127
+ style.push({
128
+ key: 'maxTime', value: props.maxTime,
129
+ });
130
+ }
131
+ if (props.defaultValue) {
132
+ style.push({
133
+ key: 'defaultValue', value: props.defaultValue,
134
+ });
135
+ }
136
+ if (props.labelBehindInput) {
137
+ style.push({ key: 'labelPlacement', value: 'after' });
138
+ }
139
+ return {
140
+ key: props.key,
141
+ role: 'timeInput',
142
+ optionProps: {
143
+ stepSize: props.step,
144
+ },
145
+ content: props.inputLabelText,
146
+ displayCondition: props.displayCondition,
147
+ style: style.length > 0 ? style : undefined,
148
+ };
149
+ };
150
+ const dropDown = (props) => {
151
+ return {
152
+ key: props.key,
153
+ role: 'dropDownGroup',
154
+ displayCondition: props.displayCondition,
155
+ description: props.placeholder,
156
+ items: props.options,
157
+ };
158
+ };
159
+ const cloze = (props) => {
160
+ const styles = [];
161
+ if (props.className !== undefined) {
162
+ styles.push({
163
+ key: 'className', value: props.className
164
+ });
165
+ }
166
+ return {
167
+ key: props.key,
168
+ role: 'cloze',
169
+ items: props.items,
170
+ displayCondition: props.displayCondition,
171
+ style: styles.length > 0 ? styles : undefined,
172
+ };
173
+ };
174
+ const clozeLineBreak = () => {
175
+ return {
176
+ key: surveys_utils_randomKeyGenerator.generateRandomKey(5),
177
+ role: 'lineBreak',
178
+ };
179
+ };
180
+ const SingleChoiceOptionTypes = {
181
+ option,
182
+ textInput,
183
+ //dateInput,
184
+ timeInput,
185
+ numberInput,
186
+ cloze,
187
+ };
188
+ const MultipleChoiceOptionTypes = {
189
+ option,
190
+ subtitle: multipleChoiceOptionSubtitle,
191
+ textInput,
192
+ // dateInput
193
+ timeInput,
194
+ numberInput,
195
+ cloze,
196
+ };
197
+ const ClozeItemTypes = {
198
+ text: multipleChoiceOptionSubtitle,
199
+ markdown,
200
+ textInput,
201
+ dateInput,
202
+ timeInput,
203
+ clozeLineBreak,
204
+ numberInput,
205
+ dropDown,
206
+ };
207
+
208
+ exports.ClozeItemTypes = ClozeItemTypes;
209
+ exports.MultipleChoiceOptionTypes = MultipleChoiceOptionTypes;
210
+ exports.SingleChoiceOptionTypes = SingleChoiceOptionTypes;
211
+ //# sourceMappingURL=optionDefGenerators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optionDefGenerators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,8 @@
1
- import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupComponent, SurveySingleItem } from "survey-engine/lib/data_types";
2
- import { StyledTextComponentProp } from "../types/item-properties";
1
+ import { LocalizedString, ItemComponent, ExpressionName, Expression, ItemGroupComponent, SurveySingleItem } from "survey-engine/data_types";
2
+ import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
3
3
  export declare const generateLocStrings: (translations: Map<string, string>) => LocalizedString[];
4
- export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp>, description?: Map<string, string> | undefined, className?: string | undefined) => ItemComponent;
4
+ export declare const generateDateDisplayComp: (key: string, item: DateDisplayComponentProp) => ItemComponent;
5
+ export declare const generateTitleComponent: (content: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string> | undefined, className?: string | undefined) => ItemComponent;
5
6
  export declare const generateHelpGroupComponent: (items: Array<{
6
7
  content: Map<string, string>;
7
8
  style?: Array<{
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var surveys_surveyEditor_componentEditor = require('../survey-editor/component-editor.js');
6
+ var surveys_types_itemProperties = require('../types/item-properties.js');
6
7
  var surveys_utils_randomKeyGenerator = require('./randomKeyGenerator.js');
7
8
 
8
9
  const generateLocStrings = (translations) => {
@@ -17,11 +18,38 @@ const generateLocStrings = (translations) => {
17
18
  });
18
19
  return locString;
19
20
  };
21
+ const generateDateDisplayComp = (key, item) => {
22
+ // console.log(translations);
23
+ const styleArray = [
24
+ { key: 'dateFormat', value: item.dateFormat }
25
+ ];
26
+ if (item.className) {
27
+ styleArray.push({ key: 'className', value: item.className });
28
+ }
29
+ const locString = new Array();
30
+ const dateExp = item.date;
31
+ item.languageCodes.forEach((code) => {
32
+ const translatedItem = {
33
+ code: code,
34
+ parts: [{ dtype: 'exp', exp: dateExp }]
35
+ };
36
+ locString.push(translatedItem);
37
+ });
38
+ return {
39
+ key: key,
40
+ role: 'dateDisplay',
41
+ content: locString,
42
+ style: styleArray,
43
+ };
44
+ };
20
45
  const generateTitleComponent = (content, description, className) => {
21
46
  let items = undefined;
22
47
  let currentContent = undefined;
23
48
  if (Array.isArray(content)) {
24
49
  items = content.map((item, index) => {
50
+ if (surveys_types_itemProperties.isDateDisplayComponentProp(item)) {
51
+ return generateDateDisplayComp(index.toFixed(), item);
52
+ }
25
53
  return {
26
54
  key: index.toFixed(),
27
55
  role: 'text',
@@ -95,6 +123,7 @@ const generatePageBreak = (parentKey, key) => {
95
123
  };
96
124
 
97
125
  exports.expWithArgs = expWithArgs;
126
+ exports.generateDateDisplayComp = generateDateDisplayComp;
98
127
  exports.generateHelpGroupComponent = generateHelpGroupComponent;
99
128
  exports.generateLocStrings = generateLocStrings;
100
129
  exports.generatePageBreak = generatePageBreak;
@@ -1 +1 @@
1
- {"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"simple-generators.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,12 +1,12 @@
1
- import { Expression, ItemComponent } from "survey-engine/lib/data_types";
1
+ import { ConfidentialMode, Expression, ItemComponent } from "survey-engine/data_types";
2
2
  import { ItemEditor } from "../survey-editor/item-editor";
3
- import { StyledTextComponentProp } from "../types/item-properties";
3
+ import { DateDisplayComponentProp, StyledTextComponentProp } from "../types/item-properties";
4
4
  export declare class SimpleQuestionEditor {
5
5
  editor: ItemEditor;
6
6
  key: string;
7
- constructor(parentKey: string, key: string, version: number);
8
- getItem(): import("survey-engine/lib/data_types").SurveyItem;
9
- setTitle(title: Map<string, string> | Array<StyledTextComponentProp>, description?: Map<string, string>, className?: string): void;
7
+ constructor(parentKey: string, key: string, version: number, confidentialMode?: ConfidentialMode);
8
+ getItem(): import("survey-engine/data_types").SurveyItem;
9
+ setTitle(title: Map<string, string> | Array<StyledTextComponentProp | DateDisplayComponentProp>, description?: Map<string, string>, className?: string): void;
10
10
  setCondition(exp: Expression): void;
11
11
  addDisplayComponent(comp: ItemComponent, atPosition?: number): void;
12
12
  addHasResponseValidation(): void;
@@ -3,17 +3,20 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var constants_keyDefinitions = require('../../constants/key-definitions.js');
6
- var surveys_surveyEditor_itemEditor = require('../../item-editor-cb5ebc1a.js');
6
+ var surveys_surveyEditor_itemEditor = require('../../item-editor-59f51ecc.js');
7
7
  var surveys_utils_simpleGenerators = require('./simple-generators.js');
8
8
  require('../survey-editor/component-editor.js');
9
9
  require('./randomKeyGenerator.js');
10
+ require('../../logger/logger.js');
11
+ require('../types/item-properties.js');
10
12
 
11
13
  class SimpleQuestionEditor {
12
- constructor(parentKey, key, version) {
14
+ constructor(parentKey, key, version, confidentialMode) {
13
15
  const itemKey = [parentKey, key].join('.');
14
16
  this.key = itemKey;
15
17
  this.editor = new surveys_surveyEditor_itemEditor.ItemEditor(undefined, { itemKey: itemKey, isGroup: false });
16
18
  this.editor.setVersion(version);
19
+ this.editor.setConfidentialMode(confidentialMode);
17
20
  }
18
21
  getItem() {
19
22
  return this.editor.getItem();
@@ -1 +1 @@
1
- {"version":3,"file":"simple-question-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"simple-question-editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Expression, ExpressionArg } from "survey-engine/lib/data_types";
1
+ import { Expression, ExpressionArg } from "survey-engine/data_types";
2
2
  export declare const isExpression: (value: Expression | any) => value is Expression;
3
3
  export declare type ExpressionArgDType = 'exp' | 'num' | 'str';
4
4
  export declare const expressionArgParser: (arg: ExpressionArg) => any;
@@ -0,0 +1,49 @@
1
+ import { Expression } from "survey-engine/data_types";
2
+ import { Duration } from "./duration";
3
+ export declare type MessageType = 'registration' | 'invitation' | 'verify-email' | 'verification-code' | 'password-reset' | 'password-changed' | 'account-id-changed' | 'weekly' | 'study-reminder' | 'newsletter' | 'account-deleted';
4
+ export interface MessageConfig {
5
+ sendTo: 'study-participants' | 'all-users' | 'scheduled-participant-messages';
6
+ label: string;
7
+ headerOverrides?: {
8
+ from: string;
9
+ sender: string;
10
+ replyTo: string[];
11
+ };
12
+ messageType: MessageType;
13
+ sendingTime: {
14
+ hour: number;
15
+ minute: number;
16
+ };
17
+ period: Duration;
18
+ defaultLanguage: string;
19
+ condition?: Expression;
20
+ translations: Array<{
21
+ lang: string;
22
+ subject: string;
23
+ }>;
24
+ }
25
+ export declare const buildMessageConfig: (props: MessageConfig, studyKey: string) => {
26
+ sendTo: "study-participants" | "all-users" | "scheduled-participant-messages";
27
+ studyKey: string;
28
+ label: string;
29
+ headerOverrides: {
30
+ from: string;
31
+ sender: string;
32
+ replyTo: string[];
33
+ } | undefined;
34
+ messageType: MessageType;
35
+ sendingTime: {
36
+ hour: number;
37
+ minute: number;
38
+ };
39
+ condition: {
40
+ dtype: string;
41
+ exp: Expression;
42
+ } | undefined;
43
+ period: number;
44
+ defaultLanguage: string;
45
+ translations: {
46
+ lang: string;
47
+ subject: string;
48
+ }[];
49
+ };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var types_duration = require('./duration.js');
6
+
7
+ const buildMessageConfig = (props, studyKey) => {
8
+ return {
9
+ sendTo: props.sendTo,
10
+ studyKey: studyKey,
11
+ label: props.label,
12
+ headerOverrides: props.headerOverrides,
13
+ messageType: props.messageType,
14
+ sendingTime: props.sendingTime,
15
+ condition: props.condition ? { dtype: 'exp', exp: props.condition } : undefined,
16
+ period: Math.floor(types_duration.durationObjectToSeconds(props.period)),
17
+ defaultLanguage: props.defaultLanguage,
18
+ translations: props.translations,
19
+ };
20
+ };
21
+
22
+ exports.buildMessageConfig = buildMessageConfig;
23
+ //# sourceMappingURL=messageConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageConfig.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
package/types/study.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { Expression } from "survey-engine/lib/data_types";
1
+ import { Expression } from "survey-engine/data_types";
2
2
  import { StudyRules } from "./studyRules";
3
3
  import { SurveyDefinition } from "../surveys/types/survey-definition";
4
+ import { MessageConfig } from "./messageConfig";
4
5
  export interface Study {
5
6
  studyKey: string;
6
7
  outputFolderName?: string;
@@ -10,4 +11,5 @@ export interface Study {
10
11
  name: string;
11
12
  rules: Expression[];
12
13
  }>;
14
+ messageConfigs?: Array<MessageConfig>;
13
15
  }
@@ -1,8 +1,9 @@
1
- import { Expression } from 'survey-engine/lib/data_types';
1
+ import { Expression } from 'survey-engine/data_types';
2
2
  export declare class StudyRules {
3
3
  private enterRules?;
4
4
  private submitRules?;
5
5
  private timerRules?;
6
- constructor(enterRules?: Expression[], submitRules?: Expression[], timerRules?: Expression[]);
6
+ private mergeRules?;
7
+ constructor(enterRules?: Expression[], submitRules?: Expression[], timerRules?: Expression[], mergeRules?: Expression[]);
7
8
  get(): Expression[];
8
9
  }
@@ -8,10 +8,11 @@ require('./duration.js');
8
8
  require('../expression-utils/expressionGen.js');
9
9
 
10
10
  class StudyRules {
11
- constructor(enterRules, submitRules, timerRules) {
11
+ constructor(enterRules, submitRules, timerRules, mergeRules) {
12
12
  this.enterRules = enterRules;
13
13
  this.submitRules = submitRules;
14
14
  this.timerRules = timerRules;
15
+ this.mergeRules = mergeRules;
15
16
  }
16
17
  get() {
17
18
  const rules = [];
@@ -24,6 +25,9 @@ class StudyRules {
24
25
  if (this.timerRules) {
25
26
  rules.push(expressionUtils_studyEngineExpressions.StudyEngine.ifThen(expressionUtils_studyEngineExpressions.StudyEngine.checkEventType('TIMER'), ...this.timerRules));
26
27
  }
28
+ if (this.mergeRules) {
29
+ rules.push(expressionUtils_studyEngineExpressions.StudyEngine.ifThen(expressionUtils_studyEngineExpressions.StudyEngine.checkEventType('MERGE'), ...this.mergeRules));
30
+ }
27
31
  return rules;
28
32
  }
29
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"studyRules.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"studyRules.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"item-editor-cb5ebc1a.js","sources":["../node_modules/survey-engine/lib/data_types/expression.js","../node_modules/survey-engine/lib/data_types/survey-item.js","../node_modules/survey-engine/lib/data_types/survey-item-component.js","../node_modules/survey-engine/lib/data_types/response.js","../node_modules/survey-engine/lib/data_types/index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isExpression = (value) => {\n return typeof (value) === 'object' && value.name !== undefined && value.name.length > 0;\n};\nexports.expressionArgParser = (arg) => {\n switch (arg.dtype) {\n case 'num':\n return arg.num;\n case 'str':\n return arg.str;\n case 'exp':\n return arg.exp;\n default:\n return arg.str;\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSurveyGroupItem = (item) => {\n const items = item.items;\n return items !== undefined && items.length > 0;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isItemGroupComponent = (item) => {\n const items = item.items;\n return items !== undefined && items.length > 0;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSurveyGroupItemResponse = (item) => {\n const items = item.items;\n return items !== undefined && items.length > 0;\n};\n","\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__export(require(\"./expression\"));\n__export(require(\"./survey-item\"));\n__export(require(\"./survey-item-component\"));\n__export(require(\"./response\"));\n"],"names":["require$$0","require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