diff --git a/devops/vaults.json b/devops/vaults.json index efcc2a343..c34f502d4 100644 --- a/devops/vaults.json +++ b/devops/vaults.json @@ -57,5 +57,11 @@ "base", "business-create-ui" ] + }, + { + "vault": "hotjar", + "application": [ + "shared" + ] } ] diff --git a/package-lock.json b/package-lock.json index 0c16dff34..aa7cf0e1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "business-create-ui", - "version": "4.5.7", + "version": "4.5.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "business-create-ui", - "version": "4.5.7", + "version": "4.5.8", "dependencies": { "@babel/compat-data": "^7.19.1", "@bcrs-shared-components/breadcrumb": "2.1.4", @@ -34,6 +34,7 @@ "axios": "^0.27.2", "core-js": "^3.25.2", "http-status-codes": "^2.2.0", + "js-cookie": "^3.0.1", "launchdarkly-js-client-sdk": "^2.22.1", "lodash": "^4.17.21", "pdfjs-dist": "2.0.943", @@ -14651,6 +14652,14 @@ "node": ">=10" } }, + "node_modules/js-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz", + "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==", + "engines": { + "node": ">=12" + } + }, "node_modules/js-message": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz", @@ -35738,6 +35747,11 @@ } } }, + "js-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz", + "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==" + }, "js-message": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/js-message/-/js-message-1.0.7.tgz", diff --git a/package.json b/package.json index 39a772942..3a7a1be59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "business-create-ui", - "version": "4.5.7", + "version": "4.5.8", "private": true, "appName": "Create UI", "sbcName": "SBC Common Components", @@ -38,6 +38,7 @@ "axios": "^0.27.2", "core-js": "^3.25.2", "http-status-codes": "^2.2.0", + "js-cookie": "^3.0.1", "launchdarkly-js-client-sdk": "^2.22.1", "lodash": "^4.17.21", "pdfjs-dist": "2.0.943", diff --git a/public/config/configuration.json b/public/config/configuration.json index 48fc99539..9ae959c99 100644 --- a/public/config/configuration.json +++ b/public/config/configuration.json @@ -8,6 +8,7 @@ "BUSINESS_CREATE_LD_CLIENT_ID": "5e6142dd29b3030a850285b3", "DASHBOARD_URL": "https://dev.bcregistry.ca/business/", "HOTJAR_ID": "", + "IA_SURVEY_ID": "", "KEYCLOAK_CONFIG_PATH": "/local-keycloak-config-url/keycloak.json", "LEGAL_API_URL": "https://legal-api-dev.apps.silver.devops.gov.bc.ca", "LEGAL_API_VERSION_2": "/api/v2", diff --git a/src/App.vue b/src/App.vue index e62ee7ce8..1a09aede0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -45,7 +45,8 @@ attach="#app" :dialog="filingSurveyDialog" @no="filingSurveyDialog = false" - @yes="filingSurveyDialog = false" + @yes="filingSurveyDialog = false; launchFilingSurvey()" + @doNotShow="updateSurveyCookie($event)" /> @@ -63,15 +62,10 @@ export default class FilingSurveyDialog extends Vue { /** Prop to provide attachment selector. */ @Prop({ default: '' }) readonly attach!: string - // Pass click events to parent. + // Pass events to parent. @Emit() protected no (): void {} @Emit() protected yes (): void {} - - /** Saves a cookie to prevent showing this dialog for a while. */ - protected updateCookie (val: boolean) { - // *** TODO: save a cookie with an expiry date - // and maybe delete cookie if not needed? - } + @Emit('doNotShow') protected doNotShow (val: boolean): void {} } diff --git a/src/utils/FetchConfig.ts b/src/utils/FetchConfig.ts index 00f1cb383..8ee846e31 100644 --- a/src/utils/FetchConfig.ts +++ b/src/utils/FetchConfig.ts @@ -94,6 +94,9 @@ export async function FetchConfig (): Promise { console.info('Set Siteminder Logout URL to: ' + siteminderLogoutUrl) } + const iaSurveyId: string = response.data.IA_SURVEY_ID + sessionStorage.setItem('IA_SURVEY_ID', iaSurveyId) + const hotjarId: string = response.data.HOTJAR_ID; (window).hotjarId = hotjarId diff --git a/tests/unit/FilingSurveyDialog.spec.ts b/tests/unit/FilingSurveyDialog.spec.ts index b111d7481..7200a4f17 100644 --- a/tests/unit/FilingSurveyDialog.spec.ts +++ b/tests/unit/FilingSurveyDialog.spec.ts @@ -31,7 +31,28 @@ describe('Filing Survey Dialog', () => { wrapper.destroy() }) - it('emits an event when No button is clicked', async () => { + it('emits an event when "Do not show" button is clicked', async () => { + const wrapper = mount(FilingSurveyDialog, + { + vuetify, + store, + propsData: { dialog: true } + }) + + expect(wrapper.emitted('doNotShow')).toBeUndefined() + + // verify and click checkbox + const checkbox = wrapper.find('.dialog-checkbox') + expect(checkbox.text()).toBe('Do not show this message again') + checkbox.find('input').trigger('click') + await Vue.nextTick() + + expect(wrapper.emitted('doNotShow').length).toBe(1) + + wrapper.destroy() + }) + + it('emits an event when "No" button is clicked', async () => { const wrapper = mount(FilingSurveyDialog, { vuetify, @@ -41,10 +62,10 @@ describe('Filing Survey Dialog', () => { expect(wrapper.emitted('no')).toBeUndefined() - // verify and click No button - const exitButton = wrapper.find('#dialog-no-button') - expect(exitButton.text()).toBe('NOT RIGHT NOW') - exitButton.trigger('click') + // verify and click button + const button = wrapper.find('#dialog-no-button') + expect(button.text()).toBe('NOT RIGHT NOW') + button.trigger('click') await Vue.nextTick() expect(wrapper.emitted('no').length).toBe(1) @@ -52,7 +73,7 @@ describe('Filing Survey Dialog', () => { wrapper.destroy() }) - it('emits an event when Yes button is clicked', async () => { + it('emits an event when "Yes" button is clicked', async () => { const wrapper = mount(FilingSurveyDialog, { vuetify, @@ -62,10 +83,10 @@ describe('Filing Survey Dialog', () => { expect(wrapper.emitted('yes')).toBeUndefined() - // verify and click retry button - const retryButton = wrapper.find('#dialog-yes-button') - expect(retryButton.text()).toBe('YES, I\'LL PARTICIPATE') - retryButton.trigger('click') + // verify and click button + const button = wrapper.find('#dialog-yes-button') + expect(button.text()).toBe('YES, I\'LL PARTICIPATE') + button.trigger('click') await Vue.nextTick() expect(wrapper.emitted('yes').length).toBe(1)