@worksafevictoria/wcl7.5 1.5.0 → 1.7.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/.storybook/preview.js +20 -13
- package/bin/deploy.sh +1 -1
- package/lib/utility.js +10 -8
- package/package.json +6 -5
- package/src/assets/icons/AppFooter/x-ws-footer.svg +10 -0
- package/src/assets/icons/AppFooter/x-ww-footer.svg +28 -0
- package/src/assets/icons/SocialShare/x-icon-white.svg +28 -0
- package/src/assets/styles/modal.scss +51 -0
- package/src/components/Common/CardGrid/index.vue +56 -51
- package/src/components/Common/CardGridItem/card-grid-item-caret.vue +7 -4
- package/src/components/Common/CardGridItem/card-grid-item-icon.vue +15 -19
- package/src/components/Common/CardGridItem/index.vue +77 -63
- package/src/components/Containers/Carousel/index.vue +14 -7
- package/src/components/Containers/HomepageHeader/index.stories.js +60 -36
- package/src/components/Containers/HomepageHeader/index.vue +2 -26
- package/src/components/Containers/HomepageHeaderNew/index.stories.js +15 -15
- package/src/components/Containers/HomepageHeaderNew/index.vue +97 -68
- package/src/components/Containers/SectionGroup/index.vue +1 -1
- package/src/components/Containers/Subheader/index.vue +5 -1
- package/src/components/Global/AppFooter/FooterSocialShare/index.vue +1 -1
- package/src/components/Global/AppFooter/index.vue +14 -7
- package/src/components/Global/AppFooter/styles.scss +3 -0
- package/src/components/Global/AppHeaderNew/styles.scss +10 -15
- package/src/components/Global/BackToTop/index.vue +8 -8
- package/src/components/Global/Cookies/index.stories.js +16 -10
- package/src/components/Global/Cookies/index.vue +280 -243
- package/src/components/Global/Cookies/styles.scss +54 -54
- package/src/components/Global/DirectoryFilters/SingleTaxonomy/index.vue +50 -133
- package/src/components/Global/DirectoryFilters/index.vue +3 -0
- package/src/components/Global/GlobalNotice/index.vue +79 -100
- package/src/components/Global/SocialShare/index.vue +1 -1
- package/src/components/Global/Strip/index.vue +1 -1
- package/src/components/Paragraphs/Accordion/AccordionItem/index.vue +8 -4
- package/src/components/Paragraphs/Accordion/StepperItem/index.vue +23 -23
- package/src/components/Paragraphs/Accordion/index.stories.js +21 -18
- package/src/components/Paragraphs/Accordion/index.vue +52 -48
- package/src/components/Paragraphs/BrowseContent/index.vue +1 -1
- package/src/components/Paragraphs/BrowseContent/setup.vue +284 -0
- package/src/components/Paragraphs/Chart/Constants.js +952 -952
- package/src/components/Paragraphs/Chart/index.vue +232 -241
- package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.stories.js +34 -0
- package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.vue +321 -0
- package/src/components/Paragraphs/Directory/HSCP/Records/index.stories.js +19 -0
- package/src/components/Paragraphs/Directory/HSCP/Records/index.vue +345 -0
- package/src/components/Paragraphs/Directory/HSCP/Records/pagination.vue +179 -0
- package/src/components/Paragraphs/Directory/Records/CJ/index.vue +1 -1
- package/src/components/Paragraphs/Directory/Records/ISP/index.vue +1 -1
- package/src/components/Paragraphs/Directory/Records/PRS/index.stories.js +34 -0
- package/src/components/Paragraphs/Directory/Records/PRS/index.vue +5 -1
- package/src/components/Paragraphs/Directory/Records/index.storieshide.js +47 -0
- package/src/components/Paragraphs/Directory/Records/index.vue +52 -33
- package/src/components/Paragraphs/Directory/constants.js +23 -5
- package/src/components/Paragraphs/Directory/index.vue +14 -14
- package/src/components/Paragraphs/Directory/{Records/styles.scss → styles.scss} +5 -3
- package/src/components/Paragraphs/ListGroup/index.vue +5 -1
- package/src/components/Paragraphs/Map/Constants.js +4790 -0
- package/src/components/Paragraphs/Map/index.mdx +29 -0
- package/src/components/Paragraphs/Map/index.stories.js +15 -0
- package/src/components/Paragraphs/Map/index.vue +295 -0
- package/src/components/Paragraphs/Map/postcode_location.json +3543 -0
- package/src/components/Paragraphs/ScrollSpy/index.vue +23 -14
- package/src/components/Paragraphs/SelectableCards/index.vue +15 -12
- package/src/components/Paragraphs/TabbedCards/index.vue +13 -14
- package/src/components/Paragraphs/Tabs/index.vue +19 -17
- package/src/components/Paragraphs/TextMedia/MediaTypes/Video/index.vue +9 -9
- package/src/components/Paragraphs/TextMedia/index.vue +20 -16
- package/src/components/Paragraphs/VideoGrid/index.stories.js +43 -19
- package/src/components/Paragraphs/VideoGrid/index.vue +13 -13
- package/src/components/Paragraphs/Webform/index.stories.js +82 -69
- package/src/components/SubComponents/Breadcrumb/index.vue +4 -0
- package/src/components/SubComponents/CardGroup/index.vue +5 -1
- package/src/components/SubComponents/FormAddressPostcode/index.vue +35 -37
- package/src/components/SubComponents/FormInstance/components/handler/index.vue +25 -29
- package/src/components/SubComponents/FormInstance/components/renderer/index.vue +81 -30
- package/src/components/SubComponents/FormInstance/models/overrides/file.js +38 -40
- package/src/components/SubComponents/FormInstance/services/form-submit-parser.js +22 -15
- package/src/components/SubComponents/FormInstance/services/registry-factory.js +1 -1
- package/src/components/SubComponents/FormInstance/stories/fileupload.stories.js +57 -0
- package/src/components/SubComponents/FormInstance/stories/mocks/fileupload.json +25 -0
- package/src/components/SubComponents/FormInstance/style.scss +2 -2
- package/src/components/SubComponents/FormInstance/tests/address.test.js +4 -4
- package/src/components/SubComponents/FormInstance/tests/checkboxes.test.js +7 -7
- package/src/components/SubComponents/FormInstance/tests/customcomposite.test.js +15 -15
- package/src/components/SubComponents/FormInstance/tests/date.test.js +8 -8
- package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +9 -9
- package/src/components/SubComponents/FormInstance/tests/multiple.test.js +13 -13
- package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +120 -120
- package/src/components/SubComponents/FormInstance/tests/scale.test.js +6 -6
- package/src/components/SubComponents/FormInstance/tests/url.test.js +13 -10
- package/src/components/SubComponents/Pagination/index.vue +19 -18
- package/src/components/SubComponents/ResourceGroup/index.vue +5 -1
- package/src/components/SubComponents/Search/SearchListing/index.vue +20 -20
- package/src/components/SubComponents/Search/index.vue +42 -35
- package/src/components/SubComponents/VideoThumbnail/index.vue +48 -133
- package/src/includes/scss/vars/src/colors.module.scss +28 -1
- package/src/index.js +25 -3
- package/src/main.js +2 -10
- package/src/mock/carousel-items.js +71 -46
- package/src/mock/course-provider.js +273 -0
|
@@ -29,15 +29,15 @@ describe(`Form ${testComponent} parser`, () => {
|
|
|
29
29
|
{ checked: false, id: 0, label: '', value: 2 },
|
|
30
30
|
{ checked: true, id: 0, label: '', value: 3 },
|
|
31
31
|
{ checked: false, id: 0, label: '', value: 4 },
|
|
32
|
-
{ checked: false, id: 0, label: '', value: 5 }
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
])
|
|
32
|
+
{ checked: false, id: 0, label: '', value: 5 },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
]),
|
|
36
36
|
)
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
it(`should return a submission value`, () => {
|
|
40
|
-
const submission = FormTestUtils.handleSubmission(json, 3)
|
|
39
|
+
it(`should return a submission value`, async () => {
|
|
40
|
+
const submission = await FormTestUtils.handleSubmission(json, 3)
|
|
41
41
|
expect(submission).toEqual({ scale1: 3 })
|
|
42
42
|
})
|
|
43
43
|
})
|
|
@@ -20,26 +20,29 @@ describe(`Form ${testComponent} parser`, () => {
|
|
|
20
20
|
labelPosition: 'top',
|
|
21
21
|
mask: false,
|
|
22
22
|
type: 'url',
|
|
23
|
-
validate: { maxLength: 255, required: false }
|
|
24
|
-
}
|
|
25
|
-
])
|
|
23
|
+
validate: { maxLength: 255, required: false },
|
|
24
|
+
},
|
|
25
|
+
]),
|
|
26
26
|
)
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
it(`should return a submission value with prefix`, () => {
|
|
30
|
-
const submission = FormTestUtils.handleSubmission(
|
|
29
|
+
it(`should return a submission value with prefix`, async () => {
|
|
30
|
+
const submission = await FormTestUtils.handleSubmission(
|
|
31
31
|
json,
|
|
32
|
-
'https://www.google.com'
|
|
32
|
+
'https://www.google.com',
|
|
33
33
|
)
|
|
34
34
|
expect(submission).toEqual({
|
|
35
|
-
url1: 'https://www.google.com'
|
|
35
|
+
url1: 'https://www.google.com',
|
|
36
36
|
})
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
it(`should return a submission value without prefix`, () => {
|
|
40
|
-
const submission = FormTestUtils.handleSubmission(
|
|
39
|
+
it(`should return a submission value without prefix`, async () => {
|
|
40
|
+
const submission = await FormTestUtils.handleSubmission(
|
|
41
|
+
json,
|
|
42
|
+
'www.google.com',
|
|
43
|
+
)
|
|
41
44
|
expect(submission).toEqual({
|
|
42
|
-
url1: 'http://www.google.com'
|
|
45
|
+
url1: 'http://www.google.com',
|
|
43
46
|
})
|
|
44
47
|
})
|
|
45
48
|
})
|
|
@@ -52,37 +52,37 @@ import CtaButton from '../../SubComponents/CtaButton/index.vue'
|
|
|
52
52
|
|
|
53
53
|
export default {
|
|
54
54
|
components: {
|
|
55
|
-
CtaButton
|
|
55
|
+
CtaButton,
|
|
56
56
|
},
|
|
57
57
|
props: {
|
|
58
58
|
ariaLabel: {
|
|
59
59
|
type: String,
|
|
60
|
-
required: true
|
|
60
|
+
required: true,
|
|
61
61
|
},
|
|
62
62
|
rows: {
|
|
63
63
|
type: Number,
|
|
64
|
-
required: true
|
|
64
|
+
required: true,
|
|
65
65
|
},
|
|
66
66
|
offset: {
|
|
67
67
|
type: Number,
|
|
68
|
-
required: true
|
|
68
|
+
required: true,
|
|
69
69
|
},
|
|
70
70
|
total: {
|
|
71
71
|
type: Number,
|
|
72
|
-
required: true
|
|
72
|
+
required: true,
|
|
73
73
|
},
|
|
74
74
|
align: {
|
|
75
75
|
type: String,
|
|
76
|
-
default: 'start'
|
|
76
|
+
default: 'start',
|
|
77
77
|
},
|
|
78
78
|
maxPages: {
|
|
79
79
|
type: Number,
|
|
80
|
-
default: 5
|
|
81
|
-
}
|
|
80
|
+
default: 5,
|
|
81
|
+
},
|
|
82
82
|
},
|
|
83
83
|
data() {
|
|
84
84
|
return {
|
|
85
|
-
currentPage: 1
|
|
85
|
+
currentPage: 1,
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
computed: {
|
|
@@ -91,27 +91,28 @@ export default {
|
|
|
91
91
|
this.total,
|
|
92
92
|
this.currentPage,
|
|
93
93
|
this.rows,
|
|
94
|
-
this.maxPages
|
|
94
|
+
this.maxPages,
|
|
95
95
|
)
|
|
96
96
|
return currentPaginationSnapshot
|
|
97
97
|
},
|
|
98
98
|
information() {
|
|
99
99
|
const totalPages = this.pagination.totalPages
|
|
100
100
|
return `${totalPages} pages of results`
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
102
|
},
|
|
103
103
|
watch: {
|
|
104
104
|
offset() {
|
|
105
105
|
if (this.offset === 0 && this.total > 0) {
|
|
106
106
|
this.currentPage = 1
|
|
107
107
|
}
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
109
|
},
|
|
110
110
|
mounted() {
|
|
111
111
|
if (this.offset === 0) {
|
|
112
112
|
this.currentPage = 1
|
|
113
113
|
} else {
|
|
114
|
-
this.currentPage = this.offset / this.rows + 1
|
|
114
|
+
// this.currentPage = this.offset / this.rows + 1
|
|
115
|
+
this.currentPage = this.offset
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
methods: {
|
|
@@ -119,23 +120,23 @@ export default {
|
|
|
119
120
|
if (this.currentPage !== currentPage) {
|
|
120
121
|
this.currentPage = currentPage
|
|
121
122
|
this.$emit('pageClicked', {
|
|
122
|
-
...this.pagination
|
|
123
|
+
...this.pagination,
|
|
123
124
|
})
|
|
124
125
|
}
|
|
125
126
|
},
|
|
126
127
|
next(el) {
|
|
127
128
|
this.currentPage += 1
|
|
128
129
|
this.$emit('next', {
|
|
129
|
-
...this.pagination
|
|
130
|
+
...this.pagination,
|
|
130
131
|
})
|
|
131
132
|
},
|
|
132
133
|
previous() {
|
|
133
134
|
this.currentPage -= 1
|
|
134
135
|
this.$emit('prev', {
|
|
135
|
-
...this.pagination
|
|
136
|
+
...this.pagination,
|
|
136
137
|
})
|
|
137
|
-
}
|
|
138
|
-
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
139
140
|
}
|
|
140
141
|
</script>
|
|
141
142
|
<style lang="scss" scoped>
|
|
@@ -438,7 +438,11 @@ export default {
|
|
|
438
438
|
},
|
|
439
439
|
selectedCard(card) {
|
|
440
440
|
// Some custom logic for gov caretaker logic
|
|
441
|
-
if (
|
|
441
|
+
if (
|
|
442
|
+
(this.$config
|
|
443
|
+
? this.$config.public.caretaker
|
|
444
|
+
: process.env.CARETAKER) === 'true'
|
|
445
|
+
) {
|
|
442
446
|
if (!isGovSite(card?.selectedCard?.link)) {
|
|
443
447
|
// this.$store.commit('page/SET_CARETAKER_REF', 'list-group')
|
|
444
448
|
// this.$root.$emit('caretaker-open', card?.selectedCard?.link)
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:taxonomies="{
|
|
46
46
|
industry: card.industry,
|
|
47
47
|
topic: card.topic,
|
|
48
|
-
language: card.language
|
|
48
|
+
language: card.language,
|
|
49
49
|
}"
|
|
50
50
|
:is-card-title-selectable="isCardTitleSelectable"
|
|
51
51
|
/>
|
|
@@ -94,44 +94,44 @@ export default {
|
|
|
94
94
|
props: {
|
|
95
95
|
isTypeahead: {
|
|
96
96
|
type: Boolean,
|
|
97
|
-
required: false
|
|
97
|
+
required: false,
|
|
98
98
|
},
|
|
99
99
|
pageLimit: {
|
|
100
100
|
type: Number,
|
|
101
101
|
required: false,
|
|
102
|
-
default: 20
|
|
102
|
+
default: 20,
|
|
103
103
|
},
|
|
104
104
|
numFound: {
|
|
105
105
|
type: Number,
|
|
106
106
|
required: false,
|
|
107
|
-
default: 0
|
|
107
|
+
default: 0,
|
|
108
108
|
},
|
|
109
109
|
query: {
|
|
110
110
|
type: String,
|
|
111
111
|
required: false,
|
|
112
|
-
default: ''
|
|
112
|
+
default: '',
|
|
113
113
|
},
|
|
114
114
|
results: {
|
|
115
115
|
type: Array,
|
|
116
|
-
default: () => []
|
|
116
|
+
default: () => [],
|
|
117
117
|
},
|
|
118
118
|
offset: {
|
|
119
119
|
type: Number,
|
|
120
120
|
required: false,
|
|
121
|
-
default: 0
|
|
121
|
+
default: 0,
|
|
122
122
|
},
|
|
123
123
|
isLoading: {
|
|
124
124
|
type: Boolean,
|
|
125
|
-
required: false
|
|
125
|
+
required: false,
|
|
126
126
|
},
|
|
127
127
|
suggestion: {
|
|
128
128
|
type: String,
|
|
129
|
-
default: null
|
|
129
|
+
default: null,
|
|
130
130
|
},
|
|
131
131
|
isCardTitleSelectable: {
|
|
132
132
|
type: Boolean,
|
|
133
|
-
default: false
|
|
134
|
-
}
|
|
133
|
+
default: false,
|
|
134
|
+
},
|
|
135
135
|
},
|
|
136
136
|
methods: {
|
|
137
137
|
onClickItem(event, item, index) {
|
|
@@ -146,8 +146,8 @@ export default {
|
|
|
146
146
|
onSelectCardTitle(card) {
|
|
147
147
|
navigateToPath.call(
|
|
148
148
|
this,
|
|
149
|
-
card?.selectedCard?.link,
|
|
150
|
-
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
|
|
149
|
+
card?.selectedCard?.link.match(/https?:\/\/[^\/]+(\/[^?#]*)/)[1], // open link in current environment
|
|
150
|
+
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
|
|
151
151
|
)
|
|
152
152
|
this.$nextTick(() => this.$emit('selected-title'))
|
|
153
153
|
|
|
@@ -158,8 +158,8 @@ export default {
|
|
|
158
158
|
onSelectResult(card) {
|
|
159
159
|
navigateToPath.call(
|
|
160
160
|
this,
|
|
161
|
-
card?.selectedCard?.link,
|
|
162
|
-
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
|
|
161
|
+
card?.selectedCard?.link.match(/https?:\/\/[^\/]+(\/[^?#]*)/)[1], // title click is used for search result, but change also included here
|
|
162
|
+
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
|
|
163
163
|
)
|
|
164
164
|
this.$nextTick(() => this.$emit('selected'))
|
|
165
165
|
|
|
@@ -173,8 +173,8 @@ export default {
|
|
|
173
173
|
this.$route?.path === '/'
|
|
174
174
|
? 'Homepage'
|
|
175
175
|
: this.$route?.path === '/search'
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
? 'Search Page'
|
|
177
|
+
: this.$route?.path,
|
|
178
178
|
label: this.query,
|
|
179
179
|
results: this.results.length,
|
|
180
180
|
clickText: card.selectedCard.title,
|
|
@@ -183,7 +183,7 @@ export default {
|
|
|
183
183
|
targetElement: card.ev.target,
|
|
184
184
|
industry: card?.selectedCard?.industry,
|
|
185
185
|
topic: card?.selectedCard?.topic,
|
|
186
|
-
language: card?.selectedCard?.language
|
|
186
|
+
language: card?.selectedCard?.language,
|
|
187
187
|
}
|
|
188
188
|
this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
|
|
189
189
|
},
|
|
@@ -191,8 +191,8 @@ export default {
|
|
|
191
191
|
if (this.$nuxt) {
|
|
192
192
|
this.$router.push('/search?q=' + this.query)
|
|
193
193
|
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
196
|
}
|
|
197
197
|
</script>
|
|
198
198
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
v-model="searchQuery"
|
|
17
17
|
name="search"
|
|
18
18
|
aria-label="searchbar"
|
|
19
|
-
debounce="600"
|
|
20
19
|
autocomplete="off"
|
|
21
20
|
trim
|
|
22
21
|
@update="searchType !== 'googlerest' ? onChange : () => {}"
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
v-if="loadSearchList && (searchResults || isLoading)"
|
|
34
33
|
:class="{
|
|
35
34
|
[`wcl-search__typeahead`]: isTypeahead,
|
|
36
|
-
[`wcl-search__modal`]: isTypeahead
|
|
35
|
+
[`wcl-search__modal`]: isTypeahead,
|
|
37
36
|
}"
|
|
38
37
|
:is-loading="isLoading"
|
|
39
38
|
:is-typeahead="isTypeahead"
|
|
@@ -58,33 +57,34 @@ import searchIcon from '../../../assets/icons/search.svg?url'
|
|
|
58
57
|
import SearchListing from './SearchListing/index.vue'
|
|
59
58
|
import { BButton, BInputGroup, BFormInput } from 'bootstrap-vue-next'
|
|
60
59
|
|
|
60
|
+
|
|
61
61
|
export default {
|
|
62
62
|
components: { SearchListing, BButton, BInputGroup, BFormInput },
|
|
63
63
|
props: {
|
|
64
64
|
pageLimit: {
|
|
65
65
|
type: Number,
|
|
66
|
-
required: true
|
|
66
|
+
required: true,
|
|
67
67
|
},
|
|
68
68
|
contentParser: {
|
|
69
69
|
type: Function,
|
|
70
|
-
required: true
|
|
70
|
+
required: true,
|
|
71
71
|
},
|
|
72
72
|
isTypeahead: {
|
|
73
73
|
type: Boolean,
|
|
74
|
-
required: true
|
|
74
|
+
required: true,
|
|
75
75
|
},
|
|
76
76
|
initialSearchQuery: {
|
|
77
77
|
type: String,
|
|
78
|
-
default: ''
|
|
78
|
+
default: '',
|
|
79
79
|
},
|
|
80
80
|
googleSearchFlag: {
|
|
81
81
|
type: String,
|
|
82
|
-
default: 'solar'
|
|
82
|
+
default: 'solar',
|
|
83
83
|
},
|
|
84
84
|
visibleSearchList: {
|
|
85
85
|
type: Boolean,
|
|
86
|
-
default: true
|
|
87
|
-
}
|
|
86
|
+
default: true,
|
|
87
|
+
},
|
|
88
88
|
},
|
|
89
89
|
data() {
|
|
90
90
|
return {
|
|
@@ -95,16 +95,16 @@ export default {
|
|
|
95
95
|
field_language: '8671',
|
|
96
96
|
searchType: this.googleSearchFlag,
|
|
97
97
|
googleSearchScript: false,
|
|
98
|
-
loadSearchList: this.visibleSearchList
|
|
98
|
+
loadSearchList: this.visibleSearchList,
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
computed: {
|
|
102
102
|
searchClass() {
|
|
103
103
|
return {
|
|
104
104
|
'wcl-search': true,
|
|
105
|
-
'wcl-search__google': this.searchType !== 'solar'
|
|
105
|
+
'wcl-search__google': this.searchType !== 'solar',
|
|
106
106
|
}
|
|
107
|
-
}
|
|
107
|
+
},
|
|
108
108
|
},
|
|
109
109
|
mounted() {
|
|
110
110
|
if (this.searchType === 'google') {
|
|
@@ -134,9 +134,9 @@ export default {
|
|
|
134
134
|
key: apiKey,
|
|
135
135
|
cx: searchEngineId,
|
|
136
136
|
q: query,
|
|
137
|
-
start: start
|
|
138
|
-
}
|
|
139
|
-
}
|
|
137
|
+
start: start,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
140
|
)
|
|
141
141
|
return response
|
|
142
142
|
} catch (error) {
|
|
@@ -156,7 +156,7 @@ export default {
|
|
|
156
156
|
apiKey,
|
|
157
157
|
searchEngineId,
|
|
158
158
|
searchQuery,
|
|
159
|
-
start
|
|
159
|
+
start,
|
|
160
160
|
)
|
|
161
161
|
let items = []
|
|
162
162
|
let suggest = response?.data?.spelling?.correctedQuery || ''
|
|
@@ -165,7 +165,7 @@ export default {
|
|
|
165
165
|
apiKey,
|
|
166
166
|
searchEngineId,
|
|
167
167
|
response?.data?.spelling?.correctedQuery,
|
|
168
|
-
start
|
|
168
|
+
start,
|
|
169
169
|
)
|
|
170
170
|
items = response?.data?.items
|
|
171
171
|
} else if (response?.data?.items) {
|
|
@@ -181,7 +181,7 @@ export default {
|
|
|
181
181
|
// Return the modified item with the updated title
|
|
182
182
|
return {
|
|
183
183
|
...item,
|
|
184
|
-
title: modifiedTitle
|
|
184
|
+
title: modifiedTitle,
|
|
185
185
|
}
|
|
186
186
|
})
|
|
187
187
|
|
|
@@ -190,7 +190,7 @@ export default {
|
|
|
190
190
|
numFound: Number(totalResults),
|
|
191
191
|
query: this.searchQuery,
|
|
192
192
|
results: modifiedResults,
|
|
193
|
-
suggestion: suggest
|
|
193
|
+
suggestion: suggest,
|
|
194
194
|
}
|
|
195
195
|
} else {
|
|
196
196
|
this.searchResults = {
|
|
@@ -198,7 +198,7 @@ export default {
|
|
|
198
198
|
numFound: 0,
|
|
199
199
|
query: this.searchQuery ?? '',
|
|
200
200
|
results: [],
|
|
201
|
-
suggestion: suggest
|
|
201
|
+
suggestion: suggest,
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
this.$emit('loading', false)
|
|
@@ -214,10 +214,10 @@ export default {
|
|
|
214
214
|
this.$route?.path === '/'
|
|
215
215
|
? 'Homepage'
|
|
216
216
|
: this.$route?.path === '/search'
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
? 'Search Page'
|
|
218
|
+
: this.$route?.path,
|
|
219
219
|
label: this.searchQuery,
|
|
220
|
-
results: this.searchResults.numFound
|
|
220
|
+
results: this.searchResults.numFound,
|
|
221
221
|
}
|
|
222
222
|
if (this.$gtm) {
|
|
223
223
|
this.$gtm.push({ event: 'custom.search.site.submit', ...attrs })
|
|
@@ -235,11 +235,14 @@ export default {
|
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
237
|
onSearch(e) {
|
|
238
|
+
// debugger
|
|
238
239
|
const { path } = this.$route || {}
|
|
239
240
|
|
|
241
|
+
|
|
242
|
+
|
|
240
243
|
// Home page
|
|
241
244
|
if (
|
|
242
|
-
(e?.type === 'click' || e?.key
|
|
245
|
+
(e?.type === 'click' || e?.key == 'Enter') &&
|
|
243
246
|
this.searchQuery &&
|
|
244
247
|
this.searchQuery.length > 2 &&
|
|
245
248
|
path === '/'
|
|
@@ -279,6 +282,8 @@ export default {
|
|
|
279
282
|
}
|
|
280
283
|
},
|
|
281
284
|
onChange(e) {
|
|
285
|
+
//debugger
|
|
286
|
+
|
|
282
287
|
if (this.searchQuery && this.searchQuery.length > 2) {
|
|
283
288
|
this.onSearch(e)
|
|
284
289
|
}
|
|
@@ -291,7 +296,7 @@ export default {
|
|
|
291
296
|
query: searchQuery,
|
|
292
297
|
start: pageNr > 1 ? (pageNr - 1) * pageLimit : 0,
|
|
293
298
|
rows: pageLimit,
|
|
294
|
-
field_language: this.field_language
|
|
299
|
+
field_language: this.field_language,
|
|
295
300
|
}).then((res) => {
|
|
296
301
|
if (res.numFound) {
|
|
297
302
|
this.searchResults = {
|
|
@@ -299,7 +304,7 @@ export default {
|
|
|
299
304
|
numFound: Number(res.numFound),
|
|
300
305
|
query: searchQuery,
|
|
301
306
|
results: res.results,
|
|
302
|
-
suggestion: null
|
|
307
|
+
suggestion: null,
|
|
303
308
|
}
|
|
304
309
|
} else {
|
|
305
310
|
this.searchResults = {
|
|
@@ -307,7 +312,7 @@ export default {
|
|
|
307
312
|
numFound: 0,
|
|
308
313
|
query: this.searchQuery ?? '',
|
|
309
314
|
results: [],
|
|
310
|
-
suggestion: null
|
|
315
|
+
suggestion: null,
|
|
311
316
|
}
|
|
312
317
|
}
|
|
313
318
|
this.$emit('loading', false)
|
|
@@ -322,10 +327,10 @@ export default {
|
|
|
322
327
|
this.$route?.path === '/'
|
|
323
328
|
? 'Homepage'
|
|
324
329
|
: this.$route?.path === '/search'
|
|
325
|
-
|
|
326
|
-
|
|
330
|
+
? 'Search Page'
|
|
331
|
+
: this.$route?.path,
|
|
327
332
|
label: this.searchQuery,
|
|
328
|
-
results: this.searchResults.numFound
|
|
333
|
+
results: this.searchResults.numFound,
|
|
329
334
|
}
|
|
330
335
|
if (this.$gtm) {
|
|
331
336
|
this.$gtm.push({ event: 'custom.search.site.submit', ...attrs })
|
|
@@ -340,7 +345,9 @@ export default {
|
|
|
340
345
|
if (this.googleSearchScript === false) {
|
|
341
346
|
const script = document.createElement('script')
|
|
342
347
|
script.async = true
|
|
343
|
-
script.src =
|
|
348
|
+
script.src = this.$config
|
|
349
|
+
? this.$config.public.googleSearch
|
|
350
|
+
: process.env.GOOGLE__URL
|
|
344
351
|
document.head.appendChild(script)
|
|
345
352
|
this.googleSearchScript = true
|
|
346
353
|
|
|
@@ -386,8 +393,8 @@ export default {
|
|
|
386
393
|
|
|
387
394
|
this.setupPaginationEvent()
|
|
388
395
|
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
396
|
+
},
|
|
397
|
+
},
|
|
391
398
|
}
|
|
392
399
|
</script>
|
|
393
400
|
<style lang="scss" scoped>
|
|
@@ -454,8 +461,8 @@ export default {
|
|
|
454
461
|
display: none;
|
|
455
462
|
}
|
|
456
463
|
}
|
|
457
|
-
|
|
458
|
-
|
|
464
|
+
// Google Search styling
|
|
465
|
+
&.wcl-search__google {
|
|
459
466
|
:deep(form.gsc-search-box) {
|
|
460
467
|
position: relative;
|
|
461
468
|
display: -ms-flexbox;
|