Skip to content

feat(MSDK-4514): Propagate isExempt to the ServiceConsent bridge model - #234

Draft
islameldesoky95 wants to merge 1 commit into
masterfrom
feat/MSDK-4514-propagate-statistical-exception
Draft

feat(MSDK-4514): Propagate isExempt to the ServiceConsent bridge model#234
islameldesoky95 wants to merge 1 commit into
masterfrom
feat/MSDK-4514-propagate-statistical-exception

Conversation

@islameldesoky95

Copy link
Copy Markdown
Collaborator

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.

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>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 603912b6-7ba2-4e14-bd0d-0ea9c2c27570

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pantoaibot

pantoaibot Bot commented Jul 30, 2026

Copy link
Copy Markdown

PR Summary:

Propagate isExempt on ServiceConsent objects across native-to-JS bridge so the RN layer receives the new boolean field.

Changes:

  • JS model: added isExempt:boolean to UsercentricsServiceConsent and extended constructor to accept isExempt.
  • Android:
    • Include "isExempt" in UsercentricsServiceConsent.toWritableMap().
    • Updated android test mocks/expected maps to include isExempt (false).
  • iOS:
    • Include "isExempt" in UsercentricsServiceConsent.toDictionary().
    • Updated sample tests and mocks to set isExempt (false).
  • Tests: updated unit tests/mocks across src/tests, androidTest and sample iOS tests to include isExempt where service consents are created/serialized.
  • Breaking change: UsercentricsServiceConsent constructor signature in the JS model now requires the additional isExempt argument — update any instantiations accordingly.
  • No dependency, performance, or behavioral changes beyond exposing the new field.

Reviewed by Panto AI

Comment on lines 13 to +24
@@ -20,6 +21,7 @@ export class UsercentricsServiceConsent {
this.isEssential = isEssential
this.history = history
this.category = category;
this.isExempt = isExempt;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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
    }
}

Comment on lines 152 to 583
@@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@pantoaibot

pantoaibot Bot commented Jul 30, 2026

Copy link
Copy Markdown

Reviewed up to commit:fd35f3cc94b4494978a3ec262ec485b46b4b2d04

Reviewed by Panto AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant