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.ConsentOrPayRestriction
import com.usercentrics.sdk.v2.settings.data.ConsentOrPaySettings
import com.usercentrics.sdk.v2.settings.data.TCF2ChangedPurposes
import com.usercentrics.sdk.v2.settings.data.TCF2Settings
Expand Down Expand Up @@ -249,6 +250,7 @@ private fun TCF2Settings.serialize(): WritableMap {
"selectedATPIds" to selectedATPIds,
"consentOrPay" to consentOrPay?.serialize(),
"mandatoryLabel" to mandatoryLabel,
"specialFeaturesConsentOrPay" to specialFeaturesConsentOrPay?.map { it.serialize() },
).toWritableMap()
}

Expand Down Expand Up @@ -447,10 +449,16 @@ private fun TCF2ChangedPurposes?.serialize(): Any? {
}
return mapOf(
"purposes" to purposes,
"legIntPurposes" to legIntPurposes
"legIntPurposes" to legIntPurposes,
"consentOrPay" to consentOrPay?.map { it.serialize() },
)
}

private fun ConsentOrPayRestriction.serialize(): Map<String, Any?> = mapOf(
"id" to id,
"value" to value,
)
Comment thread
uc-brunosilva marked this conversation as resolved.

internal fun AdditionalConsentModeData.serialize(): WritableMap {
return Arguments.createMap().apply {
putString("acString", acString)
Expand Down
13 changes: 12 additions & 1 deletion ios/Extensions/UsercentricsCMPData+Dict.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ extension TCF2Settings {
"resurfacePeriod": self.resurfacePeriod,
"consentOrPay": self.consentOrPay?.toDictionary() as Any,
"mandatoryLabel": self.mandatoryLabel,
"specialFeaturesConsentOrPay": self.specialFeaturesConsentOrPay?.map { $0.toDictionary() } as Any,
Comment thread
uc-brunosilva marked this conversation as resolved.
]
}
}
Expand Down Expand Up @@ -497,7 +498,17 @@ extension TCF2ChangedPurposes {
func toDictionary() -> Any {
return [
"purposes": purposes,
"legIntPurposes": legIntPurposes
"legIntPurposes": legIntPurposes,
"consentOrPay": consentOrPay?.map { $0.toDictionary() } as Any,
]
}
}

extension ConsentOrPayRestriction {
func toDictionary() -> [String: Any] {
return [
"id": self.id,
"value": self.value,
]
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/models/TCF2Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class TCF2Settings {
selectedATPIds: number[]
consentOrPay?: TCF2ConsentOrPaySettings
mandatoryLabel: string
specialFeaturesConsentOrPay?: ConsentOrPayRestriction[]
Comment thread
uc-brunosilva marked this conversation as resolved.

constructor(
firstLayerTitle: string,
Expand Down Expand Up @@ -123,6 +124,7 @@ export class TCF2Settings {
dataSharedOutsideEUText?: string,
consentOrPay?: TCF2ConsentOrPaySettings,
mandatoryLabel: string = 'Mandatory',
specialFeaturesConsentOrPay?: ConsentOrPayRestriction[],
) {
this.firstLayerTitle = firstLayerTitle
this.secondLayerTitle = secondLayerTitle
Expand Down Expand Up @@ -185,6 +187,7 @@ export class TCF2Settings {
this.selectedATPIds = selectedATPIds
this.consentOrPay = consentOrPay
this.mandatoryLabel = mandatoryLabel
this.specialFeaturesConsentOrPay = specialFeaturesConsentOrPay
}
}

Expand All @@ -204,13 +207,30 @@ export class TCF2ChangedPurposes {

purposes: [number]
legIntPurposes: [number]
consentOrPay?: ConsentOrPayRestriction[]

constructor(
purposes: [number],
legIntPurposes: [number],
consentOrPay?: ConsentOrPayRestriction[],
) {
this.purposes = purposes
this.legIntPurposes = legIntPurposes
this.consentOrPay = consentOrPay
}
}

export class ConsentOrPayRestriction {
id: number
value: string

constructor(id: number, value: string) {
this.id = id
this.value = value
}

isFlexible(): boolean {
return this.value?.toUpperCase() === 'FLEXIBLE'
}
}

Expand Down
Loading