Merged in develop (pull request #539)
Promote to test Approved-by: Christel Westerberg
This commit is contained in:
@@ -44,7 +44,7 @@ export default async function Profile({ params }: PageArgs<LangParams>) {
|
|||||||
</Title>
|
</Title>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
<Button asChild intent="primary" size="small" theme="base">
|
<Button asChild intent="primary" size="small" theme="base">
|
||||||
<Link color="none" href={profileEdit[getLang()]}>
|
<Link prefetch={false} color="none" href={profileEdit[getLang()]}>
|
||||||
{formatMessage({ id: "Edit profile" })}
|
{formatMessage({ id: "Edit profile" })}
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default function Form({ user }: EditFormProps) {
|
|||||||
streetAddress: user.address.streetAddress ?? "",
|
streetAddress: user.address.streetAddress ?? "",
|
||||||
zipCode: user.address.zipCode ?? "",
|
zipCode: user.address.zipCode ?? "",
|
||||||
},
|
},
|
||||||
dateOfBirth: user.dateOfBirth ?? "1900-01-01",
|
dateOfBirth: user.dateOfBirth,
|
||||||
email: user.email,
|
email: user.email,
|
||||||
language: user.language ?? langToApiLang[lang],
|
language: user.language ?? langToApiLang[lang],
|
||||||
phoneNumber: phoneInput,
|
phoneNumber: phoneInput,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { useCallback, useEffect, useState } from "react"
|
import { useCallback, useEffect } from "react"
|
||||||
|
|
||||||
import { webviews } from "@/constants/routes/webviews"
|
import { webviews } from "@/constants/routes/webviews"
|
||||||
|
import useTrackingStore from "@/stores/tracking"
|
||||||
|
|
||||||
import { createSDKPageObject } from "@/utils/tracking"
|
import { createSDKPageObject } from "@/utils/tracking"
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ import { TrackingSDKProps } from "@/types/components/tracking"
|
|||||||
export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) {
|
export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) {
|
||||||
const pathName = usePathname()
|
const pathName = usePathname()
|
||||||
const isWebview = webviews.includes(pathName)
|
const isWebview = webviews.includes(pathName)
|
||||||
const [initPerformanceTracking, setInitPerformanceTracking] = useState(true)
|
const { hasRun, setHasRun } = useTrackingStore()
|
||||||
|
|
||||||
const CookiebotCallbackOnAccept = useCallback(() => {
|
const CookiebotCallbackOnAccept = useCallback(() => {
|
||||||
const cookie = window._satellite.cookie.get("CookieConsent")
|
const cookie = window._satellite.cookie.get("CookieConsent")
|
||||||
@@ -39,7 +40,7 @@ export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initPerformanceTracking) {
|
if (!hasRun) {
|
||||||
const perfObserver = new PerformanceObserver((observedEntries) => {
|
const perfObserver = new PerformanceObserver((observedEntries) => {
|
||||||
const entry = observedEntries.getEntriesByType("navigation")[0]
|
const entry = observedEntries.getEntriesByType("navigation")[0]
|
||||||
|
|
||||||
@@ -61,9 +62,9 @@ export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) {
|
|||||||
buffered: true,
|
buffered: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
setInitPerformanceTracking(false)
|
setHasRun()
|
||||||
}
|
}
|
||||||
}, [pathName, pageData, userData, initPerformanceTracking])
|
}, [pathName, pageData, userData, hasRun, setHasRun])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// handle consent
|
// handle consent
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const getUserSchema = z.object({
|
|||||||
streetAddress: z.string().optional(),
|
streetAddress: z.string().optional(),
|
||||||
zipCode: z.string().optional(),
|
zipCode: z.string().optional(),
|
||||||
}),
|
}),
|
||||||
dateOfBirth: z.string().optional().default("N/A"),
|
dateOfBirth: z.string().optional().default("1900-01-01"),
|
||||||
email: z.string().email(),
|
email: z.string().email(),
|
||||||
firstName: z.string(),
|
firstName: z.string(),
|
||||||
language: z.string().optional(),
|
language: z.string().optional(),
|
||||||
|
|||||||
15
stores/tracking.ts
Normal file
15
stores/tracking.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { create } from "zustand"
|
||||||
|
|
||||||
|
interface TrackingStoreState {
|
||||||
|
hasRun: boolean
|
||||||
|
setHasRun: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const useTrackingStore = create<TrackingStoreState>((set) => ({
|
||||||
|
hasRun: false,
|
||||||
|
setHasRun: () => set(() => ({ hasRun: true })),
|
||||||
|
}))
|
||||||
|
|
||||||
|
export default useTrackingStore
|
||||||
Reference in New Issue
Block a user