@worksafevictoria/wcl7.5 1.7.3 → 1.8.0-beta.10

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.
Files changed (24) hide show
  1. package/lib/utility.js +2 -0
  2. package/package.json +1 -1
  3. package/src/components/Common/CardGrid/index.vue +77 -82
  4. package/src/components/Common/CardGridItem/index.vue +6 -2
  5. package/src/components/Global/AppHeader/ModalSearch/index.vue +1 -0
  6. package/src/components/Global/AppHeader/index.vue +194 -284
  7. package/src/components/Global/AppHeaderNew/ModalSearch/index.vue +16 -14
  8. package/src/components/Paragraphs/Directory/Asbestos/Records/SingleRecord/index.stories.js +30 -0
  9. package/src/components/Paragraphs/Directory/Asbestos/Records/SingleRecord/index.vue +182 -0
  10. package/src/components/Paragraphs/Directory/Asbestos/Records/index.stories.js +19 -0
  11. package/src/components/Paragraphs/Directory/Asbestos/Records/index.vue +254 -0
  12. package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.vue +38 -152
  13. package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/styles.scss +127 -0
  14. package/src/components/Paragraphs/Directory/HSCP/Records/index.vue +41 -87
  15. package/src/components/Paragraphs/Directory/HSCP/styles.scss +68 -0
  16. package/src/components/Paragraphs/Directory/Records/PRS/index.stories.js +2 -2
  17. package/src/components/Paragraphs/Directory/styles.scss +2 -0
  18. package/src/components/SubComponents/FormInstance/models/overrides/file.js +2 -1
  19. package/src/components/SubComponents/Search/SearchListing/index.vue +51 -45
  20. package/src/components/SubComponents/Search/index.stories.js +4 -3
  21. package/src/components/SubComponents/Search/index.vue +130 -138
  22. package/src/index.js +2 -0
  23. package/src/mock/asbestos-removalists.js +226 -0
  24. package/src/mock/course-provider.js +33 -19
@@ -6,6 +6,7 @@ export class FileFormElement extends BaseFormElement {
6
6
  }
7
7
 
8
8
  async transformSubmissionValue(value, axios) {
9
+ const apiUrl = this.getFormSettingsMeta().contentApiUrl
9
10
  const promises = await Promise.all(
10
11
  value.map((file) => {
11
12
  const base64Data = file.url.split(',')[1]
@@ -18,7 +19,7 @@ export class FileFormElement extends BaseFormElement {
18
19
  const blob = new Blob([byteArray], { type: 'text/plain' })
19
20
 
20
21
  return axios.post(
21
- `https://content-dev-v2.api.worksafe.vic.gov.au/webform_rest/${this.webformElement['#webform']}/upload/${this.webformElement['#webform_key']}`,
22
+ `${apiUrl}/webform_rest/${this.webformElement['#webform']}/upload/${this.webformElement['#webform_key']}`,
22
23
  blob,
23
24
  {
24
25
  headers: {
@@ -5,10 +5,7 @@
5
5
  v-if="!(isTypeahead && numFound > 0) && !isLoading"
6
6
  class="app-search-result__found"
7
7
  >
8
- <span
9
- >{{ numFound }} results found for
10
- {{ !suggestion ? query : suggestion }}</span
11
- >
8
+ <span>{{ numFound }} results found for {{ !suggestion ? query : suggestion }}</span>
12
9
  </p>
13
10
  <p
14
11
  v-if="results && results.length > 0 && suggestion"
@@ -21,12 +18,13 @@
21
18
  :force-lg-columns-per-row="1"
22
19
  :force-md-columns-per-row="1"
23
20
  :cards="results"
24
- :is-selectable="false"
21
+ :is-selectable="isSelectable"
25
22
  :size="'full'"
26
23
  :row-spacing="'none'"
27
24
  :no-padding-top="true"
28
- @selected="onSelectResult"
29
- @selected-title="onSelectCardTitle"
25
+ :google-search-flag="googleSearchFlag"
26
+ @selected="handleSelect"
27
+ @selected-title="handleSelect"
30
28
  >
31
29
  <template v-slot:cardItem="{ card }">
32
30
  <card-grid-item
@@ -41,6 +39,7 @@
41
39
  ? truncate(card.description, 144)
42
40
  : card.htmlSnippet || ''
43
41
  "
42
+ :link="card.link ? card.link : false"
44
43
  :strip-description-html="true"
45
44
  :taxonomies="{
46
45
  industry: card.industry,
@@ -82,14 +81,14 @@
82
81
  </template>
83
82
 
84
83
  <script>
85
- import CardGrid from '../../../Common/CardGrid/index.vue'
86
- import CardGridItem from '../../../Common/CardGridItem/index.vue'
87
- import { navigateToPath } from '../../../../../lib/utility'
88
- import Pagination from '../../Pagination/index.vue'
89
- import Column from '../../../Containers/Column/index.vue'
84
+ import CardGrid from "../../../Common/CardGrid/index.vue";
85
+ import CardGridItem from "../../../Common/CardGridItem/index.vue";
86
+ import { navigateToPath } from "../../../../../lib/utility";
87
+ import Pagination from "../../Pagination/index.vue";
88
+ import Column from "../../../Containers/Column/index.vue";
90
89
 
91
90
  export default {
92
- name: 'SearchListing',
91
+ name: "SearchListing",
93
92
  components: { CardGrid, CardGridItem, Pagination, Column },
94
93
  props: {
95
94
  isTypeahead: {
@@ -109,7 +108,7 @@ export default {
109
108
  query: {
110
109
  type: String,
111
110
  required: false,
112
- default: '',
111
+ default: "",
113
112
  },
114
113
  results: {
115
114
  type: Array,
@@ -132,49 +131,56 @@ export default {
132
131
  type: Boolean,
133
132
  default: false,
134
133
  },
134
+ isSelectable: {
135
+ type: Boolean,
136
+ default: true,
137
+ },
138
+ googleSearchFlag: {
139
+ type: String,
140
+ default: "solar",
141
+ },
135
142
  },
136
143
  methods: {
137
144
  onClickItem(event, item, index) {
138
- this.$emit('select-item', event.target, item, index)
145
+ this.$emit("select-item", event.target, item, index);
139
146
  },
140
147
  truncate(value, limit) {
141
148
  if (value.length > limit) {
142
- value = value.substring(0, limit - 3) + '...'
149
+ value = value.substring(0, limit - 3) + "...";
143
150
  }
144
- return value
151
+ return value;
145
152
  },
146
- onSelectCardTitle(card) {
147
- navigateToPath.call(
148
- this,
149
- card?.selectedCard?.link.match(/https?:\/\/[^\/]+(\/[^?#]*)/)[1], // open link in current environment
150
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
151
- )
152
- this.$nextTick(() => this.$emit('selected-title'))
153
+ handleSelect(card) {
154
+ debugger;
153
155
 
154
- if (this.$gtm) {
155
- this.fireGTM(card)
156
+ const isSolar = this.googleSearchFlag === "solar";
157
+ const link = card?.selectedCard?.link;
158
+ const openInNewTab = card?.ev?.ctrlKey || card?.ev?.metaKey;
159
+
160
+ // Extract pathname only for solar
161
+ const finalLink = isSolar ? link : link?.match(/https?:\/\/[^\/]+(\/[^?#]*)/)?.[1];
162
+
163
+ if (finalLink) {
164
+ navigateToPath.call(this, finalLink, openInNewTab);
156
165
  }
157
- },
158
- onSelectResult(card) {
159
- navigateToPath.call(
160
- this,
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
- )
164
- this.$nextTick(() => this.$emit('selected'))
166
+
167
+ this.$nextTick(() => {
168
+ this.$emit(isSolar ? "selected" : "selected-title");
169
+ });
165
170
 
166
171
  if (this.$gtm) {
167
- this.fireGTM(card)
172
+ this.fireGTM(card);
168
173
  }
169
174
  },
175
+
170
176
  fireGTM(card) {
171
177
  let attrs = {
172
178
  location:
173
- this.$route?.path === '/'
174
- ? 'Homepage'
175
- : this.$route?.path === '/search'
176
- ? 'Search Page'
177
- : this.$route?.path,
179
+ this.$route?.path === "/"
180
+ ? "Homepage"
181
+ : this.$route?.path === "/search"
182
+ ? "Search Page"
183
+ : this.$route?.path,
178
184
  label: this.query,
179
185
  results: this.results.length,
180
186
  clickText: card.selectedCard.title,
@@ -184,20 +190,20 @@ export default {
184
190
  industry: card?.selectedCard?.industry,
185
191
  topic: card?.selectedCard?.topic,
186
192
  language: card?.selectedCard?.language,
187
- }
188
- this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
193
+ };
194
+ this.$gtm.push({ event: "custom.search.site.result", ...attrs });
189
195
  },
190
196
  showMoreResults() {
191
197
  if (this.$nuxt) {
192
- this.$router.push('/search?q=' + this.query)
198
+ this.$router.push("/search?q=" + this.query);
193
199
  }
194
200
  },
195
201
  },
196
- }
202
+ };
197
203
  </script>
198
204
 
199
205
  <style lang="scss" scoped>
200
- @import '../../../../includes/scss/all';
206
+ @import "../../../../includes/scss/all";
201
207
  .app-search-result {
202
208
  &__found,
203
209
  &__suggestion {
@@ -5,7 +5,8 @@ const contentParser = () => {
5
5
  results: [
6
6
  {
7
7
  title: 'Content title 1',
8
- description: 'Content description 2'
8
+ description: 'Content description 2',
9
+ link: '/mental-health'
9
10
  }
10
11
  ],
11
12
  offset: 0,
@@ -37,8 +38,8 @@ const DefaultSearch = (args) => ({
37
38
  setup () {
38
39
  return { args }
39
40
  },
40
- template: `<search
41
- v-bind="args"
41
+ template: `<search
42
+ v-bind="args"
42
43
  ref="solrsearch" />`
43
44
  })
44
45