From e9335c3ba08289381d68017196252af62938ac7f Mon Sep 17 00:00:00 2001 From: Antoine Caron Date: Mon, 9 Oct 2023 13:39:54 +0200 Subject: [PATCH] fix(cookies): bind name for segment integration instead of creationName --- .changeset/brave-needles-play.md | 5 +++++ .../__tests__/useSegmentIntegrations/working.tsx | 4 ++-- .../src/CookieConsentProvider/useSegmentIntegrations.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/brave-needles-play.md diff --git a/.changeset/brave-needles-play.md b/.changeset/brave-needles-play.md new file mode 100644 index 000000000..011308cb3 --- /dev/null +++ b/.changeset/brave-needles-play.md @@ -0,0 +1,5 @@ +--- +'@scaleway/cookie-consent': patch +--- + +Fix configuration of segment integrations with categories by using name instead of creationName diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx index 6fe91e61d..e07a5a541 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx @@ -58,7 +58,7 @@ describe('CookieConsent - useSegmentIntegrations', () => { }, { category: 'analytics', - name: 'Google Analytics', + name: 'Google Universal Analytics', }, { category: 'marketing', @@ -70,7 +70,7 @@ describe('CookieConsent - useSegmentIntegrations', () => { }, { category: 'marketing', - name: 'bonjour', + name: 'Scaleway Custom', }, ]) }) diff --git a/packages/cookie-consent/src/CookieConsentProvider/useSegmentIntegrations.ts b/packages/cookie-consent/src/CookieConsentProvider/useSegmentIntegrations.ts index bc848aac1..b853d06c3 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/useSegmentIntegrations.ts +++ b/packages/cookie-consent/src/CookieConsentProvider/useSegmentIntegrations.ts @@ -37,8 +37,8 @@ const transformSegmentIntegrationsToIntegrations = ( segmentIntegrations: SegmentIntegrations, ): Integrations => [defaultSegmentIoIntegration, ...segmentIntegrations].map( - ({ category, creationName }) => ({ - name: creationName, + ({ category, name }) => ({ + name, category: CATEGORY_MATCH[category] ?? 'marketing', }), )