Skip to content
Draft
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 @@ -130,6 +130,59 @@ class DdFlagsImplementation(
promise.resolve(null)
}

@Suppress("LongParameterList")
fun trackExposure(
clientName: String,
key: String,
rawFlag: ReadableMap,
targetingKey: String,
attributes: ReadableMap,
promise: Promise,
) {
_FlagsInternalProxy(getClient(clientName)).trackFlagExposure(
key,
convertMapToUnparsedFlag(rawFlag.toMap()),
buildEvaluationContext(targetingKey, attributes),
)
promise.resolve(null)
}

@Suppress("LongParameterList")
fun trackEvaluationEvent(
clientName: String,
key: String,
rawFlag: ReadableMap?,
targetingKey: String,
attributes: ReadableMap,
errorCode: String?,
promise: Promise,
) {
_FlagsInternalProxy(getClient(clientName)).trackFlagEvaluationEvent(
key,
rawFlag?.let { convertMapToUnparsedFlag(it.toMap()) },
buildEvaluationContext(targetingKey, attributes),
errorCode,
)
promise.resolve(null)
}

@Suppress("LongParameterList")
fun trackRumEvaluation(
clientName: String,
key: String,
variant: String,
targetingKey: String,
attributes: ReadableMap,
promise: Promise,
) {
_FlagsInternalProxy(getClient(clientName)).trackFlagRumEvaluation(
key,
variant,
buildEvaluationContext(targetingKey, attributes),
)
promise.resolve(null)
}

internal companion object {
internal const val NAME = "DdFlags"
}
Expand Down Expand Up @@ -166,6 +219,9 @@ private fun buildFlagsConfiguration(configuration: Map<String, Any?>): FlagsConf
(configuration["customExposureEndpoint"] as? String)?.let {
useCustomExposureEndpoint("$it/api/v2/exposures")
}
(configuration["customEvaluationEndpoint"] as? String)?.let {
useCustomEvaluationEndpoint("$it/api/v2/flagevaluation")
}
}.build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,49 @@ class DdFlags(
) {
implementation.trackEvaluation(clientName, key, rawFlag, targetingKey, attributes, promise)
}

@ReactMethod
override fun trackRumEvaluation(
clientName: String,
key: String,
variant: String,
targetingKey: String,
attributes: ReadableMap,
promise: Promise,
) {
implementation.trackRumEvaluation(clientName, key, variant, targetingKey, attributes, promise)
}

@ReactMethod
override fun trackExposure(
clientName: String,
key: String,
rawFlag: ReadableMap,
targetingKey: String,
attributes: ReadableMap,
promise: Promise,
) {
implementation.trackExposure(clientName, key, rawFlag, targetingKey, attributes, promise)
}

@ReactMethod
override fun trackEvaluationEvent(
clientName: String,
key: String,
rawFlag: ReadableMap?,
targetingKey: String,
attributes: ReadableMap,
errorCode: String?,
promise: Promise,
) {
implementation.trackEvaluationEvent(
clientName,
key,
rawFlag,
targetingKey,
attributes,
errorCode,
promise,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,56 @@ class DdFlags(reactContext: ReactApplicationContext) : ReactContextBaseJavaModul
) {
implementation.trackEvaluation(clientName, key, rawFlag, targetingKey, attributes, promise)
}

@ReactMethod
fun trackRumEvaluation(
clientName: String,
key: String,
variant: String,
targetingKey: String,
attributes: ReadableMap,
promise: Promise
) {
implementation.trackRumEvaluation(
clientName,
key,
variant,
targetingKey,
attributes,
promise
)
}

@ReactMethod
fun trackExposure(
clientName: String,
key: String,
rawFlag: ReadableMap,
targetingKey: String,
attributes: ReadableMap,
promise: Promise
) {
implementation.trackExposure(clientName, key, rawFlag, targetingKey, attributes, promise)
}

@ReactMethod
fun trackEvaluationEvent(
clientName: String,
key: String,
rawFlag: ReadableMap?,
targetingKey: String,
attributes: ReadableMap,
errorCode: String?,
promise: Promise
) {
implementation.trackEvaluationEvent(
clientName,
key,
rawFlag,
targetingKey,
attributes,
errorCode,
promise
)
}
}
Loading
Loading