Skip to content

Commit f6885ee

Browse files
Merge pull request #10 from slawomirzaba/FEAT-add-customActionId-to-onAction-payload
Add customActionId to onAction payload
2 parents fc64cbf + 67f722e commit f6885ee

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

android/src/main/java/com/sourcepoint/reactnativecmp/RNSourcepointCmpModule.kt

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class RNSourcepointCmpModule internal constructor(context: ReactApplicationConte
119119
override fun onAction(view: View, consentAction: ConsentAction): ConsentAction {
120120
sendEvent(SDKEvent.onAction, createMap().apply {
121121
putString("actionType", RNSourcepointActionType.from(consentAction.actionType).name)
122+
putString("customActionId", consentAction.customActionId ?: "")
122123
})
123124
return consentAction
124125
}

ios/RNSourcepointCmp.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ extension RNSourcepointCmp: SPDelegate {
6969
func onAction(_ action: SPAction, from controller: UIViewController) {
7070
RNSourcepointCmp.shared?.sendEvent(
7171
withName: "onAction",
72-
body: ["actionType": RNSourcepointActionType(from: action.type).rawValue]
72+
body: [
73+
"actionType": RNSourcepointActionType(from: action.type).rawValue,
74+
"customActionId": action.customActionId ?? "",
75+
]
7376
)
7477
}
7578

src/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ export class SPConsentManager implements Spec {
6767
RNSourcepointCmp.loadUSNatPrivacyManager(pmId);
6868
}
6969

70-
onAction(callback: (body: { actionType: SPActionType }) => void): void {
70+
onAction(
71+
callback: (body: {
72+
actionType: SPActionType;
73+
customActionId: string;
74+
}) => void
75+
): void {
7176
this.emitter.removeAllListeners('onAction');
7277
this.emitter.addListener('onAction', callback);
7378
}

0 commit comments

Comments
 (0)