@ateam-ai-mobile/expo 0.1.7 → 0.1.8

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 (71) hide show
  1. package/dist/bootstrap.js +841 -323
  2. package/dist/bootstrap.js.map +1 -1
  3. package/dist/bootstrap.mjs +9 -7
  4. package/dist/bootstrap.mjs.map +1 -1
  5. package/dist/chunk-7FWYEHN5.mjs +203 -0
  6. package/dist/chunk-7FWYEHN5.mjs.map +1 -0
  7. package/dist/{chunk-4XYXJYN5.mjs → chunk-C7M5WAHA.mjs} +583 -298
  8. package/dist/chunk-C7M5WAHA.mjs.map +1 -0
  9. package/dist/{chunk-5HM6UA2K.mjs → chunk-GF2MPTAB.mjs} +83 -7
  10. package/dist/chunk-GF2MPTAB.mjs.map +1 -0
  11. package/dist/chunk-J6XRNX7P.mjs +19 -0
  12. package/dist/chunk-J6XRNX7P.mjs.map +1 -0
  13. package/dist/{chunk-TZXWVYYR.mjs → chunk-PCAEUX2N.mjs} +1 -1
  14. package/dist/chunk-PCAEUX2N.mjs.map +1 -0
  15. package/dist/{chunk-VQJPSLHP.mjs → chunk-Z5AI2SXX.mjs} +13 -4
  16. package/dist/chunk-Z5AI2SXX.mjs.map +1 -0
  17. package/dist/createBridge.js +41 -10
  18. package/dist/createBridge.js.map +1 -1
  19. package/dist/createBridge.mjs +5 -1
  20. package/dist/createBridge.mjs.map +1 -1
  21. package/dist/device/createDeviceProvider.js +278 -17
  22. package/dist/device/createDeviceProvider.js.map +1 -1
  23. package/dist/device/createDeviceProvider.mjs +5 -3
  24. package/dist/device-bridge/index.d.mts +13 -1
  25. package/dist/device-bridge/index.d.ts +13 -1
  26. package/dist/device-bridge/index.js +49 -12
  27. package/dist/device-bridge/index.js.map +1 -1
  28. package/dist/device-bridge/index.mjs +3 -1
  29. package/dist/index.d.mts +19 -3
  30. package/dist/index.d.ts +19 -3
  31. package/dist/index.js +594 -297
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +2 -1
  34. package/dist/maps/index.d.mts +56 -0
  35. package/dist/maps/index.d.ts +56 -0
  36. package/dist/maps/index.js +95 -0
  37. package/dist/maps/index.js.map +1 -0
  38. package/dist/maps/index.mjs +17 -0
  39. package/dist/maps/index.mjs.map +1 -0
  40. package/dist/vision/index.d.mts +4 -2
  41. package/dist/vision/index.d.ts +4 -2
  42. package/dist/vision/index.js.map +1 -1
  43. package/dist/vision/index.mjs +1 -1
  44. package/expo-module.config.json +1 -1
  45. package/ios/AdaMaps/AdaMapsModule.swift +180 -0
  46. package/ios/AdaMaps.podspec +25 -0
  47. package/ios/AdaVision.podspec +4 -0
  48. package/ios/AdaVisionModule.swift +63 -9
  49. package/package.json +10 -4
  50. package/src/args.ts +56 -0
  51. package/src/createBridge.ts +3 -1
  52. package/src/device/createDeviceProvider.ts +88 -3
  53. package/src/device-bridge/collectors/location.ts +21 -9
  54. package/src/device-state/collectors.ts +5 -1
  55. package/src/device-state/domains/deviceContext.ts +5 -3
  56. package/src/device-state/domains/interaction.ts +2 -1
  57. package/src/device-state/domains/spatial.ts +200 -116
  58. package/src/device-state/domains/visual.ts +34 -13
  59. package/src/device-state/events.ts +49 -0
  60. package/src/device-state/headingSource.ts +43 -8
  61. package/src/device-state/index.ts +3 -2
  62. package/src/device-state/replay.ts +76 -11
  63. package/src/device-state/spatialEvents.ts +300 -0
  64. package/src/geo.ts +23 -0
  65. package/src/maps/index.ts +81 -0
  66. package/src/maps/normalize.ts +225 -0
  67. package/src/vision/index.ts +4 -2
  68. package/dist/chunk-4XYXJYN5.mjs.map +0 -1
  69. package/dist/chunk-5HM6UA2K.mjs.map +0 -1
  70. package/dist/chunk-TZXWVYYR.mjs.map +0 -1
  71. package/dist/chunk-VQJPSLHP.mjs.map +0 -1
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  clearAllPluginData,
3
3
  createDeviceProvider
4
- } from "../chunk-5HM6UA2K.mjs";
5
- import "../chunk-TZXWVYYR.mjs";
4
+ } from "../chunk-GF2MPTAB.mjs";
5
+ import "../chunk-PCAEUX2N.mjs";
6
6
  import "../chunk-6LXF3JVX.mjs";
7
7
  import "../chunk-FF6ZZZXH.mjs";
8
- import "../chunk-VQJPSLHP.mjs";
8
+ import "../chunk-Z5AI2SXX.mjs";
9
9
  import "../chunk-KOXF2FZM.mjs";
10
10
  import "../chunk-XQSY6MHP.mjs";
11
11
  import "../chunk-4BMWVN25.mjs";
12
+ import "../chunk-7FWYEHN5.mjs";
13
+ import "../chunk-J6XRNX7P.mjs";
12
14
  import "../chunk-WMJKH4XE.mjs";
13
15
  export {
14
16
  clearAllPluginData,
@@ -353,11 +353,23 @@ interface Position {
353
353
  declare function getPosition(opts?: {
354
354
  accuracy?: 'low' | 'high';
355
355
  }): Promise<Position>;
356
+ declare const WATCH_TIER: {
357
+ readonly navigation: any;
358
+ readonly high: any;
359
+ readonly balanced: any;
360
+ readonly low: any;
361
+ };
356
362
  /**
357
363
  * Stream position updates. Returns an unsubscribe function — call it, or the
358
364
  * GPS keeps running and drains the battery.
365
+ *
366
+ * `accuracy` picks the GPS tier. The default stays Balanced (≈100 m on iOS),
367
+ * which is right for "which city block" and wrong for "turn at the next corner":
368
+ * a navigation session asks for BestForNavigation and pays the battery for it.
359
369
  */
360
- declare function watchPosition(cb: (pos: Position) => void): () => void;
370
+ declare function watchPosition(cb: (pos: Position) => void, opts?: {
371
+ accuracy?: keyof typeof WATCH_TIER;
372
+ }): () => void;
361
373
 
362
374
  type location_Position = Position;
363
375
  declare const location_collectCurrent: typeof collectCurrent;
@@ -353,11 +353,23 @@ interface Position {
353
353
  declare function getPosition(opts?: {
354
354
  accuracy?: 'low' | 'high';
355
355
  }): Promise<Position>;
356
+ declare const WATCH_TIER: {
357
+ readonly navigation: any;
358
+ readonly high: any;
359
+ readonly balanced: any;
360
+ readonly low: any;
361
+ };
356
362
  /**
357
363
  * Stream position updates. Returns an unsubscribe function — call it, or the
358
364
  * GPS keeps running and drains the battery.
365
+ *
366
+ * `accuracy` picks the GPS tier. The default stays Balanced (≈100 m on iOS),
367
+ * which is right for "which city block" and wrong for "turn at the next corner":
368
+ * a navigation session asks for BestForNavigation and pays the battery for it.
359
369
  */
360
- declare function watchPosition(cb: (pos: Position) => void): () => void;
370
+ declare function watchPosition(cb: (pos: Position) => void, opts?: {
371
+ accuracy?: keyof typeof WATCH_TIER;
372
+ }): () => void;
361
373
 
362
374
  type location_Position = Position;
363
375
  declare const location_collectCurrent: typeof collectCurrent;
@@ -1087,29 +1087,60 @@ __export(location_exports, {
1087
1087
  requestPermission: () => requestPermission4,
1088
1088
  watchPosition: () => watchPosition
1089
1089
  });
1090
+ var ExpoLocation2 = __toESM(require("expo-location"));
1091
+
1092
+ // src/maps/index.ts
1093
+ var import_react_native3 = require("react-native");
1094
+ var import_expo_modules_core = require("expo-modules-core");
1090
1095
  var ExpoLocation = __toESM(require("expo-location"));
1096
+
1097
+ // src/maps/normalize.ts
1098
+ var text = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
1099
+ function toMapsAddress(raw) {
1100
+ const r = raw ?? {};
1101
+ return {
1102
+ name: text(r.name),
1103
+ street: text(r.street),
1104
+ streetNumber: text(r.streetNumber),
1105
+ district: text(r.district),
1106
+ city: text(r.city),
1107
+ region: text(r.region),
1108
+ postalCode: text(r.postalCode),
1109
+ country: text(r.country),
1110
+ isoCountryCode: text(r.isoCountryCode)
1111
+ };
1112
+ }
1113
+
1114
+ // src/maps/index.ts
1115
+ var native = (0, import_expo_modules_core.requireOptionalNativeModule)("AdaMaps");
1116
+ async function reverseGeocode(at) {
1117
+ const [first] = await ExpoLocation.reverseGeocodeAsync({ latitude: at.latitude, longitude: at.longitude });
1118
+ return first ? toMapsAddress(first) : null;
1119
+ }
1120
+
1121
+ // src/device-bridge/collectors/location.ts
1091
1122
  async function requestPermission4() {
1092
- const { status: fg } = await ExpoLocation.requestForegroundPermissionsAsync();
1123
+ const { status: fg } = await ExpoLocation2.requestForegroundPermissionsAsync();
1093
1124
  if (fg !== "granted") return false;
1094
1125
  try {
1095
- await ExpoLocation.requestBackgroundPermissionsAsync();
1126
+ await ExpoLocation2.requestBackgroundPermissionsAsync();
1096
1127
  } catch {
1097
1128
  }
1098
1129
  return fg === "granted";
1099
1130
  }
1100
1131
  async function hasPermission4() {
1101
- const { status } = await ExpoLocation.getForegroundPermissionsAsync();
1132
+ const { status } = await ExpoLocation2.getForegroundPermissionsAsync();
1102
1133
  return status === "granted";
1103
1134
  }
1104
1135
  async function collectCurrent() {
1105
- const location = await ExpoLocation.getCurrentPositionAsync({
1106
- accuracy: ExpoLocation.Accuracy.Balanced
1136
+ const location = await ExpoLocation2.getCurrentPositionAsync({
1137
+ accuracy: ExpoLocation2.Accuracy.Balanced
1107
1138
  });
1108
1139
  let place = "Current Location";
1109
1140
  let address = `${location.coords.latitude.toFixed(4)}, ${location.coords.longitude.toFixed(4)}`;
1110
1141
  let locationType = "unknown";
1111
1142
  try {
1112
- const [geocoded] = await ExpoLocation.reverseGeocodeAsync({
1143
+ const geocoded = await reverseGeocode({
1113
1144
  latitude: location.coords.latitude,
1114
1145
  longitude: location.coords.longitude
1115
1146
  });
@@ -1148,8 +1179,8 @@ async function ensurePermission() {
1148
1179
  }
1149
1180
  async function getPosition(opts = {}) {
1150
1181
  await ensurePermission();
1151
- const fix = await ExpoLocation.getCurrentPositionAsync({
1152
- accuracy: opts.accuracy === "high" ? ExpoLocation.Accuracy.High : ExpoLocation.Accuracy.Balanced
1182
+ const fix = await ExpoLocation2.getCurrentPositionAsync({
1183
+ accuracy: opts.accuracy === "high" ? ExpoLocation2.Accuracy.High : ExpoLocation2.Accuracy.Balanced
1153
1184
  });
1154
1185
  return toPosition(fix);
1155
1186
  }
@@ -1167,15 +1198,21 @@ function toPosition(fix) {
1167
1198
  function nonNegative(v) {
1168
1199
  return typeof v === "number" && v >= 0 ? v : void 0;
1169
1200
  }
1170
- function watchPosition(cb) {
1201
+ var WATCH_TIER = {
1202
+ navigation: ExpoLocation2.Accuracy.BestForNavigation,
1203
+ high: ExpoLocation2.Accuracy.High,
1204
+ balanced: ExpoLocation2.Accuracy.Balanced,
1205
+ low: ExpoLocation2.Accuracy.Low
1206
+ };
1207
+ function watchPosition(cb, opts) {
1171
1208
  let subscription = null;
1172
1209
  let cancelled = false;
1173
1210
  (async () => {
1174
1211
  try {
1175
1212
  await ensurePermission();
1176
1213
  if (cancelled) return;
1177
- subscription = await ExpoLocation.watchPositionAsync(
1178
- { accuracy: ExpoLocation.Accuracy.Balanced },
1214
+ subscription = await ExpoLocation2.watchPositionAsync(
1215
+ { accuracy: WATCH_TIER[opts?.accuracy ?? "balanced"] },
1179
1216
  (fix) => cb(toPosition(fix))
1180
1217
  );
1181
1218
  if (cancelled) {
@@ -1324,7 +1361,7 @@ function mapPriority(p) {
1324
1361
  }
1325
1362
 
1326
1363
  // src/device-bridge/collectors/appEngagement.ts
1327
- var import_react_native3 = require("react-native");
1364
+ var import_react_native4 = require("react-native");
1328
1365
  var import_async_storage2 = __toESM(require("@react-native-async-storage/async-storage"));
1329
1366
  var KEY = "ateam.appEngagement.v1";
1330
1367
  var _tally = null;