@legalplace/prerenderx 3.9.16 → 3.9.18
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
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.18](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.9.17...@legalplace/prerenderx@3.9.18) (2026-10-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @legalplace/prerenderx
|
|
9
|
+
|
|
10
|
+
## [3.9.17](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.9.16...@legalplace/prerenderx@3.9.17) (2026-10-15)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- add day offset and format to signature date tag api[#124](https://git.legalplace.eu/legalplace/prerenderx/issues/124)j4fvkq4f ([33802bd](https://git.legalplace.eu/legalplace/prerenderx/commits/33802bdbb5bd8aa15b98cc3ca1b1c510c13e59e2)), closes [api#124j4fvkq4](https://git.legalplace.eu/api/issues/124j4fvkq4) [api#124j4fvkq4](https://git.legalplace.eu/api/issues/124j4fvkq4)
|
|
15
|
+
|
|
6
16
|
## [3.9.16](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.9.15...@legalplace/prerenderx@3.9.16) (2026-10-14)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @legalplace/prerenderx
|
|
@@ -56,6 +56,18 @@ var getRelatedVariablesValues = function (optionId, index, variables, ovc, refer
|
|
|
56
56
|
return variablesValues;
|
|
57
57
|
};
|
|
58
58
|
exports.getRelatedVariablesValues = getRelatedVariablesValues;
|
|
59
|
+
var SIGNATURE_DATE_FORMATS = [
|
|
60
|
+
"dd/MM/yyyy",
|
|
61
|
+
"dd-MM-yyyy",
|
|
62
|
+
"dd.MM.yyyy",
|
|
63
|
+
"yyyy-MM-dd",
|
|
64
|
+
"MM/dd/yyyy",
|
|
65
|
+
"dd MMMM yyyy",
|
|
66
|
+
"MMMM dd, yyyy",
|
|
67
|
+
"MMM dd, yyyy",
|
|
68
|
+
];
|
|
69
|
+
var DEFAULT_SIGNATURE_DATE_FORMAT = "dd/MM/yyyy";
|
|
70
|
+
var signatureDateWithParamsRegex = new RegExp("\\[signature:date(?:\\+([0-9]{1,3}))?:([0-9]+)(?::(".concat(SIGNATURE_DATE_FORMATS.map(function (format) { return format.replace(/[./-]/g, "\\$&"); }).join("|"), "))?\\]"), "g");
|
|
59
71
|
var parseOutputWithVariables = function (output, index, variables, autonums) {
|
|
60
72
|
var parsedOutput = "".concat(output);
|
|
61
73
|
Object.keys(variables).forEach(function (variableId) {
|
|
@@ -75,6 +87,9 @@ var parseOutputWithVariables = function (output, index, variables, autonums) {
|
|
|
75
87
|
parsedOutput = parsedOutput.replace(/\[signature:date:([0-9]+)\]/g, function (v, signatureId) {
|
|
76
88
|
return "<span data-signature=\"date\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\"></span>");
|
|
77
89
|
});
|
|
90
|
+
parsedOutput = parsedOutput.replace(signatureDateWithParamsRegex, function (v, offset, signatureId, format) {
|
|
91
|
+
return "<span data-signature=\"date\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\" data-signature-offset=\"").concat(offset !== null && offset !== void 0 ? offset : 0, "\" data-signature-format=\"").concat(format !== null && format !== void 0 ? format : DEFAULT_SIGNATURE_DATE_FORMAT, "\"></span>");
|
|
92
|
+
});
|
|
78
93
|
parsedOutput = parsedOutput.replace(/\[signature:mention:([0-9]+):(?:"|")((?:[^"&]|\\.)*?)(?:"|")\]/g, function (v, signatureId, mention) {
|
|
79
94
|
return "<span data-signature=\"mention\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\" data-signer-mention=\"").concat(mention, "\"></span>");
|
|
80
95
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/prerenderx",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.18",
|
|
4
4
|
"description": "PrerenderX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/prerenderx",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"release": "standard-version -a --no-verify"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@legalplace/conditions-runner": "^2.4.
|
|
19
|
+
"@legalplace/conditions-runner": "^2.4.13",
|
|
20
20
|
"@legalplace/lplogic": "2.4.1",
|
|
21
|
-
"@legalplace/models-v3-types": "^5.20.
|
|
22
|
-
"@legalplace/ovc-converter": "^2.2.
|
|
23
|
-
"@legalplace/referencesparser": "^3.4.
|
|
24
|
-
"@legalplace/yousign": "^0.9.
|
|
21
|
+
"@legalplace/models-v3-types": "^5.20.5",
|
|
22
|
+
"@legalplace/ovc-converter": "^2.2.37",
|
|
23
|
+
"@legalplace/referencesparser": "^3.4.13",
|
|
24
|
+
"@legalplace/yousign": "^0.9.29",
|
|
25
25
|
"crypto": "^1.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@legalplace/eslint-config": "^2.3.1",
|
|
31
31
|
"@legalplace/eslint-config-base": "^1.2.1",
|
|
32
32
|
"@legalplace/prettier-config": "^2.1.3",
|
|
33
|
-
"@legalplace/types": "^2.25.
|
|
33
|
+
"@legalplace/types": "^2.25.4",
|
|
34
34
|
"@types/jest": "^24.0.15",
|
|
35
35
|
"jest": "^24.8.0",
|
|
36
36
|
"jest-environment-jsdom": "^24.9.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"ts-jest": "^24.0.2"
|
|
40
40
|
},
|
|
41
41
|
"prettier": "@legalplace/prettier-config",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "deff3ca0b5c4cb8ac7d74bfcc6fcc15705d341a1"
|
|
43
43
|
}
|
package/src/libs/OutputParser.ts
CHANGED
|
@@ -92,6 +92,26 @@ export const getRelatedVariablesValues: getRelatedVarsT = (
|
|
|
92
92
|
* @param variables Variables values list
|
|
93
93
|
* @param autonums Autonums values
|
|
94
94
|
*/
|
|
95
|
+
|
|
96
|
+
const SIGNATURE_DATE_FORMATS = [
|
|
97
|
+
"dd/MM/yyyy",
|
|
98
|
+
"dd-MM-yyyy",
|
|
99
|
+
"dd.MM.yyyy",
|
|
100
|
+
"yyyy-MM-dd",
|
|
101
|
+
"MM/dd/yyyy",
|
|
102
|
+
"dd MMMM yyyy",
|
|
103
|
+
"MMMM dd, yyyy",
|
|
104
|
+
"MMM dd, yyyy",
|
|
105
|
+
];
|
|
106
|
+
const DEFAULT_SIGNATURE_DATE_FORMAT = "dd/MM/yyyy";
|
|
107
|
+
// Must run after the bare [signature:date:<id>] replacement, which it would otherwise also match
|
|
108
|
+
const signatureDateWithParamsRegex = new RegExp(
|
|
109
|
+
`\\[signature:date(?:\\+([0-9]{1,3}))?:([0-9]+)(?::(${SIGNATURE_DATE_FORMATS.map(
|
|
110
|
+
(format) => format.replace(/[./-]/g, "\\$&")
|
|
111
|
+
).join("|")}))?\\]`,
|
|
112
|
+
"g"
|
|
113
|
+
);
|
|
114
|
+
|
|
95
115
|
type autonumsType = [string, string, number, string | null][];
|
|
96
116
|
type parseOutputT = (
|
|
97
117
|
output: string,
|
|
@@ -147,6 +167,16 @@ export const parseOutputWithVariables: parseOutputT = (
|
|
|
147
167
|
(v, signatureId) =>
|
|
148
168
|
`<span data-signature="date" data-signature-id="${signatureId}" data-signer-index="${index}"></span>`
|
|
149
169
|
);
|
|
170
|
+
// Signature date tag with a day offset and/or a display format, e.g. [signature:date+364:1:dd/MM/yyyy]
|
|
171
|
+
parsedOutput = parsedOutput.replace(
|
|
172
|
+
signatureDateWithParamsRegex,
|
|
173
|
+
(v, offset, signatureId, format) =>
|
|
174
|
+
`<span data-signature="date" data-signature-id="${signatureId}" data-signer-index="${index}" data-signature-offset="${
|
|
175
|
+
offset ?? 0
|
|
176
|
+
}" data-signature-format="${
|
|
177
|
+
format ?? DEFAULT_SIGNATURE_DATE_FORMAT
|
|
178
|
+
}"></span>`
|
|
179
|
+
);
|
|
150
180
|
|
|
151
181
|
// Signature mention tag
|
|
152
182
|
parsedOutput = parsedOutput.replace(
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { parseOutputWithVariables } from "../src/libs/OutputParser";
|
|
2
|
+
|
|
3
|
+
const parse = (output: string, index = 0) =>
|
|
4
|
+
parseOutputWithVariables(output, index, {}, []);
|
|
5
|
+
|
|
6
|
+
describe("parseOutputWithVariables - signature date tags", () => {
|
|
7
|
+
it("keeps [signature:date:<id>] unchanged (no offset nor format attributes)", () => {
|
|
8
|
+
expect(parse("[signature:date:1]")).toBe(
|
|
9
|
+
'<span data-signature="date" data-signature-id="1" data-signer-index="0"></span>'
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("adds the day offset and the default format for [signature:date+X:<id>]", () => {
|
|
14
|
+
expect(parse("[signature:date+364:1]", 2)).toBe(
|
|
15
|
+
'<span data-signature="date" data-signature-id="1" data-signer-index="2" data-signature-offset="364" data-signature-format="dd/MM/yyyy"></span>'
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("adds a zero offset and the given format for [signature:date:<id>:<format>]", () => {
|
|
20
|
+
expect(parse("[signature:date:1:dd MMMM yyyy]")).toBe(
|
|
21
|
+
'<span data-signature="date" data-signature-id="1" data-signer-index="0" data-signature-offset="0" data-signature-format="dd MMMM yyyy"></span>'
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("supports both offset and format", () => {
|
|
26
|
+
expect(parse("[signature:date+30:2:MMMM dd, yyyy]")).toBe(
|
|
27
|
+
'<span data-signature="date" data-signature-id="2" data-signer-index="0" data-signature-offset="30" data-signature-format="MMMM dd, yyyy"></span>'
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it.each([
|
|
32
|
+
"[signature:date+abc:1]",
|
|
33
|
+
"[signature:date+1000:1]",
|
|
34
|
+
"[signature:date+364]",
|
|
35
|
+
"[signature:date:1:yyyy]",
|
|
36
|
+
// Not supported by Yousign signature_date fields
|
|
37
|
+
"[signature:date-30:1]",
|
|
38
|
+
"[signature:date:1:dd/MM]",
|
|
39
|
+
])("leaves the malformed tag %s visible", (tag) => {
|
|
40
|
+
expect(parse(tag)).toBe(tag);
|
|
41
|
+
});
|
|
42
|
+
});
|