Skip to content

Commit

Permalink
Merge pull request #896 from prezly/feature/dev-12779-update-analytic…
Browse files Browse the repository at this point in the history
…s-in-lena-theme

[DEV-12779] Feature - Updated analytics and theme kit packages
  • Loading branch information
kudlajz authored Apr 10, 2024
2 parents d970a42 + 0b7742f commit 60493c0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 40 deletions.
7 changes: 6 additions & 1 deletion modules/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Analytics } from '@prezly/analytics-nextjs';
import { Analytics, useAnalytics } from '@prezly/analytics-nextjs';
import { Notification, Story } from '@prezly/sdk';
import {
PageSeo,
Expand Down Expand Up @@ -41,6 +41,7 @@ const noIndex = process.env.VERCEL === '1';

function Layout({ children, description, imageUrl, title, hasError }: PropsWithChildren<Props>) {
const [isLoadingPage, setIsLoadingPage] = useState(false);
const { page } = useAnalytics();
const newsroom = useNewsroom();
const story = useCurrentStory();
const { contacts, notifications } = useNewsroomContext();
Expand Down Expand Up @@ -70,6 +71,10 @@ function Layout({ children, description, imageUrl, title, hasError }: PropsWithC
return notifications;
}, [notifications, isPreview]);

useEffect(() => {
page();
}, [page, pathname]);

useEffect(() => {
function onRouteChangeStart() {
setIsLoadingPage(true);
Expand Down
68 changes: 34 additions & 34 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"@hcaptcha/react-hcaptcha": "1.9.3",
"@headlessui/react": "1.7.18",
"@playwright/test": "^1.33.0",
"@prezly/analytics-nextjs": "2.0.1",
"@prezly/analytics-nextjs": "2.1.0",
"@prezly/content-renderer-react-js": "0.36.1",
"@prezly/sdk": "18.3.0",
"@prezly/story-content-format": "0.64.0",
"@prezly/theme-kit-core": "7.1.0",
"@prezly/theme-kit-intl": "7.1.0",
"@prezly/theme-kit-nextjs": "7.1.0",
"@prezly/theme-kit-core": "7.2.0",
"@prezly/theme-kit-intl": "7.2.0",
"@prezly/theme-kit-nextjs": "7.3.0",
"@prezly/uploadcare": "2.4.3",
"@prezly/uploadcare-image": "0.3.2",
"@react-hookz/web": "14.7.1",
Expand Down
3 changes: 2 additions & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function App({ Component, pageProps }: AppProps) {
const { newsroomContextProps, translations, isTrackingEnabled, ...customPageProps } =
pageProps as PageProps & BasePageProps;

const { localeCode, newsroom, currentStory } = newsroomContextProps || {
const { localeCode, newsroom, currentGallery, currentStory } = newsroomContextProps || {
localeCode: DEFAULT_LOCALE,
};
const locale = useMemo(() => LocaleObject.fromAnyCode(localeCode), [localeCode]);
Expand All @@ -39,6 +39,7 @@ function App({ Component, pageProps }: AppProps) {
messages={translations}
>
<AnalyticsContextProvider
gallery={currentGallery}
isEnabled={isTrackingEnabled}
newsroom={newsroom}
story={currentStory}
Expand Down

0 comments on commit 60493c0

Please sign in to comment.