@escapenavigator/utils 1.10.91 → 1.10.92

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,9 +1,36 @@
1
1
  "use strict";
2
+ /* eslint-disable no-prototype-builtins */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.transformText = void 0;
4
- /* eslint-disable no-prototype-builtins */
5
+ const BOOKING_BUTTON_STYLE = `
6
+ display:block;
7
+ width: 100%;
8
+ max-width: 300px;
9
+ background:#2174EF;
10
+ color:#FFFFFF;
11
+ margin-top: 16px;
12
+ font-family:Montserrat, Arial, sans-serif;
13
+ font-size:14px;
14
+ font-style:normal;
15
+ font-weight:700;
16
+ line-height: 48px;
17
+ height: 48px;
18
+ text-decoration:none;
19
+ text-transform:none;
20
+ mso-padding-alt:0px;
21
+ border-radius:6px;
22
+ text-align: center;
23
+ `.replace(/\n\s*/g, ' ').trim();
5
24
  const transformText = (text, obj) => {
6
25
  let res = text || '';
26
+ const bookingButtonRegex = /\{\{#manageBooking\}\}([\s\S]*?)\{\{\/manageBooking\}\}/g;
27
+ res = res.replace(bookingButtonRegex, (match, buttonText) => {
28
+ const link = obj.bookingManagementLink;
29
+ if (!link)
30
+ return buttonText;
31
+ const trimmedText = buttonText.trim() || 'Управлять бронью';
32
+ return `<a style="${BOOKING_BUTTON_STYLE}" target="_blank" href="${link}">${trimmedText}</a>`;
33
+ });
7
34
  const ifRegex = /\{\{#if\s+(\w+)\}\}([\s\S]*?)\{\{\/if\}\}/g;
8
35
  res = res.replace(ifRegex, (match, conditionKey, innerContent) => {
9
36
  if (obj.hasOwnProperty(conditionKey) && obj[conditionKey]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escapenavigator/utils",
3
- "version": "1.10.91",
3
+ "version": "1.10.92",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,7 +14,7 @@
14
14
  "test": "jest"
15
15
  },
16
16
  "dependencies": {
17
- "@escapenavigator/types": "^1.10.87",
17
+ "@escapenavigator/types": "^1.10.88",
18
18
  "axios": "^0.21.4",
19
19
  "class-transformer": "^0.5.1",
20
20
  "class-validator": "^0.13.2",
@@ -47,5 +47,5 @@
47
47
  "utility-types": "^3.10.0",
48
48
  "uuid": "^8.3.2"
49
49
  },
50
- "gitHead": "2478b4a96690223994764c94d3f71615218e71ae"
50
+ "gitHead": "fd7baa4ffbe73414029614e379de7986dc4044db"
51
51
  }