Skip to content
Merged
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 @@ -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
Expand Down Expand Up @@ -246,9 +247,17 @@ private fun TCF2Settings.serialize(): WritableMap {
"changedPurposes" to changedPurposes?.serialize(),
"acmV2Enabled" to acmV2Enabled,
"selectedATPIds" to selectedATPIds,
"consentOrPay" to consentOrPay?.serialize(),
Comment thread
uc-brunosilva marked this conversation as resolved.
).toWritableMap()
}

private fun ConsentOrPaySettings.serialize(): Map<String, Any?> = mapOf(
"enableConsentOrPay" to enableConsentOrPay,
"showTogglesForVendors" to showTogglesForVendors,
"publisherRestrictions" to publisherRestrictions,
"specialFeatures" to specialFeatures
Comment thread
uc-brunosilva marked this conversation as resolved.
)
Comment thread
uc-brunosilva marked this conversation as resolved.

private fun TCF2Settings.getResurfacePeriodCompat(): Int {
val intValue = runCatching {
javaClass.getMethod("getResurfacePeriod").invoke(this) as? Int
Expand Down
11 changes: 11 additions & 0 deletions ios/Extensions/UsercentricsCMPData+Dict.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,21 @@ extension TCF2Settings {
"acmV2Enabled": self.acmV2Enabled,
"selectedATPIds": self.selectedATPIds,
"resurfacePeriod": self.resurfacePeriod,
"consentOrPay": self.consentOrPay?.toDictionary() as Any,
Comment thread
uc-brunosilva marked this conversation as resolved.
]
}
}

extension ConsentOrPaySettings {
func toDictionary() -> [String: Any] {
return [
"enableConsentOrPay": self.enableConsentOrPay,
"showTogglesForVendors": self.showTogglesForVendors,
"publisherRestrictions": self.publisherRestrictions,
"specialFeatures": self.specialFeatures
Comment thread
uc-brunosilva marked this conversation as resolved.
]
}
}
Comment thread
uc-brunosilva marked this conversation as resolved.

extension UsercentricsCustomization {
func toDictionary() -> NSDictionary {
Expand Down
25 changes: 25 additions & 0 deletions src/models/TCF2Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class TCF2Settings {
changedPurposes: TCF2ChangedPurposes
acmV2Enabled: boolean
selectedATPIds: number[]
consentOrPay?: TCF2ConsentOrPaySettings

constructor(
firstLayerTitle: string,
Expand Down Expand Up @@ -119,6 +120,7 @@ export class TCF2Settings {
firstLayerHideButtonDeny?: boolean,
firstLayerMobileVariant?: FirstLayerMobileVariant,
dataSharedOutsideEUText?: string,
consentOrPay?: TCF2ConsentOrPaySettings,
) {
this.firstLayerTitle = firstLayerTitle
this.secondLayerTitle = secondLayerTitle
Expand Down Expand Up @@ -179,6 +181,7 @@ export class TCF2Settings {
this.changedPurposes = changedPurposes
this.acmV2Enabled = acmV2Enabled
this.selectedATPIds = selectedATPIds
this.consentOrPay = consentOrPay
}
}

Expand Down Expand Up @@ -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<string, string>
/** Maps Special Feature ID (as string) to "flexible". Absent entries are mandatory. */
specialFeatures: Record<string, string>

constructor(
enableConsentOrPay: boolean,
showTogglesForVendors: boolean,
publisherRestrictions: Record<string, string>,
specialFeatures: Record<string, string>,
) {
this.enableConsentOrPay = enableConsentOrPay
this.showTogglesForVendors = showTogglesForVendors
this.publisherRestrictions = publisherRestrictions
this.specialFeatures = specialFeatures
}
}
Loading