Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Braze SDK v5.6 #2687

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"typings": "./dist/esm",
"dependencies": {
"@braze/web-sdk": "npm:@braze/web-sdk@^4.1.0",
"@braze/web-sdk": "npm:@braze/web-sdk@^5",
"@braze/web-sdk-v3": "npm:@braze/web-sdk@^3.5.1",
"@segment/actions-core": "^3.141.0",
"@segment/browser-destination-runtime": "^1.70.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ NodeList [
exports[`loads different versions from CDN undefined version:
NodeList [
<script
src="https://js.appboycdn.com/web-sdk/4.6/braze.no-module.min.js"
src="https://js.appboycdn.com/web-sdk/5.6/braze.no-module.min.js"
status="loaded"
type="text/javascript"
/>,
Expand All @@ -85,7 +85,7 @@ exports[`loads different versions from CDN undefined version:
1`] = `
NodeList [
<script
src="https://js.appboycdn.com/web-sdk/4.10/braze.no-module.min.js"
src="https://js.appboycdn.com/web-sdk/5.7/braze.no-module.min.js"
status="loaded"
type="text/javascript"
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('loads different versions from CDN', () => {
expect(scripts).toMatchSnapshot(`
NodeList [
<script
src="https://js.appboycdn.com/web-sdk/4.6/braze.no-module.min.js"
src="https://js.appboycdn.com/web-sdk/5.6/braze.no-module.min.js"
status="loaded"
type="text/javascript"
/>,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 15 additions & 10 deletions packages/browser-destinations/destinations/braze/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Settings } from './generated-types'
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types'
import { browserDestination } from '@segment/browser-destination-runtime/shim'
import type braze from '@braze/web-sdk'
import * as braze from '@braze/web-sdk'
import type appboy from '@braze/web-sdk-v3'
import trackEvent from './trackEvent'
import updateUserProfile from './updateUserProfile'
Expand All @@ -18,25 +18,26 @@ declare global {
}
}

const defaultVersion = '4.10'
const defaultVersion = '5.7'

const presets: DestinationDefinition['presets'] = [
{
name: 'Identify Calls',
type: 'automatic',
subscribe: 'type = "identify" or type = "group"',
partnerAction: 'updateUserProfile',
mapping: defaultValues(updateUserProfile.fields),
type: 'automatic'
mapping: defaultValues(updateUserProfile.fields)
},
{
name: 'Order Completed calls',
type: 'automatic',
subscribe: 'type = "track" and event = "Order Completed"',
partnerAction: 'trackPurchase',
mapping: defaultValues(trackPurchase.fields),
type: 'automatic'
mapping: defaultValues(trackPurchase.fields)
},
{
name: 'Track Calls',
type: 'automatic',
subscribe: 'type = "track" and event != "Order Completed"',
partnerAction: 'trackEvent',
mapping: {
Expand All @@ -47,8 +48,7 @@ const presets: DestinationDefinition['presets'] = [
eventProperties: {
'@path': '$.properties'
}
},
type: 'automatic'
}
}
]

Expand Down Expand Up @@ -93,6 +93,10 @@ export const destination: BrowserDestinationDefinition<Settings, BrazeDestinatio
{
value: '5.4',
label: '5.4'
},
{
value: '5.7',
label: '5.7'
}
],
default: defaultVersion,
Expand Down Expand Up @@ -122,7 +126,8 @@ export const destination: BrowserDestinationDefinition<Settings, BrazeDestinatio
{ label: 'US-09 (https://dashboard-09.braze.com)', value: 'sdk.iad-09.braze.com' },
{ label: 'EU-01 (https://dashboard-01.braze.eu)', value: 'sdk.fra-01.braze.eu' },
{ label: 'EU-02 (https://dashboard-02.braze.eu)', value: 'sdk.fra-02.braze.eu' },
{ label: 'AU-01 (https://dashboard.au-01.braze.com)', value: 'sdk.au-01.braze.com' }
{ label: 'AU-01 (https://dashboard.au-01.braze.com)', value: 'sdk.au-01.braze.com' },
{ label: 'ID-01 (https://dashboard-01.braze.id)', value: 'sdk.apse-01.braze.id' }
],
default: 'sdk.iad-01.braze.com',
required: true
Expand All @@ -137,7 +142,7 @@ export const destination: BrowserDestinationDefinition<Settings, BrazeDestinatio
},
allowUserSuppliedJavascript: {
description:
'To indicate that you trust the Braze dashboard users to write non-malicious Javascript click actions, set this property to true. If enableHtmlInAppMessages is true, this option will also be set to true. [See more details](https://js.appboycdn.com/web-sdk/latest/doc/modules/appboy.html#initializationoptions)',
'To indicate that you trust the Braze dashboard users to write non-malicious Javascript click actions, set this property to true. [See more details](https://js.appboycdn.com/web-sdk/latest/doc/modules/appboy.html#initializationoptions)',
label: 'Allow User Supplied Javascript',
default: false,
type: 'boolean',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ const destination: DestinationDefinition<Settings> = {
{ label: 'US-09 (https://dashboard-09.braze.com)', value: 'https://rest.iad-09.braze.com' },
{ label: 'EU-01 (https://dashboard-01.braze.eu)', value: 'https://rest.fra-01.braze.eu' },
{ label: 'EU-02 (https://dashboard-02.braze.eu)', value: 'https://rest.fra-02.braze.eu' },
{ label: 'AU-01 (https://dashboard.au-01.braze.com)', value: 'https://rest.au-01.braze.com' }
{ label: 'AU-01 (https://dashboard.au-01.braze.com)', value: 'https://rest.au-01.braze.com' },
{ label: 'ID-01 (https://dashboard-01.braze.id)', value: 'https://rest.apse-01.braze.id' }
],
default: 'https://rest.iad-01.braze.com',
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Object {
},
"date_of_first_session": "2021-02-01T00:00:00.000Z",
"date_of_last_session": "2021-02-01T00:00:00.000Z",
"dob": "2021-02-01",
"dob": "2021-01-31",
"email": "[email protected]",
"email_click_tracking_disabled": false,
"email_open_tracking_disabled": false,
Expand Down
41 changes: 8 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1600,10 +1600,10 @@
resolved "https://registry.yarnpkg.com/@braze/web-sdk/-/web-sdk-3.5.1.tgz#04cd8e7021e13a690cd9c2ad7e7a3b5028d06178"
integrity sha512-Quvqs2RqTZK7+VUCwsGMT9EHYwiXUYwWJk441ly2F0yj64WK2GPvXy3XdIpXLCgWVhGg42WNJ4X6WBgfaF+3EQ==

"@braze/web-sdk@npm:@braze/web-sdk@^4.1.0":
version "4.7.0"
resolved "https://registry.yarnpkg.com/@braze/web-sdk/-/web-sdk-4.7.0.tgz#5adb930690d78dd3bc77a93dececde360a08d0f7"
integrity sha512-fYdCyjlZqBswlebO8XmbPj04soLycHxnSvCQ/bWpi4OB00fz/ne34vv1LzIP3d0V5++jwjsutxdEi5mRiiMK1Q==
"@braze/web-sdk@npm:@braze/web-sdk@^5":
version "5.7.0"
resolved "https://registry.yarnpkg.com/@braze/web-sdk/-/web-sdk-5.7.0.tgz#f2166922da112cc359e5259753964e3e2f9ae5a9"
integrity sha512-JG7WC00GevlyOLVaA7K8PBPE5WsaCaPhSnbitDZ0JySRgFM7tY19X6V8cynoTeBbIHBwD6CcHOCGNHQeLk2PCA==

"@bucketco/tracking-sdk@^2.0.0":
version "2.1.6"
Expand Down Expand Up @@ -15529,16 +15529,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -15596,7 +15587,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -15624,13 +15615,6 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"

strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -17081,7 +17065,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -17108,15 +17092,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down Expand Up @@ -17359,4 +17334,4 @@ zip-stream@^4.1.0:
dependencies:
archiver-utils "^2.1.0"
compress-commons "^4.1.0"
readable-stream "^3.6.0"
readable-stream "^3.6.0"