@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.
Files changed (69) hide show
  1. package/AGENTS.md +4 -3
  2. package/CHANGELOG.md +228 -4
  3. package/README.md +16 -2
  4. package/dist/analytics/index.d.mts +4 -4
  5. package/dist/analytics/index.d.ts +4 -4
  6. package/dist/analytics/index.js +104 -470
  7. package/dist/analytics/index.js.map +1 -1
  8. package/dist/analytics/index.mjs +102 -468
  9. package/dist/analytics/index.mjs.map +1 -1
  10. package/dist/coachmarks/index.d.mts +14 -1
  11. package/dist/coachmarks/index.d.ts +14 -1
  12. package/dist/coachmarks/index.js +58 -14
  13. package/dist/coachmarks/index.js.map +1 -1
  14. package/dist/coachmarks/index.mjs +58 -14
  15. package/dist/coachmarks/index.mjs.map +1 -1
  16. package/dist/{currentSession-ClkLjcJ0.d.mts → currentSession-BoWtr3Jp.d.mts} +2 -2
  17. package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-CCOMlaQ2.d.ts} +2 -2
  18. package/dist/{decision-Bl_M2y3r.d.mts → decision-Cjw0jbEj.d.mts} +1 -1
  19. package/dist/{decision-Cau5KmP6.d.ts → decision-GfpXAsk_.d.ts} +1 -1
  20. package/dist/index.d.mts +25 -2
  21. package/dist/index.d.ts +25 -2
  22. package/dist/index.js +220 -573
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +217 -570
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/questionnaire/index.d.mts +42 -10
  27. package/dist/questionnaire/index.d.ts +42 -10
  28. package/dist/questionnaire/index.js +45 -13
  29. package/dist/questionnaire/index.js.map +1 -1
  30. package/dist/questionnaire/index.mjs +45 -13
  31. package/dist/questionnaire/index.mjs.map +1 -1
  32. package/dist/reviews/index.d.mts +4 -4
  33. package/dist/reviews/index.d.ts +4 -4
  34. package/dist/reviews/index.js +27 -7
  35. package/dist/reviews/index.js.map +1 -1
  36. package/dist/reviews/index.mjs +27 -7
  37. package/dist/reviews/index.mjs.map +1 -1
  38. package/dist/showcase/index.js +7 -2
  39. package/dist/showcase/index.js.map +1 -1
  40. package/dist/showcase/index.mjs +7 -2
  41. package/dist/showcase/index.mjs.map +1 -1
  42. package/dist/{transport-DsRe4epC.d.ts → transport-CefdERPs.d.mts} +44 -5
  43. package/dist/{transport-CF_eHwzC.d.mts → transport-DFuPyCoJ.d.ts} +44 -5
  44. package/dist/{types-Buj9Lw9t.d.ts → types-UVYt9BJe.d.ts} +41 -1
  45. package/dist/{types-CNUqMK0D.d.mts → types-l2tfg23P.d.mts} +41 -1
  46. package/package.json +4 -1
  47. package/src/OnboardingFlow.tsx +44 -15
  48. package/src/WireOnboarding.tsx +7 -6
  49. package/src/activation/wireActivation.ts +3 -3
  50. package/src/analytics/analyticsFacade.ts +2 -2
  51. package/src/analytics/eventQueue.ts +83 -20
  52. package/src/cards/CardGridSelectCard.tsx +1 -1
  53. package/src/cards/ChipSelectCard.tsx +2 -2
  54. package/src/cards/SelectionCard.tsx +1 -1
  55. package/src/coachmarks/runtime.ts +62 -2
  56. package/src/coachmarks/useCoachmarkTour.ts +62 -14
  57. package/src/context/deviceId.ts +4 -4
  58. package/src/features/WireFeaturesProvider.tsx +4 -1
  59. package/src/identity/userIdentity.ts +1 -1
  60. package/src/questionnaire/QuestionnaireGate.tsx +90 -10
  61. package/src/questionnaire/index.ts +9 -1
  62. package/src/questionnaire/transport.ts +46 -11
  63. package/src/reviews/ReviewGate.tsx +61 -6
  64. package/src/reviews/index.ts +10 -1
  65. package/src/reviews/transport.ts +58 -12
  66. package/src/session-analytics/useLifecycleEvents.ts +1 -1
  67. package/src/theme/ThemeContext.tsx +42 -1
  68. package/src/types.ts +1 -1
  69. package/src/utils/submitResult.ts +39 -0
@@ -1,402 +1,12 @@
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
-
31
- // node_modules/expo-modules-core/src/errors/CodedError.ts
32
- var CodedError;
33
- var init_CodedError = __esm({
34
- "node_modules/expo-modules-core/src/errors/CodedError.ts"() {
35
- CodedError = class extends Error {
36
- constructor(code, message) {
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;
66
- try {
67
- 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(TurboModuleRegistry.get(moduleName), moduleName)) != null ? _e : null;
68
- } catch (e) {
69
- const error = e;
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;
398
- }
399
- });
400
10
 
401
11
  // src/analytics/reportClientEvent.ts
402
12
  var makeSessionId = () => `wire_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
@@ -520,14 +130,14 @@ var ensureCurrentSessionId = () => {
520
130
  };
521
131
 
522
132
  // src/reviews/transport.ts
523
- var reportAppEvent = (target, name2, options = {}) => {
524
- var _a2;
525
- if (!(target == null ? void 0 : target.serverUrl) || !name2) return;
133
+ var reportAppEvent = (target, name, options = {}) => {
134
+ var _a;
135
+ if (!(target == null ? void 0 : target.serverUrl) || !name) return;
526
136
  try {
527
- const supplied = (_a2 = options.sessionId) != null ? _a2 : "";
137
+ const supplied = (_a = options.sessionId) != null ? _a : "";
528
138
  const event = {
529
139
  event_type: "app_event",
530
- question_key: name2,
140
+ question_key: name,
531
141
  session_id: supplied.trim().length > 0 ? supplied : ensureCurrentSessionId()
532
142
  };
533
143
  if (options.deviceKey) event.user_context = { device_key: options.deviceKey };
@@ -545,24 +155,24 @@ var reportAppEvent = (target, name2, options = {}) => {
545
155
  // src/analytics/screenTracking.ts
546
156
  var getActiveRouteName = (state) => {
547
157
  let current = state;
548
- let name2;
158
+ let name;
549
159
  while (current && Array.isArray(current.routes) && current.routes.length > 0) {
550
160
  const index = typeof current.index === "number" ? current.index : 0;
551
161
  const route = current.routes[index];
552
162
  if (!route) break;
553
- name2 = route.name;
163
+ name = route.name;
554
164
  current = route.state;
555
165
  }
556
- return name2;
166
+ return name;
557
167
  };
558
168
  var createScreenTracker = (options = {}) => {
559
169
  let lastScreen;
560
170
  return {
561
171
  track: (screen) => {
562
- var _a2;
172
+ var _a;
563
173
  if (!screen || screen === lastScreen) return;
564
174
  lastScreen = screen;
565
- (_a2 = options.onScreen) == null ? void 0 : _a2.call(options, screen);
175
+ (_a = options.onScreen) == null ? void 0 : _a.call(options, screen);
566
176
  if (options.shouldTrack && !options.shouldTrack(screen)) return;
567
177
  reportAppEvent(options.target, "screen", {
568
178
  sessionId: options.sessionId,
@@ -604,8 +214,8 @@ var useScreenTracking = (navigationRef, options = {}) => {
604
214
  const tracker = trackerRef.current;
605
215
  if (!tracker || !(navigationRef == null ? void 0 : navigationRef.addListener)) return;
606
216
  const report = () => {
607
- var _a2, _b;
608
- return tracker.track((_b = (_a2 = navigationRef.getCurrentRoute) == null ? void 0 : _a2.call(navigationRef)) == null ? void 0 : _b.name);
217
+ var _a, _b;
218
+ return tracker.track((_b = (_a = navigationRef.getCurrentRoute) == null ? void 0 : _a.call(navigationRef)) == null ? void 0 : _b.name);
609
219
  };
610
220
  report();
611
221
  const unsubscribe = navigationRef.addListener("state", report);
@@ -705,7 +315,7 @@ var runtimeRequire = (moduleName) => {
705
315
  try {
706
316
  switch (moduleName) {
707
317
  case "expo-constants":
708
- return init_Constants(), __toCommonJS(Constants_exports);
318
+ return __require("expo-constants");
709
319
  case "expo-application":
710
320
  return __require("expo-application");
711
321
  default:
@@ -730,14 +340,14 @@ var safeInterop = (requireModule, moduleName) => {
730
340
  };
731
341
  var detectAppVersion = (requireModule = runtimeRequire) => {
732
342
  try {
733
- const constants2 = safeInterop(requireModule, "expo-constants");
734
- if (constants2) {
735
- const expoConfig = constants2.expoConfig;
343
+ const constants = safeInterop(requireModule, "expo-constants");
344
+ if (constants) {
345
+ const expoConfig = constants.expoConfig;
736
346
  if (expoConfig && typeof expoConfig === "object") {
737
347
  const fromExpoConfig = coerceVersion(expoConfig.version);
738
348
  if (fromExpoConfig) return fromExpoConfig;
739
349
  }
740
- const fromNative = coerceVersion(constants2.nativeAppVersion);
350
+ const fromNative = coerceVersion(constants.nativeAppVersion);
741
351
  if (fromNative) return fromNative;
742
352
  }
743
353
  const application = safeInterop(requireModule, "expo-application");
@@ -802,7 +412,7 @@ var deriveFormFactor = (iosIdiom, width, height) => {
802
412
  return void 0;
803
413
  };
804
414
  var collectDeviceContext = () => {
805
- var _a2;
415
+ var _a;
806
416
  const ctx = { platform: Platform.OS };
807
417
  try {
808
418
  const version = Platform.Version;
@@ -811,26 +421,26 @@ var collectDeviceContext = () => {
811
421
  }
812
422
  } catch {
813
423
  }
814
- let constants2 = {};
424
+ let constants = {};
815
425
  try {
816
- constants2 = (_a2 = Platform.constants) != null ? _a2 : {};
426
+ constants = (_a = Platform.constants) != null ? _a : {};
817
427
  } catch {
818
- constants2 = {};
428
+ constants = {};
819
429
  }
820
430
  let iosIdiom;
821
431
  try {
822
432
  if (Platform.OS === "android") {
823
- const brand = constants2.Brand;
824
- const model = constants2.Model;
825
- const release = constants2.Release;
433
+ const brand = constants.Brand;
434
+ const model = constants.Model;
435
+ const release = constants.Release;
826
436
  if (typeof brand === "string" && brand) ctx.brand = brand;
827
437
  if (typeof model === "string" && model) ctx.model = model;
828
438
  if (release !== void 0 && release !== null && String(release)) {
829
439
  ctx.osVersion = String(release);
830
440
  }
831
441
  } else if (Platform.OS === "ios") {
832
- const osVersion = constants2.osVersion;
833
- const idiom = constants2.interfaceIdiom;
442
+ const osVersion = constants.osVersion;
443
+ const idiom = constants.interfaceIdiom;
834
444
  if (osVersion !== void 0 && osVersion !== null && String(osVersion)) {
835
445
  ctx.osVersion = String(osVersion);
836
446
  }
@@ -871,10 +481,10 @@ var collectDeviceContext = () => {
871
481
 
872
482
  // src/analytics/contextEnvelope.ts
873
483
  var buildContextEnvelope = (input = {}) => {
874
- var _a2;
484
+ var _a;
875
485
  const device = { ...collectDeviceContext() };
876
486
  if (input.appVersion) device.appVersion = input.appVersion;
877
- const effectiveAppVersion = (_a2 = input.appVersion) != null ? _a2 : device.appVersion;
487
+ const effectiveAppVersion = (_a = input.appVersion) != null ? _a : device.appVersion;
878
488
  const envelope = { device };
879
489
  if (input.sessionId) envelope.sessionId = input.sessionId;
880
490
  if (effectiveAppVersion) envelope.appVersion = effectiveAppVersion;
@@ -917,10 +527,11 @@ var claimQueueKey = (preferred, explicit) => {
917
527
  return key;
918
528
  };
919
529
  var resetEventQueueKeys = () => claimedQueueKeys().clear();
530
+ var READ_TIMED_OUT = /* @__PURE__ */ Symbol("wireai:storage-read-timeout");
920
531
  var withTimeout = (p, ms) => {
921
532
  let timer;
922
533
  const timeout = new Promise((resolve) => {
923
- timer = setTimeout(() => resolve(void 0), ms);
534
+ timer = setTimeout(() => resolve(READ_TIMED_OUT), ms);
924
535
  });
925
536
  return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
926
537
  };
@@ -945,10 +556,10 @@ var parsePersisted = (raw) => {
945
556
  }
946
557
  };
947
558
  var createEventQueue = (options) => {
948
- var _a2, _b, _c, _d, _e, _f, _g;
559
+ var _a, _b, _c, _d, _e, _f, _g;
949
560
  const target = options.target;
950
561
  const storage = options.storage;
951
- const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a2 = options.appId) != null ? _a2 : "default"}`;
562
+ const defaultKey = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a = options.appId) != null ? _a : "default"}`;
952
563
  const key = storage ? claimQueueKey(defaultKey, options.storageKey !== void 0) : defaultKey;
953
564
  const maxSize = (_c = options.maxSize) != null ? _c : DEFAULTS.maxSize;
954
565
  const batchSize = (_d = options.batchSize) != null ? _d : DEFAULTS.batchSize;
@@ -960,6 +571,7 @@ var createEventQueue = (options) => {
960
571
  let flushing = false;
961
572
  let attempt = 0;
962
573
  let retryTimer;
574
+ let backlogUnread = false;
963
575
  const resolveEnvelope = () => {
964
576
  try {
965
577
  return typeof options.envelope === "function" ? options.envelope() : options.envelope;
@@ -968,14 +580,14 @@ var createEventQueue = (options) => {
968
580
  }
969
581
  };
970
582
  const stamp = (event) => {
971
- var _a3;
583
+ var _a2;
972
584
  const env = resolveEnvelope();
973
585
  const stamped = { ...event };
974
586
  if (stamped.ts === void 0) stamped.ts = Date.now();
975
587
  if (!env) return stamped;
976
588
  if (!stamped.device && env.device) stamped.device = env.device;
977
589
  if (!stamped.session_id && env.sessionId) stamped.session_id = env.sessionId;
978
- const uc = { ...(_a3 = stamped.user_context) != null ? _a3 : {} };
590
+ const uc = { ...(_a2 = stamped.user_context) != null ? _a2 : {} };
979
591
  if (env.appVersion && uc.app_version === void 0) uc.app_version = env.appVersion;
980
592
  if (env.appBuild && uc.app_build === void 0) uc.app_build = env.appBuild;
981
593
  if (env.networkType && uc.network_type === void 0) uc.network_type = env.networkType;
@@ -984,6 +596,7 @@ var createEventQueue = (options) => {
984
596
  };
985
597
  const persist = () => {
986
598
  if (!storage) return;
599
+ if (backlogUnread) return;
987
600
  try {
988
601
  if (pending.length === 0) {
989
602
  void storage.removeItem(key).catch(() => {
@@ -1006,23 +619,44 @@ var createEventQueue = (options) => {
1006
619
  return `__nosig_${nextId}_${Math.random()}`;
1007
620
  }
1008
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
+ };
1009
637
  const loadPromise = (async () => {
1010
638
  if (!storage) return;
1011
639
  try {
1012
- const persistedItems = parsePersisted(await withTimeout(storage.getItem(key), READ_TIMEOUT_MS));
1013
- if (persistedItems.length === 0) return;
1014
- const events = [...persistedItems.map((p) => p.event), ...pending.map((p) => p.event)];
1015
- pending = [];
1016
- nextId = 0;
1017
- const seen = /* @__PURE__ */ new Set();
1018
- for (const event of events) {
1019
- const sig = safeSig(event);
1020
- if (seen.has(sig)) continue;
1021
- seen.add(sig);
1022
- pending.push({ id: nextId++, event, sig });
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;
1023
658
  }
1024
- enforceSizeCap();
1025
- persist();
659
+ mergePersisted(parsePersisted(raced));
1026
660
  } catch {
1027
661
  }
1028
662
  })();
@@ -1171,7 +805,7 @@ var clearUserContext = async (opts = {}) => {
1171
805
  }
1172
806
  };
1173
807
  var resolveUserContext = (ctx = {}, opts = {}) => {
1174
- var _a2;
808
+ var _a;
1175
809
  const result = {};
1176
810
  const bucket = {};
1177
811
  const userId = sanitizeUserId(ctx.userId);
@@ -1181,7 +815,7 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
1181
815
  result.deviceKey = deviceKey;
1182
816
  bucket.device_key = deviceKey;
1183
817
  }
1184
- const appVersion = (_a2 = cleanString(ctx.appVersion)) != null ? _a2 : cleanString(opts.autoAppVersion);
818
+ const appVersion = (_a = cleanString(ctx.appVersion)) != null ? _a : cleanString(opts.autoAppVersion);
1185
819
  if (appVersion) {
1186
820
  result.appVersion = appVersion;
1187
821
  bucket.app_version = appVersion;
@@ -1212,11 +846,11 @@ var provenanceRegistry = () => {
1212
846
  };
1213
847
  var provenanceKey = (space, scope) => `${space}:${scope != null ? scope : "default"}`;
1214
848
  var resolveIdentity = (input) => {
1215
- var _a2;
849
+ var _a;
1216
850
  if (typeof input.value !== "string") return void 0;
1217
851
  const value = input.value.trim();
1218
852
  if (!value) return void 0;
1219
- const durable = (_a2 = input.durable) != null ? _a2 : input.source === "host";
853
+ const durable = (_a = input.durable) != null ? _a : input.source === "host";
1220
854
  {
1221
855
  provenanceRegistry().host.set(provenanceKey(input.space, input.scope), value);
1222
856
  }
@@ -1246,8 +880,8 @@ var startHydration = (registry, appId, storage, minted) => {
1246
880
  if (existing) return existing;
1247
881
  const slot = deviceIdStorageKey(appId);
1248
882
  const degraded = () => {
1249
- var _a2;
1250
- return { value: (_a2 = registry.keys.get(appId)) != null ? _a2 : minted, durable: false };
883
+ var _a;
884
+ return { value: (_a = registry.keys.get(appId)) != null ? _a : minted, durable: false };
1251
885
  };
1252
886
  const adopted = (value) => ({ value, durable: true });
1253
887
  let run;
@@ -1260,8 +894,8 @@ var startHydration = (registry, appId, storage, minted) => {
1260
894
  }
1261
895
  return Promise.resolve(storage.setItem(slot, minted)).then(
1262
896
  () => {
1263
- var _a2;
1264
- return adopted((_a2 = registry.keys.get(appId)) != null ? _a2 : minted);
897
+ var _a;
898
+ return adopted((_a = registry.keys.get(appId)) != null ? _a : minted);
1265
899
  },
1266
900
  degraded
1267
901
  );
@@ -1271,17 +905,17 @@ var startHydration = (registry, appId, storage, minted) => {
1271
905
  }
1272
906
  registry.pending.set(appId, run);
1273
907
  void run.then((outcome) => {
1274
- var _a2;
908
+ var _a;
1275
909
  if (outcome.durable) return;
1276
- (_a2 = registry.pending) == null ? void 0 : _a2.delete(appId);
910
+ (_a = registry.pending) == null ? void 0 : _a.delete(appId);
1277
911
  registry.hydrating.delete(appId);
1278
912
  });
1279
913
  return run;
1280
914
  };
1281
915
  var resolveAutoDeviceKey = (opts = {}) => {
1282
- var _a2, _b;
916
+ var _a, _b;
1283
917
  const registry = autoDeviceKeyRegistry();
1284
- const appId = (_a2 = opts.appId) != null ? _a2 : "default";
918
+ const appId = (_a = opts.appId) != null ? _a : "default";
1285
919
  let id = registry.keys.get(appId);
1286
920
  if (!id) {
1287
921
  id = mintDeviceId();
@@ -1295,19 +929,19 @@ var resolveAutoDeviceKey = (opts = {}) => {
1295
929
  return (_b = registry.keys.get(appId)) != null ? _b : id;
1296
930
  };
1297
931
  var resetAutoDeviceKeys = () => {
1298
- var _a2;
932
+ var _a;
1299
933
  const registry = autoDeviceKeyRegistry();
1300
934
  registry.keys.clear();
1301
935
  registry.hydrating.clear();
1302
- (_a2 = registry.pending) == null ? void 0 : _a2.clear();
936
+ (_a = registry.pending) == null ? void 0 : _a.clear();
1303
937
  };
1304
938
 
1305
939
  // src/analytics/analyticsFacade.ts
1306
940
  var createAnalytics = (config, options = {}) => {
1307
- var _a2, _b, _c;
941
+ var _a, _b, _c;
1308
942
  const resolveSessionId = () => {
1309
- var _a3;
1310
- return (_a3 = config.sessionId) != null ? _a3 : ensureCurrentSessionId();
943
+ var _a2;
944
+ return (_a2 = config.sessionId) != null ? _a2 : ensureCurrentSessionId();
1311
945
  };
1312
946
  if (config.sessionId) {
1313
947
  warnInDev(
@@ -1315,7 +949,7 @@ var createAnalytics = (config, options = {}) => {
1315
949
  );
1316
950
  }
1317
951
  const detectedAppVersion = detectAppVersion();
1318
- let userContext = { ...(_a2 = config.userContext) != null ? _a2 : {} };
952
+ let userContext = { ...(_a = config.userContext) != null ? _a : {} };
1319
953
  const hostDeviceKeyAtInit = typeof ((_b = config.userContext) == null ? void 0 : _b.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
1320
954
  resolveIdentity({
1321
955
  value: hostDeviceKeyAtInit,
@@ -1330,10 +964,10 @@ var createAnalytics = (config, options = {}) => {
1330
964
  };
1331
965
  if (!hostDeviceKeyAtInit) resolveAutoDeviceKey(autoDeviceKeyOptions);
1332
966
  const envelope = () => {
1333
- var _a3;
967
+ var _a2;
1334
968
  return buildContextEnvelope({
1335
969
  sessionId: resolveSessionId(),
1336
- appVersion: (_a3 = userContext.appVersion) != null ? _a3 : config.appVersion,
970
+ appVersion: (_a2 = userContext.appVersion) != null ? _a2 : config.appVersion,
1337
971
  appBuild: config.appBuild,
1338
972
  networkType: config.networkType
1339
973
  });
@@ -1354,12 +988,12 @@ var createAnalytics = (config, options = {}) => {
1354
988
  });
1355
989
  }
1356
990
  const applyContext = (event) => {
1357
- var _a3, _b2;
991
+ var _a2, _b2;
1358
992
  const hostDeviceKey = typeof userContext.deviceKey === "string" && userContext.deviceKey.trim() ? userContext.deviceKey : void 0;
1359
993
  const resolved = resolveUserContext(
1360
994
  // `??` is lazy on purpose: a host-supplied key must never even touch the auto registry.
1361
995
  { ...userContext, deviceKey: hostDeviceKey != null ? hostDeviceKey : resolveAutoDeviceKey(autoDeviceKeyOptions) },
1362
- { autoAppVersion: (_a3 = config.appVersion) != null ? _a3 : detectedAppVersion }
996
+ { autoAppVersion: (_a2 = config.appVersion) != null ? _a2 : detectedAppVersion }
1363
997
  );
1364
998
  if (resolved.userContext) {
1365
999
  event.user_context = { ...resolved.userContext, ...(_b2 = event.user_context) != null ? _b2 : {} };
@@ -1374,9 +1008,9 @@ var createAnalytics = (config, options = {}) => {
1374
1008
  return void 0;
1375
1009
  };
1376
1010
  const setUserContext = (partial) => {
1377
- var _a3, _b2;
1011
+ var _a2, _b2;
1378
1012
  if (!partial || typeof partial !== "object") return;
1379
- const mergedExtra = partial.extra || userContext.extra ? { ...(_a3 = userContext.extra) != null ? _a3 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
1013
+ const mergedExtra = partial.extra || userContext.extra ? { ...(_a2 = userContext.extra) != null ? _a2 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
1380
1014
  userContext = { ...userContext, ...partial };
1381
1015
  if (mergedExtra) userContext.extra = mergedExtra;
1382
1016
  const uid = sanitizeUserId(partial.userId);
@@ -1406,9 +1040,9 @@ var createAnalytics = (config, options = {}) => {
1406
1040
  applyContext(clientEvent);
1407
1041
  queue.enqueue(clientEvent);
1408
1042
  };
1409
- const screen = (name2, props) => {
1410
- if (!name2) return;
1411
- const meta = { screen: name2, ...props != null ? props : {} };
1043
+ const screen = (name, props) => {
1044
+ if (!name) return;
1045
+ const meta = { screen: name, ...props != null ? props : {} };
1412
1046
  const clientEvent = {
1413
1047
  event_type: "app_event",
1414
1048
  session_id: resolveSessionId(),
@@ -1451,7 +1085,7 @@ var createAnalytics = (config, options = {}) => {
1451
1085
  };
1452
1086
  };
1453
1087
  var useAnalytics = (config, options = {}) => {
1454
- var _a2;
1088
+ var _a;
1455
1089
  const ref = useRef(void 0);
1456
1090
  const prevKeys = useRef("");
1457
1091
  const currentKeys = `${config.serverUrl}|${config.apiKey}|${config.appId}`;
@@ -1459,10 +1093,10 @@ var useAnalytics = (config, options = {}) => {
1459
1093
  prevKeys.current = currentKeys;
1460
1094
  ref.current = createAnalytics(config, options);
1461
1095
  }
1462
- const hostDeviceKey = typeof ((_a2 = config.userContext) == null ? void 0 : _a2.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
1096
+ const hostDeviceKey = typeof ((_a = config.userContext) == null ? void 0 : _a.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
1463
1097
  useEffect(() => {
1464
- var _a3;
1465
- if (hostDeviceKey) (_a3 = ref.current) == null ? void 0 : _a3.setUserContext({ deviceKey: hostDeviceKey });
1098
+ var _a2;
1099
+ if (hostDeviceKey) (_a2 = ref.current) == null ? void 0 : _a2.setUserContext({ deviceKey: hostDeviceKey });
1466
1100
  }, [hostDeviceKey]);
1467
1101
  return ref.current;
1468
1102
  };