From 9891a9b62bfece90e4768e5b67cf1151222b22c6 Mon Sep 17 00:00:00 2001 From: helgifr Date: Tue, 17 Dec 2024 20:23:14 +0000 Subject: [PATCH 1/2] fix(new-primary-school): Use guardian role instead of parent (#17269) Co-authored-by: hfhelgason Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../templates/new-primary-school/new-primary-school.utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts index f816098a2283..36aba3e7c7e3 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts @@ -46,7 +46,7 @@ export const transformApplicationToNewPrimarySchoolDTO = ( }, email: parents.parent1.email, phone: parents.parent1.phoneNumber, - role: 'parent', + role: 'guardian', }, ...(parents.parent2 ? [ @@ -59,7 +59,7 @@ export const transformApplicationToNewPrimarySchoolDTO = ( }, email: parents.parent2.email, phone: parents.parent2.phoneNumber, - role: 'parent', + role: 'guardian', }, ] : []), From 2213255ef4cfd135097a7a3d29a31ebb5876cacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar=20Vestmann?= <43557895+RunarVestmann@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:56:07 +0000 Subject: [PATCH 2/2] fix(web): Boost chat panel - use pushUp prop (#17271) * Push chat panel up * Add translation to text in chat bubble * Open chat if query params are present --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../BoostChatPanel/BoostChatPanel.tsx | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx b/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx index 998fe2c2390b..bc0d8a2f0d58 100644 --- a/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx +++ b/apps/web/components/ChatPanel/BoostChatPanel/BoostChatPanel.tsx @@ -1,7 +1,14 @@ -import React, { useEffect, useState } from 'react' -import { config, boostChatPanelEndpoints } from './config' +import React, { useEffect, useMemo, useState } from 'react' +import { useQuery } from '@apollo/client' + +import { Query, QueryGetNamespaceArgs } from '@island.is/web/graphql/schema' +import { useNamespaceStrict } from '@island.is/web/hooks' +import { useI18n } from '@island.is/web/i18n' +import { GET_NAMESPACE_QUERY } from '@island.is/web/screens/queries' + import { ChatBubble } from '../ChatBubble' import { BoostChatPanelProps } from '../types' +import { boostChatPanelEndpoints, config } from './config' declare global { interface Window { @@ -16,6 +23,7 @@ export const BoostChatPanel: React.FC< React.PropsWithChildren > = ({ endpoint, pushUp = false }) => { const [showButton, setShowButton] = useState(Boolean(window.boost)) // we show button when chat already loaded + const { activeLocale } = useI18n() useEffect(() => { // recreate the chat panel if we are on a different endpoint @@ -60,19 +68,43 @@ export const BoostChatPanel: React.FC< ) setShowButton(true) + + const queryParam = new URLSearchParams(window.location.search).get( + 'wa_lid', + ) + if (queryParam && ['t10', 't11'].includes(queryParam)) { + window.boost.chatPanel.show() + } }) el.src = boostChatPanelEndpoints[endpoint].url el.id = 'boost-script' document.body.appendChild(el) } - }, []) + }, [endpoint]) + + const { data } = useQuery(GET_NAMESPACE_QUERY, { + variables: { + input: { + lang: activeLocale, + namespace: 'ChatPanels', + }, + }, + }) + + const namespace = useMemo( + () => JSON.parse(data?.getNamespace?.fields || '{}'), + [data?.getNamespace?.fields], + ) + + const n = useNamespaceStrict(namespace) return ( window.boost.chatPanel.show()} isVisible={showButton} + pushUp={pushUp} /> ) }