diff --git a/.env.local.sample b/.env.local.sample index f041a760..e991c4e5 100644 --- a/.env.local.sample +++ b/.env.local.sample @@ -1,2 +1 @@ -VITE_GPT_URL="" -VITE_GPT_AUTH="" \ No newline at end of file +VITE_FIREBASE_CONFIG="" \ No newline at end of file diff --git a/__tests__/setup.js b/__tests__/setup.js index f96675f3..addfaa66 100644 --- a/__tests__/setup.js +++ b/__tests__/setup.js @@ -1,6 +1,20 @@ import { config } from '@vue/test-utils'; import i18n from '@/utils/plugins/i18n.js'; import UnnnicSystemPlugin from '@/utils/plugins/UnnnicSystem.js'; +import { vi } from 'vitest'; + +vi.mock('firebase/app', () => ({ + initializeApp: vi.fn(() => ({ + name: 'mockApp', + })), +})); + +vi.mock('firebase/firestore', () => ({ + getFirestore: vi.fn(() => ({ + collection: vi.fn(), + doc: vi.fn(), + })), +})); config.global.plugins = [i18n, UnnnicSystemPlugin]; config.global.mocks = { diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 79755b5c..f288a33f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,10 +1,13 @@ #!/bin/sh + +ESCAPED_FIREBASE_CONFIG=$(echo "${VITE_FIREBASE_CONFIG}" | sed 's/\//\\\//g') + export JSON_STRING='window.configs = { \ - "VITE_GPT_URL":"'${VITE_GPT_URL}'", \ - "VITE_GPT_AUTH":"'${VITE_GPT_AUTH}'", \ - "VITE_INSIGHTS_API_URL":"'${VITE_INSIGHTS_API_URL}'", \ - "VITE_HOTJAR_ID":"'${VITE_HOTJAR_ID}'", \ + "VITE_INSIGHTS_API_URL": "'${VITE_INSIGHTS_API_URL}'", \ + "VITE_FIREBASE_CONFIG": '${ESCAPED_FIREBASE_CONFIG}', \ + "VITE_HOTJAR_ID": "'${VITE_HOTJAR_ID}'" \ }' + sed "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/insights/index.html.tmpl > /tmp/index.html exec "$@" \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index dd05e640..e8567e9c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,12 +7,9 @@ FROM node:${NODE_VERSION}-${BASE_VERSION} as builder WORKDIR /app -ARG VITE_GPT_URL -ARG VITE_GPT_AUTH -ARG VITE_HOTJAR_ID +ARG VITE_FIREBASE_CONFIG -ENV VITE_GPT_URL $VITE_GPT_URL -ENV VITE_GPT_AUTH $VITE_GPT_AUTH +ENV VITE_FIREBASE_CONFIG $VITE_FIREBASE_CONFIG ENV VITE_HOTJAR_ID $VITE_HOTJAR_ID RUN apk --no-cache add git diff --git a/package.json b/package.json index 8c78da3c..a02ac71b 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,11 @@ "axios": "^1.7.2", "chart.js": "^4.4.2", "chartjs-plugin-datalabels": "^2.2.0", + "dompurify": "^3.1.7", "emoji-mart": "^5.6.0", + "firebase": "^10.13.1", + "marked": "^14.1.2", + "mitt": "^3.0.1", "moment": "^2.30.1", "vue": "^3.3.11", "vue-i18n": "9", @@ -56,4 +60,4 @@ "resolutions": { "strip-ansi": "6.0.1" } -} \ No newline at end of file +} diff --git a/src/App.vue b/src/App.vue index b5e8cd41..da8f1481 100644 --- a/src/App.vue +++ b/src/App.vue @@ -104,6 +104,7 @@ export default { setProject: 'config/setProject', checkEnableCreateCustomDashboards: 'config/checkEnableCreateCustomDashboards', + setEmail: 'user/setEmail', }), ...mapMutations({ @@ -141,6 +142,10 @@ export default { const sessionUserEmail = parseJwt(newToken)?.email || null; + if (sessionUserEmail) { + this.setEmail(sessionUserEmail); + } + initHotjar(sessionUserEmail); await this.checkEnableCreateCustomDashboards(); diff --git a/src/assets/images/shine.svg b/src/assets/images/shine.svg new file mode 100644 index 00000000..cceb36de --- /dev/null +++ b/src/assets/images/shine.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/components/Markdown.vue b/src/components/Markdown.vue new file mode 100644 index 00000000..b5556753 --- /dev/null +++ b/src/components/Markdown.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/src/components/insights/Layout/Header.vue b/src/components/insights/Layout/Header.vue index 850c7a04..b18826df 100644 --- a/src/components/insights/Layout/Header.vue +++ b/src/components/insights/Layout/Header.vue @@ -17,10 +17,11 @@ + @@ -33,6 +34,7 @@ import HeaderSelectDashboard from './HeaderSelectDashboard/index.vue'; import HeaderTagLive from './HeaderTagLive.vue'; import InsightsLayoutHeaderFilters from './HeaderFilters/index.vue'; import HeaderDashboardSettings from './HeaderDashboardSettings.vue'; +import HeaderGenerateInsightButton from './HeaderGenerateInsights/HeaderGenerateInsightButton.vue'; import moment from 'moment'; @@ -43,8 +45,8 @@ export default { HeaderSelectDashboard, HeaderTagLive, InsightsLayoutHeaderFilters, - HeaderDashboardSettings, + HeaderGenerateInsightButton, }, computed: { ...mapState({ diff --git a/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightButton.vue b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightButton.vue new file mode 100644 index 00000000..ce4c0200 --- /dev/null +++ b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightButton.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightModal.vue b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightModal.vue new file mode 100644 index 00000000..1623793c --- /dev/null +++ b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightModal.vue @@ -0,0 +1,358 @@ + + + + + diff --git a/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightText.vue b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightText.vue new file mode 100644 index 00000000..10eaf0c4 --- /dev/null +++ b/src/components/insights/Layout/HeaderGenerateInsights/HeaderGenerateInsightText.vue @@ -0,0 +1,123 @@ + + + + + + diff --git a/src/components/insights/Layout/HeaderGenerateInsights/InsightModalFooter.vue b/src/components/insights/Layout/HeaderGenerateInsights/InsightModalFooter.vue new file mode 100644 index 00000000..82a39765 --- /dev/null +++ b/src/components/insights/Layout/HeaderGenerateInsights/InsightModalFooter.vue @@ -0,0 +1,308 @@ +