@@ -3,42 +3,20 @@ import { TurboModuleRegistry } from 'react-native';
33
44// NOTE: No types can be imported because of the way new arch works, so we have
55// to re-define the types here.
6- interface EmbeddedMessage {
7- metadata : {
8- messageId : string ;
9- placementId : number ;
10- campaignId ?: number | null ;
11- isProof ?: boolean ;
12- } ;
13- elements : {
14- buttons ?:
15- | {
16- id : string ;
17- title ?: string | null ;
18- action : { type : string ; data ?: string } | null ;
19- } [ ]
20- | null ;
21- body ?: string | null ;
22- mediaUrl ?: string | null ;
23- mediaUrlCaption ?: string | null ;
24- defaultAction ?: { type : string ; data ?: string } | null ;
25- text ?: { id : string ; text ?: string | null ; label ?: string | null } [ ] | null ;
26- title ?: string | null ;
27- } | null ;
28- payload ?: { [ key : string ] : string | number | boolean | null } | null ;
29- }
30-
6+ // Codegen (RN 0.84+) rejects unions that include array types (e.g. `T[] | U`,
7+ // `string | string[]`). Use `Object` / `unknown` where the bridge carries
8+ // richer JSON than the parser allows.
319export interface Spec extends TurboModule {
3210 // Initialization
3311 initializeWithApiKey (
3412 apiKey : string ,
35- config : { [ key : string ] : string | number | boolean | undefined | string [ ] } ,
13+ config : object ,
3614 version : string
3715 ) : Promise < boolean > ;
3816
3917 initialize2WithApiKey (
4018 apiKey : string ,
41- config : { [ key : string ] : string | number | boolean | undefined | string [ ] } ,
19+ config : object ,
4220 version : string ,
4321 apiEndPointOverride : string
4422 ) : Promise < boolean > ;
@@ -122,12 +100,13 @@ export interface Spec extends TurboModule {
122100 // App links
123101 handleAppLink ( appLink : string ) : Promise < boolean > ;
124102
125- // Subscriptions
103+ // Subscriptions (arrays only in spec — RN codegen rejects `T[] | null`; callers
104+ // may still pass null at the bridge when using typed assertions.)
126105 updateSubscriptions (
127- emailListIds : number [ ] | null ,
128- unsubscribedChannelIds : number [ ] | null ,
129- unsubscribedMessageTypeIds : number [ ] | null ,
130- subscribedMessageTypeIds : number [ ] | null ,
106+ emailListIds : number [ ] ,
107+ unsubscribedChannelIds : number [ ] ,
108+ unsubscribedMessageTypeIds : number [ ] ,
109+ subscribedMessageTypeIds : number [ ] ,
131110 campaignId : number ,
132111 templateId : number
133112 ) : void ;
@@ -151,11 +130,9 @@ export interface Spec extends TurboModule {
151130 endEmbeddedSession ( ) : void ;
152131 startEmbeddedImpression ( messageId : string , placementId : number ) : void ;
153132 pauseEmbeddedImpression ( messageId : string ) : void ;
154- getEmbeddedMessages (
155- placementIds : number [ ] | null
156- ) : Promise < EmbeddedMessage [ ] > ;
133+ getEmbeddedMessages ( placementIds : number [ ] ) : Promise < object [ ] > ;
157134 trackEmbeddedClick (
158- message : EmbeddedMessage ,
135+ message : object ,
159136 buttonId : string | null ,
160137 clickedUrl : string | null
161138 ) : void ;
0 commit comments