cec-nuxt-lib 0.10.3 → 0.10.5
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/dist/module.d.mts +2 -1
- package/dist/module.json +5 -1
- package/dist/runtime/components/cecBreadcrumb.vue +27 -50
- package/dist/runtime/components/cecBreadcrumb.vue.d.ts +2 -0
- package/dist/runtime/components/cecCanvas.vue +148 -220
- package/dist/runtime/components/cecCanvas.vue.d.ts +12 -0
- package/dist/runtime/components/cecFeedback.vue +11 -11
- package/dist/runtime/components/cecFeedback.vue.d.ts +28 -0
- package/dist/runtime/components/cecFooter.vue.d.ts +2 -0
- package/dist/runtime/components/cecHeader.vue +104 -149
- package/dist/runtime/components/cecHeader.vue.d.ts +2 -0
- package/dist/runtime/components/cecMeta.vue +73 -80
- package/dist/runtime/components/cecMeta.vue.d.ts +2 -0
- package/dist/runtime/components/chatbot.vue +50 -65
- package/dist/runtime/components/chatbot.vue.d.ts +2 -0
- package/dist/runtime/components/inThisSection.vue +2 -2
- package/dist/runtime/components/inThisSection.vue.d.ts +2 -0
- package/dist/runtime/components/pagination.vue +5 -6
- package/dist/runtime/components/pagination.vue.d.ts +2 -0
- package/dist/types.d.mts +2 -15
- package/package.json +24 -17
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -7
- package/dist/types.d.ts +0 -16
- /package/dist/runtime/composables/{useMakePages.mjs → useMakePages.js} +0 -0
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { useState } from
|
|
3
|
-
import { createRenderer, text } from
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const listItems = useState('listItems');
|
|
8
|
-
const questions = useState('questions');
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useState } from "#app";
|
|
3
|
+
import { createRenderer, text } from "@contensis/canvas-html";
|
|
4
|
+
const getCanvas = (data) => renderer({ data });
|
|
5
|
+
const listItems = useState("listItems");
|
|
6
|
+
const questions = useState("questions");
|
|
9
7
|
let canvasHtml;
|
|
10
|
-
|
|
11
8
|
const props = defineProps({
|
|
12
9
|
canvas: {
|
|
13
10
|
type: Object,
|
|
14
|
-
required: true
|
|
15
|
-
}
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
const { canvas } = props;
|
|
19
|
-
|
|
20
15
|
const sizeString = (n) => {
|
|
21
|
-
if (n <
|
|
16
|
+
if (n < 1e3) {
|
|
22
17
|
return `${n}B`;
|
|
23
|
-
} else if (n <
|
|
24
|
-
return `${Math.ceil(n /
|
|
18
|
+
} else if (n < 1e3 * 1e3) {
|
|
19
|
+
return `${Math.ceil(n / 1e3)}KB`;
|
|
25
20
|
} else {
|
|
26
|
-
return `${(n /
|
|
21
|
+
return `${(n / 1e3 / 1e3).toFixed(1)}MB`;
|
|
27
22
|
}
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
const abbr = (data) => {
|
|
31
25
|
return `<abbr title="${text(data.entryDescription)}">${text(data.entryTitle)}</abbr>`;
|
|
32
26
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
let data = { ...props.block.value, id: props.block.id };
|
|
27
|
+
const accWithAssets = (props2) => {
|
|
28
|
+
let data = { ...props2.block.value, id: props2.block.id };
|
|
36
29
|
return accordion(data);
|
|
37
30
|
};
|
|
38
|
-
|
|
39
31
|
const accordion = (data) => {
|
|
40
32
|
if (!data.id) {
|
|
41
33
|
data.id = data.sys.id;
|
|
42
34
|
}
|
|
43
|
-
let html = data.expandAll
|
|
44
|
-
? `
|
|
35
|
+
let html = data.expandAll ? `
|
|
45
36
|
<div class="text-end">
|
|
46
37
|
<button
|
|
47
38
|
id="${data.id}"
|
|
@@ -51,8 +42,7 @@ const accordion = (data) => {
|
|
|
51
42
|
Expand all
|
|
52
43
|
</button>
|
|
53
44
|
</div>
|
|
54
|
-
`
|
|
55
|
-
: '';
|
|
45
|
+
` : "";
|
|
56
46
|
html += `
|
|
57
47
|
<p class="sr-only">
|
|
58
48
|
The following checkboxes are used for accordion drop-downs. When
|
|
@@ -64,23 +54,20 @@ const accordion = (data) => {
|
|
|
64
54
|
let accId = `${data.id}_${i}`;
|
|
65
55
|
if (e.pdfs?.length) {
|
|
66
56
|
let pdfs = e.pdfs.reduce((acc, p) => {
|
|
67
|
-
return
|
|
68
|
-
acc +
|
|
69
|
-
`
|
|
57
|
+
return acc + `
|
|
70
58
|
<li>
|
|
71
59
|
<a href="${processUri(p.sys.uri)}"
|
|
72
60
|
>${p.title[0].toUpperCase()}${p.title.slice(1)}
|
|
73
61
|
(${p.sys.contentTypeId.toUpperCase()},
|
|
74
62
|
${sizeString(p.sys.properties.fileSize)})
|
|
75
63
|
</a>
|
|
76
|
-
</li
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
e.content = `${e.content ? e.content : ''}${pdfs}</ul>`;
|
|
64
|
+
</li>`;
|
|
65
|
+
}, "<ul>");
|
|
66
|
+
e.content = `${e.content ? e.content : ""}${pdfs}</ul>`;
|
|
80
67
|
}
|
|
81
|
-
let article = `${e.content ? e.content :
|
|
68
|
+
let article = `${e.content ? e.content : ""}${e.genericList ? genList(e.genericList, accId) : ""}`;
|
|
82
69
|
if (!article.length) {
|
|
83
|
-
article =
|
|
70
|
+
article = "<p>Nothing to display at present</p>";
|
|
84
71
|
}
|
|
85
72
|
html += `
|
|
86
73
|
<input class="${data.id}"
|
|
@@ -93,41 +80,28 @@ const accordion = (data) => {
|
|
|
93
80
|
</article>
|
|
94
81
|
`;
|
|
95
82
|
});
|
|
96
|
-
html +=
|
|
83
|
+
html += "</section>";
|
|
97
84
|
return html;
|
|
98
85
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return accordion({ ...props.block.value, id: props.block.id });
|
|
86
|
+
const accordionComponent = (props2) => {
|
|
87
|
+
return accordion({ ...props2.block.value, id: props2.block.id });
|
|
102
88
|
};
|
|
103
|
-
|
|
104
89
|
const anchor = (data) => {
|
|
105
90
|
return `<${data.tag} id="${data.id}">${data.text}</${data.tag}>`;
|
|
106
91
|
};
|
|
107
|
-
|
|
108
92
|
const carousel = (data, id) => {
|
|
109
|
-
// Create the indicators
|
|
110
93
|
let indicators = data.carouselComponent.reduce((acc, _, i) => {
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
`<button type="button" data-bs-target="#${id}-indicators" data-bs-slide-to="${i}" class="${i ? '' : 'active'}" aria-current="${i ? '' : 'true'}" aria-label="Slide ${i}">${i + 1}</button>`
|
|
114
|
-
);
|
|
115
|
-
}, '');
|
|
116
|
-
|
|
117
|
-
// Create the slides
|
|
94
|
+
return acc + `<button type="button" data-bs-target="#${id}-indicators" data-bs-slide-to="${i}" class="${i ? "" : "active"}" aria-current="${i ? "" : "true"}" aria-label="Slide ${i}">${i + 1}</button>`;
|
|
95
|
+
}, "");
|
|
118
96
|
let slides = data.carouselComponent.reduce((acc, e, i) => {
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
`<div class="carousel-item ${i ? '' : 'active'}">
|
|
122
|
-
${e.link.target ? '<a class="innerLink" href="' + e.link.target + '"><span class="hidden">' + e.link.label + '</span></a>' : ''}
|
|
97
|
+
return acc + `<div class="carousel-item ${i ? "" : "active"}">
|
|
98
|
+
${e.link.target ? '<a class="innerLink" href="' + e.link.target + '"><span class="hidden">' + e.link.label + "</span></a>" : ""}
|
|
123
99
|
<img src="${e.image.asset.sys.uri}" class="d-block w-100" alt="${e.image.altText}">
|
|
124
100
|
<div class="carousel-caption d-none d-md-block">
|
|
125
101
|
${e.content}
|
|
126
102
|
</div>
|
|
127
|
-
</div
|
|
128
|
-
|
|
129
|
-
}, '');
|
|
130
|
-
// Return the component
|
|
103
|
+
</div>`;
|
|
104
|
+
}, "");
|
|
131
105
|
return `
|
|
132
106
|
<div id="${id}-indicators" class="carousel slide">
|
|
133
107
|
<div class="carousel-indicators ">
|
|
@@ -150,16 +124,14 @@ const carousel = (data, id) => {
|
|
|
150
124
|
</button>
|
|
151
125
|
</div>`;
|
|
152
126
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
let item = props.block?.value;
|
|
127
|
+
const cecButton = (props2) => {
|
|
128
|
+
let item = props2.block?.value;
|
|
156
129
|
let inner = item.text.length > 20 ? `<small>${item.text}</small>` : item.text;
|
|
157
|
-
let title = item.titleText?.length ? `title="${item.titleText}"` :
|
|
130
|
+
let title = item.titleText?.length ? `title="${item.titleText}"` : "";
|
|
158
131
|
return `<a ${title} class="cec-button" href="${item.url}">${inner}</a>`;
|
|
159
132
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let item = props.block?.value;
|
|
133
|
+
const centralColumn = (props2) => {
|
|
134
|
+
let item = props2.block?.value;
|
|
163
135
|
if (item.column.length === 1) {
|
|
164
136
|
return `
|
|
165
137
|
<div class="row">
|
|
@@ -193,9 +165,8 @@ const centralColumn = (props: any) => {
|
|
|
193
165
|
`;
|
|
194
166
|
}
|
|
195
167
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
let item = props.block?.value;
|
|
168
|
+
const centralPromotionalSection = (props2) => {
|
|
169
|
+
let item = props2.block?.value;
|
|
199
170
|
return `
|
|
200
171
|
<div class="row">
|
|
201
172
|
<div class="py-5 bg-cec-central-promo-section">
|
|
@@ -208,24 +179,17 @@ const centralPromotionalSection = (props: any) => {
|
|
|
208
179
|
</div>
|
|
209
180
|
`;
|
|
210
181
|
};
|
|
211
|
-
|
|
212
182
|
const contactDetails = (data) => {
|
|
213
|
-
let address = data.buildingName ? `<p class="mb-0">${data.buildingName}` :
|
|
214
|
-
address += data.streetAddress
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
address += data.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
address += data.county ? makeAddressItem('addressRegion', data.county) : '';
|
|
221
|
-
address += data.postCode ? makeAddressItem('postalCode', data.postCode) : '';
|
|
222
|
-
let contact = data.phoneNumber
|
|
223
|
-
? makeAddressItem('telephone', data.phoneNumber)
|
|
224
|
-
: '';
|
|
225
|
-
contact += data.email ? makeAddressItem('email', data.email) : '';
|
|
183
|
+
let address = data.buildingName ? `<p class="mb-0">${data.buildingName}` : "";
|
|
184
|
+
address += data.streetAddress ? makeAddressItem("streetAddress", data.streetAddress) : "";
|
|
185
|
+
address += data.locality ? makeAddressItem("addressLocality", data.locality) : "";
|
|
186
|
+
address += data.county ? makeAddressItem("addressRegion", data.county) : "";
|
|
187
|
+
address += data.postCode ? makeAddressItem("postalCode", data.postCode) : "";
|
|
188
|
+
let contact = data.phoneNumber ? makeAddressItem("telephone", data.phoneNumber) : "";
|
|
189
|
+
contact += data.email ? makeAddressItem("email", data.email) : "";
|
|
226
190
|
return `
|
|
227
191
|
<div itemscope itemtype="https://schema.org/Organization">
|
|
228
|
-
${makeAddressItem(
|
|
192
|
+
${makeAddressItem("name", data.name)}
|
|
229
193
|
<div itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
|
|
230
194
|
${address}
|
|
231
195
|
</div>
|
|
@@ -233,21 +197,19 @@ const contactDetails = (data) => {
|
|
|
233
197
|
</div>
|
|
234
198
|
`;
|
|
235
199
|
};
|
|
236
|
-
|
|
237
200
|
const container = (data) => {
|
|
238
201
|
if (data.closeContainer) {
|
|
239
|
-
return `</div>${data.singleChoice ===
|
|
202
|
+
return `</div>${data.singleChoice === "cec-main-column" ? "</div>" : ""}`;
|
|
240
203
|
}
|
|
241
|
-
if (data.singleChoice ===
|
|
204
|
+
if (data.singleChoice === "full-width") {
|
|
242
205
|
return '<div class="container">';
|
|
243
206
|
}
|
|
244
207
|
return `<div class="container">
|
|
245
208
|
<div class="col-lg-8 cec-main-col-width">
|
|
246
209
|
`;
|
|
247
210
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
let item = props.block?.value;
|
|
211
|
+
const fullWidthImageWithOverlay = (props2) => {
|
|
212
|
+
let item = props2.block?.value;
|
|
251
213
|
let overlay;
|
|
252
214
|
if (item.overlayImage) {
|
|
253
215
|
overlay = `
|
|
@@ -284,7 +246,7 @@ const fullWidthImageWithOverlay = (props: any) => {
|
|
|
284
246
|
</div>
|
|
285
247
|
`;
|
|
286
248
|
} else {
|
|
287
|
-
overlay =
|
|
249
|
+
overlay = "";
|
|
288
250
|
}
|
|
289
251
|
return `
|
|
290
252
|
<div class="position-relative">
|
|
@@ -299,9 +261,8 @@ const fullWidthImageWithOverlay = (props: any) => {
|
|
|
299
261
|
</div>
|
|
300
262
|
`;
|
|
301
263
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
let item = props.block?.value;
|
|
264
|
+
const fullWidthImageWithSideOverlay = (props2) => {
|
|
265
|
+
let item = props2.block?.value;
|
|
305
266
|
return `
|
|
306
267
|
<div class="position-relative side-overlay-section">
|
|
307
268
|
<div class="row g-0">
|
|
@@ -318,20 +279,18 @@ const fullWidthImageWithSideOverlay = (props: any) => {
|
|
|
318
279
|
</div>
|
|
319
280
|
`;
|
|
320
281
|
};
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
let item = props.block?.value;
|
|
282
|
+
const heroUnit = (props2) => {
|
|
283
|
+
let item = props2.block?.value;
|
|
324
284
|
return `<div class="hero-unit my-4">${item.content}</div>`;
|
|
325
285
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
let data = props.block?.value;
|
|
286
|
+
const horizontalTable = (props2) => {
|
|
287
|
+
let data = props2.block?.value;
|
|
329
288
|
let rows = data.tableRow.reduce((acc, r) => {
|
|
330
289
|
let cols = r.columns.reduce((acc1, c) => {
|
|
331
290
|
return acc1 + `<td>${c}</td>`;
|
|
332
|
-
},
|
|
291
|
+
}, "");
|
|
333
292
|
return `${acc}<tr><th scope="row">${r.headerCell}</th>${cols}</tr>`;
|
|
334
|
-
},
|
|
293
|
+
}, "");
|
|
335
294
|
return `
|
|
336
295
|
<div class="table-responsive">
|
|
337
296
|
<table class="usr_TableDefault">
|
|
@@ -343,44 +302,36 @@ const horizontalTable = (props: any) => {
|
|
|
343
302
|
</div>
|
|
344
303
|
`;
|
|
345
304
|
};
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
let item = props.block?.value;
|
|
305
|
+
const htmlComponent = (props2) => {
|
|
306
|
+
let item = props2.block?.value;
|
|
349
307
|
return item.html;
|
|
350
308
|
};
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
let
|
|
354
|
-
|
|
355
|
-
classes += data.otherCss ? ` ${data.otherCss}` : '';
|
|
309
|
+
const imageWithCSS = (props2) => {
|
|
310
|
+
let data = props2.block?.value;
|
|
311
|
+
let classes = data.alignment || "";
|
|
312
|
+
classes += data.otherCss ? ` ${data.otherCss}` : "";
|
|
356
313
|
return `
|
|
357
|
-
<img src="${data
|
|
314
|
+
<img src="${data?.image?.asset?.sys?.uri || data.pathOfImage}" alt="${data.image.altText}" class="${classes}" />
|
|
358
315
|
`;
|
|
359
316
|
};
|
|
360
|
-
|
|
361
317
|
const linkEntry = (data) => {
|
|
362
|
-
return `<a title="${data.title ||
|
|
318
|
+
return `<a title="${data.title || ""}" href="${data.target}">${data.text}</a>`;
|
|
363
319
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
return `<p class="mb-0"> <a href="mailto:${text}" itemprop="${prop}>${text}</a></p>`;
|
|
320
|
+
const makeAddressItem = (prop, text2) => {
|
|
321
|
+
if (prop === "email") {
|
|
322
|
+
return `<p class="mb-0"> <a href="mailto:${text2}" itemprop="${prop}>${text2}</a></p>`;
|
|
368
323
|
}
|
|
369
|
-
return `<p class="mb-0" itemprop="${prop}">${
|
|
324
|
+
return `<p class="mb-0" itemprop="${prop}">${text2}</p>`;
|
|
370
325
|
};
|
|
371
|
-
|
|
372
326
|
const formatId = (str) => {
|
|
373
|
-
return str.replace(
|
|
327
|
+
return str.replace("?", "").replace(/\W/g, "-");
|
|
374
328
|
};
|
|
375
|
-
|
|
376
329
|
const makeQuestions = (data, id) => {
|
|
377
330
|
data.question.forEach((qu, j) => {
|
|
378
331
|
qu.stack = [0];
|
|
379
332
|
if (qu.responseForQuestionComponent.length < 4) {
|
|
380
333
|
qu.buttons = qu.responseForQuestionComponent.reduce((acc, r, i) => {
|
|
381
|
-
return
|
|
382
|
-
acc +
|
|
383
|
-
`<div class="col w-auto ps-0 pe-3">
|
|
334
|
+
return acc + `<div class="col w-auto ps-0 pe-3">
|
|
384
335
|
<button
|
|
385
336
|
type="button"
|
|
386
337
|
id="${formatId(data.title)}_${formatId(qu.question)}_${formatId(r.buttonText)}_${id}_${j}_${i}"
|
|
@@ -388,9 +339,8 @@ const makeQuestions = (data, id) => {
|
|
|
388
339
|
>
|
|
389
340
|
${r.buttonText}
|
|
390
341
|
</button>
|
|
391
|
-
</div
|
|
392
|
-
|
|
393
|
-
}, '');
|
|
342
|
+
</div>`;
|
|
343
|
+
}, "");
|
|
394
344
|
} else {
|
|
395
345
|
qu.select = qu.responseForQuestionComponent.reduce(
|
|
396
346
|
(acc, r) => {
|
|
@@ -398,18 +348,15 @@ const makeQuestions = (data, id) => {
|
|
|
398
348
|
},
|
|
399
349
|
`<select class="question-select" name="${id}_${j}" id="${formatId(data.title)}_${formatId(qu.question)}_select_${id}_${j}"><option value="" disabled selected hidden>Choose an option</option>`
|
|
400
350
|
);
|
|
401
|
-
qu.select +=
|
|
351
|
+
qu.select += "</select>";
|
|
402
352
|
}
|
|
403
353
|
if (!questions.value.some((e) => e.id === id)) {
|
|
404
|
-
questions.value.push({ id
|
|
354
|
+
questions.value.push({ id, question: data.question, stack: [0] });
|
|
405
355
|
}
|
|
406
356
|
});
|
|
407
|
-
|
|
408
|
-
let inner = data.question[0].select
|
|
409
|
-
? `
|
|
357
|
+
let inner = data.question[0].select ? `
|
|
410
358
|
<div id="${id}_buttons">${data.question[0].select}</div>
|
|
411
|
-
`
|
|
412
|
-
: `
|
|
359
|
+
` : `
|
|
413
360
|
<div class="row row-cols-auto btns-div" id="${id}_buttons">
|
|
414
361
|
${data.question[0].buttons}
|
|
415
362
|
</div>`;
|
|
@@ -441,23 +388,22 @@ const makeQuestions = (data, id) => {
|
|
|
441
388
|
</fieldset>
|
|
442
389
|
</div>`;
|
|
443
390
|
};
|
|
444
|
-
|
|
445
391
|
const processTime = (str) => {
|
|
446
|
-
let suffix =
|
|
447
|
-
if (str ===
|
|
448
|
-
return
|
|
392
|
+
let suffix = "am";
|
|
393
|
+
if (str === "00:00") {
|
|
394
|
+
return "midnight";
|
|
449
395
|
}
|
|
450
|
-
if (str ===
|
|
451
|
-
return
|
|
396
|
+
if (str === "12:00") {
|
|
397
|
+
return "midday";
|
|
452
398
|
}
|
|
453
399
|
if (!str) {
|
|
454
|
-
return
|
|
400
|
+
return "Closed";
|
|
455
401
|
}
|
|
456
|
-
let time = str.split(
|
|
402
|
+
let time = str.split(":").reduce((acc, e) => {
|
|
457
403
|
return [...acc, parseInt(e)];
|
|
458
404
|
}, []);
|
|
459
405
|
if (time[0] > 12) {
|
|
460
|
-
suffix =
|
|
406
|
+
suffix = "pm";
|
|
461
407
|
time[0] -= 12;
|
|
462
408
|
}
|
|
463
409
|
let res = time[0].toString();
|
|
@@ -468,25 +414,21 @@ const processTime = (str) => {
|
|
|
468
414
|
}
|
|
469
415
|
return res;
|
|
470
416
|
};
|
|
471
|
-
|
|
472
417
|
const openingHours = (data) => {
|
|
473
418
|
let body = data.openingHours.reduce((acc, e) => {
|
|
474
419
|
let from = processTime(e.from);
|
|
475
420
|
let to = processTime(e.to);
|
|
476
|
-
let hours =
|
|
477
|
-
if (from ===
|
|
478
|
-
hours =
|
|
421
|
+
let hours = "";
|
|
422
|
+
if (from === "Closed") {
|
|
423
|
+
hours = "Closed";
|
|
479
424
|
} else {
|
|
480
425
|
hours = `${from} to ${to}`;
|
|
481
426
|
}
|
|
482
|
-
return
|
|
483
|
-
acc +
|
|
484
|
-
`<tr>
|
|
427
|
+
return acc + `<tr>
|
|
485
428
|
<td>${e.dayInformation}</td>
|
|
486
429
|
<td>${hours}</td>
|
|
487
|
-
</tr
|
|
488
|
-
|
|
489
|
-
}, '');
|
|
430
|
+
</tr>`;
|
|
431
|
+
}, "");
|
|
490
432
|
return `
|
|
491
433
|
<table class="usrTableDefault">
|
|
492
434
|
<caption class="hidden">
|
|
@@ -504,9 +446,8 @@ const openingHours = (data) => {
|
|
|
504
446
|
</table>
|
|
505
447
|
`;
|
|
506
448
|
};
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
let item = props.block?.value;
|
|
449
|
+
const promotionalBannerWithText = (props2) => {
|
|
450
|
+
let item = props2.block?.value;
|
|
510
451
|
let overlay = `
|
|
511
452
|
<div class="cec-cent-promo-txt-wrap col-md-11 top-50 w-100 text-center">
|
|
512
453
|
<h1
|
|
@@ -516,7 +457,7 @@ const promotionalBannerWithText = (props: any) => {
|
|
|
516
457
|
</h1>
|
|
517
458
|
</div>
|
|
518
459
|
`;
|
|
519
|
-
let paras = item.html ? item.html.replace(/<\/?p>/g,
|
|
460
|
+
let paras = item.html ? item.html.replace(/<\/?p>/g, "").split("\n") : [];
|
|
520
461
|
if (paras.length) {
|
|
521
462
|
overlay = `
|
|
522
463
|
<div
|
|
@@ -545,9 +486,9 @@ const promotionalBannerWithText = (props: any) => {
|
|
|
545
486
|
</div>
|
|
546
487
|
`;
|
|
547
488
|
};
|
|
548
|
-
const promotionalContrastRegion = (
|
|
549
|
-
let item =
|
|
550
|
-
const bgClass = `bg-${item.colour.toLowerCase().replace(/\s/g,
|
|
489
|
+
const promotionalContrastRegion = (props2) => {
|
|
490
|
+
let item = props2.block?.value;
|
|
491
|
+
const bgClass = `bg-${item.colour.toLowerCase().replace(/\s/g, "-")}`;
|
|
551
492
|
let textCol = `
|
|
552
493
|
<div class="p-2 ps-lg-4 ms-lg-5 col">
|
|
553
494
|
<div class="cec-pull-column pe-md-5">${item.content}</div>
|
|
@@ -564,13 +505,12 @@ const promotionalContrastRegion = (props: any) => {
|
|
|
564
505
|
<div
|
|
565
506
|
class="${bgClass} cec-pull-container pe-md-0 d-flex flex-column flex-md-row justify-content-center ps-4 align-items-center py-5 mb-4"
|
|
566
507
|
>
|
|
567
|
-
${item.alignment ===
|
|
508
|
+
${item.alignment === "left" ? imageCol + textCol : textCol + imageCol}
|
|
568
509
|
</div>
|
|
569
510
|
`;
|
|
570
511
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
let item = props.block?.value;
|
|
512
|
+
const promotionalFullWidthImageWithOverlay = (props2) => {
|
|
513
|
+
let item = props2.block?.value;
|
|
574
514
|
let overlay;
|
|
575
515
|
if (!item.overlayText) {
|
|
576
516
|
overlay = `
|
|
@@ -620,8 +560,8 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
|
|
|
620
560
|
</div>
|
|
621
561
|
`;
|
|
622
562
|
};
|
|
623
|
-
const promotionalFullWidthImageWithSideOverlay = (
|
|
624
|
-
let item =
|
|
563
|
+
const promotionalFullWidthImageWithSideOverlay = (props2) => {
|
|
564
|
+
let item = props2.block?.value;
|
|
625
565
|
return `
|
|
626
566
|
<div class="position-relative side-overlay-section">
|
|
627
567
|
<div class="row g-0">
|
|
@@ -641,27 +581,21 @@ const promotionalFullWidthImageWithSideOverlay = (props: any) => {
|
|
|
641
581
|
</div>
|
|
642
582
|
`;
|
|
643
583
|
};
|
|
644
|
-
|
|
645
584
|
const processUri = (uri) => {
|
|
646
585
|
return encodeURI(decodeURI(uri).toLowerCase());
|
|
647
586
|
};
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
return genList(props.block.value, props.block.id);
|
|
587
|
+
const genericList = (props2) => {
|
|
588
|
+
return genList(props2.block.value, props2.block.id);
|
|
651
589
|
};
|
|
652
590
|
const genList = (item, id) => {
|
|
653
|
-
let heading = item.title ? `<h2 class="fs-4 mt-3">${item.title}</h2>` :
|
|
654
|
-
|
|
655
|
-
return listItems.value[id] && listItems.value[id].length
|
|
656
|
-
? `
|
|
591
|
+
let heading = item.title ? `<h2 class="fs-4 mt-3">${item.title}</h2>` : "";
|
|
592
|
+
return listItems.value[id] && listItems.value[id].length ? `
|
|
657
593
|
${heading}
|
|
658
594
|
<ul>
|
|
659
595
|
${listItems.value[id].reduce((acc, e) => {
|
|
660
|
-
|
|
661
|
-
? `${acc}
|
|
596
|
+
return e.sys.dataFormat === "webpage" ? `${acc}
|
|
662
597
|
<li><a href="${processUri(e.sys.uri)}">${e.title}</a></li>
|
|
663
|
-
`
|
|
664
|
-
: `${acc}
|
|
598
|
+
` : `${acc}
|
|
665
599
|
<li>
|
|
666
600
|
<a href="${processUri(e.sys.uri)}"
|
|
667
601
|
>${e.title[0].toUpperCase()}${e.title.slice(1)}
|
|
@@ -670,67 +604,61 @@ const genList = (item, id) => {
|
|
|
670
604
|
</a>
|
|
671
605
|
</li>
|
|
672
606
|
`;
|
|
673
|
-
|
|
607
|
+
}, "")}
|
|
674
608
|
</ul>
|
|
675
|
-
`
|
|
676
|
-
: '';
|
|
609
|
+
` : "";
|
|
677
610
|
};
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
let
|
|
681
|
-
let
|
|
682
|
-
|
|
683
|
-
if (entryType.startsWith('accordion')) {
|
|
611
|
+
const myInlineEntry = (props2) => {
|
|
612
|
+
let data = props2.block?.value;
|
|
613
|
+
let id = props2.block?.id;
|
|
614
|
+
let entryType = props2.block?.value.sys.contentTypeId;
|
|
615
|
+
if (entryType.startsWith("accordion")) {
|
|
684
616
|
return accordion(data);
|
|
685
617
|
}
|
|
686
618
|
switch (entryType) {
|
|
687
|
-
case
|
|
619
|
+
case "abbreviation":
|
|
688
620
|
return abbr(data);
|
|
689
|
-
case
|
|
621
|
+
case "anchor":
|
|
690
622
|
return anchor(data);
|
|
691
|
-
case
|
|
623
|
+
case "carousel":
|
|
692
624
|
return carousel(data, id);
|
|
693
|
-
case
|
|
625
|
+
case "contactDetails":
|
|
694
626
|
return contactDetails(data);
|
|
695
|
-
case
|
|
627
|
+
case "container":
|
|
696
628
|
return container(data);
|
|
697
|
-
case
|
|
629
|
+
case "linkEntry":
|
|
698
630
|
return linkEntry(data);
|
|
699
|
-
case
|
|
631
|
+
case "openingHours":
|
|
700
632
|
return openingHours(data);
|
|
701
|
-
case
|
|
633
|
+
case "questions":
|
|
702
634
|
return makeQuestions(data, id);
|
|
703
635
|
default:
|
|
704
636
|
return `<span> ${text(data.entrytitle)} </span>`;
|
|
705
637
|
}
|
|
706
638
|
};
|
|
707
|
-
|
|
708
639
|
const renderer = createRenderer({
|
|
709
640
|
blocks: {
|
|
710
|
-
_inlineEntry: myInlineEntry
|
|
641
|
+
_inlineEntry: myInlineEntry
|
|
711
642
|
},
|
|
712
643
|
components: {
|
|
713
|
-
accordionComponent
|
|
714
|
-
cecButton
|
|
715
|
-
centralColumn
|
|
644
|
+
accordionComponent,
|
|
645
|
+
cecButton,
|
|
646
|
+
centralColumn,
|
|
716
647
|
dragonsLaneAccordion: accWithAssets,
|
|
717
|
-
fullWidthImageWithOverlay
|
|
718
|
-
fullWidthImageWithSideOverlay
|
|
719
|
-
centralPromotionalSection
|
|
720
|
-
promotionalFullWidthImageWithOverlay
|
|
721
|
-
promotionalFullWidthImageWithSideOverlay
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
},
|
|
648
|
+
fullWidthImageWithOverlay,
|
|
649
|
+
fullWidthImageWithSideOverlay,
|
|
650
|
+
centralPromotionalSection,
|
|
651
|
+
promotionalFullWidthImageWithOverlay,
|
|
652
|
+
promotionalFullWidthImageWithSideOverlay,
|
|
653
|
+
genericList,
|
|
654
|
+
heroUnit,
|
|
655
|
+
horizontalTable,
|
|
656
|
+
htmlComponent,
|
|
657
|
+
imageWithCSS,
|
|
658
|
+
promotionalBannerWithText,
|
|
659
|
+
promotionalContrastRegion
|
|
660
|
+
}
|
|
731
661
|
});
|
|
732
|
-
|
|
733
|
-
// Process the canvas
|
|
734
662
|
canvasHtml = getCanvas(canvas);
|
|
735
663
|
canvasHtml = canvasHtml.replace(
|
|
736
664
|
/<img src="|<caption|<table|<\/table>|<th>/g,
|
|
@@ -738,13 +666,13 @@ canvasHtml = canvasHtml.replace(
|
|
|
738
666
|
switch (match) {
|
|
739
667
|
case '<img src="':
|
|
740
668
|
return `<img src="`;
|
|
741
|
-
case
|
|
669
|
+
case "<caption":
|
|
742
670
|
return "<caption class='hidden'";
|
|
743
|
-
case
|
|
671
|
+
case "<table":
|
|
744
672
|
return "<div class='table-responsive'><table class='usr_TableDefault'";
|
|
745
|
-
case
|
|
746
|
-
return
|
|
747
|
-
case
|
|
673
|
+
case "</table>":
|
|
674
|
+
return "</table></div>";
|
|
675
|
+
case "<th>":
|
|
748
676
|
return '<th scope="col">';
|
|
749
677
|
default:
|
|
750
678
|
return match;
|
|
@@ -754,7 +682,7 @@ canvasHtml = canvasHtml.replace(
|
|
|
754
682
|
canvasHtml = canvasHtml.replace(
|
|
755
683
|
/(<a href="mailto:[^"]+">)([^<]+)(<\/a>)/g,
|
|
756
684
|
(_, p1, p2, p3) => {
|
|
757
|
-
return `${p1}${p2.replace(/([.@])/g,
|
|
685
|
+
return `${p1}${p2.replace(/([.@])/g, "<wbr />$1")}${p3}`;
|
|
758
686
|
}
|
|
759
687
|
);
|
|
760
688
|
</script>
|