@formo/analytics-react-native 1.0.1 → 1.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/lib/commonjs/FormoAnalytics.js +15 -3
- package/lib/commonjs/FormoAnalytics.js.map +1 -1
- package/lib/commonjs/lib/crash/index.js +23 -7
- package/lib/commonjs/lib/crash/index.js.map +1 -1
- package/lib/commonjs/lib/event/EventFactory.js +11 -1
- package/lib/commonjs/lib/event/EventFactory.js.map +1 -1
- package/lib/commonjs/lib/event/EventQueue.js +367 -57
- package/lib/commonjs/lib/event/EventQueue.js.map +1 -1
- package/lib/commonjs/utils/sanitize.js +260 -0
- package/lib/commonjs/utils/sanitize.js.map +1 -0
- package/lib/commonjs/utils/trafficSource.js +10 -1
- package/lib/commonjs/utils/trafficSource.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/FormoAnalytics.js +15 -3
- package/lib/module/FormoAnalytics.js.map +1 -1
- package/lib/module/lib/crash/index.js +23 -7
- package/lib/module/lib/crash/index.js.map +1 -1
- package/lib/module/lib/event/EventFactory.js +11 -1
- package/lib/module/lib/event/EventFactory.js.map +1 -1
- package/lib/module/lib/event/EventQueue.js +368 -57
- package/lib/module/lib/event/EventQueue.js.map +1 -1
- package/lib/module/utils/sanitize.js +253 -0
- package/lib/module/utils/sanitize.js.map +1 -0
- package/lib/module/utils/trafficSource.js +10 -1
- package/lib/module/utils/trafficSource.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/FormoAnalytics.d.ts.map +1 -1
- package/lib/typescript/commonjs/lib/crash/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/lib/event/EventFactory.d.ts.map +1 -1
- package/lib/typescript/commonjs/lib/event/EventQueue.d.ts +55 -0
- package/lib/typescript/commonjs/lib/event/EventQueue.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/sanitize.d.ts +31 -0
- package/lib/typescript/commonjs/utils/sanitize.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/trafficSource.d.ts +3 -0
- package/lib/typescript/commonjs/utils/trafficSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/FormoAnalytics.d.ts +2 -2
- package/lib/typescript/module/FormoAnalytics.d.ts.map +1 -1
- package/lib/typescript/module/FormoAnalyticsProvider.d.ts +1 -1
- package/lib/typescript/module/FormoAnalyticsProvider.d.ts.map +1 -1
- package/lib/typescript/module/constants/index.d.ts +3 -3
- package/lib/typescript/module/constants/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/lib/crash/index.d.ts.map +1 -1
- package/lib/typescript/module/lib/event/EventFactory.d.ts +2 -2
- package/lib/typescript/module/lib/event/EventFactory.d.ts.map +1 -1
- package/lib/typescript/module/lib/event/EventManager.d.ts +2 -2
- package/lib/typescript/module/lib/event/EventManager.d.ts.map +1 -1
- package/lib/typescript/module/lib/event/EventQueue.d.ts +57 -2
- package/lib/typescript/module/lib/event/EventQueue.d.ts.map +1 -1
- package/lib/typescript/module/lib/event/index.d.ts +4 -4
- package/lib/typescript/module/lib/event/index.d.ts.map +1 -1
- package/lib/typescript/module/lib/event/types.d.ts +1 -1
- package/lib/typescript/module/lib/event/types.d.ts.map +1 -1
- package/lib/typescript/module/lib/session/index.d.ts +1 -1
- package/lib/typescript/module/lib/session/index.d.ts.map +1 -1
- package/lib/typescript/module/lib/storage/AsyncStorageAdapter.d.ts +2 -2
- package/lib/typescript/module/lib/storage/AsyncStorageAdapter.d.ts.map +1 -1
- package/lib/typescript/module/lib/storage/MemoryStorage.d.ts +1 -1
- package/lib/typescript/module/lib/storage/MemoryStorage.d.ts.map +1 -1
- package/lib/typescript/module/lib/storage/StorageBlueprint.d.ts +1 -1
- package/lib/typescript/module/lib/storage/StorageBlueprint.d.ts.map +1 -1
- package/lib/typescript/module/lib/storage/StorageManager.d.ts +1 -1
- package/lib/typescript/module/lib/storage/StorageManager.d.ts.map +1 -1
- package/lib/typescript/module/lib/storage/index.d.ts +4 -4
- package/lib/typescript/module/lib/storage/index.d.ts.map +1 -1
- package/lib/typescript/module/lib/wagmi/WagmiEventHandler.d.ts +2 -2
- package/lib/typescript/module/lib/wagmi/WagmiEventHandler.d.ts.map +1 -1
- package/lib/typescript/module/lib/wagmi/index.d.ts +2 -2
- package/lib/typescript/module/lib/wagmi/index.d.ts.map +1 -1
- package/lib/typescript/module/solana/address.d.ts +1 -1
- package/lib/typescript/module/solana/address.d.ts.map +1 -1
- package/lib/typescript/module/solana/index.d.ts +2 -2
- package/lib/typescript/module/solana/index.d.ts.map +1 -1
- package/lib/typescript/module/types/base.d.ts +3 -3
- package/lib/typescript/module/types/base.d.ts.map +1 -1
- package/lib/typescript/module/types/events.d.ts +2 -2
- package/lib/typescript/module/types/events.d.ts.map +1 -1
- package/lib/typescript/module/types/index.d.ts +2 -2
- package/lib/typescript/module/types/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/index.d.ts +5 -5
- package/lib/typescript/module/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/sanitize.d.ts +31 -0
- package/lib/typescript/module/utils/sanitize.d.ts.map +1 -0
- package/lib/typescript/module/utils/trafficSource.d.ts +4 -1
- package/lib/typescript/module/utils/trafficSource.d.ts.map +1 -1
- package/lib/typescript/module/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/FormoAnalytics.ts +18 -3
- package/src/lib/crash/index.ts +21 -7
- package/src/lib/event/EventFactory.ts +14 -1
- package/src/lib/event/EventQueue.ts +402 -61
- package/src/utils/sanitize.ts +274 -0
- package/src/utils/trafficSource.ts +19 -1
- package/src/version.ts +1 -1
package/src/lib/crash/index.ts
CHANGED
|
@@ -64,18 +64,31 @@ export class CrashReporter {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
this.
|
|
67
|
+
// Captured in the closure, NOT read from `this` at crash time. If another
|
|
68
|
+
// reporter wraps us afterwards our handler stays reachable through its
|
|
69
|
+
// chain, and cleanup() clearing the field would otherwise sever the chain
|
|
70
|
+
// at the moment it matters: A.start, B.start, A.cleanup, crash — B calls
|
|
71
|
+
// our handler, which would then forward to `undefined` and the real
|
|
72
|
+
// RN/default handler would never run.
|
|
73
|
+
const previousHandler = errorUtils.getGlobalHandler();
|
|
74
|
+
this.previousHandler = previousHandler;
|
|
68
75
|
|
|
69
76
|
const handler: ErrorHandler = (error, isFatal) => {
|
|
70
77
|
// Nothing in here may throw: this runs while the app is already failing,
|
|
71
78
|
// and an exception would replace the real crash with ours.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
//
|
|
80
|
+
// `started` is checked so a cleaned-up reporter still FORWARDS (keeping
|
|
81
|
+
// the chain intact) but no longer reports — otherwise the sequence above
|
|
82
|
+
// would emit a duplicate Application Crashed from the stopped instance.
|
|
83
|
+
if (this.started) {
|
|
84
|
+
try {
|
|
85
|
+
this.report(error, isFatal);
|
|
86
|
+
} catch (reportingError) {
|
|
87
|
+
logger.debug("CrashReporter: failed to report crash", reportingError);
|
|
88
|
+
}
|
|
76
89
|
}
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
previousHandler?.(error, isFatal);
|
|
79
92
|
};
|
|
80
93
|
|
|
81
94
|
this.installedHandler = handler;
|
|
@@ -123,9 +136,10 @@ export class CrashReporter {
|
|
|
123
136
|
errorUtils.setGlobalHandler(this.previousHandler);
|
|
124
137
|
}
|
|
125
138
|
|
|
139
|
+
// previousHandler is deliberately NOT cleared: if another reporter wrapped
|
|
140
|
+
// us, our installed handler is still in its chain and must keep forwarding.
|
|
126
141
|
this.started = false;
|
|
127
142
|
this.installedHandler = undefined;
|
|
128
|
-
this.previousHandler = undefined;
|
|
129
143
|
logger.info("CrashReporter: Cleaned up");
|
|
130
144
|
}
|
|
131
145
|
}
|
|
@@ -156,7 +156,20 @@ interface DeviceInfoResult {
|
|
|
156
156
|
* ("/tabs/leaderboard") does not produce a doubled separator.
|
|
157
157
|
*/
|
|
158
158
|
export function buildScreenUrl(bundleId: string, name: string): string {
|
|
159
|
-
const screen = (name ?? "")
|
|
159
|
+
const screen = (name ?? "")
|
|
160
|
+
.replace(/^\/+/, "")
|
|
161
|
+
// Percent-encode the characters that would otherwise change the URL's
|
|
162
|
+
// STRUCTURE rather than its path. '?' starts a query and '#' a fragment, so
|
|
163
|
+
// screen("Checkout?coupon=X") would parse with pathname "/Checkout" and the
|
|
164
|
+
// rest silently dropped from the screen name. '/' is deliberately NOT
|
|
165
|
+
// encoded — router-style names like "/tabs/leaderboard" are meant to be
|
|
166
|
+
// path segments.
|
|
167
|
+
// '%' FIRST, so the transform stays injective. Without it a screen literally
|
|
168
|
+
// named "Checkout%3Fx" and one named "Checkout?x" both produce
|
|
169
|
+
// ".../Checkout%3Fx" and two distinct screens merge in the analytics.
|
|
170
|
+
.replace(/%/g, "%25")
|
|
171
|
+
.replace(/\?/g, "%3F")
|
|
172
|
+
.replace(/#/g, "%23");
|
|
160
173
|
return `app://${bundleId ?? ""}/${screen}`;
|
|
161
174
|
}
|
|
162
175
|
|