@@ -6,6 +6,7 @@ import type {
66 SPAction ,
77 SPBuildOptions ,
88 GDPRConsent ,
9+ SPError
910} from './NativeReactNativeCmp' ;
1011import ReactNativeCmp , { SPMessageLanguage } from './NativeReactNativeCmp' ;
1112import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypes' ;
@@ -18,6 +19,32 @@ const defaultBuildOptions: SPBuildOptions = {
1819}
1920
2021export default class SPConsentManager implements Spec {
22+ /** intended to be used by the SDK only */
23+ internalOnAction : EventEmitter < string > = ReactNativeCmp . internalOnAction ;
24+ /** intended to be used by the SDK only */
25+ internalOnError : EventEmitter < string > = ReactNativeCmp . internalOnError ;
26+
27+ onSPUIReady : EventEmitter < void > = ReactNativeCmp . onSPUIReady ;
28+ onSPUIFinished : EventEmitter < void > = ReactNativeCmp . onSPUIFinished ;
29+ onFinished : EventEmitter < void > = ReactNativeCmp . onFinished ;
30+ onMessageInactivityTimeout : EventEmitter < void > = ReactNativeCmp . onMessageInactivityTimeout ;
31+
32+ onAction ( handler : ( action : SPAction ) => void ) {
33+ ReactNativeCmp . internalOnAction ( ( stringifiedAction ) => {
34+ handler ( JSON . parse ( stringifiedAction ) as SPAction ) ;
35+ } ) ;
36+ }
37+
38+ onError ( handler : ( error : SPError ) => void ) {
39+ ReactNativeCmp . internalOnError ( ( stringifiedError ) => {
40+ handler ( JSON . parse ( stringifiedError ) as SPError ) ;
41+ } ) ;
42+ }
43+
44+ getConstants ?( ) : { } {
45+ throw new Error ( 'Method not implemented.' ) ;
46+ }
47+
2148 build (
2249 accountId : number ,
2350 propertyId : number ,
@@ -74,14 +101,7 @@ export default class SPConsentManager implements Spec {
74101 categories : string [ ] ,
75102 legIntCategories : string [ ] ,
76103 callback : ( consent : GDPRConsent ) => void
77- ) {
78- ReactNativeCmp . postDeleteCustomConsentGDPR ( vendors , categories , legIntCategories , callback ) ;
104+ ) {
105+ ReactNativeCmp . postDeleteCustomConsentGDPR ( vendors , categories , legIntCategories , callback ) ;
79106 }
80-
81- onAction : EventEmitter < SPAction > = ReactNativeCmp . onAction ;
82- onSPUIReady : EventEmitter < void > = ReactNativeCmp . onSPUIReady ;
83- onSPUIFinished : EventEmitter < void > = ReactNativeCmp . onSPUIFinished ;
84- onFinished : EventEmitter < void > = ReactNativeCmp . onFinished ;
85- onMessageInactivityTimeout : EventEmitter < void > = ReactNativeCmp . onMessageInactivityTimeout ;
86- onError : EventEmitter < { description : string } > = ReactNativeCmp . onError ;
87107}
0 commit comments