Skip to content

Commit

Permalink
- misc fixes (#504)
Browse files Browse the repository at this point in the history
- app version = 4.5.9
  • Loading branch information
severinbeauvais authored Jan 24, 2023
1 parent 469e73e commit d7ec137
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-create-ui",
"version": "4.5.8",
"version": "4.5.9",
"private": true,
"appName": "Create UI",
"sbcName": "SBC Common Components",
Expand Down
35 changes: 22 additions & 13 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export default class App extends Vue {
@Getter getFilingName!: FilingNames
@Getter isDissolutionFiling!: boolean
@Getter isRestorationFiling!: boolean
@Getter isIncorporationFiling!: boolean
@Getter getSteps!: Array<StepIF>
@Getter isSbcStaff!: boolean
@Getter getFilingSubtitle!: string
Expand Down Expand Up @@ -417,6 +418,12 @@ export default class App extends Vue {
return !this.$route.meta.noStepper
}
/** The current domain. */
get domain (): string {
// remove possible leading period
return window.location.hostname.replace(/^\./, '')
}
/** Helper to check is the current route matches */
private isRouteName (routeName: RouteNames): boolean {
return (this.$route.name === routeName)
Expand Down Expand Up @@ -543,12 +550,11 @@ export default class App extends Vue {
/** Called to save or delete "hide survey" cookie. */
protected updateSurveyCookie (doNotShow: boolean): void {
const domain = window.location.hostname
if (doNotShow) {
// hide survey for 30 days
Cookies.set(this.IA_SURVEY_KEY, 'do-not-show', { domain, expires: 30 })
Cookies.set(this.IA_SURVEY_KEY, 'do-not-show', { domain: this.domain, expires: 30 })
} else {
Cookies.remove(this.IA_SURVEY_KEY, { domain })
Cookies.remove(this.IA_SURVEY_KEY, { domain: this.domain })
}
}
Expand Down Expand Up @@ -588,16 +594,6 @@ export default class App extends Vue {
// reset errors in case this method is invoked more than once (ie, retry)
this.resetFlags()
// check if IA Survey ID is configured
const iaSurveyId = sessionStorage.getItem('IA_SURVEY_ID')
if (iaSurveyId) {
// check for cookie; if it doesn't exist then show survey dialog
// NB: cookie is auto-removed when it expires
const domain = window.location.hostname
const cookie = Cookies.get(this.IA_SURVEY_KEY, { domain })
if (!cookie) this.filingSurveyDialog = true
}
// check that current route matches a supported filing type
const supportedFilings = await GetFeatureFlag('supported-filings')
if (!supportedFilings?.includes(this.$route.meta.filingType)) {
Expand Down Expand Up @@ -1106,6 +1102,19 @@ export default class App extends Vue {
// fetch the data
await this.fetchData()
// show survey dialog...
// - if this is an Incorporation Application filing
// - if the IA Survey ID is configured
// - if the cookie doesn't exist (eg, never set, or expired)
if (this.isIncorporationFiling) {
if (sessionStorage.getItem('IA_SURVEY_ID')) {
const cookie = Cookies.get(this.IA_SURVEY_KEY, { domain: this.domain })
if (!cookie) {
this.filingSurveyDialog = true
}
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/FetchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export async function FetchConfig (): Promise<any> {
}

const iaSurveyId: string = response.data.IA_SURVEY_ID
sessionStorage.setItem('IA_SURVEY_ID', iaSurveyId)
// NB: assign fallback otherwise sessionStorage will store string "undefined"
sessionStorage.setItem('IA_SURVEY_ID', iaSurveyId || '')

const hotjarId: string = response.data.HOTJAR_ID;
(<any>window).hotjarId = hotjarId
Expand Down

0 comments on commit d7ec137

Please sign in to comment.