@booleanmaths/booleanmaths-rn-sdk 0.3.0 → 0.4.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.
@@ -10,8 +10,8 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- # No platform override needed. BooleanMathsSDK 1.0.1 lowered its own floor to
14
- # 15.1, which is exactly React Native's min_ios_version_supported — pinning a
13
+ # No platform override needed. BooleanMathsSDK has declared a 15.1 floor since
14
+ # 1.0.1, which is exactly React Native's min_ios_version_supported — pinning a
15
15
  # higher floor here would push it onto every consuming app.
16
16
  s.platforms = { :ios => min_ios_version_supported }
17
17
  s.source = { :git => "https://github.com/medront/react-native-booleanmaths-sdk.git", :tag => "v#{s.version}" }
@@ -25,10 +25,12 @@ Pod::Spec.new do |s|
25
25
 
26
26
  s.swift_version = "5.9"
27
27
 
28
- # `~> 1.0.1`, deliberately not `~> 1.0`: 1.0.0 is still published on Trunk
29
- # carrying an iOS 17.0 deployment target, and resolving to it would break the
30
- # install for any app below iOS 17.
31
- s.dependency "BooleanMathsSDK", "~> 1.0.1"
28
+ # `~> 1.1` resolves to >= 1.1, < 2.0. The earlier pin carried a `.1` patch
29
+ # component purely to exclude 1.0.0, which is still published on Trunk carrying
30
+ # an iOS 17.0 deployment target and would break the install for any app below
31
+ # iOS 17. A 1.1 floor excludes it outright, so the patch component is no longer
32
+ # load-bearing and the range can stay open across minors.
33
+ s.dependency "BooleanMathsSDK", "~> 1.1"
32
34
 
33
35
  # Mirrors Android's BuildConfig.WRAPPER_VERSION, which is read from
34
36
  # package.json so the reported wrapper_version cannot drift from the published
package/README.md CHANGED
@@ -18,8 +18,8 @@ call the same methods everywhere.
18
18
 
19
19
  | Platform | Native SDK | Behaviour |
20
20
  | :------- | :--------- | :-------- |
21
- | Android | ✅ `com.booleanmaths:bm-sdk:1.0.9` | Fully functional |
22
- | iOS | ✅ `BooleanMathsSDK 1.0.1` | Event tracking fully functional — see below |
21
+ | Android | ✅ `com.booleanmaths:bm-sdk:1.0.12` | Fully functional |
22
+ | iOS | ✅ `BooleanMathsSDK 1.1.0` | Event tracking fully functional — see below |
23
23
  | Web | ❌ not published | Silent no-op, **never crashes** |
24
24
 
25
25
  ### What iOS supports
@@ -33,6 +33,8 @@ rather than a bug.
33
33
  | `initialize()` | ✅ | ✅ |
34
34
  | `trackEvent()` with nested properties | ✅ | ✅ |
35
35
  | `wrapper_type` / `wrapper_version` on every event | ✅ | ✅ |
36
+ | `isDebug` → `environment` on every event | ✅ | ✅ |
37
+ | `app_info` (package, version, install/update times) on every event | ✅ | ✅ |
36
38
  | Automatic `app_opened` | ✅ | ✅ |
37
39
  | Automatic `FirstOpen` (once per install) | ✅ | ✅ — but with no attribution payload, see below |
38
40
  | Visitor ID and 30-minute session handling | ✅ | ✅ |
@@ -140,11 +142,17 @@ To pin a different native SDK version, set this in your app's **root**
140
142
  ```gradle
141
143
  buildscript {
142
144
  ext {
143
- BooleanmathsRnSdk_bmSdkVersion = "1.0.9"
145
+ BooleanmathsRnSdk_bmSdkVersion = "1.0.12"
144
146
  }
145
147
  }
146
148
  ```
147
149
 
150
+ > ⚠️ **1.0.10 is the floor.** The wrapper calls
151
+ > `BooleanMathsSDK.initialize(context, apiKey, pixelId, isDebug)`, and the
152
+ > four-argument overload only exists from 1.0.10. Pinning anything older fails
153
+ > the Kotlin compile with an unresolved-overload error rather than degrading at
154
+ > runtime.
155
+
148
156
  ### iOS
149
157
 
150
158
  Autolinking picks the module up; run `pod install` to pull in the native SDK.
@@ -157,10 +165,10 @@ That resolves `BooleanMathsSDK` from CocoaPods Trunk. Points worth knowing:
157
165
 
158
166
  - **Minimum deployment target is iOS 15.1**, matching React Native's own floor,
159
167
  so adopting this SDK does not raise your app's minimum iOS version.
160
- - **The pod is pinned to `~> 1.0.1`,** deliberately not `~> 1.0`. Version 1.0.0
161
- is still published with an iOS 17.0 floor, and resolving to it would break
162
- the install for apps below iOS 17. Confirm your `Podfile.lock` shows
163
- `BooleanMathsSDK (1.0.1)` or newer.
168
+ - **The pod is constrained to `~> 1.1`** that is, `>= 1.1, < 2.0`. The floor
169
+ matters: version 1.0.0 is still published with an iOS 17.0 floor, and
170
+ resolving to it would break the install for apps below iOS 17. Confirm your
171
+ `Podfile.lock` shows `BooleanMathsSDK (1.1.0)` or newer.
164
172
  - **The SDK ships as a closed-source, vendored *dynamic* XCFramework.**
165
173
  CocoaPods embeds and re-signs it with your app's identity. If you use
166
174
  `use_frameworks!`, both `:linkage => :static` and `:linkage => :dynamic`
@@ -182,6 +190,9 @@ import { BooleanMaths } from '@booleanmaths/booleanmaths-rn-sdk';
182
190
  // Once, as early as possible — typically in your root component.
183
191
  BooleanMaths.initialize('YOUR_API_KEY', 'YOUR_PIXEL_ID');
184
192
 
193
+ // Or, to mark this build's events as development rather than production:
194
+ BooleanMaths.initialize('YOUR_API_KEY', 'YOUR_PIXEL_ID', __DEV__);
195
+
185
196
  // Anywhere afterwards.
186
197
  BooleanMaths.trackEvent('purchase', {
187
198
  orderId: 'ORD-1024',
@@ -204,7 +215,7 @@ ignored.
204
215
 
205
216
  ## API
206
217
 
207
- ### `BooleanMaths.initialize(apiKey, pixelId): void`
218
+ ### `BooleanMaths.initialize(apiKey, pixelId, isDebug?): void`
208
219
 
209
220
  Initializes the native SDK. Also registers this wrapper with the native SDK
210
221
  **before** initializing, so that even the automatic `FirstOpen` and `app_opened`
@@ -217,6 +228,39 @@ On Android it additionally forwards the launch intent (see
217
228
  [Deep links](#deep-links-and-notification-attribution)); there is no iOS
218
229
  equivalent.
219
230
 
231
+ `isDebug` defaults to `false`. See [Debug mode](#debug-mode) below.
232
+
233
+ ### Debug mode
234
+
235
+ Passing `isDebug: true` does two things on both platforms:
236
+
237
+ 1. **Every event this process tracks is stamped `environment: "development"`**
238
+ instead of `"production"`, in the `setup` block of the request payload.
239
+ 2. **The native SDK's verbose logging is switched on.** Warnings and errors —
240
+ "SDK is already initialized", network failures, malformed intents — are
241
+ logged *regardless* of this flag, so a broken integration is still
242
+ diagnosable in a production build. Only the routine per-event chatter
243
+ ("Persisted event", "Sending payload") is gated.
244
+
245
+ The flag is recorded **per event, when the event is queued** — not when the
246
+ queue is flushed. An event written by a debug build therefore stays marked as
247
+ development even if it only reaches the network later, after an app restart.
248
+ Both platforms migrated their local queue schemas for this (Room v6 → v7 on
249
+ Android, SQLite v1 → v2 on iOS); the migration is automatic and no events are
250
+ lost.
251
+
252
+ The wrapper deliberately **does not** default this to `__DEV__`. Which
253
+ environment events land in is a backend-routing decision, not a bundler one —
254
+ release builds pointed at a development pixel are a normal QA setup. Pass
255
+ `__DEV__` yourself if that is the behaviour you want:
256
+
257
+ ```ts
258
+ BooleanMaths.initialize(API_KEY, PIXEL_ID, __DEV__);
259
+ ```
260
+
261
+ Requires native SDK `bm-sdk` **1.0.10+** on Android and `BooleanMathsSDK`
262
+ **1.1.0+** on iOS; both are the versions this wrapper depends on.
263
+
220
264
  ### `BooleanMaths.trackEvent(name, properties?): void`
221
265
 
222
266
  Records a custom event. `properties` defaults to `{}` and may contain strings,
@@ -379,7 +423,7 @@ persisted by `AttributionManager` and attached to **every subsequent event** as
379
423
  `data.attribution`. iOS produces no `data.attribution` block, since it handles
380
424
  no intents; Apple Search Ads attribution is deferred to a later release.
381
425
 
382
- ### What counts as a campaign intent (native SDK v1.0.9)
426
+ ### What counts as a campaign intent (native SDK v1.0.12)
383
427
 
384
428
  `handleIntent` ignores an intent when **all** of these hold, which is what a
385
429
  plain launcher tap looks like:
@@ -449,7 +493,7 @@ costs you that one key and nothing else.
449
493
  { "value": 2499, "items": [{ "quantity": 2, "price": 999.5 }] }
450
494
  ```
451
495
 
452
- > ⚠️ **Known native SDK limitation (still present in v1.0.9).** The integers do *not* survive
496
+ > ⚠️ **Known native SDK limitation (still present in v1.0.12).** The integers do *not* survive
453
497
  > to the wire. `EventDispatcher` re-reads the stored payload with
454
498
  > `gson.fromJson(properties, Map::class.java)`, and Gson coerces every number
455
499
  > in a raw `Map` to `Double` — so the request body ends up with `2499.0` and
@@ -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"
9
+ bmSdkVersion: "1.0.12"
10
10
  ]
11
11
 
12
12
  ext.getExtOrDefault = { prop ->
@@ -8,17 +8,22 @@ import com.facebook.react.bridge.ReadableMap
8
8
  class BooleanmathsRnSdkModule(reactContext: ReactApplicationContext) :
9
9
  NativeBooleanmathsRnSdkSpec(reactContext) {
10
10
 
11
- override fun initializeSdk(apiKey: String, pixelId: String) {
11
+ override fun initializeSdk(apiKey: String, pixelId: String, isDebug: Boolean) {
12
12
  safely("initialize") {
13
13
  // Stamp the wrapper identity *before* initialize() so the automatic
14
14
  // `app_opened` and `FirstOpen` events that the native SDK tracks during
15
15
  // initialization already carry wrapper_type / wrapper_version.
16
16
  applyWrapperConfig()
17
17
 
18
+ // `isDebug` is passed explicitly rather than left to the native default:
19
+ // it decides the `environment` field ("development" / "production") that
20
+ // every event carries, and it gates the native SDK's verbose logging.
21
+ // The JS wrapper always supplies it, defaulting to false.
18
22
  BooleanMathsSDK.initialize(
19
23
  reactApplicationContext.applicationContext,
20
24
  apiKey,
21
- pixelId
25
+ pixelId,
26
+ isDebug
22
27
  )
23
28
 
24
29
  // ...and again afterwards, because the native SDK can only persist the
@@ -35,10 +35,11 @@ public final class BMBooleanMathsBridge: NSObject {
35
35
  /// Named `initializeSdk` rather than `initialize` for the same reason the
36
36
  /// codegen spec is: `+[NSObject initialize]` already exists.
37
37
  @MainActor
38
- @objc(initializeSdkWithApiKey:pixelId:wrapperVersion:)
38
+ @objc(initializeSdkWithApiKey:pixelId:isDebug:wrapperVersion:)
39
39
  public static func initializeSdk(
40
40
  apiKey: String,
41
41
  pixelId: String,
42
+ isDebug: Bool,
42
43
  wrapperVersion: String
43
44
  ) {
44
45
  // Before `initialize`, not after: `initialize` itself emits `FirstOpen` and
@@ -54,7 +55,11 @@ public final class BMBooleanMathsBridge: NSObject {
54
55
  // persisted one. One call, before initialize, is correct and sufficient.
55
56
  BooleanMaths.shared.setWrapperConfig(type: wrapperType, version: wrapperVersion)
56
57
 
57
- BooleanMaths.shared.initialize(apiKey: apiKey, pixelId: pixelId)
58
+ // `isDebug` is passed explicitly rather than left to the SDK's default: it
59
+ // decides the `environment` field ("development" / "production") stamped on
60
+ // every event, and it gates the SDK's verbose logging. The JS wrapper always
61
+ // supplies it, defaulting to false. Same contract as Android.
62
+ BooleanMaths.shared.initialize(apiKey: apiKey, pixelId: pixelId, isDebug: isDebug)
58
63
 
59
64
  // There is no iOS equivalent of Android's forwardCurrentIntent(): deep links
60
65
  // are deferred on iOS, so nothing is forwarded here. See `handleIntent` in
@@ -47,7 +47,7 @@ static void BMWarnIntentUnsupportedOnce(void)
47
47
  });
48
48
  }
49
49
 
50
- - (void)initializeSdk:(NSString *)apiKey pixelId:(NSString *)pixelId
50
+ - (void)initializeSdk:(NSString *)apiKey pixelId:(NSString *)pixelId isDebug:(BOOL)isDebug
51
51
  {
52
52
  // Captured outside the block: it is a compile-time constant, not thread state.
53
53
  NSString *wrapperVersion = @BMRN_WRAPPER_VERSION;
@@ -58,6 +58,7 @@ static void BMWarnIntentUnsupportedOnce(void)
58
58
  BMSafely(@"initialize", ^{
59
59
  [BMBooleanMathsBridge initializeSdkWithApiKey:apiKey
60
60
  pixelId:pixelId
61
+ isDebug:isDebug
61
62
  wrapperVersion:wrapperVersion];
62
63
  });
63
64
  });
@@ -17,7 +17,7 @@ function warnOnce() {
17
17
  }
18
18
  export const BooleanMaths = {
19
19
  isSupported: false,
20
- initialize(_apiKey, _pixelId) {
20
+ initialize(_apiKey, _pixelId, _isDebug) {
21
21
  warnOnce();
22
22
  },
23
23
  trackEvent(_name, _properties) {
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"names":["hasWarned","warnOnce","__DEV__","console","warn","BooleanMaths","isSupported","initialize","_apiKey","_pixelId","_isDebug","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,EAAEC,QAAkB,EAAQ;IACtET,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDU,UAAUA,CAACC,KAAa,EAAEC,WAAyC,EAAQ;IACzEZ,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDa,YAAYA,CAAA,EAAS;IACnBb,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDc,wBAAwBA,CAAA,EAAS;IAC/Bd,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDe,eAAeA,CAAA,EAAkB;IAC/Bf,QAAQ,CAAC,CAAC;IACV,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
@@ -48,12 +48,16 @@ function forwardCurrentIntent() {
48
48
  }
49
49
  export const BooleanMaths = {
50
50
  isSupported,
51
- initialize(apiKey, pixelId) {
51
+ initialize(apiKey, pixelId, isDebug = false) {
52
52
  if (!isSupported) {
53
53
  warnOnce();
54
54
  return;
55
55
  }
56
- NativeBooleanmathsRnSdk.initializeSdk(apiKey, pixelId);
56
+
57
+ // Coerced rather than passed through: the codegen spec declares a
58
+ // non-optional boolean, and a truthy non-boolean from untyped JS would
59
+ // arrive at the native side as a type mismatch rather than a flag.
60
+ NativeBooleanmathsRnSdk.initializeSdk(apiKey, pixelId, Boolean(isDebug));
57
61
  },
58
62
  trackEvent(name, properties = {}) {
59
63
  if (!isSupported) {
@@ -1 +1 @@
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;AACA;AACA;AACA;AACA,MAAMC,mBAAsD,GAAG,CAC7D,SAAS,EACT,KAAK,CACN;AAED,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
+ {"version":3,"names":["Platform","NativeBooleanmathsRnSdk","SUPPORTED_PLATFORMS","isPlatformSupported","includes","OS","isSupported","hasWarned","warnOnce","__DEV__","console","warn","forwardCurrentIntent","handleIntent","BooleanMaths","initialize","apiKey","pixelId","isDebug","initializeSdk","Boolean","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;AACA;AACA;AACA;AACA,MAAMC,mBAAsD,GAAG,CAC7D,SAAS,EACT,KAAK,CACN;AAED,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,EAAEC,OAAgB,GAAG,KAAK,EAAQ;IAC1E,IAAI,CAACZ,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;;IAEA;IACA;IACA;IACAP,uBAAuB,CAAEkB,aAAa,CAACH,MAAM,EAAEC,OAAO,EAAEG,OAAO,CAACF,OAAO,CAAC,CAAC;EAC3E,CAAC;EAEDG,UAAUA,CAACC,IAAY,EAAEC,UAAuC,GAAG,CAAC,CAAC,EAAQ;IAC3E,IAAI,CAACjB,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEoB,UAAU,CAACC,IAAI,EAAEC,UAAU,CAAC;EACvD,CAAC;EAEDV,YAAY,EAAED,oBAAoB;EAElCY,wBAAwB,EAAEZ,oBAAoB;EAE9Ca,eAAeA,CAAA,EAAkB;IAC/B,IAAI,CAACnB,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV,OAAO,IAAI;IACb;IAEA,OAAOP,uBAAuB,CAAEwB,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;AAsBpE;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,mBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeBooleanmathsRnSdk.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AA2BpE;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,mBAAmB,CAAC","ignoreList":[]}
@@ -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;AAmE5E,eAAO,MAAM,YAAY,EAAE,eAiC1B,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;AAmE5E,eAAO,MAAM,YAAY,EAAE,eAoC1B,CAAC"}
@@ -5,8 +5,13 @@ export interface Spec extends TurboModule {
5
5
  * already taken by `NativeModule.initialize()` on Android and by
6
6
  * `+[NSObject initialize]` on iOS. The public JS API exposes this as
7
7
  * `BooleanMaths.initialize()`.
8
+ *
9
+ * `isDebug` is required here even though it is optional on the public API —
10
+ * codegen has no notion of a default, so `BooleanMaths.initialize` always
11
+ * passes an explicit boolean. Same arrangement as `trackEvent`'s
12
+ * `properties`.
8
13
  */
9
- initializeSdk(apiKey: string, pixelId: string): void;
14
+ initializeSdk(apiKey: string, pixelId: string, isDebug: boolean): void;
10
15
  trackEvent(name: string, properties: Object): void;
11
16
  /** Android only. No-op elsewhere. */
12
17
  handleIntent(): void;
@@ -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,YAAY,IAAI,IAAI,CAAC;IACrB;;;OAGG;IACH,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;;;;;;;;;;OAUG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACvE,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"}
@@ -15,8 +15,21 @@ export interface BooleanMathsApi {
15
15
  *
16
16
  * Calling this more than once is harmless — the native SDK ignores
17
17
  * subsequent calls.
18
+ *
19
+ * @param isDebug Marks this process as a development build. Every event it
20
+ * tracks is stamped `environment: "development"` instead of `"production"`,
21
+ * and the native SDKs' verbose logging is switched on. Defaults to `false`.
22
+ *
23
+ * The flag is recorded per event when the event is queued, not when the
24
+ * queue is flushed, so events written by a debug build stay marked as
25
+ * development even if they only sync later.
26
+ *
27
+ * It is deliberately *not* derived from `__DEV__` inside the wrapper —
28
+ * where an event lands is a backend-routing decision, not a bundler one, and
29
+ * some teams want release builds pointed at development. Pass `__DEV__`
30
+ * yourself if that is the behaviour you want.
18
31
  */
19
- initialize(apiKey: string, pixelId: string): void;
32
+ initialize(apiKey: string, pixelId: string, isDebug?: boolean): void;
20
33
  /**
21
34
  * Records a custom event. Events are persisted locally and synced in the
22
35
  * background, so this never blocks and never throws on network failure.
@@ -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;;;;;;;;;;;;;;;OAeG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;OAMG;IACH,wBAAwB,IAAI,IAAI,CAAC;IAEjC;;;;;;;OAOG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B"}
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;;;;;;;;;;;;;;;;;;;OAmBG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAErE;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAEzE;;;;;;;;;;;;;;;OAeG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;OAMG;IACH,wBAAwB,IAAI,IAAI,CAAC;IAEjC;;;;;;;OAOG;IACH,eAAe,IAAI,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;OAIG;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.0",
3
+ "version": "0.4.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",
@@ -70,13 +70,16 @@ function forwardCurrentIntent(): void {
70
70
  export const BooleanMaths: BooleanMathsApi = {
71
71
  isSupported,
72
72
 
73
- initialize(apiKey: string, pixelId: string): void {
73
+ initialize(apiKey: string, pixelId: string, isDebug: boolean = false): void {
74
74
  if (!isSupported) {
75
75
  warnOnce();
76
76
  return;
77
77
  }
78
78
 
79
- NativeBooleanmathsRnSdk!.initializeSdk(apiKey, pixelId);
79
+ // Coerced rather than passed through: the codegen spec declares a
80
+ // non-optional boolean, and a truthy non-boolean from untyped JS would
81
+ // arrive at the native side as a type mismatch rather than a flag.
82
+ NativeBooleanmathsRnSdk!.initializeSdk(apiKey, pixelId, Boolean(isDebug));
80
83
  },
81
84
 
82
85
  trackEvent(name: string, properties: BooleanMathsEventProperties = {}): void {
@@ -26,7 +26,7 @@ function warnOnce() {
26
26
  export const BooleanMaths: BooleanMathsApi = {
27
27
  isSupported: false,
28
28
 
29
- initialize(_apiKey: string, _pixelId: string): void {
29
+ initialize(_apiKey: string, _pixelId: string, _isDebug?: boolean): void {
30
30
  warnOnce();
31
31
  },
32
32
 
@@ -6,8 +6,13 @@ export interface Spec extends TurboModule {
6
6
  * already taken by `NativeModule.initialize()` on Android and by
7
7
  * `+[NSObject initialize]` on iOS. The public JS API exposes this as
8
8
  * `BooleanMaths.initialize()`.
9
+ *
10
+ * `isDebug` is required here even though it is optional on the public API —
11
+ * codegen has no notion of a default, so `BooleanMaths.initialize` always
12
+ * passes an explicit boolean. Same arrangement as `trackEvent`'s
13
+ * `properties`.
9
14
  */
10
- initializeSdk(apiKey: string, pixelId: string): void;
15
+ initializeSdk(apiKey: string, pixelId: string, isDebug: boolean): void;
11
16
  trackEvent(name: string, properties: Object): void;
12
17
  /** Android only. No-op elsewhere. */
13
18
  handleIntent(): void;
package/src/types.ts CHANGED
@@ -25,8 +25,21 @@ export interface BooleanMathsApi {
25
25
  *
26
26
  * Calling this more than once is harmless — the native SDK ignores
27
27
  * subsequent calls.
28
+ *
29
+ * @param isDebug Marks this process as a development build. Every event it
30
+ * tracks is stamped `environment: "development"` instead of `"production"`,
31
+ * and the native SDKs' verbose logging is switched on. Defaults to `false`.
32
+ *
33
+ * The flag is recorded per event when the event is queued, not when the
34
+ * queue is flushed, so events written by a debug build stay marked as
35
+ * development even if they only sync later.
36
+ *
37
+ * It is deliberately *not* derived from `__DEV__` inside the wrapper —
38
+ * where an event lands is a backend-routing decision, not a bundler one, and
39
+ * some teams want release builds pointed at development. Pass `__DEV__`
40
+ * yourself if that is the behaviour you want.
28
41
  */
29
- initialize(apiKey: string, pixelId: string): void;
42
+ initialize(apiKey: string, pixelId: string, isDebug?: boolean): void;
30
43
 
31
44
  /**
32
45
  * Records a custom event. Events are persisted locally and synced in the