cec-nuxt-lib 0.11.18 → 0.12.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cec-nuxt-lib",
3
3
  "configKey": "cec-nuxt-lib",
4
- "version": "0.11.18",
4
+ "version": "0.12.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -2,8 +2,7 @@
2
2
  import { useState } from "#app";
3
3
  import { createRenderer, text } from "@contensis/canvas-html";
4
4
  const getCanvas = (data) => renderer({ data });
5
- const listItems = useState("listItems");
6
- const questions = useState("questions");
5
+ const settings = useState("settings");
7
6
  let canvasHtml;
8
7
  const props = defineProps({
9
8
  canvas: {
@@ -355,8 +354,12 @@ const makeQuestions = (data, id) => {
355
354
  );
356
355
  qu.select += "</select>";
357
356
  }
358
- if (!questions.value.some((e) => e.id === id)) {
359
- questions.value.push({ id, question: data.question, stack: [0] });
357
+ if (!settings.value.questions.some((e) => e.id === id)) {
358
+ settings.value.questions.push({
359
+ id,
360
+ question: data.question,
361
+ stack: [0]
362
+ });
360
363
  }
361
364
  });
362
365
  let inner = data.question[0].select ? `
@@ -597,10 +600,10 @@ const genericListAsAccordion = (props2) => {
597
600
  };
598
601
  const genList = (item, id) => {
599
602
  let heading = item.title ? `<h2 class="fs-4 mt-3">${item.title}</h2>` : "";
600
- return listItems.value[id] && listItems.value[id].length ? `
603
+ return settings.value.listItems[id] && settings.value.listItems[id].length ? `
601
604
  ${heading}
602
605
  <ul>
603
- ${listItems.value[id].reduce((acc, e) => {
606
+ ${settings.value.listItems[id].reduce((acc, e) => {
604
607
  return e.sys.dataFormat === "webpage" ? `${acc}
605
608
  <li><a href="${processUri(e.sys.uri)}">${e.title}</a></li>
606
609
  ` : `${acc}
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
3
  const page = useState("page");
4
- const baseUrl = useState("baseUrl");
4
+ const settings = useState("settings");
5
5
  const props = defineProps({
6
6
  reviewed: {
7
7
  type: String,
@@ -60,7 +60,7 @@ const dateOptions = {
60
60
  <ul class="list-unstyled list-inline">
61
61
  <li class="list-inline-item me-3">
62
62
  <a
63
- :href="`https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=improve_this_page&pageTitle=${encodeURIComponent(title)}&pagePath=${baseUrl}${path}`"
63
+ :href="`https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=improve_this_page&pageTitle=${encodeURIComponent(title)}&pagePath=${settings.baseUrl}${path}`"
64
64
  id="yes-feedback"
65
65
  class="liberty_form_link btn btn-lg btn-outline-secondary btn-example-1 btn-chevron rounded-pill text-left"
66
66
  >Yes<span class="visually-hidden">
@@ -1,11 +1,8 @@
1
1
  <script setup>
2
2
  import { onMounted } from "vue";
3
3
  import { useState, navigateTo } from "#app";
4
- const searchTerms = useState("searchTerms");
5
- const questions = useState("questions");
6
- const baseUrl = useState("baseUrl");
7
4
  const page = useState("page");
8
- const path = useState("path");
5
+ const settings = useState("settings");
9
6
  const regex = /^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
10
7
  const config = {
11
8
  apiKey: "c1a902dfad207b122cca32738e623af375e1d2ee",
@@ -16,7 +13,7 @@ const config = {
16
13
  description: "For more information visit our",
17
14
  name: "Cookies page",
18
15
  url: "/council_and_democracy/council_information/website_information/website_information.aspx",
19
- updated: "08/09/2020"
16
+ updated: "01/10/2025"
20
17
  },
21
18
  accessibility: {
22
19
  outline: true
@@ -84,9 +81,9 @@ const config = {
84
81
  }
85
82
  };
86
83
  const doSearch = async () => {
87
- if (searchTerms.value) {
84
+ if (settings.value.searchTerms) {
88
85
  await navigateTo(
89
- `https://www.cheshireeast.gov.uk/search-results?search_keywords=${encodeURI(searchTerms.value)}`,
86
+ `https://www.cheshireeast.gov.uk/search-results?search_keywords=${encodeURI(settings.value.searchTerms)}`,
90
87
  { external: true }
91
88
  );
92
89
  }
@@ -145,7 +142,7 @@ onMounted(() => {
145
142
  const getQuInfo = (b) => {
146
143
  let temp = b.id.split("_");
147
144
  let id = temp[3];
148
- let q = questions.value.find((e) => e.id === id);
145
+ let q = settings.value.questions.find((e) => e.id === id);
149
146
  if (q) {
150
147
  let myQ = q.question[parseInt(temp[4])];
151
148
  if (temp.length === 6) {
@@ -198,7 +195,7 @@ onMounted(() => {
198
195
  forms.forEach((link) => {
199
196
  link.href = `${link.href}&pageTitle=${encodeURIComponent(
200
197
  page.value.title
201
- )}&pagePath=${baseUrl.value}${encodeURIComponent(path.value)}`;
198
+ )}&pagePath=${settings.value.baseUrl}${encodeURIComponent(settings.value.path)}`;
202
199
  });
203
200
  const setUpListeners = () => {
204
201
  let qSelects = Array.from(
@@ -230,7 +227,7 @@ onMounted(() => {
230
227
  });
231
228
  };
232
229
  const goto = (id, index, addToStack = true) => {
233
- let qTop = questions.value.find((e) => e.id === id);
230
+ let qTop = settings.value.questions.find((e) => e.id === id);
234
231
  if (!index) {
235
232
  qTop.stack = [0];
236
233
  }
@@ -252,12 +249,12 @@ onMounted(() => {
252
249
  );
253
250
  };
254
251
  const prev = (id) => {
255
- let qTop = questions.value.find((e) => e.id === id);
252
+ let qTop = settings.value.questions.find((e) => e.id === id);
256
253
  let ind = qTop.stack.pop();
257
254
  goto(id, ind, !qTop.stack.length);
258
255
  };
259
256
  const reset = (id) => {
260
- let qTop = questions.value.find((e) => e.id === id);
257
+ let qTop = settings.value.questions.find((e) => e.id === id);
261
258
  if (qTop.stack.length) {
262
259
  qTop.stack = [];
263
260
  goto(id, 0);
@@ -352,10 +349,10 @@ onMounted(() => {
352
349
  >Search</label
353
350
  >
354
351
  <input
355
- v-model="searchTerms"
352
+ v-model="settings.searchTerms"
356
353
  @keypress.enter="doSearch"
357
354
  placeholder="Enter keywords"
358
- @focus="searchTerms = ''"
355
+ @focus="settings.searchTerms = ''"
359
356
  type="text"
360
357
  id="searchTextBox"
361
358
  class="sys_searchbox"
@@ -1,9 +1,7 @@
1
1
  <script setup>
2
2
  import { useState, useHead, useSeoMeta } from "#app";
3
- const baseUrl = useState("baseUrl");
4
- const ogImage = useState("ogImage");
5
- const path = useState("path");
6
3
  const page = useState("page");
4
+ const settings = useState("settings");
7
5
  let reviewDate = page.value.dateReviewed ? new Date(page.value.dateReviewed) : /* @__PURE__ */ new Date();
8
6
  let reviewISO = reviewDate.toISOString().slice(0, 10);
9
7
  let meta = [
@@ -73,7 +71,7 @@ useHead({
73
71
  },
74
72
  {
75
73
  "@type": "ContactPoint",
76
- url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(page.value.title)}&pagePath=${baseUrl.value}${path.value}`,
74
+ url: `https://digital-core.cheshireeast.gov.uk/w/webpage/request?form=contact_us&pageTitle=${encodeURIComponent(page.value.title)}&pagePath=${settings.value.baseUrl}${settings.value.path}`,
77
75
  contactType: "Online contact form",
78
76
  areaServed: "Cheshire East"
79
77
  }
@@ -106,7 +104,7 @@ useHead({
106
104
  });
107
105
  useSeoMeta({
108
106
  ogTitle: page.value.title,
109
- ogImage: ogImage.value,
107
+ ogImage: settings.value.ogImage,
110
108
  ogDescription: page.value.title
111
109
  });
112
110
  </script>
@@ -1,12 +1,12 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
- const siblings = useState("siblings");
3
+ const settings = useState("settings");
4
4
  </script>
5
5
 
6
6
  <template>
7
- <h2>In this section</h2>
7
+ <h2>Related pages</h2>
8
8
  <ul>
9
- <li v-for="item in siblings">
9
+ <li v-for="item in settings.siblings">
10
10
  <a :href="item.path">{{ item.displayName }}</a>
11
11
  </li>
12
12
  </ul>
@@ -1,15 +1,13 @@
1
1
  <script setup>
2
2
  import { useState } from "#app";
3
- const pages = useState("pages");
4
- const pageIndex = useState("pageIndex");
5
- const scrollTo = useState("scrollTo");
6
3
  const page = useState("page");
4
+ const settings = useState("settings");
7
5
  const goToPage = (n) => {
8
- pageIndex.value = n;
9
- scrollTo.value.scrollIntoView();
6
+ settings.value.pageIndex = n;
7
+ settings.value.scrollTo.scrollIntoView();
10
8
  };
11
9
  const getResults = () => {
12
- return pages.value.reduce((acc, p) => {
10
+ return settings.value.pages.reduce((acc, p) => {
13
11
  return acc + p.length;
14
12
  }, 0);
15
13
  };
@@ -19,7 +17,7 @@ const getResults = () => {
19
17
  <div>
20
18
  <nav
21
19
  class="my-4"
22
- v-if="pages.length > 1"
20
+ v-if="settings.pages.length > 1"
23
21
  aria-label="Results data navigation"
24
22
  >
25
23
  <ol class="pagination d-flex flex-wrap my-2 ms-0">
@@ -28,7 +26,7 @@ const getResults = () => {
28
26
  class="page-link rounded"
29
27
  type="button"
30
28
  aria-label="First"
31
- :class="{ disabled: !pageIndex }"
29
+ :class="{ disabled: !settings.pageIndex }"
32
30
  @click="goToPage(0)"
33
31
  >
34
32
  First
@@ -39,15 +37,15 @@ const getResults = () => {
39
37
  class="page-link rounded"
40
38
  type="button"
41
39
  aria-label="Previous"
42
- :class="{ disabled: !pageIndex }"
43
- @click="goToPage(pageIndex - 1)"
40
+ :class="{ disabled: !settings.pageIndex }"
41
+ @click="goToPage(settings.pageIndex - 1)"
44
42
  >
45
43
  Previous
46
44
  </button>
47
45
  </li>
48
46
  <li class="page-item mb-2 rounded disabled current">
49
47
  <button class="page-link rounded" type="button">
50
- {{ pageIndex + 1 }}
48
+ {{ settings.pageIndex + 1 }}
51
49
  </button>
52
50
  </li>
53
51
  <li class="page-item mb-2">
@@ -55,8 +53,10 @@ const getResults = () => {
55
53
  class="page-link rounded"
56
54
  type="button"
57
55
  aria-label="Next"
58
- :class="{ disabled: pageIndex + 1 === pages.length }"
59
- @click="goToPage(pageIndex + 1)"
56
+ :class="{
57
+ disabled: settings.pageIndex + 1 === settings.pages.length,
58
+ }"
59
+ @click="goToPage(settings.pageIndex + 1)"
60
60
  >
61
61
  Next
62
62
  </button>
@@ -66,8 +66,10 @@ const getResults = () => {
66
66
  class="page-link rounded"
67
67
  type="button"
68
68
  aria-label="Last"
69
- :class="{ disabled: pageIndex === pages.length - 1 }"
70
- @click="goToPage(pages.length - 1)"
69
+ :class="{
70
+ disabled: settings.pageIndex === settings.pages.length - 1,
71
+ }"
72
+ @click="goToPage(settings.pages.length - 1)"
71
73
  >
72
74
  Last
73
75
  </button>
@@ -75,11 +77,17 @@ const getResults = () => {
75
77
  </ol>
76
78
  </nav>
77
79
  <p>
78
- <span v-if="page.showResultsNum && pages[0] && pages[0].length > 0"
80
+ <span
81
+ v-if="
82
+ page.showResultsNum &&
83
+ settings.pages[0] &&
84
+ settings.pages[0].length > 0
85
+ "
79
86
  >Total results: {{ getResults() }}.&nbsp;</span
80
87
  >
81
- <span v-if="pages.length > 1"
82
- >Viewing page {{ pageIndex + 1 }} of {{ pages.length }}.</span
88
+ <span v-if="settings.pages.length > 1"
89
+ >Viewing page {{ settings.pageIndex + 1 }} of
90
+ {{ settings.pages.length }}.</span
83
91
  >
84
92
  </p>
85
93
  </div>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.11.18",
2
+ "version": "0.12.0",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",