@booleanmaths/booleanmaths-rn-sdk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -35
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/booleanmathsrnsdk/BooleanmathsRnSdkModule.kt +11 -1
- package/ios/BooleanmathsRnSdk.mm +7 -1
- package/lib/module/BooleanMaths.js +3 -0
- package/lib/module/BooleanMaths.js.map +1 -1
- package/lib/module/BooleanMaths.native.js +16 -7
- package/lib/module/BooleanMaths.native.js.map +1 -1
- package/lib/module/NativeBooleanmathsRnSdk.js.map +1 -1
- package/lib/typescript/src/BooleanMaths.d.ts.map +1 -1
- package/lib/typescript/src/BooleanMaths.native.d.ts.map +1 -1
- package/lib/typescript/src/NativeBooleanmathsRnSdk.d.ts +5 -0
- package/lib/typescript/src/NativeBooleanmathsRnSdk.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +17 -5
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BooleanMaths.native.tsx +17 -7
- package/src/BooleanMaths.tsx +4 -0
- package/src/NativeBooleanmathsRnSdk.ts +5 -0
- package/src/types.ts +18 -5
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Android SDK.
|
|
|
17
17
|
|
|
18
18
|
| Platform | Native SDK | Behaviour |
|
|
19
19
|
| :------- | :--------- | :-------- |
|
|
20
|
-
| Android | ✅ `com.booleanmaths:bm-sdk:1.0.
|
|
20
|
+
| Android | ✅ `com.booleanmaths:bm-sdk:1.0.9` | Fully functional |
|
|
21
21
|
| iOS | ❌ not published | Silent no-op, **never crashes** |
|
|
22
22
|
| Web | ❌ not published | Silent no-op, **never crashes** |
|
|
23
23
|
|
|
@@ -98,7 +98,7 @@ To pin a different native SDK version, set this in your app's **root**
|
|
|
98
98
|
```gradle
|
|
99
99
|
buildscript {
|
|
100
100
|
ext {
|
|
101
|
-
BooleanmathsRnSdk_bmSdkVersion = "1.0.
|
|
101
|
+
BooleanmathsRnSdk_bmSdkVersion = "1.0.9"
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
```
|
|
@@ -155,11 +155,21 @@ forwards the launch intent (see [Deep links](#deep-links-and-notification-attrib
|
|
|
155
155
|
Records a custom event. `properties` defaults to `{}` and may contain strings,
|
|
156
156
|
numbers, booleans, nested objects, and arrays.
|
|
157
157
|
|
|
158
|
-
### `BooleanMaths.
|
|
158
|
+
### `BooleanMaths.handleIntent(): void`
|
|
159
159
|
|
|
160
160
|
**Android only** (no-op elsewhere). Forwards the current Activity's intent to
|
|
161
|
-
the native SDK so deep
|
|
162
|
-
to call repeatedly — the native SDK de-duplicates intents
|
|
161
|
+
the native SDK so ad deep links, app links and push-notification campaign data
|
|
162
|
+
are attributed. Safe to call repeatedly — the native SDK de-duplicates intents
|
|
163
|
+
it has already seen.
|
|
164
|
+
|
|
165
|
+
This is the single entry point for every kind of launch intent; native SDK
|
|
166
|
+
1.0.9 unified them behind one method.
|
|
167
|
+
|
|
168
|
+
### `BooleanMaths.handleNotificationIntent(): void`
|
|
169
|
+
|
|
170
|
+
Deprecated alias of `handleIntent()`, kept so existing callers keep working.
|
|
171
|
+
It calls straight through to the same native `handleIntent`, so there is no
|
|
172
|
+
behavioural difference — prefer `handleIntent()` in new code.
|
|
163
173
|
|
|
164
174
|
### `BooleanMaths.getHelloMessage(): string | null`
|
|
165
175
|
|
|
@@ -181,7 +191,7 @@ app is never seen by those callbacks.**
|
|
|
181
191
|
|
|
182
192
|
This wrapper works around it by forwarding `currentActivity.intent` at the end
|
|
183
193
|
of `initialize()`. For links that arrive while the app is already running, call
|
|
184
|
-
`
|
|
194
|
+
`handleIntent()` yourself:
|
|
185
195
|
|
|
186
196
|
```ts
|
|
187
197
|
useEffect(() => {
|
|
@@ -189,13 +199,13 @@ useEffect(() => {
|
|
|
189
199
|
|
|
190
200
|
// Deep link received while the app is running.
|
|
191
201
|
const link = Linking.addEventListener('url', () => {
|
|
192
|
-
BooleanMaths.
|
|
202
|
+
BooleanMaths.handleIntent();
|
|
193
203
|
});
|
|
194
204
|
|
|
195
205
|
// Notification tap that brought the app back to the foreground.
|
|
196
206
|
const state = AppState.addEventListener('change', (next) => {
|
|
197
207
|
if (next === 'active') {
|
|
198
|
-
BooleanMaths.
|
|
208
|
+
BooleanMaths.handleIntent();
|
|
199
209
|
}
|
|
200
210
|
});
|
|
201
211
|
|
|
@@ -255,9 +265,11 @@ Watch it land with:
|
|
|
255
265
|
adb logcat -s BooleanMathsSDK:D EventDispatcher:D
|
|
256
266
|
```
|
|
257
267
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
fields nested under `data.
|
|
268
|
+
The demo's tap intent is an `ACTION_VIEW` deep link, so a successful tap logs
|
|
269
|
+
`Deep link click tracked with campaign data.`, persists a `DeepLinkClick`
|
|
270
|
+
event, and dispatches it with the campaign fields nested under `data.link`. An
|
|
271
|
+
intent without `ACTION_VIEW` takes the `NotificationClick` path instead — see
|
|
272
|
+
[Automatic events](#automatic-events).
|
|
261
273
|
|
|
262
274
|
---
|
|
263
275
|
|
|
@@ -269,31 +281,40 @@ The native SDK tracks these without any call from you:
|
|
|
269
281
|
| :---- | :--- |
|
|
270
282
|
| `app_opened` | First Activity creation / SDK initialization |
|
|
271
283
|
| `FirstOpen` | Once per install, with Google Play Install Referrer attribution |
|
|
272
|
-
| `
|
|
284
|
+
| `DeepLinkClick` | An `ACTION_VIEW` intent is handled — ad deep links and app links. Campaign fields nest under `data.link` |
|
|
285
|
+
| `NotificationClick` | Any other intent carrying campaign data is handled. Fields nest under `data.notification` |
|
|
273
286
|
|
|
274
287
|
Visitor ID and session ID (30-minute timeout) are generated and persisted
|
|
275
|
-
natively.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
natively. Campaign data from a handled intent is also persisted by
|
|
289
|
+
`AttributionManager` and attached to **every subsequent event** as
|
|
290
|
+
`data.attribution` — natively, so `trackEvent` needs no extra work from you.
|
|
291
|
+
|
|
292
|
+
### What counts as a campaign intent (native SDK v1.0.9)
|
|
293
|
+
|
|
294
|
+
`handleIntent` ignores an intent when **all** of these hold, which is what a
|
|
295
|
+
plain launcher tap looks like:
|
|
296
|
+
|
|
297
|
+
- `action` is `ACTION_MAIN`, **and**
|
|
298
|
+
- `categories` contains `CATEGORY_LAUNCHER`, **and**
|
|
299
|
+
- there are no extras, **and**
|
|
300
|
+
- `data` is `null`
|
|
301
|
+
|
|
302
|
+
Anything else with non-empty campaign data is attributed: `ACTION_VIEW` emits
|
|
303
|
+
`DeepLinkClick`, everything else emits `NotificationClick`. Intents are
|
|
304
|
+
de-duplicated in a `WeakHashMap`, so re-forwarding the same intent is a no-op.
|
|
305
|
+
|
|
306
|
+
> ℹ️ **This fixes a v1.0.7/v1.0.8 bug this README previously warned about.**
|
|
307
|
+
> Older native SDKs recorded `intent.action` unconditionally and emitted
|
|
308
|
+
> `NotificationClick` whenever the resulting map was non-empty — so an ordinary
|
|
309
|
+
> launcher open produced a spurious
|
|
310
|
+
> `{ "event": "NotificationClick", "data": { "notification": { "action": "android.intent.action.MAIN" } } }`
|
|
311
|
+
> and the event could not be used as a tap metric without downstream
|
|
312
|
+
> filtering. As of 1.0.9 the launcher case is skipped at the source, and real
|
|
313
|
+
> deep links are split out into their own `DeepLinkClick` event.
|
|
292
314
|
>
|
|
293
|
-
>
|
|
294
|
-
>
|
|
295
|
-
>
|
|
296
|
-
> (require deep-link data or extras before emitting the event), not here.
|
|
315
|
+
> If you built dashboards or alerts that filter `NotificationClick` down to
|
|
316
|
+
> real taps, revisit them: the noise is gone, and `ACTION_VIEW` taps now arrive
|
|
317
|
+
> under a **different event name**.
|
|
297
318
|
|
|
298
319
|
---
|
|
299
320
|
|
|
@@ -311,7 +332,7 @@ Two normalizations happen on the Android side, both worth knowing:
|
|
|
311
332
|
{ "value": 2499, "items": [{ "quantity": 2, "price": 999.5 }] }
|
|
312
333
|
```
|
|
313
334
|
|
|
314
|
-
> ⚠️ **Known native SDK limitation (v1.0.
|
|
335
|
+
> ⚠️ **Known native SDK limitation (still present in v1.0.9).** The integers do *not* survive
|
|
315
336
|
> to the wire. `EventDispatcher` re-reads the stored payload with
|
|
316
337
|
> `gson.fromJson(properties, Map::class.java)`, and Gson coerces every number
|
|
317
338
|
> in a raw `Map` to `Double` — so the request body ends up with `2499.0` and
|
|
@@ -358,7 +379,7 @@ explicit forwarding, and `singleTask` activities need `setIntent`.
|
|
|
358
379
|
|
|
359
380
|
## License
|
|
360
381
|
|
|
361
|
-
|
|
382
|
+
[Apache-2.0](LICENSE)
|
|
362
383
|
|
|
363
384
|
---
|
|
364
385
|
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ buildscript {
|
|
|
6
6
|
// Version of the native Android SDK (com.booleanmaths:bm-sdk) this wrapper
|
|
7
7
|
// is built against. Override with `ext.BooleanmathsRnSdk_bmSdkVersion` in
|
|
8
8
|
// your app's root build.gradle to pin a different one.
|
|
9
|
-
bmSdkVersion: "1.0.
|
|
9
|
+
bmSdkVersion: "1.0.9"
|
|
10
10
|
]
|
|
11
11
|
|
|
12
12
|
ext.getExtOrDefault = { prop ->
|
|
@@ -41,6 +41,16 @@ class BooleanmathsRnSdkModule(reactContext: ReactApplicationContext) :
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
override fun handleIntent() {
|
|
45
|
+
safely("handleIntent") { forwardCurrentIntent() }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Alias of [handleIntent]. The native SDK unified ad deep links, app links
|
|
50
|
+
* and push notifications behind `handleIntent` in 1.0.9 and kept
|
|
51
|
+
* `handleNotificationIntent` as a delegating alias; this mirrors that so
|
|
52
|
+
* apps written against the older name keep working unchanged.
|
|
53
|
+
*/
|
|
44
54
|
override fun handleNotificationIntent() {
|
|
45
55
|
safely("handleNotificationIntent") { forwardCurrentIntent() }
|
|
46
56
|
}
|
|
@@ -64,7 +74,7 @@ class BooleanmathsRnSdkModule(reactContext: ReactApplicationContext) :
|
|
|
64
74
|
|
|
65
75
|
// The native SDK de-duplicates intents it has already processed, so
|
|
66
76
|
// calling this more than once for the same intent is safe.
|
|
67
|
-
BooleanMathsSDK.
|
|
77
|
+
BooleanMathsSDK.handleIntent(intent)
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
/**
|
package/ios/BooleanmathsRnSdk.mm
CHANGED
|
@@ -28,12 +28,18 @@ static void BMWarnUnsupportedOnce(void)
|
|
|
28
28
|
BMWarnUnsupportedOnce();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
- (void)
|
|
31
|
+
- (void)handleIntent
|
|
32
32
|
{
|
|
33
33
|
// Android-only concept; nothing to do on iOS even once an iOS SDK exists.
|
|
34
34
|
BMWarnUnsupportedOnce();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
- (void)handleNotificationIntent
|
|
38
|
+
{
|
|
39
|
+
// Alias of handleIntent, mirroring the Android bridge.
|
|
40
|
+
BMWarnUnsupportedOnce();
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
- (NSString *)getHelloMessage
|
|
38
44
|
{
|
|
39
45
|
BMWarnUnsupportedOnce();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hasWarned","warnOnce","__DEV__","console","warn","BooleanMaths","isSupported","initialize","_apiKey","_pixelId","trackEvent","_name","_properties","handleNotificationIntent","getHelloMessage"],"sourceRoot":"../../src","sources":["BooleanMaths.tsx"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,SAAS,GAAG,KAAK;AAErB,SAASC,QAAQA,CAAA,EAAG;EAClB,IAAID,SAAS,IAAI,OAAOE,OAAO,KAAK,WAAW,IAAI,CAACA,OAAO,EAAE;IAC3D;EACF;EAEAF,SAAS,GAAG,IAAI;EAEhBG,OAAO,CAACC,IAAI,CACV,sFAAsF,GACpF,2EAA2E,GAC3E,8DACJ,CAAC;AACH;AAEA,OAAO,MAAMC,YAA6B,GAAG;EAC3CC,WAAW,EAAE,KAAK;EAElBC,UAAUA,CAACC,OAAe,EAAEC,QAAgB,EAAQ;IAClDR,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDS,UAAUA,CAACC,KAAa,EAAEC,WAAyC,EAAQ;IACzEX,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDY,wBAAwBA,CAAA,EAAS;IAC/
|
|
1
|
+
{"version":3,"names":["hasWarned","warnOnce","__DEV__","console","warn","BooleanMaths","isSupported","initialize","_apiKey","_pixelId","trackEvent","_name","_properties","handleIntent","handleNotificationIntent","getHelloMessage"],"sourceRoot":"../../src","sources":["BooleanMaths.tsx"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,SAAS,GAAG,KAAK;AAErB,SAASC,QAAQA,CAAA,EAAG;EAClB,IAAID,SAAS,IAAI,OAAOE,OAAO,KAAK,WAAW,IAAI,CAACA,OAAO,EAAE;IAC3D;EACF;EAEAF,SAAS,GAAG,IAAI;EAEhBG,OAAO,CAACC,IAAI,CACV,sFAAsF,GACpF,2EAA2E,GAC3E,8DACJ,CAAC;AACH;AAEA,OAAO,MAAMC,YAA6B,GAAG;EAC3CC,WAAW,EAAE,KAAK;EAElBC,UAAUA,CAACC,OAAe,EAAEC,QAAgB,EAAQ;IAClDR,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDS,UAAUA,CAACC,KAAa,EAAEC,WAAyC,EAAQ;IACzEX,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDY,YAAYA,CAAA,EAAS;IACnBZ,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDa,wBAAwBA,CAAA,EAAS;IAC/Bb,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDc,eAAeA,CAAA,EAAkB;IAC/Bd,QAAQ,CAAC,CAAC;IACV,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -28,6 +28,20 @@ function warnOnce() {
|
|
|
28
28
|
}
|
|
29
29
|
console.warn('[@booleanmaths/booleanmaths-rn-sdk] The native module could not be found on ' + `${Platform.OS}. Rebuild the app after installing the package (a Metro ` + 'reload is not enough), and on iOS run `pod install`. All SDK calls are ' + 'no-ops until this is fixed.');
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Shared by `handleIntent` and its `handleNotificationIntent` alias. A
|
|
34
|
+
* standalone function rather than `this.handleIntent()` so the alias keeps
|
|
35
|
+
* working when it is pulled off the object, as in
|
|
36
|
+
* `const { handleNotificationIntent } = BooleanMaths`.
|
|
37
|
+
*/
|
|
38
|
+
function forwardCurrentIntent() {
|
|
39
|
+
if (!isSupported) {
|
|
40
|
+
warnOnce();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
NativeBooleanmathsRnSdk.handleIntent();
|
|
44
|
+
}
|
|
31
45
|
export const BooleanMaths = {
|
|
32
46
|
isSupported,
|
|
33
47
|
initialize(apiKey, pixelId) {
|
|
@@ -44,13 +58,8 @@ export const BooleanMaths = {
|
|
|
44
58
|
}
|
|
45
59
|
NativeBooleanmathsRnSdk.trackEvent(name, properties);
|
|
46
60
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
warnOnce();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
NativeBooleanmathsRnSdk.handleNotificationIntent();
|
|
53
|
-
},
|
|
61
|
+
handleIntent: forwardCurrentIntent,
|
|
62
|
+
handleNotificationIntent: forwardCurrentIntent,
|
|
54
63
|
getHelloMessage() {
|
|
55
64
|
if (!isSupported) {
|
|
56
65
|
warnOnce();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","NativeBooleanmathsRnSdk","SUPPORTED_PLATFORMS","isPlatformSupported","includes","OS","isSupported","hasWarned","warnOnce","__DEV__","console","warn","BooleanMaths","initialize","apiKey","pixelId","initializeSdk","trackEvent","name","properties","handleNotificationIntent","getHelloMessage"],"sourceRoot":"../../src","sources":["BooleanMaths.native.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,uBAAuB,MAAM,8BAA2B;AAG/D;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAsD,GAAG,CAAC,SAAS,CAAC;AAE1E,MAAMC,mBAAmB,GAAGD,mBAAmB,CAACE,QAAQ,CAACJ,QAAQ,CAACK,EAAE,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGH,mBAAmB,IAAIF,uBAAuB,IAAI,IAAI;AAE1E,IAAIM,SAAS,GAAG,KAAK;AAErB,SAASC,QAAQA,CAAA,EAAG;EAClB,IAAID,SAAS,IAAI,CAACE,OAAO,EAAE;IACzB;EACF;EAEAF,SAAS,GAAG,IAAI;EAEhB,IAAI,CAACJ,mBAAmB,EAAE;IACxBO,OAAO,CAACC,IAAI,CACV,uFAAuFX,QAAQ,CAACK,EAAE,GAAG,GACnG,2EAA2E,GAC3E,2EAA2E,GAC3E,sEACJ,CAAC;IACD;EACF;EAEAK,OAAO,CAACC,IAAI,CACV,8EAA8E,GAC5E,GAAGX,QAAQ,CAACK,EAAE,0DAA0D,GACxE,yEAAyE,GACzE,6BACJ,CAAC;AACH;AAEA,OAAO,
|
|
1
|
+
{"version":3,"names":["Platform","NativeBooleanmathsRnSdk","SUPPORTED_PLATFORMS","isPlatformSupported","includes","OS","isSupported","hasWarned","warnOnce","__DEV__","console","warn","forwardCurrentIntent","handleIntent","BooleanMaths","initialize","apiKey","pixelId","initializeSdk","trackEvent","name","properties","handleNotificationIntent","getHelloMessage"],"sourceRoot":"../../src","sources":["BooleanMaths.native.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,uBAAuB,MAAM,8BAA2B;AAG/D;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAsD,GAAG,CAAC,SAAS,CAAC;AAE1E,MAAMC,mBAAmB,GAAGD,mBAAmB,CAACE,QAAQ,CAACJ,QAAQ,CAACK,EAAE,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAGH,mBAAmB,IAAIF,uBAAuB,IAAI,IAAI;AAE1E,IAAIM,SAAS,GAAG,KAAK;AAErB,SAASC,QAAQA,CAAA,EAAG;EAClB,IAAID,SAAS,IAAI,CAACE,OAAO,EAAE;IACzB;EACF;EAEAF,SAAS,GAAG,IAAI;EAEhB,IAAI,CAACJ,mBAAmB,EAAE;IACxBO,OAAO,CAACC,IAAI,CACV,uFAAuFX,QAAQ,CAACK,EAAE,GAAG,GACnG,2EAA2E,GAC3E,2EAA2E,GAC3E,sEACJ,CAAC;IACD;EACF;EAEAK,OAAO,CAACC,IAAI,CACV,8EAA8E,GAC5E,GAAGX,QAAQ,CAACK,EAAE,0DAA0D,GACxE,yEAAyE,GACzE,6BACJ,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,oBAAoBA,CAAA,EAAS;EACpC,IAAI,CAACN,WAAW,EAAE;IAChBE,QAAQ,CAAC,CAAC;IACV;EACF;EAEAP,uBAAuB,CAAEY,YAAY,CAAC,CAAC;AACzC;AAEA,OAAO,MAAMC,YAA6B,GAAG;EAC3CR,WAAW;EAEXS,UAAUA,CAACC,MAAc,EAAEC,OAAe,EAAQ;IAChD,IAAI,CAACX,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEiB,aAAa,CAACF,MAAM,EAAEC,OAAO,CAAC;EACzD,CAAC;EAEDE,UAAUA,CAACC,IAAY,EAAEC,UAAuC,GAAG,CAAC,CAAC,EAAQ;IAC3E,IAAI,CAACf,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEkB,UAAU,CAACC,IAAI,EAAEC,UAAU,CAAC;EACvD,CAAC;EAEDR,YAAY,EAAED,oBAAoB;EAElCU,wBAAwB,EAAEV,oBAAoB;EAE9CW,eAAeA,CAAA,EAAkB;IAC/B,IAAI,CAACjB,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV,OAAO,IAAI;IACb;IAEA,OAAOP,uBAAuB,CAAEsB,eAAe,CAAC,CAAC;EACnD;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeBooleanmathsRnSdk.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeBooleanmathsRnSdk.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAsBpE;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanMaths.d.ts","sourceRoot":"","sources":["../../../src/BooleanMaths.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,YAAS,CAAC;AAyB5E,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"BooleanMaths.d.ts","sourceRoot":"","sources":["../../../src/BooleanMaths.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,YAAS,CAAC;AAyB5E,eAAO,MAAM,YAAY,EAAE,eAuB1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanMaths.native.d.ts","sourceRoot":"","sources":["../../../src/BooleanMaths.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,YAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanMaths.native.d.ts","sourceRoot":"","sources":["../../../src/BooleanMaths.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAA+B,MAAM,YAAS,CAAC;AA4D5E,eAAO,MAAM,YAAY,EAAE,eAiC1B,CAAC"}
|
|
@@ -9,6 +9,11 @@ export interface Spec extends TurboModule {
|
|
|
9
9
|
initializeSdk(apiKey: string, pixelId: string): void;
|
|
10
10
|
trackEvent(name: string, properties: Object): void;
|
|
11
11
|
/** Android only. No-op elsewhere. */
|
|
12
|
+
handleIntent(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Alias of `handleIntent`, kept so existing callers keep working. Android
|
|
15
|
+
* only. No-op elsewhere.
|
|
16
|
+
*/
|
|
12
17
|
handleNotificationIntent(): void;
|
|
13
18
|
/** Smoke test that the native bridge is wired up. */
|
|
14
19
|
getHelloMessage(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeBooleanmathsRnSdk.d.ts","sourceRoot":"","sources":["../../../src/NativeBooleanmathsRnSdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,qCAAqC;IACrC,wBAAwB,IAAI,IAAI,CAAC;IACjC,qDAAqD;IACrD,eAAe,IAAI,MAAM,CAAC;CAC3B;AAED;;;GAGG;;AACH,wBAAkE"}
|
|
1
|
+
{"version":3,"file":"NativeBooleanmathsRnSdk.d.ts","sourceRoot":"","sources":["../../../src/NativeBooleanmathsRnSdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD,qCAAqC;IACrC,YAAY,IAAI,IAAI,CAAC;IACrB;;;OAGG;IACH,wBAAwB,IAAI,IAAI,CAAC;IACjC,qDAAqD;IACrD,eAAe,IAAI,MAAM,CAAC;CAC3B;AAED;;;GAGG;;AACH,wBAAkE"}
|
|
@@ -25,12 +25,24 @@ export interface BooleanMathsApi {
|
|
|
25
25
|
*/
|
|
26
26
|
trackEvent(name: string, properties?: BooleanMathsEventProperties): void;
|
|
27
27
|
/**
|
|
28
|
-
* Forwards the current Activity's intent to the native SDK so deep
|
|
29
|
-
* notification campaign data
|
|
28
|
+
* Forwards the current Activity's intent to the native SDK so ad deep links,
|
|
29
|
+
* app links and push-notification campaign data are attributed.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* launch intent
|
|
31
|
+
* This is the primary entry point for every kind of launch intent. Android
|
|
32
|
+
* only — a no-op on every other platform. Call it from your deep-link
|
|
33
|
+
* handler; `initialize` already forwards the launch intent itself (see the
|
|
34
|
+
* README for why that needs special handling).
|
|
35
|
+
*
|
|
36
|
+
* Safe to call repeatedly — the native SDK de-duplicates intents it has
|
|
37
|
+
* already processed.
|
|
38
|
+
*/
|
|
39
|
+
handleIntent(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Backward-compatible alias of {@link handleIntent}.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Prefer `handleIntent()`, which names what it actually does:
|
|
44
|
+
* the native SDK routes deep links, app links and notifications through the
|
|
45
|
+
* same path. This alias will be kept for the foreseeable future.
|
|
34
46
|
*/
|
|
35
47
|
handleNotificationIntent(): void;
|
|
36
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GACjC,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,yBAAyB,EAAE,GAC3B;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAA;CAAE,CAAC;AAEjD,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,yBAAyB,CAC1B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAEzE
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GACjC,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,yBAAyB,EAAE,GAC3B;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,yBAAyB,CAAA;CAAE,CAAC;AAEjD,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,yBAAyB,CAC1B,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAEzE;;;;;;;;;;;OAWG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;OAMG;IACH,wBAAwB,IAAI,IAAI,CAAC;IAEjC;;;OAGG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@booleanmaths/booleanmaths-rn-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React Native SDK for BooleanMaths — track user events and attribution in mobile apps.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -45,6 +45,21 @@ function warnOnce() {
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Shared by `handleIntent` and its `handleNotificationIntent` alias. A
|
|
50
|
+
* standalone function rather than `this.handleIntent()` so the alias keeps
|
|
51
|
+
* working when it is pulled off the object, as in
|
|
52
|
+
* `const { handleNotificationIntent } = BooleanMaths`.
|
|
53
|
+
*/
|
|
54
|
+
function forwardCurrentIntent(): void {
|
|
55
|
+
if (!isSupported) {
|
|
56
|
+
warnOnce();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
NativeBooleanmathsRnSdk!.handleIntent();
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
export const BooleanMaths: BooleanMathsApi = {
|
|
49
64
|
isSupported,
|
|
50
65
|
|
|
@@ -66,14 +81,9 @@ export const BooleanMaths: BooleanMathsApi = {
|
|
|
66
81
|
NativeBooleanmathsRnSdk!.trackEvent(name, properties);
|
|
67
82
|
},
|
|
68
83
|
|
|
69
|
-
|
|
70
|
-
if (!isSupported) {
|
|
71
|
-
warnOnce();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
84
|
+
handleIntent: forwardCurrentIntent,
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
},
|
|
86
|
+
handleNotificationIntent: forwardCurrentIntent,
|
|
77
87
|
|
|
78
88
|
getHelloMessage(): string | null {
|
|
79
89
|
if (!isSupported) {
|
package/src/BooleanMaths.tsx
CHANGED
|
@@ -10,6 +10,11 @@ export interface Spec extends TurboModule {
|
|
|
10
10
|
initializeSdk(apiKey: string, pixelId: string): void;
|
|
11
11
|
trackEvent(name: string, properties: Object): void;
|
|
12
12
|
/** Android only. No-op elsewhere. */
|
|
13
|
+
handleIntent(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Alias of `handleIntent`, kept so existing callers keep working. Android
|
|
16
|
+
* only. No-op elsewhere.
|
|
17
|
+
*/
|
|
13
18
|
handleNotificationIntent(): void;
|
|
14
19
|
/** Smoke test that the native bridge is wired up. */
|
|
15
20
|
getHelloMessage(): string;
|
package/src/types.ts
CHANGED
|
@@ -37,12 +37,25 @@ export interface BooleanMathsApi {
|
|
|
37
37
|
trackEvent(name: string, properties?: BooleanMathsEventProperties): void;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Forwards the current Activity's intent to the native SDK so deep
|
|
41
|
-
* notification campaign data
|
|
40
|
+
* Forwards the current Activity's intent to the native SDK so ad deep links,
|
|
41
|
+
* app links and push-notification campaign data are attributed.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* launch intent
|
|
43
|
+
* This is the primary entry point for every kind of launch intent. Android
|
|
44
|
+
* only — a no-op on every other platform. Call it from your deep-link
|
|
45
|
+
* handler; `initialize` already forwards the launch intent itself (see the
|
|
46
|
+
* README for why that needs special handling).
|
|
47
|
+
*
|
|
48
|
+
* Safe to call repeatedly — the native SDK de-duplicates intents it has
|
|
49
|
+
* already processed.
|
|
50
|
+
*/
|
|
51
|
+
handleIntent(): void;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Backward-compatible alias of {@link handleIntent}.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Prefer `handleIntent()`, which names what it actually does:
|
|
57
|
+
* the native SDK routes deep links, app links and notifications through the
|
|
58
|
+
* same path. This alias will be kept for the foreseeable future.
|
|
46
59
|
*/
|
|
47
60
|
handleNotificationIntent(): void;
|
|
48
61
|
|