From 776cbcbf15bf682968f3013d3c2196db336bc606 Mon Sep 17 00:00:00 2001 From: Jason Gill Date: Thu, 12 Dec 2024 08:24:24 -0700 Subject: [PATCH] Set up Flutter listeners and callHandlers in the Sample App for native app communication (#5597) --- CHANGELOG.md | 1 + .../src/components/notices/NoticeOverlay.tsx | 4 ++-- .../src/components/tcf/TcfOverlay.tsx | 8 +++---- clients/sample-app/package-lock.json | 2 +- clients/sample-app/package.json | 2 +- .../sample-app/src/pages/embedded-consent.tsx | 24 ++++++++++++++----- clients/sample-app/src/pages/index.tsx | 9 +++++++ 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24f0e34ecb..ad2999fea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The types of changes are: ### Added - New page in the Cookie House sample app to demonstrate the use of embedding the FidesJS SDK on the page [#5564](https://github.com/ethyca/fides/pull/5564) +- Added event based communication example to the Cookie House sample app [#5597](https://github.com/ethyca/fides/pull/5597) - Added new erasure tests for BigQuery Enterprise [#5554](https://github.com/ethyca/fides/pull/5554) ### Fixed diff --git a/clients/fides-js/src/components/notices/NoticeOverlay.tsx b/clients/fides-js/src/components/notices/NoticeOverlay.tsx index b24ca220b3..44a31caf7a 100644 --- a/clients/fides-js/src/components/notices/NoticeOverlay.tsx +++ b/clients/fides-js/src/components/notices/NoticeOverlay.tsx @@ -258,12 +258,12 @@ const NoticeOverlay: FunctionComponent = ({ if (isConsentOverride(options) && experience.privacy_notices) { if (options.fidesConsentOverride === ConsentMethod.ACCEPT) { fidesDebugger( - "Consent automatically accepted by fides_accept_all override!", + "Consent automatically accepted by fides_consent_override!", ); handleAcceptAll(true); } else if (options.fidesConsentOverride === ConsentMethod.REJECT) { fidesDebugger( - "Consent automatically rejected by fides_reject_all override!", + "Consent automatically rejected by fides_consent_override!", ); handleRejectAll(true); } diff --git a/clients/fides-js/src/components/tcf/TcfOverlay.tsx b/clients/fides-js/src/components/tcf/TcfOverlay.tsx index 907fc613b6..9e47bf35f7 100644 --- a/clients/fides-js/src/components/tcf/TcfOverlay.tsx +++ b/clients/fides-js/src/components/tcf/TcfOverlay.tsx @@ -362,12 +362,12 @@ export const TcfOverlay = ({ useEffect(() => { if (options.fidesConsentOverride === ConsentMethod.ACCEPT) { fidesDebugger( - "Consent automatically accepted by fides_accept_all override!", + "Consent automatically accepted by fides_consent_override!", ); handleAcceptAll(true); } else if (options.fidesConsentOverride === ConsentMethod.REJECT) { fidesDebugger( - "Consent automatically rejected by fides_reject_all override!", + "Consent automatically rejected by fides_consent_override!", ); handleRejectAll(true); } @@ -389,7 +389,7 @@ export const TcfOverlay = ({ }, [cookie, options.debug]); const handleDismiss = useCallback(() => { - handleUpdateAllPreferences(ConsentMethod.DISMISS, draftIds!); + handleUpdateAllPreferences(ConsentMethod.DISMISS, draftIds); }, [handleUpdateAllPreferences, draftIds]); const experienceConfig = @@ -461,7 +461,7 @@ export const TcfOverlay = ({ : () => ( { setDraftIds(updatedIds); dispatchFidesEvent("FidesUIChanged", cookie, options.debug); diff --git a/clients/sample-app/package-lock.json b/clients/sample-app/package-lock.json index d513b3a1d4..7ed686f9c1 100644 --- a/clients/sample-app/package-lock.json +++ b/clients/sample-app/package-lock.json @@ -14,7 +14,7 @@ "react": "18.3.1", "react-dom": "18.3.1", "react-hook-form": "7.38.0", - "react-select": "^5.7.3", + "react-select": "^5.8.3", "sass": "1.55.0" }, "devDependencies": { diff --git a/clients/sample-app/package.json b/clients/sample-app/package.json index b4f8cabd47..d74ce250f2 100644 --- a/clients/sample-app/package.json +++ b/clients/sample-app/package.json @@ -22,7 +22,7 @@ "react": "18.3.1", "react-dom": "18.3.1", "react-hook-form": "7.38.0", - "react-select": "^5.7.3", + "react-select": "^5.8.3", "sass": "1.55.0" }, "devDependencies": { diff --git a/clients/sample-app/src/pages/embedded-consent.tsx b/clients/sample-app/src/pages/embedded-consent.tsx index 3b4334b031..9f5049ce5b 100644 --- a/clients/sample-app/src/pages/embedded-consent.tsx +++ b/clients/sample-app/src/pages/embedded-consent.tsx @@ -61,14 +61,17 @@ const IndexPage = ({ gtmContainerId, privacyCenterUrl }: Props) => { {/* Allow the embedded consent modal to fill the screen */} @@ -101,6 +104,15 @@ const IndexPage = ({ gtmContainerId, privacyCenterUrl }: Props) => { `} ) : null} + {/* Support for Flutter InAppWebView communication https://inappwebview.dev/docs/webview/javascript/communication */} + {/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */} +
); diff --git a/clients/sample-app/src/pages/index.tsx b/clients/sample-app/src/pages/index.tsx index 0e91ab7920..44a8107aa2 100644 --- a/clients/sample-app/src/pages/index.tsx +++ b/clients/sample-app/src/pages/index.tsx @@ -98,6 +98,15 @@ const IndexPage = ({ gtmContainerId, privacyCenterUrl, products }: Props) => { `} ) : null} + {/* Support for Flutter InAppWebView communication https://inappwebview.dev/docs/webview/javascript/communication */} + {/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */} + );