@booleanmaths/booleanmaths-rn-sdk 0.1.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/BooleanmathsRnSdk.podspec +20 -0
- package/LICENSE +201 -0
- package/README.md +365 -0
- package/android/build.gradle +78 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/booleanmathsrnsdk/BooleanmathsRnSdkModule.kt +126 -0
- package/android/src/main/java/com/booleanmathsrnsdk/BooleanmathsRnSdkPackage.kt +31 -0
- package/ios/BooleanmathsRnSdk.h +20 -0
- package/ios/BooleanmathsRnSdk.mm +56 -0
- package/lib/module/BooleanMaths.js +34 -0
- package/lib/module/BooleanMaths.js.map +1 -0
- package/lib/module/BooleanMaths.native.js +62 -0
- package/lib/module/BooleanMaths.native.js.map +1 -0
- package/lib/module/NativeBooleanmathsRnSdk.js +9 -0
- package/lib/module/NativeBooleanmathsRnSdk.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/BooleanMaths.d.ts +3 -0
- package/lib/typescript/src/BooleanMaths.d.ts.map +1 -0
- package/lib/typescript/src/BooleanMaths.native.d.ts +3 -0
- package/lib/typescript/src/BooleanMaths.native.d.ts.map +1 -0
- package/lib/typescript/src/NativeBooleanmathsRnSdk.d.ts +22 -0
- package/lib/typescript/src/NativeBooleanmathsRnSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +47 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +189 -0
- package/src/BooleanMaths.native.tsx +86 -0
- package/src/BooleanMaths.tsx +45 -0
- package/src/NativeBooleanmathsRnSdk.ts +22 -0
- package/src/index.tsx +7 -0
- package/src/types.ts +60 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
package com.booleanmathsrnsdk
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.booleanmaths.sdk.BooleanMathsSDK
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
|
|
8
|
+
class BooleanmathsRnSdkModule(reactContext: ReactApplicationContext) :
|
|
9
|
+
NativeBooleanmathsRnSdkSpec(reactContext) {
|
|
10
|
+
|
|
11
|
+
override fun initializeSdk(apiKey: String, pixelId: String) {
|
|
12
|
+
safely("initialize") {
|
|
13
|
+
// Stamp the wrapper identity *before* initialize() so the automatic
|
|
14
|
+
// `app_opened` and `FirstOpen` events that the native SDK tracks during
|
|
15
|
+
// initialization already carry wrapper_type / wrapper_version.
|
|
16
|
+
applyWrapperConfig()
|
|
17
|
+
|
|
18
|
+
BooleanMathsSDK.initialize(
|
|
19
|
+
reactApplicationContext.applicationContext,
|
|
20
|
+
apiKey,
|
|
21
|
+
pixelId
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
// ...and again afterwards, because the native SDK can only persist the
|
|
25
|
+
// wrapper config to SharedPreferences once it holds an application
|
|
26
|
+
// context, which it only acquires inside initialize().
|
|
27
|
+
applyWrapperConfig()
|
|
28
|
+
|
|
29
|
+
// The native SDK registers its ActivityLifecycleCallbacks from within
|
|
30
|
+
// initialize(). In a React Native app that happens long after
|
|
31
|
+
// MainActivity's onActivityCreated has fired, so the intent that
|
|
32
|
+
// cold-started the app is never seen by those callbacks. Forward it
|
|
33
|
+
// explicitly here so a deep link that launched the app is attributed.
|
|
34
|
+
forwardCurrentIntent()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun trackEvent(name: String, properties: ReadableMap?) {
|
|
39
|
+
safely("trackEvent") {
|
|
40
|
+
BooleanMathsSDK.trackEvent(name, properties.toEventProperties())
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override fun handleNotificationIntent() {
|
|
45
|
+
safely("handleNotificationIntent") { forwardCurrentIntent() }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun getHelloMessage(): String = BooleanMathsSDK.getHelloMessage()
|
|
49
|
+
|
|
50
|
+
private fun applyWrapperConfig() {
|
|
51
|
+
BooleanMathsSDK.setWrapperConfig(
|
|
52
|
+
BuildConfig.WRAPPER_TYPE,
|
|
53
|
+
BuildConfig.WRAPPER_VERSION
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private fun forwardCurrentIntent() {
|
|
58
|
+
val intent = reactApplicationContext.currentActivity?.intent
|
|
59
|
+
|
|
60
|
+
if (intent == null) {
|
|
61
|
+
Log.d(TAG, "No current Activity intent available to forward.")
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// The native SDK de-duplicates intents it has already processed, so
|
|
66
|
+
// calling this more than once for the same intent is safe.
|
|
67
|
+
BooleanMathsSDK.handleNotificationIntent(intent)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Analytics must never take the host app down. Any failure is logged and
|
|
72
|
+
* swallowed rather than surfaced to JS as a thrown exception.
|
|
73
|
+
*/
|
|
74
|
+
private inline fun safely(operation: String, block: () -> Unit) {
|
|
75
|
+
try {
|
|
76
|
+
block()
|
|
77
|
+
} catch (throwable: Throwable) {
|
|
78
|
+
Log.e(TAG, "BooleanMaths $operation failed", throwable)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
companion object {
|
|
83
|
+
const val NAME = NativeBooleanmathsRnSdkSpec.NAME
|
|
84
|
+
private const val TAG = "BooleanmathsRnSdk"
|
|
85
|
+
|
|
86
|
+
/** Matches JavaScript's Number.MAX_SAFE_INTEGER. */
|
|
87
|
+
private const val MAX_SAFE_INTEGER = 9007199254740991.0
|
|
88
|
+
|
|
89
|
+
private fun ReadableMap?.toEventProperties(): Map<String, Any> =
|
|
90
|
+
if (this == null) emptyMap() else normalizeMap(toHashMap())
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Null-valued keys are dropped: the native SDK serializes properties with
|
|
94
|
+
* Gson, which omits null map values anyway, so this changes nothing about
|
|
95
|
+
* the emitted JSON.
|
|
96
|
+
*/
|
|
97
|
+
private fun normalizeMap(source: Map<*, *>): Map<String, Any> {
|
|
98
|
+
val result = LinkedHashMap<String, Any>(source.size)
|
|
99
|
+
|
|
100
|
+
for ((key, value) in source) {
|
|
101
|
+
val normalized = normalizeValue(value) ?: continue
|
|
102
|
+
result[key.toString()] = normalized
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return result
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private fun normalizeValue(value: Any?): Any? = when (value) {
|
|
109
|
+
null -> null
|
|
110
|
+
// React Native passes every JS number across the bridge as a Double, so
|
|
111
|
+
// without this an integral value would serialize as `3.0` instead of `3`.
|
|
112
|
+
is Double -> value.toWholeNumberOrSelf()
|
|
113
|
+
is Map<*, *> -> normalizeMap(value)
|
|
114
|
+
// Nulls are preserved inside lists — dropping them would shift indices.
|
|
115
|
+
is Iterable<*> -> value.map { normalizeValue(it) }
|
|
116
|
+
else -> value
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private fun Double.toWholeNumberOrSelf(): Any =
|
|
120
|
+
if (isFinite() && this % 1.0 == 0.0 && kotlin.math.abs(this) <= MAX_SAFE_INTEGER) {
|
|
121
|
+
toLong()
|
|
122
|
+
} else {
|
|
123
|
+
this
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
package com.booleanmathsrnsdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
import java.util.HashMap
|
|
9
|
+
|
|
10
|
+
class BooleanmathsRnSdkPackage : BaseReactPackage() {
|
|
11
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
12
|
+
return if (name == BooleanmathsRnSdkModule.NAME) {
|
|
13
|
+
BooleanmathsRnSdkModule(reactContext)
|
|
14
|
+
} else {
|
|
15
|
+
null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
20
|
+
mapOf(
|
|
21
|
+
BooleanmathsRnSdkModule.NAME to ReactModuleInfo(
|
|
22
|
+
name = BooleanmathsRnSdkModule.NAME,
|
|
23
|
+
className = BooleanmathsRnSdkModule.NAME,
|
|
24
|
+
canOverrideExistingModule = false,
|
|
25
|
+
needsEagerInit = false,
|
|
26
|
+
isCxxModule = false,
|
|
27
|
+
isTurboModule = true
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#import <BooleanmathsRnSdkSpec/BooleanmathsRnSdkSpec.h>
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* iOS no-op implementation of the BooleanMaths SDK.
|
|
5
|
+
*
|
|
6
|
+
* There is no native BooleanMaths iOS SDK published yet (the native SDK ships
|
|
7
|
+
* for Android only, as `com.booleanmaths:bm-sdk`). This class exists so that
|
|
8
|
+
* the TurboModule still resolves on iOS and every call degrades into a
|
|
9
|
+
* harmless no-op instead of crashing the host app.
|
|
10
|
+
*
|
|
11
|
+
* In practice these methods are never reached: the JavaScript layer gates on
|
|
12
|
+
* `Platform.OS` and returns before touching the bridge. They are implemented
|
|
13
|
+
* anyway as a backstop.
|
|
14
|
+
*
|
|
15
|
+
* When an iOS SDK becomes available, replace the bodies below and flip
|
|
16
|
+
* `SUPPORTED_PLATFORMS` in `src/BooleanMaths.native.tsx` to include 'ios'.
|
|
17
|
+
*/
|
|
18
|
+
@interface BooleanmathsRnSdk : NSObject <NativeBooleanmathsRnSdkSpec>
|
|
19
|
+
|
|
20
|
+
@end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#import "BooleanmathsRnSdk.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTLog.h>
|
|
4
|
+
|
|
5
|
+
@implementation BooleanmathsRnSdk
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Logs the "no iOS SDK" warning at most once per app launch so it is visible
|
|
9
|
+
* without flooding the console if something does call through.
|
|
10
|
+
*/
|
|
11
|
+
static void BMWarnUnsupportedOnce(void)
|
|
12
|
+
{
|
|
13
|
+
static dispatch_once_t onceToken;
|
|
14
|
+
dispatch_once(&onceToken, ^{
|
|
15
|
+
RCTLogWarn(@"[@booleanmaths/booleanmaths-rn-sdk] The BooleanMaths native SDK is not available on iOS "
|
|
16
|
+
@"(Android only for now). All SDK calls are no-ops and no events will be "
|
|
17
|
+
@"tracked on this platform.");
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
- (void)initializeSdk:(NSString *)apiKey pixelId:(NSString *)pixelId
|
|
22
|
+
{
|
|
23
|
+
BMWarnUnsupportedOnce();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
- (void)trackEvent:(NSString *)name properties:(NSDictionary *)properties
|
|
27
|
+
{
|
|
28
|
+
BMWarnUnsupportedOnce();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)handleNotificationIntent
|
|
32
|
+
{
|
|
33
|
+
// Android-only concept; nothing to do on iOS even once an iOS SDK exists.
|
|
34
|
+
BMWarnUnsupportedOnce();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (NSString *)getHelloMessage
|
|
38
|
+
{
|
|
39
|
+
BMWarnUnsupportedOnce();
|
|
40
|
+
|
|
41
|
+
// Deliberately not nil: the codegen spec declares a non-optional string.
|
|
42
|
+
return @"BooleanMaths SDK is not available on iOS";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
46
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
47
|
+
{
|
|
48
|
+
return std::make_shared<facebook::react::NativeBooleanmathsRnSdkSpecJSI>(params);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
+ (NSString *)moduleName
|
|
52
|
+
{
|
|
53
|
+
return @"BooleanmathsRnSdk";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web (and any non-React-Native) build of the SDK.
|
|
5
|
+
*
|
|
6
|
+
* There is no BooleanMaths browser SDK behind this wrapper, so every method is
|
|
7
|
+
* a no-op. It exists so that shared code can import and call the SDK
|
|
8
|
+
* unconditionally without platform checks or bundler errors.
|
|
9
|
+
*/
|
|
10
|
+
let hasWarned = false;
|
|
11
|
+
function warnOnce() {
|
|
12
|
+
if (hasWarned || typeof __DEV__ === 'undefined' || !__DEV__) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
hasWarned = true;
|
|
16
|
+
console.warn('[@booleanmaths/booleanmaths-rn-sdk] The BooleanMaths SDK has no web implementation. ' + 'All SDK calls are no-ops on web and no events will be tracked. Gate your ' + 'calls on `BooleanMaths.isSupported` to silence this warning.');
|
|
17
|
+
}
|
|
18
|
+
export const BooleanMaths = {
|
|
19
|
+
isSupported: false,
|
|
20
|
+
initialize(_apiKey, _pixelId) {
|
|
21
|
+
warnOnce();
|
|
22
|
+
},
|
|
23
|
+
trackEvent(_name, _properties) {
|
|
24
|
+
warnOnce();
|
|
25
|
+
},
|
|
26
|
+
handleNotificationIntent() {
|
|
27
|
+
warnOnce();
|
|
28
|
+
},
|
|
29
|
+
getHelloMessage() {
|
|
30
|
+
warnOnce();
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=BooleanMaths.js.map
|
|
@@ -0,0 +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/BZ,QAAQ,CAAC,CAAC;EACZ,CAAC;EAEDa,eAAeA,CAAA,EAAkB;IAC/Bb,QAAQ,CAAC,CAAC;IACV,OAAO,IAAI;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import NativeBooleanmathsRnSdk from "./NativeBooleanmathsRnSdk.js";
|
|
5
|
+
/**
|
|
6
|
+
* The BooleanMaths native SDK currently ships for Android only. There is no
|
|
7
|
+
* iOS artifact yet, so on iOS every call below short-circuits and the SDK
|
|
8
|
+
* behaves as a silent no-op rather than crashing the app.
|
|
9
|
+
*/
|
|
10
|
+
const SUPPORTED_PLATFORMS = ['android'];
|
|
11
|
+
const isPlatformSupported = SUPPORTED_PLATFORMS.includes(Platform.OS);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Both conditions must hold: a platform we ship a native SDK for, and a native
|
|
15
|
+
* module that actually resolved. The second guards against a broken/incomplete
|
|
16
|
+
* native install.
|
|
17
|
+
*/
|
|
18
|
+
const isSupported = isPlatformSupported && NativeBooleanmathsRnSdk != null;
|
|
19
|
+
let hasWarned = false;
|
|
20
|
+
function warnOnce() {
|
|
21
|
+
if (hasWarned || !__DEV__) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
hasWarned = true;
|
|
25
|
+
if (!isPlatformSupported) {
|
|
26
|
+
console.warn(`[@booleanmaths/booleanmaths-rn-sdk] The BooleanMaths native SDK is not available on ${Platform.OS} ` + '(Android only for now). All SDK calls are no-ops on this platform and no ' + 'events will be tracked. Gate your calls on `BooleanMaths.isSupported` to ' + 'silence this warning — see the README\'s "Platform support" section.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
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
|
+
}
|
|
31
|
+
export const BooleanMaths = {
|
|
32
|
+
isSupported,
|
|
33
|
+
initialize(apiKey, pixelId) {
|
|
34
|
+
if (!isSupported) {
|
|
35
|
+
warnOnce();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
NativeBooleanmathsRnSdk.initializeSdk(apiKey, pixelId);
|
|
39
|
+
},
|
|
40
|
+
trackEvent(name, properties = {}) {
|
|
41
|
+
if (!isSupported) {
|
|
42
|
+
warnOnce();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
NativeBooleanmathsRnSdk.trackEvent(name, properties);
|
|
46
|
+
},
|
|
47
|
+
handleNotificationIntent() {
|
|
48
|
+
if (!isSupported) {
|
|
49
|
+
warnOnce();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
NativeBooleanmathsRnSdk.handleNotificationIntent();
|
|
53
|
+
},
|
|
54
|
+
getHelloMessage() {
|
|
55
|
+
if (!isSupported) {
|
|
56
|
+
warnOnce();
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return NativeBooleanmathsRnSdk.getHelloMessage();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=BooleanMaths.native.js.map
|
|
@@ -0,0 +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,MAAMO,YAA6B,GAAG;EAC3CN,WAAW;EAEXO,UAAUA,CAACC,MAAc,EAAEC,OAAe,EAAQ;IAChD,IAAI,CAACT,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEe,aAAa,CAACF,MAAM,EAAEC,OAAO,CAAC;EACzD,CAAC;EAEDE,UAAUA,CAACC,IAAY,EAAEC,UAAuC,GAAG,CAAC,CAAC,EAAQ;IAC3E,IAAI,CAACb,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEgB,UAAU,CAACC,IAAI,EAAEC,UAAU,CAAC;EACvD,CAAC;EAEDC,wBAAwBA,CAAA,EAAS;IAC/B,IAAI,CAACd,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV;IACF;IAEAP,uBAAuB,CAAEmB,wBAAwB,CAAC,CAAC;EACrD,CAAC;EAEDC,eAAeA,CAAA,EAAkB;IAC/B,IAAI,CAACf,WAAW,EAAE;MAChBE,QAAQ,CAAC,CAAC;MACV,OAAO,IAAI;IACb;IAEA,OAAOP,uBAAuB,CAAEoB,eAAe,CAAC,CAAC;EACnD;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
/**
|
|
5
|
+
* `get` rather than `getEnforcing` so that a missing/unlinked native module
|
|
6
|
+
* degrades to a warning instead of throwing at import time.
|
|
7
|
+
*/
|
|
8
|
+
export default TurboModuleRegistry.get('BooleanmathsRnSdk');
|
|
9
|
+
//# sourceMappingURL=NativeBooleanmathsRnSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeBooleanmathsRnSdk.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAiBpE;AACA;AACA;AACA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BooleanMaths","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASA,YAAY,IAAIC,OAAO,QAAQ,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +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,eAmB1B,CAAC"}
|
|
@@ -0,0 +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;AA6C5E,eAAO,MAAM,YAAY,EAAE,eAsC1B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
/**
|
|
4
|
+
* Named `initializeSdk` rather than `initialize` on purpose: `initialize` is
|
|
5
|
+
* already taken by `NativeModule.initialize()` on Android and by
|
|
6
|
+
* `+[NSObject initialize]` on iOS. The public JS API exposes this as
|
|
7
|
+
* `BooleanMaths.initialize()`.
|
|
8
|
+
*/
|
|
9
|
+
initializeSdk(apiKey: string, pixelId: string): void;
|
|
10
|
+
trackEvent(name: string, properties: Object): void;
|
|
11
|
+
/** Android only. No-op elsewhere. */
|
|
12
|
+
handleNotificationIntent(): void;
|
|
13
|
+
/** Smoke test that the native bridge is wired up. */
|
|
14
|
+
getHelloMessage(): string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* `get` rather than `getEnforcing` so that a missing/unlinked native module
|
|
18
|
+
* degrades to a warning instead of throwing at import time.
|
|
19
|
+
*/
|
|
20
|
+
declare const _default: Spec | null | undefined;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=NativeBooleanmathsRnSdk.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EACV,eAAe,EACf,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,YAAS,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values allowed inside an event's `properties` payload.
|
|
3
|
+
*
|
|
4
|
+
* The payload is serialized to JSON natively, so only JSON-representable
|
|
5
|
+
* values survive the bridge. Nested objects and arrays are supported.
|
|
6
|
+
*/
|
|
7
|
+
export type BooleanMathsPropertyValue = string | number | boolean | null | undefined | BooleanMathsPropertyValue[] | {
|
|
8
|
+
[key: string]: BooleanMathsPropertyValue;
|
|
9
|
+
};
|
|
10
|
+
export type BooleanMathsEventProperties = Record<string, BooleanMathsPropertyValue>;
|
|
11
|
+
export interface BooleanMathsApi {
|
|
12
|
+
/**
|
|
13
|
+
* Initializes the native SDK. Safe to call on any platform; on platforms
|
|
14
|
+
* without native support this is a no-op (see `isSupported`).
|
|
15
|
+
*
|
|
16
|
+
* Calling this more than once is harmless — the native SDK ignores
|
|
17
|
+
* subsequent calls.
|
|
18
|
+
*/
|
|
19
|
+
initialize(apiKey: string, pixelId: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Records a custom event. Events are persisted locally and synced in the
|
|
22
|
+
* background, so this never blocks and never throws on network failure.
|
|
23
|
+
*
|
|
24
|
+
* No-op if `initialize` has not been called.
|
|
25
|
+
*/
|
|
26
|
+
trackEvent(name: string, properties?: BooleanMathsEventProperties): void;
|
|
27
|
+
/**
|
|
28
|
+
* Forwards the current Activity's intent to the native SDK so deep-link and
|
|
29
|
+
* notification campaign data is attributed.
|
|
30
|
+
*
|
|
31
|
+
* Android only — a no-op on every other platform. Call this from your
|
|
32
|
+
* deep-link handler and once after `initialize`; see the README for why the
|
|
33
|
+
* launch intent needs this.
|
|
34
|
+
*/
|
|
35
|
+
handleNotificationIntent(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the native SDK's hello message, or `null` when there is no native
|
|
38
|
+
* SDK on this platform. Useful as a bridge smoke test.
|
|
39
|
+
*/
|
|
40
|
+
getHelloMessage(): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* `true` only on platforms where a real BooleanMaths native SDK is linked.
|
|
43
|
+
* Currently Android only.
|
|
44
|
+
*/
|
|
45
|
+
readonly isSupported: boolean;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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;;;;;;;OAOG;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"}
|