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', }), )