@log-drop/react-native 2.0.6 → 2.0.8

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.
@@ -22,5 +22,5 @@ if respond_to?(:install_modules_dependencies, true)
22
22
  else
23
23
  s.dependency "React-Core"
24
24
  end
25
- s.dependency 'LogDrop', '2.1.4'
25
+ s.dependency 'LogDrop', '2.1.8'
26
26
  end
package/README.md CHANGED
@@ -250,7 +250,7 @@ Add LogDrop to the extension target and run `pod install`:
250
250
 
251
251
  ```ruby
252
252
  target 'LogDropNotificationServiceExtension' do
253
- pod 'LogDrop', '2.1.3'
253
+ pod 'LogDrop', '2.1.8'
254
254
  end
255
255
  ```
256
256
 
@@ -286,6 +286,56 @@ Forces the SDK to send any cached logs immediately.
286
286
 
287
287
  ---
288
288
 
289
+ ### `LogDrop.trackCustomEvent(eventName: string, properties?: Record<string, unknown>): void`
290
+ Tracks an application-specific event with an optional JSON-compatible
291
+ properties object. Event and property codes shown in the panel are managed by
292
+ LogDrop.
293
+
294
+ ```ts
295
+ LogDrop.trackCustomEvent('purchase_completed', {
296
+ coupon_code: 'SUMMER10',
297
+ amount: 49.9,
298
+ item_count: 2,
299
+ is_first_order: true,
300
+ });
301
+
302
+ LogDrop.trackCustomEvent('onboarding_completed');
303
+ ```
304
+
305
+ Supported values are strings, numbers, booleans, null, nested objects, and
306
+ arrays. Object keys must be strings. Convert JavaScript `Date` instances to
307
+ ISO-8601 strings before passing them through the native-module bridge:
308
+
309
+ ```ts
310
+ LogDrop.trackCustomEvent('product_viewed', {
311
+ sku: 'LD-100',
312
+ viewed_at: new Date().toISOString(),
313
+ product: { name: 'LogDrop Hoodie', price: 79.95 },
314
+ categories: ['merch', 'hoodies'],
315
+ campaign: null,
316
+ });
317
+ ```
318
+
319
+ Use stable event names and keep each property's type consistent. Do not place
320
+ IDs or timestamps in an event name and do not reuse a LogDrop default event
321
+ name. Reusing the same custom event name updates the same schema; changing the
322
+ name creates a different custom event. If a property is later sent with another
323
+ type, LogDrop keeps the event but marks a type conflict in the panel.
324
+
325
+ Limits and validation:
326
+
327
+ - Event and property names must not be empty and can contain up to **128 characters**.
328
+ - One event can contain up to **100 top-level properties**.
329
+ - The complete properties JSON can contain up to **16 KB in UTF-8**.
330
+ - Property values must be JSON-compatible.
331
+
332
+ If validation fails, the native SDK rejects the complete event, logs the reason,
333
+ and never silently truncates names, properties, or payloads. No event definition
334
+ is required before tracking; the first valid event creates its schema in the
335
+ LogDrop panel.
336
+
337
+ ---
338
+
289
339
  ### `LogDrop.trackDeepLink(url: string): void`
290
340
  Tracks a deep link or universal link URL in the native LogDrop SDK.
291
341
 
@@ -315,6 +365,31 @@ LogDrop.userUpdate("user_123");
315
365
 
316
366
  ---
317
367
 
368
+ ### `LogDrop.setCustomAttributes(attributes: Record<string, string>): void`
369
+ Adds or updates custom user attributes used for push notification segmentation.
370
+ The call is an additive upsert, so attributes not included in the call remain
371
+ unchanged.
372
+
373
+ ```ts
374
+ LogDrop.setCustomAttributes({
375
+ plan: 'premium',
376
+ country: 'TR',
377
+ });
378
+ ```
379
+
380
+ ### `LogDrop.removeCustomAttribute(key: string): void`
381
+ Removes one custom user attribute and syncs the deletion with LogDrop.
382
+
383
+ ```ts
384
+ LogDrop.removeCustomAttribute('plan');
385
+ ```
386
+
387
+ Attribute keys must match `[A-Za-z0-9_-]+` and be at most 64 characters.
388
+ Values must be non-blank and at most 256 characters. A user can have at most 30
389
+ attributes. Invalid mutations are rejected as a whole by the native SDK.
390
+
391
+ ---
392
+
318
393
  ### Logging Methods
319
394
 
320
395
  These correspond to standard log levels.
@@ -77,6 +77,5 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
77
77
  dependencies {
78
78
  implementation "com.facebook.react:react-android"
79
79
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
80
- implementation "io.logdrop:sdk:2.1.3"
80
+ implementation "io.logdrop:sdk:2.1.8"
81
81
  }
82
-
@@ -37,7 +37,7 @@ class LogDropReactNativeModule(reactContext: ReactApplicationContext) :
37
37
 
38
38
  @ReactMethod
39
39
  fun showPendingPushPopup(promise: Promise) {
40
- val activity = currentActivity
40
+ val activity = reactApplicationContext.currentActivity
41
41
  if (activity == null) {
42
42
  promise.reject("NO_ACTIVITY", "Cannot show a push popup without an active Activity")
43
43
  return
@@ -51,9 +51,14 @@ class LogDropReactNativeModule(reactContext: ReactApplicationContext) :
51
51
  LogDrop.sendLogs()
52
52
  }
53
53
 
54
+ @ReactMethod
55
+ fun trackCustomEvent(eventName: String, properties: ReadableMap?) {
56
+ LogDrop.trackCustomEvent(eventName, properties?.toHashMap() ?: emptyMap())
57
+ }
58
+
54
59
  @ReactMethod
55
60
  fun trackDeepLink(url: String) {
56
- LogDropReactNative.trackDeepLink(url, currentActivity)
61
+ LogDropReactNative.trackDeepLink(url, reactApplicationContext.currentActivity)
57
62
  }
58
63
 
59
64
  @ReactMethod
@@ -66,6 +71,20 @@ class LogDropReactNativeModule(reactContext: ReactApplicationContext) :
66
71
  LogDrop.userUpdate(userId)
67
72
  }
68
73
 
74
+ @ReactMethod
75
+ fun setCustomAttributes(readableMap: ReadableMap) {
76
+ val rawAttributes = readableMap.toHashMap()
77
+ if (rawAttributes.values.any { it !is String }) return
78
+
79
+ val attributes = rawAttributes.mapValues { it.value as String }
80
+ LogDrop.setCustomAttributes(attributes)
81
+ }
82
+
83
+ @ReactMethod
84
+ fun removeCustomAttribute(key: String) {
85
+ LogDrop.removeCustomAttribute(key)
86
+ }
87
+
69
88
  @ReactMethod
70
89
  fun e(tag: String, message: String, logFlow: ReadableMap?) {
71
90
  val logFlowObject = readableMapToLogFlow(logFlow)
@@ -15,7 +15,11 @@ RCT_EXTERN_METHOD(i:(NSString *)tag message:(NSString *)message logFlow:(NSDicti
15
15
  RCT_EXTERN_METHOD(d:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
16
16
  RCT_EXTERN_METHOD(w:(NSString *)tag message:(NSString *)message logFlow:(NSDictionary * _Nullable)logFlow)
17
17
  RCT_EXTERN_METHOD(userUpdate:(NSString *)userUuid)
18
+ RCT_EXTERN_METHOD(setCustomAttributes:(NSDictionary *)attributes)
19
+ RCT_EXTERN_METHOD(removeCustomAttribute:(NSString *)key)
18
20
  RCT_EXTERN_METHOD(sendLogs)
21
+ RCT_EXTERN_METHOD(trackCustomEvent:(NSString *)eventName
22
+ properties:(NSDictionary * _Nullable)properties)
19
23
  RCT_EXTERN_METHOD(trackDeepLink:(NSString *)urlString)
20
24
  RCT_EXTERN_METHOD(saveCustomCrashReport:(NSString *)threadName
21
25
  stackTrace:(NSString *)stackTrace
@@ -116,12 +116,31 @@ class LogDropReactNative: NSObject {
116
116
  func userUpdate(_ userUuid: String) {
117
117
  LogDrop.updateUser(userUuid: userUuid)
118
118
  }
119
+
120
+ @objc
121
+ func setCustomAttributes(_ attributes: NSDictionary) {
122
+ guard let customAttributes = attributes as? [String: String] else { return }
123
+ LogDrop.setCustomAttributes(customAttributes)
124
+ }
125
+
126
+ @objc
127
+ func removeCustomAttribute(_ key: String) {
128
+ LogDrop.removeCustomAttribute(key: key)
129
+ }
119
130
 
120
131
  @objc
121
132
  func sendLogs() {
122
133
  LogDrop.sendLogs()
123
134
  }
124
135
 
136
+ @objc
137
+ func trackCustomEvent(_ eventName: String, properties: NSDictionary?) {
138
+ LogDrop.trackCustomEvent(
139
+ eventName: eventName,
140
+ properties: properties as? [String: Any] ?? [:]
141
+ )
142
+ }
143
+
125
144
  @objc
126
145
  func trackDeepLink(_ urlString: String) {
127
146
  guard let url = URL(string: urlString.trimmingCharacters(in: .whitespacesAndNewlines)) else {
@@ -67,6 +67,11 @@ export default class LogDrop {
67
67
  static sendLogs = () => {
68
68
  LogDropReactNative.sendLogs();
69
69
  };
70
+
71
+ /** Tracks a customer-defined event with JSON-compatible properties. */
72
+ static trackCustomEvent = (eventName, properties = {}) => {
73
+ LogDropReactNative.trackCustomEvent(eventName, properties);
74
+ };
70
75
  static trackDeepLink = url => {
71
76
  LogDropReactNative.trackDeepLink?.(url);
72
77
  };
@@ -76,6 +81,16 @@ export default class LogDrop {
76
81
  static userUpdate = userId => {
77
82
  LogDropReactNative.userUpdate(userId);
78
83
  };
84
+
85
+ /** Adds or updates custom user attributes used for push segmentation. */
86
+ static setCustomAttributes = attributes => {
87
+ LogDropReactNative.setCustomAttributes(attributes);
88
+ };
89
+
90
+ /** Removes a custom user attribute used for push segmentation. */
91
+ static removeCustomAttribute = key => {
92
+ LogDropReactNative.removeCustomAttribute(key);
93
+ };
79
94
  static e = (tag, message, logFlow) => {
80
95
  LogDropReactNative.e(tag, message, logFlow);
81
96
  };
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","LogDropErrorTracking","LogDropReactNative","LogDropPopupShowResult","LogDrop","init","config","OS","initLogDrop","start","onRemoteMessageReceived","message","onNewFcmPushToken","token","onNewHmsPushToken","onNewApnsToken","isLogDropPush","showPendingPushPopup","NotInitialized","result","Shown","NothingToShow","sendLogs","trackDeepLink","url","setAppId","appId","userUpdate","userId","e","tag","logFlow","d","i","w"],"sourceRoot":"../../src","sources":["LogDrop.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,iCAA8B;AAGnE,SAASC,kBAAkB,QAAQ,yBAAsB;AAEzD,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAMlC,eAAe,MAAMC,OAAO,CAAC;EAC3B,OAAOC,IAAI,GAAIC,MAAqB,IAAW;IAC7C,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAIP,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MACtDL,kBAAkB,CAACM,WAAW,GAAGF,MAAM,CAAC;MACxCL,oBAAoB,CAACQ,KAAK,CAAC,CAAC;IAC9B;EACF,CAAC;EAED,OAAOC,u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","LogDropErrorTracking","LogDropReactNative","LogDropPopupShowResult","LogDrop","init","config","OS","initLogDrop","start","onRemoteMessageReceived","message","onNewFcmPushToken","token","onNewHmsPushToken","onNewApnsToken","isLogDropPush","showPendingPushPopup","NotInitialized","result","Shown","NothingToShow","sendLogs","trackCustomEvent","eventName","properties","trackDeepLink","url","setAppId","appId","userUpdate","userId","setCustomAttributes","attributes","removeCustomAttribute","key","e","tag","logFlow","d","i","w"],"sourceRoot":"../../src","sources":["LogDrop.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,oBAAoB,QAAQ,iCAA8B;AAGnE,SAASC,kBAAkB,QAAQ,yBAAsB;AAEzD,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAMlC,eAAe,MAAMC,OAAO,CAAC;EAC3B,OAAOC,IAAI,GAAIC,MAAqB,IAAW;IAC7C,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAIP,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MACtDL,kBAAkB,CAACM,WAAW,GAAGF,MAAM,CAAC;MACxCL,oBAAoB,CAACQ,KAAK,CAAC,CAAC;IAC9B;EACF,CAAC;EAED,OAAOC,uBAAuB,GAAIC,OAEjC,IAAW;IACV,IAAIX,QAAQ,CAACO,EAAE,KAAK,KAAK,IAAIP,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MACtDL,kBAAkB,CAACQ,uBAAuB,CAACC,OAAO,CAAC;IACrD;EACF,CAAC;EAED,OAAOC,iBAAiB,GAAIC,KAAa,IAAW;IAClD,IAAIb,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7BL,kBAAkB,CAACU,iBAAiB,CAACC,KAAK,CAAC;IAC7C;EACF,CAAC;EAED,OAAOC,iBAAiB,GAAID,KAAa,IAAW;IAClD,IAA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Drop {
19
19
  }) => Promise<boolean>;
20
20
  static showPendingPushPopup: () => Promise<LogDropPopupShowResult>;
21
21
  static sendLogs: () => void;
22
+ /** Tracks a customer-defined event with JSON-compatible properties. */
23
+ static trackCustomEvent: (eventName: string, properties?: Record<string, unknown>) => void;
22
24
  static trackDeepLink: (url: string) => void;
23
25
  static setAppId: (appId: string) => void;
24
26
  static userUpdate: (userId: string) => void;
27
+ /** Adds or updates custom user attributes used for push segmentation. */
28
+ static setCustomAttributes: (attributes: Record<string, string>) => void;
29
+ /** Removes a custom user attribute used for push segmentation. */
30
+ static removeCustomAttribute: (key: string) => void;
25
31
  static e: (tag: string, message: string, logFlow?: LogFlow) => void;
26
32
  static d: (tag: string, message: string, logFlow?: LogFlow) => void;
27
33
  static i: (tag: string, message: string, logFlow?: LogFlow) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"LogDrop.d.ts","sourceRoot":"","sources":["../../../src/LogDrop.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,OAAO,MAAM,WAAW,CAAC;AAGhC,oBAAY,sBAAsB;IAChC,KAAK,UAAU;IACf,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;CAClC;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,MAAM,CAAC,IAAI,GAAI,QAAQ,aAAa,KAAG,IAAI,CAKzC;IAEF,MAAM,CAAC,uBAAuB,GAAI,SAAS;QACzC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,KAAG,IAAI,CAIN;IAEF,MAAM,CAAC,iBAAiB,GAAI,OAAO,MAAM,KAAG,IAAI,CAI9C;IAEF,MAAM,CAAC,iBAAiB,GAAI,OAAO,MAAM,KAAG,IAAI,CAI9C;IAEF,iFAAiF;IACjF,MAAM,CAAC,cAAc,GAAI,OAAO,MAAM,KAAG,IAAI,CAI3C;IAEF,MAAM,CAAC,aAAa,GAAU,SAAS;QACrC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CAEhE;IAEF,MAAM,CAAC,CAAC,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,UAAU,OAAO,KAAG,IAAI,CAEhE;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@log-drop/react-native",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "LogDrop React Native SDK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
package/src/LogDrop.ts CHANGED
@@ -81,6 +81,14 @@ export default class LogDrop {
81
81
  LogDropReactNative.sendLogs();
82
82
  };
83
83
 
84
+ /** Tracks a customer-defined event with JSON-compatible properties. */
85
+ static trackCustomEvent = (
86
+ eventName: string,
87
+ properties: Record<string, unknown> = {}
88
+ ): void => {
89
+ LogDropReactNative.trackCustomEvent(eventName, properties);
90
+ };
91
+
84
92
  static trackDeepLink = (url: string): void => {
85
93
  LogDropReactNative.trackDeepLink?.(url);
86
94
  };
@@ -93,6 +101,16 @@ export default class LogDrop {
93
101
  LogDropReactNative.userUpdate(userId);
94
102
  };
95
103
 
104
+ /** Adds or updates custom user attributes used for push segmentation. */
105
+ static setCustomAttributes = (attributes: Record<string, string>): void => {
106
+ LogDropReactNative.setCustomAttributes(attributes);
107
+ };
108
+
109
+ /** Removes a custom user attribute used for push segmentation. */
110
+ static removeCustomAttribute = (key: string): void => {
111
+ LogDropReactNative.removeCustomAttribute(key);
112
+ };
113
+
96
114
  static e = (tag: string, message: string, logFlow?: LogFlow): void => {
97
115
  LogDropReactNative.e(tag, message, logFlow);
98
116
  };