@wireai/activation 0.8.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 (91) hide show
  1. package/AGENTS.md +29 -5
  2. package/CHANGELOG.md +163 -6
  3. package/README.md +105 -10
  4. package/dist/analytics/index.d.mts +6 -6
  5. package/dist/analytics/index.d.ts +6 -6
  6. package/dist/analytics/index.js +447 -49
  7. package/dist/analytics/index.js.map +1 -1
  8. package/dist/analytics/index.mjs +447 -49
  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-f7LWcdWG.d.ts → currentSession-61dcm3V-.d.ts} +10 -2
  15. package/dist/{currentSession-d9CrBxwe.d.mts → currentSession-Bs2JfTJ8.d.mts} +10 -2
  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 +558 -15
  19. package/dist/index.d.ts +558 -15
  20. package/dist/index.js +1144 -375
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +969 -207
  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/currentSession.ts +1 -1
  53. package/src/cards/CardGridSelectCard.tsx +253 -0
  54. package/src/cards/ChipSelectCard.tsx +1 -1
  55. package/src/cards/SelectionCard.tsx +15 -19
  56. package/src/cards/index.ts +13 -1
  57. package/src/cards/optionSchema.ts +65 -0
  58. package/src/coachmarks/types.ts +1 -1
  59. package/src/components/CardHandoff.tsx +39 -7
  60. package/src/components/DoneCheck.tsx +94 -0
  61. package/src/components/ModalPaneHost.tsx +141 -0
  62. package/src/components/StepDots.tsx +112 -0
  63. package/src/device/appVersion.ts +29 -8
  64. package/src/device/deviceModel.ts +21 -8
  65. package/src/features/cache.ts +1 -1
  66. package/src/haptics/expo-haptics.d.ts +31 -0
  67. package/src/haptics/haptics.ts +58 -0
  68. package/src/icons/IconRegistry.tsx +53 -0
  69. package/src/icons/WireIcon.tsx +85 -0
  70. package/src/icons/expoIcons.ts +165 -0
  71. package/src/icons/index.ts +18 -0
  72. package/src/icons/vocabulary.ts +154 -0
  73. package/src/index.ts +20 -0
  74. package/src/questionnaire/QuestionnaireGate.tsx +315 -164
  75. package/src/questionnaire/decision.ts +4 -2
  76. package/src/questionnaire/index.ts +3 -2
  77. package/src/questionnaire/steps.ts +261 -0
  78. package/src/questionnaire/types.ts +33 -12
  79. package/src/reviews/ReviewGate.tsx +250 -152
  80. package/src/reviews/index.ts +7 -3
  81. package/src/reviews/transport.ts +77 -3
  82. package/src/reviews/types.ts +13 -0
  83. package/src/session/persistedSession.ts +1 -1
  84. package/src/session-analytics/lifecycle.ts +1 -1
  85. package/src/session-analytics/useSessionStart.ts +2 -2
  86. package/src/showcase/FeatureShowcase.tsx +1 -1
  87. package/src/showcase/showcaseColors.ts +1 -1
  88. package/src/theme/mergeThemeOver.ts +27 -0
  89. package/src/types.ts +8 -0
  90. package/dist/transport-BeO_Brcu.d.mts +0 -40
  91. package/dist/transport-DLpd1v5_.d.ts +0 -40
@@ -1,23 +1,413 @@
1
+ import { Platform, Dimensions, I18nManager, NativeModules, TurboModuleRegistry } from 'react-native';
1
2
  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;
4
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
10
  }) : x)(function(x) {
7
11
  if (typeof require !== "undefined") return require.apply(this, arguments);
8
12
  throw Error('Dynamic require of "' + x + '" is not supported');
9
13
  });
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
+ });
10
400
 
11
401
  // src/reviews/transport.ts
12
- var reportAppEvent = (target, name, options = {}) => {
13
- if (!(target == null ? void 0 : target.serverUrl) || !name) return;
402
+ var reportAppEvent = (target, name2, options = {}) => {
403
+ if (!(target == null ? void 0 : target.serverUrl) || !name2) return;
14
404
  try {
15
405
  const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
16
406
  const headers = { "Content-Type": "application/json" };
17
407
  if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
18
408
  const event = {
19
409
  event_type: "app_event",
20
- question_key: name
410
+ question_key: name2
21
411
  };
22
412
  if (options.sessionId) event.session_id = options.sessionId;
23
413
  if (options.deviceKey) event.user_context = { device_key: options.deviceKey };
@@ -37,24 +427,24 @@ var reportAppEvent = (target, name, options = {}) => {
37
427
  // src/analytics/screenTracking.ts
38
428
  var getActiveRouteName = (state) => {
39
429
  let current = state;
40
- let name;
430
+ let name2;
41
431
  while (current && Array.isArray(current.routes) && current.routes.length > 0) {
42
432
  const index = typeof current.index === "number" ? current.index : 0;
43
433
  const route = current.routes[index];
44
434
  if (!route) break;
45
- name = route.name;
435
+ name2 = route.name;
46
436
  current = route.state;
47
437
  }
48
- return name;
438
+ return name2;
49
439
  };
50
440
  var createScreenTracker = (options = {}) => {
51
441
  let lastScreen;
52
442
  return {
53
443
  track: (screen) => {
54
- var _a;
444
+ var _a2;
55
445
  if (!screen || screen === lastScreen) return;
56
446
  lastScreen = screen;
57
- (_a = options.onScreen) == null ? void 0 : _a.call(options, screen);
447
+ (_a2 = options.onScreen) == null ? void 0 : _a2.call(options, screen);
58
448
  if (options.shouldTrack && !options.shouldTrack(screen)) return;
59
449
  reportAppEvent(options.target, "screen", {
60
450
  sessionId: options.sessionId,
@@ -96,8 +486,8 @@ var useScreenTracking = (navigationRef, options = {}) => {
96
486
  const tracker = trackerRef.current;
97
487
  if (!tracker || !(navigationRef == null ? void 0 : navigationRef.addListener)) return;
98
488
  const report = () => {
99
- var _a, _b;
100
- return tracker.track((_b = (_a = navigationRef.getCurrentRoute) == null ? void 0 : _a.call(navigationRef)) == null ? void 0 : _b.name);
489
+ var _a2, _b;
490
+ return tracker.track((_b = (_a2 = navigationRef.getCurrentRoute) == null ? void 0 : _a2.call(navigationRef)) == null ? void 0 : _b.name);
101
491
  };
102
492
  report();
103
493
  const unsubscribe = navigationRef.addListener("state", report);
@@ -170,9 +560,16 @@ var coerceVersion = (value) => {
170
560
  return trimmed.length > 0 ? trimmed : void 0;
171
561
  };
172
562
  var runtimeRequire = (moduleName) => {
563
+ if (typeof __require !== "function") return void 0;
173
564
  try {
174
- if (typeof __require !== "function") return void 0;
175
- return __require(moduleName);
565
+ switch (moduleName) {
566
+ case "expo-constants":
567
+ return init_Constants(), __toCommonJS(Constants_exports);
568
+ case "expo-application":
569
+ return __require("expo-application");
570
+ default:
571
+ return void 0;
572
+ }
176
573
  } catch {
177
574
  return void 0;
178
575
  }
@@ -192,14 +589,14 @@ var safeInterop = (requireModule, moduleName) => {
192
589
  };
193
590
  var detectAppVersion = (requireModule = runtimeRequire) => {
194
591
  try {
195
- const constants = safeInterop(requireModule, "expo-constants");
196
- if (constants) {
197
- const expoConfig = constants.expoConfig;
592
+ const constants2 = safeInterop(requireModule, "expo-constants");
593
+ if (constants2) {
594
+ const expoConfig = constants2.expoConfig;
198
595
  if (expoConfig && typeof expoConfig === "object") {
199
596
  const fromExpoConfig = coerceVersion(expoConfig.version);
200
597
  if (fromExpoConfig) return fromExpoConfig;
201
598
  }
202
- const fromNative = coerceVersion(constants.nativeAppVersion);
599
+ const fromNative = coerceVersion(constants2.nativeAppVersion);
203
600
  if (fromNative) return fromNative;
204
601
  }
205
602
  const application = safeInterop(requireModule, "expo-application");
@@ -219,9 +616,10 @@ var coerceModel = (value) => {
219
616
  return trimmed.length > 0 ? trimmed : void 0;
220
617
  };
221
618
  var runtimeRequire2 = (moduleName) => {
619
+ if (moduleName !== "expo-device") return void 0;
620
+ if (typeof __require !== "function") return void 0;
222
621
  try {
223
- if (typeof __require !== "function") return void 0;
224
- return __require(moduleName);
622
+ return __require("expo-device");
225
623
  } catch {
226
624
  return void 0;
227
625
  }
@@ -263,7 +661,7 @@ var deriveFormFactor = (iosIdiom, width, height) => {
263
661
  return void 0;
264
662
  };
265
663
  var collectDeviceContext = () => {
266
- var _a;
664
+ var _a2;
267
665
  const ctx = { platform: Platform.OS };
268
666
  try {
269
667
  const version = Platform.Version;
@@ -272,26 +670,26 @@ var collectDeviceContext = () => {
272
670
  }
273
671
  } catch {
274
672
  }
275
- let constants = {};
673
+ let constants2 = {};
276
674
  try {
277
- constants = (_a = Platform.constants) != null ? _a : {};
675
+ constants2 = (_a2 = Platform.constants) != null ? _a2 : {};
278
676
  } catch {
279
- constants = {};
677
+ constants2 = {};
280
678
  }
281
679
  let iosIdiom;
282
680
  try {
283
681
  if (Platform.OS === "android") {
284
- const brand = constants.Brand;
285
- const model = constants.Model;
286
- const release = constants.Release;
682
+ const brand = constants2.Brand;
683
+ const model = constants2.Model;
684
+ const release = constants2.Release;
287
685
  if (typeof brand === "string" && brand) ctx.brand = brand;
288
686
  if (typeof model === "string" && model) ctx.model = model;
289
687
  if (release !== void 0 && release !== null && String(release)) {
290
688
  ctx.osVersion = String(release);
291
689
  }
292
690
  } else if (Platform.OS === "ios") {
293
- const osVersion = constants.osVersion;
294
- const idiom = constants.interfaceIdiom;
691
+ const osVersion = constants2.osVersion;
692
+ const idiom = constants2.interfaceIdiom;
295
693
  if (osVersion !== void 0 && osVersion !== null && String(osVersion)) {
296
694
  ctx.osVersion = String(osVersion);
297
695
  }
@@ -332,10 +730,10 @@ var collectDeviceContext = () => {
332
730
 
333
731
  // src/analytics/contextEnvelope.ts
334
732
  var buildContextEnvelope = (input = {}) => {
335
- var _a;
733
+ var _a2;
336
734
  const device = { ...collectDeviceContext() };
337
735
  if (input.appVersion) device.appVersion = input.appVersion;
338
- const effectiveAppVersion = (_a = input.appVersion) != null ? _a : device.appVersion;
736
+ const effectiveAppVersion = (_a2 = input.appVersion) != null ? _a2 : device.appVersion;
339
737
  const envelope = { device };
340
738
  if (input.sessionId) envelope.sessionId = input.sessionId;
341
739
  if (effectiveAppVersion) envelope.appVersion = effectiveAppVersion;
@@ -381,10 +779,10 @@ var parsePersisted = (raw) => {
381
779
  }
382
780
  };
383
781
  var createEventQueue = (options) => {
384
- var _a, _b, _c, _d, _e, _f, _g;
782
+ var _a2, _b, _c, _d, _e, _f, _g;
385
783
  const target = options.target;
386
784
  const storage = options.storage;
387
- const key = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a = options.appId) != null ? _a : "default"}`;
785
+ const key = (_b = options.storageKey) != null ? _b : `wireai:evtq:${(_a2 = options.appId) != null ? _a2 : "default"}`;
388
786
  const maxSize = (_c = options.maxSize) != null ? _c : DEFAULTS.maxSize;
389
787
  const batchSize = (_d = options.batchSize) != null ? _d : DEFAULTS.batchSize;
390
788
  const baseBackoffMs = (_e = options.baseBackoffMs) != null ? _e : DEFAULTS.baseBackoffMs;
@@ -403,13 +801,13 @@ var createEventQueue = (options) => {
403
801
  }
404
802
  };
405
803
  const stamp = (event) => {
406
- var _a2;
804
+ var _a3;
407
805
  const env = resolveEnvelope();
408
806
  const stamped = { ...event };
409
807
  if (!env) return stamped;
410
808
  if (!stamped.device && env.device) stamped.device = env.device;
411
809
  if (!stamped.session_id && env.sessionId) stamped.session_id = env.sessionId;
412
- const uc = { ...(_a2 = stamped.user_context) != null ? _a2 : {} };
810
+ const uc = { ...(_a3 = stamped.user_context) != null ? _a3 : {} };
413
811
  if (env.appVersion && uc.app_version === void 0) uc.app_version = env.appVersion;
414
812
  if (env.appBuild && uc.app_build === void 0) uc.app_build = env.appBuild;
415
813
  if (env.networkType && uc.network_type === void 0) uc.network_type = env.networkType;
@@ -605,7 +1003,7 @@ var namespaceExtra = (extra) => {
605
1003
  return out;
606
1004
  };
607
1005
  var resolveUserContext = (ctx = {}, opts = {}) => {
608
- var _a;
1006
+ var _a2;
609
1007
  const result = {};
610
1008
  const bucket = {};
611
1009
  const userId = sanitizeUserId(ctx.userId);
@@ -615,7 +1013,7 @@ var resolveUserContext = (ctx = {}, opts = {}) => {
615
1013
  result.deviceKey = deviceKey;
616
1014
  bucket.device_key = deviceKey;
617
1015
  }
618
- const appVersion = (_a = cleanString(ctx.appVersion)) != null ? _a : cleanString(opts.autoAppVersion);
1016
+ const appVersion = (_a2 = cleanString(ctx.appVersion)) != null ? _a2 : cleanString(opts.autoAppVersion);
619
1017
  if (appVersion) {
620
1018
  result.appVersion = appVersion;
621
1019
  bucket.app_version = appVersion;
@@ -645,11 +1043,11 @@ var mintDeviceId = () => {
645
1043
 
646
1044
  // src/analytics/analyticsFacade.ts
647
1045
  var createAnalytics = (config, options = {}) => {
648
- var _a, _b, _c, _d, _e;
649
- const instanceSessionId = (_a = config.sessionId) != null ? _a : makeSessionId();
1046
+ var _a2, _b, _c, _d, _e;
1047
+ const instanceSessionId = (_a2 = config.sessionId) != null ? _a2 : makeSessionId();
650
1048
  const resolveSessionId = () => {
651
- var _a2, _b2;
652
- return (_b2 = (_a2 = config.sessionId) != null ? _a2 : getCurrentSessionId()) != null ? _b2 : instanceSessionId;
1049
+ var _a3, _b2;
1050
+ return (_b2 = (_a3 = config.sessionId) != null ? _a3 : getCurrentSessionId()) != null ? _b2 : instanceSessionId;
653
1051
  };
654
1052
  let userContext = { ...(_b = config.userContext) != null ? _b : {} };
655
1053
  const hostDeviceKeyAtInit = typeof ((_c = config.userContext) == null ? void 0 : _c.deviceKey) === "string" && config.userContext.deviceKey.trim() ? config.userContext.deviceKey.trim() : void 0;
@@ -666,10 +1064,10 @@ var createAnalytics = (config, options = {}) => {
666
1064
  });
667
1065
  }
668
1066
  const envelope = () => {
669
- var _a2;
1067
+ var _a3;
670
1068
  return buildContextEnvelope({
671
1069
  sessionId: resolveSessionId(),
672
- appVersion: (_a2 = userContext.appVersion) != null ? _a2 : config.appVersion,
1070
+ appVersion: (_a3 = userContext.appVersion) != null ? _a3 : config.appVersion,
673
1071
  appBuild: config.appBuild,
674
1072
  networkType: config.networkType
675
1073
  });
@@ -690,21 +1088,21 @@ var createAnalytics = (config, options = {}) => {
690
1088
  });
691
1089
  }
692
1090
  const applyContext = (event) => {
693
- var _a2;
1091
+ var _a3;
694
1092
  const hostDeviceKey = typeof userContext.deviceKey === "string" && userContext.deviceKey.trim() ? userContext.deviceKey : void 0;
695
1093
  const resolved = resolveUserContext(
696
1094
  { ...userContext, deviceKey: hostDeviceKey != null ? hostDeviceKey : autoDeviceKey },
697
1095
  { autoAppVersion: config.appVersion }
698
1096
  );
699
1097
  if (resolved.userContext) {
700
- event.user_context = { ...resolved.userContext, ...(_a2 = event.user_context) != null ? _a2 : {} };
1098
+ event.user_context = { ...resolved.userContext, ...(_a3 = event.user_context) != null ? _a3 : {} };
701
1099
  }
702
1100
  if (boundUserId && !event.user_id) event.user_id = boundUserId;
703
1101
  };
704
1102
  const setUserContext = (partial) => {
705
- var _a2, _b2;
1103
+ var _a3, _b2;
706
1104
  if (!partial || typeof partial !== "object") return;
707
- const mergedExtra = partial.extra || userContext.extra ? { ...(_a2 = userContext.extra) != null ? _a2 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
1105
+ const mergedExtra = partial.extra || userContext.extra ? { ...(_a3 = userContext.extra) != null ? _a3 : {}, ...(_b2 = partial.extra) != null ? _b2 : {} } : void 0;
708
1106
  userContext = { ...userContext, ...partial };
709
1107
  if (mergedExtra) userContext.extra = mergedExtra;
710
1108
  const uid = sanitizeUserId(partial.userId);
@@ -725,9 +1123,9 @@ var createAnalytics = (config, options = {}) => {
725
1123
  applyContext(clientEvent);
726
1124
  queue.enqueue(clientEvent);
727
1125
  };
728
- const screen = (name, props) => {
729
- if (!name) return;
730
- const meta = { screen: name, ...props != null ? props : {} };
1126
+ const screen = (name2, props) => {
1127
+ if (!name2) return;
1128
+ const meta = { screen: name2, ...props != null ? props : {} };
731
1129
  const clientEvent = {
732
1130
  event_type: "app_event",
733
1131
  session_id: resolveSessionId(),