From beb06c2d753a12a014cd65e4fd3edec9c82143df Mon Sep 17 00:00:00 2001 From: kamenboev Date: Wed, 24 Jan 2024 15:04:22 +0200 Subject: [PATCH] fix(WWP-3314): settings link --- src/consent/__tests__/consent-settings-link.test.tsx | 6 +++--- src/consent/consent-settings-link.tsx | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/consent/__tests__/consent-settings-link.test.tsx b/src/consent/__tests__/consent-settings-link.test.tsx index 55485a4aa..56ff46828 100644 --- a/src/consent/__tests__/consent-settings-link.test.tsx +++ b/src/consent/__tests__/consent-settings-link.test.tsx @@ -30,11 +30,11 @@ describe('ConsentSettingsLink', () => { ccpa: { loadPrivacyManagerModal: expectedFunction, }, + usnat: { + loadPrivacyManagerModal: expectedFunction, + }, }; (global as any).window._sp_ = sp; - (global as any).window._sp_usnat = { - loadPrivacyManagerModal: expectedFunction, - }; }); afterEach(() => { diff --git a/src/consent/consent-settings-link.tsx b/src/consent/consent-settings-link.tsx index c090bc67f..872bdcc8f 100644 --- a/src/consent/consent-settings-link.tsx +++ b/src/consent/consent-settings-link.tsx @@ -19,8 +19,10 @@ type SPWindowUnifiedCCPA = Window & { }; type SPWindowUnifiedUSNAT = Window & { - _sp_usnat?: { - loadPrivacyManagerModal: (managerId: string) => void; + _sp_?: { + usnat?: { + loadPrivacyManagerModal: (managerId: string) => void; + }; }; }; @@ -75,7 +77,7 @@ export const ConsentSettingsLink: React.FC = ({ ); } else if (usnat) { // eslint-disable-next-line no-underscore-dangle - (window as SPWindowUnifiedUSNAT)._sp_usnat!.loadPrivacyManagerModal( + (window as SPWindowUnifiedUSNAT)._sp_!.usnat!.loadPrivacyManagerModal( privacyManagerId, ); } else {