@worksafevictoria/wcl7.5 1.8.0-beta.5 → 1.8.0-beta.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.8.0-beta.5",
3
+ "version": "1.8.0-beta.7",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -227,6 +227,7 @@ export default {
227
227
  },
228
228
  methods: {
229
229
  cardTitleSelected(selectedCard, ev) {
230
+ debugger;
230
231
  this.clearCards();
231
232
  selectedCard.selected = !!!selectedCard.selected;
232
233
  const selectedCardModelIndex = this.getChildIndex(selectedCard);
@@ -13,11 +13,7 @@
13
13
  >
14
14
  <nuxt-link class="dark" to="/">
15
15
  <img
16
- :alt="
17
- isWorkWell
18
- ? 'Work Well Victoria - Logo'
19
- : 'Work Safe Victoria - Logo'
20
- "
16
+ :alt="isWorkWell ? 'Work Well Victoria - Logo' : 'Work Safe Victoria - Logo'"
21
17
  width="127"
22
18
  height="55"
23
19
  :src="isWorkWell ? WorkWellLogo : WorkSafeLogo"
@@ -50,7 +46,7 @@
50
46
  @keydown.tab="submenuFocus"
51
47
  >
52
48
  <caret-left />
53
- {{ isThirdLevelOpen ? firstLevelItemName : 'Main menu' }}
49
+ {{ isThirdLevelOpen ? firstLevelItemName : "Main menu" }}
54
50
  </button>
55
51
  </div>
56
52
  <nav
@@ -73,10 +69,7 @@
73
69
  role="button"
74
70
  aria-expanded="false"
75
71
  @click.prevent="
76
- firstLevelClick(
77
- firstLevelLink,
78
- `firstLevelMenuItem-${parentIndex}`,
79
- )
72
+ firstLevelClick(firstLevelLink, `firstLevelMenuItem-${parentIndex}`)
80
73
  "
81
74
  @mouseover="mouseHover('firstLevelMenuItem', parentIndex)"
82
75
  @mouseleave="mouseLeave('firstLevelMenuItem', parentIndex)"
@@ -114,8 +107,7 @@
114
107
  <div
115
108
  class="sub-nav-container__wrap"
116
109
  :class="{
117
- 'styled-scrollbar':
118
- screen === 'mobile' && isSecondLevelOpen,
110
+ 'styled-scrollbar': screen === 'mobile' && isSecondLevelOpen,
119
111
  }"
120
112
  >
121
113
  <div
@@ -137,9 +129,7 @@
137
129
  <div class="selected-items">
138
130
  <ul v-if="firstLevelLink.below" class="sub-nav-group">
139
131
  <li
140
- v-for="(
141
- secondLevelLink, secondIndex
142
- ) in firstLevelLink.below"
132
+ v-for="(secondLevelLink, secondIndex) in firstLevelLink.below"
143
133
  :key="secondLevelLink.key"
144
134
  :ref="`secondLevelMenuItem-${parentIndex}-${secondIndex}`"
145
135
  class="sub-nav-parent-item"
@@ -151,45 +141,25 @@
151
141
  role="button"
152
142
  aria-expanded="false"
153
143
  @keydown.tab="
154
- searchFocus(
155
- secondIndex,
156
- firstLevelLink.below.length,
157
- $event,
158
- )
144
+ searchFocus(secondIndex, firstLevelLink.below.length, $event)
159
145
  "
160
146
  @click.prevent="
161
147
  secondLevelClick(
162
148
  secondLevelLink,
163
- `secondLevelMenuItem-${parentIndex}-${secondIndex}`,
149
+ `secondLevelMenuItem-${parentIndex}-${secondIndex}`
164
150
  )
165
151
  "
166
152
  @mouseover="
167
- mouseHover(
168
- 'secondLevelMenuItem',
169
- parentIndex,
170
- secondIndex,
171
- )
153
+ mouseHover('secondLevelMenuItem', parentIndex, secondIndex)
172
154
  "
173
155
  @mouseleave="
174
- mouseLeave(
175
- 'secondLevelMenuItem',
176
- parentIndex,
177
- secondIndex,
178
- )
156
+ mouseLeave('secondLevelMenuItem', parentIndex, secondIndex)
179
157
  "
180
158
  @focusin="
181
- mouseHover(
182
- 'secondLevelMenuItem',
183
- parentIndex,
184
- secondIndex,
185
- )
159
+ mouseHover('secondLevelMenuItem', parentIndex, secondIndex)
186
160
  "
187
161
  @focusout="
188
- mouseLeave(
189
- 'secondLevelMenuItem',
190
- parentIndex,
191
- secondIndex,
192
- )
162
+ mouseLeave('secondLevelMenuItem', parentIndex, secondIndex)
193
163
  "
194
164
  >
195
165
  <span>{{ secondLevelLink.title }}</span>
@@ -210,39 +180,19 @@
210
180
  class="dark"
211
181
  :to="secondLevelLink.relative"
212
182
  @keydown.tab.native="
213
- searchFocus(
214
- secondIndex,
215
- firstLevelLink.below.length,
216
- $event,
217
- )
183
+ searchFocus(secondIndex, firstLevelLink.below.length, $event)
218
184
  "
219
185
  @mouseover.native="
220
- mouseHover(
221
- 'secondLevelMenuItem',
222
- parentIndex,
223
- secondIndex,
224
- )
186
+ mouseHover('secondLevelMenuItem', parentIndex, secondIndex)
225
187
  "
226
188
  @mouseleave.native="
227
- mouseLeave(
228
- 'secondLevelMenuItem',
229
- parentIndex,
230
- secondIndex,
231
- )
189
+ mouseLeave('secondLevelMenuItem', parentIndex, secondIndex)
232
190
  "
233
191
  @focusin.native="
234
- mouseHover(
235
- 'secondLevelMenuItem',
236
- parentIndex,
237
- secondIndex,
238
- )
192
+ mouseHover('secondLevelMenuItem', parentIndex, secondIndex)
239
193
  "
240
194
  @focusout.native="
241
- mouseLeave(
242
- 'secondLevelMenuItem',
243
- parentIndex,
244
- secondIndex,
245
- )
195
+ mouseLeave('secondLevelMenuItem', parentIndex, secondIndex)
246
196
  "
247
197
  @click.native="fireAnalytics(secondLevelLink)"
248
198
  >
@@ -264,10 +214,7 @@
264
214
  <span v-else>{{ secondLevelLink.title }}</span>
265
215
  </div>
266
216
  <div class="selected-sub-nav">
267
- <ul
268
- v-if="secondLevelLink.below"
269
- class="sub-nav-group"
270
- >
217
+ <ul v-if="secondLevelLink.below" class="sub-nav-group">
271
218
  <li
272
219
  v-for="(
273
220
  thirdLevelLink, thirdIndex
@@ -283,7 +230,7 @@
283
230
  searchFocus(
284
231
  thirdIndex,
285
232
  secondLevelLink.below.length,
286
- $event,
233
+ $event
287
234
  )
288
235
  "
289
236
  @mouseover.native="
@@ -291,7 +238,7 @@
291
238
  'thirdLevelMenuItem',
292
239
  parentIndex,
293
240
  secondIndex,
294
- thirdIndex,
241
+ thirdIndex
295
242
  )
296
243
  "
297
244
  @mouseleave.native="
@@ -299,7 +246,7 @@
299
246
  'thirdLevelMenuItem',
300
247
  parentIndex,
301
248
  secondIndex,
302
- thirdIndex,
249
+ thirdIndex
303
250
  )
304
251
  "
305
252
  @focusin.native="
@@ -307,7 +254,7 @@
307
254
  'thirdLevelMenuItem',
308
255
  parentIndex,
309
256
  secondIndex,
310
- thirdIndex,
257
+ thirdIndex
311
258
  )
312
259
  "
313
260
  @focusout.native="
@@ -315,20 +262,14 @@
315
262
  'thirdLevelMenuItem',
316
263
  parentIndex,
317
264
  secondIndex,
318
- thirdIndex,
265
+ thirdIndex
319
266
  )
320
267
  "
321
- @click.native="
322
- fireAnalytics(thirdLevelLink)
323
- "
268
+ @click.native="fireAnalytics(thirdLevelLink)"
324
269
  >
325
270
  <span>{{ thirdLevelLink.title }}</span>
326
271
  </nuxt-link>
327
- <a
328
- v-else
329
- class="dark"
330
- :href="thirdLevelLink.absolute"
331
- >
272
+ <a v-else class="dark" :href="thirdLevelLink.absolute">
332
273
  <span>{{ thirdLevelLink.title }}</span>
333
274
  </a>
334
275
  </li>
@@ -402,6 +343,7 @@
402
343
  </div>
403
344
  <div v-if="isSearchOpen && !isWorkWell" class="search-container">
404
345
  <modal-search
346
+ :google-search-flag="'googlerest'"
405
347
  :search-query="searchQuery"
406
348
  :content-parser="contentParser"
407
349
  @closed="closeSearch"
@@ -412,15 +354,15 @@
412
354
  </template>
413
355
 
414
356
  <script>
415
- import ModalSearch from './ModalSearch/index.vue'
416
- import Close from './../../../assets/icons/close.svg?component'
417
- import WorkSafeLogo from './../../../assets/icons/AppFooter/worksafe-footer-logo.svg?url'
418
- import WorkWellLogo from './../../../assets/icons/AppFooter/logo-workwell-reversed.svg?url'
419
- import CaretRight from './../../../assets/icons/caret-right.svg?component'
420
- import CaretDown from './../../../assets/icons/caret-down.svg?component'
421
- import SearchIcon from './../../../assets/icons/AppHeader/search-32px.svg?component'
422
- import CaretLeft from './../../../assets/icons/caret-left.svg?component'
423
- import MenuIcon from './../../../assets/icons/AppHeader/menu-32px.svg?component'
357
+ import ModalSearch from "./ModalSearch/index.vue";
358
+ import Close from "./../../../assets/icons/close.svg?component";
359
+ import WorkSafeLogo from "./../../../assets/icons/AppFooter/worksafe-footer-logo.svg?url";
360
+ import WorkWellLogo from "./../../../assets/icons/AppFooter/logo-workwell-reversed.svg?url";
361
+ import CaretRight from "./../../../assets/icons/caret-right.svg?component";
362
+ import CaretDown from "./../../../assets/icons/caret-down.svg?component";
363
+ import SearchIcon from "./../../../assets/icons/AppHeader/search-32px.svg?component";
364
+ import CaretLeft from "./../../../assets/icons/caret-left.svg?component";
365
+ import MenuIcon from "./../../../assets/icons/AppHeader/menu-32px.svg?component";
424
366
 
425
367
  export default {
426
368
  components: {
@@ -470,85 +412,81 @@ export default {
470
412
  MenuIcon,
471
413
  windowWidth: 0,
472
414
  searchQuery: null,
473
- }
415
+ };
474
416
  },
475
417
  computed: {
476
418
  showSecondLevelCaret() {
477
419
  return (
478
- (this.screen === 'mobile' &&
479
- this.isSecondLevelOpen &&
480
- !this.isThirdLevelOpen) ||
481
- this.screen === 'desktop'
482
- )
420
+ (this.screen === "mobile" && this.isSecondLevelOpen && !this.isThirdLevelOpen) ||
421
+ this.screen === "desktop"
422
+ );
483
423
  },
484
424
  isChrome() {
485
- return !!window.chrome
425
+ return !!window.chrome;
486
426
  },
487
427
  },
488
428
  watch: {
489
429
  $route() {
490
430
  if (this.screen) {
491
- this.closeMegaMenu()
431
+ this.closeMegaMenu();
492
432
  }
493
433
  },
494
434
  windowWidth(val) {
495
435
  if (val > 980) {
496
- this.screen = 'desktop'
436
+ this.screen = "desktop";
497
437
  } else if (val <= 980) {
498
- this.screen = 'mobile'
438
+ this.screen = "mobile";
499
439
  if (this.isSecondLevelOpen === true) {
500
- this.isMobileMenuOpen = true
440
+ this.isMobileMenuOpen = true;
501
441
  }
502
442
  }
503
443
  },
504
444
  },
505
445
  destroyed() {
506
- window.removeEventListener('resize', this.screenWidth)
446
+ window.removeEventListener("resize", this.screenWidth);
507
447
  },
508
448
  created() {
509
- if (typeof window !== 'undefined' && window) {
510
- window.addEventListener('resize', this.screenWidth)
511
- this.screenWidth()
449
+ if (typeof window !== "undefined" && window) {
450
+ window.addEventListener("resize", this.screenWidth);
451
+ this.screenWidth();
512
452
  }
513
453
  if (this.$bus) {
514
- this.$bus.$on('site-search', (query) => {
515
- this.searchQuery = query
454
+ this.$bus.$on("site-search", (query) => {
455
+ this.searchQuery = query;
516
456
  if (query) {
517
- this.showSearch()
457
+ this.showSearch();
518
458
  }
519
- })
459
+ });
520
460
  }
521
461
  },
522
462
  methods: {
523
463
  screenWidth() {
524
- this.windowWidth = window.innerWidth
464
+ this.windowWidth = window.innerWidth;
525
465
  },
526
466
  firstLevelClick(item, ref) {
527
- console.log('in first level click')
467
+ console.log("in first level click");
528
468
  // Reset screen to fix whitespace
529
- if (window && window.scrollTo && this.screen === 'desktop') {
530
- window.scrollTo(0, 0)
469
+ if (window && window.scrollTo && this.screen === "desktop") {
470
+ window.scrollTo(0, 0);
531
471
  }
532
472
 
533
- let selectedItem = this.$refs[ref][0]
534
- let previouslyOpenItem = this.getActiveParent()
473
+ let selectedItem = this.$refs[ref][0];
474
+ let previouslyOpenItem = this.getActiveParent();
535
475
 
536
476
  // Set this for mobile
537
- this.firstLevelItemName = item.title
538
- this.firstLevelItemRef = ref
477
+ this.firstLevelItemName = item.title;
478
+ this.firstLevelItemRef = ref;
539
479
 
540
480
  // Set the first item to the variable
541
481
  if (previouslyOpenItem.length) {
542
- previouslyOpenItem = previouslyOpenItem[0]
482
+ previouslyOpenItem = previouslyOpenItem[0];
543
483
  }
544
484
  // If the menu is not open, open it
545
485
  if (item.below && this.isSecondLevelOpen === false) {
546
- selectedItem.classList.add('isActiveParent')
547
- selectedItem
548
- .getElementsByTagName('a')[0]
549
- .setAttribute('aria-expanded', 'true')
550
- this.isSecondLevelOpen = true
551
- this.letBodyOverflow(false)
486
+ selectedItem.classList.add("isActiveParent");
487
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "true");
488
+ this.isSecondLevelOpen = true;
489
+ this.letBodyOverflow(false);
552
490
  }
553
491
  // If the menu is already open and the same item is clicked,
554
492
  // close it
@@ -557,57 +495,51 @@ export default {
557
495
  this.isSecondLevelOpen === true &&
558
496
  selectedItem === previouslyOpenItem
559
497
  ) {
560
- selectedItem.classList.remove('isActiveParent')
561
- selectedItem
562
- .getElementsByTagName('a')[0]
563
- .setAttribute('aria-expanded', 'false')
564
- this.isSecondLevelOpen = false
565
- this.letBodyOverflow(true)
498
+ selectedItem.classList.remove("isActiveParent");
499
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "false");
500
+ this.isSecondLevelOpen = false;
501
+ this.letBodyOverflow(true);
566
502
  }
567
503
  // If the link has no children then go to that page
568
504
  else if (!item.below) {
569
- if (item.relative !== '/') {
570
- this.$router.push(item.relative)
505
+ if (item.relative !== "/") {
506
+ this.$router.push(item.relative);
571
507
  }
572
508
  }
573
509
  // Otherwise just remove the existing open menu and add
574
510
  // the isActive class on the new selected item
575
511
  else {
576
- previouslyOpenItem.classList.remove('isActiveParent')
577
- selectedItem.classList.add('isActiveParent')
512
+ previouslyOpenItem.classList.remove("isActiveParent");
513
+ selectedItem.classList.add("isActiveParent");
578
514
  previouslyOpenItem
579
- .getElementsByTagName('a')[0]
580
- .setAttribute('aria-expanded', 'false')
581
- selectedItem
582
- .getElementsByTagName('a')[0]
583
- .setAttribute('aria-expanded', 'true')
515
+ .getElementsByTagName("a")[0]
516
+ .setAttribute("aria-expanded", "false");
517
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "true");
584
518
  }
585
- if (this.screen === 'mobile') {
586
- this.focusOnNext(selectedItem)
519
+ if (this.screen === "mobile") {
520
+ this.focusOnNext(selectedItem);
587
521
  }
588
522
  },
589
523
  secondLevelClick(item, ref) {
590
- let selectedItem = this.$refs[ref][0]
591
- let previouslyOpenItem = this.getActiveChild()
592
- this.secondLevelItemRef = ref
524
+ let selectedItem = this.$refs[ref][0];
525
+ let previouslyOpenItem = this.getActiveChild();
526
+ this.secondLevelItemRef = ref;
593
527
 
594
528
  // Set the first item to the variable
595
529
  if (previouslyOpenItem.length) {
596
- previouslyOpenItem = previouslyOpenItem[0]
530
+ previouslyOpenItem = previouslyOpenItem[0];
597
531
  }
598
532
 
599
533
  // If the menu is not open, open it
600
534
  if (item.below && this.isThirdLevelOpen === false) {
601
- selectedItem.classList.add('isActiveChild')
602
- selectedItem
603
- .getElementsByTagName('a')[0]
604
- .setAttribute('aria-expanded', 'true')
605
- this.isThirdLevelOpen = true
535
+ selectedItem.classList.add("isActiveChild");
536
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "true");
537
+ this.isThirdLevelOpen = true;
606
538
  }
607
539
  // If the link has no children then go to that page
608
540
  else if (!item.below) {
609
- if (item.relative !== '/') {
610
- this.$router.push(item.relative)
541
+ if (item.relative !== "/") {
542
+ this.$router.push(item.relative);
611
543
  }
612
544
  }
613
545
  // If the menu is already open and the same item is clicked,
@@ -617,260 +549,238 @@ export default {
617
549
  this.isThirdLevelOpen === true &&
618
550
  selectedItem === previouslyOpenItem
619
551
  ) {
620
- selectedItem.classList.remove('isActiveChild')
621
- selectedItem
622
- .getElementsByTagName('a')[0]
623
- .setAttribute('aria-expanded', 'false')
624
- this.isThirdLevelOpen = false
552
+ selectedItem.classList.remove("isActiveChild");
553
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "false");
554
+ this.isThirdLevelOpen = false;
625
555
  }
626
556
  // Otherwise just remove the existing open menu and add
627
557
  // the isActive class on the new selected item
628
558
  else {
629
- previouslyOpenItem.classList.remove('isActiveChild')
559
+ previouslyOpenItem.classList.remove("isActiveChild");
630
560
  previouslyOpenItem
631
- .getElementsByTagName('a')[0]
632
- .setAttribute('aria-expanded', 'false')
633
- selectedItem.classList.add('isActiveChild')
634
- selectedItem
635
- .getElementsByTagName('a')[0]
636
- .setAttribute('aria-expanded', 'true')
561
+ .getElementsByTagName("a")[0]
562
+ .setAttribute("aria-expanded", "false");
563
+ selectedItem.classList.add("isActiveChild");
564
+ selectedItem.getElementsByTagName("a")[0].setAttribute("aria-expanded", "true");
637
565
  }
638
566
 
639
- this.focusOnNext(selectedItem)
567
+ this.focusOnNext(selectedItem);
640
568
  },
641
569
  showMobileMenu() {
642
570
  // Reset screen to top to fix whitespace issues
643
571
  if (window) {
644
- window.scrollTo(0, 0)
572
+ window.scrollTo(0, 0);
645
573
  }
646
574
 
647
- this.isMobileMenuOpen = true
648
- this.letBodyOverflow(false)
575
+ this.isMobileMenuOpen = true;
576
+ this.letBodyOverflow(false);
649
577
  this.$nextTick(() => {
650
- this.$refs['firstLevelMenuItem-0'][0].firstElementChild.focus()
651
- })
578
+ this.$refs["firstLevelMenuItem-0"][0].firstElementChild.focus();
579
+ });
652
580
  },
653
581
  mouseHover(refID, parentIndex, secondIndex, thirdIndex) {
654
- let theLI = this.getLIaboveHovered(
655
- refID,
656
- parentIndex,
657
- secondIndex,
658
- thirdIndex,
659
- )
582
+ let theLI = this.getLIaboveHovered(refID, parentIndex, secondIndex, thirdIndex);
660
583
  if (theLI) {
661
- let A = theLI.getElementsByTagName('A')[0]
662
- A.style.borderBottom = '1px solid transparent'
584
+ let A = theLI.getElementsByTagName("A")[0];
585
+ A.style.borderBottom = "1px solid transparent";
663
586
  }
664
587
  },
665
588
  mouseLeave(refID, parentIndex, secondIndex, thirdIndex) {
666
- let theLI = this.getLIaboveHovered(
667
- refID,
668
- parentIndex,
669
- secondIndex,
670
- thirdIndex,
671
- )
589
+ let theLI = this.getLIaboveHovered(refID, parentIndex, secondIndex, thirdIndex);
672
590
  if (theLI) {
673
- let A = theLI.getElementsByTagName('A')[0]
674
- A.removeAttribute('style')
591
+ let A = theLI.getElementsByTagName("A")[0];
592
+ A.removeAttribute("style");
675
593
  }
676
594
  },
677
595
  getLIaboveHovered(refID, parentIndex, secondIndex, thirdIndex) {
678
596
  // Check if its a first level link
679
597
  if (secondIndex === undefined && thirdIndex === undefined) {
680
- if (screen === 'desktop') {
681
- return
598
+ if (screen === "desktop") {
599
+ return;
682
600
  }
683
601
 
684
- let prevFirstIndex = parentIndex - 1
602
+ let prevFirstIndex = parentIndex - 1;
685
603
 
686
604
  if (prevFirstIndex < 0) {
687
- return
605
+ return;
688
606
  } else {
689
- let aboveHovered = `${refID}-${prevFirstIndex}`
690
- return this.$refs[aboveHovered][0]
607
+ let aboveHovered = `${refID}-${prevFirstIndex}`;
608
+ return this.$refs[aboveHovered][0];
691
609
  }
692
610
  }
693
611
  // Check if its a second level link
694
612
  else if (thirdIndex === undefined) {
695
- let prevSecondIndex = secondIndex - 1
613
+ let prevSecondIndex = secondIndex - 1;
696
614
  if (prevSecondIndex < 0) {
697
- return
615
+ return;
698
616
  } else {
699
- let aboveHovered = `${refID}-${parentIndex}-${prevSecondIndex}`
700
- return this.$refs[aboveHovered][0]
617
+ let aboveHovered = `${refID}-${parentIndex}-${prevSecondIndex}`;
618
+ return this.$refs[aboveHovered][0];
701
619
  }
702
620
  }
703
621
  // If its a third level link
704
622
  else {
705
- let prevThirdIndex = thirdIndex - 1
623
+ let prevThirdIndex = thirdIndex - 1;
706
624
  if (prevThirdIndex < 0) {
707
- return
625
+ return;
708
626
  } else {
709
- let aboveHovered = `${refID}-${parentIndex}-${secondIndex}-${prevThirdIndex}`
710
- return this.$refs[aboveHovered][0]
627
+ let aboveHovered = `${refID}-${parentIndex}-${secondIndex}-${prevThirdIndex}`;
628
+ return this.$refs[aboveHovered][0];
711
629
  }
712
630
  }
713
631
  },
714
632
  showSearch() {
715
- this.isSearchOpen = true
716
- this.letBodyOverflow(false)
633
+ this.isSearchOpen = true;
634
+ this.letBodyOverflow(false);
717
635
  },
718
636
  closeSearch() {
719
- this.isSearchOpen = false
720
- this.letBodyOverflow(true)
721
- this.resetTab()
722
- this.searchQuery = null
637
+ this.isSearchOpen = false;
638
+ this.letBodyOverflow(true);
639
+ this.resetTab();
640
+ this.searchQuery = null;
723
641
  },
724
642
  closeMegaMenu() {
725
- let activeChild = this.getActiveChild()
726
- let theActiveParent = this.getActiveParent()
643
+ let activeChild = this.getActiveChild();
644
+ let theActiveParent = this.getActiveParent();
727
645
 
728
646
  if (theActiveParent.length) {
729
- theActiveParent = theActiveParent[0]
730
- theActiveParent.classList.remove('isActiveParent')
647
+ theActiveParent = theActiveParent[0];
648
+ theActiveParent.classList.remove("isActiveParent");
731
649
  theActiveParent
732
- .getElementsByTagName('a')[0]
733
- .setAttribute('aria-expanded', 'false')
650
+ .getElementsByTagName("a")[0]
651
+ .setAttribute("aria-expanded", "false");
734
652
  }
735
653
 
736
654
  if (this.isThirdLevelOpen) {
737
- activeChild = activeChild[0]
738
- activeChild.classList.remove('isActiveChild')
739
- activeChild
740
- .getElementsByTagName('a')[0]
741
- .setAttribute('aria-expanded', 'false')
742
- this.isThirdLevelOpen = false
655
+ activeChild = activeChild[0];
656
+ activeChild.classList.remove("isActiveChild");
657
+ activeChild.getElementsByTagName("a")[0].setAttribute("aria-expanded", "false");
658
+ this.isThirdLevelOpen = false;
743
659
  }
744
- this.isMobileMenuOpen = false
745
- this.isSecondLevelOpen = false
746
- this.letBodyOverflow(true)
660
+ this.isMobileMenuOpen = false;
661
+ this.isSecondLevelOpen = false;
662
+ this.letBodyOverflow(true);
747
663
  },
748
664
  letBodyOverflow(state) {
749
- let body = document.body
750
- let main = document.getElementsByTagName('main')[0]
751
- let footer = document.getElementsByTagName('footer')[0]
665
+ let body = document.body;
666
+ let main = document.getElementsByTagName("main")[0];
667
+ let footer = document.getElementsByTagName("footer")[0];
752
668
  switch (state) {
753
669
  case true:
754
- body.removeAttribute('style')
670
+ body.removeAttribute("style");
755
671
  if (main) {
756
- main.removeAttribute('style')
672
+ main.removeAttribute("style");
757
673
  }
758
674
  if (footer) {
759
- footer.removeAttribute('style')
675
+ footer.removeAttribute("style");
760
676
  }
761
- break
677
+ break;
762
678
  case false:
763
- body.style.overflow = 'hidden'
764
- body.style.background = '#ffffff'
679
+ body.style.overflow = "hidden";
680
+ body.style.background = "#ffffff";
765
681
  if (main) {
766
- main.style.display = 'none'
682
+ main.style.display = "none";
767
683
  }
768
684
  if (footer) {
769
- footer.style.display = 'none'
685
+ footer.style.display = "none";
770
686
  }
771
- break
687
+ break;
772
688
  }
773
689
  },
774
690
  resetTab(el) {
775
691
  if (this.$refs.closeMenuButton) {
776
692
  if (el) {
777
- el.preventDefault()
693
+ el.preventDefault();
778
694
  }
779
- this.$refs.closeMenuButton.focus()
695
+ this.$refs.closeMenuButton.focus();
780
696
  }
781
697
  },
782
698
  getActiveParent() {
783
- return document.getElementsByClassName('isActiveParent')
699
+ return document.getElementsByClassName("isActiveParent");
784
700
  },
785
701
  getActiveChild() {
786
- return document.getElementsByClassName('isActiveChild')
702
+ return document.getElementsByClassName("isActiveChild");
787
703
  },
788
704
  mobileGoBack() {
789
705
  if (this.isThirdLevelOpen) {
790
- let activeChild = this.getActiveChild()
791
- activeChild = activeChild[0]
792
- activeChild.classList.remove('isActiveChild')
793
- activeChild
794
- .getElementsByTagName('a')[0]
795
- .setAttribute('aria-expanded', 'false')
796
- this.isThirdLevelOpen = false
706
+ let activeChild = this.getActiveChild();
707
+ activeChild = activeChild[0];
708
+ activeChild.classList.remove("isActiveChild");
709
+ activeChild.getElementsByTagName("a")[0].setAttribute("aria-expanded", "false");
710
+ this.isThirdLevelOpen = false;
797
711
  } else if (this.isSecondLevelOpen) {
798
- let activeParent = this.getActiveParent()
799
- activeParent = activeParent[0]
800
- activeParent.classList.remove('isActiveParent')
801
- activeParent
802
- .getElementsByTagName('a')[0]
803
- .setAttribute('aria-expanded', 'false')
804
- this.isSecondLevelOpen = false
712
+ let activeParent = this.getActiveParent();
713
+ activeParent = activeParent[0];
714
+ activeParent.classList.remove("isActiveParent");
715
+ activeParent.getElementsByTagName("a")[0].setAttribute("aria-expanded", "false");
716
+ this.isSecondLevelOpen = false;
805
717
  }
806
718
  },
807
719
  searchFocus(index, length, event) {
808
720
  if (index === length - 1 && this.isMobileMenuOpen && !event.shiftKey) {
809
- event.preventDefault()
810
- this.$refs.searchButton.focus()
721
+ event.preventDefault();
722
+ this.$refs.searchButton.focus();
811
723
  } else if (index === 0 && this.isMobileMenuOpen && event.shiftKey) {
812
- event.preventDefault()
813
- let firstIndex = this.firstLevelItemRef.split('-')[1]
814
- let key = null
724
+ event.preventDefault();
725
+ let firstIndex = this.firstLevelItemRef.split("-")[1];
726
+ let key = null;
815
727
  if (!this.isThirdLevelOpen) {
816
- key = `secondLevelSelectedTitle-${firstIndex}`
728
+ key = `secondLevelSelectedTitle-${firstIndex}`;
817
729
  } else if (this.isThirdLevelOpen) {
818
- let secondIndex = this.secondLevelItemRef.split('-')[2]
819
- key = `secondLevelSelectedTitle-${firstIndex}-${secondIndex}`
730
+ let secondIndex = this.secondLevelItemRef.split("-")[2];
731
+ key = `secondLevelSelectedTitle-${firstIndex}-${secondIndex}`;
820
732
  }
821
- if (this.$refs[key][0].$el.nodeName === 'A') {
822
- this.$refs[key][0].$el.focus()
733
+ if (this.$refs[key][0].$el.nodeName === "A") {
734
+ this.$refs[key][0].$el.focus();
823
735
  }
824
736
  }
825
737
  },
826
738
  submenuFocus(event) {
827
739
  if (this.isMobileMenuOpen && !event.shiftKey && this.isSecondLevelOpen) {
828
- event.preventDefault()
829
- let firstIndex = this.firstLevelItemRef.split('-')[1]
830
- let key = null
740
+ event.preventDefault();
741
+ let firstIndex = this.firstLevelItemRef.split("-")[1];
742
+ let key = null;
831
743
  if (!this.isThirdLevelOpen) {
832
- key = `secondLevelSelectedTitle-${firstIndex}`
744
+ key = `secondLevelSelectedTitle-${firstIndex}`;
833
745
  } else if (this.isThirdLevelOpen) {
834
- let secondIndex = this.secondLevelItemRef.split('-')[2]
835
- key = `secondLevelSelectedTitle-${firstIndex}-${secondIndex}`
746
+ let secondIndex = this.secondLevelItemRef.split("-")[2];
747
+ key = `secondLevelSelectedTitle-${firstIndex}-${secondIndex}`;
836
748
  }
837
- if (this.$refs[key][0].$el.nodeName === 'A') {
838
- this.$refs[key][0].$el.focus()
749
+ if (this.$refs[key][0].$el.nodeName === "A") {
750
+ this.$refs[key][0].$el.focus();
839
751
  }
840
752
  }
841
753
  },
842
754
  backBtnFocus(event) {
843
755
  if (this.isMobileMenuOpen && event.shiftKey && this.isSecondLevelOpen) {
844
- event.preventDefault()
845
- this.$refs.menuBackButton.focus()
756
+ event.preventDefault();
757
+ this.$refs.menuBackButton.focus();
846
758
  }
847
759
  },
848
760
  focusOnNext(selectedItem) {
849
761
  this.$nextTick(() => {
850
- selectedItem
851
- .getElementsByClassName('selected-title')[0]
852
- .firstChild.focus()
853
- })
762
+ selectedItem.getElementsByClassName("selected-title")[0].firstChild.focus();
763
+ });
854
764
  },
855
765
  fireAnalytics(content) {
856
766
  let payload = {
857
- event: 'custom.interaction.megamenu.click',
858
- group: 'Mega Menu',
767
+ event: "custom.interaction.megamenu.click",
768
+ group: "Mega Menu",
859
769
  label: content.title,
860
770
  url: content.relative,
861
- }
771
+ };
862
772
  // this.$store.dispatch('tracking/event', payload)
863
773
  },
864
774
  skipToContent() {
865
775
  if (this.$bus) {
866
- this.$bus.$emit('scrollToTop')
776
+ this.$bus.$emit("scrollToTop");
867
777
  }
868
778
  },
869
779
  },
870
- }
780
+ };
871
781
  </script>
872
782
 
873
783
  <style lang="scss" scoped>
874
- @import './styles';
875
- @import './mobile';
784
+ @import "./styles";
785
+ @import "./mobile";
876
786
  </style>
@@ -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: {
@@ -18,14 +18,15 @@
18
18
  :force-lg-columns-per-row="1"
19
19
  :force-md-columns-per-row="1"
20
20
  :cards="results"
21
- :is-selectable="true"
21
+ :is-selectable="isSelectable"
22
22
  :size="'full'"
23
23
  :row-spacing="'none'"
24
24
  :no-padding-top="true"
25
- @selected="onSelectResult"
25
+ :google-search-flag="googleSearchFlag"
26
+ @selected="handleSelect"
27
+ @selected-title="handleSelect"
26
28
  >
27
29
  <template v-slot:cardItem="{ card }">
28
- <span class="d-none">card.link :- {{ card.link }}</span>
29
30
  <card-grid-item
30
31
  :header-size="isTypeahead ? 'medium' : 'large'"
31
32
  :card-header-title="card.title"
@@ -45,6 +46,7 @@
45
46
  topic: card.topic,
46
47
  language: card.language,
47
48
  }"
49
+ :is-card-title-selectable="isCardTitleSelectable"
48
50
  />
49
51
  </template>
50
52
  <template
@@ -133,6 +135,10 @@ export default {
133
135
  type: Boolean,
134
136
  default: true,
135
137
  },
138
+ googleSearchFlag: {
139
+ type: String,
140
+ default: "solar",
141
+ },
136
142
  },
137
143
  methods: {
138
144
  onClickItem(event, item, index) {
@@ -144,37 +150,29 @@ export default {
144
150
  }
145
151
  return value;
146
152
  },
147
- onSelectCardTitle(card) {
153
+ handleSelect(card) {
148
154
  debugger;
149
- console.log("onSelectCardTitle :- ", card);
150
155
 
151
- navigateToPath.call(
152
- this,
153
- card?.selectedCard?.link,
154
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
155
- );
156
- this.$nextTick(() => this.$emit("selected-title"));
156
+ const isSolar = this.googleSearchFlag === "solar";
157
+ const link = card?.selectedCard?.link;
158
+ const openInNewTab = card?.ev?.ctrlKey || card?.ev?.metaKey;
157
159
 
158
- if (this.$gtm) {
159
- this.fireGTM(card);
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);
160
165
  }
161
- },
162
- onSelectResult(card) {
163
- debugger;
164
- console.log("onSelectResult card:- ", card);
165
- console.log("onSelectResult card?.selectedCard?.link:- ", card?.selectedCard?.link);
166
166
 
167
- navigateToPath.call(
168
- this,
169
- card?.selectedCard?.link, // title click is used for search result, but change also included here
170
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
171
- );
172
- this.$nextTick(() => this.$emit("selected"));
167
+ this.$nextTick(() => {
168
+ this.$emit(isSolar ? "selected" : "selected-title");
169
+ });
173
170
 
174
171
  if (this.$gtm) {
175
172
  this.fireGTM(card);
176
173
  }
177
174
  },
175
+
178
176
  fireGTM(card) {
179
177
  let attrs = {
180
178
  location:
@@ -42,6 +42,9 @@
42
42
  :offset="searchResults && searchResults.offset"
43
43
  :page-limit="pageLimit"
44
44
  :content-parser="contentParser"
45
+ :google-search-flag="searchType"
46
+ :is-selectable="searchType === 'solar'"
47
+ :is-card-title-selectable="searchType !== 'solar'"
45
48
  @selected="$emit('selected')"
46
49
  @pageChanged="pageChanged"
47
50
  />