Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All - UI: add sbc web messenger #450

Merged
merged 13 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions strr-base-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default defineAppConfig({
hrefRtcKey: ''
}
}
},
sbcWebMsg: {
enable: false,
allowedRoutes: undefined
}
},
ui: {
Expand Down
69 changes: 69 additions & 0 deletions strr-base-web/app/middleware/enable-sbc-web-messenger.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export default defineNuxtRouteMiddleware(async (to) => {
const { ldClient, getStoredFlag } = useConnectLaunchdarklyStore()
await ldClient?.waitUntilReady()
const enableSbcWebMsg = getStoredFlag('enable-sbc-web-messenger')
const msgConfig = useAppConfig().strrBaseLayer.sbcWebMsg

if (ldClient && enableSbcWebMsg && msgConfig.enable) {
const rtc = useRuntimeConfig().public
const genesysUrl = rtc.genesysUrl as string
const environmentKey = rtc.genesysEnvironmentKey as string
const deploymentKey = rtc.genesysDeploymentKey as string

const initWebMsg = () => {
if (!genesysUrl || !environmentKey || !deploymentKey) {
console.warn('Missing Sbc Web Messenger config, aborting setup.')
kialj876 marked this conversation as resolved.
Show resolved Hide resolved
}

window._genesysJs = 'Genesys'
window.Genesys = window.Genesys || function (...args: any) {
(window.Genesys.q = window.Genesys.q || []).push(args)
}
window.Genesys.t = new Date().getTime()
window.Genesys.c = {
environment: environmentKey,
deploymentId: deploymentKey
}

const script = document.createElement('script')
script.async = true
script.src = genesysUrl
document.head.appendChild(script)
localStorage.removeItem('_actmu')
}

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

// 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) {
return true
}
return msgConfig.allowedRoutes.some(route => path.includes(route))
}

if (isRouteAllowed(to.path)) {
initWebMsg()
} else {
// TODO: how to remove ?
// removeWebMsg()
}
}
})
22 changes: 22 additions & 0 deletions strr-base-web/app/types/strr-base-app-config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ declare module 'nuxt/schema' {
},
feeWidget?: {
itemLabelTooltip: Record<string, { i18nkey: string, hrefRtcKey?: keyof PublicRuntimeConfig }> // typeCode
},
sbcWebMsg: {
enable: boolean,
allowedRoutes: string[] | undefined
}
}
}
Expand All @@ -37,6 +41,24 @@ declare module 'nuxt/schema' {
},
feeWidget?: {
itemLabelTooltip: Record<string, { i18nkey: string, hrefRtcKey?: keyof PublicRuntimeConfig }> // typeCode
},
sbcWebMsg: {
enable: boolean,
allowedRoutes: string[] | undefined
}
}
}
}

declare global {
interface Window {
_genesysJs: string
Genesys: {
q?: any[]
t?: number
c?: {
environment: string
deploymentId: string
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion strr-base-web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export default defineNuxtConfig({
version: `STRR Base UI v${process.env.npm_package_version}`,
housingStrrUrl: process.env.NUXT_REGISTRY_HOME_URL, // TODO: update to NUXT_HOUSING_STRR_URL once we get the housing strr url set
declineTosRedirectUrl: process.env.NUXT_DECLINE_TOS_REDIRECT_URL,
bcGovStrrUrl: process.env.NUXT_BCGOV_STRR_URL
bcGovStrrUrl: process.env.NUXT_BCGOV_STRR_URL,
genesysUrl: process.env.NUXT_GENESYS_URL,
genesysEnvironmentKey: process.env.NUXT_GENESYS_ENVIRONMENT_KEY,
genesysDeploymentKey: process.env.NUXT_GENESYS_DEPLOYMENT_KEY
// set by layer - still required in .env
// keycloakAuthUrl - NUXT_KEYCLOAK_AUTH_URL
// keycloakClientId - NUXT_KEYCLOAK_CLIENTID
Expand Down
5 changes: 5 additions & 0 deletions strr-host-pm-web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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_HOST_FEES_URL="https://www2.gov.bc.ca/gov/content/housing-tenancy/short-term-rentals/registry/host-registration#fees"

# 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-host-pm-web/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export default defineAppConfig({
hrefRtcKey: 'hostFeesUrl'
}
})
},
sbcWebMsg: {
enable: true,
allowedRoutes: ['application', 'dashboard']
}
},
ui: {}
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
1 change: 0 additions & 1 deletion strr-host-pm-web/app/pages/application.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { ConnectStepper, FormReview } from '#components'

const { t } = useI18n()
const route = useRoute()
const localePath = useLocalePath()
Expand Down
5 changes: 5 additions & 0 deletions strr-host-pm-web/devops/vaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ 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"

# 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-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=""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be created in 1pass? I can do that for you if you need

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that would be great if you could. I can wait to merge this until thats added.


# 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-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
Loading