@legalplace/prerenderx 3.9.4-staging.0 → 3.9.4
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/CHANGELOG.md +8 -0
- package/dist/libs/OptionRender.js +3 -5
- package/dist/libs/SectionRender.js +1 -1
- package/dist/libs/misc/FillPdfFormBase.js +5 -7
- package/package.json +10 -9
- package/src/libs/OptionRender.ts +3 -4
- package/src/libs/SectionRender.ts +1 -2
- package/src/libs/misc/FillPdfFormBase.ts +5 -13
- package/tests/Prerender.documentMultiple.test.ts +5 -3
- package/dist/libs/outputTableRendering.d.ts +0 -16
- package/dist/libs/outputTableRendering.js +0 -130
- package/dist/libs/regionHelpers.d.ts +0 -5
- package/dist/libs/regionHelpers.js +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.9.4](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.9.3...@legalplace/prerenderx@3.9.4) (2026-09-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @legalplace/prerenderx
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [3.9.3](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.9.2...@legalplace/prerenderx@3.9.3) (2026-09-02)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -29,9 +29,7 @@ var OptionRender = (function () {
|
|
|
29
29
|
OptionRender.prototype.isDisplayed = function (optionId) {
|
|
30
30
|
var _this = this;
|
|
31
31
|
if (optionId === void 0) { optionId = this.id; }
|
|
32
|
-
return (0, referencesparser_1.isOptionDisplayed)(this.references, this.ovc, function (type, entityId, entityIndex
|
|
33
|
-
var _a;
|
|
34
|
-
if (documentSlug === void 0) { documentSlug = "main"; }
|
|
32
|
+
return (0, referencesparser_1.isOptionDisplayed)(this.references, this.ovc, function (type, entityId, entityIndex) {
|
|
35
33
|
if (type === "options") {
|
|
36
34
|
var conditionObject = _this.references.conditions.options[entityId];
|
|
37
35
|
return conditionObject === undefined
|
|
@@ -39,10 +37,10 @@ var OptionRender = (function () {
|
|
|
39
37
|
: _this.conditions.executeCondition(conditionObject, entityId, entityIndex, "options");
|
|
40
38
|
}
|
|
41
39
|
if (type === "sections") {
|
|
42
|
-
var conditionObject =
|
|
40
|
+
var conditionObject = _this.references.conditions.sections.main[entityId];
|
|
43
41
|
return conditionObject === undefined
|
|
44
42
|
? true
|
|
45
|
-
: _this.conditions.executeCondition(conditionObject, entityId, entityIndex, "sections"
|
|
43
|
+
: _this.conditions.executeCondition(conditionObject, entityId, entityIndex, "sections");
|
|
46
44
|
}
|
|
47
45
|
return true;
|
|
48
46
|
}, optionId, this.index);
|
|
@@ -44,7 +44,7 @@ var SectionRender = (function () {
|
|
|
44
44
|
var conditionObject = this.references.conditions.sections[this.documentName][this.currentSection];
|
|
45
45
|
var condition = conditionObject === undefined
|
|
46
46
|
? true
|
|
47
|
-
: this.conditions.executeCondition(conditionObject, 0, this.baseIndex, "sections"
|
|
47
|
+
: this.conditions.executeCondition(conditionObject, 0, this.baseIndex, "sections");
|
|
48
48
|
if (condition !== true)
|
|
49
49
|
return;
|
|
50
50
|
var documentMultipleSource = this.getDocumentMultipleSource();
|
|
@@ -4,12 +4,12 @@ var referencesparser_1 = require("@legalplace/referencesparser");
|
|
|
4
4
|
var FillPdfFormBase = (function () {
|
|
5
5
|
function FillPdfFormBase(references, conditions, ovc) {
|
|
6
6
|
var _this = this;
|
|
7
|
-
this.conditionEvaluator = function (type, id, index
|
|
7
|
+
this.conditionEvaluator = function (type, id, index) {
|
|
8
8
|
if (type === "options")
|
|
9
9
|
return _this.getOptionCondition(id, index);
|
|
10
10
|
if (type === "variables")
|
|
11
11
|
return _this.getVariableCondition(id, index);
|
|
12
|
-
return _this.getSectionCondition(id
|
|
12
|
+
return _this.getSectionCondition(id);
|
|
13
13
|
};
|
|
14
14
|
this.references = references;
|
|
15
15
|
this.conditions = conditions;
|
|
@@ -33,13 +33,11 @@ var FillPdfFormBase = (function () {
|
|
|
33
33
|
? true
|
|
34
34
|
: this.conditions.executeCondition(conditionObject, id, index, "options");
|
|
35
35
|
};
|
|
36
|
-
FillPdfFormBase.prototype.getSectionCondition = function (id
|
|
37
|
-
var
|
|
38
|
-
if (documentSlug === void 0) { documentSlug = "main"; }
|
|
39
|
-
var conditionObject = (_a = this.references.conditions.sections[documentSlug]) === null || _a === void 0 ? void 0 : _a[id];
|
|
36
|
+
FillPdfFormBase.prototype.getSectionCondition = function (id) {
|
|
37
|
+
var conditionObject = this.references.conditions.sections.main[id];
|
|
40
38
|
return conditionObject === undefined
|
|
41
39
|
? true
|
|
42
|
-
: this.conditions.executeCondition(conditionObject, id, 0, "sections"
|
|
40
|
+
: this.conditions.executeCondition(conditionObject, id, 0, "sections");
|
|
43
41
|
};
|
|
44
42
|
return FillPdfFormBase;
|
|
45
43
|
}());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/prerenderx",
|
|
3
|
-
"version": "3.9.4
|
|
3
|
+
"version": "3.9.4",
|
|
4
4
|
"description": "PrerenderX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/prerenderx",
|
|
@@ -16,25 +16,26 @@
|
|
|
16
16
|
"release": "standard-version -a --no-verify"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@legalplace/conditions-runner": "2.
|
|
19
|
+
"@legalplace/conditions-runner": "^2.4.0",
|
|
20
20
|
"@legalplace/lplogic": "2.4.1",
|
|
21
|
-
"@legalplace/models-v3-types": "5.
|
|
22
|
-
"@legalplace/ovc-converter": "2.2.25
|
|
23
|
-
"@legalplace/referencesparser": "3.
|
|
21
|
+
"@legalplace/models-v3-types": "^5.19.0",
|
|
22
|
+
"@legalplace/ovc-converter": "^2.2.25",
|
|
23
|
+
"@legalplace/referencesparser": "^3.4.0",
|
|
24
24
|
"@legalplace/yousign": "^0.9.23",
|
|
25
25
|
"crypto": "^1.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.7.2",
|
|
29
29
|
"@babel/preset-typescript": "^7.7.2",
|
|
30
|
-
"@legalplace/eslint-config-base": "1.2.
|
|
31
|
-
"@legalplace/prettier-config": "2.1.
|
|
32
|
-
"@legalplace/types": "2.22.
|
|
30
|
+
"@legalplace/eslint-config-base": "^1.2.0",
|
|
31
|
+
"@legalplace/prettier-config": "^2.1.3",
|
|
32
|
+
"@legalplace/types": "^2.22.13",
|
|
33
33
|
"@types/jest": "^24.0.15",
|
|
34
34
|
"jest": "^24.8.0",
|
|
35
35
|
"redux-mock-store": "^1.5.3",
|
|
36
36
|
"standard-version": "^9.3.1",
|
|
37
37
|
"ts-jest": "^24.0.2"
|
|
38
38
|
},
|
|
39
|
-
"prettier": "@legalplace/prettier-config"
|
|
39
|
+
"prettier": "@legalplace/prettier-config",
|
|
40
|
+
"gitHead": "291ab9a10b1cad0ef43afc9cb1e1b0dcc7dfbcdb"
|
|
40
41
|
}
|
package/src/libs/OptionRender.ts
CHANGED
|
@@ -67,7 +67,7 @@ class OptionRender {
|
|
|
67
67
|
return isOptionDisplayed(
|
|
68
68
|
this.references,
|
|
69
69
|
this.ovc,
|
|
70
|
-
(type, entityId, entityIndex
|
|
70
|
+
(type, entityId, entityIndex) => {
|
|
71
71
|
if (type === "options") {
|
|
72
72
|
const conditionObject = this.references.conditions.options[entityId];
|
|
73
73
|
return conditionObject === undefined
|
|
@@ -81,15 +81,14 @@ class OptionRender {
|
|
|
81
81
|
}
|
|
82
82
|
if (type === "sections") {
|
|
83
83
|
const conditionObject =
|
|
84
|
-
this.references.conditions.sections[
|
|
84
|
+
this.references.conditions.sections.main[entityId];
|
|
85
85
|
return conditionObject === undefined
|
|
86
86
|
? true
|
|
87
87
|
: this.conditions.executeCondition(
|
|
88
88
|
conditionObject,
|
|
89
89
|
entityId,
|
|
90
90
|
entityIndex,
|
|
91
|
-
"sections"
|
|
92
|
-
documentSlug
|
|
91
|
+
"sections"
|
|
93
92
|
);
|
|
94
93
|
}
|
|
95
94
|
return true;
|
|
@@ -29,12 +29,11 @@ class FillPdfFormBase {
|
|
|
29
29
|
private readonly conditionEvaluator: ConditionEvaluator = (
|
|
30
30
|
type,
|
|
31
31
|
id,
|
|
32
|
-
index
|
|
33
|
-
documentSlug
|
|
32
|
+
index
|
|
34
33
|
) => {
|
|
35
34
|
if (type === "options") return this.getOptionCondition(id, index);
|
|
36
35
|
if (type === "variables") return this.getVariableCondition(id, index);
|
|
37
|
-
return this.getSectionCondition(id
|
|
36
|
+
return this.getSectionCondition(id);
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
/**
|
|
@@ -91,18 +90,11 @@ class FillPdfFormBase {
|
|
|
91
90
|
/**
|
|
92
91
|
* Returns a section's conditions.
|
|
93
92
|
*/
|
|
94
|
-
private getSectionCondition(id: number
|
|
95
|
-
const conditionObject =
|
|
96
|
-
this.references.conditions.sections[documentSlug]?.[id];
|
|
93
|
+
private getSectionCondition(id: number) {
|
|
94
|
+
const conditionObject = this.references.conditions.sections.main[id];
|
|
97
95
|
return conditionObject === undefined
|
|
98
96
|
? true
|
|
99
|
-
: this.conditions.executeCondition(
|
|
100
|
-
conditionObject,
|
|
101
|
-
id,
|
|
102
|
-
0,
|
|
103
|
-
"sections",
|
|
104
|
-
documentSlug
|
|
105
|
-
);
|
|
97
|
+
: this.conditions.executeCondition(conditionObject, id, 0, "sections");
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
100
|
|
|
@@ -6,7 +6,9 @@ import Prerender from "../src/libs/Prerender";
|
|
|
6
6
|
* (`params.multiple.enabled = true`, source = option #2). The output
|
|
7
7
|
* `[var:3]` interpolates the partner name at each occurrence.
|
|
8
8
|
*/
|
|
9
|
-
const buildMultipleDocumentModel = (
|
|
9
|
+
const buildMultipleDocumentModel = (
|
|
10
|
+
filenameTemplate?: string
|
|
11
|
+
): ModelV3 => ({
|
|
10
12
|
documents: {
|
|
11
13
|
main: {
|
|
12
14
|
name: "Contract",
|
|
@@ -158,8 +160,8 @@ describe("Prerender — document multiple", () => {
|
|
|
158
160
|
((b[1].occurrenceIndex ?? 0) as number)
|
|
159
161
|
);
|
|
160
162
|
|
|
161
|
-
const rendered = entries.map(
|
|
162
|
-
|
|
163
|
+
const rendered = entries.map(([hash]) =>
|
|
164
|
+
prerender.getDocument(hash) as string
|
|
163
165
|
);
|
|
164
166
|
|
|
165
167
|
expect(rendered[0]).toContain("Hello Alice");
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { OptionV3 } from "@legalplace/models-v3-types";
|
|
2
|
-
export type OutputTableCellStyle = Record<string, string>;
|
|
3
|
-
export type OutputTableStyle = {
|
|
4
|
-
columnWidths?: number[];
|
|
5
|
-
width?: number;
|
|
6
|
-
borderStyle?: string;
|
|
7
|
-
borderColor?: string;
|
|
8
|
-
borderWidth?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const expandOutputTableCellStyle: (styles: OutputTableCellStyle) => OutputTableCellStyle;
|
|
11
|
-
export declare const serializeInlineStyle: (styles: OutputTableCellStyle) => string;
|
|
12
|
-
export declare const buildOutputTableStyleAttr: (tableStyle?: OutputTableStyle) => string;
|
|
13
|
-
export declare const buildOutputTableCellStyleAttr: (cellStyle?: OutputTableCellStyle | null) => string;
|
|
14
|
-
export declare const getOutputTableCellStyle: (option: OptionV3) => OutputTableCellStyle | undefined;
|
|
15
|
-
export declare const replaceOutputTableMarkers: (html: string, renderTable: (tableId: number) => string) => string;
|
|
16
|
-
export declare const stripOutputTableMarkers: (html: string) => string;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.stripOutputTableMarkers = exports.replaceOutputTableMarkers = exports.getOutputTableCellStyle = exports.buildOutputTableCellStyleAttr = exports.buildOutputTableStyleAttr = exports.serializeInlineStyle = exports.expandOutputTableCellStyle = void 0;
|
|
15
|
-
var DEFAULT_OUTPUT_TABLE_CELL_STYLE = {
|
|
16
|
-
paddingTop: "4px",
|
|
17
|
-
paddingRight: "4px",
|
|
18
|
-
paddingBottom: "4px",
|
|
19
|
-
paddingLeft: "4px",
|
|
20
|
-
borderTopWidth: "1px",
|
|
21
|
-
borderTopStyle: "solid",
|
|
22
|
-
borderTopColor: "#000000",
|
|
23
|
-
borderRightWidth: "1px",
|
|
24
|
-
borderRightStyle: "solid",
|
|
25
|
-
borderRightColor: "#000000",
|
|
26
|
-
borderBottomWidth: "1px",
|
|
27
|
-
borderBottomStyle: "solid",
|
|
28
|
-
borderBottomColor: "#000000",
|
|
29
|
-
borderLeftWidth: "1px",
|
|
30
|
-
borderLeftStyle: "solid",
|
|
31
|
-
borderLeftColor: "#000000",
|
|
32
|
-
};
|
|
33
|
-
var BORDER_SIDES = ["Top", "Right", "Bottom", "Left"];
|
|
34
|
-
var parseBoxShorthand = function (parts) {
|
|
35
|
-
var first = parts[0], second = parts[1], third = parts[2], fourth = parts[3];
|
|
36
|
-
if (parts.length === 1) {
|
|
37
|
-
return [first, first, first, first];
|
|
38
|
-
}
|
|
39
|
-
if (parts.length === 2) {
|
|
40
|
-
return [first, second, first, second];
|
|
41
|
-
}
|
|
42
|
-
if (parts.length === 3) {
|
|
43
|
-
return [first, second, third, second];
|
|
44
|
-
}
|
|
45
|
-
return [first, second, third, fourth];
|
|
46
|
-
};
|
|
47
|
-
var parseBorderShorthand = function (border) {
|
|
48
|
-
var parts = border.trim().split(/\s+/);
|
|
49
|
-
var width = parts.find(function (part) { return /^[0-9.]+(px|pt|em|rem|%)?$/i.test(part); }) || "1px";
|
|
50
|
-
var style = parts.find(function (part) {
|
|
51
|
-
return ["solid", "dashed", "dotted", "double", "none"].includes(part.toLowerCase());
|
|
52
|
-
}) || "solid";
|
|
53
|
-
var color = parts.find(function (part) { return part.startsWith("#") || part.startsWith("rgb"); }) ||
|
|
54
|
-
"#000000";
|
|
55
|
-
return { width: width, style: style, color: color };
|
|
56
|
-
};
|
|
57
|
-
var expandOutputTableCellStyle = function (styles) {
|
|
58
|
-
var expanded = __assign({}, styles);
|
|
59
|
-
if (expanded.padding) {
|
|
60
|
-
var _a = parseBoxShorthand(expanded.padding.trim().split(/\s+/)), top_1 = _a[0], right = _a[1], bottom = _a[2], left = _a[3];
|
|
61
|
-
delete expanded.padding;
|
|
62
|
-
expanded.paddingTop = expanded.paddingTop || top_1;
|
|
63
|
-
expanded.paddingRight = expanded.paddingRight || right;
|
|
64
|
-
expanded.paddingBottom = expanded.paddingBottom || bottom;
|
|
65
|
-
expanded.paddingLeft = expanded.paddingLeft || left;
|
|
66
|
-
}
|
|
67
|
-
if (expanded.border) {
|
|
68
|
-
var _b = parseBorderShorthand(expanded.border), width_1 = _b.width, style_1 = _b.style, color_1 = _b.color;
|
|
69
|
-
delete expanded.border;
|
|
70
|
-
BORDER_SIDES.forEach(function (side) {
|
|
71
|
-
var widthKey = "border".concat(side, "Width");
|
|
72
|
-
var styleKey = "border".concat(side, "Style");
|
|
73
|
-
var colorKey = "border".concat(side, "Color");
|
|
74
|
-
expanded[widthKey] = expanded[widthKey] || width_1;
|
|
75
|
-
expanded[styleKey] = expanded[styleKey] || style_1;
|
|
76
|
-
expanded[colorKey] = expanded[colorKey] || color_1;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return expanded;
|
|
80
|
-
};
|
|
81
|
-
exports.expandOutputTableCellStyle = expandOutputTableCellStyle;
|
|
82
|
-
var camelToKebab = function (property) {
|
|
83
|
-
return property.replace(/[A-Z]/g, function (match) { return "-".concat(match.toLowerCase()); });
|
|
84
|
-
};
|
|
85
|
-
var serializeInlineStyle = function (styles) {
|
|
86
|
-
return Object.entries(styles)
|
|
87
|
-
.filter(function (_a) {
|
|
88
|
-
var value = _a[1];
|
|
89
|
-
return value !== undefined && value !== "";
|
|
90
|
-
})
|
|
91
|
-
.map(function (_a) {
|
|
92
|
-
var property = _a[0], value = _a[1];
|
|
93
|
-
return "".concat(camelToKebab(property), ":").concat(value);
|
|
94
|
-
})
|
|
95
|
-
.join(";");
|
|
96
|
-
};
|
|
97
|
-
exports.serializeInlineStyle = serializeInlineStyle;
|
|
98
|
-
var buildOutputTableStyleAttr = function (tableStyle) {
|
|
99
|
-
var styles = [
|
|
100
|
-
"table-layout:fixed",
|
|
101
|
-
"border-spacing:0",
|
|
102
|
-
"border-collapse:collapse",
|
|
103
|
-
];
|
|
104
|
-
if (typeof (tableStyle === null || tableStyle === void 0 ? void 0 : tableStyle.width) === "number") {
|
|
105
|
-
styles.push("width:".concat(tableStyle.width, "%"));
|
|
106
|
-
}
|
|
107
|
-
return " style=\"".concat(styles.join(";"), "\"");
|
|
108
|
-
};
|
|
109
|
-
exports.buildOutputTableStyleAttr = buildOutputTableStyleAttr;
|
|
110
|
-
var buildOutputTableCellStyleAttr = function (cellStyle) {
|
|
111
|
-
var styles = (0, exports.expandOutputTableCellStyle)(__assign(__assign({}, DEFAULT_OUTPUT_TABLE_CELL_STYLE), (cellStyle || {})));
|
|
112
|
-
var serialized = (0, exports.serializeInlineStyle)(styles);
|
|
113
|
-
return serialized.length > 0 ? " style=\"".concat(serialized, "\"") : "";
|
|
114
|
-
};
|
|
115
|
-
exports.buildOutputTableCellStyleAttr = buildOutputTableCellStyleAttr;
|
|
116
|
-
var getOutputTableCellStyle = function (option) {
|
|
117
|
-
return option.meta.cellStyle;
|
|
118
|
-
};
|
|
119
|
-
exports.getOutputTableCellStyle = getOutputTableCellStyle;
|
|
120
|
-
var OUTPUT_TABLE_MARKER_REGEX = /<output-table\s+data-id="(\d+)"\s*><\/output-table>/gi;
|
|
121
|
-
var replaceOutputTableMarkers = function (html, renderTable) {
|
|
122
|
-
return html.replace(OUTPUT_TABLE_MARKER_REGEX, function (_match, tableId) {
|
|
123
|
-
return renderTable(parseInt(tableId, 10));
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
exports.replaceOutputTableMarkers = replaceOutputTableMarkers;
|
|
127
|
-
var stripOutputTableMarkers = function (html) {
|
|
128
|
-
return html.replace(OUTPUT_TABLE_MARKER_REGEX, "");
|
|
129
|
-
};
|
|
130
|
-
exports.stripOutputTableMarkers = stripOutputTableMarkers;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SectionRoleV3, SectionV3 } from "@legalplace/models-v3-types";
|
|
2
|
-
export type OutputRegionRole = SectionRoleV3;
|
|
3
|
-
export declare const isBodySection: (section: SectionV3) => boolean;
|
|
4
|
-
export declare const isRegionSection: (section: SectionV3, role: OutputRegionRole) => boolean;
|
|
5
|
-
export declare const getSectionIdsForRole: (sections: Record<string, SectionV3>, role: OutputRegionRole) => number[];
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSectionIdsForRole = exports.isRegionSection = exports.isBodySection = void 0;
|
|
4
|
-
var isBodySection = function (section) {
|
|
5
|
-
return !section.role || section.role === "body";
|
|
6
|
-
};
|
|
7
|
-
exports.isBodySection = isBodySection;
|
|
8
|
-
var isRegionSection = function (section, role) {
|
|
9
|
-
if (role === "body")
|
|
10
|
-
return (0, exports.isBodySection)(section);
|
|
11
|
-
return section.role === role;
|
|
12
|
-
};
|
|
13
|
-
exports.isRegionSection = isRegionSection;
|
|
14
|
-
var getSectionIdsForRole = function (sections, role) {
|
|
15
|
-
return Object.keys(sections)
|
|
16
|
-
.map(function (sectionId) { return parseInt(sectionId, 10); })
|
|
17
|
-
.filter(function (sectionId) {
|
|
18
|
-
var section = sections[sectionId];
|
|
19
|
-
return section && (0, exports.isRegionSection)(section, role);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
exports.getSectionIdsForRole = getSectionIdsForRole;
|