diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx index 90893b9ec..11f5b2f09 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/CategorySection.tsx @@ -60,6 +60,7 @@ export const categorySectionFragment = graphql` description kind gcmConsentTypes + posthogConsent cookies(first: 100, orderBy: { field: CREATED_AT, direction: ASC }) @connection(key: "CategorySection_cookies", filters: []) @required(action: THROW) { @@ -99,6 +100,7 @@ const updateCategoryMutation = graphql` description rank gcmConsentTypes + posthogConsent updatedAt } cookieBanner { @@ -239,7 +241,10 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps) const cookies = category.cookies.edges.map(e => e.node); const isMutating = isUpdating || isCreating || isUpdatingCookie; - const handleSaveCategory = (name: string, slug: string, description: string, gcmConsentTypes: string[]) => { + const handleSaveCategory = ( + name: string, slug: string, description: string, + gcmConsentTypes: string[], posthogConsent: boolean, + ) => { updateCategory({ variables: { input: { @@ -248,6 +253,7 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps) slug, description, gcmConsentTypes, + posthogConsent, }, }, onCompleted(_response, errors) { @@ -485,6 +491,7 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps) slug={category.slug} description={category.description} gcmConsentTypes={[...category.gcmConsentTypes]} + posthogConsent={category.posthogConsent} isUpdating={isUpdating} onSave={handleSaveCategory} onCancel={() => setIsEditingCategory(false)} @@ -541,6 +548,16 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps) ))} )} + {category.posthogConsent && ( +
+ + {__("PostHog:")} + + + {__("Tracking consent")} + +
+ )} )} diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/EditCategoryForm.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/EditCategoryForm.tsx index 500b569fb..618c8866b 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/EditCategoryForm.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/EditCategoryForm.tsx @@ -31,8 +31,9 @@ interface EditCategoryFormProps { slug: string; description: string; gcmConsentTypes: string[]; + posthogConsent: boolean; isUpdating: boolean; - onSave: (name: string, slug: string, description: string, gcmConsentTypes: string[]) => void; + onSave: (name: string, slug: string, description: string, gcmConsentTypes: string[], posthogConsent: boolean) => void; onCancel: () => void; } @@ -41,6 +42,7 @@ export function EditCategoryForm({ slug, description, gcmConsentTypes, + posthogConsent, isUpdating, onSave, onCancel, @@ -50,6 +52,7 @@ export function EditCategoryForm({ const [editSlug, setEditSlug] = useState(slug); const [editDescription, setEditDescription] = useState(description); const [editGcmTypes, setEditGcmTypes] = useState(gcmConsentTypes); + const [editPosthogConsent, setEditPosthogConsent] = useState(posthogConsent); const toggleGcmType = (type: string) => { setEditGcmTypes(prev => @@ -102,11 +105,28 @@ export function EditCategoryForm({ ))} +
+ +

+ {__("Control PostHog tracking consent based on this category.")} +

+ +