@goliapkg/sentori-react-native 6.2.1 → 6.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.
Files changed (33) hide show
  1. package/android/build.gradle +6 -0
  2. package/android/src/main/java-core/com/sentori/Sentori.kt +33 -4
  3. package/android/src/main/java-core/com/sentori/SentoriAttachment.kt +153 -0
  4. package/android/src/main/java-core/com/sentori/SentoriConfig.kt +1 -1
  5. package/android/src/main/java-core/com/sentori/SentoriCrashHandler.kt +19 -0
  6. package/android/src/main/java-core/com/sentori/SentoriFirebaseMessagingService.kt +15 -0
  7. package/android/src/main/java-core/com/sentori/SentoriNotificationTap.kt +148 -0
  8. package/android/src/main/java-core/com/sentori/SentoriPendingCrash.kt +154 -0
  9. package/android/src/main/java-core/com/sentori/SentoriPush.kt +242 -13
  10. package/android/src/main/java-core/com/sentori/SentoriPushNotifications.kt +168 -17
  11. package/android/src/main/java-core/com/sentori/SentoriScope.kt +49 -2
  12. package/android/src/main/java-core/com/sentori/SentoriTransport.kt +95 -2
  13. package/android/src/test/java-core/com/sentori/SentoriAttachmentTest.kt +413 -0
  14. package/android/src/test/java-core/com/sentori/SentoriLiveServerTest.kt +43 -0
  15. package/android/src/test/java-core/com/sentori/SentoriPendingCrashTest.kt +194 -0
  16. package/android/src/test/java-core/com/sentori/SentoriPushTest.kt +556 -0
  17. package/ios/core/SentoriAttachment.swift +129 -0
  18. package/ios/core/SentoriCrashHandler.swift +15 -0
  19. package/ios/core/SentoriPushNotifications.swift +8 -0
  20. package/lib/push.d.ts.map +1 -1
  21. package/lib/push.js +155 -1
  22. package/lib/push.js.map +1 -1
  23. package/lib/scope.d.ts +6 -0
  24. package/lib/scope.d.ts.map +1 -1
  25. package/lib/scope.js +45 -1
  26. package/lib/scope.js.map +1 -1
  27. package/lib/transport.js +1 -1
  28. package/package.json +2 -2
  29. package/src/__tests__/push.test.ts +203 -1
  30. package/src/push.ts +147 -1
  31. package/src/scope.ts +50 -1
  32. package/src/transport.ts +1 -1
  33. package/ios/core/SentoriPush.swift +0 -340
@@ -0,0 +1,129 @@
1
+ // GENERATED MIRROR — do not edit.
2
+ // Source of truth: sdk/native/ios/Sources/Sentori/SentoriAttachment.swift
3
+ // Run `node scripts/sync-native-core.mjs` after editing it.
4
+ import Foundation
5
+
6
+ /// Blobs that belong to an event: the screenshot taken as the app
7
+ /// died, the wireframe replay ring behind it.
8
+ ///
9
+ /// They upload *after* the event, never before. The server keys an
10
+ /// attachment on an event id it must already know, so an upload that
11
+ /// races the batch 404s — and it always wins that race, because the
12
+ /// batch waits for a flush and the upload does not.
13
+ ///
14
+ /// The multipart body is built by hand rather than with a form API.
15
+ /// React Native learned that the expensive way: its `FormData` file
16
+ /// part wants a `uri`, the `data:` form throws a bare network error on
17
+ /// iOS, and every JS attachment died silently for a release. Doing it
18
+ /// literally is both shorter and checkable.
19
+ enum SentoriAttachment {
20
+
21
+ /// The kinds the server's CHECK constraint accepts, from
22
+ /// `handlers/sdk/events_attachments.rs`. Anything else is a 400,
23
+ /// so it is dropped here with the round trip saved.
24
+ ///
25
+ /// This list is worth keeping honest: the first version of it had
26
+ /// three entries, and the crash handler's view tree — written on
27
+ /// both platforms, kind `viewTree` — was not one of them. It
28
+ /// would have been dropped on the way out by the very code meant
29
+ /// to deliver it, silently, with the event arriving intact and
30
+ /// the evidence missing.
31
+ static let known: Set<String> = [
32
+ "logTail", "replay", "screens", "screenshot",
33
+ "sessionTrail", "stateSnapshot", "viewTree",
34
+ ]
35
+
36
+ /// `android` | `ios` | `js`, likewise CHECK-constrained.
37
+ static let knownSources: Set<String> = ["android", "ios", "js"]
38
+
39
+ /// Test seam: capture instead of sending.
40
+ ///
41
+ /// What is worth asserting here is *what* would be uploaded and
42
+ /// *when* — the kind, the event it is keyed on, the body, and
43
+ /// that none of it moves before the batch lands. None of that is
44
+ /// about TCP. The wire itself is covered by `ios-live-ingest`,
45
+ /// which posts to a real server and reads the blob back.
46
+ static var recorderForTests: ((String, String, String) -> Void)?
47
+
48
+ /// Upload one blob against an event the server already has.
49
+ ///
50
+ /// Fire and forget: nothing here reaches the caller, and a
51
+ /// failure costs the attachment rather than the crash report it
52
+ /// belongs to.
53
+ static func upload(
54
+ eventId: String,
55
+ kind: String,
56
+ base64: String,
57
+ mediaType: String,
58
+ source: String = "ios",
59
+ completion: ((Bool) -> Void)? = nil
60
+ ) {
61
+ guard let config = SentoriConfig.current, known.contains(kind),
62
+ knownSources.contains(source),
63
+ let encodedId = eventId.addingPercentEncoding(
64
+ withAllowedCharacters: .urlPathAllowed),
65
+ let url = URL(
66
+ string: "\(config.ingestUrl)/v1/events/\(encodedId)/attachments/\(kind)")
67
+ else {
68
+ completion?(false)
69
+ return
70
+ }
71
+
72
+ let boundary = "----sentori-\(eventId)"
73
+ if let record = recorderForTests {
74
+ record(
75
+ eventId, kind,
76
+ multipartBody(
77
+ boundary: boundary, kind: kind, mediaType: mediaType, base64: base64,
78
+ source: source))
79
+ completion?(true)
80
+ return
81
+ }
82
+ var body = ""
83
+ body += "--\(boundary)\r\n"
84
+ body += "Content-Disposition: form-data; name=\"file\"; filename=\"\(kind).bin\"\r\n"
85
+ body += "Content-Type: \(mediaType)\r\n"
86
+ // The server decodes when told to. Without this header it
87
+ // stores the base64 text as the image, which renders as
88
+ // nothing and looks like a capture problem.
89
+ body += "Content-Transfer-Encoding: base64\r\n"
90
+ body += "\r\n\(base64)\r\n"
91
+ body += "--\(boundary)\r\n"
92
+ body += "Content-Disposition: form-data; name=\"source\"\r\n"
93
+ body += "\r\n\(source)\r\n"
94
+ body += "--\(boundary)--\r\n"
95
+
96
+ var request = URLRequest(url: url)
97
+ request.httpMethod = "POST"
98
+ request.setValue(
99
+ "multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
100
+ request.setValue("Bearer \(config.token)", forHTTPHeaderField: "Authorization")
101
+ request.setValue("swift/\(SentoriVersion.current)", forHTTPHeaderField: "Sentori-Sdk")
102
+ request.httpBody = body.data(using: .utf8)
103
+ request.timeoutInterval = 30
104
+
105
+ URLSession.shared.dataTask(with: request) { _, response, _ in
106
+ let code = (response as? HTTPURLResponse)?.statusCode ?? 0
107
+ completion?((200..<300).contains(code))
108
+ }.resume()
109
+ }
110
+
111
+ /// The multipart body, exposed so a test can read what would go
112
+ /// on the wire. Building it correctly is the whole job here, and
113
+ /// the failure mode is a 2xx that stored the wrong bytes.
114
+ static func multipartBody(
115
+ boundary: String, kind: String, mediaType: String, base64: String, source: String
116
+ ) -> String {
117
+ var body = ""
118
+ body += "--\(boundary)\r\n"
119
+ body += "Content-Disposition: form-data; name=\"file\"; filename=\"\(kind).bin\"\r\n"
120
+ body += "Content-Type: \(mediaType)\r\n"
121
+ body += "Content-Transfer-Encoding: base64\r\n"
122
+ body += "\r\n\(base64)\r\n"
123
+ body += "--\(boundary)\r\n"
124
+ body += "Content-Disposition: form-data; name=\"source\"\r\n"
125
+ body += "\r\n\(source)\r\n"
126
+ body += "--\(boundary)--\r\n"
127
+ return body
128
+ }
129
+ }
@@ -80,6 +80,21 @@ import MachO
80
80
  write(exception: exception)
81
81
  }
82
82
 
83
+ /// Test-only seam that writes a crash file verbatim.
84
+ ///
85
+ /// `persistForTesting(exception:)` goes through `write`, which
86
+ /// composes the file from a live exception and a live screen —
87
+ /// neither of which an XCTest can arrange. Delivery tests need to
88
+ /// state the file they are about to deliver, particularly the
89
+ /// pre-death attachments, which only exist when there was a
90
+ /// window to capture.
91
+ internal static func persistRawForTesting(_ event: [String: Any]) {
92
+ guard let dir = pendingDir(),
93
+ let data = try? JSONSerialization.data(withJSONObject: event)
94
+ else { return }
95
+ try? data.write(to: dir.appendingPathComponent("\(UUID().uuidString.lowercased()).json"))
96
+ }
97
+
83
98
  private static func write(exception: NSException) {
84
99
  let cfg = config()
85
100
  let release = (cfg["release"] as? String) ?? "unknown"
@@ -138,9 +138,17 @@ import ObjectiveC.runtime
138
138
  @objc public func handleRegisteredToken(_ deviceToken: Data) {
139
139
  let hex = deviceToken.map { String(format: "%02x", $0) }.joined()
140
140
  bufferLock.lock()
141
+ let changed = tokenHex != nil && tokenHex != hex
141
142
  tokenHex = hex
142
143
  registrationError = nil
143
144
  bufferLock.unlock()
145
+
146
+ // A token that replaced a different one is a rotation, and the
147
+ // server has to hear about it now. Buffering it in a field was
148
+ // the whole of what happened here before, so a rotation stayed
149
+ // invisible until the host next called `register` — and the
150
+ // device received nothing in between.
151
+ if changed { Sentori.push.handleRotatedToken(hex) }
144
152
  }
145
153
 
146
154
  /// Host-callable counterpart for the failure path.
package/lib/push.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAqCA,OAAO,EAEL,aAAa,EAEb,qBAAqB,EAEtB,MAAM,aAAa,CAAA;AAqBpB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;mEAM+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;kDAC8C;IAC9C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAA;IACtD,sDAAsD;IACtD,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/B;iEAC6D;IAC7D,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B;;yBAEqB;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;IAC9B;;;kBAGc;IACd,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,cAAc,GACd,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,CAAA;AAEnB;;;;mCAImC;AACnC,MAAM,MAAM,kBAAkB,GAC1B;IACE,EAAE,EAAE,IAAI,CAAA;IACR;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AsB,QAAQ,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyC1F;AAgDD;;;GAGG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBhD;AAED;4DAC4D;AAC5D,wBAAgB,YAAY,IAAI,IAAI,GAAG,MAAM,CAE5C;AAED,sDAAsD;AACtD,OAAO,EAAE,aAAa,IAAI,SAAS,EAAE,qBAAqB,IAAI,iBAAiB,EAAE,CAAA;AAuQjF;oEACoE;AACpE,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAEhE;AA4HD;;+DAE+D;AAC/D,wBAAgB,eAAe,IAAI,IAAI,CAWtC;AAID;qCACqC;AACrC,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAEnF"}
package/lib/push.js CHANGED
@@ -21,10 +21,27 @@
21
21
  // buffered events while the app is foreground. Pauses on
22
22
  // background, resumes on active, per the perf iron rule.
23
23
  import { logger, pushSignal } from '@goliapkg/sentori-core';
24
- import { currentUserKey } from './scope.js';
24
+ import { currentUserKey, currentUserTraits, onIdentityChange } from './scope.js';
25
25
  import { pushDrainState, pushGetStatus, pushRegister as nativePushRegister, pushRequestPermission, pushUnregister as nativePushUnregister, } from './native.js';
26
26
  const STORAGE_KEY = 'sentori.push.ipt';
27
+ /// Which installation this is.
28
+ ///
29
+ /// Minted once and kept, so the server can key the device row on it
30
+ /// rather than on the vendor's token. Without one a rotation writes a
31
+ /// *new* row under a *new* spToken, and every backend holding the old
32
+ /// one is addressing nothing — with nothing to tell it. The native
33
+ /// SDKs were given this; this package registers from JS and was not.
34
+ const INSTALL_KEY = 'sentori.push.install';
27
35
  let _cachedIpt = null;
36
+ // The last token the vendor handed us, kept so a sign-in can re-send
37
+ // the registration without asking the OS for a token again.
38
+ let _lastNativeToken = null;
39
+ let _lastOptions = {};
40
+ // What the server was last told. A re-registration that would send
41
+ // the same thing is not sent: `user()` is a verb an app may call on
42
+ // every screen, and one HTTP request per call is not free to a host.
43
+ let _lastSentIdentity = null;
44
+ let _installId = null;
28
45
  let _drainInterval = null;
29
46
  let _appStateSubscription = null;
30
47
  let _backgrounded = false;
@@ -77,9 +94,13 @@ export async function register(opts = {}) {
77
94
  const token = await waitForToken(opts.tokenTimeoutMs ?? 8000);
78
95
  const ipt = await registerWithServer(cfg, token, opts);
79
96
  _cachedIpt = ipt;
97
+ _lastNativeToken = token;
98
+ _lastOptions = opts;
80
99
  void persistIpt(ipt);
81
100
  opts.onToken?.(ipt);
82
101
  bindBufferDrain(opts.onMessage, opts.onTap);
102
+ // From here on, signing in or out updates the row by itself.
103
+ onIdentityChange(reRegisterAfterIdentityChange);
83
104
  return { ok: true, ipt };
84
105
  }
85
106
  catch (e) {
@@ -95,6 +116,30 @@ function fail(opts, reason, message) {
95
116
  opts.onError?.(new Error(message));
96
117
  return { ok: false, message, reason };
97
118
  }
119
+ /**
120
+ * Send the registration again because the person changed.
121
+ *
122
+ * Only for a device that has already registered — the vendor token is
123
+ * the evidence, the same rule the native SDKs use for a rotated
124
+ * token. Nothing here throws and nothing here is awaited by the host:
125
+ * `user()` is synchronous and stays that way.
126
+ */
127
+ function reRegisterAfterIdentityChange() {
128
+ const token = _lastNativeToken;
129
+ const cfg = tryGetRuntimeConfig();
130
+ if (token == null || cfg == null)
131
+ return;
132
+ const identity = JSON.stringify([currentUserKey() ?? null, currentUserTraits() ?? null]);
133
+ if (identity === _lastSentIdentity)
134
+ return;
135
+ _lastSentIdentity = identity;
136
+ void registerWithServer(cfg, token, _lastOptions).catch((e) => {
137
+ // A failed update leaves the row pointing at the previous person,
138
+ // so the next change must be allowed to try again.
139
+ _lastSentIdentity = null;
140
+ logger.warn('push', 'updating the device after a sign-in failed', e);
141
+ });
142
+ }
98
143
  /** Internal carrier so the helpers below can name which failure they
99
144
  * are without every one of them returning a result object. */
100
145
  class PushRegisterError extends Error {
@@ -124,6 +169,9 @@ export async function unregister() {
124
169
  }
125
170
  }
126
171
  nativePushUnregister();
172
+ onIdentityChange(undefined);
173
+ _lastNativeToken = null;
174
+ _lastSentIdentity = null;
127
175
  _cachedIpt = null;
128
176
  void clearPersistedIpt();
129
177
  teardownBufferDrain();
@@ -179,6 +227,10 @@ async function registerWithServer(cfg, nativeToken, opts) {
179
227
  // `kind`, not `provider` — the server's field name, which this
180
228
  // sent for a year as `provider` and got a 422 for every time.
181
229
  const body = {
230
+ // Which installation this is. The server keys the row on it, so a
231
+ // rotated token updates this device rather than creating a second
232
+ // one under a new address.
233
+ installId: await installId(),
182
234
  kind: isAndroid ? 'fcm' : 'apns',
183
235
  nativeToken,
184
236
  // The same salted identity hash every event carries, so the
@@ -196,6 +248,13 @@ async function registerWithServer(cfg, nativeToken, opts) {
196
248
  // not — 2026-08-11.)
197
249
  if (opts.metadata != null)
198
250
  body.metadata = opts.metadata;
251
+ // Attributes of the person rather than of the device, kept apart so
252
+ // a build channel called "pro" cannot answer a send aimed at the pro
253
+ // plan. Absent leaves whatever the row already had; `{}` clears it,
254
+ // which is what signing out sends.
255
+ const traits = currentUserTraits();
256
+ if (traits != null)
257
+ body.traits = traits;
199
258
  const res = await fetch(joinUrl(cfg.ingestUrl, '/v1/push/tokens'), {
200
259
  method: 'POST',
201
260
  headers: {
@@ -243,6 +302,48 @@ function teardownBufferDrain() {
243
302
  async function pumpOnce() {
244
303
  const state = await pushDrainState();
245
304
  flushBuffered(state.notifications, state.taps);
305
+ await reportRotationIfAny(state.token);
306
+ }
307
+ /// Tell the server when the vendor has handed the app a different
308
+ /// token from the one it registered with.
309
+ ///
310
+ /// Both native layers already route a rotation into the *native*
311
+ /// `SentoriPush.handleRotatedToken`, and that refuses to act on a
312
+ /// device the native side never registered — which, for a React
313
+ /// Native app, is every device: registration goes through JS and the
314
+ /// handle lives in AsyncStorage. So the rotation arrived nowhere, and
315
+ /// the server held a dead token until the host next called
316
+ /// `register()`. For an app that stays resident that is not a bounded
317
+ /// wait.
318
+ ///
319
+ /// This is the drain loop that already runs at 1 Hz and already reads
320
+ /// the token; it threw it away. Foreground only, like the rest of the
321
+ /// loop — a rotation while backgrounded is reported on the next tick
322
+ /// after the app comes back, which is bounded.
323
+ async function reportRotationIfAny(token) {
324
+ if (token == null || token === '' || token === _lastNativeToken)
325
+ return;
326
+ // Only a device that has registered: a token arriving for one that
327
+ // never did is not something to act on unasked, which is the rule
328
+ // both native SDKs follow.
329
+ if (_lastNativeToken == null)
330
+ return;
331
+ const cfg = tryGetRuntimeConfig();
332
+ if (cfg == null)
333
+ return;
334
+ const previous = _lastNativeToken;
335
+ _lastNativeToken = token;
336
+ try {
337
+ const ipt = await registerWithServer(cfg, token, _lastOptions);
338
+ _cachedIpt = ipt;
339
+ void persistIpt(ipt);
340
+ }
341
+ catch (e) {
342
+ // Put it back, or one failed report means the rotation is never
343
+ // mentioned again and the device is unreachable for good.
344
+ _lastNativeToken = previous;
345
+ logger.warn('push', 'reporting a rotated token failed', e);
346
+ }
246
347
  }
247
348
  function flushBuffered(notifications, taps) {
248
349
  for (const raw of notifications) {
@@ -361,6 +462,54 @@ function startAppStateWatch() {
361
462
  /* react-native unavailable (unit test) */
362
463
  }
363
464
  }
465
+ /// This installation's id, minted on first use and kept after.
466
+ ///
467
+ /// Falls back to a module-scoped value when there is no AsyncStorage,
468
+ /// which is the same fallback the handle uses: worse than persistent,
469
+ /// better than nothing, and it still keeps one launch's rotations
470
+ /// pointed at one row.
471
+ async function installId() {
472
+ if (_installId != null)
473
+ return _installId;
474
+ const storage = await tryAsyncStorage();
475
+ if (storage) {
476
+ try {
477
+ const seen = await storage.getItem(INSTALL_KEY);
478
+ if (typeof seen === 'string' && seen.length > 0) {
479
+ _installId = seen;
480
+ return seen;
481
+ }
482
+ }
483
+ catch {
484
+ // An unreadable store is a store with nothing in it.
485
+ }
486
+ }
487
+ const fresh = randomId();
488
+ _installId = fresh;
489
+ if (storage) {
490
+ try {
491
+ await storage.setItem(INSTALL_KEY, fresh);
492
+ }
493
+ catch (e) {
494
+ logger.warn('push', 'AsyncStorage.setItem failed', e);
495
+ }
496
+ }
497
+ return fresh;
498
+ }
499
+ /// A uuid, without requiring one to exist.
500
+ ///
501
+ /// `crypto.randomUUID` is present on newer Hermes and absent on older
502
+ /// ones, and this must not be the line that decides whether push
503
+ /// works on an older engine.
504
+ function randomId() {
505
+ const c = globalThis.crypto;
506
+ if (typeof c?.randomUUID === 'function')
507
+ return c.randomUUID();
508
+ let out = '';
509
+ for (let i = 0; i < 32; i++)
510
+ out += Math.floor(Math.random() * 16).toString(16);
511
+ return out;
512
+ }
364
513
  async function persistIpt(ipt) {
365
514
  const storage = await tryAsyncStorage();
366
515
  if (!storage)
@@ -409,9 +558,14 @@ function joinUrl(base, path) {
409
558
  * into the next. Production code paths must not call this. */
410
559
  export function __resetForTests() {
411
560
  _cachedIpt = null;
561
+ _installId = null;
412
562
  _onMessage = undefined;
413
563
  _onTap = undefined;
414
564
  _ackQueue = [];
565
+ _lastNativeToken = null;
566
+ _lastOptions = {};
567
+ _lastSentIdentity = null;
568
+ onIdentityChange(undefined);
415
569
  teardownBufferDrain();
416
570
  }
417
571
  let _platformOverride = null;
package/lib/push.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"push.js","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,yBAAyB;AACzB,EAAE;AACF,QAAQ;AACR,gEAAgE;AAChE,oCAAoC;AACpC,2CAA2C;AAC3C,kEAAkE;AAClE,qEAAqE;AACrE,sDAAsD;AACtD,qEAAqE;AACrE,sBAAsB;AACtB,gEAAgE;AAChE,qEAAqE;AACrE,yDAAyD;AACzD,iEAAiE;AACjE,yDAAyD;AACzD,2DAA2D;AAC3D,4CAA4C;AAC5C,qEAAqE;AACrE,8DAA8D;AAC9D,8DAA8D;AAE9D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAA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EAAE,CAAC,QAAQ,EAAE,EAAE,CAAA;QAC1B,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,EAAE,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
package/lib/scope.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import type { User } from '@goliapkg/sentori-core';
2
+ /** Register interest in identity changes. Only push does. */
3
+ export declare const onIdentityChange: (fn: (() => void) | undefined) => void;
2
4
  export declare const setUser: (u: User | null) => void | undefined;
3
5
  export declare const patchContext: (patch: Record<string, unknown>) => void | undefined;
4
6
  export declare const currentUserKey: () => string | undefined;
7
+ /** The person's attributes, for the device row. Undefined when the
8
+ * host has not set any — which is different from `{}`, the value that
9
+ * clears them. */
10
+ export declare const currentUserTraits: () => Record<string, unknown> | undefined;
5
11
  export declare const currentContext: () => Record<string, unknown> | undefined;
6
12
  export declare const __resetForTests: () => void;
7
13
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAOnD,eAAO,MAAM,OAAO,sCAmBlB,CAAC;AAEH,eAAO,MAAM,YAAY,sDAIvB,CAAC;AAEH,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,SAAqB,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SACI,CAAC;AAEjE,eAAO,MAAM,eAAe,QAAO,IAKlC,CAAC"}
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAoBnD,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,OAAQ,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,KAAG,IAE/D,CAAC;AAUF,eAAO,MAAM,OAAO,sCAkClB,CAAC;AAEH,eAAO,MAAM,YAAY,sDAIvB,CAAC;AAEH,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,SAAqB,CAAC;AAEjE;;mBAEmB;AACnB,eAAO,MAAM,iBAAiB,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SACX,CAAC;AAErD,eAAO,MAAM,cAAc,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SACI,CAAC;AAEjE,eAAO,MAAM,eAAe,QAAO,IAOlC,CAAC"}
package/lib/scope.js CHANGED
@@ -6,12 +6,47 @@ let _user = null;
6
6
  let _userKey;
7
7
  let _context = {};
8
8
  let _hashGeneration = 0;
9
+ let _traits;
10
+ // What to tell when the person changes.
11
+ //
12
+ // The device row carries the identity, and until now nothing updated
13
+ // it after registration: an app that registers for push at launch and
14
+ // signs in ten seconds later — which is every app with a login screen
15
+ // — held a row with no user on it for the life of the install. A send
16
+ // aimed at that user reached nobody and reported success.
17
+ //
18
+ // A callback rather than a direct call because push.ts already imports
19
+ // this file; the arrow has to point one way.
20
+ let _onIdentityChange;
21
+ /** Register interest in identity changes. Only push does. */
22
+ export const onIdentityChange = (fn) => {
23
+ _onIdentityChange = fn;
24
+ };
25
+ const announce = () => {
26
+ try {
27
+ _onIdentityChange?.();
28
+ }
29
+ catch {
30
+ // NEVER rule: whatever the listener does, user() returns.
31
+ }
32
+ };
9
33
  export const setUser = safeFn('user', function setUser(u) {
10
34
  _user = u;
11
35
  _userKey = undefined;
36
+ // A call to `user()` describes the person completely, so one made
37
+ // without traits means they have none — not "leave the last ones".
38
+ // Absent and empty are different on the wire: absent keeps what the
39
+ // row has, and a signed-out device that kept them would still be
40
+ // selectable as whoever just left.
41
+ _traits = u?.traits == null ? {} : { ...u.traits };
12
42
  const generation = ++_hashGeneration;
13
- if (u === null)
43
+ if (u === null) {
44
+ // Signing out is an identity change too, and the one where a
45
+ // stale row matters most: the device would otherwise keep
46
+ // answering to the person who just left.
47
+ announce();
14
48
  return;
49
+ }
15
50
  // The wire carries only a salted hash — raw identity never leaves
16
51
  // the device (breadth × depth needs distinctness, not identity).
17
52
  // Hashing is async (WebCrypto); the verb stays synchronous and the
@@ -21,6 +56,9 @@ export const setUser = safeFn('user', function setUser(u) {
21
56
  .then((hashes) => {
22
57
  if (generation === _hashGeneration) {
23
58
  _userKey = hashes.id ?? hashes.email;
59
+ // Announced after the hash lands, not before: the whole point
60
+ // is to send the new key, and the key is what arrives late.
61
+ announce();
24
62
  }
25
63
  })
26
64
  .catch(() => {
@@ -31,11 +69,17 @@ export const patchContext = safeFn('context', function patchContext(patch) {
31
69
  _context = { ..._context, ...patch };
32
70
  });
33
71
  export const currentUserKey = () => _userKey;
72
+ /** The person's attributes, for the device row. Undefined when the
73
+ * host has not set any — which is different from `{}`, the value that
74
+ * clears them. */
75
+ export const currentUserTraits = () => _traits === undefined ? undefined : { ..._traits };
34
76
  export const currentContext = () => Object.keys(_context).length > 0 ? { ..._context } : undefined;
35
77
  export const __resetForTests = () => {
36
78
  _user = null;
37
79
  _userKey = undefined;
80
+ _traits = undefined;
38
81
  _context = {};
82
+ _onIdentityChange = undefined;
39
83
  _hashGeneration++;
40
84
  };
41
85
  //# sourceMappingURL=scope.js.map
package/lib/scope.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,gEAAgE;AAChE,wCAAwC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhE,IAAI,KAAK,GAAgB,IAAI,CAAC;AAC9B,IAAI,QAA4B,CAAC;AACjC,IAAI,QAAQ,GAA4B,EAAE,CAAC;AAC3C,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB,MAAM,CAAC,MAA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SAAS,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAS,EAAE;IACxC,KAAK,GAAG,IAAI,CAAC;IACb,QAAQ,GAAG,SAAS,CAAC;IACrB,OAAO,GAAG,SAAS,CAAC;IACpB,QAAQ,GAAG,EAAE,CAAC;IACd,iBAAiB,GAAG,SAAS,CAAC;IAC9B,eAAe,EAAE,CAAC;AACpB,CAAC,CAAC"}
package/lib/transport.js CHANGED
@@ -15,7 +15,7 @@ const MAX_RETRY = 3;
15
15
  const STORAGE_KEY = '@sentori/pending';
16
16
  const MAX_PERSISTED = 1000;
17
17
  // Pinned to package.json by a test — bump both together.
18
- const SDK_VERSION = '6.2.1';
18
+ const SDK_VERSION = '6.4.0';
19
19
  let _queue = [];
20
20
  let _assertStats = new Map();
21
21
  let _flushTimer = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goliapkg/sentori-react-native",
3
- "version": "6.2.1",
3
+ "version": "6.4.0",
4
4
  "description": "Sentori SDK for React Native — JS-layer error capture, native crash handlers (iOS / Android), batched transport, fetch + react-navigation tracing.",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "author": "GOLIA K.K. <takagi@golia.jp> (https://golia.jp)",
@@ -85,6 +85,6 @@
85
85
  "access": "public"
86
86
  },
87
87
  "dependencies": {
88
- "@goliapkg/sentori-core": "^2.2.0"
88
+ "@goliapkg/sentori-core": "^2.3.0"
89
89
  }
90
90
  }