feat(MSDK-4514): Propagate isExempt to the ServiceConsent bridge model - #234
feat(MSDK-4514): Propagate isExempt to the ServiceConsent bridge model#234islameldesoky95 wants to merge 1 commit into
Conversation
Threads the isExempt field (added to the native UsercentricsServiceConsent in MSDK-4513) through the TS model, iOS Swift and Android Kotlin serialization extensions, and their mock/test fixtures. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
PR Summary: Propagate isExempt on ServiceConsent objects across native-to-JS bridge so the RN layer receives the new boolean field. Changes:
|
| @@ -20,6 +21,7 @@ export class UsercentricsServiceConsent { | |||
| this.isEssential = isEssential | |||
| this.history = history | |||
| this.category = category; | |||
| this.isExempt = isExempt; | |||
There was a problem hiding this comment.
[CRITICAL_BUG] You made isExempt a required constructor parameter and a required class property. This is a breaking change for any existing callers that instantiate UsercentricsServiceConsent without the new argument. Make the new parameter optional with a sensible default (e.g. isExempt: boolean = false) or provide an overloaded/secondary constructor to preserve backward compatibility. Also update any factory/mapper code that constructs this class to pass the new value (or rely on the default).
export class UsercentricsServiceConsent {
templateId: string
status: boolean
dataProcessor: string
version: string
type: UsercentricsConsentType
isEssential: boolean
history: UsercentricsConsentHistoryEntry[]
category: string
isExempt: boolean
constructor(
templateId: string,
status: boolean,
dataProcessor: string,
version: string,
type: UsercentricsConsentType,
isEssential: boolean,
history: UsercentricsConsentHistoryEntry[],
category: string,
isExempt: boolean = false,
) {
this.templateId = templateId
this.status = status
this.dataProcessor = dataProcessor
this.version = version
this.type = type
this.isEssential = isEssential
this.history = history
this.category = category
this.isExempt = isExempt
}
}| @@ -202,7 +203,8 @@ describe('Test Usercentrics Module', () => { | |||
| timestampInMillis: 123.0, | |||
| type: 0 | |||
| }], | |||
| category: "essemtial" | |||
| category: "essemtial", | |||
| isExempt: false, | |||
| } | |||
| ] | |||
| ) | |||
| @@ -270,7 +272,8 @@ describe('Test Usercentrics Module', () => { | |||
| timestampInMillis: 123.0, | |||
| type: 0 | |||
| }], | |||
| category: "essemtial" | |||
| category: "essemtial", | |||
| isExempt: false, | |||
| } | |||
| ], | |||
| { | |||
| @@ -579,7 +582,8 @@ describe('Test Usercentrics Module', () => { | |||
| timestampInMillis: 123.0, | |||
| type: 0 | |||
There was a problem hiding this comment.
[REFACTORING] Multiple tests were updated to include the new isExempt field in literal consent objects. To reduce duplication and the risk of missing future fields, introduce a small test helper/factory (e.g. makeConsentMock(overrides?)) that returns a consent object with sensible defaults (including isExempt: false). Replace inline literals with calls to that helper so future schema changes require modifications in a single place.
// src/__tests__/index.test.ts
type ConsentLiteral = {
templateId: string
status: boolean
dataProcessor: string
version: string
type: number
isEssential: boolean
history: Array<{
status: boolean
timestampInMillis: number
type: number
}>
category: string
isExempt: boolean
}
const makeConsentMock = (overrides: Partial<ConsentLiteral> = {}): ConsentLiteral => ({
templateId: "123",
status: false,
dataProcessor: "facebook",
version: "123",
type: 0,
isEssential: false,
history: [
{
status: false,
timestampInMillis: 123.0,
type: 0,
},
],
category: "essemtial",
isExempt: false,
...overrides,
})
// Usage example inside tests:
const readyStatus = new UsercentricsReadyStatus(
true,
[makeConsentMock()],
{
countryCode: "PT",
regionCode: "PT11",
isInEU: true,
isInUS: false,
isInCalifornia: false,
},
{
activeSettingsId: "",
bannerRequiredAtLocation: false,
},
)|
Reviewed up to commit:fd35f3cc94b4494978a3ec262ec485b46b4b2d04 |
Threads the isExempt field (added to the native UsercentricsServiceConsent in MSDK-4513) through the TS model, iOS Swift and Android Kotlin serialization extensions, and their mock/test fixtures.