cec-nuxt-lib 0.9.0 → 0.10.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.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.9.0"
4
+ "version": "0.10.1"
5
5
  }
@@ -2,9 +2,8 @@
2
2
  import { useState, useRuntimeConfig } from '#app';
3
3
  import { useRoute } from 'vue-router';
4
4
  const config = useRuntimeConfig();
5
-
6
5
  const baseUrl = config.app.baseURL;
7
- const classicPath = useState('classicPath');
6
+ const page = useState('page');
8
7
  const route = useRoute();
9
8
 
10
9
  const trimPath = (str) => {
@@ -40,13 +39,15 @@ const toSentenceCase = (str, notLast) => {
40
39
  // Make arrays of the items in the paths
41
40
  let routeTrim = trimPath(route.path);
42
41
  let routes = routeTrim.split('/');
43
- let classic = trimPath(classicPath.value).split('/');
42
+ let classic = trimPath(page.value.classicPath).split('/');
44
43
  const length = classic.length;
45
44
 
46
45
  // Build an array of hrefs
47
46
  let hrefs =
48
47
  baseUrl !== '/'
49
- ? `${classicPath.value}${routeTrim === '/' ? '' : routeTrim}`.split('/')
48
+ ? `${page.value.classicPath}${routeTrim === '/' ? '' : routeTrim}`.split(
49
+ '/'
50
+ )
50
51
  : routes.reduce((acc, e, i) => {
51
52
  if (classic[i]) {
52
53
  return [...acc, classic[i]];
@@ -1,16 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { onMounted } from 'vue';
3
2
  import { useState } from '#app';
4
-
5
3
  import { createRenderer, text } from '@contensis/canvas-html';
6
4
  import type { Block } from '@contensis/canvas-html';
7
5
  const getCanvas = (data: Block[]) => renderer({ data });
8
6
 
9
- const baseUrl = useState('baseUrl');
10
7
  const listItems = useState('listItems');
11
- const path = useState('path');
12
8
  const questions = useState('questions');
13
- const title = useState('title');
14
9
  let canvasHtml;
15
10
 
16
11
  const props = defineProps({
@@ -73,7 +68,7 @@ const accordion = (data) => {
73
68
  acc +
74
69
  `
75
70
  <li>
76
- <a href="${baseUrl.value}${processUri(p.sys.uri)}"
71
+ <a href="${processUri(p.sys.uri)}"
77
72
  >${p.title[0].toUpperCase()}${p.title.slice(1)}
78
73
  (${p.sys.contentTypeId.toUpperCase()},
79
74
  ${sizeString(p.sys.properties.fileSize)})
@@ -263,7 +258,7 @@ const fullWidthImageWithOverlay = (props: any) => {
263
258
  <img
264
259
  class="px-4 mx-auto mt-2"
265
260
  alt="${item.overlayImage.altText}"
266
- src="${baseUrl.value}${item.overlayImage.asset.sys.uri}"
261
+ src="${item.overlayImage.asset.sys.uri}"
267
262
  />
268
263
  </div>
269
264
  </div>`;
@@ -274,7 +269,7 @@ const fullWidthImageWithOverlay = (props: any) => {
274
269
  <img
275
270
  class="img-fluid"
276
271
  alt="${item.image.altText}"
277
- src="${baseUrl.value}${item.image.asset.sys.uri}"
272
+ src="${item.image.asset.sys.uri}"
278
273
  />
279
274
  <div class="cec-cent-promo-txt-wrap top-50 end-0">
280
275
  <div class="container-md">
@@ -297,7 +292,7 @@ const fullWidthImageWithOverlay = (props: any) => {
297
292
  <img
298
293
  class="img-fluid"
299
294
  alt="${item.image.altText}"
300
- src="${baseUrl.value}${item.image.asset.sys.uri}"
295
+ src="${item.image.asset.sys.uri}"
301
296
  />
302
297
  ${overlay}
303
298
  </div>
@@ -313,7 +308,7 @@ const fullWidthImageWithSideOverlay = (props: any) => {
313
308
  <img
314
309
  class="img-fluid"
315
310
  alt="${item.image.altText}"
316
- src="${baseUrl.value}${item.image.asset.sys.uri}"
311
+ src="${item.image.asset.sys.uri}"
317
312
  />
318
313
  <div style="position: absolute;" class="my-side-overlay col-lg-6 bg-cec-green ms-lg-5 mt-lg-5 p-2 top-0 ">
319
314
  <h2 class="text-white promo-heading display-6">${item.heading}</h2>
@@ -544,7 +539,7 @@ const promotionalBannerWithText = (props: any) => {
544
539
  <div class="position-relative row g-0 mb-3">
545
540
  <img
546
541
  alt="${item.bannerImage.altText}"
547
- src="${baseUrl.value}${item.bannerImage.asset.sys.uri}"
542
+ src="${item.bannerImage.asset.sys.uri}"
548
543
  />
549
544
  ${overlay}
550
545
  </div>
@@ -562,7 +557,7 @@ const promotionalContrastRegion = (props: any) => {
562
557
  <img
563
558
  class="img-fluid"
564
559
  alt="${item.image.altText}"
565
- src="${baseUrl.value}${item.image.asset.sys.uri}"
560
+ src="${item.image.asset.sys.uri}"
566
561
  />
567
562
  </div>`;
568
563
  return `
@@ -586,7 +581,7 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
586
581
  <img
587
582
  class="px-4 mx-auto mt-2"
588
583
  alt="${item.overlayImage.altText}"
589
- src="${baseUrl.value}${item.overlayImage.asset.sys.uri}"
584
+ src="${item.overlayImage.asset.sys.uri}"
590
585
  />
591
586
  </div>
592
587
  </div>`;
@@ -597,7 +592,7 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
597
592
  <img
598
593
  class="img-fluid"
599
594
  alt="${item.image.altText}"
600
- src="${baseUrl.value}${item.image.asset.sys.uri}"
595
+ src="${item.image.asset.sys.uri}"
601
596
  />
602
597
  <div class="cec-cent-promo-txt-wrap top-50 end-0">
603
598
  <div class="container-md">
@@ -618,7 +613,7 @@ const promotionalFullWidthImageWithOverlay = (props: any) => {
618
613
  <img
619
614
  class="img-fluid"
620
615
  alt="${item.image.altText}"
621
- src="${baseUrl.value}${item.image.asset.sys.uri}"
616
+ src="${item.image.asset.sys.uri}"
622
617
  />
623
618
  ${overlay}
624
619
  </div>
@@ -633,7 +628,7 @@ const promotionalFullWidthImageWithSideOverlay = (props: any) => {
633
628
  <img
634
629
  class="img-fluid"
635
630
  alt="${item.image.altText}"
636
- src="${baseUrl.value}${item.image.asset.sys.uri}"
631
+ src="${item.image.asset.sys.uri}"
637
632
  />
638
633
  <div
639
634
  style="position: absolute"
@@ -742,7 +737,7 @@ canvasHtml = canvasHtml.replace(
742
737
  (match) => {
743
738
  switch (match) {
744
739
  case '<img src="':
745
- return `<img src="${baseUrl.value}`;
740
+ return `<img src="`;
746
741
  case '<caption':
747
742
  return "<caption class='hidden'";
748
743
  case '<table':
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { useState } from '#app';
3
- const hideReviewDate = useState('hideReviewDate');
3
+ const page = useState('page');
4
4
  const props = defineProps({
5
5
  reviewed: {
6
6
  type: String,
@@ -23,8 +23,11 @@ const { path, title, reviewed } = props;
23
23
  <div class="mt-4">
24
24
  <div class="row">
25
25
  <div class="col-lg-8">
26
- <p v-if="!hideReviewDate">
27
- <small>Page last reviewed: {{ reviewed }} </small>
26
+ <p v-if="!page.hideReviewDate">
27
+ <small
28
+ >Page last reviewed:
29
+ {{ new Date(reviewed).toLocaleDateString('en-GB') }}
30
+ </small>
28
31
  </p>
29
32
  <div class="accordion pb-4">
30
33
  <div class="accordion-item">
@@ -3,10 +3,9 @@ import { onMounted } from 'vue';
3
3
  import { useState, navigateTo } from '#app';
4
4
 
5
5
  const searchTerm = useState('searchTerm', () => undefined);
6
- const showSiteSearch = useState('showSiteSearch');
7
6
  const questions = useState('questions');
8
7
  const baseUrl = useState('baseUrl');
9
- const title = useState('title');
8
+ const page = useState('page');
10
9
  const path = useState('path');
11
10
 
12
11
  const regex =
@@ -245,7 +244,7 @@ onMounted(() => {
245
244
 
246
245
  forms.forEach((link) => {
247
246
  link.href = `${link.href}&pageTitle=${encodeURIComponent(
248
- title.value
247
+ page.value.title
249
248
  )}&pagePath=${baseUrl.value}${encodeURIComponent(path.value)}`;
250
249
  });
251
250
 
@@ -444,7 +443,7 @@ onMounted(() => {
444
443
  <div class="cec-search-site">
445
444
  <div
446
445
  class="sys_search-query-control"
447
- :class="{ 'd-none': !showSiteSearch }"
446
+ :class="{ 'd-none': !page.showSiteSearch }"
448
447
  >
449
448
  <label for="searchTextBox" class="hidden sys_search-label"
450
449
  >Search</label
@@ -1,24 +1,26 @@
1
1
  <script setup>
2
2
  import { useState, useHead, useSeoMeta } from '#app';
3
3
  const baseUrl = useState('baseUrl');
4
- const description = useState('description');
5
4
  const ogImage = useState('ogImage');
6
- const noindex = useState('noindex');
7
5
  const path = useState('path');
8
- const reviewISO = useState('reviewISO');
9
- const title = useState('title');
6
+ const page = useState('page');
7
+
8
+ let reviewDate = new Date(page.value.dateReviewed);
9
+ let reviewISO = reviewDate.toISOString().slice(0, 10);
10
10
 
11
11
  let meta = [
12
12
  {
13
13
  name: 'description',
14
- content: description.value,
14
+ content: page.value.description,
15
15
  },
16
16
  ];
17
- if (noindex.value) {
17
+
18
+ if (page.value.noindex) {
18
19
  meta.push({ name: 'robots', content: 'noindex, nofollow' });
19
20
  }
21
+
20
22
  useHead({
21
- title: title.value,
23
+ title: page.value.title,
22
24
  meta: meta,
23
25
  script: [
24
26
  {
@@ -26,7 +28,7 @@ useHead({
26
28
  children: {
27
29
  '@context': 'https://schema.org',
28
30
  '@type': 'WebPage',
29
- lastReviewed: reviewISO.value,
31
+ lastReviewed: reviewISO,
30
32
  },
31
33
  },
32
34
  {
@@ -78,7 +80,7 @@ useHead({
78
80
  },
79
81
  {
80
82
  '@type': 'ContactPoint',
81
- url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(title.value)}&pagePath=${baseUrl.value}${path.value}`,
83
+ url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(page.value.title)}&pagePath=${baseUrl.value}${path.value}`,
82
84
  contactType: 'Online contact form',
83
85
  areaServed: 'Cheshire East',
84
86
  },
@@ -111,9 +113,9 @@ useHead({
111
113
  ],
112
114
  });
113
115
  useSeoMeta({
114
- ogTitle: title.value,
116
+ ogTitle: page.value.title,
115
117
  ogImage: ogImage.value,
116
- ogDescription: description.value,
118
+ ogDescription: page.value.title,
117
119
  });
118
120
  </script>
119
121
  <template><span class="d-none">meta</span></template>
@@ -3,7 +3,7 @@ import { useState } from '#app';
3
3
  const pages = useState('pages');
4
4
  const pageIndex = useState('pageIndex');
5
5
  const scrollTo = useState('scrollTo');
6
- const showResultsNum = useState('showResultsNum');
6
+ const page = useState('page');
7
7
 
8
8
  const goToPage = (n) => {
9
9
  pageIndex.value = n;
@@ -71,7 +71,7 @@ const goToPage = (n) => {
71
71
  </ol>
72
72
  </nav>
73
73
  <p>
74
- <span v-if="showResultsNum"
74
+ <span v-if="page.showResultsNum"
75
75
  >Total results:
76
76
  {{
77
77
  pages.reduce((acc, p) => {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.9.0",
2
+ "version": "0.10.1",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",