@wireai/activation 0.13.0 → 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 +7 -4
- package/CHANGELOG.md +341 -4
- package/README.md +98 -2
- package/dist/analytics/index.d.mts +4 -4
- package/dist/analytics/index.d.ts +4 -4
- package/dist/analytics/index.js +164 -471
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +162 -469
- 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-_GynvhzT.d.mts → currentSession-BoWtr3Jp.d.mts} +299 -14
- package/dist/{currentSession-D7zabMXK.d.ts → currentSession-CCOMlaQ2.d.ts} +299 -14
- 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 +218 -4
- package/dist/index.d.ts +218 -4
- package/dist/index.js +1104 -888
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +887 -692
- 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 +39 -8
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +39 -8
- 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 +175 -15
- package/src/WireOnboarding.tsx +70 -8
- package/src/activation/wireActivation.ts +3 -3
- package/src/analytics/analyticsEvent.ts +16 -1
- package/src/analytics/analyticsFacade.ts +2 -2
- package/src/analytics/eventQueue.ts +85 -20
- package/src/analytics/reportClientEvent.ts +68 -12
- package/src/cards/CardGridSelectCard.tsx +1 -1
- package/src/cards/ChipSelectCard.tsx +2 -2
- package/src/cards/PermissionCard.tsx +438 -0
- package/src/cards/SelectionCard.tsx +1 -1
- package/src/cards/index.ts +7 -0
- 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/illustrations/defaultIllustrations.tsx +44 -3
- package/src/index.ts +38 -0
- package/src/permissions/index.ts +64 -0
- package/src/permissions/permissionCopy.ts +87 -0
- package/src/permissions/permissionEvents.ts +76 -0
- package/src/permissions/permissionMemory.ts +88 -0
- package/src/permissions/placement.ts +88 -0
- package/src/permissions/types.ts +131 -0
- 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/persistedSession.ts +10 -3
- package/src/session-analytics/useLifecycleEvents.ts +1 -1
- package/src/theme/ThemeContext.tsx +42 -1
- package/src/types.ts +66 -4
- package/src/utils/submitResult.ts +39 -0
package/dist/analytics/index.mjs
CHANGED
|
@@ -1,412 +1,33 @@
|
|
|
1
|
-
import { Platform, Dimensions, I18nManager, NativeModules, TurboModuleRegistry } from 'react-native';
|
|
2
1
|
import { useRef, useEffect } from 'react';
|
|
2
|
+
import { Platform, Dimensions, I18nManager } from 'react-native';
|
|
3
3
|
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
5
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
6
|
}) : x)(function(x) {
|
|
11
7
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
8
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
9
|
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
-
};
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name2 in all)
|
|
19
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
10
|
|
|
31
|
-
//
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
super(message);
|
|
38
|
-
this.code = code;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// node_modules/expo-modules-core/src/NativeModulesProxy.ts
|
|
45
|
-
var NativeModulesProxy_default;
|
|
46
|
-
var init_NativeModulesProxy = __esm({
|
|
47
|
-
"node_modules/expo-modules-core/src/NativeModulesProxy.ts"() {
|
|
48
|
-
NativeModulesProxy_default = {};
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// node_modules/expo-modules-core/src/TurboModuleToExpoModuleProxy.ts
|
|
53
|
-
function createTurboModuleToExpoProxy(turboModule, name2) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
var init_TurboModuleToExpoModuleProxy = __esm({
|
|
57
|
-
"node_modules/expo-modules-core/src/TurboModuleToExpoModuleProxy.ts"() {
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var init_ensureNativeModulesAreInstalled = __esm({
|
|
61
|
-
"node_modules/expo-modules-core/src/ensureNativeModulesAreInstalled.ts"() {
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
function requireOptionalNativeModule(moduleName) {
|
|
65
|
-
var _a2, _b, _c, _d, _e;
|
|
11
|
+
// src/analytics/reportClientEvent.ts
|
|
12
|
+
var makeSessionId = () => `wire_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
13
|
+
var toWireEvents = (events) => events.map((event) => {
|
|
14
|
+
if (typeof event.ts !== "number") return event;
|
|
15
|
+
const { ts, ...rest } = event;
|
|
16
|
+
if (!Number.isFinite(ts)) return rest;
|
|
66
17
|
try {
|
|
67
|
-
return
|
|
68
|
-
} catch
|
|
69
|
-
|
|
70
|
-
console.warn(`An error occurred while requiring the '${moduleName}' module: ${error.message}`);
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
var init_requireNativeModule = __esm({
|
|
75
|
-
"node_modules/expo-modules-core/src/requireNativeModule.ts"() {
|
|
76
|
-
init_NativeModulesProxy();
|
|
77
|
-
init_TurboModuleToExpoModuleProxy();
|
|
78
|
-
init_ensureNativeModulesAreInstalled();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// node_modules/expo-modules-core/src/sweet/setUpJsLogger.fx.ts
|
|
83
|
-
var init_setUpJsLogger_fx = __esm({
|
|
84
|
-
"node_modules/expo-modules-core/src/sweet/setUpJsLogger.fx.ts"() {
|
|
85
|
-
init_CodedError();
|
|
86
|
-
init_requireNativeModule();
|
|
87
|
-
if (__DEV__ && typeof window !== "undefined" && (process.env.EXPO_OS === "android" || process.env.EXPO_OS === "ios")) {
|
|
88
|
-
const NativeJSLogger = requireOptionalNativeModule("ExpoModulesCoreJSLogger");
|
|
89
|
-
if (NativeJSLogger) {
|
|
90
|
-
const onNewException = {
|
|
91
|
-
eventName: "ExpoModulesCoreJSLogger.onNewError",
|
|
92
|
-
action: console.error
|
|
93
|
-
};
|
|
94
|
-
const onNewWarning = {
|
|
95
|
-
eventName: "ExpoModulesCoreJSLogger.onNewWarning",
|
|
96
|
-
action: console.warn
|
|
97
|
-
};
|
|
98
|
-
const onNewDebug = {
|
|
99
|
-
eventName: "ExpoModulesCoreJSLogger.onNewDebug",
|
|
100
|
-
action: console.debug
|
|
101
|
-
};
|
|
102
|
-
const onNewInfo = {
|
|
103
|
-
eventName: "ExpoModulesCoreJSLogger.onNewInfo",
|
|
104
|
-
action: console.info
|
|
105
|
-
};
|
|
106
|
-
const onNewTrace = {
|
|
107
|
-
eventName: "ExpoModulesCoreJSLogger.onNewTrace",
|
|
108
|
-
action: console.trace
|
|
109
|
-
};
|
|
110
|
-
const listeners = [
|
|
111
|
-
onNewException,
|
|
112
|
-
onNewWarning,
|
|
113
|
-
onNewDebug,
|
|
114
|
-
onNewInfo,
|
|
115
|
-
onNewTrace
|
|
116
|
-
];
|
|
117
|
-
for (const listener of listeners) {
|
|
118
|
-
NativeJSLogger.addListener(listener.eventName, ({ message }) => {
|
|
119
|
-
listener.action(message);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
globalThis.ExpoModulesCore_CodedError = CodedError;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// node_modules/expo-modules-core/src/registerWebModule.ts
|
|
129
|
-
var init_registerWebModule = __esm({
|
|
130
|
-
"node_modules/expo-modules-core/src/registerWebModule.ts"() {
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// node_modules/expo-modules-core/src/TypedArrays.types.ts
|
|
135
|
-
var init_TypedArrays_types = __esm({
|
|
136
|
-
"node_modules/expo-modules-core/src/TypedArrays.types.ts"() {
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// node_modules/expo-modules-core/src/PermissionsInterface.ts
|
|
141
|
-
var init_PermissionsInterface = __esm({
|
|
142
|
-
"node_modules/expo-modules-core/src/PermissionsInterface.ts"() {
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
var init_PermissionsHook = __esm({
|
|
146
|
-
"node_modules/expo-modules-core/src/PermissionsHook.ts"() {
|
|
147
|
-
"use client";
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
var init_Refs = __esm({
|
|
151
|
-
"node_modules/expo-modules-core/src/Refs.ts"() {
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
var init_useReleasingSharedObject = __esm({
|
|
155
|
-
"node_modules/expo-modules-core/src/hooks/useReleasingSharedObject.ts"() {
|
|
156
|
-
"use client";
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// node_modules/expo-modules-core/src/reload.ts
|
|
161
|
-
var init_reload = __esm({
|
|
162
|
-
"node_modules/expo-modules-core/src/reload.ts"() {
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// node_modules/expo-modules-core/src/index.ts
|
|
167
|
-
var init_src = __esm({
|
|
168
|
-
"node_modules/expo-modules-core/src/index.ts"() {
|
|
169
|
-
init_setUpJsLogger_fx();
|
|
170
|
-
init_requireNativeModule();
|
|
171
|
-
init_registerWebModule();
|
|
172
|
-
init_TypedArrays_types();
|
|
173
|
-
init_PermissionsInterface();
|
|
174
|
-
init_PermissionsHook();
|
|
175
|
-
init_Refs();
|
|
176
|
-
init_useReleasingSharedObject();
|
|
177
|
-
init_reload();
|
|
178
|
-
init_CodedError();
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// node_modules/expo-constants/build/Constants.types.js
|
|
183
|
-
var AppOwnership, ExecutionEnvironment, UserInterfaceIdiom;
|
|
184
|
-
var init_Constants_types = __esm({
|
|
185
|
-
"node_modules/expo-constants/build/Constants.types.js"() {
|
|
186
|
-
(function(AppOwnership2) {
|
|
187
|
-
AppOwnership2["Expo"] = "expo";
|
|
188
|
-
})(AppOwnership || (AppOwnership = {}));
|
|
189
|
-
(function(ExecutionEnvironment2) {
|
|
190
|
-
ExecutionEnvironment2["Bare"] = "bare";
|
|
191
|
-
ExecutionEnvironment2["Standalone"] = "standalone";
|
|
192
|
-
ExecutionEnvironment2["StoreClient"] = "storeClient";
|
|
193
|
-
})(ExecutionEnvironment || (ExecutionEnvironment = {}));
|
|
194
|
-
(function(UserInterfaceIdiom2) {
|
|
195
|
-
UserInterfaceIdiom2["Handset"] = "handset";
|
|
196
|
-
UserInterfaceIdiom2["Tablet"] = "tablet";
|
|
197
|
-
UserInterfaceIdiom2["Desktop"] = "desktop";
|
|
198
|
-
UserInterfaceIdiom2["TV"] = "tv";
|
|
199
|
-
UserInterfaceIdiom2["Unsupported"] = "unsupported";
|
|
200
|
-
})(UserInterfaceIdiom || (UserInterfaceIdiom = {}));
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// node_modules/expo-constants/build/ExponentConstants.js
|
|
205
|
-
var ExponentConstants_default;
|
|
206
|
-
var init_ExponentConstants = __esm({
|
|
207
|
-
"node_modules/expo-constants/build/ExponentConstants.js"() {
|
|
208
|
-
init_src();
|
|
209
|
-
ExponentConstants_default = requireOptionalNativeModule("ExponentConstants");
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// node_modules/expo-constants/build/Constants.js
|
|
214
|
-
var Constants_exports = {};
|
|
215
|
-
__export(Constants_exports, {
|
|
216
|
-
AppOwnership: () => AppOwnership,
|
|
217
|
-
ExecutionEnvironment: () => ExecutionEnvironment,
|
|
218
|
-
UserInterfaceIdiom: () => UserInterfaceIdiom,
|
|
219
|
-
default: () => Constants_default
|
|
220
|
-
});
|
|
221
|
-
function isEmbeddedManifest(manifest) {
|
|
222
|
-
return !isExpoUpdatesManifest(manifest);
|
|
223
|
-
}
|
|
224
|
-
function isExpoUpdatesManifest(manifest) {
|
|
225
|
-
return "metadata" in manifest;
|
|
226
|
-
}
|
|
227
|
-
function getManifest(suppressWarning = false) {
|
|
228
|
-
if (!rawManifest) {
|
|
229
|
-
const invalidManifestType = rawManifest === null ? "null" : "undefined";
|
|
230
|
-
if (nativeConstants.executionEnvironment === ExecutionEnvironment.Bare && Platform.OS !== "web") {
|
|
231
|
-
if (!suppressWarning) {
|
|
232
|
-
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.`);
|
|
233
|
-
}
|
|
234
|
-
} else if (nativeConstants.executionEnvironment === ExecutionEnvironment.StoreClient || nativeConstants.executionEnvironment === ExecutionEnvironment.Standalone) {
|
|
235
|
-
throw new CodedError("ERR_CONSTANTS_MANIFEST_UNAVAILABLE", `Constants.manifest is ${invalidManifestType}, must be an object.`);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return rawManifest;
|
|
239
|
-
}
|
|
240
|
-
var ExpoUpdates, rawUpdatesManifest, rawDevLauncherManifest, rawAppConfig, _a, rawManifest, name, appOwnership, nativeConstants, constants, Constants_default;
|
|
241
|
-
var init_Constants = __esm({
|
|
242
|
-
"node_modules/expo-constants/build/Constants.js"() {
|
|
243
|
-
init_src();
|
|
244
|
-
init_Constants_types();
|
|
245
|
-
init_ExponentConstants();
|
|
246
|
-
init_Constants_types();
|
|
247
|
-
if (!ExponentConstants_default) {
|
|
248
|
-
console.warn("No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?");
|
|
249
|
-
}
|
|
250
|
-
ExpoUpdates = requireOptionalNativeModule("ExpoUpdates");
|
|
251
|
-
rawUpdatesManifest = null;
|
|
252
|
-
if (ExpoUpdates) {
|
|
253
|
-
let updatesManifest;
|
|
254
|
-
if (ExpoUpdates.manifest) {
|
|
255
|
-
updatesManifest = ExpoUpdates.manifest;
|
|
256
|
-
} else if (ExpoUpdates.manifestString) {
|
|
257
|
-
updatesManifest = JSON.parse(ExpoUpdates.manifestString);
|
|
258
|
-
}
|
|
259
|
-
if (updatesManifest && Object.keys(updatesManifest).length > 0) {
|
|
260
|
-
rawUpdatesManifest = updatesManifest;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
rawDevLauncherManifest = null;
|
|
264
|
-
if (NativeModules.EXDevLauncher) {
|
|
265
|
-
let devLauncherManifest;
|
|
266
|
-
if (NativeModules.EXDevLauncher.manifestString) {
|
|
267
|
-
devLauncherManifest = JSON.parse(NativeModules.EXDevLauncher.manifestString);
|
|
268
|
-
}
|
|
269
|
-
if (devLauncherManifest && Object.keys(devLauncherManifest).length > 0) {
|
|
270
|
-
rawDevLauncherManifest = devLauncherManifest;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
rawAppConfig = null;
|
|
274
|
-
if (ExponentConstants_default && ExponentConstants_default.manifest) {
|
|
275
|
-
const appConfig = ExponentConstants_default.manifest;
|
|
276
|
-
if (typeof appConfig === "string") {
|
|
277
|
-
rawAppConfig = JSON.parse(appConfig);
|
|
278
|
-
} else {
|
|
279
|
-
rawAppConfig = appConfig;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
rawManifest = (_a = rawUpdatesManifest != null ? rawUpdatesManifest : rawDevLauncherManifest) != null ? _a : rawAppConfig;
|
|
283
|
-
({ name, appOwnership, ...nativeConstants } = ExponentConstants_default || {});
|
|
284
|
-
constants = {
|
|
285
|
-
...nativeConstants,
|
|
286
|
-
// Ensure this is null in bare workflow
|
|
287
|
-
appOwnership: appOwnership != null ? appOwnership : null
|
|
288
|
-
};
|
|
289
|
-
Object.defineProperties(constants, {
|
|
290
|
-
/**
|
|
291
|
-
* Use `manifest` property by default.
|
|
292
|
-
* This property is only used for internal purposes.
|
|
293
|
-
* It behaves similarly to the original one, but suppresses warning upon no manifest available.
|
|
294
|
-
* `expo-asset` uses it to prevent users from seeing mentioned warning.
|
|
295
|
-
*/
|
|
296
|
-
__unsafeNoWarnManifest: {
|
|
297
|
-
get() {
|
|
298
|
-
const maybeManifest = getManifest(true);
|
|
299
|
-
if (!maybeManifest || !isEmbeddedManifest(maybeManifest)) {
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
return maybeManifest;
|
|
303
|
-
},
|
|
304
|
-
enumerable: false
|
|
305
|
-
},
|
|
306
|
-
__unsafeNoWarnManifest2: {
|
|
307
|
-
get() {
|
|
308
|
-
const maybeManifest = getManifest(true);
|
|
309
|
-
if (!maybeManifest || !isExpoUpdatesManifest(maybeManifest)) {
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
return maybeManifest;
|
|
313
|
-
},
|
|
314
|
-
enumerable: false
|
|
315
|
-
},
|
|
316
|
-
manifest: {
|
|
317
|
-
get() {
|
|
318
|
-
const maybeManifest = getManifest();
|
|
319
|
-
if (!maybeManifest || !isEmbeddedManifest(maybeManifest)) {
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
return maybeManifest;
|
|
323
|
-
},
|
|
324
|
-
enumerable: true
|
|
325
|
-
},
|
|
326
|
-
manifest2: {
|
|
327
|
-
get() {
|
|
328
|
-
const maybeManifest = getManifest();
|
|
329
|
-
if (!maybeManifest || !isExpoUpdatesManifest(maybeManifest)) {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
return maybeManifest;
|
|
333
|
-
},
|
|
334
|
-
enumerable: true
|
|
335
|
-
},
|
|
336
|
-
expoConfig: {
|
|
337
|
-
get() {
|
|
338
|
-
var _a2, _b;
|
|
339
|
-
const maybeManifest = getManifest(true);
|
|
340
|
-
if (!maybeManifest) {
|
|
341
|
-
return null;
|
|
342
|
-
}
|
|
343
|
-
if (ExpoUpdates && ExpoUpdates.isEmbeddedLaunch) {
|
|
344
|
-
return rawAppConfig;
|
|
345
|
-
}
|
|
346
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
347
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.expoClient) != null ? _b : null;
|
|
348
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
349
|
-
return maybeManifest;
|
|
350
|
-
}
|
|
351
|
-
return null;
|
|
352
|
-
},
|
|
353
|
-
enumerable: true
|
|
354
|
-
},
|
|
355
|
-
expoGoConfig: {
|
|
356
|
-
get() {
|
|
357
|
-
var _a2, _b;
|
|
358
|
-
const maybeManifest = getManifest(true);
|
|
359
|
-
if (!maybeManifest) {
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
363
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.expoGo) != null ? _b : null;
|
|
364
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
365
|
-
return maybeManifest;
|
|
366
|
-
}
|
|
367
|
-
return null;
|
|
368
|
-
},
|
|
369
|
-
enumerable: true
|
|
370
|
-
},
|
|
371
|
-
easConfig: {
|
|
372
|
-
get() {
|
|
373
|
-
var _a2, _b;
|
|
374
|
-
const maybeManifest = getManifest(true);
|
|
375
|
-
if (!maybeManifest) {
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
if (isExpoUpdatesManifest(maybeManifest)) {
|
|
379
|
-
return (_b = (_a2 = maybeManifest.extra) == null ? void 0 : _a2.eas) != null ? _b : null;
|
|
380
|
-
} else if (isEmbeddedManifest(maybeManifest)) {
|
|
381
|
-
return maybeManifest;
|
|
382
|
-
}
|
|
383
|
-
return null;
|
|
384
|
-
},
|
|
385
|
-
enumerable: true
|
|
386
|
-
},
|
|
387
|
-
__rawManifest_TEST: {
|
|
388
|
-
get() {
|
|
389
|
-
return rawManifest;
|
|
390
|
-
},
|
|
391
|
-
set(value) {
|
|
392
|
-
rawManifest = value;
|
|
393
|
-
},
|
|
394
|
-
enumerable: false
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
Constants_default = constants;
|
|
18
|
+
return { ...rest, ts: new Date(ts).toISOString() };
|
|
19
|
+
} catch {
|
|
20
|
+
return rest;
|
|
398
21
|
}
|
|
399
22
|
});
|
|
400
|
-
|
|
401
|
-
// src/analytics/reportClientEvent.ts
|
|
402
|
-
var makeSessionId = () => `wire_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
403
23
|
var buildEventsRequest = (target, events) => {
|
|
404
24
|
if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return null;
|
|
405
25
|
try {
|
|
406
26
|
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
|
|
407
27
|
const headers = { "Content-Type": "application/json" };
|
|
408
28
|
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
409
|
-
|
|
29
|
+
const body = JSON.stringify({ events: toWireEvents(events) });
|
|
30
|
+
return { url, init: { method: "POST", headers, body } };
|
|
410
31
|
} catch {
|
|
411
32
|
return null;
|
|
412
33
|
}
|
|
@@ -418,7 +39,13 @@ var readEventsAck = async (res) => {
|
|
|
418
39
|
const body = await Promise.resolve(json.call(res));
|
|
419
40
|
const skipped = body == null ? void 0 : body.skipped;
|
|
420
41
|
if (typeof skipped !== "number" || !Number.isFinite(skipped)) return void 0;
|
|
421
|
-
const reasons = Array.isArray(body == null ? void 0 : body.errors) ? body.errors.map((e) =>
|
|
42
|
+
const reasons = Array.isArray(body == null ? void 0 : body.errors) ? body.errors.map((e) => {
|
|
43
|
+
const entry = e;
|
|
44
|
+
const reason = entry == null ? void 0 : entry.reason;
|
|
45
|
+
if (typeof reason !== "string") return void 0;
|
|
46
|
+
const field = entry == null ? void 0 : entry.field;
|
|
47
|
+
return typeof field === "string" && field.length > 0 ? `${reason} (field: ${field})` : reason;
|
|
48
|
+
}).filter((r) => typeof r === "string") : [];
|
|
422
49
|
return { written: typeof (body == null ? void 0 : body.written) === "number" ? body.written : void 0, skipped, reasons };
|
|
423
50
|
} catch {
|
|
424
51
|
return void 0;
|
|
@@ -503,14 +130,14 @@ var ensureCurrentSessionId = () => {
|
|
|
503
130
|
};
|
|
504
131
|
|
|
505
132
|
// src/reviews/transport.ts
|
|
506
|
-
var reportAppEvent = (target,
|
|
507
|
-
var
|
|
508
|
-
if (!(target == null ? void 0 : target.serverUrl) || !
|
|
133
|
+
var reportAppEvent = (target, name, options = {}) => {
|
|
134
|
+
var _a;
|
|
135
|
+
if (!(target == null ? void 0 : target.serverUrl) || !name) return;
|
|
509
136
|
try {
|
|
510
|
-
const supplied = (
|
|
137
|
+
const supplied = (_a = options.sessionId) != null ? _a : "";
|
|
511
138
|
const event = {
|
|
512
139
|
event_type: "app_event",
|
|
513
|
-
question_key:
|
|
140
|
+
question_key: name,
|
|
514
141
|
session_id: supplied.trim().length > 0 ? supplied : ensureCurrentSessionId()
|
|
515
142
|
};
|
|
516
143
|
if (options.deviceKey) event.user_context = { device_key: options.deviceKey };
|
|
@@ -528,24 +155,24 @@ var reportAppEvent = (target, name2, options = {}) => {
|
|
|
528
155
|
// src/analytics/screenTracking.ts
|
|
529
156
|
var getActiveRouteName = (state) => {
|
|
530
157
|
let current = state;
|
|
531
|
-
let
|
|
158
|
+
let name;
|
|
532
159
|
while (current && Array.isArray(current.routes) && current.routes.length > 0) {
|
|
533
160
|
const index = typeof current.index === "number" ? current.index : 0;
|
|
534
161
|
const route = current.routes[index];
|
|
535
162
|
if (!route) break;
|
|
536
|
-
|
|
163
|
+
name = route.name;
|
|
537
164
|
current = route.state;
|
|
538
165
|
}
|
|
539
|
-
return
|
|
166
|
+
return name;
|
|
540
167
|
};
|
|
541
168
|
var createScreenTracker = (options = {}) => {
|
|
542
169
|
let lastScreen;
|
|
543
170
|
return {
|
|
544
171
|
track: (screen) => {
|
|
545
|
-
var
|
|
172
|
+
var _a;
|
|
546
173
|
if (!screen || screen === lastScreen) return;
|
|
547
174
|
lastScreen = screen;
|
|
548
|
-
(
|
|
175
|
+
(_a = options.onScreen) == null ? void 0 : _a.call(options, screen);
|
|
549
176
|
if (options.shouldTrack && !options.shouldTrack(screen)) return;
|
|
550
177
|
reportAppEvent(options.target, "screen", {
|
|
551
178
|
sessionId: options.sessionId,
|
|
@@ -587,8 +214,8 @@ var useScreenTracking = (navigationRef, options = {}) => {
|
|
|
587
214
|
const tracker = trackerRef.current;
|
|
588
215
|
if (!tracker || !(navigationRef == null ? void 0 : navigationRef.addListener)) return;
|
|
589
216
|
const report = () => {
|
|
590
|
-
var
|
|
591
|
-
return tracker.track((_b = (
|
|
217
|
+
var _a, _b;
|
|
218
|
+
return tracker.track((_b = (_a = navigationRef.getCurrentRoute) == null ? void 0 : _a.call(navigationRef)) == null ? void 0 : _b.name);
|
|
592
219
|
};
|
|
593
220
|
report();
|
|
594
221
|
const unsubscribe = navigationRef.addListener("state", report);
|
|
@@ -596,6 +223,43 @@ var useScreenTracking = (navigationRef, options = {}) => {
|
|
|
596
223
|
}, [navigationRef]);
|
|
597
224
|
};
|
|
598
225
|
|
|
226
|
+
// src/permissions/permissionEvents.ts
|
|
227
|
+
var WIRE_PERMISSION_EVENTS = {
|
|
228
|
+
/** The priming screen became visible. The denominator for every rate below. */
|
|
229
|
+
screenShown: "wire_permission_screen_shown",
|
|
230
|
+
/** The user tapped the primary, so the OS dialog is about to open. The rationale worked. */
|
|
231
|
+
primerAccepted: "wire_permission_primer_accepted",
|
|
232
|
+
/** The OS granted it. */
|
|
233
|
+
granted: "wire_permission_granted",
|
|
234
|
+
/** The OS refused it (a permanently blocked answer reports here too, with `status: "blocked"`). */
|
|
235
|
+
denied: "wire_permission_denied",
|
|
236
|
+
/** The user took the secondary. The one native prompt was NOT spent. */
|
|
237
|
+
skipped: "wire_permission_skipped",
|
|
238
|
+
/** A blocked user was redirected to the OS settings page. */
|
|
239
|
+
settingsOpened: "wire_permission_settings_opened"
|
|
240
|
+
};
|
|
241
|
+
var permissionEventName = (stage) => {
|
|
242
|
+
switch (stage) {
|
|
243
|
+
case "shown":
|
|
244
|
+
return WIRE_PERMISSION_EVENTS.screenShown;
|
|
245
|
+
case "accepted":
|
|
246
|
+
return WIRE_PERMISSION_EVENTS.primerAccepted;
|
|
247
|
+
case "granted":
|
|
248
|
+
return WIRE_PERMISSION_EVENTS.granted;
|
|
249
|
+
case "denied":
|
|
250
|
+
return WIRE_PERMISSION_EVENTS.denied;
|
|
251
|
+
case "skipped":
|
|
252
|
+
return WIRE_PERMISSION_EVENTS.skipped;
|
|
253
|
+
case "settings":
|
|
254
|
+
return WIRE_PERMISSION_EVENTS.settingsOpened;
|
|
255
|
+
default: {
|
|
256
|
+
const _exhaustive = stage;
|
|
257
|
+
return _exhaustive;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var permissionEventProps = (permission, status) => status ? { permission, status } : { permission };
|
|
262
|
+
|
|
599
263
|
// src/analytics/analyticsEvent.ts
|
|
600
264
|
var WIRE_ONBOARDING_EVENTS = {
|
|
601
265
|
started: "wire_onboarding_started",
|
|
@@ -628,6 +292,11 @@ var toAnalyticsEvent = (event) => {
|
|
|
628
292
|
};
|
|
629
293
|
case "fallback":
|
|
630
294
|
return { name: WIRE_ONBOARDING_EVENTS.fallback, params: { reason: event.reason } };
|
|
295
|
+
case "permission":
|
|
296
|
+
return {
|
|
297
|
+
name: permissionEventName(event.stage),
|
|
298
|
+
params: permissionEventProps(event.permission, event.status)
|
|
299
|
+
};
|
|
631
300
|
default: {
|
|
632
301
|
const _exhaustive = event;
|
|
633
302
|
return _exhaustive;
|
|
@@ -646,7 +315,7 @@ var runtimeRequire = (moduleName) => {
|
|
|
646
315
|
try {
|
|
647
316
|
switch (moduleName) {
|
|
648
317
|
case "expo-constants":
|
|
649
|
-
return
|
|
318
|
+
return __require("expo-constants");
|
|
650
319
|
case "expo-application":
|
|
651
320
|
return __require("expo-application");
|
|
652
321
|
default:
|
|
@@ -671,14 +340,14 @@ var safeInterop = (requireModule, moduleName) => {
|
|
|
671
340
|
};
|
|
672
341
|
var detectAppVersion = (requireModule = runtimeRequire) => {
|
|
673
342
|
try {
|
|
674
|
-
const
|
|
675
|
-
if (
|
|
676
|
-
const expoConfig =
|
|
343
|
+
const constants = safeInterop(requireModule, "expo-constants");
|
|
344
|
+
if (constants) {
|
|
345
|
+
const expoConfig = constants.expoConfig;
|
|
677
346
|
if (expoConfig && typeof expoConfig === "object") {
|
|
678
347
|
const fromExpoConfig = coerceVersion(expoConfig.version);
|
|
679
348
|
if (fromExpoConfig) return fromExpoConfig;
|
|
680
349
|
}
|
|
681
|
-
const fromNative = coerceVersion(
|
|
350
|
+
const fromNative = coerceVersion(constants.nativeAppVersion);
|
|
682
351
|
if (fromNative) return fromNative;
|
|
683
352
|
}
|
|
684
353
|
const application = safeInterop(requireModule, "expo-application");
|
|
@@ -743,7 +412,7 @@ var deriveFormFactor = (iosIdiom, width, height) => {
|
|
|
743
412
|
return void 0;
|
|
744
413
|
};
|
|
745
414
|
var collectDeviceContext = () => {
|
|
746
|
-
var
|
|
415
|
+
var _a;
|
|
747
416
|
const ctx = { platform: Platform.OS };
|
|
748
417
|
try {
|
|
749
418
|
const version = Platform.Version;
|
|
@@ -752,26 +421,26 @@ var collectDeviceContext = () => {
|
|
|
752
421
|
}
|
|
753
422
|
} catch {
|
|
754
423
|
}
|
|
755
|
-
let
|
|
424
|
+
let constants = {};
|
|
756
425
|
try {
|
|
757
|
-
|
|
426
|
+
constants = (_a = Platform.constants) != null ? _a : {};
|
|
758
427
|
} catch {
|
|
759
|
-
|
|
428
|
+
constants = {};
|
|
760
429
|
}
|
|
761
430
|
let iosIdiom;
|
|
762
431
|
try {
|
|
763
432
|
if (Platform.OS === "android") {
|
|
764
|
-
const brand =
|
|
765
|
-
const model =
|
|
766
|
-
const release =
|
|
433
|
+
const brand = constants.Brand;
|
|
434
|
+
const model = constants.Model;
|
|
435
|
+
const release = constants.Release;
|
|
767
436
|
if (typeof brand === "string" && brand) ctx.brand = brand;
|
|
768
437
|
if (typeof model === "string" && model) ctx.model = model;
|
|
769
438
|
if (release !== void 0 && release !== null && String(release)) {
|
|
770
439
|
ctx.osVersion = String(release);
|
|
771
440
|
}
|
|
772
441
|
} else if (Platform.OS === "ios") {
|
|
773
|
-
const osVersion =
|
|
774
|
-
const idiom =
|
|
442
|
+
const osVersion = constants.osVersion;
|
|
443
|
+
const idiom = constants.interfaceIdiom;
|
|
775
444
|
if (osVersion !== void 0 && osVersion !== null && String(osVersion)) {
|
|
776
445
|
ctx.osVersion = String(osVersion);
|
|
777
446
|
}
|
|
@@ -812,10 +481,10 @@ var collectDeviceContext = () => {
|
|
|
812
481
|
|
|
813
482
|
// src/analytics/contextEnvelope.ts
|
|
814
483
|
var buildContextEnvelope = (input = {}) => {
|
|
815
|
-
var
|
|
484
|
+
var _a;
|
|
816
485
|
const device = { ...collectDeviceContext() };
|
|
817
486
|
if (input.appVersion) device.appVersion = input.appVersion;
|
|
818
|
-
const effectiveAppVersion = (
|
|
487
|
+
const effectiveAppVersion = (_a = input.appVersion) != null ? _a : device.appVersion;
|
|
819
488
|
const envelope = { device };
|
|
820
489
|
if (input.sessionId) envelope.sessionId = input.sessionId;
|
|
821
490
|
if (effectiveAppVersion) envelope.appVersion = effectiveAppVersion;
|
|
@@ -858,10 +527,11 @@ var claimQueueKey = (preferred, explicit) => {
|
|
|
858
527
|
return key;
|
|
859
528
|
};
|
|
860
529
|
var resetEventQueueKeys = () => claimedQueueKeys().clear();
|
|
530
|
+
var READ_TIMED_OUT = /* @__PURE__ */ Symbol("wireai:storage-read-timeout");
|
|
861
531
|
var withTimeout = (p, ms) => {
|
|
862
532
|
let timer;
|
|
863
533
|
const timeout = new Promise((resolve) => {
|
|
864
|
-
timer = setTimeout(() => resolve(
|
|
534
|
+
timer = setTimeout(() => resolve(READ_TIMED_OUT), ms);
|
|
865
535
|
});
|
|
866
536
|
return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
|
|
867
537
|
};
|
|
@@ -886,10 +556,10 @@ var parsePersisted = (raw) => {
|
|
|
886
556
|
}
|
|
887
557
|
};
|
|
888
558
|
var createEventQueue = (options) => {
|
|
889
|
-
var
|
|
559
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
890
560
|
const target = options.target;
|
|
891
561
|
const storage = options.storage;
|
|
892
|
-
const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(
|
|
562
|
+
const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a = options.appId) != null ? _a : "default"}`;
|
|
893
563
|
const key = storage ? claimQueueKey(defaultKey, options.storageKey !== void 0) : defaultKey;
|
|
894
564
|
const maxSize = (_c = options.maxSize) != null ? _c : DEFAULTS.maxSize;
|
|
895
565
|
const batchSize = (_d = options.batchSize) != null ? _d : DEFAULTS.batchSize;
|
|
@@ -901,6 +571,7 @@ var createEventQueue = (options) => {
|
|
|
901
571
|
let flushing = false;
|
|
902
572
|
let attempt = 0;
|
|
903
573
|
let retryTimer;
|
|
574
|
+
let backlogUnread = false;
|
|
904
575
|
const resolveEnvelope = () => {
|
|
905
576
|
try {
|
|
906
577
|
return typeof options.envelope === "function" ? options.envelope() : options.envelope;
|
|
@@ -909,14 +580,14 @@ var createEventQueue = (options) => {
|
|
|
909
580
|
}
|
|
910
581
|
};
|
|
911
582
|
const stamp = (event) => {
|
|
912
|
-
var
|
|
583
|
+
var _a2;
|
|
913
584
|
const env = resolveEnvelope();
|
|
914
585
|
const stamped = { ...event };
|
|
915
586
|
if (stamped.ts === void 0) stamped.ts = Date.now();
|
|
916
587
|
if (!env) return stamped;
|
|
917
588
|
if (!stamped.device && env.device) stamped.device = env.device;
|
|
918
589
|
if (!stamped.session_id && env.sessionId) stamped.session_id = env.sessionId;
|
|
919
|
-
const uc = { ...(
|
|
590
|
+
const uc = { ...(_a2 = stamped.user_context) != null ? _a2 : {} };
|
|
920
591
|
if (env.appVersion && uc.app_version === void 0) uc.app_version = env.appVersion;
|
|
921
592
|
if (env.appBuild && uc.app_build === void 0) uc.app_build = env.appBuild;
|
|
922
593
|
if (env.networkType && uc.network_type === void 0) uc.network_type = env.networkType;
|
|
@@ -925,6 +596,7 @@ var createEventQueue = (options) => {
|
|
|
925
596
|
};
|
|
926
597
|
const persist = () => {
|
|
927
598
|
if (!storage) return;
|
|
599
|
+
if (backlogUnread) return;
|
|
928
600
|
try {
|
|
929
601
|
if (pending.length === 0) {
|
|
930
602
|
void storage.removeItem(key).catch(() => {
|
|
@@ -947,23 +619,44 @@ var createEventQueue = (options) => {
|
|
|
947
619
|
return `__nosig_${nextId}_${Math.random()}`;
|
|
948
620
|
}
|
|
949
621
|
};
|
|
622
|
+
const mergePersisted = (persistedItems) => {
|
|
623
|
+
if (persistedItems.length === 0) return;
|
|
624
|
+
const seen = new Set(pending.map((item) => item.sig));
|
|
625
|
+
const restored = [];
|
|
626
|
+
for (const persisted of persistedItems) {
|
|
627
|
+
const sig = safeSig(persisted.event);
|
|
628
|
+
if (seen.has(sig)) continue;
|
|
629
|
+
seen.add(sig);
|
|
630
|
+
restored.push({ id: nextId++, event: persisted.event, sig });
|
|
631
|
+
}
|
|
632
|
+
if (restored.length === 0) return;
|
|
633
|
+
pending = [...restored, ...pending];
|
|
634
|
+
enforceSizeCap();
|
|
635
|
+
persist();
|
|
636
|
+
};
|
|
950
637
|
const loadPromise = (async () => {
|
|
951
638
|
if (!storage) return;
|
|
952
639
|
try {
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
640
|
+
const read = Promise.resolve(storage.getItem(key));
|
|
641
|
+
read.catch(() => {
|
|
642
|
+
});
|
|
643
|
+
const raced = await withTimeout(read, READ_TIMEOUT_MS);
|
|
644
|
+
if (raced === READ_TIMED_OUT) {
|
|
645
|
+
backlogUnread = true;
|
|
646
|
+
warnInDev(
|
|
647
|
+
`[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.`
|
|
648
|
+
);
|
|
649
|
+
void read.then((late) => {
|
|
650
|
+
backlogUnread = false;
|
|
651
|
+
mergePersisted(parsePersisted(late));
|
|
652
|
+
flush();
|
|
653
|
+
}).catch(() => {
|
|
654
|
+
backlogUnread = false;
|
|
655
|
+
persist();
|
|
656
|
+
});
|
|
657
|
+
return;
|
|
964
658
|
}
|
|
965
|
-
|
|
966
|
-
persist();
|
|
659
|
+
mergePersisted(parsePersisted(raced));
|
|
967
660
|
} catch {
|
|
968
661
|
}
|
|
969
662
|
})();
|
|
@@ -1112,7 +805,7 @@ var clearUserContext = async (opts = {}) => {
|
|
|
1112
805
|
}
|
|
1113
806
|
};
|
|
1114
807
|
var resolveUserContext = (ctx = {}, opts = {}) => {
|
|
1115
|
-
var
|
|
808
|
+
var _a;
|
|
1116
809
|
const result = {};
|
|
1117
810
|
const bucket = {};
|
|
1118
811
|
const userId = sanitizeUserId(ctx.userId);
|
|
@@ -1122,7 +815,7 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
|
|
|
1122
815
|
result.deviceKey = deviceKey;
|
|
1123
816
|
bucket.device_key = deviceKey;
|
|
1124
817
|
}
|
|
1125
|
-
const appVersion = (
|
|
818
|
+
const appVersion = (_a = cleanString(ctx.appVersion)) != null ? _a : cleanString(opts.autoAppVersion);
|
|
1126
819
|
if (appVersion) {
|
|
1127
820
|
result.appVersion = appVersion;
|
|
1128
821
|
bucket.app_version = appVersion;
|
|
@@ -1153,11 +846,11 @@ var provenanceRegistry = () => {
|
|
|
1153
846
|
};
|
|
1154
847
|
var provenanceKey = (space, scope) => `${space}:${scope != null ? scope : "default"}`;
|
|
1155
848
|
var resolveIdentity = (input) => {
|
|
1156
|
-
var
|
|
849
|
+
var _a;
|
|
1157
850
|
if (typeof input.value !== "string") return void 0;
|
|
1158
851
|
const value = input.value.trim();
|
|
1159
852
|
if (!value) return void 0;
|
|
1160
|
-
const durable = (
|
|
853
|
+
const durable = (_a = input.durable) != null ? _a : input.source === "host";
|
|
1161
854
|
{
|
|
1162
855
|
provenanceRegistry().host.set(provenanceKey(input.space, input.scope), value);
|
|
1163
856
|
}
|
|
@@ -1187,8 +880,8 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1187
880
|
if (existing) return existing;
|
|
1188
881
|
const slot = deviceIdStorageKey(appId);
|
|
1189
882
|
const degraded = () => {
|
|
1190
|
-
var
|
|
1191
|
-
return { value: (
|
|
883
|
+
var _a;
|
|
884
|
+
return { value: (_a = registry.keys.get(appId)) != null ? _a : minted, durable: false };
|
|
1192
885
|
};
|
|
1193
886
|
const adopted = (value) => ({ value, durable: true });
|
|
1194
887
|
let run;
|
|
@@ -1201,8 +894,8 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1201
894
|
}
|
|
1202
895
|
return Promise.resolve(storage.setItem(slot, minted)).then(
|
|
1203
896
|
() => {
|
|
1204
|
-
var
|
|
1205
|
-
return adopted((
|
|
897
|
+
var _a;
|
|
898
|
+
return adopted((_a = registry.keys.get(appId)) != null ? _a : minted);
|
|
1206
899
|
},
|
|
1207
900
|
degraded
|
|
1208
901
|
);
|
|
@@ -1212,17 +905,17 @@ var startHydration = (registry, appId, storage, minted) => {
|
|
|
1212
905
|
}
|
|
1213
906
|
registry.pending.set(appId, run);
|
|
1214
907
|
void run.then((outcome) => {
|
|
1215
|
-
var
|
|
908
|
+
var _a;
|
|
1216
909
|
if (outcome.durable) return;
|
|
1217
|
-
(
|
|
910
|
+
(_a = registry.pending) == null ? void 0 : _a.delete(appId);
|
|
1218
911
|
registry.hydrating.delete(appId);
|
|
1219
912
|
});
|
|
1220
913
|
return run;
|
|
1221
914
|
};
|
|
1222
915
|
var resolveAutoDeviceKey = (opts = {}) => {
|
|
1223
|
-
var
|
|
916
|
+
var _a, _b;
|
|
1224
917
|
const registry = autoDeviceKeyRegistry();
|
|
1225
|
-
const appId = (
|
|
918
|
+
const appId = (_a = opts.appId) != null ? _a : "default";
|
|
1226
919
|
let id = registry.keys.get(appId);
|
|
1227
920
|
if (!id) {
|
|
1228
921
|
id = mintDeviceId();
|
|
@@ -1236,19 +929,19 @@ var resolveAutoDeviceKey = (opts = {}) => {
|
|
|
1236
929
|
return (_b = registry.keys.get(appId)) != null ? _b : id;
|
|
1237
930
|
};
|
|
1238
931
|
var resetAutoDeviceKeys = () => {
|
|
1239
|
-
var
|
|
932
|
+
var _a;
|
|
1240
933
|
const registry = autoDeviceKeyRegistry();
|
|
1241
934
|
registry.keys.clear();
|
|
1242
935
|
registry.hydrating.clear();
|
|
1243
|
-
(
|
|
936
|
+
(_a = registry.pending) == null ? void 0 : _a.clear();
|
|
1244
937
|
};
|
|
1245
938
|
|
|
1246
939
|
// src/analytics/analyticsFacade.ts
|
|
1247
940
|
var createAnalytics = (config, options = {}) => {
|
|
1248
|
-
var
|
|
941
|
+
var _a, _b, _c;
|
|
1249
942
|
const resolveSessionId = () => {
|
|
1250
|
-
var
|
|
1251
|
-
return (
|
|
943
|
+
var _a2;
|
|
944
|
+
return (_a2 = config.sessionId) != null ? _a2 : ensureCurrentSessionId();
|
|
1252
945
|
};
|
|
1253
946
|
if (config.sessionId) {
|
|
1254
947
|
warnInDev(
|
|
@@ -1256,7 +949,7 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1256
949
|
);
|
|
1257
950
|
}
|
|
1258
951
|
const detectedAppVersion = detectAppVersion();
|
|
1259
|
-
let userContext = { ...(
|
|
952
|
+
let userContext = { ...(_a = config.userContext) != null ? _a : {} };
|
|
1260
953
|
const hostDeviceKeyAtInit = typeof ((_b = config.userContext) == null ? void 0 : _b.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
|
|
1261
954
|
resolveIdentity({
|
|
1262
955
|
value: hostDeviceKeyAtInit,
|
|
@@ -1271,10 +964,10 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1271
964
|
};
|
|
1272
965
|
if (!hostDeviceKeyAtInit) resolveAutoDeviceKey(autoDeviceKeyOptions);
|
|
1273
966
|
const envelope = () => {
|
|
1274
|
-
var
|
|
967
|
+
var _a2;
|
|
1275
968
|
return buildContextEnvelope({
|
|
1276
969
|
sessionId: resolveSessionId(),
|
|
1277
|
-
appVersion: (
|
|
970
|
+
appVersion: (_a2 = userContext.appVersion) != null ? _a2 : config.appVersion,
|
|
1278
971
|
appBuild: config.appBuild,
|
|
1279
972
|
networkType: config.networkType
|
|
1280
973
|
});
|
|
@@ -1295,12 +988,12 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1295
988
|
});
|
|
1296
989
|
}
|
|
1297
990
|
const applyContext = (event) => {
|
|
1298
|
-
var
|
|
991
|
+
var _a2, _b2;
|
|
1299
992
|
const hostDeviceKey = typeof userContext.deviceKey === "string" && userContext.deviceKey.trim() ? userContext.deviceKey : void 0;
|
|
1300
993
|
const resolved = resolveUserContext(
|
|
1301
994
|
// `??` is lazy on purpose: a host-supplied key must never even touch the auto registry.
|
|
1302
995
|
{ ...userContext, deviceKey: hostDeviceKey != null ? hostDeviceKey : resolveAutoDeviceKey(autoDeviceKeyOptions) },
|
|
1303
|
-
{ autoAppVersion: (
|
|
996
|
+
{ autoAppVersion: (_a2 = config.appVersion) != null ? _a2 : detectedAppVersion }
|
|
1304
997
|
);
|
|
1305
998
|
if (resolved.userContext) {
|
|
1306
999
|
event.user_context = { ...resolved.userContext, ...(_b2 = event.user_context) != null ? _b2 : {} };
|
|
@@ -1315,9 +1008,9 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1315
1008
|
return void 0;
|
|
1316
1009
|
};
|
|
1317
1010
|
const setUserContext = (partial) => {
|
|
1318
|
-
var
|
|
1011
|
+
var _a2, _b2;
|
|
1319
1012
|
if (!partial || typeof partial !== "object") return;
|
|
1320
|
-
const mergedExtra = partial.extra || userContext.extra ? { ...(
|
|
1013
|
+
const mergedExtra = partial.extra || userContext.extra ? { ...(_a2 = userContext.extra) != null ? _a2 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
|
|
1321
1014
|
userContext = { ...userContext, ...partial };
|
|
1322
1015
|
if (mergedExtra) userContext.extra = mergedExtra;
|
|
1323
1016
|
const uid = sanitizeUserId(partial.userId);
|
|
@@ -1347,9 +1040,9 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1347
1040
|
applyContext(clientEvent);
|
|
1348
1041
|
queue.enqueue(clientEvent);
|
|
1349
1042
|
};
|
|
1350
|
-
const screen = (
|
|
1351
|
-
if (!
|
|
1352
|
-
const meta = { screen:
|
|
1043
|
+
const screen = (name, props) => {
|
|
1044
|
+
if (!name) return;
|
|
1045
|
+
const meta = { screen: name, ...props != null ? props : {} };
|
|
1353
1046
|
const clientEvent = {
|
|
1354
1047
|
event_type: "app_event",
|
|
1355
1048
|
session_id: resolveSessionId(),
|
|
@@ -1392,7 +1085,7 @@ var createAnalytics = (config, options = {}) => {
|
|
|
1392
1085
|
};
|
|
1393
1086
|
};
|
|
1394
1087
|
var useAnalytics = (config, options = {}) => {
|
|
1395
|
-
var
|
|
1088
|
+
var _a;
|
|
1396
1089
|
const ref = useRef(void 0);
|
|
1397
1090
|
const prevKeys = useRef("");
|
|
1398
1091
|
const currentKeys = `${config.serverUrl}|${config.apiKey}|${config.appId}`;
|
|
@@ -1400,10 +1093,10 @@ var useAnalytics = (config, options = {}) => {
|
|
|
1400
1093
|
prevKeys.current = currentKeys;
|
|
1401
1094
|
ref.current = createAnalytics(config, options);
|
|
1402
1095
|
}
|
|
1403
|
-
const hostDeviceKey = typeof ((
|
|
1096
|
+
const hostDeviceKey = typeof ((_a = config.userContext) == null ? void 0 : _a.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
|
|
1404
1097
|
useEffect(() => {
|
|
1405
|
-
var
|
|
1406
|
-
if (hostDeviceKey) (
|
|
1098
|
+
var _a2;
|
|
1099
|
+
if (hostDeviceKey) (_a2 = ref.current) == null ? void 0 : _a2.setUserContext({ deviceKey: hostDeviceKey });
|
|
1407
1100
|
}, [hostDeviceKey]);
|
|
1408
1101
|
return ref.current;
|
|
1409
1102
|
};
|