@cloudparse/up-miniapps-sdk 0.6.6 → 0.6.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.
package/dist/index.js CHANGED
@@ -202,11 +202,61 @@ var Bridge = class {
202
202
  }
203
203
  }
204
204
  /**
205
- * Internal handler for mock message processing, overrideable in test environments
205
+ * Internal handler for mock message processing, overrideable in test environments.
206
+ *
207
+ * Every mini-app that calls a bridge method also has to run standalone in a plain
208
+ * browser (dev, and this vault's own Chrome-based verification) with no native shell
209
+ * attached — `isNative()` is false, so `send()` never round-trips through the real
210
+ * host at all. Before this switch existed, EVERY unhandled type here resolved with
211
+ * plain `undefined` (see the `default` branch below), which silently broke any caller
212
+ * checking a result shape like `{success: boolean}` — `undefined?.success` reads as
213
+ * `false`, not "no answer", so e.g. `sdk.media.saveImage()` looked like a real
214
+ * permission-denied rejection in the browser instead of "there's no native shell
215
+ * here to ask." Add a `case` here — instead of leaving every mini-app to
216
+ * individually special-case "what happens when I call this with no shell attached" —
217
+ * whenever a bridge method's mock behavior should be more than a no-op.
206
218
  */
207
219
  handleMockMessage(type, payload) {
208
- console.warn(`[Bridge] Mock mode active: Unhandled message type ${type}`);
209
- return Promise.resolve();
220
+ switch (type) {
221
+ case "SAVE_IMAGE":
222
+ return this.mockSaveImage(
223
+ payload
224
+ );
225
+ default:
226
+ console.warn(
227
+ `[Bridge] Mock mode active: Unhandled message type ${type}`
228
+ );
229
+ return Promise.resolve();
230
+ }
231
+ }
232
+ /**
233
+ * Standalone-browser stand-in for the native `SAVE_IMAGE` handler: triggers a real
234
+ * browser download (an `<a download>` click) instead of writing to a device photo
235
+ * library, which doesn't exist here. Resolves `{success: true}` on a real trigger so
236
+ * every mini-app's own `result?.success` check gets the same shape/semantics as the
237
+ * real native response — no per-app "am I in mock mode" branching needed. Consumers
238
+ * can still keep their own `catch` fallback for the genuinely different case of a
239
+ * native shell that's missing its WebView bridge (see `sendOnce`'s own rejection
240
+ * path) — that's a real native edge case, not mocking, and this method never runs
241
+ * for it (`send()` only reaches `handleMockMessage` when `!isNative()`).
242
+ */
243
+ mockSaveImage(payload) {
244
+ if (typeof document === "undefined") {
245
+ return Promise.resolve({ success: false });
246
+ }
247
+ try {
248
+ const href = payload.base64.startsWith("data:") ? payload.base64 : `data:image/png;base64,${payload.base64}`;
249
+ const link = document.createElement("a");
250
+ link.href = href;
251
+ link.download = payload.filename ? `${payload.filename}.png` : "image.png";
252
+ document.body.appendChild(link);
253
+ link.click();
254
+ link.remove();
255
+ return Promise.resolve({ success: true });
256
+ } catch (err) {
257
+ console.warn("[Bridge] Mock SAVE_IMAGE download failed:", err);
258
+ return Promise.resolve({ success: false });
259
+ }
210
260
  }
211
261
  sendOnce(type, payload, timeoutMs) {
212
262
  return new Promise((resolve, reject) => {
@@ -676,7 +726,7 @@ var MapDrawer = forwardRef3(
676
726
  const dragDelta = touchEndY - dragStartY;
677
727
  const drawerHeightFromBottom = dragBaseHeightPxRef.current - dragDelta;
678
728
  const distToClosed = Math.abs(drawerHeightFromBottom - closedPx);
679
- let targetState;
729
+ let targetState2;
680
730
  if (currentState === "auto") {
681
731
  const autoMaxPx2 = resolveHeightToPixels(
682
732
  drawerAutoMaxHeight || "100%",
@@ -684,22 +734,22 @@ var MapDrawer = forwardRef3(
684
734
  );
685
735
  const autoPx2 = Math.min(autoMaxPx2, autoContentPx);
686
736
  const distToAuto = Math.abs(drawerHeightFromBottom - autoPx2);
687
- targetState = distToAuto <= distToClosed ? "auto" : "closed";
737
+ targetState2 = distToAuto <= distToClosed ? "auto" : "closed";
688
738
  } else {
689
739
  const distToFull = Math.abs(drawerHeightFromBottom - fullPx2);
690
740
  const distToPeek = Math.abs(drawerHeightFromBottom - peekPx2);
691
741
  const minDist = Math.min(distToFull, distToPeek, distToClosed);
692
742
  if (minDist === distToFull) {
693
- targetState = "full";
743
+ targetState2 = "full";
694
744
  } else if (minDist === distToPeek) {
695
- targetState = "peek";
745
+ targetState2 = "peek";
696
746
  } else {
697
- targetState = "closed";
747
+ targetState2 = "closed";
698
748
  }
699
749
  }
700
750
  setTouchStartY(null);
701
751
  setCurrentTouchY(null);
702
- onChangeState(targetState);
752
+ onChangeState(targetState2);
703
753
  requestAnimationFrame(() => {
704
754
  if (parentContainer) {
705
755
  parentContainer.style.setProperty("--drag-offset", "0px");
@@ -1981,122 +2031,149 @@ var GlobalEvent = /* @__PURE__ */ ((GlobalEvent2) => {
1981
2031
  })(GlobalEvent || {});
1982
2032
 
1983
2033
  // src/components/Map/hooks/useUserLocation.ts
1984
- import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef4, useState as useState4 } from "react";
2034
+ import { useEffect as useEffect3, useState as useState4 } from "react";
1985
2035
  var LERP_FACTOR = 0.12;
1986
- var useUserLocation = () => {
1987
- const [locationState, setLocationState] = useState4({
1988
- accuracy: null,
1989
- coords: null,
1990
- heading: null
1991
- });
1992
- const targetRef = useRef4({
1993
- accuracy: null,
1994
- coords: null,
1995
- heading: null
1996
- });
1997
- const currentRef = useRef4({
1998
- accuracy: null,
1999
- coords: null,
2000
- heading: null
2001
- });
2002
- const mapPayload = useCallback3((payload) => {
2003
- const coords = payload.location?.coords || payload.coords;
2004
- const headingData = payload.heading;
2005
- const newCoords = coords ? [coords.longitude, coords.latitude] : null;
2006
- let heading = null;
2007
- if (headingData?.trueHeading !== void 0 && headingData.trueHeading >= 0) {
2008
- heading = headingData.trueHeading;
2009
- } else if (headingData?.magneticHeading !== void 0 && headingData.magneticHeading >= 0) {
2010
- heading = headingData.magneticHeading;
2011
- } else if (headingData?.heading !== null && headingData?.heading >= 0) {
2012
- heading = headingData.heading;
2013
- }
2014
- return {
2015
- accuracy: coords?.accuracy || null,
2016
- coords: newCoords,
2017
- heading
2018
- };
2019
- }, []);
2020
- useEffect3(() => {
2021
- let rafId;
2022
- const animate = () => {
2023
- let changed = false;
2024
- if (targetRef.current.coords) {
2025
- if (!currentRef.current.coords) {
2026
- currentRef.current.coords = [...targetRef.current.coords];
2027
- changed = true;
2028
- } else {
2029
- const [tLng, tLat] = targetRef.current.coords;
2030
- const [cLng, cLat] = currentRef.current.coords;
2031
- const nLng = cLng + (tLng - cLng) * LERP_FACTOR;
2032
- const nLat = cLat + (tLat - cLat) * LERP_FACTOR;
2033
- if (Math.abs(nLng - cLng) > 1e-7 || Math.abs(nLat - cLat) > 1e-7) {
2034
- currentRef.current.coords = [nLng, nLat];
2035
- changed = true;
2036
- }
2037
- }
2038
- }
2039
- if (targetRef.current.heading !== null) {
2040
- if (currentRef.current.heading === null) {
2041
- currentRef.current.heading = targetRef.current.heading;
2042
- changed = true;
2043
- } else {
2044
- const target = targetRef.current.heading;
2045
- const current = currentRef.current.heading;
2046
- let delta = target - current;
2047
- if (delta > 180) delta -= 360;
2048
- if (delta < -180) delta += 360;
2049
- const nHeading = current + delta * LERP_FACTOR;
2050
- const normalized = (nHeading % 360 + 360) % 360;
2051
- if (Math.abs(delta) > 0.1) {
2052
- currentRef.current.heading = normalized;
2053
- changed = true;
2054
- }
2055
- }
2056
- }
2057
- if (changed) {
2058
- setLocationState({
2059
- accuracy: targetRef.current.accuracy,
2060
- coords: currentRef.current.coords ? [...currentRef.current.coords] : null,
2061
- heading: currentRef.current.heading
2062
- });
2063
- }
2064
- rafId = requestAnimationFrame(animate);
2065
- };
2066
- rafId = requestAnimationFrame(animate);
2067
- sdk.location.getCurrentPosition().then((data) => {
2068
- const payload = mapPayload(data);
2069
- targetRef.current = payload;
2070
- }).catch((e) => console.warn("Initial location fetch failed", e));
2071
- const unsubscribeStream = sdk.on(
2072
- "LOCATION_STREAM_UPDATE" /* LOCATION_STREAM_UPDATE */,
2073
- (payload) => {
2074
- targetRef.current = mapPayload(payload);
2036
+ var EMPTY_STATE = {
2037
+ accuracy: null,
2038
+ coords: null,
2039
+ heading: null
2040
+ };
2041
+ function mapPayload(payload) {
2042
+ const coords = payload.location?.coords || payload.coords;
2043
+ const headingData = payload.heading;
2044
+ const newCoords = coords ? [coords.longitude, coords.latitude] : null;
2045
+ let heading = null;
2046
+ if (headingData?.trueHeading !== void 0 && headingData.trueHeading >= 0) {
2047
+ heading = headingData.trueHeading;
2048
+ } else if (headingData?.magneticHeading !== void 0 && headingData.magneticHeading >= 0) {
2049
+ heading = headingData.magneticHeading;
2050
+ } else if (headingData?.heading !== null && headingData?.heading >= 0) {
2051
+ heading = headingData.heading;
2052
+ }
2053
+ return {
2054
+ accuracy: coords?.accuracy || null,
2055
+ coords: newCoords,
2056
+ heading
2057
+ };
2058
+ }
2059
+ var refCount = 0;
2060
+ var generation = 0;
2061
+ var subscribers = /* @__PURE__ */ new Set();
2062
+ var targetState = { ...EMPTY_STATE };
2063
+ var currentInterpolated = { coords: null, heading: null };
2064
+ var rafId = null;
2065
+ var unsubscribeStream = null;
2066
+ var unsubscribeLegacy = null;
2067
+ function getSnapshot() {
2068
+ return {
2069
+ accuracy: targetState.accuracy,
2070
+ coords: currentInterpolated.coords ? [...currentInterpolated.coords] : null,
2071
+ heading: currentInterpolated.heading
2072
+ };
2073
+ }
2074
+ function notify() {
2075
+ const snapshot = getSnapshot();
2076
+ for (const callback of subscribers) callback(snapshot);
2077
+ }
2078
+ function animate() {
2079
+ let changed = false;
2080
+ if (targetState.coords) {
2081
+ if (!currentInterpolated.coords) {
2082
+ currentInterpolated.coords = [...targetState.coords];
2083
+ changed = true;
2084
+ } else {
2085
+ const [tLng, tLat] = targetState.coords;
2086
+ const [cLng, cLat] = currentInterpolated.coords;
2087
+ const nLng = cLng + (tLng - cLng) * LERP_FACTOR;
2088
+ const nLat = cLat + (tLat - cLat) * LERP_FACTOR;
2089
+ if (Math.abs(nLng - cLng) > 1e-7 || Math.abs(nLat - cLat) > 1e-7) {
2090
+ currentInterpolated.coords = [nLng, nLat];
2091
+ changed = true;
2075
2092
  }
2076
- );
2077
- const unsubscribeLegacy = sdk.on(
2078
- "LOCATION_UPDATE" /* LOCATION_UPDATE */,
2079
- (payload) => {
2080
- targetRef.current = mapPayload(payload);
2093
+ }
2094
+ }
2095
+ if (targetState.heading !== null) {
2096
+ if (currentInterpolated.heading === null) {
2097
+ currentInterpolated.heading = targetState.heading;
2098
+ changed = true;
2099
+ } else {
2100
+ const target = targetState.heading;
2101
+ const current = currentInterpolated.heading;
2102
+ let delta = target - current;
2103
+ if (delta > 180) delta -= 360;
2104
+ if (delta < -180) delta += 360;
2105
+ const nHeading = current + delta * LERP_FACTOR;
2106
+ const normalized = (nHeading % 360 + 360) % 360;
2107
+ if (Math.abs(delta) > 0.1) {
2108
+ currentInterpolated.heading = normalized;
2109
+ changed = true;
2081
2110
  }
2082
- );
2083
- sdk.location.startStream({
2084
- distanceFilter: 1,
2085
- headingThreshold: 2
2086
- }).catch((e) => console.warn("Failed to start location stream", e));
2111
+ }
2112
+ }
2113
+ if (changed) notify();
2114
+ rafId = requestAnimationFrame(animate);
2115
+ }
2116
+ function startSharedStream() {
2117
+ rafId = requestAnimationFrame(animate);
2118
+ generation++;
2119
+ const thisGeneration = generation;
2120
+ sdk.location.getCurrentPosition().then((data) => {
2121
+ if (thisGeneration !== generation) return;
2122
+ targetState = mapPayload(data);
2123
+ }).catch((e) => console.warn("Initial location fetch failed", e));
2124
+ unsubscribeStream = sdk.on(
2125
+ "LOCATION_STREAM_UPDATE" /* LOCATION_STREAM_UPDATE */,
2126
+ (payload) => {
2127
+ targetState = mapPayload(payload);
2128
+ }
2129
+ );
2130
+ unsubscribeLegacy = sdk.on(
2131
+ "LOCATION_UPDATE" /* LOCATION_UPDATE */,
2132
+ (payload) => {
2133
+ targetState = mapPayload(payload);
2134
+ }
2135
+ );
2136
+ sdk.location.startStream({
2137
+ distanceFilter: 1,
2138
+ headingThreshold: 2
2139
+ }).catch((e) => console.warn("Failed to start location stream", e));
2140
+ }
2141
+ function stopSharedStream() {
2142
+ generation++;
2143
+ if (rafId !== null) cancelAnimationFrame(rafId);
2144
+ rafId = null;
2145
+ unsubscribeStream?.();
2146
+ unsubscribeLegacy?.();
2147
+ unsubscribeStream = null;
2148
+ unsubscribeLegacy = null;
2149
+ sdk.location.stopStream().catch(() => {
2150
+ });
2151
+ targetState = { ...EMPTY_STATE };
2152
+ currentInterpolated = { coords: null, heading: null };
2153
+ }
2154
+ var useUserLocation = () => {
2155
+ const [locationState, setLocationState] = useState4(getSnapshot);
2156
+ useEffect3(() => {
2157
+ refCount++;
2158
+ if (refCount === 1) {
2159
+ startSharedStream();
2160
+ } else {
2161
+ setLocationState(getSnapshot());
2162
+ }
2163
+ subscribers.add(setLocationState);
2087
2164
  return () => {
2088
- cancelAnimationFrame(rafId);
2089
- unsubscribeStream();
2090
- unsubscribeLegacy();
2091
- sdk.location.stopStream().catch(() => {
2092
- });
2165
+ subscribers.delete(setLocationState);
2166
+ refCount--;
2167
+ if (refCount === 0) {
2168
+ stopSharedStream();
2169
+ }
2093
2170
  };
2094
- }, [mapPayload]);
2171
+ }, []);
2095
2172
  return locationState;
2096
2173
  };
2097
2174
 
2098
2175
  // src/components/Map/hooks/useLiveRouting.ts
2099
- import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef5, useState as useState5 } from "react";
2176
+ import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4, useState as useState5 } from "react";
2100
2177
  var useLiveRouting = ({
2101
2178
  origin: manualOrigin,
2102
2179
  destination,
@@ -2113,11 +2190,11 @@ var useLiveRouting = ({
2113
2190
  const userLocationState = useUserLocation();
2114
2191
  const calculationOrigin = manualOrigin || userLocationState.coords;
2115
2192
  const trackingLocation = userLocationState.coords || manualOrigin;
2116
- const lastCalcOrigin = useRef5(null);
2117
- const lastCalcDest = useRef5(null);
2118
- const isRequestInProgress = useRef5(false);
2119
- const lastResetDestKey = useRef5(null);
2120
- const getDistance = useCallback4(
2193
+ const lastCalcOrigin = useRef4(null);
2194
+ const lastCalcDest = useRef4(null);
2195
+ const isRequestInProgress = useRef4(false);
2196
+ const lastResetDestKey = useRef4(null);
2197
+ const getDistance = useCallback3(
2121
2198
  (p1, p2) => {
2122
2199
  const R = 6371e3;
2123
2200
  const \u03C61 = p1[1] * Math.PI / 180;
@@ -2157,7 +2234,7 @@ var useLiveRouting = ({
2157
2234
  }
2158
2235
  return dist;
2159
2236
  }, [trackingLocation, route, destination, getDistance]);
2160
- const calculate = useCallback4(
2237
+ const calculate = useCallback3(
2161
2238
  async (origin, dest, isNewDest) => {
2162
2239
  if (isRequestInProgress.current) return;
2163
2240
  isRequestInProgress.current = true;
@@ -2278,7 +2355,7 @@ var useRoute = (origin, destination, profile = "driving") => {
2278
2355
  };
2279
2356
 
2280
2357
  // src/components/Map/hooks/useJourney.ts
2281
- import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef6, useState as useState6 } from "react";
2358
+ import { useCallback as useCallback4, useEffect as useEffect5, useRef as useRef5, useState as useState6 } from "react";
2282
2359
  var useJourney = (options = {}) => {
2283
2360
  const { navigation, onAbort, onModeChange } = options;
2284
2361
  const [progNav, setProgNav] = useState6(null);
@@ -2311,7 +2388,7 @@ var useJourney = (options = {}) => {
2311
2388
  profile: effectiveOptions?.profile || "driving",
2312
2389
  recalculateThreshold: effectiveOptions?.recalculateThreshold || 50
2313
2390
  });
2314
- const prevDest = useRef6(null);
2391
+ const prevDest = useRef5(null);
2315
2392
  const currentDest = effectiveOptions?.destination;
2316
2393
  useEffect5(() => {
2317
2394
  if (currentDest && (!prevDest.current || prevDest.current[0] !== currentDest[0] || prevDest.current[1] !== currentDest[1])) {
@@ -2319,7 +2396,7 @@ var useJourney = (options = {}) => {
2319
2396
  }
2320
2397
  prevDest.current = currentDest;
2321
2398
  }, [currentDest]);
2322
- const onModeChangeRef = useRef6(onModeChange);
2399
+ const onModeChangeRef = useRef5(onModeChange);
2323
2400
  onModeChangeRef.current = onModeChange;
2324
2401
  useEffect5(() => {
2325
2402
  onModeChangeRef.current?.(internalNav.mode);
@@ -2343,13 +2420,13 @@ var useJourney = (options = {}) => {
2343
2420
  (totalDistanceMeters - remainingMeters) / totalDistanceMeters * 100
2344
2421
  )
2345
2422
  ) : 0;
2346
- const cancel = useCallback5(() => {
2423
+ const cancel = useCallback4(() => {
2347
2424
  setIsAborted(true);
2348
2425
  setProgNav(null);
2349
2426
  sdk.navigation.abort();
2350
2427
  if (onAbort) onAbort();
2351
2428
  }, [onAbort]);
2352
- const start = useCallback5(() => {
2429
+ const start = useCallback4(() => {
2353
2430
  sdk.navigation.start();
2354
2431
  internalNav.start();
2355
2432
  }, [internalNav.start]);
@@ -2837,11 +2914,11 @@ var UserLocationLayer = ({
2837
2914
  // src/components/Map/Map.tsx
2838
2915
  import { Map as MapLibre, MapProvider } from "@vis.gl/react-maplibre";
2839
2916
  import React4, {
2840
- useCallback as useCallback6,
2917
+ useCallback as useCallback5,
2841
2918
  useContext as useContext5,
2842
2919
  useEffect as useEffect7,
2843
2920
  useMemo as useMemo6,
2844
- useRef as useRef7,
2921
+ useRef as useRef6,
2845
2922
  useState as useState8
2846
2923
  } from "react";
2847
2924
  import "maplibre-gl/dist/maplibre-gl.css";
@@ -2885,7 +2962,7 @@ var MapInternal = ({
2885
2962
  }) => {
2886
2963
  const mapControls = useContext5(MapControlsContext);
2887
2964
  const mockLocation = useContext5(MockLocationContext);
2888
- const mapRef = useRef7(null);
2965
+ const mapRef = useRef6(null);
2889
2966
  const userLocationState = useUserLocation();
2890
2967
  const journey = useJourney({
2891
2968
  navigation,
@@ -2903,14 +2980,14 @@ var MapInternal = ({
2903
2980
  const showNavigationUI = hasIntegratedNav ? externalShowNavigationUI !== false && navigation?.showUI !== false : externalShowNavigationUI;
2904
2981
  const mode = navigationData?.mode || "preview";
2905
2982
  const resolvedInitialFollow = mapControls ? mapControls.isFollowing : initialFollowUser;
2906
- const isFollowingRef = useRef7(resolvedInitialFollow);
2907
- const isFlyingRef = useRef7(false);
2908
- const flyingGenerationRef = useRef7(0);
2909
- const lockFlying = useCallback6(() => {
2983
+ const isFollowingRef = useRef6(resolvedInitialFollow);
2984
+ const isFlyingRef = useRef6(false);
2985
+ const flyingGenerationRef = useRef6(0);
2986
+ const lockFlying = useCallback5(() => {
2910
2987
  isFlyingRef.current = true;
2911
2988
  return ++flyingGenerationRef.current;
2912
2989
  }, []);
2913
- const releaseFlyingIfCurrent = useCallback6((flightId) => {
2990
+ const releaseFlyingIfCurrent = useCallback5((flightId) => {
2914
2991
  if (flyingGenerationRef.current === flightId) {
2915
2992
  isFlyingRef.current = false;
2916
2993
  }
@@ -2920,7 +2997,7 @@ var MapInternal = ({
2920
2997
  );
2921
2998
  const isFollowingUI = mapControls ? mapControls.isFollowing : localIsFollowingUI;
2922
2999
  const setIsFollowingCtx = mapControls?.setIsFollowing;
2923
- const setFollowMode = useCallback6(
3000
+ const setFollowMode = useCallback5(
2924
3001
  (follow) => {
2925
3002
  isFollowingRef.current = follow;
2926
3003
  setLocalIsFollowingUI(follow);
@@ -2939,7 +3016,7 @@ var MapInternal = ({
2939
3016
  if (pois.length > 0 && !mergedInteractiveLayerIds.includes("sdk-poi-layer")) {
2940
3017
  mergedInteractiveLayerIds.push("sdk-poi-layer");
2941
3018
  }
2942
- const prevInitialFollow = useRef7(initialFollowUser);
3019
+ const prevInitialFollow = useRef6(initialFollowUser);
2943
3020
  useEffect7(() => {
2944
3021
  if (initialFollowUser !== prevInitialFollow.current) {
2945
3022
  setFollowMode(initialFollowUser);
@@ -2964,8 +3041,8 @@ var MapInternal = ({
2964
3041
  lockFlying,
2965
3042
  releaseFlyingIfCurrent
2966
3043
  ]);
2967
- const lastAutoLockedRouteRef = useRef7(null);
2968
- const lastModeRef = useRef7(null);
3044
+ const lastAutoLockedRouteRef = useRef6(null);
3045
+ const lastModeRef = useRef6(null);
2969
3046
  useEffect7(() => {
2970
3047
  if (!route || !mapRef.current) {
2971
3048
  if (!route) lastAutoLockedRouteRef.current = null;
@@ -3138,7 +3215,7 @@ var MapInternal = ({
3138
3215
  }
3139
3216
  if (onClick) onClick(e);
3140
3217
  };
3141
- const handleCenterOnUser = useCallback6(
3218
+ const handleCenterOnUser = useCallback5(
3142
3219
  (payload) => {
3143
3220
  if (userLocationState.coords && mapRef.current) {
3144
3221
  setFollowMode(true);
@@ -3163,7 +3240,7 @@ var MapInternal = ({
3163
3240
  releaseFlyingIfCurrent
3164
3241
  ]
3165
3242
  );
3166
- const handleFlyTo = useCallback6(
3243
+ const handleFlyTo = useCallback5(
3167
3244
  (coords, params) => {
3168
3245
  const map = mapRef.current;
3169
3246
  if (!map) return;
@@ -3183,7 +3260,7 @@ var MapInternal = ({
3183
3260
  },
3184
3261
  [setFollowMode, lockFlying, releaseFlyingIfCurrent]
3185
3262
  );
3186
- const handleResetBearing = useCallback6((params) => {
3263
+ const handleResetBearing = useCallback5((params) => {
3187
3264
  if (mapRef.current) {
3188
3265
  mapRef.current.easeTo({
3189
3266
  bearing: 0,
@@ -3200,7 +3277,7 @@ var MapInternal = ({
3200
3277
  mapControls._registerFlyToCallback(handleFlyTo);
3201
3278
  }
3202
3279
  }, [mapControls, handleCenterOnUser, handleResetBearing, handleFlyTo]);
3203
- const handleMove = useCallback6(() => {
3280
+ const handleMove = useCallback5(() => {
3204
3281
  if (mapRef.current && mapControls) {
3205
3282
  mapControls.setBearing(mapRef.current.getBearing());
3206
3283
  mapControls.setPitch(mapRef.current.getPitch());
@@ -3490,7 +3567,7 @@ var loadImage2 = (src) => new Promise((resolve, reject) => {
3490
3567
  });
3491
3568
 
3492
3569
  // package.json
3493
- var version = "0.6.6";
3570
+ var version = "0.6.8";
3494
3571
 
3495
3572
  // src/sdk.ts
3496
3573
  function deepFreeze(obj) {
@@ -3897,11 +3974,10 @@ var MiniAppSDK = class {
3897
3974
  var sdk = deepFreeze(new MiniAppSDK());
3898
3975
 
3899
3976
  // src/components/BridgeMocker.tsx
3900
- import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef8, useState as useState9 } from "react";
3977
+ import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo7, useRef as useRef7, useState as useState9 } from "react";
3901
3978
  import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
3902
3979
  var AVATAR_MOUTH_VARIANTS = [
3903
3980
  "variant03",
3904
- "variant06",
3905
3981
  "variant07",
3906
3982
  "variant08",
3907
3983
  "variant09",
@@ -3995,10 +4071,10 @@ var BridgeMocker = ({
3995
4071
  const [radiusMeters, setRadiusMeters] = useState9(0);
3996
4072
  const [radiusUnit, setRadiusUnit] = useState9("m");
3997
4073
  const [isPlacingLocation, setIsPlacingLocation] = useState9(false);
3998
- const streamIntervalRef = useRef8(null);
3999
- const pathIndexRef = useRef8(0);
4000
- const activeConfigRef = useRef8(null);
4001
- const stateRef = useRef8({
4074
+ const streamIntervalRef = useRef7(null);
4075
+ const pathIndexRef = useRef7(0);
4076
+ const activeConfigRef = useRef7(null);
4077
+ const stateRef = useRef7({
4002
4078
  autoMove,
4003
4079
  heading,
4004
4080
  location,
@@ -4010,7 +4086,7 @@ var BridgeMocker = ({
4010
4086
  simulationPath,
4011
4087
  speedMultiplier
4012
4088
  });
4013
- const pushLocationUpdateFor = useCallback7(
4089
+ const pushLocationUpdateFor = useCallback6(
4014
4090
  (coords, headingDeg) => {
4015
4091
  const currentState = stateRef.current;
4016
4092
  const payload = {
@@ -4042,11 +4118,11 @@ var BridgeMocker = ({
4042
4118
  },
4043
4119
  []
4044
4120
  );
4045
- const pushLocationUpdate = useCallback7(() => {
4121
+ const pushLocationUpdate = useCallback6(() => {
4046
4122
  const currentState = stateRef.current;
4047
4123
  pushLocationUpdateFor(currentState.location, currentState.heading);
4048
4124
  }, [pushLocationUpdateFor]);
4049
- const placeLocation = useCallback7(
4125
+ const placeLocation = useCallback6(
4050
4126
  (coords) => {
4051
4127
  setLocation(coords);
4052
4128
  setIsPlacingLocation(false);
@@ -4496,7 +4572,7 @@ var BridgeMocker = ({
4496
4572
  };
4497
4573
 
4498
4574
  // src/components/DebugConsole.tsx
4499
- import { useCallback as useCallback8, useEffect as useEffect9, useRef as useRef9, useState as useState10 } from "react";
4575
+ import { useCallback as useCallback7, useEffect as useEffect9, useRef as useRef8, useState as useState10 } from "react";
4500
4576
  import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
4501
4577
  var DebugConsole = ({
4502
4578
  isOpen: initialOpen = false,
@@ -4504,12 +4580,12 @@ var DebugConsole = ({
4504
4580
  }) => {
4505
4581
  const [showConsole, setShowConsole] = useState10(initialOpen);
4506
4582
  const [logs, setLogs] = useState10([]);
4507
- const scrollRef = useRef9(null);
4583
+ const scrollRef = useRef8(null);
4508
4584
  useEffect9(() => {
4509
4585
  setShowConsole(initialOpen);
4510
4586
  }, [initialOpen]);
4511
4587
  const clearLogs = () => setLogs([]);
4512
- const addLog = useCallback8((label, data) => {
4588
+ const addLog = useCallback7((label, data) => {
4513
4589
  if (label.includes("LOCATION_STREAM_UPDATE" /* LOCATION_STREAM_UPDATE */)) return;
4514
4590
  const entry = {
4515
4591
  content: typeof data === "string" ? data : JSON.stringify(data, null, 2),
@@ -4637,7 +4713,7 @@ var DebugConsole = ({
4637
4713
  };
4638
4714
 
4639
4715
  // src/components/PullToRefresh.tsx
4640
- import { useEffect as useEffect10, useRef as useRef10, useState as useState11 } from "react";
4716
+ import { useEffect as useEffect10, useRef as useRef9, useState as useState11 } from "react";
4641
4717
  import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
4642
4718
  var DEFAULT_PULL_THRESHOLD = 64;
4643
4719
  var DEFAULT_MAX_PULL = 96;
@@ -4645,7 +4721,10 @@ var RESISTANCE = 0.5;
4645
4721
  var DRAG_DEADZONE = 8;
4646
4722
  var FLING_FRICTION = 0.95;
4647
4723
  var FLING_MIN_VELOCITY = 0.02;
4648
- function DefaultIndicator({ progress, isRefreshing }) {
4724
+ function DefaultIndicator({
4725
+ progress,
4726
+ isRefreshing
4727
+ }) {
4649
4728
  return /* @__PURE__ */ jsxs14(
4650
4729
  "div",
4651
4730
  {
@@ -4701,25 +4780,25 @@ var PullToRefresh = ({
4701
4780
  maxPull = DEFAULT_MAX_PULL,
4702
4781
  renderIndicator
4703
4782
  }) => {
4704
- const containerRef = useRef10(null);
4705
- const startYRef = useRef10(null);
4706
- const lastYRef = useRef10(0);
4707
- const lastMoveTimeRef = useRef10(0);
4708
- const velocityRef = useRef10(0);
4709
- const pointerIdRef = useRef10(null);
4710
- const isPullingRef = useRef10(false);
4711
- const pullDistanceRef = useRef10(0);
4712
- const flingRafRef = useRef10(null);
4783
+ const containerRef = useRef9(null);
4784
+ const startYRef = useRef9(null);
4785
+ const lastYRef = useRef9(0);
4786
+ const lastMoveTimeRef = useRef9(0);
4787
+ const velocityRef = useRef9(0);
4788
+ const pointerIdRef = useRef9(null);
4789
+ const isPullingRef = useRef9(false);
4790
+ const pullDistanceRef = useRef9(0);
4791
+ const flingRafRef = useRef9(null);
4713
4792
  const [pullDistance, setPullDistance] = useState11(0);
4714
4793
  const [isRefreshing, setIsRefreshing] = useState11(false);
4715
4794
  const [isTracking, setIsTracking] = useState11(false);
4716
- const disabledRef = useRef10(disabled);
4795
+ const disabledRef = useRef9(disabled);
4717
4796
  disabledRef.current = disabled;
4718
- const onRefreshRef = useRef10(onRefresh);
4797
+ const onRefreshRef = useRef9(onRefresh);
4719
4798
  onRefreshRef.current = onRefresh;
4720
- const pullThresholdRef = useRef10(pullThreshold);
4799
+ const pullThresholdRef = useRef9(pullThreshold);
4721
4800
  pullThresholdRef.current = pullThreshold;
4722
- const maxPullRef = useRef10(maxPull);
4801
+ const maxPullRef = useRef9(maxPull);
4723
4802
  maxPullRef.current = maxPull;
4724
4803
  useEffect10(() => {
4725
4804
  const el = containerRef.current;
@@ -4888,14 +4967,14 @@ var PullToRefresh = ({
4888
4967
 
4889
4968
  // src/components/QRScanner.tsx
4890
4969
  import jsQR2 from "jsqr";
4891
- import { useEffect as useEffect11, useRef as useRef11, useState as useState12 } from "react";
4970
+ import { useEffect as useEffect11, useRef as useRef10, useState as useState12 } from "react";
4892
4971
  import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
4893
4972
  function QRScanner({ onScan, onError, className = "" }) {
4894
- const videoRef = useRef11(null);
4895
- const canvasRef = useRef11(null);
4896
- const streamRef = useRef11(null);
4897
- const tickRequestRef = useRef11(null);
4898
- const hasScannedRef = useRef11(false);
4973
+ const videoRef = useRef10(null);
4974
+ const canvasRef = useRef10(null);
4975
+ const streamRef = useRef10(null);
4976
+ const tickRequestRef = useRef10(null);
4977
+ const hasScannedRef = useRef10(false);
4899
4978
  const [isReady, setIsReady] = useState12(false);
4900
4979
  useEffect11(() => {
4901
4980
  let cancelled = false;
@@ -5047,7 +5126,7 @@ var SDKProvider = ({
5047
5126
  import {
5048
5127
  useEffect as useEffect12,
5049
5128
  useLayoutEffect,
5050
- useRef as useRef12,
5129
+ useRef as useRef11,
5051
5130
  useState as useState13
5052
5131
  } from "react";
5053
5132
  import { jsx as jsx21 } from "react/jsx-runtime";
@@ -5077,20 +5156,20 @@ var SwipeCarousel = ({
5077
5156
  overscan = DEFAULT_OVERSCAN,
5078
5157
  visibleOverscan = DEFAULT_VISIBLE_OVERSCAN
5079
5158
  }) => {
5080
- const containerRef = useRef12(null);
5159
+ const containerRef = useRef11(null);
5081
5160
  const [containerWidth, setContainerWidth] = useState13(0);
5082
5161
  const [dragX, setDragX] = useState13(0);
5083
5162
  const [dragY, setDragY] = useState13(0);
5084
5163
  const [isDraggingX, setIsDraggingX] = useState13(false);
5085
5164
  const [isDraggingY, setIsDraggingY] = useState13(false);
5086
- const touchStateRef = useRef12(null);
5165
+ const touchStateRef = useRef11(null);
5087
5166
  const [internalIndex, setInternalIndex] = useState13(
5088
5167
  () => Math.max(
5089
5168
  0,
5090
5169
  items.findIndex((item) => item.id === activeId)
5091
5170
  )
5092
5171
  );
5093
- const prevActiveIdRef = useRef12(activeId);
5172
+ const prevActiveIdRef = useRef11(activeId);
5094
5173
  const [timingWaiting, setTimingWaiting] = useState13(true);
5095
5174
  useEffect12(() => {
5096
5175
  const timer = setTimeout(() => {