Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #912 from prezly/feature/care-4941-support-onetrus…
Browse files Browse the repository at this point in the history
…t-cookie-integration

[CARE-4941] Feature - Support OneTrust cookie integration
  • Loading branch information
e1himself authored May 10, 2024
2 parents 2044db2 + 8ffa9e6 commit 0216a3d
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 144 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STORY_FILE, useAnalytics } from '@prezly/analytics-nextjs';
import { DOWNLOAD, useAnalytics } from '@prezly/analytics-nextjs';
import type { AttachmentNode } from '@prezly/story-content-format';
import { translations } from '@prezly/theme-kit-intl';
import { UploadcareFile } from '@prezly/uploadcare';
Expand Down Expand Up @@ -26,7 +26,7 @@ function Attachment({ node }: Props) {
const fileType = fileExtension?.toUpperCase();

function handleClick() {
track(STORY_FILE.DOWNLOAD, { id: file.uuid });
track(DOWNLOAD.ATTACHMENT, { id: file.uuid });
}

return (
Expand Down
6 changes: 3 additions & 3 deletions components/ContentRenderer/components/Gallery.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STORY_GALLERY_IMAGE, useAnalytics } from '@prezly/analytics-nextjs';
import { DOWNLOAD, useAnalytics, VIEW } from '@prezly/analytics-nextjs';
import { Elements } from '@prezly/content-renderer-react-js';
import type { GalleryNode } from '@prezly/story-content-format';

Expand All @@ -13,10 +13,10 @@ function Gallery({ node }: Props) {
<Elements.Gallery
node={node}
onImageDownload={(image) => {
track(STORY_GALLERY_IMAGE.DOWNLOAD, { id: image.uuid });
track(DOWNLOAD.GALLERY_IMAGE, { id: image.uuid });
}}
onPreviewOpen={(image) => {
track(STORY_GALLERY_IMAGE.VIEW, { id: image.uuid });
track(VIEW.GALLERY_IMAGE, { id: image.uuid });
}}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions components/ContentRenderer/components/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { STORY_IMAGE, useAnalytics } from '@prezly/analytics-nextjs';
import { DOWNLOAD, useAnalytics, VIEW } from '@prezly/analytics-nextjs';
import { Elements } from '@prezly/content-renderer-react-js';
import type { ImageNode } from '@prezly/story-content-format';
import type { PropsWithChildren } from 'react';
Expand All @@ -14,10 +14,10 @@ function Image({ node, children }: PropsWithChildren<Props>) {
<Elements.Image
node={node}
onDownload={(image) => {
track(STORY_IMAGE.DOWNLOAD, { id: image.uuid });
track(DOWNLOAD.IMAGE, { id: image.uuid });
}}
onPreviewOpen={(image) => {
track(STORY_IMAGE.VIEW, { id: image.uuid });
track(VIEW.IMAGE, { id: image.uuid });
}}
>
{children}
Expand Down
8 changes: 0 additions & 8 deletions components/RichText/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { STORY_LINK, useAnalytics } from '@prezly/analytics-nextjs';
import type { LinkNode } from '@prezly/story-content-format';
import classNames from 'classnames';
import type { PropsWithChildren } from 'react';
Expand All @@ -8,20 +7,13 @@ interface Props {
}

function Link({ node, children }: PropsWithChildren<Props>) {
const { track } = useAnalytics();

function handleClick() {
track(STORY_LINK.CLICK, { href: node.href });
}

return (
<a
href={node.href}
className={classNames(
'text-neutral-200 underline hover:text-blue-400 active:text-blue-500',
'focus:text-blue-400 focus:outline-none',
)}
onClick={handleClick}
>
{children}
</a>
Expand Down
Loading

0 comments on commit 0216a3d

Please sign in to comment.