@legalplace/tagextractor 1.1.0 → 1.1.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.
@@ -11,7 +11,6 @@ declare class TagExtractor {
11
11
  get getTags(): TagsType;
12
12
  private extractFromOptions;
13
13
  private extractFromVariables;
14
- private optionConditionValue;
15
14
  isVariableDisplayed(id: number, index: number): boolean;
16
15
  isOptionDisplayed(id: number, index: number): boolean;
17
16
  private getVariableCondition;
@@ -76,16 +76,6 @@ var TagExtractor = (function () {
76
76
  }
77
77
  });
78
78
  };
79
- TagExtractor.prototype.optionConditionValue = function (optionId) {
80
- var _this = this;
81
- var conditions = this.references.conditions.options[optionId];
82
- var inputs = this.inputs.options[optionId];
83
- if (conditions === undefined)
84
- return inputs.map(function () { return true; });
85
- return inputs.map(function (input, index) {
86
- return _this.conditionsRunner.executeCondition(conditions, optionId, index, 'options');
87
- });
88
- };
89
79
  TagExtractor.prototype.isVariableDisplayed = function (id, index) {
90
80
  var _a;
91
81
  var variableCondition = this.getVariableCondition(id, index);
@@ -57,6 +57,13 @@ var OvcConverter = (function () {
57
57
  }
58
58
  });
59
59
  }
60
+ Object.keys(references.options).forEach(function (optionId) {
61
+ var option = references.options[optionId];
62
+ var parents = references.relations.options[optionId].parents;
63
+ if (inputs.options[optionId] === undefined && parents.length === 0 && option.meta.type === 'static') {
64
+ inputs.options[optionId] = [true];
65
+ }
66
+ });
60
67
  if (typeof ovc.c === 'object') {
61
68
  Object.keys(ovc.c).forEach(function (id) {
62
69
  var currentCheckbox = ovc.c[id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/tagextractor",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "TagExtractor",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/tagextractor",
@@ -89,23 +89,6 @@ class TagExtractor {
89
89
  })
90
90
  }
91
91
 
92
- /**
93
- * Calculates option's condition
94
- */
95
- private optionConditionValue(optionId: number) {
96
- // Getting option conditions
97
- const conditions = this.references.conditions.options[optionId]
98
-
99
- // Getting option inputs length
100
- const inputs = this.inputs.options[optionId]
101
-
102
- if (conditions === undefined) return inputs.map(() => true)
103
-
104
- return inputs.map((input, index) => {
105
- return this.conditionsRunner.executeCondition(conditions, optionId, index, 'options')
106
- })
107
- }
108
-
109
92
  /**
110
93
  * Checks whether a variable is displayed at a given index
111
94
  * @param id Variable's ID
@@ -58,6 +58,16 @@ class OvcConverter {
58
58
  })
59
59
  }
60
60
 
61
+ // Adding static root options
62
+ Object.keys(references.options).forEach(optionId => {
63
+ const option = references.options[optionId]
64
+ const { parents } = references.relations.options[optionId]
65
+
66
+ if (inputs.options[optionId] === undefined && parents.length === 0 && option.meta.type === 'static') {
67
+ inputs.options[optionId] = [true]
68
+ }
69
+ })
70
+
61
71
  // Reading checkboxes
62
72
  if (typeof ovc.c === 'object') {
63
73
  Object.keys(ovc.c).forEach(id => {
@@ -104,6 +114,7 @@ class OvcConverter {
104
114
  const foundKeys = Object.keys(_obj)
105
115
  .map((key): number => (ovcKeys.includes(key) ? 1 : 0))
106
116
  .reduce((a, b) => a + b, 0)
117
+
107
118
  return foundKeys > 1
108
119
  }
109
120