diff --git a/android/src/main/java/com/usercentrics/reactnative/extensions/UsercentricsCMPDataExtensions.kt b/android/src/main/java/com/usercentrics/reactnative/extensions/UsercentricsCMPDataExtensions.kt index bc6f6bc..3746128 100644 --- a/android/src/main/java/com/usercentrics/reactnative/extensions/UsercentricsCMPDataExtensions.kt +++ b/android/src/main/java/com/usercentrics/reactnative/extensions/UsercentricsCMPDataExtensions.kt @@ -12,6 +12,7 @@ import com.usercentrics.sdk.v2.settings.data.CustomizationFont import com.usercentrics.sdk.v2.settings.data.FirstLayer import com.usercentrics.sdk.v2.settings.data.PublishedApp import com.usercentrics.sdk.v2.settings.data.SecondLayer +import com.usercentrics.sdk.v2.settings.data.ConsentOrPaySettings import com.usercentrics.sdk.v2.settings.data.TCF2ChangedPurposes import com.usercentrics.sdk.v2.settings.data.TCF2Settings import com.usercentrics.sdk.v2.settings.data.UsercentricsCategory @@ -246,9 +247,17 @@ private fun TCF2Settings.serialize(): WritableMap { "changedPurposes" to changedPurposes?.serialize(), "acmV2Enabled" to acmV2Enabled, "selectedATPIds" to selectedATPIds, + "consentOrPay" to consentOrPay?.serialize(), ).toWritableMap() } +private fun ConsentOrPaySettings.serialize(): Map = mapOf( + "enableConsentOrPay" to enableConsentOrPay, + "showTogglesForVendors" to showTogglesForVendors, + "publisherRestrictions" to publisherRestrictions, + "specialFeatures" to specialFeatures +) + private fun TCF2Settings.getResurfacePeriodCompat(): Int { val intValue = runCatching { javaClass.getMethod("getResurfacePeriod").invoke(this) as? Int diff --git a/ios/Extensions/UsercentricsCMPData+Dict.swift b/ios/Extensions/UsercentricsCMPData+Dict.swift index 9e609b3..0fdd6ae 100644 --- a/ios/Extensions/UsercentricsCMPData+Dict.swift +++ b/ios/Extensions/UsercentricsCMPData+Dict.swift @@ -236,10 +236,21 @@ extension TCF2Settings { "acmV2Enabled": self.acmV2Enabled, "selectedATPIds": self.selectedATPIds, "resurfacePeriod": self.resurfacePeriod, + "consentOrPay": self.consentOrPay?.toDictionary() as Any, ] } } +extension ConsentOrPaySettings { + func toDictionary() -> [String: Any] { + return [ + "enableConsentOrPay": self.enableConsentOrPay, + "showTogglesForVendors": self.showTogglesForVendors, + "publisherRestrictions": self.publisherRestrictions, + "specialFeatures": self.specialFeatures + ] + } +} extension UsercentricsCustomization { func toDictionary() -> NSDictionary { diff --git a/src/models/TCF2Settings.tsx b/src/models/TCF2Settings.tsx index 3599bcf..c1461af 100644 --- a/src/models/TCF2Settings.tsx +++ b/src/models/TCF2Settings.tsx @@ -58,6 +58,7 @@ export class TCF2Settings { changedPurposes: TCF2ChangedPurposes acmV2Enabled: boolean selectedATPIds: number[] + consentOrPay?: TCF2ConsentOrPaySettings constructor( firstLayerTitle: string, @@ -119,6 +120,7 @@ export class TCF2Settings { firstLayerHideButtonDeny?: boolean, firstLayerMobileVariant?: FirstLayerMobileVariant, dataSharedOutsideEUText?: string, + consentOrPay?: TCF2ConsentOrPaySettings, ) { this.firstLayerTitle = firstLayerTitle this.secondLayerTitle = secondLayerTitle @@ -179,6 +181,7 @@ export class TCF2Settings { this.changedPurposes = changedPurposes this.acmV2Enabled = acmV2Enabled this.selectedATPIds = selectedATPIds + this.consentOrPay = consentOrPay } } @@ -207,3 +210,25 @@ export class TCF2ChangedPurposes { this.legIntPurposes = legIntPurposes } } + +export class TCF2ConsentOrPaySettings { + + enableConsentOrPay: boolean + showTogglesForVendors: boolean + /** Maps TCF Purpose ID (as string) to "flexible". Absent entries are mandatory. */ + publisherRestrictions: Record + /** Maps Special Feature ID (as string) to "flexible". Absent entries are mandatory. */ + specialFeatures: Record + + constructor( + enableConsentOrPay: boolean, + showTogglesForVendors: boolean, + publisherRestrictions: Record, + specialFeatures: Record, + ) { + this.enableConsentOrPay = enableConsentOrPay + this.showTogglesForVendors = showTogglesForVendors + this.publisherRestrictions = publisherRestrictions + this.specialFeatures = specialFeatures + } +}