@app-swiss-knife/react-native-sdk 0.4.0 → 0.5.1
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/CHANGELOG.md +473 -2
- package/LICENSE +21 -0
- package/README.md +279 -47
- package/SwissKnifePurchases.podspec +1 -1
- package/android/build.gradle +24 -2
- package/android/consumer-rules.pro +12 -0
- package/android/src/main/AndroidManifest.xml +15 -1
- package/android/src/main/java/com/swissknife/crashreporting/SKCrashReportingModule.kt +5 -4
- package/android/src/main/java/com/swissknife/purchases/SwissKnifeJson.kt +20 -2
- package/android/src/main/java/com/swissknife/purchases/SwissKnifePurchasesModule.kt +168 -6
- package/android/src/play/java/com/swissknife/purchases/StoreIntentHandler.kt +7 -0
- package/android/src/rustore/java/com/swissknife/purchases/StoreIntentHandler.kt +9 -0
- package/android/vendor/GENERATED.md +1 -0
- package/android/vendor/java/com/appswissknife/SwissKnife.kt +111 -38
- package/android/vendor/java/com/appswissknife/analytics/SKAnalytics.kt +180 -115
- package/android/vendor/java/com/appswissknife/attributes/AttributesClient.kt +16 -18
- package/android/vendor/java/com/appswissknife/attributes/SetAttributesWorker.kt +13 -13
- package/android/vendor/java/com/appswissknife/attribution/Attribution.kt +56 -25
- package/android/vendor/java/com/appswissknife/context/DeviceContext.kt +1 -1
- package/android/vendor/java/com/appswissknife/crashreporting/SKCrashReporting.kt +365 -206
- package/android/vendor/java/com/appswissknife/entitlements/EntitlementsRepository.kt +195 -26
- package/android/vendor/java/com/appswissknife/identity/Identity.kt +31 -6
- package/android/vendor/java/com/appswissknife/models/PurchasesError.kt +5 -0
- package/android/vendor/java/com/appswissknife/net/BackendHttpClient.kt +56 -31
- package/android/vendor/java/com/appswissknife/net/IngestClient.kt +673 -87
- package/android/vendor/java/com/appswissknife/net/OfflineQueueStore.kt +214 -30
- package/android/vendor/java/com/appswissknife/notifications/NotificationRenderer.kt +195 -0
- package/android/vendor/java/com/appswissknife/notifications/PermissionRequestActivity.kt +60 -0
- package/android/vendor/java/com/appswissknife/notifications/PermissionStatus.kt +41 -0
- package/android/vendor/java/com/appswissknife/notifications/PushEventQueue.kt +143 -0
- package/android/vendor/java/com/appswissknife/notifications/PushPayload.kt +72 -0
- package/android/vendor/java/com/appswissknife/notifications/PushRegistration.kt +89 -0
- package/android/vendor/java/com/appswissknife/notifications/SwissKnifeMessagingService.kt +57 -0
- package/android/vendor/java/com/appswissknife/notifications/SwissKnifeNotifications.kt +438 -0
- package/android/vendor/java/com/appswissknife/offerings/OfferingsRepository.kt +312 -65
- package/android/vendor/java/com/appswissknife/performance/SKPerformance.kt +1 -0
- package/android/vendor/java/com/appswissknife/purchases/BillingClientGateway.kt +705 -96
- package/android/vendor/java/com/appswissknife/purchases/PlayPriceEnrichmentProvider.kt +55 -24
- package/android/vendor/java/com/appswissknife/purchases/ProductKindHint.kt +29 -0
- package/android/vendor/java/com/appswissknife/purchases/PurchasesGateway.kt +24 -0
- package/android/vendor-rustore/AndroidManifest.xml +59 -0
- package/android/vendor-rustore/java/com/appswissknife/rustore/RuStoreGateway.kt +428 -0
- package/android/vendor-rustore/java/com/appswissknife/rustore/RuStoreInitProvider.kt +43 -0
- package/android/vendor-rustore/java/com/appswissknife/rustore/RuStorePriceEnrichmentProvider.kt +85 -0
- package/app.plugin.js +343 -0
- package/ios/SwissKnifeJSON.swift +24 -2
- package/ios/SwissKnifePurchases.m +20 -0
- package/ios/SwissKnifePurchases.swift +97 -3
- package/ios/SwissKnifePushBootstrap.m +34 -0
- package/ios/vendor/GENERATED.md +1 -0
- package/ios/vendor/SwissKnifeiOS/Analytics/SKAnalytics.swift +138 -89
- package/ios/vendor/SwissKnifeiOS/Context/DeviceContext.swift +1 -1
- package/ios/vendor/SwissKnifeiOS/CrashReporting/SKCrashReporting.swift +345 -44
- package/ios/vendor/SwissKnifeiOS/Net/BackendBackoffGate.swift +43 -2
- package/ios/vendor/SwissKnifeiOS/Net/IngestClient.swift +495 -16
- package/ios/vendor/SwissKnifeiOS/Net/OfflineQueueStore.swift +231 -23
- package/ios/vendor/SwissKnifeiOS/Notifications/PushPayload.swift +87 -0
- package/ios/vendor/SwissKnifeiOS/Notifications/PushRegistrar.swift +322 -0
- package/ios/vendor/SwissKnifeiOS/Notifications/SwissKnife+Notifications.swift +403 -0
- package/ios/vendor/SwissKnifeiOS/Performance/SKPerformance.swift +1 -0
- package/ios/vendor/SwissKnifeiOS/Services/EntitlementsService.swift +11 -7
- package/ios/vendor/SwissKnifeiOS/Services/OfferingsService.swift +37 -5
- package/ios/vendor/SwissKnifeiOS/Services/PurchaseService.swift +38 -7
- package/ios/vendor/SwissKnifeiOS/SwissKnife.swift +34 -6
- package/ios/vendor/SwissKnifeiOS/Types.swift +31 -1
- package/ios-notification-service/SwissKnifeNotificationService.podspec +37 -0
- package/ios-notification-service/vendor/GENERATED.md +11 -0
- package/ios-notification-service/vendor/SwissKnifeNotificationService/SwissKnifeNotificationServiceExtension.swift +177 -0
- package/lib/commonjs/attribution.js +4 -3
- package/lib/commonjs/attribution.js.map +1 -1
- package/lib/commonjs/identity.js +12 -11
- package/lib/commonjs/identity.js.map +1 -1
- package/lib/commonjs/index.js +16 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/config.js +105 -8
- package/lib/commonjs/internal/config.js.map +1 -1
- package/lib/commonjs/internal/telemetry-context.js +70 -0
- package/lib/commonjs/internal/telemetry-context.js.map +1 -0
- package/lib/commonjs/modules/analytics.js +18 -25
- package/lib/commonjs/modules/analytics.js.map +1 -1
- package/lib/commonjs/modules/crash-reporting.js +27 -6
- package/lib/commonjs/modules/crash-reporting.js.map +1 -1
- package/lib/commonjs/modules/log.js +1 -1
- package/lib/commonjs/modules/notifications.js +500 -0
- package/lib/commonjs/modules/notifications.js.map +1 -0
- package/lib/commonjs/modules/performance.js +57 -8
- package/lib/commonjs/modules/performance.js.map +1 -1
- package/lib/commonjs/native/module.js +6 -0
- package/lib/commonjs/native/module.js.map +1 -1
- package/lib/commonjs/native/spec.js +12 -5
- package/lib/commonjs/native/spec.js.map +1 -1
- package/lib/commonjs/purchases.js +4 -4
- package/lib/commonjs/types.js +12 -15
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/attribution.js +4 -3
- package/lib/module/attribution.js.map +1 -1
- package/lib/module/identity.js +12 -11
- package/lib/module/identity.js.map +1 -1
- package/lib/module/index.js +8 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/config.js +103 -8
- package/lib/module/internal/config.js.map +1 -1
- package/lib/module/internal/telemetry-context.js +63 -0
- package/lib/module/internal/telemetry-context.js.map +1 -0
- package/lib/module/modules/analytics.js +18 -25
- package/lib/module/modules/analytics.js.map +1 -1
- package/lib/module/modules/crash-reporting.js +27 -6
- package/lib/module/modules/crash-reporting.js.map +1 -1
- package/lib/module/modules/log.js +1 -1
- package/lib/module/modules/notifications.js +491 -0
- package/lib/module/modules/notifications.js.map +1 -0
- package/lib/module/modules/performance.js +57 -8
- package/lib/module/modules/performance.js.map +1 -1
- package/lib/module/native/module.js +6 -1
- package/lib/module/native/module.js.map +1 -1
- package/lib/module/native/spec.js +11 -4
- package/lib/module/native/spec.js.map +1 -1
- package/lib/module/purchases.js +4 -4
- package/lib/module/types.js +12 -15
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/commonjs/attribution.d.ts +3 -2
- package/lib/typescript/commonjs/attribution.d.ts.map +1 -1
- package/lib/typescript/commonjs/identity.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/config.d.ts +16 -2
- package/lib/typescript/commonjs/internal/config.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/telemetry-context.d.ts +22 -0
- package/lib/typescript/commonjs/internal/telemetry-context.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/analytics.d.ts +8 -11
- package/lib/typescript/commonjs/modules/analytics.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts +18 -5
- package/lib/typescript/commonjs/modules/crash-reporting.d.ts.map +1 -1
- package/lib/typescript/commonjs/modules/notifications.d.ts +110 -0
- package/lib/typescript/commonjs/modules/notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/modules/performance.d.ts +13 -0
- package/lib/typescript/commonjs/modules/performance.d.ts.map +1 -1
- package/lib/typescript/commonjs/native/module.d.ts +2 -0
- package/lib/typescript/commonjs/native/module.d.ts.map +1 -1
- package/lib/typescript/commonjs/native/spec.d.ts +33 -4
- package/lib/typescript/commonjs/native/spec.d.ts.map +1 -1
- package/lib/typescript/commonjs/purchases.d.ts +4 -4
- package/lib/typescript/commonjs/types.d.ts +4 -5
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/attribution.d.ts +3 -2
- package/lib/typescript/module/attribution.d.ts.map +1 -1
- package/lib/typescript/module/identity.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/internal/config.d.ts +16 -2
- package/lib/typescript/module/internal/config.d.ts.map +1 -1
- package/lib/typescript/module/internal/telemetry-context.d.ts +22 -0
- package/lib/typescript/module/internal/telemetry-context.d.ts.map +1 -0
- package/lib/typescript/module/modules/analytics.d.ts +8 -11
- package/lib/typescript/module/modules/analytics.d.ts.map +1 -1
- package/lib/typescript/module/modules/crash-reporting.d.ts +18 -5
- package/lib/typescript/module/modules/crash-reporting.d.ts.map +1 -1
- package/lib/typescript/module/modules/notifications.d.ts +110 -0
- package/lib/typescript/module/modules/notifications.d.ts.map +1 -0
- package/lib/typescript/module/modules/performance.d.ts +13 -0
- package/lib/typescript/module/modules/performance.d.ts.map +1 -1
- package/lib/typescript/module/native/module.d.ts +2 -0
- package/lib/typescript/module/native/module.d.ts.map +1 -1
- package/lib/typescript/module/native/spec.d.ts +33 -4
- package/lib/typescript/module/native/spec.d.ts.map +1 -1
- package/lib/typescript/module/purchases.d.ts +4 -4
- package/lib/typescript/module/types.d.ts +4 -5
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/package.json +13 -4
- package/src/attribution.ts +4 -3
- package/src/identity.ts +12 -11
- package/src/index.ts +16 -4
- package/src/internal/config.ts +113 -8
- package/src/internal/telemetry-context.ts +76 -0
- package/src/modules/analytics.ts +24 -33
- package/src/modules/crash-reporting.ts +50 -9
- package/src/modules/log.ts +1 -1
- package/src/modules/notifications.ts +557 -0
- package/src/modules/performance.ts +94 -14
- package/src/native/module.ts +6 -0
- package/src/native/spec.ts +45 -10
- package/src/purchases.ts +4 -4
- package/src/types.ts +12 -15
- package/android/vendor/java/com/appswissknife/analytics/EventQueueStore.kt +0 -326
- package/android/vendor/java/com/appswissknife/analytics/FlushEventsWorker.kt +0 -296
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.configure = configure;
|
|
7
7
|
exports.configureCore = configureCore;
|
|
8
|
+
exports.getServerConfig = getServerConfig;
|
|
8
9
|
exports.isConfigured = isConfigured;
|
|
9
10
|
exports.isCoreConfigured = isCoreConfigured;
|
|
10
11
|
exports.nativeBoolean = nativeBoolean;
|
|
12
|
+
exports.recordServerConfig = recordServerConfig;
|
|
11
13
|
exports.resetConfigForTests = resetConfigForTests;
|
|
12
14
|
exports.setLogLevel = setLogLevel;
|
|
13
15
|
exports.throwIfCoreNotConfigured = throwIfCoreNotConfigured;
|
|
@@ -39,7 +41,48 @@ var _types = require("../types.js");
|
|
|
39
41
|
|
|
40
42
|
let configured = false;
|
|
41
43
|
let configuredApiKey = null;
|
|
44
|
+
let configuredServerURL = null;
|
|
42
45
|
let coreConfigured = false;
|
|
46
|
+
/**
|
|
47
|
+
* Why the last native configure failed, if it did. `throwIfNotConfigured`
|
|
48
|
+
* attaches it as the `cause` of the error it throws, so a purchase made after
|
|
49
|
+
* a failed configure names the real reason instead of "not configured".
|
|
50
|
+
*/
|
|
51
|
+
let lastConfigureError = null;
|
|
52
|
+
/**
|
|
53
|
+
* Bumped by every configure call. A native rejection only resets the JS state
|
|
54
|
+
* when no later configure has replaced it — a slow failure of an old call must
|
|
55
|
+
* not undo a newer one that succeeded.
|
|
56
|
+
*/
|
|
57
|
+
let configureGeneration = 0;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Reject an empty or whitespace-only API key synchronously, before any state
|
|
61
|
+
* changes. The native bridges reject an empty key asynchronously, which the old
|
|
62
|
+
* fire-and-forget call turned into an unhandled rejection while JS went on to
|
|
63
|
+
* report the SDK as configured. Typical cause: a missing env var at build time.
|
|
64
|
+
*/
|
|
65
|
+
function assertApiKey(apiKey, entryPoint) {
|
|
66
|
+
if (typeof apiKey !== "string" || apiKey.trim() === "") {
|
|
67
|
+
throw new Error(`${entryPoint} requires a non-empty apiKey (got ${typeof apiKey === "string" ? JSON.stringify(apiKey) : String(apiKey)}).`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Observe a native configure promise without awaiting it: `configure` stays
|
|
73
|
+
* synchronous (RC parity), but a rejection is logged, kept for
|
|
74
|
+
* {@link throwIfNotConfigured}, and undoes the JS state `onFailure` names so the
|
|
75
|
+
* next configure with the same key retries instead of returning early.
|
|
76
|
+
*/
|
|
77
|
+
function observeNativeConfigure(result, entryPoint, onFailure) {
|
|
78
|
+
const generation = configureGeneration;
|
|
79
|
+
Promise.resolve(result).catch(error => {
|
|
80
|
+
if (generation !== configureGeneration) return;
|
|
81
|
+
onFailure();
|
|
82
|
+
lastConfigureError = error;
|
|
83
|
+
console.warn(`[SwissKnife] native ${entryPoint} failed:`, error);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
43
86
|
|
|
44
87
|
/**
|
|
45
88
|
* Read a boolean off the native module without ever letting a missing native
|
|
@@ -66,12 +109,34 @@ function nativeBoolean(read) {
|
|
|
66
109
|
}
|
|
67
110
|
}
|
|
68
111
|
|
|
112
|
+
/**
|
|
113
|
+
* The API key + backend URL this process was configured with, for the few JS
|
|
114
|
+
* modules that talk to the backend directly (push manual registration).
|
|
115
|
+
* `serverURL` is "" when the default host applies. Null until something
|
|
116
|
+
* configured — `configure`, `configureCore` or `Analytics.init`.
|
|
117
|
+
*/
|
|
118
|
+
function getServerConfig() {
|
|
119
|
+
return configuredApiKey ? {
|
|
120
|
+
apiKey: configuredApiKey,
|
|
121
|
+
serverURL: configuredServerURL ?? ""
|
|
122
|
+
} : null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Record key + URL for consumers of {@link getServerConfig}. */
|
|
126
|
+
function recordServerConfig(apiKey, serverURL) {
|
|
127
|
+
configuredApiKey = apiKey;
|
|
128
|
+
configuredServerURL = serverURL ?? "";
|
|
129
|
+
}
|
|
130
|
+
|
|
69
131
|
/**
|
|
70
132
|
* Configure the SDK. Must be called before any other method. Calling again
|
|
71
|
-
* with the same API key is a no-op (matches the common "configure once" guard)
|
|
72
|
-
* the native
|
|
133
|
+
* with the same API key is a no-op (matches the common "configure once" guard)
|
|
134
|
+
* unless the native configure failed, in which case it retries; the native
|
|
135
|
+
* layer owns full reconfiguration. Throws synchronously on an empty or
|
|
136
|
+
* whitespace-only `apiKey`.
|
|
73
137
|
*/
|
|
74
138
|
function configure(options) {
|
|
139
|
+
assertApiKey(options?.apiKey, "configure");
|
|
75
140
|
if (configured && configuredApiKey === options.apiKey) return;
|
|
76
141
|
const native = (0, _module.getNativeModule)();
|
|
77
142
|
const nativeOptions = {
|
|
@@ -91,11 +156,20 @@ function configure(options) {
|
|
|
91
156
|
sendInstallOnFirstLaunch: options.sendInstallOnFirstLaunch,
|
|
92
157
|
logLevel: options.logLevel
|
|
93
158
|
};
|
|
94
|
-
//
|
|
95
|
-
|
|
159
|
+
// Not awaited: native configure resolves async but RC's configure is sync.
|
|
160
|
+
// A rejection is observed, never left unhandled — see observeNativeConfigure.
|
|
161
|
+
const result = native.configure(nativeOptions);
|
|
162
|
+
configureGeneration += 1;
|
|
163
|
+
lastConfigureError = null;
|
|
96
164
|
configured = true;
|
|
97
165
|
coreConfigured = true;
|
|
98
|
-
|
|
166
|
+
recordServerConfig(options.apiKey, options.proxyURL);
|
|
167
|
+
observeNativeConfigure(result, "configure", () => {
|
|
168
|
+
configured = false;
|
|
169
|
+
coreConfigured = false;
|
|
170
|
+
configuredApiKey = null;
|
|
171
|
+
configuredServerURL = null;
|
|
172
|
+
});
|
|
99
173
|
}
|
|
100
174
|
|
|
101
175
|
/**
|
|
@@ -113,6 +187,7 @@ function configure(options) {
|
|
|
113
187
|
* `appUserID`, an attribution configuration, or a log level up front.
|
|
114
188
|
*/
|
|
115
189
|
function configureCore(options) {
|
|
190
|
+
assertApiKey(options?.apiKey, "configureCore");
|
|
116
191
|
if (coreConfigured && configuredApiKey === options.apiKey) return;
|
|
117
192
|
const native = (0, _module.getNativeModule)();
|
|
118
193
|
const nativeOptions = {
|
|
@@ -127,9 +202,18 @@ function configureCore(options) {
|
|
|
127
202
|
sendInstallOnFirstLaunch: options.sendInstallOnFirstLaunch,
|
|
128
203
|
logLevel: options.logLevel
|
|
129
204
|
};
|
|
130
|
-
|
|
205
|
+
const result = native.configureCore(nativeOptions);
|
|
206
|
+
configureGeneration += 1;
|
|
207
|
+
lastConfigureError = null;
|
|
131
208
|
coreConfigured = true;
|
|
132
|
-
|
|
209
|
+
recordServerConfig(options.apiKey, options.proxyURL);
|
|
210
|
+
// The purchase engine flag is left alone: configureCore never set it, and a
|
|
211
|
+
// store configured earlier is still configured natively.
|
|
212
|
+
observeNativeConfigure(result, "configureCore", () => {
|
|
213
|
+
coreConfigured = false;
|
|
214
|
+
configuredApiKey = null;
|
|
215
|
+
configuredServerURL = null;
|
|
216
|
+
});
|
|
133
217
|
}
|
|
134
218
|
|
|
135
219
|
/**
|
|
@@ -193,8 +277,18 @@ function setLogLevel(level) {
|
|
|
193
277
|
*/
|
|
194
278
|
function throwIfNotConfigured() {
|
|
195
279
|
if (!configured) {
|
|
196
|
-
throw new _types.UninitializedPurchasesError();
|
|
280
|
+
if (lastConfigureError == null) throw new _types.UninitializedPurchasesError();
|
|
281
|
+
const error = new _types.UninitializedPurchasesError("Purchases is not configured: the native configure call failed (" + describe(lastConfigureError) + "). Fix the cause and call Purchases.configure() again.");
|
|
282
|
+
error.cause = lastConfigureError;
|
|
283
|
+
throw error;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function describe(error) {
|
|
287
|
+
if (error instanceof Error) return error.message;
|
|
288
|
+
if (error && typeof error === "object" && "message" in error) {
|
|
289
|
+
return String(error.message);
|
|
197
290
|
}
|
|
291
|
+
return String(error);
|
|
198
292
|
}
|
|
199
293
|
|
|
200
294
|
/**
|
|
@@ -233,5 +327,8 @@ function resetConfigForTests() {
|
|
|
233
327
|
configured = false;
|
|
234
328
|
coreConfigured = false;
|
|
235
329
|
configuredApiKey = null;
|
|
330
|
+
configuredServerURL = null;
|
|
331
|
+
lastConfigureError = null;
|
|
332
|
+
configureGeneration += 1;
|
|
236
333
|
}
|
|
237
334
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_module","require","_types","configured","configuredApiKey","coreConfigured","
|
|
1
|
+
{"version":3,"names":["_module","require","_types","configured","configuredApiKey","configuredServerURL","coreConfigured","lastConfigureError","configureGeneration","assertApiKey","apiKey","entryPoint","trim","Error","JSON","stringify","String","observeNativeConfigure","result","onFailure","generation","Promise","resolve","catch","error","console","warn","nativeBoolean","read","getNativeModule","getServerConfig","serverURL","recordServerConfig","configure","options","native","nativeOptions","appUserID","proxyURL","diagnosticsEnabled","storeKitVersion","useAmazon","autoPromptATT","sendInstallOnFirstLaunch","logLevel","configureCore","isConfigured","isCoreConfigured","setLogLevel","level","throwIfNotConfigured","UninitializedPurchasesError","describe","cause","message","throwIfCoreNotConfigured","resetConfigForTests"],"sourceRoot":"../../../src","sources":["internal/config.ts"],"mappings":";;;;;;;;;;;;;;;;AAuBA,IAAAA,OAAA,GAAAC,OAAA;AACA,I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,kBAAkB;IAChC,MAAMiB,KAAK;EACb;AACF;AAEA,SAAS4B,QAAQA,CAAC5B,KAAc,EAAU;EACxC,IAAIA,KAAK,YAAYX,KAAK,EAAE,OAAOW,KAAK,CAAC8B,OAAO;EAChD,IAAI9B,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAIA,KAAK,EAAE;IAC5D,OAAOR,MAAM,CAAEQ,KAAK,CAA0B8B,OAAO,CAAC;EACxD;EACA,OAAOtC,MAAM,CAACQ,KAAK,CAAC;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe+B,wBAAwBA,CAAA,EAAkB;EAC9D,IAAIjD,cAAc,EAAE;EACpB,IAAI,MAAMqB,aAAa,CAAEQ,MAAM,IAAKA,MAAM,CAACY,gBAAgB,CAAC,CAAC,CAAC,EAAE;EAChE,MAAM,IAAII,kCAA2B,CACnC,mEAAmE,GACjE,wDACJ,CAAC;AACH;;AAEA;AACO,SAASK,mBAAmBA,CAAA,EAAS;EAC1CrD,UAAU,GAAG,KAAK;EAClBG,cAAc,GAAG,KAAK;EACtBF,gBAAgB,GAAG,IAAI;EACvBC,mBAAmB,GAAG,IAAI;EAC1BE,kBAAkB,GAAG,IAAI;EACzBC,mBAAmB,IAAI,CAAC;AAC1B","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.captureTelemetryContext = captureTelemetryContext;
|
|
7
|
+
exports.currentTelemetryTraceId = currentTelemetryTraceId;
|
|
8
|
+
exports.setTelemetryBridgeForTests = setTelemetryBridgeForTests;
|
|
9
|
+
exports.setTelemetryTraceReader = setTelemetryTraceReader;
|
|
10
|
+
/** Capture once, before a queued event can outlive its user or session. */
|
|
11
|
+
|
|
12
|
+
let override;
|
|
13
|
+
function bridge() {
|
|
14
|
+
if (override !== undefined) return override;
|
|
15
|
+
try {
|
|
16
|
+
// Optional native bridge: JS-only instrumentation remains usable without it.
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
18
|
+
return require("../native/module").getNativeModule();
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function captureTelemetryContext() {
|
|
24
|
+
const native = bridge();
|
|
25
|
+
if (!native) return Promise.resolve({});
|
|
26
|
+
const result = {};
|
|
27
|
+
// Invoke both bridge reads now, rather than in a later flush microtask.
|
|
28
|
+
let identity = Promise.resolve();
|
|
29
|
+
let session = Promise.resolve();
|
|
30
|
+
try {
|
|
31
|
+
identity = native.identityCurrent?.().then(s => {
|
|
32
|
+
result.userId = s.userId ?? "";
|
|
33
|
+
result.installId = s.anonymousId ?? "";
|
|
34
|
+
}) ?? identity;
|
|
35
|
+
} catch {
|
|
36
|
+
/* Missing information stays unknown. */
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
session = native.sessionCurrent?.().then(s => {
|
|
40
|
+
result.sessionId = s.id;
|
|
41
|
+
}) ?? session;
|
|
42
|
+
} catch {
|
|
43
|
+
/* Never invent a second session id. */
|
|
44
|
+
}
|
|
45
|
+
return new Promise(resolve => {
|
|
46
|
+
let finished = false;
|
|
47
|
+
const finish = () => {
|
|
48
|
+
if (finished) return;
|
|
49
|
+
finished = true;
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
resolve({
|
|
52
|
+
...result
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const timer = setTimeout(finish, 250);
|
|
56
|
+
void Promise.allSettled([identity, session]).then(finish);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Internal seam; never exported by the SDK public entry point. */
|
|
60
|
+
function setTelemetryBridgeForTests(value) {
|
|
61
|
+
override = value;
|
|
62
|
+
}
|
|
63
|
+
let traceReader;
|
|
64
|
+
function setTelemetryTraceReader(read) {
|
|
65
|
+
traceReader = read;
|
|
66
|
+
}
|
|
67
|
+
function currentTelemetryTraceId() {
|
|
68
|
+
return traceReader?.();
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=telemetry-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["override","bridge","undefined","require","getNativeModule","captureTelemetryContext","native","Promise","resolve","result","identity","session","identityCurrent","then","s","userId","installId","anonymousId","sessionCurrent","sessionId","id","finished","finish","clearTimeout","timer","setTimeout","allSettled","setTelemetryBridgeForTests","value","traceReader","setTelemetryTraceReader","read","currentTelemetryTraceId"],"sourceRoot":"../../../src","sources":["internal/telemetry-context.ts"],"mappings":";;;;;;;;;AAAA;;AAaA,IAAIA,QAAmC;AACvC,SAASC,MAAMA,CAAA,EAAkB;EAC/B,IAAID,QAAQ,KAAKE,SAAS,EAAE,OAAOF,QAAQ;EAC3C,IAAI;IACF;IACA;IACA,OACEG,OAAO,CAAC,kBAAkB,CAAC,CAC3BC,eAAe,CAAC,CAAC;EACrB,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AACO,SAASC,uBAAuBA,CAAA,EAA8B;EACnE,MAAMC,MAAM,GAAGL,MAAM,CAAC,CAAC;EACvB,IAAI,CAACK,MAAM,EAAE,OAAOC,OAAO,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;EACvC,MAAMC,MAAwB,GAAG,CAAC,CAAC;EACnC;EACA,IAAIC,QAA0B,GAAGH,OAAO,CAACC,OAAO,CAAC,CAAC;EAClD,IAAIG,OAAyB,GAAGJ,OAAO,CAACC,OAAO,CAAC,CAAC;EACjD,IAAI;IACFE,QAAQ,GACNJ,MAAM,CAACM,eAAe,GAAG,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAK;MACrCL,MAAM,CAACM,MAAM,GAAGD,CAAC,CAACC,MAAM,IAAI,EAAE;MAC9BN,MAAM,CAACO,SAAS,GAAGF,CAAC,CAACG,WAAW,IAAI,EAAE;IACxC,CAAC,CAAC,IAAIP,QAAQ;EAClB,CAAC,CAAC,MAAM;IACN;EAAA;EAEF,IAAI;IACFC,OAAO,GACLL,MAAM,CAACY,cAAc,GAAG,CAAC,CAACL,IAAI,CAAEC,CAAC,IAAK;MACpCL,MAAM,CAACU,SAAS,GAAGL,CAAC,CAACM,EAAE;IACzB,CAAC,CAAC,IAAIT,OAAO;EACjB,CAAC,CAAC,MAAM;IACN;EAAA;EAEF,OAAO,IAAIJ,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIa,QAAQ,GAAG,KAAK;IACpB,MAAMC,MAAM,GAAGA,CAAA,KAAM;MACnB,IAAID,QAAQ,EAAE;MACdA,QAAQ,GAAG,IAAI;MACfE,YAAY,CAACC,KAAK,CAAC;MACnBhB,OAAO,CAAC;QAAE,GAAGC;MAAO,CAAC,CAAC;IACxB,CAAC;IACD,MAAMe,KAAK,GAAGC,UAAU,CAACH,MAAM,EAAE,GAAG,CAAC;IACrC,KAAKf,OAAO,CAACmB,UAAU,CAAC,CAAChB,QAAQ,EAAEC,OAAO,CAAC,CAAC,CAACE,IAAI,CAACS,MAAM,CAAC;EAC3D,CAAC,CAAC;AACJ;AACA;AACO,SAASK,0BAA0BA,CACxCC,KAAgC,EAC1B;EACN5B,QAAQ,GAAG4B,KAAK;AAClB;AAEA,IAAIC,WAAmD;AAChD,SAASC,uBAAuBA,CAACC,IAA8B,EAAQ;EAC5EF,WAAW,GAAGE,IAAI;AACpB;AACO,SAASC,uBAAuBA,CAAA,EAAuB;EAC5D,OAAOH,WAAW,GAAG,CAAC;AACxB","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SKRevenue = exports.SKIdentify = exports.Analytics = void 0;
|
|
7
7
|
var _module = require("../native/module.js");
|
|
8
|
+
var _config2 = require("../internal/config.js");
|
|
8
9
|
var _ids = require("./ids.js");
|
|
9
10
|
// packages/react-native-sdk/src/modules/analytics.ts
|
|
10
11
|
//
|
|
@@ -13,8 +14,7 @@ var _ids = require("./ids.js");
|
|
|
13
14
|
//
|
|
14
15
|
// ## Architecture: thin pass-through to native
|
|
15
16
|
//
|
|
16
|
-
//
|
|
17
|
-
// pass-through to the native event queue:
|
|
17
|
+
// The RN Analytics layer is a thin pass-through to the native event queue:
|
|
18
18
|
//
|
|
19
19
|
// - **JS owns the payload shape** — `event_id`, `device_id`, super
|
|
20
20
|
// properties, timed-event duration, identify merging, session id, user
|
|
@@ -197,9 +197,7 @@ let _superProperties = {};
|
|
|
197
197
|
let _timedEvents = {};
|
|
198
198
|
let _flushTimer = null;
|
|
199
199
|
|
|
200
|
-
//
|
|
201
|
-
// centralized in `./ids.ts` so future callers can import rather than
|
|
202
|
-
// copy-paste.
|
|
200
|
+
// `generateUUID` lives in `./ids.ts`, shared with the other modules.
|
|
203
201
|
|
|
204
202
|
/**
|
|
205
203
|
* Detect whether we're in a React Native runtime (`navigator` is defined by RN's
|
|
@@ -287,12 +285,10 @@ function sendToNativeFireAndForget(event) {
|
|
|
287
285
|
* Awaits the native device-id promise when the cached id is still null.
|
|
288
286
|
* The returned event is ready to hand to the native bridge.
|
|
289
287
|
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* `
|
|
294
|
-
* emitted with `user_id: ""` because the JS-side `setUserId(...)` was
|
|
295
|
-
* never called. Now native is the single source of truth.
|
|
288
|
+
* `user_id` is derived from the native `Identity.current()` snapshot at
|
|
289
|
+
* event-build time, not from the JS-local `_userId` cache, so an
|
|
290
|
+
* `Analytics.track(...)` right after `Identity.logIn("u_42")` already
|
|
291
|
+
* carries `u_42`. Native is the single source of truth for identity.
|
|
296
292
|
*/
|
|
297
293
|
async function buildEvent(eventType, eventProperties, overrides) {
|
|
298
294
|
// Merge super properties (event props override)
|
|
@@ -318,16 +314,15 @@ async function buildEvent(eventType, eventProperties, overrides) {
|
|
|
318
314
|
|
|
319
315
|
// Resolve session_id from the canonical native primitive. Same lazy
|
|
320
316
|
// pattern as device_id — synchronous when cached, otherwise await the
|
|
321
|
-
// in-flight promise kicked off in init()
|
|
322
|
-
//
|
|
323
|
-
// ContextSnapshot.session_id.
|
|
317
|
+
// in-flight promise kicked off in init() — so it matches the
|
|
318
|
+
// envelope-level ContextSnapshot.session_id.
|
|
324
319
|
let sessionId = _sessionId;
|
|
325
320
|
if (sessionId == null) {
|
|
326
321
|
if (_sessionIdPromise == null) loadSessionIdFromNative();
|
|
327
322
|
sessionId = (await _sessionIdPromise) ?? String(Date.now());
|
|
328
323
|
}
|
|
329
324
|
|
|
330
|
-
//
|
|
325
|
+
// Derive user_id from the native Identity snapshot. Fall back
|
|
331
326
|
// to the JS-local `_userId` only when the native call throws (e.g.
|
|
332
327
|
// test harness without the Identity bridge methods stubbed) — that
|
|
333
328
|
// preserves the legacy `Analytics.setUserId(...)` test seam.
|
|
@@ -368,8 +363,8 @@ async function buildEvent(eventType, eventProperties, overrides) {
|
|
|
368
363
|
} : {}),
|
|
369
364
|
...overrides
|
|
370
365
|
};
|
|
371
|
-
// Stamp anonymous_id when we resolved it from native
|
|
372
|
-
//
|
|
366
|
+
// Stamp anonymous_id when we resolved it from native; it carries the
|
|
367
|
+
// $SKAnonymousID: prefix.
|
|
373
368
|
if (anonymousId !== undefined) {
|
|
374
369
|
event.anonymous_id = anonymousId;
|
|
375
370
|
}
|
|
@@ -394,7 +389,7 @@ const Analytics = exports.Analytics = {
|
|
|
394
389
|
...config
|
|
395
390
|
};
|
|
396
391
|
// Reset cached session id so the next track() refetches from the
|
|
397
|
-
// canonical native primitive.
|
|
392
|
+
// canonical native primitive.
|
|
398
393
|
_sessionId = null;
|
|
399
394
|
_sessionIdPromise = null;
|
|
400
395
|
|
|
@@ -408,6 +403,7 @@ const Analytics = exports.Analytics = {
|
|
|
408
403
|
// (there used to be, and it made `Analytics.init({ apiKey })` — no
|
|
409
404
|
// serverURL — a silent no-op on both platforms).
|
|
410
405
|
// Fire-and-forget: events queue natively regardless and flush once wired.
|
|
406
|
+
(0, _config2.recordServerConfig)(config.apiKey, config.serverURL);
|
|
411
407
|
try {
|
|
412
408
|
void (0, _module.getNativeModule)().configureObservability(config.apiKey, config.serverURL ?? "").catch(() => {});
|
|
413
409
|
} catch {
|
|
@@ -492,9 +488,8 @@ const Analytics = exports.Analytics = {
|
|
|
492
488
|
/**
|
|
493
489
|
* Current session id from the native `Session.shared` primitive.
|
|
494
490
|
* Returns `null` until the first `track()` (or explicit await on
|
|
495
|
-
* `init()`'s session warm) has resolved the native call.
|
|
496
|
-
*
|
|
497
|
-
* null` reflecting both the native UUID format and the lazy resolution.
|
|
491
|
+
* `init()`'s session warm) has resolved the native call. The id is the
|
|
492
|
+
* native session UUID.
|
|
498
493
|
*/
|
|
499
494
|
getSessionId() {
|
|
500
495
|
return _sessionId;
|
|
@@ -567,10 +562,8 @@ const Analytics = exports.Analytics = {
|
|
|
567
562
|
_superProperties = {};
|
|
568
563
|
_timedEvents = {};
|
|
569
564
|
// Drop the cached session id so the next track() refetches from the
|
|
570
|
-
// native primitive (`Session.shared`)
|
|
571
|
-
//
|
|
572
|
-
// every reset because the JS-side number drifted from the native
|
|
573
|
-
// session UUID stamped on the envelope.
|
|
565
|
+
// native primitive (`Session.shared`), the same session UUID that is
|
|
566
|
+
// stamped on the envelope.
|
|
574
567
|
_sessionId = null;
|
|
575
568
|
_sessionIdPromise = null;
|
|
576
569
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_module","require","_ids","SKIdentify","operations","set","property","value","push","op","key","setOnce","unset","add","append","prepend","remove","union","values","clearAll","_getOperations","exports","SKRevenue","productId","quantity","price","FALLBACK_DEVICE_ID","_config","_userId","_deviceId","_deviceIdPromise","_sessionId","_sessionIdPromise","_userProperties","_groups","_superProperties","_timedEvents","_flushTimer","detectOsName","globalThis","navigator","loadSessionIdFromNative","p","snap","getNativeModule","sessionCurrent","id","length","fallback","String","Date","now","e","console","warn","loadDeviceIdFromNative","getDeviceId","sendToNativeFireAndForget","event","trackEvent","buildEvent","eventType","eventProperties","overrides","mergedProps","$duration","deviceId","sessionId","userId","anonymousId","snapshot","identityCurrent","undefined","event_id","generateUUID","event_type","event_properties","user_id","device_id","session_id","time","platform","os_name","Object","keys","user_properties","groups","anonymous_id","Analytics","init","config","flushQueueSize","flushIntervalMs","optOut","trackingSessionEvents","configureObservability","apiKey","serverURL","catch","clearInterval","setInterval","flush","track","Promise","resolve","then","trackScreen","name","properties","setUserId","getUserId","setDeviceId","getSessionId","identify","$set","registerSuperProperties","assign","registerSuperPropertiesOnce","k","v","entries","getSuperProperties","unregisterSuperProperty","clearSuperProperties","timeEvent","eventName","addGroup","groupType","groupName","existing","Array","isArray","includes","reset","setGroup","groupIdentify","revenue","props","$productId","$quantity","$price","revenueType","$revenueType","trackCharge","amount","$amount","flushEvents","setOptOut","shutdown"],"sourceRoot":"../../../src","sources":["modules/analytics.ts"],"mappings":";;;;;;AAmEA,IAAAA,OAAA,GAAAC,OAAA;AAsJA,IAAAC,IAAA,GAAAD,OAAA;AAzNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;AA4CA;;AAEO,MAAME,UAAU,CAAC;EACdC,UAAU,GAAyD,EAAE;EAE7EC,GAAGA,CAACC,QAAgB,EAAEC,KAAc,EAAQ;IAC1C,IAAI,CAACH,UAAU,CAACI,IAAI,CAAC;MAAEC,EAAE,E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AC9D,WAAW,CAAC;MAC1BA,WAAW,GAAG,IAAI;IACpB;IACA,KAAKmD,SAAS,CAACa,KAAK,CAAC,CAAC;EACxB;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_module","require","_config2","_ids","SKIdentify","operations","set","property","value","push","op","key","setOnce","unset","add","append","prepend","remove","union","values","clearAll","_getOperations","exports","SKRevenue","productId","quantity","price","FALLBACK_DEVICE_ID","_config","_userId","_deviceId","_deviceIdPromise","_sessionId","_sessionIdPromise","_userProperties","_groups","_superProperties","_timedEvents","_flushTimer","detectOsName","globalThis","navigator","loadSessionIdFromNative","p","snap","getNativeModule","sessionCurrent","id","length","fallback","String","Date","now","e","console","warn","loadDeviceIdFromNative","getDeviceId","sendToNativeFireAndForget","event","trackEvent","buildEvent","eventType","eventProperties","overrides","mergedProps","$duration","deviceId","sessionId","userId","anonymousId","snapshot","identityCurrent","undefined","event_id","generateUUID","event_type","event_properties","user_id","device_id","session_id","time","platform","os_name","Object","keys","user_properties","groups","anonymous_id","Analytics","init","config","flushQueueSize","flushIntervalMs","optOut","trackingSessionEvents","recordServerConfig","apiKey","serverURL","configureObservability","catch","clearInterval","setInterval","flush","track","Promise","resolve","then","trackScreen","name","properties","setUserId","getUserId","setDeviceId","getSessionId","identify","$set","registerSuperProperties","assign","registerSuperPropertiesOnce","k","v","entries","getSuperProperties","unregisterSuperProperty","clearSuperProperties","timeEvent","eventName","addGroup","groupType","groupName","existing","Array","isArray","includes","reset","setGroup","groupIdentify","revenue","props","$productId","$quantity","$price","revenueType","$revenueType","trackCharge","amount","$amount","flushEvents","setOptOut","shutdown"],"sourceRoot":"../../../src","sources":["modules/analytics.ts"],"mappings":";;;;;;AAkEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAkJA,IAAAE,IAAA,GAAAF,OAAA;AArNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ED;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAM3C,KAAKA,CAAA,EAAG;IACZ,IAAI;MACF,MAAM,IAAA1D,uBAAe,EAAC,CAAC,CAACuG,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,OAAO/F,CAAC,EAAE;MACVC,OAAO,CAACC,IAAI,CAAC,qDAAqD,EAAEF,CAAC,CAAC;IACxE;EACF,CAAC;EAED;;EAEAgG,SAASA,CAACvD,MAAe,EAAE;IACzB,IAAIlE,OAAO,EAAEA,OAAO,CAACkE,MAAM,GAAGA,MAAM;EACtC,CAAC;EAED;;EAEAwD,QAAQA,CAAA,EAAG;IACT,IAAIhH,WAAW,EAAE;MACf+D,aAAa,CAAC/D,WAAW,CAAC;MAC1BA,WAAW,GAAG,IAAI;IACpB;IACA,KAAKmD,SAAS,CAACc,KAAK,CAAC,CAAC;EACxB;AACF,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.SKErrorBoundary = exports.CrashReporting = void 0;
|
|
7
7
|
exports.buildStaticContexts = buildStaticContexts;
|
|
8
8
|
exports.parseStackTrace = parseStackTrace;
|
|
9
|
+
var _telemetryContext = require("../internal/telemetry-context.js");
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
10
11
|
var _ids = require("./ids.js");
|
|
11
12
|
var _offlineStore = require("./offline-store.js");
|
|
@@ -38,7 +39,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
38
39
|
// require new native impls on both platforms + spec.ts + tests, well
|
|
39
40
|
// beyond Round-D's "wrap-up the audit" scope.
|
|
40
41
|
//
|
|
41
|
-
// Native crash capture (
|
|
42
|
+
// Native crash capture (iOS signals + NSException, ANR, Android NDK)
|
|
42
43
|
// already goes through the native `SKCrashReporting` module (see the
|
|
43
44
|
// `getNativeCrashModule()` branch below) — those native-side captures
|
|
44
45
|
// ARE on the unified transport. JS-captured errors stay on this fetch
|
|
@@ -49,8 +50,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
49
50
|
/**
|
|
50
51
|
* Optional native module for crash reporting. If the host app has linked
|
|
51
52
|
* the SwissKnife iOS/Android native crash SDKs, this module delegates
|
|
52
|
-
* init/setUser/addBreadcrumb to the native layer — catching
|
|
53
|
-
*
|
|
53
|
+
* init/setUser/addBreadcrumb to the native layer — catching signal crashes and
|
|
54
|
+
* uncaught NSExceptions (iOS) and NDK native crashes (Android) that JS can't
|
|
55
|
+
* see. iOS installs no Mach exception handler.
|
|
54
56
|
*/
|
|
55
57
|
|
|
56
58
|
/** Test seam (same shape as `_screenshotCaptureOverride`): `undefined` =
|
|
@@ -482,7 +484,14 @@ async function readOrMintJsInstallId() {
|
|
|
482
484
|
|
|
483
485
|
// MARK: - Pending Queue (memory + best-effort disk mirror)
|
|
484
486
|
|
|
487
|
+
const capturedContexts = new WeakMap();
|
|
485
488
|
function enqueueEvent(event) {
|
|
489
|
+
event.traceId ??= (0, _telemetryContext.currentTelemetryTraceId)();
|
|
490
|
+
const captured = (0, _telemetryContext.captureTelemetryContext)().then(context => {
|
|
491
|
+
event.sessionId ??= context.sessionId;
|
|
492
|
+
persistQueue();
|
|
493
|
+
});
|
|
494
|
+
capturedContexts.set(event, captured);
|
|
486
495
|
_pendingEvents.push(event);
|
|
487
496
|
if (_pendingEvents.length > MAX_PENDING_EVENTS) {
|
|
488
497
|
const dropped = _pendingEvents.splice(0, _pendingEvents.length - MAX_PENDING_EVENTS);
|
|
@@ -1656,6 +1665,18 @@ function installConsoleBreadcrumbs() {
|
|
|
1656
1665
|
|
|
1657
1666
|
const CrashReporting = exports.CrashReporting = {
|
|
1658
1667
|
init(config) {
|
|
1668
|
+
// An empty key (typically a build-time env var that was not set) can
|
|
1669
|
+
// never authenticate. Same rule as `configure()` (internal/config.ts
|
|
1670
|
+
// assertApiKey), but logged instead of thrown: `init` usually runs in
|
|
1671
|
+
// module scope, where a throw keeps the app from booting. Nothing is
|
|
1672
|
+
// installed and the native crash module is not started, so the native
|
|
1673
|
+
// layer is not wired with the empty key and a later `init` with the real
|
|
1674
|
+
// key works.
|
|
1675
|
+
const apiKey = config?.apiKey;
|
|
1676
|
+
if (typeof apiKey !== "string" || apiKey.trim() === "") {
|
|
1677
|
+
console.error(`[SwissKnife CrashReporting] init requires a non-empty apiKey (got ${typeof apiKey === "string" ? JSON.stringify(apiKey) : String(apiKey)}); crash reporting is off.`);
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1659
1680
|
// Defaults keep today's behaviour byte-for-byte: every handler is on
|
|
1660
1681
|
// unless the host explicitly opts out. The opt-outs exist for apps whose
|
|
1661
1682
|
// incumbent reporter owns a given global — see each field's doc comment
|
|
@@ -1692,15 +1713,14 @@ const CrashReporting = exports.CrashReporting = {
|
|
|
1692
1713
|
if (_config.enableAppStateTracking) installAppStateListener();
|
|
1693
1714
|
|
|
1694
1715
|
// Initialize native crash handler if the native module is linked.
|
|
1695
|
-
// This catches
|
|
1696
|
-
// crashes + system ANRs (Android) that pure JS cannot observe.
|
|
1716
|
+
// This catches signal crashes + uncaught NSExceptions (iOS) and NDK
|
|
1717
|
+
// native crashes + system ANRs (Android) that pure JS cannot observe.
|
|
1697
1718
|
const nativeMod = _config.enableNativeCrashHandler ? getNativeCrashModule() : null;
|
|
1698
1719
|
if (nativeMod) {
|
|
1699
1720
|
try {
|
|
1700
1721
|
nativeMod.start({
|
|
1701
1722
|
apiKey: config.apiKey,
|
|
1702
1723
|
serverURL: config.serverURL || "",
|
|
1703
|
-
ingestURL: config.ingestURL,
|
|
1704
1724
|
environment: config.environment || "production",
|
|
1705
1725
|
release: config.release || ""
|
|
1706
1726
|
});
|
|
@@ -1945,6 +1965,7 @@ const CrashReporting = exports.CrashReporting = {
|
|
|
1945
1965
|
// - expects `timestamp` as an ISO string (SDK builds it as Date.now() number)
|
|
1946
1966
|
// - rejects `user: null` (schema marks `user` optional, not nullable)
|
|
1947
1967
|
// Coerce both on the wire so the internal SDK shape stays ergonomic.
|
|
1968
|
+
await Promise.all(batch.map(event => capturedContexts.get(event)));
|
|
1948
1969
|
const installId = resolveInstallId();
|
|
1949
1970
|
const serialized = batch.map(e => {
|
|
1950
1971
|
const {
|