@wireai/activation 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/AGENTS.md +29 -5
  2. package/CHANGELOG.md +198 -6
  3. package/README.md +105 -10
  4. package/dist/analytics/index.d.mts +12 -8
  5. package/dist/analytics/index.d.ts +12 -8
  6. package/dist/analytics/index.js +525 -55
  7. package/dist/analytics/index.js.map +1 -1
  8. package/dist/analytics/index.mjs +525 -55
  9. package/dist/analytics/index.mjs.map +1 -1
  10. package/dist/coachmarks/index.d.mts +2 -2
  11. package/dist/coachmarks/index.d.ts +2 -2
  12. package/dist/coachmarks/index.js.map +1 -1
  13. package/dist/coachmarks/index.mjs.map +1 -1
  14. package/dist/{currentSession-CxnP7gAa.d.ts → currentSession-61dcm3V-.d.ts} +19 -3
  15. package/dist/{currentSession-BJBB7i4-.d.mts → currentSession-Bs2JfTJ8.d.mts} +19 -3
  16. package/dist/{decision-BzbiKwk3.d.mts → decision-Bl_M2y3r.d.mts} +1 -1
  17. package/dist/{decision-plDEOCkt.d.ts → decision-Cau5KmP6.d.ts} +1 -1
  18. package/dist/index.d.mts +620 -13
  19. package/dist/index.d.ts +620 -13
  20. package/dist/index.js +1194 -369
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +1015 -201
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/questionnaire/index.d.mts +69 -23
  25. package/dist/questionnaire/index.d.ts +69 -23
  26. package/dist/questionnaire/index.js +643 -172
  27. package/dist/questionnaire/index.js.map +1 -1
  28. package/dist/questionnaire/index.mjs +608 -137
  29. package/dist/questionnaire/index.mjs.map +1 -1
  30. package/dist/reviews/index.d.mts +24 -12
  31. package/dist/reviews/index.d.ts +24 -12
  32. package/dist/reviews/index.js +507 -173
  33. package/dist/reviews/index.js.map +1 -1
  34. package/dist/reviews/index.mjs +462 -129
  35. package/dist/reviews/index.mjs.map +1 -1
  36. package/dist/showcase/index.d.mts +2 -2
  37. package/dist/showcase/index.d.ts +2 -2
  38. package/dist/showcase/index.js.map +1 -1
  39. package/dist/showcase/index.mjs.map +1 -1
  40. package/dist/transport-DzU-TqZz.d.ts +86 -0
  41. package/dist/transport-f5VVB5hH.d.mts +86 -0
  42. package/dist/{types-GL_hQ0TN.d.mts → types-BcmagF6K.d.mts} +1 -1
  43. package/dist/{types-GL_hQ0TN.d.ts → types-BcmagF6K.d.ts} +1 -1
  44. package/dist/{types-BhpXJGlg.d.ts → types-Buj9Lw9t.d.ts} +15 -3
  45. package/dist/{types-CMuOexw0.d.mts → types-CKFhyrMu.d.mts} +1 -1
  46. package/dist/{types-CMuOexw0.d.ts → types-CKFhyrMu.d.ts} +1 -1
  47. package/dist/{types-A6pTxIZV.d.mts → types-CNUqMK0D.d.mts} +15 -3
  48. package/metro/index.d.ts +18 -1
  49. package/metro/index.js +80 -0
  50. package/package.json +9 -1
  51. package/src/WireOnboarding.tsx +4 -0
  52. package/src/analytics/analyticsFacade.ts +55 -10
  53. package/src/analytics/currentSession.ts +1 -1
  54. package/src/cards/CardGridSelectCard.tsx +253 -0
  55. package/src/cards/ChipSelectCard.tsx +1 -1
  56. package/src/cards/SelectionCard.tsx +15 -19
  57. package/src/cards/index.ts +13 -1
  58. package/src/cards/optionSchema.ts +65 -0
  59. package/src/coachmarks/types.ts +1 -1
  60. package/src/components/CardHandoff.tsx +39 -7
  61. package/src/components/DoneCheck.tsx +94 -0
  62. package/src/components/ModalPaneHost.tsx +141 -0
  63. package/src/components/StepDots.tsx +112 -0
  64. package/src/context/deviceId.ts +43 -0
  65. package/src/device/appVersion.ts +29 -8
  66. package/src/device/deviceContext.ts +14 -1
  67. package/src/device/deviceModel.ts +106 -0
  68. package/src/features/cache.ts +1 -1
  69. package/src/haptics/expo-haptics.d.ts +31 -0
  70. package/src/haptics/haptics.ts +58 -0
  71. package/src/icons/IconRegistry.tsx +53 -0
  72. package/src/icons/WireIcon.tsx +85 -0
  73. package/src/icons/expoIcons.ts +165 -0
  74. package/src/icons/index.ts +18 -0
  75. package/src/icons/vocabulary.ts +154 -0
  76. package/src/index.ts +22 -0
  77. package/src/questionnaire/QuestionnaireGate.tsx +315 -164
  78. package/src/questionnaire/decision.ts +4 -2
  79. package/src/questionnaire/index.ts +3 -2
  80. package/src/questionnaire/steps.ts +261 -0
  81. package/src/questionnaire/types.ts +33 -12
  82. package/src/reviews/ReviewGate.tsx +250 -152
  83. package/src/reviews/index.ts +7 -3
  84. package/src/reviews/transport.ts +77 -3
  85. package/src/reviews/types.ts +13 -0
  86. package/src/session/persistedSession.ts +1 -1
  87. package/src/session-analytics/lifecycle.ts +1 -1
  88. package/src/session-analytics/useSessionStart.ts +2 -2
  89. package/src/showcase/FeatureShowcase.tsx +1 -1
  90. package/src/showcase/showcaseColors.ts +1 -1
  91. package/src/theme/mergeThemeOver.ts +27 -0
  92. package/src/types.ts +8 -0
  93. package/dist/transport-BeO_Brcu.d.mts +0 -40
  94. package/dist/transport-DLpd1v5_.d.ts +0 -40
@@ -1,25 +1,415 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
3
  var reactNative = require('react-native');
4
+ var react = require('react');
5
5
 
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
10
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
11
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
8
12
  }) : x)(function(x) {
9
13
  if (typeof require !== "undefined") return require.apply(this, arguments);
10
14
  throw Error('Dynamic require of "' + x + '" is not supported');
11
15
  });
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
+ });
12
402
 
13
403
  // src/reviews/transport.ts
14
- var reportAppEvent = (target, name, options = {}) => {
15
- if (!(target == null ? void 0 : target.serverUrl) || !name) return;
404
+ var reportAppEvent = (target, name2, options = {}) => {
405
+ if (!(target == null ? void 0 : target.serverUrl) || !name2) return;
16
406
  try {
17
407
  const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
18
408
  const headers = { "Content-Type": "application/json" };
19
409
  if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
20
410
  const event = {
21
411
  event_type: "app_event",
22
- question_key: name
412
+ question_key: name2
23
413
  };
24
414
  if (options.sessionId) event.session_id = options.sessionId;
25
415
  if (options.deviceKey) event.user_context = { device_key: options.deviceKey };
@@ -39,24 +429,24 @@ var reportAppEvent = (target, name, options = {}) => {
39
429
  // src/analytics/screenTracking.ts
40
430
  var getActiveRouteName = (state) => {
41
431
  let current = state;
42
- let name;
432
+ let name2;
43
433
  while (current && Array.isArray(current.routes) && current.routes.length > 0) {
44
434
  const index = typeof current.index === "number" ? current.index : 0;
45
435
  const route = current.routes[index];
46
436
  if (!route) break;
47
- name = route.name;
437
+ name2 = route.name;
48
438
  current = route.state;
49
439
  }
50
- return name;
440
+ return name2;
51
441
  };
52
442
  var createScreenTracker = (options = {}) => {
53
443
  let lastScreen;
54
444
  return {
55
445
  track: (screen) => {
56
- var _a;
446
+ var _a2;
57
447
  if (!screen || screen === lastScreen) return;
58
448
  lastScreen = screen;
59
- (_a = options.onScreen) == null ? void 0 : _a.call(options, screen);
449
+ (_a2 = options.onScreen) == null ? void 0 : _a2.call(options, screen);
60
450
  if (options.shouldTrack && !options.shouldTrack(screen)) return;
61
451
  reportAppEvent(options.target, "screen", {
62
452
  sessionId: options.sessionId,
@@ -98,8 +488,8 @@ var useScreenTracking = (navigationRef, options = {}) => {
98
488
  const tracker = trackerRef.current;
99
489
  if (!tracker || !(navigationRef == null ? void 0 : navigationRef.addListener)) return;
100
490
  const report = () => {
101
- var _a, _b;
102
- return tracker.track((_b = (_a = navigationRef.getCurrentRoute) == null ? void 0 : _a.call(navigationRef)) == null ? void 0 : _b.name);
491
+ var _a2, _b;
492
+ return tracker.track((_b = (_a2 = navigationRef.getCurrentRoute) == null ? void 0 : _a2.call(navigationRef)) == null ? void 0 : _b.name);
103
493
  };
104
494
  report();
105
495
  const unsubscribe = navigationRef.addListener("state", report);
@@ -172,9 +562,16 @@ var coerceVersion = (value) => {
172
562
  return trimmed.length > 0 ? trimmed : void 0;
173
563
  };
174
564
  var runtimeRequire = (moduleName) => {
565
+ if (typeof __require !== "function") return void 0;
175
566
  try {
176
- if (typeof __require !== "function") return void 0;
177
- return __require(moduleName);
567
+ switch (moduleName) {
568
+ case "expo-constants":
569
+ return init_Constants(), __toCommonJS(Constants_exports);
570
+ case "expo-application":
571
+ return __require("expo-application");
572
+ default:
573
+ return void 0;
574
+ }
178
575
  } catch {
179
576
  return void 0;
180
577
  }
@@ -194,14 +591,14 @@ var safeInterop = (requireModule, moduleName) => {
194
591
  };
195
592
  var detectAppVersion = (requireModule = runtimeRequire) => {
196
593
  try {
197
- const constants = safeInterop(requireModule, "expo-constants");
198
- if (constants) {
199
- const expoConfig = constants.expoConfig;
594
+ const constants2 = safeInterop(requireModule, "expo-constants");
595
+ if (constants2) {
596
+ const expoConfig = constants2.expoConfig;
200
597
  if (expoConfig && typeof expoConfig === "object") {
201
598
  const fromExpoConfig = coerceVersion(expoConfig.version);
202
599
  if (fromExpoConfig) return fromExpoConfig;
203
600
  }
204
- const fromNative = coerceVersion(constants.nativeAppVersion);
601
+ const fromNative = coerceVersion(constants2.nativeAppVersion);
205
602
  if (fromNative) return fromNative;
206
603
  }
207
604
  const application = safeInterop(requireModule, "expo-application");
@@ -214,6 +611,48 @@ var detectAppVersion = (requireModule = runtimeRequire) => {
214
611
  return void 0;
215
612
  };
216
613
 
614
+ // src/device/deviceModel.ts
615
+ var coerceModel = (value) => {
616
+ if (typeof value !== "string") return void 0;
617
+ const trimmed = value.trim();
618
+ return trimmed.length > 0 ? trimmed : void 0;
619
+ };
620
+ var runtimeRequire2 = (moduleName) => {
621
+ if (moduleName !== "expo-device") return void 0;
622
+ if (typeof __require !== "function") return void 0;
623
+ try {
624
+ return __require("expo-device");
625
+ } catch {
626
+ return void 0;
627
+ }
628
+ };
629
+ var interop2 = (mod) => {
630
+ if (!mod || typeof mod !== "object") return void 0;
631
+ const def = mod.default;
632
+ if (def && typeof def === "object") return def;
633
+ return mod;
634
+ };
635
+ var safeInterop2 = (requireModule, moduleName) => {
636
+ try {
637
+ return interop2(requireModule(moduleName));
638
+ } catch {
639
+ return void 0;
640
+ }
641
+ };
642
+ var detectNativeModel = (requireModule = runtimeRequire2) => {
643
+ try {
644
+ const device = safeInterop2(requireModule, "expo-device");
645
+ if (device) {
646
+ const modelName = coerceModel(device.modelName);
647
+ if (modelName) return modelName;
648
+ const modelId = coerceModel(device.modelId);
649
+ if (modelId) return modelId;
650
+ }
651
+ } catch {
652
+ }
653
+ return void 0;
654
+ };
655
+
217
656
  // src/device/deviceContext.ts
218
657
  var deriveFormFactor = (iosIdiom, width, height) => {
219
658
  if (iosIdiom === "pad") return "tablet";
@@ -224,7 +663,7 @@ var deriveFormFactor = (iosIdiom, width, height) => {
224
663
  return void 0;
225
664
  };
226
665
  var collectDeviceContext = () => {
227
- var _a;
666
+ var _a2;
228
667
  const ctx = { platform: reactNative.Platform.OS };
229
668
  try {
230
669
  const version = reactNative.Platform.Version;
@@ -233,26 +672,26 @@ var collectDeviceContext = () => {
233
672
  }
234
673
  } catch {
235
674
  }
236
- let constants = {};
675
+ let constants2 = {};
237
676
  try {
238
- constants = (_a = reactNative.Platform.constants) != null ? _a : {};
677
+ constants2 = (_a2 = reactNative.Platform.constants) != null ? _a2 : {};
239
678
  } catch {
240
- constants = {};
679
+ constants2 = {};
241
680
  }
242
681
  let iosIdiom;
243
682
  try {
244
683
  if (reactNative.Platform.OS === "android") {
245
- const brand = constants.Brand;
246
- const model = constants.Model;
247
- const release = constants.Release;
684
+ const brand = constants2.Brand;
685
+ const model = constants2.Model;
686
+ const release = constants2.Release;
248
687
  if (typeof brand === "string" && brand) ctx.brand = brand;
249
688
  if (typeof model === "string" && model) ctx.model = model;
250
689
  if (release !== void 0 && release !== null && String(release)) {
251
690
  ctx.osVersion = String(release);
252
691
  }
253
692
  } else if (reactNative.Platform.OS === "ios") {
254
- const osVersion = constants.osVersion;
255
- const idiom = constants.interfaceIdiom;
693
+ const osVersion = constants2.osVersion;
694
+ const idiom = constants2.interfaceIdiom;
256
695
  if (osVersion !== void 0 && osVersion !== null && String(osVersion)) {
257
696
  ctx.osVersion = String(osVersion);
258
697
  }
@@ -260,6 +699,8 @@ var collectDeviceContext = () => {
260
699
  ctx.interfaceIdiom = idiom;
261
700
  iosIdiom = idiom;
262
701
  }
702
+ const iosModel = detectNativeModel();
703
+ if (iosModel) ctx.model = iosModel;
263
704
  }
264
705
  } catch {
265
706
  }
@@ -291,10 +732,10 @@ var collectDeviceContext = () => {
291
732
 
292
733
  // src/analytics/contextEnvelope.ts
293
734
  var buildContextEnvelope = (input = {}) => {
294
- var _a;
735
+ var _a2;
295
736
  const device = { ...collectDeviceContext() };
296
737
  if (input.appVersion) device.appVersion = input.appVersion;
297
- const effectiveAppVersion = (_a = input.appVersion) != null ? _a : device.appVersion;
738
+ const effectiveAppVersion = (_a2 = input.appVersion) != null ? _a2 : device.appVersion;
298
739
  const envelope = { device };
299
740
  if (input.sessionId) envelope.sessionId = input.sessionId;
300
741
  if (effectiveAppVersion) envelope.appVersion = effectiveAppVersion;
@@ -340,10 +781,10 @@ var parsePersisted = (raw) => {
340
781
  }
341
782
  };
342
783
  var createEventQueue = (options) => {
343
- var _a, _b, _c, _d, _e, _f, _g;
784
+ var _a2, _b, _c, _d, _e, _f, _g;
344
785
  const target = options.target;
345
786
  const storage = options.storage;
346
- const key = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a = options.appId) != null ? _a : "default"}`;
787
+ const key = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a2 = options.appId) != null ? _a2 : "default"}`;
347
788
  const maxSize = (_c = options.maxSize) != null ? _c : DEFAULTS.maxSize;
348
789
  const batchSize = (_d = options.batchSize) != null ? _d : DEFAULTS.batchSize;
349
790
  const baseBackoffMs = (_e = options.baseBackoffMs) != null ? _e : DEFAULTS.baseBackoffMs;
@@ -362,13 +803,13 @@ var createEventQueue = (options) => {
362
803
  }
363
804
  };
364
805
  const stamp = (event) => {
365
- var _a2;
806
+ var _a3;
366
807
  const env = resolveEnvelope();
367
808
  const stamped = { ...event };
368
809
  if (!env) return stamped;
369
810
  if (!stamped.device && env.device) stamped.device = env.device;
370
811
  if (!stamped.session_id && env.sessionId) stamped.session_id = env.sessionId;
371
- const uc = { ...(_a2 = stamped.user_context) != null ? _a2 : {} };
812
+ const uc = { ...(_a3 = stamped.user_context) != null ? _a3 : {} };
372
813
  if (env.appVersion && uc.app_version === void 0) uc.app_version = env.appVersion;
373
814
  if (env.appBuild && uc.app_build === void 0) uc.app_build = env.appBuild;
374
815
  if (env.networkType && uc.network_type === void 0) uc.network_type = env.networkType;
@@ -564,7 +1005,7 @@ var namespaceExtra = (extra) => {
564
1005
  return out;
565
1006
  };
566
1007
  var resolveUserContext = (ctx = {}, opts = {}) => {
567
- var _a;
1008
+ var _a2;
568
1009
  const result = {};
569
1010
  const bucket = {};
570
1011
  const userId = sanitizeUserId(ctx.userId);
@@ -574,7 +1015,7 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
574
1015
  result.deviceKey = deviceKey;
575
1016
  bucket.device_key = deviceKey;
576
1017
  }
577
- const appVersion = (_a = cleanString(ctx.appVersion)) != null ? _a : cleanString(opts.autoAppVersion);
1018
+ const appVersion = (_a2 = cleanString(ctx.appVersion)) != null ? _a2 : cleanString(opts.autoAppVersion);
578
1019
  if (appVersion) {
579
1020
  result.appVersion = appVersion;
580
1021
  bucket.app_version = appVersion;
@@ -593,20 +1034,46 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
593
1034
  return result;
594
1035
  };
595
1036
 
1037
+ // src/context/deviceId.ts
1038
+ var AUTO_DEVICE_ID_PREFIX = "wdev_";
1039
+ var deviceIdStorageKey = (appId) => `wireai:analytics:deviceKey:${appId != null ? appId : "default"}`;
1040
+ var randomChunk = () => Math.floor(Math.random() * 4294967296).toString(36).padStart(6, "0");
1041
+ var mintDeviceId = () => {
1042
+ const time = Date.now().toString(36);
1043
+ return `${AUTO_DEVICE_ID_PREFIX}${time}_${randomChunk()}${randomChunk()}`;
1044
+ };
1045
+
596
1046
  // src/analytics/analyticsFacade.ts
597
1047
  var createAnalytics = (config, options = {}) => {
598
- var _a, _b, _c, _d;
599
- const instanceSessionId = (_a = config.sessionId) != null ? _a : makeSessionId();
1048
+ var _a2, _b, _c, _d, _e;
1049
+ const instanceSessionId = (_a2 = config.sessionId) != null ? _a2 : makeSessionId();
600
1050
  const resolveSessionId = () => {
601
- var _a2, _b2;
602
- return (_b2 = (_a2 = config.sessionId) != null ? _a2 : getCurrentSessionId()) != null ? _b2 : instanceSessionId;
1051
+ var _a3, _b2;
1052
+ return (_b2 = (_a3 = config.sessionId) != null ? _a3 : getCurrentSessionId()) != null ? _b2 : instanceSessionId;
1053
+ };
1054
+ let userContext = { ...(_b = config.userContext) != null ? _b : {} };
1055
+ const hostDeviceKeyAtInit = typeof ((_c = config.userContext) == null ? void 0 : _c.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
1056
+ let autoDeviceKey = mintDeviceId();
1057
+ if (config.storage && !hostDeviceKeyAtInit) {
1058
+ const storage = config.storage;
1059
+ const deviceKey = deviceIdStorageKey(config.appId);
1060
+ void storage.getItem(deviceKey).then((saved) => {
1061
+ const persisted = typeof saved === "string" && saved.trim() ? saved.trim() : void 0;
1062
+ if (persisted) autoDeviceKey = persisted;
1063
+ else void storage.setItem(deviceKey, autoDeviceKey).catch(() => {
1064
+ });
1065
+ }).catch(() => {
1066
+ });
1067
+ }
1068
+ const envelope = () => {
1069
+ var _a3;
1070
+ return buildContextEnvelope({
1071
+ sessionId: resolveSessionId(),
1072
+ appVersion: (_a3 = userContext.appVersion) != null ? _a3 : config.appVersion,
1073
+ appBuild: config.appBuild,
1074
+ networkType: config.networkType
1075
+ });
603
1076
  };
604
- const envelope = () => buildContextEnvelope({
605
- sessionId: resolveSessionId(),
606
- appVersion: config.appVersion,
607
- appBuild: config.appBuild,
608
- networkType: config.networkType
609
- });
610
1077
  const queue = createEventQueue({
611
1078
  target: { serverUrl: config.serverUrl, apiKey: config.apiKey },
612
1079
  storage: config.storage,
@@ -614,9 +1081,8 @@ var createAnalytics = (config, options = {}) => {
614
1081
  envelope,
615
1082
  ...options
616
1083
  });
617
- let userContext = { ...(_b = config.userContext) != null ? _b : {} };
618
- let boundUserId = sanitizeUserId((_c = config.userContext) == null ? void 0 : _c.userId);
619
- const storageKey = `wireai:analytics:userId:${(_d = config.appId) != null ? _d : "default"}`;
1084
+ let boundUserId = sanitizeUserId((_d = config.userContext) == null ? void 0 : _d.userId);
1085
+ const storageKey = `wireai:analytics:userId:${(_e = config.appId) != null ? _e : "default"}`;
620
1086
  if (config.storage) {
621
1087
  void config.storage.getItem(storageKey).then((saved) => {
622
1088
  if (saved && !boundUserId) boundUserId = saved;
@@ -624,17 +1090,21 @@ var createAnalytics = (config, options = {}) => {
624
1090
  });
625
1091
  }
626
1092
  const applyContext = (event) => {
627
- var _a2;
628
- const resolved = resolveUserContext(userContext, { autoAppVersion: config.appVersion });
1093
+ var _a3;
1094
+ const hostDeviceKey = typeof userContext.deviceKey === "string" && userContext.deviceKey.trim() ? userContext.deviceKey : void 0;
1095
+ const resolved = resolveUserContext(
1096
+ { ...userContext, deviceKey: hostDeviceKey != null ? hostDeviceKey : autoDeviceKey },
1097
+ { autoAppVersion: config.appVersion }
1098
+ );
629
1099
  if (resolved.userContext) {
630
- event.user_context = { ...resolved.userContext, ...(_a2 = event.user_context) != null ? _a2 : {} };
1100
+ event.user_context = { ...resolved.userContext, ...(_a3 = event.user_context) != null ? _a3 : {} };
631
1101
  }
632
1102
  if (boundUserId && !event.user_id) event.user_id = boundUserId;
633
1103
  };
634
1104
  const setUserContext = (partial) => {
635
- var _a2, _b2;
1105
+ var _a3, _b2;
636
1106
  if (!partial || typeof partial !== "object") return;
637
- const mergedExtra = partial.extra || userContext.extra ? { ...(_a2 = userContext.extra) != null ? _a2 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
1107
+ const mergedExtra = partial.extra || userContext.extra ? { ...(_a3 = userContext.extra) != null ? _a3 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
638
1108
  userContext = { ...userContext, ...partial };
639
1109
  if (mergedExtra) userContext.extra = mergedExtra;
640
1110
  const uid = sanitizeUserId(partial.userId);
@@ -655,9 +1125,9 @@ var createAnalytics = (config, options = {}) => {
655
1125
  applyContext(clientEvent);
656
1126
  queue.enqueue(clientEvent);
657
1127
  };
658
- const screen = (name, props) => {
659
- if (!name) return;
660
- const meta = { screen: name, ...props != null ? props : {} };
1128
+ const screen = (name2, props) => {
1129
+ if (!name2) return;
1130
+ const meta = { screen: name2, ...props != null ? props : {} };
661
1131
  const clientEvent = {
662
1132
  event_type: "app_event",
663
1133
  session_id: resolveSessionId(),