@legalplace/prerenderx 3.6.7 → 3.6.8-staging.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.
@@ -1,4 +1,15 @@
1
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
+ };
2
13
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
14
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
15
  if (ar || !(i in from)) {
@@ -10,6 +21,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10
21
  };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.parseDocumentNameWithVariables = exports.parseOutputWithVariables = exports.getRelatedVariablesValues = void 0;
24
+ var yousign_1 = require("@legalplace/yousign");
13
25
  var frenchNumber = function (value) {
14
26
  var result = typeof value === "number" ? value.toString() : value;
15
27
  if (/^([0-9]+)\.([0-9]+)$/.test(result.trim()))
@@ -67,6 +79,16 @@ var parseOutputWithVariables = function (output, index, variables, autonums) {
67
79
  return "<span data-signature=\"mention\" data-signature-id=\"" + signatureId + "\" data-signer-index=\"" + index + "\" data-signer-mention=\"" + mention + "\"></span>";
68
80
  });
69
81
  parsedOutput = parsedOutput.replace(/\[date\]/g, function () { return '<span data-signature="date"></span>'; });
82
+ parsedOutput = parsedOutput.replace(yousign_1.yousignTagFieldRegex, function (v, paramsString) {
83
+ try {
84
+ var parsedParams = (0, yousign_1.parseYousignTag)("[yousign:" + paramsString + "]");
85
+ return (0, yousign_1.convertParamsToHtmlTag)(__assign(__assign({}, parsedParams), { signerIndex: index }));
86
+ }
87
+ catch (error) {
88
+ console.error("Failed to parse Yousign tag: " + v, error);
89
+ return v;
90
+ }
91
+ });
70
92
  autonums.forEach(function (currentAn) {
71
93
  if (currentAn[3] === null)
72
94
  parsedOutput = parsedOutput.replace("[" + currentAn[0] + ":" + currentAn[1] + "]", "<span class=\"" + currentAn[0] + "\">" + currentAn[2] + "</span>");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/prerenderx",
3
- "version": "3.6.7",
3
+ "version": "3.6.8-staging.1",
4
4
  "description": "PrerenderX",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/prerenderx",
@@ -23,20 +23,18 @@
23
23
  "@legalplace/ovc-converter": "^2.0.33",
24
24
  "@legalplace/prettier-config": "^2.1.3",
25
25
  "@legalplace/referencesparser": "^3.1.26",
26
+ "@legalplace/yousign": "0.6.37-staging.0",
26
27
  "crypto": "^1.0.1",
27
- "standard-version": "^9.3.1",
28
- "typescript": "4.4.3"
28
+ "standard-version": "^9.3.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/core": "^7.7.2",
32
32
  "@babel/preset-typescript": "^7.7.2",
33
33
  "@legalplace/types": "^2.12.0",
34
34
  "@types/jest": "^24.0.15",
35
- "@types/node": "^20.8.10",
36
35
  "jest": "^24.8.0",
37
36
  "redux-mock-store": "^1.5.3",
38
37
  "ts-jest": "^24.0.2"
39
38
  },
40
- "prettier": "@legalplace/prettier-config",
41
- "gitHead": "7c8743850e111b4cfd3b1feedfdfcb87d89ba8c7"
39
+ "prettier": "@legalplace/prettier-config"
42
40
  }
@@ -1,4 +1,9 @@
1
1
  import type { Types } from "@legalplace/referencesparser";
2
+ import {
3
+ convertParamsToHtmlTag,
4
+ parseYousignTag,
5
+ yousignTagFieldRegex,
6
+ } from "@legalplace/yousign";
2
7
  import type InputsType from "@legalplace/types/dist/inputs";
3
8
 
4
9
  /**
@@ -156,6 +161,21 @@ export const parseOutputWithVariables: parseOutputT = (
156
161
  () => '<span data-signature="date"></span>'
157
162
  );
158
163
 
164
+ // Replace Yousign tags
165
+ parsedOutput = parsedOutput.replace(
166
+ yousignTagFieldRegex,
167
+ (v, paramsString) => {
168
+ try {
169
+ const parsedParams = parseYousignTag(`[yousign:${paramsString}]`);
170
+ return convertParamsToHtmlTag({ ...parsedParams, signerIndex: index });
171
+ } catch (error) {
172
+ // eslint-disable-next-line no-console
173
+ console.error(`Failed to parse Yousign tag: ${v}`, error);
174
+ return v;
175
+ }
176
+ }
177
+ );
178
+
159
179
  // Inserting autonums
160
180
  autonums.forEach((currentAn) => {
161
181
  if (currentAn[3] === null)
package/tsconfig.json CHANGED
@@ -7,11 +7,10 @@
7
7
  "lib": ["es2018"],
8
8
  "outDir": "./dist/",
9
9
  "strict": true,
10
- "typeRoots": ["node_modules/@types"],
11
- "types": ["node"],
12
10
  "esModuleInterop": true,
13
11
  "removeComments": true,
14
- "declaration": true
12
+ "declaration": true,
13
+ "experimentalDecorators": true
15
14
  },
16
15
  "include": ["src"],
17
16
  "exclude": ["node_modules"]