@worksafevictoria/wcl7.5 1.1.23 → 1.2.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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container id="mainCookieContainer" class="hide">
2
+ <container id="mainCookieContainer">
3
3
  <row class="cookie-container">
4
4
  <column class="cookie-container__col">
5
5
  <h3 id="cookie_header" class="cookie-header hidden-on-xs">
@@ -222,32 +222,24 @@ export default {
222
222
  },
223
223
  showCookie() {
224
224
  //Check first if cookies have been turned on in the environment variable
225
- if (process.env.SHOW_COOKIE === 'true') {
226
- return 'true'
227
- } else {
228
- return 'false'
229
- }
225
+ return process.env.SHOW_COOKIE === false ? false : true
230
226
  }
231
227
  },
232
228
  mounted() {
233
229
  // required, as unable to check localStorage until window loaded
234
- window.addEventListener('load', this.checkCookie())
230
+ window.addEventListener('load', this.checkCookie)
235
231
  // detect screen size to display smaller content
236
232
  this.screenWidth = window.innerWidth
237
233
  this.$nextTick(() => {
238
- window.addEventListener('resize', this.onScreenResize())
234
+ window.addEventListener('resize', this.updateScreenWidth)
239
235
  })
240
- this.onScreenResize()
236
+ this.updateScreenWidth()
241
237
  },
242
238
  unmounted() {
243
- window.removeEventListener('load', this.checkCookie())
239
+ window.removeEventListener('load', this.checkCookie)
240
+ window.removeEventListener('resize', this.updateScreenWidth)
244
241
  },
245
242
  methods: {
246
- onScreenResize() {
247
- window.addEventListener('resize', () => {
248
- this.updateScreenWidth()
249
- })
250
- },
251
243
  updateScreenWidth() {
252
244
  this.screenWidth = window.innerWidth
253
245
  },
@@ -259,59 +251,61 @@ export default {
259
251
  const analyticsCookieName = 'analyticsCookies'
260
252
  const marketingCookieName = 'marketingCookies'
261
253
  var cookieElement = document.getElementById('mainCookieContainer')
262
- if (clickResponse === 'accept') {
263
- localStorage.setItem('cookieBannerDisplayed', 'false')
264
- localStorage.setItem(analyticsCookieName, 'granted')
265
- localStorage.setItem(marketingCookieName, 'granted')
266
- cookieElement.classList.add('hide')
267
- cookieElement.classList.remove('show')
268
- } else if (clickResponse === 'save') {
269
- const acb = document.getElementById('modal2CB')
270
- const mcb = document.getElementById('modal3CB')
271
- localStorage.setItem('cookieBannerDisplayed', 'false')
272
- if (acb.checked) {
254
+ if (cookieElement) {
255
+ if (clickResponse === 'accept') {
256
+ localStorage.setItem('cookieBannerDisplayed', 'false')
273
257
  localStorage.setItem(analyticsCookieName, 'granted')
274
- } else {
275
- localStorage.setItem(analyticsCookieName, 'denied')
276
- }
277
- if (mcb.checked) {
278
258
  localStorage.setItem(marketingCookieName, 'granted')
259
+ cookieElement.classList.add('hide')
260
+ cookieElement.classList.remove('show')
261
+ } else if (clickResponse === 'save') {
262
+ const acb = document.getElementById('modal2CB')
263
+ const mcb = document.getElementById('modal3CB')
264
+ localStorage.setItem('cookieBannerDisplayed', 'false')
265
+ if (acb.checked) {
266
+ localStorage.setItem(analyticsCookieName, 'granted')
267
+ } else {
268
+ localStorage.setItem(analyticsCookieName, 'denied')
269
+ }
270
+ if (mcb.checked) {
271
+ localStorage.setItem(marketingCookieName, 'granted')
272
+ } else {
273
+ localStorage.setItem(marketingCookieName, 'denied')
274
+ }
275
+ cookieElement.classList.add('hide')
276
+ cookieElement.classList.remove('show')
279
277
  } else {
278
+ localStorage.setItem('cookieBannerDisplayed', 'false')
279
+ localStorage.setItem(analyticsCookieName, 'denied')
280
280
  localStorage.setItem(marketingCookieName, 'denied')
281
+ cookieElement.classList.add('hide')
282
+ cookieElement.classList.remove('show')
281
283
  }
282
- cookieElement.classList.add('hide')
283
- cookieElement.classList.remove('show')
284
- } else {
285
- localStorage.setItem('cookieBannerDisplayed', 'false')
286
- localStorage.setItem(analyticsCookieName, 'denied')
287
- localStorage.setItem(marketingCookieName, 'denied')
288
- cookieElement.classList.add('hide')
289
- cookieElement.classList.remove('show')
290
284
  }
291
285
  },
292
286
  // function to update consent in GTM
293
287
  fireGTM() {
294
- if (this.$gtm) {
295
- // gather attrs
296
- let aConsent = localStorage.getItem('analyticsCookies')
297
- let mConsent = localStorage.getItem('marketingCookies')
298
- let attrs1 = {
299
- ad_storage: mConsent
300
- }
301
- // fire the event - marketing
302
- this.$gtm.push({
303
- event: 'gtm_consent_update',
304
- ...attrs1
305
- })
306
- let attrs2 = {
307
- analytics_storage: aConsent
308
- }
309
- // fire the event - analytics
310
- this.$gtm.push({
311
- event: 'gtm_consent_update',
312
- ...attrs2
313
- })
314
- }
288
+ // if (this.$gtm) {
289
+ // // gather attrs
290
+ // let aConsent = localStorage.getItem('analyticsCookies')
291
+ // let mConsent = localStorage.getItem('marketingCookies')
292
+ // let attrs1 = {
293
+ // ad_storage: mConsent
294
+ // }
295
+ // // fire the event - marketing
296
+ // this.$gtm.push({
297
+ // event: 'gtm_consent_update',
298
+ // ...attrs1
299
+ // })
300
+ // let attrs2 = {
301
+ // analytics_storage: aConsent
302
+ // }
303
+ // // fire the event - analytics
304
+ // this.$gtm.push({
305
+ // event: 'gtm_consent_update',
306
+ // ...attrs2
307
+ // })
308
+ // }
315
309
  },
316
310
  //function to remove from local storage based on partial match - called from checkCookie
317
311
  removeLocalStorage: function(cookieName) {
@@ -329,104 +323,109 @@ export default {
329
323
  // function to remove cookies according to response from overlay or modal
330
324
  checkCookie: function() {
331
325
  var cookieElement = document.getElementById('mainCookieContainer')
332
- if (
333
- this.showCookie === 'true' &&
334
- !localStorage.getItem('cookieBannerDisplayed')
335
- ) {
336
- cookieElement.classList.remove('hide')
337
- cookieElement.classList.add('show')
338
- } else {
339
- // need to remove cookies in rejected categories, but first hide cookie overlay
340
- cookieElement.classList.add('hide')
341
- cookieElement.classList.remove('show')
326
+ console.log('**else this.showCookie:-', this.showCookie)
327
+ console.log('**else typeof this.showCookie:-', typeof this.showCookie)
328
+ console.log('**else localStorage.getItem(cookieBannerDisplayed):-', localStorage.getItem('cookieBannerDisplayed'))
329
+
330
+ if (cookieElement) {
331
+ if (this.showCookie === true && !localStorage.getItem('cookieBannerDisplayed')) {
332
+ console.log('**Ifffff:-')
333
+ cookieElement.classList.remove('hide')
334
+ cookieElement.classList.add('show')
335
+ } else {
336
+ console.log('**Elseeee:-')
337
+ // need to remove cookies in rejected categories, but first hide cookie overlay
338
+ cookieElement.classList.add('hide')
339
+ cookieElement.classList.remove('show')
342
340
 
343
- // get list of categorised cookies
344
- const analyticsArr = analyticsCookies
345
- const marketingArr = marketingCookies
341
+ // get list of categorised cookies
342
+ const analyticsArr = analyticsCookies
343
+ const marketingArr = marketingCookies
346
344
 
347
- // get list of cookies to process
348
- var pairs = document.cookie.split(';')
349
- var cookieArr = []
350
- for (var i = 0; i < pairs.length; i++) {
351
- var pair = pairs[i].split('=')
352
- var nameVar = [pair[0].trim()]
353
- cookieArr.push(nameVar[0])
354
- }
355
- // identify which categories to process, initialising variables to false
356
- // will only be set to true if user has rejected any cookies
357
- var checkAnalytics = false
358
- var checkMarketing = false
345
+ // get list of cookies to process
346
+ var pairs = document.cookie.split(';')
347
+ var cookieArr = []
348
+ for (var i = 0; i < pairs.length; i++) {
349
+ var pair = pairs[i].split('=')
350
+ var nameVar = [pair[0].trim()]
351
+ cookieArr.push(nameVar[0])
352
+ }
353
+ // identify which categories to process, initialising variables to false
354
+ // will only be set to true if user has rejected any cookies
355
+ var checkAnalytics = false
356
+ var checkMarketing = false
359
357
 
360
- // get value of consent cookies to determine if cookies have to be removed
361
- var analyticsValue = localStorage.getItem('analyticsCookies')
362
- if (analyticsValue !== null && analyticsValue === 'denied') {
363
- checkAnalytics = true
364
- }
358
+ // get value of consent cookies to determine if cookies have to be removed
359
+ var analyticsValue = localStorage.getItem('analyticsCookies')
360
+ if (analyticsValue !== null && analyticsValue === 'denied') {
361
+ checkAnalytics = true
362
+ }
365
363
 
366
- var marketingValue = localStorage.getItem('marketingCookies')
367
- if (marketingValue !== null && marketingValue === 'denied') {
368
- checkMarketing = true
369
- }
364
+ var marketingValue = localStorage.getItem('marketingCookies')
365
+ if (marketingValue !== null && marketingValue === 'denied') {
366
+ checkMarketing = true
367
+ }
370
368
 
371
- // Remove analytics cookies stored as cookies or localStorage
372
- if (checkAnalytics) {
373
- analyticsArr.forEach((cookieName) => {
374
- if (cookieName.name.slice(-1) === '*') {
375
- var tmpVar = cookieName.name.slice(0, -1)
376
- this.removeLocalStorage(tmpVar)
377
- var tmpArr = cookieArr.filter((x) => x.match(cookieName.name))
378
- tmpArr.forEach((tmpName) => {
369
+ // Remove analytics cookies stored as cookies or localStorage
370
+ if (checkAnalytics) {
371
+ analyticsArr.forEach((cookieName) => {
372
+ if (cookieName.name.slice(-1) === '*') {
373
+ var tmpVar = cookieName.name.slice(0, -1)
374
+ this.removeLocalStorage(tmpVar)
375
+ var tmpArr = cookieArr.filter((x) => x.match(cookieName.name))
376
+ tmpArr.forEach((tmpName) => {
377
+ document.cookie =
378
+ tmpName +
379
+ '=;expires=' +
380
+ new Date(0).toUTCString() +
381
+ ';domain=' +
382
+ cookieName.domain +
383
+ ';path=' +
384
+ cookieName.path
385
+ })
386
+ } else {
387
+ localStorage.removeItem(cookieName.name)
379
388
  document.cookie =
380
- tmpName +
389
+ cookieName.name +
381
390
  '=;expires=' +
382
391
  new Date(0).toUTCString() +
383
392
  ';domain=' +
384
393
  cookieName.domain +
385
394
  ';path=' +
386
395
  cookieName.path
387
- })
388
- } else {
389
- localStorage.removeItem(cookieName.name)
390
- document.cookie =
391
- cookieName.name +
392
- '=;expires=' +
393
- new Date(0).toUTCString() +
394
- ';domain=' +
395
- cookieName.domain +
396
- ';path=' +
397
- cookieName.path
398
- }
399
- })
400
- }
401
- // Remove marketing cookies stored as cookies or localStorage
402
- if (checkMarketing) {
403
- marketingArr.forEach((cookieName) => {
404
- if (cookieName.name.slice(-1) === '*') {
405
- var tmpVar = cookieName.name.slice(0, -1)
406
- this.removeLocalStorage(tmpVar)
407
- var tmpArr = cookieArr.filter((x) => x.match(cookieName.name))
408
- tmpArr.forEach((tmpName) => {
396
+ }
397
+ })
398
+ }
399
+ // Remove marketing cookies stored as cookies or localStorage
400
+ if (checkMarketing) {
401
+ marketingArr.forEach((cookieName) => {
402
+ if (cookieName.name.slice(-1) === '*') {
403
+ var tmpVar = cookieName.name.slice(0, -1)
404
+ this.removeLocalStorage(tmpVar)
405
+ var tmpArr = cookieArr.filter((x) => x.match(cookieName.name))
406
+ tmpArr.forEach((tmpName) => {
407
+ document.cookie =
408
+ tmpName +
409
+ '=;expires=' +
410
+ new Date(0).toUTCString() +
411
+ ';domain=' +
412
+ cookieName.domain +
413
+ ';path=' +
414
+ cookieName.path
415
+ })
416
+ } else {
417
+ localStorage.removeItem(cookieName.name)
409
418
  document.cookie =
410
- tmpName +
419
+ cookieName.name +
411
420
  '=;expires=' +
412
421
  new Date(0).toUTCString() +
413
422
  ';domain=' +
414
423
  cookieName.domain +
415
424
  ';path=' +
416
425
  cookieName.path
417
- })
418
- } else {
419
- localStorage.removeItem(cookieName.name)
420
- document.cookie =
421
- cookieName.name +
422
- '=;expires=' +
423
- new Date(0).toUTCString() +
424
- ';domain=' +
425
- cookieName.domain +
426
- ';path=' +
427
- cookieName.path
428
- }
429
- })
426
+ }
427
+ })
428
+ }
430
429
  }
431
430
  }
432
431
  }
@@ -69,6 +69,12 @@ export default {
69
69
  displayGlobal: false,
70
70
  }
71
71
  },
72
+ computed: {
73
+ showGlobalNotice() {
74
+ //Check first if SHOW_GLOBAL_NOTICE have been turned on in the environment variable
75
+ return process.env.SHOW_GLOBAL_NOTICE === false ? false : true
76
+ }
77
+ },
72
78
  mounted() {
73
79
  window.addEventListener('load', this.checkPage())
74
80
  },
@@ -89,12 +95,16 @@ export default {
89
95
  this.setCookie()
90
96
  this.displayGlobal = false
91
97
  } else if (typeof window !== 'undefined') {
98
+ console.log('**else this.showGlobalNotice:-', this.showGlobalNotice)
99
+ console.log('**else tocalStorage.getItem(globalModalHidden):-', localStorage.getItem('globalModalHidden'))
100
+
92
101
  this.displayGlobal =
93
- process.env.SHOW_GLOBAL_NOTICE === 'true' &&
102
+ this.showGlobalNotice === true &&
94
103
  !localStorage.getItem('globalModalHidden')
95
104
  } else {
96
- this.displayGlobal = process.env.SHOW_GLOBAL_NOTICE === 'true'
105
+ this.displayGlobal = process.env.SHOW_GLOBAL_NOTICE === true
97
106
  }
107
+ console.log('**this.displayGlobal:- ', this.displayGlobal)
98
108
  }
99
109
  }
100
110
  }
@@ -104,6 +114,17 @@ export default {
104
114
  @import '../../../includes/scss/all';
105
115
 
106
116
  // modal and modal backdrop styles required in order to display the overlay behind the modal
117
+ #global-notice-modal {
118
+ .modal-dialog-centered {
119
+ border-radius: 6px !important;
120
+ // box-shadow: 0 0 16px 8px rgba(0, 0, 0, 0.24) !important;
121
+ left: 50%;
122
+ margin-left: -200px;
123
+ margin-top: -240px;
124
+ top: 50%;
125
+ width: 400px !important;
126
+ }
127
+ }
107
128
 
108
129
  .modal {
109
130
  background: rgba(0,0,0,0.5)
@@ -48,7 +48,8 @@
48
48
  class="wcl-hero-header__content-wrapper__content-col"
49
49
  :md="7"
50
50
  :class="{
51
- [`wcl-hero-header__content-wrapper__content-col--split`]: $slots.side
51
+ [`wcl-hero-header__content-wrapper__content-col--split`]:
52
+ $slots.side,
52
53
  }"
53
54
  >
54
55
  <breadcrumb
@@ -98,7 +99,7 @@
98
99
  >
99
100
  </column>
100
101
  </row>
101
- <social-share v-show="showSocial && type !== 'hero'" :rtl="rtl" />
102
+ <social-share v-show="showSocial && type !== 'hero'" :rtl="rtl" />
102
103
  </container>
103
104
  </div>
104
105
  <!-- Type Default -->
@@ -176,63 +177,63 @@ export default {
176
177
  CtaButton,
177
178
  HeroHeaderChevron,
178
179
  RichText,
179
- Icon
180
+ Icon,
180
181
  },
181
182
  props: {
182
183
  type: {
183
184
  type: String,
184
- default: 'default'
185
+ default: 'default',
185
186
  },
186
187
  title: {
187
188
  type: String,
188
- default: ''
189
+ default: '',
189
190
  },
190
191
  description: {
191
192
  type: String,
192
- default: ''
193
+ default: '',
193
194
  },
194
195
  image: {
195
196
  type: Object,
196
- default: () => {}
197
+ default: () => {},
197
198
  },
198
199
  cta: {
199
200
  type: Object,
200
- default: () => {}
201
+ default: () => {},
201
202
  },
202
203
  bgColor: {
203
204
  type: Boolean,
204
- default: false
205
+ default: false,
205
206
  },
206
207
  breadcrumbItems: {
207
208
  type: Array,
208
- default: () => []
209
+ default: () => [],
209
210
  },
210
211
  rtl: {
211
212
  type: Boolean,
212
- default: false
213
+ default: false,
213
214
  },
214
215
  workwell: {
215
216
  type: Boolean,
216
- default: false
217
+ default: false,
217
218
  },
218
219
  showBreadcrumb: {
219
220
  type: Boolean,
220
- default: true
221
+ default: true,
221
222
  },
222
223
  showMask: {
223
224
  type: Boolean,
224
- default: true
225
+ default: true,
225
226
  },
226
227
  showSocial: {
227
228
  type: Boolean,
228
- default: true
229
- }
229
+ default: true,
230
+ },
230
231
  },
231
232
  data() {
232
233
  return {
233
234
  socialShareToggle: false,
234
235
  HeroHeaderChevron,
235
- CaretDown
236
+ CaretDown,
236
237
  }
237
238
  },
238
239
  computed: {
@@ -269,7 +270,7 @@ export default {
269
270
  // }
270
271
  // }
271
272
  return this.title
272
- }
273
+ },
273
274
  // Will reintroduce if business requirement
274
275
  // strippedDescription() {
275
276
  // let strippedString = this.description.replace(/(<([^>]+)>)/gi, '')
@@ -281,15 +282,16 @@ export default {
281
282
  },
282
283
  mounted() {
283
284
  if (this.$nuxt?.$on) {
284
- this.$nuxt.$on('scrollToTop', () => {
285
- setTimeout(() => {
286
- const title = this.$refs.title
287
- if (title) {
288
- title.$el.setAttribute('tabindex', 0)
289
- title.$el.focus()
290
- }
291
- }, 500)
292
- })
285
+ // console.log('🚀 ~ this.$nuxt.$on ~ this.$nuxt:', this.$nuxt)
286
+ // this.$nuxt.$on('scrollToTop', () => {
287
+ // setTimeout(() => {
288
+ // const title = this.$refs.title
289
+ // if (title) {
290
+ // title.$el.setAttribute('tabindex', 0)
291
+ // title.$el.focus()
292
+ // }
293
+ // }, 500)
294
+ // })
293
295
  }
294
296
  },
295
297
  beforeDestroy() {
@@ -314,20 +316,20 @@ export default {
314
316
  ev.target.scrollIntoView({
315
317
  behavior: 'smooth',
316
318
  alignToTop: true,
317
- block: 'start'
319
+ block: 'start',
318
320
  })
319
321
  }
320
322
  },
321
323
  fireGTM() {
322
324
  let attrs = {
323
325
  label: this.cta.uri,
324
- document_title: this.cta.filename
326
+ document_title: this.cta.filename,
325
327
  }
326
328
  if (this.$gtm) {
327
329
  this.$gtm.push({ event: 'custom.interaction.download', ...attrs })
328
330
  }
329
- }
330
- }
331
+ },
332
+ },
331
333
  }
332
334
  </script>
333
335
  <style lang="scss" scoped>