@coveops/abi 1.0.1 → 1.0.3

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-355878fc.js');
6
- const index$1 = require('./index-8f6652e1.js');
6
+ const index$1 = require('./index-20ac4bdb.js');
7
7
  const resultTemplateDecorators881a4c8e = require('./result-template-decorators-881a4c8e-4ff46481.js');
8
8
  require('./headless.esm-085e70ed-f2e18485.js');
9
9
 
@@ -35,7 +35,7 @@ const FaqPopupComponent = class {
35
35
  }
36
36
  }
37
37
  openFAQModal(result) {
38
- var _a, _b, _c, _d;
38
+ var _a, _b, _c, _d, _e, _f, _g;
39
39
  if (this.bindings) {
40
40
  const { logClickEvent } = index$1.Fde(this.bindings.engine);
41
41
  const logClickPayload = {
@@ -52,7 +52,7 @@ const FaqPopupComponent = class {
52
52
  const tableEl = document.createElement('table');
53
53
  const questionElement = document.createElement("tr");
54
54
  questionElement.className = "question-row";
55
- questionElement.innerHTML = '<td>Question: </td> <td>' + (((_a = this.result) === null || _a === void 0 ? void 0 : _a.title) || '') + '</td>'
55
+ questionElement.innerHTML = '<td>Question: <a href="https://anheuserbuschinbev.sharepoint.com" autofocus="true" style="display:none;"></a></td> <td>' + (((_a = this.result) === null || _a === void 0 ? void 0 : _a.title) || '') + '</td>'
56
56
  + '<div id="faq-modal-close-button"><svg width="48" height="49" viewBox="0 0 48 49" fill="black" xmlns="http://www.w3.org/2000/svg"><rect y="0.5" width="48" height="48" rx="24" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M22.5382 24.5L15 16.9618L16.4618 15.5L24 23.0382L31.5382 15.5L33 16.9618L25.4618 24.5L33 32.0382L31.5382 33.5L24 25.9618L16.4618 33.5L15 32.0382L22.5382 24.5Z" fill="#17171A"/></svg></div>';
57
57
  tableEl.appendChild(questionElement);
58
58
  const answerElement = document.createElement('tr');
@@ -62,17 +62,48 @@ const FaqPopupComponent = class {
62
62
  answerElement.appendChild(answerTitleElement);
63
63
  // Create a new element to contain the answer content
64
64
  const answerContentElement = document.createElement('td');
65
- answerContentElement.innerHTML = ((_b = this.result) === null || _b === void 0 ? void 0 : _b.raw.answer) || '';
65
+ if ((_c = (_b = this.result) === null || _b === void 0 ? void 0 : _b.raw) === null || _c === void 0 ? void 0 : _c.answer) {
66
+ let value = (_e = (_d = this.result) === null || _d === void 0 ? void 0 : _d.raw) === null || _e === void 0 ? void 0 : _e.answer;
67
+ try {
68
+ var els = new DOMParser().parseFromString(value, 'text/html');
69
+ var html = '';
70
+ Array.from(els.children).forEach(el => {
71
+ var _a;
72
+ el.querySelectorAll('a').forEach(a => {
73
+ if (a.href.startsWith(window.location.origin) && a.href.indexOf('/sites/') > -1) {
74
+ a.href = a.href.replace(window.location.origin, 'https://anheuserbuschinbev.sharepoint.com');
75
+ }
76
+ if (a.href.startsWith(window.location.origin) && a.href.match(/:.:\/./)) {
77
+ a.href = a.href.replace(window.location.origin, 'https://anheuserbuschinbev.sharepoint.com');
78
+ }
79
+ });
80
+ el.querySelectorAll('img').forEach(a => {
81
+ if (a.src.startsWith(window.location.origin) && a.src.indexOf('/sites/') > -1) {
82
+ a.src = a.src.replace(window.location.origin, 'https://anheuserbuschinbev.sharepoint.com');
83
+ }
84
+ if (a.src.startsWith(window.location.origin) && a.src.match(/:.:\/./)) {
85
+ a.src = a.src.replace(window.location.origin, 'https://anheuserbuschinbev.sharepoint.com');
86
+ }
87
+ });
88
+ html = html + ((_a = el.querySelector('body')) === null || _a === void 0 ? void 0 : _a.innerHTML);
89
+ });
90
+ answerContentElement.innerHTML = html;
91
+ }
92
+ catch (e) {
93
+ console.log(e);
94
+ answerContentElement.innerHTML = value;
95
+ }
96
+ }
66
97
  // Append the answer content element to the answer element
67
98
  answerElement.appendChild(answerContentElement);
68
99
  // Now, the answer element has the title and the content properly appended
69
100
  tableEl.appendChild(answerElement);
70
- if ((_c = this.result) === null || _c === void 0 ? void 0 : _c.raw.category) {
101
+ if ((_f = this.result) === null || _f === void 0 ? void 0 : _f.raw.category) {
71
102
  const categoryElement = document.createElement("tr");
72
103
  categoryElement.innerHTML = '<td> Category: </td><td>' + this.result.raw.category + '</td>';
73
104
  tableEl.appendChild(categoryElement);
74
105
  }
75
- if ((_d = this.result) === null || _d === void 0 ? void 0 : _d.raw.newmoreinfo) {
106
+ if ((_g = this.result) === null || _g === void 0 ? void 0 : _g.raw.newmoreinfo) {
76
107
  const linkElement = document.createElement("tr");
77
108
  const linkUrl = this.result.raw.newmoreinfo;
78
109
  linkElement.innerHTML = '<td> Link: </td><td> <a href="' + linkUrl + '" target="_blank">' + linkUrl + '</a> </td>';