From a4e46cb002d671dcffd0ac74aa610633a3b57bc7 Mon Sep 17 00:00:00 2001 From: Prithviraj-rathore-segment Date: Fri, 29 Aug 2025 12:55:14 +0530 Subject: [PATCH] STRATCONN-6111/Braze added devicePropertyAllowList in braze SDK initialization onyly for valid values --- .../src/__tests__/initialization.test.ts | 30 +++++++++++++++++++ .../destinations/braze/src/index.ts | 13 +++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/browser-destinations/destinations/braze/src/__tests__/initialization.test.ts b/packages/browser-destinations/destinations/braze/src/__tests__/initialization.test.ts index f2cdfa1c4e8..37a17ecfacb 100644 --- a/packages/browser-destinations/destinations/braze/src/__tests__/initialization.test.ts +++ b/packages/browser-destinations/destinations/braze/src/__tests__/initialization.test.ts @@ -136,4 +136,34 @@ describe('initialization', () => { expect(openSessionSpy).toHaveBeenCalled() expect(logCustomEventSpy).toHaveBeenCalledWith('FIFA', { goat: 'deno' }) }) + + test('passes devicePropertyAllowlist to Braze SDK initialization', async () => { + const devicePropertyAllowlist = ['os', 'browser'] + const [event] = await brazeDestination({ + api_key: 'b_123', + endpoint: 'endpoint', + sdkVersion: '3.5', + doNotLoadFontAwesome: true, + devicePropertyAllowlist, + subscriptions: [ + { + partnerAction: 'trackEvent', + name: 'Track Event', + enabled: true, + subscribe: 'type = "track"', + mapping: { + eventName: { '@path': '$.event' }, + eventProperties: { '@path': '$.properties' } + } + } + ] + }) + + const initializeSpy = jest.spyOn(destination, 'initialize') + await event.load(Context.system(), {} as Analytics) + + // Check that the config passed to initialize contains the allowlist + const callArgs = initializeSpy.mock.calls[0][0]?.settings || {} + expect(callArgs.devicePropertyAllowlist).toEqual(devicePropertyAllowlist) + }) }) diff --git a/packages/browser-destinations/destinations/braze/src/index.ts b/packages/browser-destinations/destinations/braze/src/index.ts index 853930eb164..2ad630b353b 100644 --- a/packages/browser-destinations/destinations/braze/src/index.ts +++ b/packages/browser-destinations/destinations/braze/src/index.ts @@ -322,9 +322,20 @@ export const destination: BrowserDestinationDefinition item.trim() !== '')) { + config.devicePropertyAllowlist = devicePropertyAllowlist + } + } + const version = sdkVersion ?? defaultVersion resetUserCache() @@ -351,7 +362,7 @@ export const destination: BrowserDestinationDefinition