@wireai/activation 0.13.2 → 0.13.3
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/AGENTS.md +4 -3
- package/CHANGELOG.md +228 -4
- package/README.md +16 -2
- package/dist/analytics/index.d.mts +4 -4
- package/dist/analytics/index.d.ts +4 -4
- package/dist/analytics/index.js +104 -470
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +102 -468
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/coachmarks/index.d.mts +14 -1
- package/dist/coachmarks/index.d.ts +14 -1
- package/dist/coachmarks/index.js +58 -14
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +58 -14
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/{currentSession-ClkLjcJ0.d.mts → currentSession-BoWtr3Jp.d.mts} +2 -2
- package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-CCOMlaQ2.d.ts} +2 -2
- package/dist/{decision-Bl_M2y3r.d.mts → decision-Cjw0jbEj.d.mts} +1 -1
- package/dist/{decision-Cau5KmP6.d.ts → decision-GfpXAsk_.d.ts} +1 -1
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +220 -573
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -570
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.d.mts +42 -10
- package/dist/questionnaire/index.d.ts +42 -10
- package/dist/questionnaire/index.js +45 -13
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +45 -13
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.d.mts +4 -4
- package/dist/reviews/index.d.ts +4 -4
- package/dist/reviews/index.js +27 -7
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +27 -7
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/showcase/index.js +7 -2
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +7 -2
- package/dist/showcase/index.mjs.map +1 -1
- package/dist/{transport-DsRe4epC.d.ts → transport-CefdERPs.d.mts} +44 -5
- package/dist/{transport-CF_eHwzC.d.mts → transport-DFuPyCoJ.d.ts} +44 -5
- package/dist/{types-Buj9Lw9t.d.ts → types-UVYt9BJe.d.ts} +41 -1
- package/dist/{types-CNUqMK0D.d.mts → types-l2tfg23P.d.mts} +41 -1
- package/package.json +4 -1
- package/src/OnboardingFlow.tsx +44 -15
- package/src/WireOnboarding.tsx +7 -6
- package/src/activation/wireActivation.ts +3 -3
- package/src/analytics/analyticsFacade.ts +2 -2
- package/src/analytics/eventQueue.ts +83 -20
- package/src/cards/CardGridSelectCard.tsx +1 -1
- package/src/cards/ChipSelectCard.tsx +2 -2
- package/src/cards/SelectionCard.tsx +1 -1
- package/src/coachmarks/runtime.ts +62 -2
- package/src/coachmarks/useCoachmarkTour.ts +62 -14
- package/src/context/deviceId.ts +4 -4
- package/src/features/WireFeaturesProvider.tsx +4 -1
- package/src/identity/userIdentity.ts +1 -1
- package/src/questionnaire/QuestionnaireGate.tsx +90 -10
- package/src/questionnaire/index.ts +9 -1
- package/src/questionnaire/transport.ts +46 -11
- package/src/reviews/ReviewGate.tsx +61 -6
- package/src/reviews/index.ts +10 -1
- package/src/reviews/transport.ts +58 -12
- package/src/session-analytics/useLifecycleEvents.ts +1 -1
- package/src/theme/ThemeContext.tsx +42 -1
- package/src/types.ts +1 -1
- package/src/utils/submitResult.ts +39 -0
package/dist/analytics/index.js
CHANGED
|
@@ -1,404 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var reactNative = require('react-native');
|
|
4
3
|
var react = require('react');
|
|
4
|
+
var reactNative = require('react-native');
|
|
5
5
|
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
6
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
7
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
8
|
}) : x)(function(x) {
|
|
13
9
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
10
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
11
|
});
|
|
16
|
-
var __esm = (fn, res) => function __init() {
|
|
17
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
-
};
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name2 in all)
|
|
21
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
22
|
-
};
|
|
23
|
-
var __copyProps = (to, from, except, desc) => {
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
-
for (let key of __getOwnPropNames(from))
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
-
}
|
|
29
|
-
return to;
|
|
30
|
-
};
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// node_modules/expo-modules-core/src/errors/CodedError.ts
|
|
34
|
-
var CodedError;
|
|
35
|
-
var init_CodedError = __esm({
|
|
36
|
-
"node_modules/expo-modules-core/src/errors/CodedError.ts"() {
|
|
37
|
-
CodedError = class extends Error {
|
|
38
|
-
constructor(code, message) {
|
|
39
|
-
super(message);
|
|
40
|
-
this.code = code;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// node_modules/expo-modules-core/src/NativeModulesProxy.ts
|
|
47
|
-
var NativeModulesProxy_default;
|
|
48
|
-
var init_NativeModulesProxy = __esm({
|
|
49
|
-
"node_modules/expo-modules-core/src/NativeModulesProxy.ts"() {
|
|
50
|
-
NativeModulesProxy_default = {};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// node_modules/expo-modules-core/src/TurboModuleToExpoModuleProxy.ts
|
|
55
|
-
function createTurboModuleToExpoProxy(turboModule, name2) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
var init_TurboModuleToExpoModuleProxy = __esm({
|
|
59
|
-
"node_modules/expo-modules-core/src/TurboModuleToExpoModuleProxy.ts"() {
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
var init_ensureNativeModulesAreInstalled = __esm({
|
|
63
|
-
"node_modules/expo-modules-core/src/ensureNativeModulesAreInstalled.ts"() {
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
function requireOptionalNativeModule(moduleName) {
|
|
67
|
-
var _a2, _b, _c, _d, _e;
|
|
68
|
-
try {
|
|
69
|
-
return (_e = (_d = (_c = (_b = (_a2 = globalThis.expo) == null ? void 0 : _a2.modules) == null ? void 0 : _b[moduleName]) != null ? _c : NativeModulesProxy_default[moduleName]) != null ? _d : createTurboModuleToExpoProxy(reactNative.TurboModuleRegistry.get(moduleName), moduleName)) != null ? _e : null;
|
|
70
|
-
} catch (e) {
|
|
71
|
-
const error = e;
|
|
72
|
-
console.warn(`An error occurred while requiring the '${moduleName}' module: ${error.message}`);
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
var init_requireNativeModule = __esm({
|
|
77
|
-
"node_modules/expo-modules-core/src/requireNativeModule.ts"() {
|
|
78
|
-
init_NativeModulesProxy();
|
|
79
|
-
init_TurboModuleToExpoModuleProxy();
|
|
80
|
-
init_ensureNativeModulesAreInstalled();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// node_modules/expo-modules-core/src/sweet/setUpJsLogger.fx.ts
|
|
85
|
-
var init_setUpJsLogger_fx = __esm({
|
|
86
|
-
"node_modules/expo-modules-core/src/sweet/setUpJsLogger.fx.ts"() {
|
|
87
|
-
init_CodedError();
|
|
88
|
-
init_requireNativeModule();
|
|
89
|
-
if (__DEV__ && typeof window !== "undefined" && (process.env.EXPO_OS === "android" || process.env.EXPO_OS === "ios")) {
|
|
90
|
-
const NativeJSLogger = requireOptionalNativeModule("ExpoModulesCoreJSLogger");
|
|
91
|
-
if (NativeJSLogger) {
|
|
92
|
-
const onNewException = {
|
|
93
|
-
eventName: "ExpoModulesCoreJSLogger.onNewError",
|
|
94
|
-
action: console.error
|
|
95
|
-
};
|
|
96
|
-
const onNewWarning = {
|
|
97
|
-
eventName: "ExpoModulesCoreJSLogger.onNewWarning",
|
|
98
|
-
action: console.warn
|
|
99
|
-
};
|
|
100
|
-
const onNewDebug = {
|
|
101
|
-
eventName: "ExpoModulesCoreJSLogger.onNewDebug",
|
|
102
|
-
action: console.debug
|
|
103
|
-
};
|
|
104
|
-
const onNewInfo = {
|
|
105
|
-
eventName: "ExpoModulesCoreJSLogger.onNewInfo",
|
|
106
|
-
action: console.info
|
|
107
|
-
};
|
|
108
|
-
const onNewTrace = {
|
|
109
|
-
eventName: "ExpoModulesCoreJSLogger.onNewTrace",
|
|
110
|
-
action: console.trace
|
|
111
|
-
};
|
|
112
|
-
const listeners = [
|
|
113
|
-
onNewException,
|
|
114
|
-
onNewWarning,
|
|
115
|
-
onNewDebug,
|
|
116
|
-
onNewInfo,
|
|
117
|
-
onNewTrace
|
|
118
|
-
];
|
|
119
|
-
for (const listener of listeners) {
|
|
120
|
-
NativeJSLogger.addListener(listener.eventName, ({ message }) => {
|
|
121
|
-
listener.action(message);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
globalThis.ExpoModulesCore_CodedError = CodedError;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// node_modules/expo-modules-core/src/registerWebModule.ts
|
|
131
|
-
var init_registerWebModule = __esm({
|
|
132
|
-
"node_modules/expo-modules-core/src/registerWebModule.ts"() {
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// node_modules/expo-modules-core/src/TypedArrays.types.ts
|
|
137
|
-
var init_TypedArrays_types = __esm({
|
|
138
|
-
"node_modules/expo-modules-core/src/TypedArrays.types.ts"() {
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// node_modules/expo-modules-core/src/PermissionsInterface.ts
|
|
143
|
-
var init_PermissionsInterface = __esm({
|
|
144
|
-
"node_modules/expo-modules-core/src/PermissionsInterface.ts"() {
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
var init_PermissionsHook = __esm({
|
|
148
|
-
"node_modules/expo-modules-core/src/PermissionsHook.ts"() {
|
|
149
|
-
"use client";
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
var init_Refs = __esm({
|
|
153
|
-
"node_modules/expo-modules-core/src/Refs.ts"() {
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
var init_useReleasingSharedObject = __esm({
|
|
157
|
-
"node_modules/expo-modules-core/src/hooks/useReleasingSharedObject.ts"() {
|
|
158
|
-
"use client";
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// node_modules/expo-modules-core/src/reload.ts
|
|
163
|
-
var init_reload = __esm({
|
|
164
|
-
"node_modules/expo-modules-core/src/reload.ts"() {
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// node_modules/expo-modules-core/src/index.ts
|
|
169
|
-
var init_src = __esm({
|
|
170
|
-
"node_modules/expo-modules-core/src/index.ts"() {
|
|
171
|
-
init_setUpJsLogger_fx();
|
|
172
|
-
init_requireNativeModule();
|
|
173
|
-
init_registerWebModule();
|
|
174
|
-
init_TypedArrays_types();
|
|
175
|
-
init_PermissionsInterface();
|
|
176
|
-
init_PermissionsHook();
|
|
177
|
-
init_Refs();
|
|
178
|
-
init_useReleasingSharedObject();
|
|
179
|
-
init_reload();
|
|
180
|
-
init_CodedError();
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// node_modules/expo-constants/build/Constants.types.js
|
|
185
|
-
var AppOwnership, ExecutionEnvironment, UserInterfaceIdiom;
|
|
186
|
-
var init_Constants_types = __esm({
|
|
187
|
-
"node_modules/expo-constants/build/Constants.types.js"() {
|
|
188
|
-
(function(AppOwnership2) {
|
|
189
|
-
AppOwnership2["Expo"] = "expo";
|
|
190
|
-
})(AppOwnership || (AppOwnership = {}));
|
|
191
|
-
(function(ExecutionEnvironment2) {
|
|
192
|
-
ExecutionEnvironment2["Bare"] = "bare";
|
|
193
|
-
ExecutionEnvironment2["Standalone"] = "standalone";
|
|
194
|
-
ExecutionEnvironment2["StoreClient"] = "storeClient";
|
|
195
|
-
})(ExecutionEnvironment || (ExecutionEnvironment = {}));
|
|
196
|
-
(function(UserInterfaceIdiom2) {
|
|
197
|
-
UserInterfaceIdiom2["Handset"] = "handset";
|
|
198
|
-
UserInterfaceIdiom2["Tablet"] = "tablet";
|
|
199
|
-
UserInterfaceIdiom2["Desktop"] = "desktop";
|
|
200
|
-
UserInterfaceIdiom2["TV"] = "tv";
|
|
201
|
-
UserInterfaceIdiom2["Unsupported"] = "unsupported";
|
|
202
|
-
})(UserInterfaceIdiom || (UserInterfaceIdiom = {}));
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
// node_modules/expo-constants/build/ExponentConstants.js
|
|
207
|
-
var ExponentConstants_default;
|
|
208
|
-
var init_ExponentConstants = __esm({
|
|
209
|
-
"node_modules/expo-constants/build/ExponentConstants.js"() {
|
|
210
|
-
init_src();
|
|
211
|
-
ExponentConstants_default = requireOptionalNativeModule("ExponentConstants");
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// node_modules/expo-constants/build/Constants.js
|
|
216
|
-
var Constants_exports = {};
|
|
217
|
-
__export(Constants_exports, {
|
|
218
|
-
AppOwnership: () => AppOwnership,
|
|
219
|
-
ExecutionEnvironment: () => ExecutionEnvironment,
|
|
220
|
-
UserInterfaceIdiom: () => UserInterfaceIdiom,
|
|
221
|
-
default: () => Constants_default
|
|
222
|
-
});
|
|
223
|
-
function isEmbeddedManifest(manifest) {
|
|
224
|
-
return !isExpoUpdatesManifest(manifest);
|
|
225
|
-
}
|
|
226
|
-
function isExpoUpdatesManifest(manifest) {
|
|
227
|
-
return "metadata" in manifest;
|
|
228
|
-
}
|
|
229
|
-
function getManifest(suppressWarning = false) {
|
|
230
|
-
if (!rawManifest) {
|
|
231
|
-
const invalidManifestType = rawManifest === null ? "null" : "undefined";
|
|
232
|
-
if (nativeConstants.executionEnvironment === ExecutionEnvironment.Bare && reactNative.Platform.OS !== "web") {
|
|
233
|
-
if (!suppressWarning) {
|
|
234
|
-
console.warn(`Constants.manifest is ${invalidManifestType} because the embedded app.config could not be read. Ensure that you have installed the expo-constants build scripts if you need to read from Constants.manifest.`);
|
|
235
|
-
}
|
|
236
|
-
} else if (nativeConstants.executionEnvironment === ExecutionEnvironment.StoreClient || nativeConstants.executionEnvironment === ExecutionEnvironment.Standalone) {
|
|
237
|
-
throw new CodedError("ERR_CONSTANTS_MANIFEST_UNAVAILABLE", `Constants.manifest is ${invalidManifestType}, must be an object.`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return rawManifest;
|
|
241
|
-
}
|
|
242
|
-
var ExpoUpdates, rawUpdatesManifest, rawDevLauncherManifest, rawAppConfig, _a, rawManifest, name, appOwnership, nativeConstants, constants, Constants_default;
|
|
243
|
-
var init_Constants = __esm({
|
|
244
|
-
"node_modules/expo-constants/build/Constants.js"() {
|
|
245
|
-
init_src();
|
|
246
|
-
init_Constants_types();
|
|
247
|
-
init_ExponentConstants();
|
|
248
|
-
init_Constants_types();
|
|
249
|
-
if (!ExponentConstants_default) {
|
|
250
|
-
console.warn("No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?");
|
|
251
|
-
}
|
|
252
|
-
ExpoUpdates = requireOptionalNativeModule("ExpoUpdates");
|
|
253
|
-
rawUpdatesManifest = null;
|
|
254
|
-
if (ExpoUpdates) {
|
|
255
|
-
let updatesManifest;
|
|
256
|
-
if (ExpoUpdates.manifest) {
|
|
257
|
-
updatesManifest = ExpoUpdates.manifest;
|
|
258
|
-
} else if (ExpoUpdates.manifestString) {
|
|
259
|
-
updatesManifest = JSON.parse(ExpoUpdates.manifestString);
|
|
260
|
-
}
|
|
261
|
-
if (updatesManifest && Object.keys(updatesManifest).length > 0) {
|
|
262
|
-
rawUpdatesManifest = updatesManifest;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
rawDevLauncherManifest = null;
|
|
266
|
-
if (reactNative.NativeModules.EXDevLauncher) {
|
|
267
|
-
let devLauncherManifest;
|
|
268
|
-
if (reactNative.NativeModules.EXDevLauncher.manifestString) {
|
|
269
|
-
devLauncherManifest = JSON.parse(reactNative.NativeModules.EXDevLauncher.manifestString);
|
|
270
|
-
}
|
|
271
|
-
if (devLauncherManifest && Object.keys(devLauncherManifest).length > 0) {
|
|
272
|
-
rawDevLauncherManifest = devLauncherManifest;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
rawAppConfig = null;
|
|
276
|
-
if (ExponentConstants_default && ExponentConstants_default.manifest) {
|
|
277
|
-
const appConfig = ExponentConstants_default.manifest;
|
|
278
|
-
if (typeof appConfig === "string") {
|
|
279
|
-
rawAppConfig = JSON.parse(appConfig);
|
|
280
|
-
} else {
|
|
281
|
-
rawAppConfig = appConfig;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
rawManifest = (_a = rawUpdatesManifest != null ? rawUpdatesManifest : rawDevLauncherManifest) != null ? _a : rawAppConfig;
|
|
285
|
-
({ name, appOwnership, ...nativeConstants } = ExponentConstants_default || {});
|
|
286
|
-
constants = {
|
|
287
|
-
...nativeConstants,
|
|
288
|
-
// Ensure this is null in bare workflow
|
|
289
|
-
appOwnership: appOwnership != null ? appOwnership : null
|
|
290
|
-
};
|
|
291
|
-
Object.defineProperties(constants, {
|
|
292
|
-
/**
|
|
293
|
-
* Use `manifest` property by default.
|
|
294
|
-
* This property is only used for internal purposes.
|
|
295
|
-
* It behaves similarly to the original one, but suppresses warning upon no manifest available.
|
|
296
|
-
* `expo-asset` uses it to prevent users from seeing mentioned warning.
|
|
297
|
-
*/
|
|
298
|
-
__unsafeNoWarnManifest: {
|
|
299
|
-
get() {
|
|
300
|
-
const maybeManifest = getManifest(true);
|
|
301
|
-
if (!maybeManifest || !isEmbeddedManifest(maybeManifest)) {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
return maybeManifest;
|
|
305
|
-
},
|
|
306
|
-
enumerable: false
|
|
307
|
-
},
|
|
308
|
-
__unsafeNoWarnManifest2: {
|
|
309
|
-
get() {
|
|
310
|
-
const maybeManifest = getManifest(true);
|
|
311
|
-
if (!maybeManifest || !isExpoUpdatesManifest(maybeManifest)) {
|
|
312
|
-
return null;
|
|
313
|
-
}
|
|
314
|
-
return maybeManifest;
|
|
315
|
-
},
|
|
316
|
-
enumerable: false
|
|
317
|
-
},
|
|
318
|
-
manifest: {
|
|
319
|
-
get() {
|
|
320
|
-
const maybeManifest = getManifest();
|
|
321
|
-
if (!maybeManifest || !isEmbeddedManifest(maybeManifest)) {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
return maybeManifest;
|
|
325
|
-
},
|
|
326
|
-
enumerable: true
|
|
327
|
-
},
|
|
328
|
-
manifest2: {
|
|
329
|
-
get() {
|
|
330
|
-
const maybeManifest = getManifest();
|
|
331
|
-
if (!maybeManifest || !isExpoUpdatesManifest(maybeManifest)) {
|
|
332
|
-
return null;
|
|
333
|
-
}
|
|
334
|
-
return maybeManifest;
|
|
335
|
-
},
|
|
336
|
-
enumerable: true
|
|
337
|
-
},
|
|
338
|
-
expoConfig: {
|
|
339
|
-
get() {
|
|
340
|
-
var _a2, _b;
|
|
341
|
-
const maybeManifest = getManifest(true);
|
|
342
|
-
if (!maybeManifest) {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
if (ExpoUpdates && ExpoUpdates.isEmbeddedLaunch) {
|
|
346
|
-
return rawAppConfig;
|
|
347
|
-
}
|
|
348
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
349
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.expoClient) != null ? _b : null;
|
|
350
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
351
|
-
return maybeManifest;
|
|
352
|
-
}
|
|
353
|
-
return null;
|
|
354
|
-
},
|
|
355
|
-
enumerable: true
|
|
356
|
-
},
|
|
357
|
-
expoGoConfig: {
|
|
358
|
-
get() {
|
|
359
|
-
var _a2, _b;
|
|
360
|
-
const maybeManifest = getManifest(true);
|
|
361
|
-
if (!maybeManifest) {
|
|
362
|
-
return null;
|
|
363
|
-
}
|
|
364
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
365
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.expoGo) != null ? _b : null;
|
|
366
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
367
|
-
return maybeManifest;
|
|
368
|
-
}
|
|
369
|
-
return null;
|
|
370
|
-
},
|
|
371
|
-
enumerable: true
|
|
372
|
-
},
|
|
373
|
-
easConfig: {
|
|
374
|
-
get() {
|
|
375
|
-
var _a2, _b;
|
|
376
|
-
const maybeManifest = getManifest(true);
|
|
377
|
-
if (!maybeManifest) {
|
|
378
|
-
return null;
|
|
379
|
-
}
|
|
380
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
381
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.eas) != null ? _b : null;
|
|
382
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
383
|
-
return maybeManifest;
|
|
384
|
-
}
|
|
385
|
-
return null;
|
|
386
|
-
},
|
|
387
|
-
enumerable: true
|
|
388
|
-
},
|
|
389
|
-
__rawManifest_TEST: {
|
|
390
|
-
get() {
|
|
391
|
-
return rawManifest;
|
|
392
|
-
},
|
|
393
|
-
set(value) {
|
|
394
|
-
rawManifest = value;
|
|
395
|
-
},
|
|
396
|
-
enumerable: false
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
Constants_default = constants;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
12
|
|
|
403
13
|
// src/analytics/reportClientEvent.ts
|
|
404
14
|
var makeSessionId = () => `wire_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
@@ -522,14 +132,14 @@ var ensureCurrentSessionId = () => {
|
|
|
522
132
|
};
|
|
523
133
|
|
|
524
134
|
// src/reviews/transport.ts
|
|
525
|
-
var reportAppEvent = (target,
|
|
526
|
-
var
|
|
527
|
-
if (!(target == null ? void 0 : target.serverUrl) || !
|
|
135
|
+
var reportAppEvent = (target, name, options = {}) => {
|
|
136
|
+
var _a;
|
|
137
|
+
if (!(target == null ? void 0 : target.serverUrl) || !name) return;
|
|
528
138
|
try {
|
|
529
|
-
const supplied = (
|
|
139
|
+
const supplied = (_a = options.sessionId) != null ? _a : "";
|
|
530
140
|
const event = {
|
|
531
141
|
event_type: "app_event",
|
|
532
|
-
question_key:
|
|
142
|
+
question_key: name,
|
|
533
143
|
session_id: supplied.trim().length > 0 ? supplied : ensureCurrentSessionId()
|
|
534
144
|
};
|
|
535
145
|
if (options.deviceKey) event.user_context = { device_key: options.deviceKey };
|
|
@@ -547,24 +157,24 @@ var reportAppEvent = (target, name2, options = {}) => {
|
|
|
547
157
|
// src/analytics/screenTracking.ts
|
|
548
158
|
var getActiveRouteName = (state) => {
|
|
549
159
|
let current = state;
|
|
550
|
-
let
|
|
160
|
+
let name;
|
|
551
161
|
while (current && Array.isArray(current.routes) && current.routes.length > 0) {
|
|
552
162
|
const index = typeof current.index === "number" ? current.index : 0;
|
|
553
163
|
const route = current.routes[index];
|
|
554
164
|
if (!route) break;
|
|
555
|
-
|
|
165
|
+
name = route.name;
|
|
556
166
|
current = route.state;
|
|
557
167
|
}
|
|
558
|
-
return
|
|
168
|
+
return name;
|
|
559
169
|
};
|
|
560
170
|
var createScreenTracker = (options = {}) => {
|
|
561
171
|
let lastScreen;
|
|
562
172
|
return {
|
|
563
173
|
track: (screen) => {
|
|
564
|
-
var
|
|
174
|
+
var _a;
|
|
565
175
|
if (!screen || screen === lastScreen) return;
|
|
566
176
|
lastScreen = screen;
|
|
567
|
-
(
|
|
177
|
+
(_a = options.onScreen) == null ? void 0 : _a.call(options, screen);
|
|
568
178
|
if (options.shouldTrack && !options.shouldTrack(screen)) return;
|
|
569
179
|
reportAppEvent(options.target, "screen", {
|
|
570
180
|
sessionId: options.sessionId,
|
|
@@ -606,8 +216,8 @@ var useScreenTracking = (navigationRef, options = {}) => {
|
|
|
606
216
|
const tracker = trackerRef.current;
|
|
607
217
|
if (!tracker || !(navigationRef == null ? void 0 : navigationRef.addListener)) return;
|
|
608
218
|
const report = () => {
|
|
609
|
-
var
|
|
610
|
-
return tracker.track((_b = (
|
|
219
|
+
var _a, _b;
|
|
220
|
+
return tracker.track((_b = (_a = navigationRef.getCurrentRoute) == null ? void 0 : _a.call(navigationRef)) == null ? void 0 : _b.name);
|
|
611
221
|
};
|
|
612
222
|
report();
|
|
613
223
|
const unsubscribe = navigationRef.addListener("state", report);
|
|
@@ -707,9 +317,9 @@ var runtimeRequire = (moduleName) => {
|
|
|
707
317
|
try {
|
|
708
318
|
switch (moduleName) {
|
|
709
319
|
case "expo-constants":
|
|
710
|
-
return
|
|
320
|
+
return require("expo-constants");
|
|
711
321
|
case "expo-application":
|
|
712
|
-
return
|
|
322
|
+
return require("expo-application");
|
|
713
323
|
default:
|
|
714
324
|
return void 0;
|
|
715
325
|
}
|
|
@@ -732,14 +342,14 @@ var safeInterop = (requireModule, moduleName) => {
|
|
|
732
342
|
};
|
|
733
343
|
var detectAppVersion = (requireModule = runtimeRequire) => {
|
|
734
344
|
try {
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
737
|
-
const expoConfig =
|
|
345
|
+
const constants = safeInterop(requireModule, "expo-constants");
|
|
346
|
+
if (constants) {
|
|
347
|
+
const expoConfig = constants.expoConfig;
|
|
738
348
|
if (expoConfig && typeof expoConfig === "object") {
|
|
739
349
|
const fromExpoConfig = coerceVersion(expoConfig.version);
|
|
740
350
|
if (fromExpoConfig) return fromExpoConfig;
|
|
741
351
|
}
|
|
742
|
-
const fromNative = coerceVersion(
|
|
352
|
+
const fromNative = coerceVersion(constants.nativeAppVersion);
|
|
743
353
|
if (fromNative) return fromNative;
|
|
744
354
|
}
|
|
745
355
|
const application = safeInterop(requireModule, "expo-application");
|
|
@@ -762,7 +372,7 @@ var runtimeRequire2 = (moduleName) => {
|
|
|
762
372
|
if (moduleName !== "expo-device") return void 0;
|
|
763
373
|
if (typeof __require !== "function") return void 0;
|
|
764
374
|
try {
|
|
765
|
-
return
|
|
375
|
+
return require("expo-device");
|
|
766
376
|
} catch {
|
|
767
377
|
return void 0;
|
|
768
378
|
}
|
|
@@ -804,7 +414,7 @@ var deriveFormFactor = (iosIdiom, width, height) => {
|
|
|
804
414
|
return void 0;
|
|
805
415
|
};
|
|
806
416
|
var collectDeviceContext = () => {
|
|
807
|
-
var
|
|
417
|
+
var _a;
|
|
808
418
|
const ctx = { platform: reactNative.Platform.OS };
|
|
809
419
|
try {
|
|
810
420
|
const version = reactNative.Platform.Version;
|
|
@@ -813,26 +423,26 @@ var collectDeviceContext = () => {
|
|
|
813
423
|
}
|
|
814
424
|
} catch {
|
|
815
425
|
}
|
|
816
|
-
let
|
|
426
|
+
let constants = {};
|
|
817
427
|
try {
|
|
818
|
-
|
|
428
|
+
constants = (_a = reactNative.Platform.constants) != null ? _a : {};
|
|
819
429
|
} catch {
|
|
820
|
-
|
|
430
|
+
constants = {};
|
|
821
431
|
}
|
|
822
432
|
let iosIdiom;
|
|
823
433
|
try {
|
|
824
434
|
if (reactNative.Platform.OS === "android") {
|
|
825
|
-
const brand =
|
|
826
|
-
const model =
|
|
827
|
-
const release =
|
|
435
|
+
const brand = constants.Brand;
|
|
436
|
+
const model = constants.Model;
|
|
437
|
+
const release = constants.Release;
|
|
828
438
|
if (typeof brand === "string" && brand) ctx.brand = brand;
|
|
829
439
|
if (typeof model === "string" && model) ctx.model = model;
|
|
830
440
|
if (release !== void 0 && release !== null && String(release)) {
|
|
831
441
|
ctx.osVersion = String(release);
|
|
832
442
|
}
|
|
833
443
|
} else if (reactNative.Platform.OS === "ios") {
|
|
834
|
-
const osVersion =
|
|
835
|
-
const idiom =
|
|
444
|
+
const osVersion = constants.osVersion;
|
|
445
|
+
const idiom = constants.interfaceIdiom;
|
|
836
446
|
if (osVersion !== void 0 && osVersion !== null && String(osVersion)) {
|
|
837
447
|
ctx.osVersion = String(osVersion);
|
|
838
448
|
}
|
|
@@ -873,10 +483,10 @@ var collectDeviceContext = () => {
|
|
|
873
483
|
|
|
874
484
|
// src/analytics/contextEnvelope.ts
|
|
875
485
|
var buildContextEnvelope = (input = {}) => {
|
|
876
|
-
var
|
|
486
|
+
var _a;
|
|
877
487
|
const device = { ...collectDeviceContext() };
|
|
878
488
|
if (input.appVersion) device.appVersion = input.appVersion;
|
|
879
|
-
const effectiveAppVersion = (
|
|
489
|
+
const effectiveAppVersion = (_a = input.appVersion) != null ? _a : device.appVersion;
|
|
880
490
|
const envelope = { device };
|
|
881
491
|
if (input.sessionId) envelope.sessionId = input.sessionId;
|
|
882
492
|
if (effectiveAppVersion) envelope.appVersion = effectiveAppVersion;
|
|
@@ -919,10 +529,11 @@ var claimQueueKey = (preferred, explicit) => {
|
|
|
919
529
|
return key;
|
|
920
530
|
};
|
|
921
531
|
var resetEventQueueKeys = () => claimedQueueKeys().clear();
|
|
532
|
+
var READ_TIMED_OUT = /* @__PURE__ */ Symbol("wireai:storage-read-timeout");
|
|
922
533
|
var withTimeout = (p, ms) => {
|
|
923
534
|
let timer;
|
|
924
535
|
const timeout = new Promise((resolve) => {
|
|
925
|
-
timer = setTimeout(() => resolve(
|
|
536
|
+
timer = setTimeout(() => resolve(READ_TIMED_OUT), ms);
|
|
926
537
|
});
|
|
927
538
|
return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
|
|
928
539
|
};
|
|
@@ -947,10 +558,10 @@ var parsePersisted = (raw) => {
|
|
|
947
558
|
}
|
|
948
559
|
};
|
|
949
560
|
var createEventQueue = (options) => {
|
|
950
|
-
var
|
|
561
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
951
562
|
const target = options.target;
|
|
952
563
|
const storage = options.storage;
|
|
953
|
-
const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(
|
|
564
|
+
const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a = options.appId) != null ? _a : "default"}`;
|
|
954
565
|
const key = storage ? claimQueueKey(defaultKey, options.storageKey !== void 0) : defaultKey;
|
|
955
566
|
const maxSize = (_c = options.maxSize) != null ? _c : DEFAULTS.maxSize;
|
|
956
567
|
const batchSize = (_d = options.batchSize) != null ? _d : DEFAULTS.batchSize;
|
|
@@ -962,6 +573,7 @@ var createEventQueue = (options) => {
|
|
|
962
573
|
let flushing = false;
|
|
963
574
|
let attempt = 0;
|
|
964
575
|
let retryTimer;
|
|
576
|
+
let backlogUnread = false;
|
|
965
577
|
const resolveEnvelope = () => {
|
|
966
578
|
try {
|
|
967
579
|
return typeof options.envelope === "function" ? options.envelope() : options.envelope;
|
|
@@ -970,14 +582,14 @@ var createEventQueue = (options) => {
|
|
|
970
582
|
}
|
|
971
583
|
};
|
|
972
584
|
const stamp = (event) => {
|
|
973
|
-
var
|
|
585
|
+
var _a2;
|
|
974
586
|
const env = resolveEnvelope();
|
|
975
587
|
const stamped = { ...event };
|
|
976
588
|
if (stamped.ts === void 0) stamped.ts = Date.now();
|
|
977
589
|
if (!env) return stamped;
|
|
978
590
|
if (!stamped.device && env.device) stamped.device = env.device;
|
|
979
591
|
if (!stamped.session_id && env.sessionId) stamped.session_id = env.sessionId;
|
|
980
|
-
const uc = { ...(
|
|
592
|
+
const uc = { ...(_a2 = stamped.user_context) != null ? _a2 : {} };
|
|
981
593
|
if (env.appVersion && uc.app_version === void 0) uc.app_version = env.appVersion;
|
|
982
594
|
if (env.appBuild && uc.app_build === void 0) uc.app_build = env.appBuild;
|
|
983
595
|
if (env.networkType && uc.network_type === void 0) uc.network_type = env.networkType;
|
|
@@ -986,6 +598,7 @@ var createEventQueue = (options) => {
|
|
|
986
598
|
};
|
|
987
599
|
const persist = () => {
|
|
988
600
|
if (!storage) return;
|
|
601
|
+
if (backlogUnread) return;
|
|
989
602
|
try {
|
|
990
603
|
if (pending.length === 0) {
|
|
991
604
|
void storage.removeItem(key).catch(() => {
|
|
@@ -1008,23 +621,44 @@ var createEventQueue = (options) => {
|
|
|
1008
621
|
return `__nosig_${nextId}_${Math.random()}`;
|
|
1009
622
|
}
|
|
1010
623
|
};
|
|
624
|
+
const mergePersisted = (persistedItems) => {
|
|
625
|
+
if (persistedItems.length === 0) return;
|
|
626
|
+
const seen = new Set(pending.map((item) => item.sig));
|
|
627
|
+
const restored = [];
|
|
628
|
+
for (const persisted of persistedItems) {
|
|
629
|
+
const sig = safeSig(persisted.event);
|
|
630
|
+
if (seen.has(sig)) continue;
|
|
631
|
+
seen.add(sig);
|
|
632
|
+
restored.push({ id: nextId++, event: persisted.event, sig });
|
|
633
|
+
}
|
|
634
|
+
if (restored.length === 0) return;
|
|
635
|
+
pending = [...restored, ...pending];
|
|
636
|
+
enforceSizeCap();
|
|
637
|
+
persist();
|
|
638
|
+
};
|
|
1011
639
|
const loadPromise = (async () => {
|
|
1012
640
|
if (!storage) return;
|
|
1013
641
|
try {
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
642
|
+
const read = Promise.resolve(storage.getItem(key));
|
|
643
|
+
read.catch(() => {
|
|
644
|
+
});
|
|
645
|
+
const raced = await withTimeout(read, READ_TIMEOUT_MS);
|
|
646
|
+
if (raced === READ_TIMED_OUT) {
|
|
647
|
+
backlogUnread = true;
|
|
648
|
+
warnInDev(
|
|
649
|
+
`[wireai] the persisted analytics backlog at "${key}" took longer than ${READ_TIMEOUT_MS}ms to read, so the queue started without it. The stored events are NOT discarded: writes are held back until the read lands, and the backlog is merged in then. If you see this on every cold start, your storage adapter is too slow to be on the launch path.`
|
|
650
|
+
);
|
|
651
|
+
void read.then((late) => {
|
|
652
|
+
backlogUnread = false;
|
|
653
|
+
mergePersisted(parsePersisted(late));
|
|
654
|
+
flush();
|
|
655
|
+
}).catch(() => {
|
|
656
|
+
backlogUnread = false;
|
|
657
|
+
persist();
|
|
658
|
+
});
|
|
659
|
+
return;
|
|
1025
660
|
}
|
|
1026
|
-
|
|
1027
|
-
persist();
|
|
661
|
+
mergePersisted(parsePersisted(raced));
|
|
1028
662
|
} catch {
|
|
1029
663
|
}
|
|
1030
664
|
})();
|
|
@@ -1173,7 +807,7 @@ var clearUserContext = async (opts = {}) => {
|
|
|
1173
807
|
}
|
|
1174
808
|
};
|
|
1175
809
|
var resolveUserContext = (ctx = {}, opts = {}) => {
|
|
1176
|
-
var
|
|
810
|
+
var _a;
|
|
1177
811
|
const result = {};
|
|
1178
812
|
const bucket = {};
|
|
1179
813
|
const userId = sanitizeUserId(ctx.userId);
|
|
@@ -1183,7 +817,7 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
|
|
|
1183
817
|
result.deviceKey = deviceKey;
|
|
1184
818
|
bucket.device_key = deviceKey;
|
|
1185
819
|
}
|
|
1186
|
-
const appVersion = (
|
|
820
|
+
const appVersion = (_a = cleanString(ctx.appVersion)) != null ? _a : cleanString(opts.autoAppVersion);
|
|
1187
821
|
if (appVersion) {
|
|
1188
822
|
result.appVersion = appVersion;
|
|
1189
823
|
bucket.app_version = appVersion;
|
|
@@ -1214,11 +848,11 @@ var provenanceRegistry = () => {
|
|
|
1214
848
|
};
|
|
1215
849
|
var provenanceKey = (space, scope) => `${space}:${scope != null ? scope : "default"}`;
|
|
1216
850
|
var resolveIdentity = (input) => {
|
|
1217
|
-
var
|
|
851
|
+
var _a;
|
|
1218
852
|
if (typeof input.value !== "string") return void 0;
|
|
1219
853
|
const value = input.value.trim();
|
|
1220
854
|
if (!value) return void 0;
|
|
1221
|
-
const durable = (
|
|
855
|
+
const durable = (_a = input.durable) != null ? _a : input.source === "host";
|
|
1222
856
|
{
|
|
1223
857
|
provenanceRegistry().host.set(provenanceKey(input.space, input.scope), value);
|
|
1224
858
|
}
|
|
@@ -1248,8 +882,8 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1248
882
|
if (existing) return existing;
|
|
1249
883
|
const slot = deviceIdStorageKey(appId);
|
|
1250
884
|
const degraded = () => {
|
|
1251
|
-
var
|
|
1252
|
-
return { value: (
|
|
885
|
+
var _a;
|
|
886
|
+
return { value: (_a = registry.keys.get(appId)) != null ? _a : minted, durable: false };
|
|
1253
887
|
};
|
|
1254
888
|
const adopted = (value) => ({ value, durable: true });
|
|
1255
889
|
let run;
|
|
@@ -1262,8 +896,8 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1262
896
|
}
|
|
1263
897
|
return Promise.resolve(storage.setItem(slot, minted)).then(
|
|
1264
898
|
() => {
|
|
1265
|
-
var
|
|
1266
|
-
return adopted((
|
|
899
|
+
var _a;
|
|
900
|
+
return adopted((_a = registry.keys.get(appId)) != null ? _a : minted);
|
|
1267
901
|
},
|
|
1268
902
|
degraded
|
|
1269
903
|
);
|
|
@@ -1273,17 +907,17 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1273
907
|
}
|
|
1274
908
|
registry.pending.set(appId, run);
|
|
1275
909
|
void run.then((outcome) => {
|
|
1276
|
-
var
|
|
910
|
+
var _a;
|
|
1277
911
|
if (outcome.durable) return;
|
|
1278
|
-
(
|
|
912
|
+
(_a = registry.pending) == null ? void 0 : _a.delete(appId);
|
|
1279
913
|
registry.hydrating.delete(appId);
|
|
1280
914
|
});
|
|
1281
915
|
return run;
|
|
1282
916
|
};
|
|
1283
917
|
var resolveAutoDeviceKey = (opts = {}) => {
|
|
1284
|
-
var
|
|
918
|
+
var _a, _b;
|
|
1285
919
|
const registry = autoDeviceKeyRegistry();
|
|
1286
|
-
const appId = (
|
|
920
|
+
const appId = (_a = opts.appId) != null ? _a : "default";
|
|
1287
921
|
let id = registry.keys.get(appId);
|
|
1288
922
|
if (!id) {
|
|
1289
923
|
id = mintDeviceId();
|
|
@@ -1297,19 +931,19 @@ var resolveAutoDeviceKey = (opts = {}) => {
|
|
|
1297
931
|
return (_b = registry.keys.get(appId)) != null ? _b : id;
|
|
1298
932
|
};
|
|
1299
933
|
var resetAutoDeviceKeys = () => {
|
|
1300
|
-
var
|
|
934
|
+
var _a;
|
|
1301
935
|
const registry = autoDeviceKeyRegistry();
|
|
1302
936
|
registry.keys.clear();
|
|
1303
937
|
registry.hydrating.clear();
|
|
1304
|
-
(
|
|
938
|
+
(_a = registry.pending) == null ? void 0 : _a.clear();
|
|
1305
939
|
};
|
|
1306
940
|
|
|
1307
941
|
// src/analytics/analyticsFacade.ts
|
|
1308
942
|
var createAnalytics = (config, options = {}) => {
|
|
1309
|
-
var
|
|
943
|
+
var _a, _b, _c;
|
|
1310
944
|
const resolveSessionId = () => {
|
|
1311
|
-
var
|
|
1312
|
-
return (
|
|
945
|
+
var _a2;
|
|
946
|
+
return (_a2 = config.sessionId) != null ? _a2 : ensureCurrentSessionId();
|
|
1313
947
|
};
|
|
1314
948
|
if (config.sessionId) {
|
|
1315
949
|
warnInDev(
|
|
@@ -1317,7 +951,7 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1317
951
|
);
|
|
1318
952
|
}
|
|
1319
953
|
const detectedAppVersion = detectAppVersion();
|
|
1320
|
-
let userContext = { ...(
|
|
954
|
+
let userContext = { ...(_a = config.userContext) != null ? _a : {} };
|
|
1321
955
|
const hostDeviceKeyAtInit = typeof ((_b = config.userContext) == null ? void 0 : _b.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
|
|
1322
956
|
resolveIdentity({
|
|
1323
957
|
value: hostDeviceKeyAtInit,
|
|
@@ -1332,10 +966,10 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1332
966
|
};
|
|
1333
967
|
if (!hostDeviceKeyAtInit) resolveAutoDeviceKey(autoDeviceKeyOptions);
|
|
1334
968
|
const envelope = () => {
|
|
1335
|
-
var
|
|
969
|
+
var _a2;
|
|
1336
970
|
return buildContextEnvelope({
|
|
1337
971
|
sessionId: resolveSessionId(),
|
|
1338
|
-
appVersion: (
|
|
972
|
+
appVersion: (_a2 = userContext.appVersion) != null ? _a2 : config.appVersion,
|
|
1339
973
|
appBuild: config.appBuild,
|
|
1340
974
|
networkType: config.networkType
|
|
1341
975
|
});
|
|
@@ -1356,12 +990,12 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1356
990
|
});
|
|
1357
991
|
}
|
|
1358
992
|
const applyContext = (event) => {
|
|
1359
|
-
var
|
|
993
|
+
var _a2, _b2;
|
|
1360
994
|
const hostDeviceKey = typeof userContext.deviceKey === "string" && userContext.deviceKey.trim() ? userContext.deviceKey : void 0;
|
|
1361
995
|
const resolved = resolveUserContext(
|
|
1362
996
|
// `??` is lazy on purpose: a host-supplied key must never even touch the auto registry.
|
|
1363
997
|
{ ...userContext, deviceKey: hostDeviceKey != null ? hostDeviceKey : resolveAutoDeviceKey(autoDeviceKeyOptions) },
|
|
1364
|
-
{ autoAppVersion: (
|
|
998
|
+
{ autoAppVersion: (_a2 = config.appVersion) != null ? _a2 : detectedAppVersion }
|
|
1365
999
|
);
|
|
1366
1000
|
if (resolved.userContext) {
|
|
1367
1001
|
event.user_context = { ...resolved.userContext, ...(_b2 = event.user_context) != null ? _b2 : {} };
|
|
@@ -1376,9 +1010,9 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1376
1010
|
return void 0;
|
|
1377
1011
|
};
|
|
1378
1012
|
const setUserContext = (partial) => {
|
|
1379
|
-
var
|
|
1013
|
+
var _a2, _b2;
|
|
1380
1014
|
if (!partial || typeof partial !== "object") return;
|
|
1381
|
-
const mergedExtra = partial.extra || userContext.extra ? { ...(
|
|
1015
|
+
const mergedExtra = partial.extra || userContext.extra ? { ...(_a2 = userContext.extra) != null ? _a2 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
|
|
1382
1016
|
userContext = { ...userContext, ...partial };
|
|
1383
1017
|
if (mergedExtra) userContext.extra = mergedExtra;
|
|
1384
1018
|
const uid = sanitizeUserId(partial.userId);
|
|
@@ -1408,9 +1042,9 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1408
1042
|
applyContext(clientEvent);
|
|
1409
1043
|
queue.enqueue(clientEvent);
|
|
1410
1044
|
};
|
|
1411
|
-
const screen = (
|
|
1412
|
-
if (!
|
|
1413
|
-
const meta = { screen:
|
|
1045
|
+
const screen = (name, props) => {
|
|
1046
|
+
if (!name) return;
|
|
1047
|
+
const meta = { screen: name, ...props != null ? props : {} };
|
|
1414
1048
|
const clientEvent = {
|
|
1415
1049
|
event_type: "app_event",
|
|
1416
1050
|
session_id: resolveSessionId(),
|
|
@@ -1453,7 +1087,7 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1453
1087
|
};
|
|
1454
1088
|
};
|
|
1455
1089
|
var useAnalytics = (config, options = {}) => {
|
|
1456
|
-
var
|
|
1090
|
+
var _a;
|
|
1457
1091
|
const ref = react.useRef(void 0);
|
|
1458
1092
|
const prevKeys = react.useRef("");
|
|
1459
1093
|
const currentKeys = `${config.serverUrl}|${config.apiKey}|${config.appId}`;
|
|
@@ -1461,10 +1095,10 @@ var useAnalytics = (config, options = {}) => {
|
|
|
1461
1095
|
prevKeys.current = currentKeys;
|
|
1462
1096
|
ref.current = createAnalytics(config, options);
|
|
1463
1097
|
}
|
|
1464
|
-
const hostDeviceKey = typeof ((
|
|
1098
|
+
const hostDeviceKey = typeof ((_a = config.userContext) == null ? void 0 : _a.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
|
|
1465
1099
|
react.useEffect(() => {
|
|
1466
|
-
var
|
|
1467
|
-
if (hostDeviceKey) (
|
|
1100
|
+
var _a2;
|
|
1101
|
+
if (hostDeviceKey) (_a2 = ref.current) == null ? void 0 : _a2.setUserContext({ deviceKey: hostDeviceKey });
|
|
1468
1102
|
}, [hostDeviceKey]);
|
|
1469
1103
|
return ref.current;
|
|
1470
1104
|
};
|