Skip to content

Commit

Permalink
add msg config to all apps
Browse files Browse the repository at this point in the history
  • Loading branch information
deetz99 committed Jan 13, 2025
1 parent bf75754 commit b9c14ac
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion strr-base-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineAppConfig({
}
},
sbcWebMsg: {
enable: true,
enable: false,
allowedRoutes: undefined
}
},
Expand Down
36 changes: 21 additions & 15 deletions strr-base-web/app/middleware/enable-sbc-web-messenger.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
window.Genesys = window.Genesys || function (...args: any) {
(window.Genesys.q = window.Genesys.q || []).push(args)
}
window.Genesys.t = Date.now()
window.Genesys.t = new Date().getTime()
window.Genesys.c = {
environment: environmentKey,
deploymentId: deploymentKey
Expand All @@ -28,17 +28,25 @@ export default defineNuxtRouteMiddleware(async (to) => {
localStorage.removeItem('_actmu')
}

const removeWebMsg = () => {
const script = document.querySelector(`script[src="${genesysUrl}"]`)
if (script) {
script.remove()
}
// TODO: how to remove ?
// const removeWebMsg = () => {
// const scripts = document.querySelectorAll('script[src^="https://apps.cac1.pure.cloud"]')
// scripts.forEach(script => script.remove())

// clean up // TODO: cleanup
delete window.Genesys
delete window._genesysJs
localStorage.removeItem('_actmu')
}
// const el1 = document.getElementById('genesys-thirdparty')
// if (el1) {
// el1.remove()
// }

// const el2 = document.getElementById('genesys-messenger')
// if (el2) {
// el2.remove()
// }

// delete window.Genesys
// delete window._genesysJs
// localStorage.removeItem('_actmu')
// }

const isRouteAllowed = (path: string): boolean => {
if (msgConfig.allowedRoutes === undefined) {
Expand All @@ -48,12 +56,10 @@ export default defineNuxtRouteMiddleware(async (to) => {
}

if (isRouteAllowed(to.path)) {
console.log('init')
initWebMsg()
} else {
// TODO: make this work
removeWebMsg()
console.log('remove')
// TODO: how to remove ?
// removeWebMsg()
}
}
})
2 changes: 1 addition & 1 deletion strr-host-pm-web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NUXT_BCGOV_STRR_URL="https://www.gov.bc.ca/STRRegistry"
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_HOST_FEES_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry/host-registration#fees"

# sbc/genesys messenger
# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""
Expand Down
4 changes: 2 additions & 2 deletions strr-host-pm-web/app/locales/en-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default {
title: 'Your property is in a location where the principal residence requirement applies.'
},
straaExempt: {
title: '{boldStart}Registration Not Required:{boldEnd} This address appears to be located on First Nations land and is therefore exempt from the {italicStart}Short-term Rental Accommodations Act{italicEnd}. You do not need to register a short-term rental at this address.',
note: 'Please check with the First Nations for any applicable Short-Term Rental regulations.'
title: '{boldStart}Registration Not Required:{boldEnd} This address appears to be located on First Nation land and is therefore exempt from the {italicStart}Short-term Rental Accommodations Act{italicEnd}. You do not need to register a short-term rental at this address.',
note: 'Please check with the First Nation for any applicable Short-Term Rental regulations.'
},
strProhibited: {
title: 'Some types of short-term rentals are not permitted by your local government.',
Expand Down
2 changes: 1 addition & 1 deletion strr-host-pm-web/devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ NUXT_HOST_ACC_ACT_SUMMARY="https://www2.gov.bc.ca/gov/content/housing-tenancy/sh
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_HOST_FEES_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry/host-registration#fees"

# sbc/genesys messenger
# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""
Expand Down
4 changes: 2 additions & 2 deletions strr-host-pm-web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default defineNuxtConfig({
},

extends: [
// ['github:bcgov/STRR/strr-base-web', { install: true }],
'../strr-base-web', // dev only
['github:bcgov/STRR/strr-base-web', { install: true }],
// '../strr-base-web', // dev only
'@daxiom/nuxt-core-layer-test' // extend again, this prevents the payApi plugin error
],

Expand Down
2 changes: 1 addition & 1 deletion strr-host-pm-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-host-pm-web",
"private": true,
"type": "module",
"version": "0.0.34",
"version": "0.0.35",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
5 changes: 5 additions & 0 deletions strr-platform-web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ NUXT_BCGOV_STRR_URL="https://www.gov.bc.ca/STRRegistry"
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_PLATFORMS_LEARN_MORE_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry/platform-registration/platform-requirements#localgovernmenttakedown"

# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""

#vaults keycloak
NUXT_KEYCLOAK_AUTH_URL="https://dev.loginproxy.gov.bc.ca/auth"
NUXT_KEYCLOAK_REALM="bcregistry"
Expand Down
4 changes: 4 additions & 0 deletions strr-platform-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default defineAppConfig({
idps: () => ['bceid', 'bcsc'] // function required to overwrite default value, will merge if no function
}
}
},
sbcWebMsg: {
enable: true,
allowedRoutes: ['application', 'dashboard']
}
},
ui: {
Expand Down
5 changes: 5 additions & 0 deletions strr-platform-web/devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ NUXT_BCGOV_STRR_URL="https://www.gov.bc.ca/STRRegistry"
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_PLATFORMS_LEARN_MORE_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry/platform-registration/platform-requirements#localgovernmenttakedown"

# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""

# vaults api
NUXT_PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL"
NUXT_PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION"
Expand Down
4 changes: 2 additions & 2 deletions strr-platform-web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default defineNuxtConfig({
],

extends: [
['github:bcgov/STRR/strr-base-web', { install: true }],
// '../strr-base-web', // dev only
// ['github:bcgov/STRR/strr-base-web', { install: true }],
'../strr-base-web', // dev only
'@daxiom/nuxt-core-layer-test' // extend again, this prevents the payApi plugin error
],

Expand Down
2 changes: 1 addition & 1 deletion strr-platform-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-platform-web",
"private": true,
"type": "module",
"version": "0.0.37",
"version": "0.0.38",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
5 changes: 5 additions & 0 deletions strr-strata-web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ NUXT_BCGOV_STRR_URL="https://www.gov.bc.ca/STRRegistry"
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_DOES_PR_APPLY_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/principal-residence-requirement#PRapplies"

# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""

#vaults keycloak
NUXT_KEYCLOAK_AUTH_URL="https://dev.loginproxy.gov.bc.ca/auth"
NUXT_KEYCLOAK_REALM="bcregistry"
Expand Down
4 changes: 4 additions & 0 deletions strr-strata-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default defineAppConfig({
idps: () => ['bcsc', 'bceid'] // function required to overwrite default value, will merge if no function
}
}
},
sbcWebMsg: {
enable: true,
allowedRoutes: ['application', 'dashboard']
}
},
ui: {}
Expand Down
5 changes: 5 additions & 0 deletions strr-strata-web/devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ NUXT_BCGOV_STRR_URL="https://www.gov.bc.ca/STRRegistry"
NUXT_DECLINE_TOS_REDIRECT_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry"
NUXT_DOES_PR_APPLY_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/principal-residence-requirement#PRapplies"

# vaults sbc/genesys messenger
NUXT_GENESYS_URL=""
NUXT_GENESYS_ENVIRONMENT_KEY=""
NUXT_GENESYS_DEPLOYMENT_KEY=""

# vaults api
NUXT_PAY_API_URL="op://API/$APP_ENV/pay-api/PAY_API_URL"
NUXT_PAY_API_VERSION="op://API/$APP_ENV/pay-api/PAY_API_VERSION"
Expand Down
2 changes: 1 addition & 1 deletion strr-strata-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-strata-web",
"private": true,
"type": "module",
"version": "0.0.38",
"version": "0.0.39",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down

0 comments on commit b9c14ac

Please sign in to comment.