@yarrow-uz/rn-map-sdk 0.5.0 → 0.6.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.
- package/CHANGELOG.md +50 -0
- package/README.md +48 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{surface-CvmTHryW.d.ts → surface-DIyAsyCh.d.ts} +134 -7
- package/dist/{surface-BY-U7jnq.js → surface-DMNyWc2D.js} +390 -66
- package/dist/surface.d.ts +2 -2
- package/dist/surface.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @yarrow-uz/rn-map-sdk
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dcb109b: Coded API errors end to end, plus the diagnostics to act on them:
|
|
8
|
+
|
|
9
|
+
- **`YarrowApiError`** (new export): every network client — routing, search, the
|
|
10
|
+
icon registry, place details and the style-URL builder — now throws a coded
|
|
11
|
+
error instead of a plain `Error`. Branch on `error.code`
|
|
12
|
+
(`'unauthorized' | 'payment-required' | 'forbidden' | 'rate-limited' |
|
|
13
|
+
'not-found' | 'network' | 'invalid-response' | 'unknown'`); `status` and
|
|
14
|
+
`url` carry the HTTP status and request URL when one exists. The codes
|
|
15
|
+
follow the 2026-11 gateway contract: `402` is quota exhausted with overage
|
|
16
|
+
enabled but no billable balance, `403` is a missing subscription. Historic
|
|
17
|
+
`"Request failed: …"` messages are preserved verbatim, so message-based
|
|
18
|
+
handling keeps working. Client-side aborts are not wrapped — cancellation
|
|
19
|
+
still surfaces as a plain `AbortError`.
|
|
20
|
+
- **Missing-key clarity**: building a request with no configured API key now
|
|
21
|
+
throws a coded `unauthorized` error telling you to pass
|
|
22
|
+
`<YarrowMapView apiKey>` or call `setYarrowApiKey()` — previously the key was
|
|
23
|
+
silently omitted and the request failed opaquely on the server. `YarrowMapView`
|
|
24
|
+
and `YarrowOfflineManager` always seed the key, so normal map usage is
|
|
25
|
+
unaffected; only truly standalone clients without a key change behavior (they
|
|
26
|
+
were broken anyway).
|
|
27
|
+
- **Routing timeout**: `useYarrowRouting` aborts requests after 30 s by default
|
|
28
|
+
(previously `isLoading` could hang forever on a stalled network with no
|
|
29
|
+
caller signal) and rejects with a `network` error mentioning the timeout. The
|
|
30
|
+
new `timeoutMs` option tunes or disables it (`0` disables). Implemented with
|
|
31
|
+
a manual controller + timer — no `AbortSignal.any`/`AbortSignal.timeout`, so
|
|
32
|
+
it is safe on the full supported Hermes/RN range; caller `signal`
|
|
33
|
+
cancellation still applies immediately.
|
|
34
|
+
- **`onIconsError` prop** on `<YarrowMapView>`: fires with the failure when the
|
|
35
|
+
icon-registry fetch fails (still warns to the console; default without the
|
|
36
|
+
prop is unchanged warn-only). POI place-detail failures now warn with status
|
|
37
|
+
- URL in dev builds (`__DEV__`) instead of silently returning `null`.
|
|
38
|
+
- **Offline force-settle**: `downloadRegion({ force: true })` (and
|
|
39
|
+
`handle.delete()`) now settles every outstanding handle for the deleted
|
|
40
|
+
region — their `done` rejects with a `not-found` offline error explaining the
|
|
41
|
+
replacement — instead of hanging forever. Reattached listeners are released
|
|
42
|
+
with the pack.
|
|
43
|
+
- **Camera hardening**: `useYarrowCamera.fitBounds` no-ops with a dev warning on
|
|
44
|
+
empty/degenerate FeatureCollections instead of flying the camera to core's
|
|
45
|
+
inverted-world sentinel box.
|
|
46
|
+
|
|
47
|
+
README gains an "Errors" section documenting the codes and the timeout option.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- 7251837: Fix routing against the updated Yarrow routing API (2026-11 contract): `profile` values are now mapped onto the API's wire enum — `driving` → `CAR`, `walking` → `FOOT`, `cycling` → `BICYCLE` (the API removed its old `DRIVING`-style values, so every route request failed validation with a 422). The wire values themselves are accepted case-insensitively, unknown values still pass through uppercased, and the public `profile` input/format is unchanged. The API's new no-route contract ("no route could be built" is now a 400 instead of a 200 with `success: false`) still resolves to an empty result, as documented. Non-OK responses now also surface the API error envelope's message when HTTP/2 leaves `statusText` empty (e.g. `Request failed: 422 Request validation failed` instead of a bare `Request failed: 422`).
|
|
52
|
+
|
|
3
53
|
## 0.5.0
|
|
4
54
|
|
|
5
55
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@ restored), `compass` (`true`),
|
|
|
89
89
|
`brandBadgePosition` (`bottom-left`), `brandBadgeScale` (`1` — exact web
|
|
90
90
|
sizing; pass e.g. `1.4` for a bigger mark), `androidView` (MapLibre's
|
|
91
91
|
default, `surface`), `dauTracking` (`true`), `onReady`, `onLoadError`,
|
|
92
|
+
`onIconsError` (icon-registry fetch failure — a coded `YarrowApiError`),
|
|
92
93
|
`onPress`, `cameraRef`, `style` and `children` are optional.
|
|
93
94
|
|
|
94
95
|
The component ref is the MapLibre `MapRef` (`getCenter`, `getBounds`,
|
|
@@ -114,7 +115,7 @@ import { YarrowMapView, RouteLayer, useYarrowRouting } from '@yarrow-uz/rn-map-s
|
|
|
114
115
|
|
|
115
116
|
function Directions({ origin, destination }) {
|
|
116
117
|
const { routes, isLoading, error, buildRoute, clearRoutes } = useYarrowRouting({
|
|
117
|
-
profile: 'driving',
|
|
118
|
+
profile: 'driving', // mapped to the API's CAR; also accepted: walking→FOOT, cycling→BICYCLE
|
|
118
119
|
language: 'uz',
|
|
119
120
|
});
|
|
120
121
|
|
|
@@ -131,7 +132,9 @@ function Directions({ origin, destination }) {
|
|
|
131
132
|
|
|
132
133
|
`buildRoute({ coordinates })` resolves to `{ features, directions, meta }`
|
|
133
134
|
("no route found" resolves to an empty result instead of rejecting; network
|
|
134
|
-
failures reject and set `error`).
|
|
135
|
+
failures reject with a coded `YarrowApiError` and set `error`). Requests
|
|
136
|
+
abort after 30 s by default — see [Errors](#errors) for the `timeoutMs`
|
|
137
|
+
option.
|
|
135
138
|
|
|
136
139
|
`<RouteLayer>` renders best-route-plus-alternatives (web `buildRoute()`
|
|
137
140
|
styling). Pass `distinct` to render independent series in their own palette
|
|
@@ -423,6 +426,49 @@ offline.invalidateAmbientCache(); // recommended refresh
|
|
|
423
426
|
destructive — MapLibre's JS layer only re-reads the database on app restart,
|
|
424
427
|
so prefer per-region `invalidate()`/`delete()`.
|
|
425
428
|
|
|
429
|
+
## Errors
|
|
430
|
+
|
|
431
|
+
All SDK network failures (routing, search, icon registry) throw a coded
|
|
432
|
+
`YarrowApiError` — catch it and branch on `error.code` instead of parsing
|
|
433
|
+
messages. Place-detail lookups (`PoiHighlightLayer`) never throw: they roll
|
|
434
|
+
the highlight back and warn in dev builds.
|
|
435
|
+
|
|
436
|
+
```tsx
|
|
437
|
+
import { YarrowApiError, useYarrowRouting } from '@yarrow-uz/rn-map-sdk';
|
|
438
|
+
|
|
439
|
+
try {
|
|
440
|
+
await buildRoute({ coordinates: [[69.24, 41.29], [69.25, 41.3]] });
|
|
441
|
+
} catch (error) {
|
|
442
|
+
if (error instanceof YarrowApiError && error.code === 'unauthorized') {
|
|
443
|
+
// No key configured, or the server rejected it — `error.status` carries
|
|
444
|
+
// the HTTP status when one arrived (a missing-key error has none).
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
| Code | Meaning |
|
|
450
|
+
| --- | --- |
|
|
451
|
+
| `unauthorized` | No API key configured, or the server rejected it (HTTP 401). Configure the key via `<YarrowMapView apiKey>` or `setYarrowApiKey()`. |
|
|
452
|
+
| `payment-required` | HTTP 402 — the quota is used up, overage is enabled, but the billing balance (or overage cap) could not cover the request. |
|
|
453
|
+
| `forbidden` | HTTP 403 — e.g. no active subscription for a metered service. |
|
|
454
|
+
| `rate-limited` | HTTP 429 — the quota for this period is used up and overage is off. |
|
|
455
|
+
| `not-found` | HTTP 404. |
|
|
456
|
+
| `network` | The request never produced a response — connection failure or a `buildRoute` timeout. |
|
|
457
|
+
| `invalid-response` | The Yarrow backend replied with an unexpected payload. |
|
|
458
|
+
| `unknown` | Any other HTTP status. |
|
|
459
|
+
|
|
460
|
+
Errors also carry `status` (HTTP status, when one arrived) and `url` (for
|
|
461
|
+
debugging). Client-side aborts are not wrapped — caller cancellation still
|
|
462
|
+
surfaces as a plain `AbortError`. Offline regions keep their own coded
|
|
463
|
+
`YarrowOfflineError` (see below). Deleting a region — including `force: true`
|
|
464
|
+
re-downloads — rejects any outstanding `region.done` with a `not-found`
|
|
465
|
+
offline error instead of hanging forever.
|
|
466
|
+
|
|
467
|
+
`useYarrowRouting` aborts requests after **30 s** by default and rejects with
|
|
468
|
+
a `network` error mentioning the timeout. Tune or disable it with the
|
|
469
|
+
`timeoutMs` option (`timeoutMs: 0` disables); caller `signal` cancellation
|
|
470
|
+
still applies immediately.
|
|
471
|
+
|
|
426
472
|
## Web-parity gaps
|
|
427
473
|
|
|
428
474
|
The RN SDK mirrors the web SDK's interactive surface — search, routing, POI
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as YarrowMapViewProps, $t as RouteDirection, A as useYarrowOfflineRegions, At as ClusteringConfig, B as OfflineRegionHandle, Bt as BoundingBox, C as PlaceLocation, Cn as
|
|
2
|
-
export { AVG_TILE_BYTES, type AsyncStorageLike, type BoundingBox, type BrandBadgePosition, type BuildRouteInput, CACHED_AT_HEADER, CACHE_PROTOCOL, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type ClickLayerTarget, ClusterBadge, type ClusterBadgeProps, type ClusterChild, type ClusterClickHandler, type ClusterPoint, type ClusteringConfig, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, type FetchRoutesInput, type FetchRoutesResult, type FitBoundsOptions, HighlightMarkerView, type HighlightMarkerViewProps, type HighlightPoiData, ICONS_ENDPOINT, ICON_CACHE_NAME, type LayerPressInfo, MILLISECONDS_PER_DAY, type MapRef, type NormalizedCacheConfig, type NormalizedClusteringConfig, OFFLINE_METADATA_VERSION, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, POI_BASE_LAYER, type PixelCluster, type PlaceLocation, PoiHighlightLayer, type PoiHighlightLayerProps, type PoiHighlightPressInfo, ROUTE_API_URL, type ResolvedPoiData, type RouteDirection, type RouteDirectionModifier, type RouteFeature, RouteLayer, type RouteLayerProps, type RoutesMeta, type SearchResult, SearchResultsLayer, type SearchResultsLayerProps, TILE_CACHE_NAME, type TokenStorage, USER_TOKEN_STORAGE_KEY, type UseYarrowLayerPressOptions, type UseYarrowMapSearchOptions, type UseYarrowMapSearchResult, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowPoiHighlightResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, type YarrowCamera, type YarrowIconsMap, YarrowImages, type YarrowImagesProps, YarrowMapConfig, type YarrowMapConfigOptions, YarrowMapContext, type YarrowMapPress, type YarrowMapRuntime, YarrowMapView, type YarrowMapViewProps, YarrowMarker, type YarrowMarkerProps, type YarrowOfflineError, YarrowOfflineManager, type YarrowOfflineManagerOptions, type YarrowPoiHighlight, type YarrowRegionState, type YarrowStyleType, type ZoomToOptions, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
|
1
|
+
import { $ as YarrowMapViewProps, $t as RouteDirection, A as useYarrowOfflineRegions, At as ClusteringConfig, B as OfflineRegionHandle, Bt as BoundingBox, C as PlaceLocation, Cn as setTokenStorage, Ct as LayerPressInfo, D as YarrowOfflineManagerOptions, Dt as ClusterChild, E as YarrowOfflineManager, Et as useYarrowLayerPress, F as OFFLINE_METADATA_VERSION, Ft as PixelCluster, G as YarrowCamera, Gt as DEFAULT_CACHE_LIFESPAN_DAYS, H as OfflineRegionSummary, Ht as CACHE_PROTOCOL, I as OfflineBounds, It as groupByPixelRadius, J as YarrowMarker, Jt as ICONS_ENDPOINT, K as ZoomToOptions, Kt as FetchRoutesInput, L as OfflineRegionDownloadOptions, Lt as normalizeClusteringConfig, M as estimateRegion, Mt as DEFAULT_CLUSTER_MIN_POINTS, N as DEFAULT_OFFLINE_MAX_ZOOM, Nt as DEFAULT_CLUSTER_RADIUS_PX, O as UseYarrowOfflineRegionsOptions, Ot as ClusterClickHandler, P as DEFAULT_OFFLINE_MIN_ZOOM, Pt as NormalizedClusteringConfig, Q as YarrowMapView, Qt as ROUTE_API_URL, R as OfflineRegionErrorCode, Rt as ClusterBadge, S as HighlightPoiData, Sn as normalizeStyleType, St as ClickLayerTarget, T as ResolvedPoiData, Tn as transformRouteCoordinates, Tt as YARROW_CLICK_LAYER_IDS, U as YarrowOfflineError, Ut as CacheConfig, V as OfflineRegionProgress, Vt as CACHED_AT_HEADER, W as FitBoundsOptions, Wt as CachedArrayBufferResponse, X as HighlightMarkerView, Xt as MILLISECONDS_PER_DAY, Y as YarrowMarkerProps, Yt as ICON_CACHE_NAME, Z as HighlightMarkerViewProps, Zt as NormalizedCacheConfig, _ as YarrowMapRuntime, _n as getBoundingBox, _t as UseYarrowMapSearchResult, a as trackDau, an as TokenStorage, at as BrandBadgePosition, b as PoiHighlightLayer, bn as hasCacheStorage, bt as UseYarrowSearchResult, c as UseYarrowPoiHighlightResult, cn as YARROW_SEARCH_API_URL, ct as YarrowImagesProps, d as POI_BASE_LAYER, dn as YarrowStyleType, dt as resolveCategoryIcon, en as RouteDirectionModifier, et as buildStyleUrl, f as fetchPlaceLocation, fn as addApiKeyToUrl, ft as BuildRouteInput, g as YarrowMapPress, gn as fetchSearchResults, gt as UseYarrowMapSearchOptions, h as YarrowMapContext, hn as fetchRoutes, ht as useYarrowRouting, i as setAsyncStorageTokenStorage, in as TILE_CACHE_NAME, it as YarrowMapConfigOptions, j as AVG_TILE_BYTES, jt as DEFAULT_CLUSTER_MAX_ZOOM, k as UseYarrowOfflineRegionsResult, kt as ClusterPoint, l as YarrowPoiHighlight, ln as YarrowApiError, lt as YarrowIconsMap, m as resolvePoiData, mn as fetchArrayBufferWithCache, mt as UseYarrowRoutingResult, n as MapRef, nn as RoutesMeta, nt as RouteLayerProps, o as SearchResultsLayer, on as USER_TOKEN_STORAGE_KEY, ot as DEFAULT_BRAND_BADGE_SCALE, p as lookupPoiInViewport, pn as buildStyleEndpoint, pt as UseYarrowRoutingOptions, q as useYarrowCamera, qt as FetchRoutesResult, r as AsyncStorageLike, rn as SearchResult, rt as YarrowMapConfig, s as SearchResultsLayerProps, sn as YARROW_MAP_URL, st as YarrowImages, t as CameraRef, tn as RouteFeature, tt as RouteLayer, u as useYarrowPoiHighlight, un as YarrowApiErrorCode, ut as fetchYarrowIcons, v as YarrowRegionState, vn as getOrCreateUserToken, vt as useYarrowMapSearch, w as PoiHighlightPressInfo, wn as setYarrowApiKey, wt as UseYarrowLayerPressOptions, x as PoiHighlightLayerProps, xn as haversineDistance, xt as useYarrowSearch, y as useYarrowMapRuntime, yn as getYarrowApiKey, yt as UseYarrowSearchOptions, z as OfflineRegionEstimate, zt as ClusterBadgeProps } from "./surface-DIyAsyCh.js";
|
|
2
|
+
export { AVG_TILE_BYTES, type AsyncStorageLike, type BoundingBox, type BrandBadgePosition, type BuildRouteInput, CACHED_AT_HEADER, CACHE_PROTOCOL, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type ClickLayerTarget, ClusterBadge, type ClusterBadgeProps, type ClusterChild, type ClusterClickHandler, type ClusterPoint, type ClusteringConfig, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, type FetchRoutesInput, type FetchRoutesResult, type FitBoundsOptions, HighlightMarkerView, type HighlightMarkerViewProps, type HighlightPoiData, ICONS_ENDPOINT, ICON_CACHE_NAME, type LayerPressInfo, MILLISECONDS_PER_DAY, type MapRef, type NormalizedCacheConfig, type NormalizedClusteringConfig, OFFLINE_METADATA_VERSION, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, POI_BASE_LAYER, type PixelCluster, type PlaceLocation, PoiHighlightLayer, type PoiHighlightLayerProps, type PoiHighlightPressInfo, ROUTE_API_URL, type ResolvedPoiData, type RouteDirection, type RouteDirectionModifier, type RouteFeature, RouteLayer, type RouteLayerProps, type RoutesMeta, type SearchResult, SearchResultsLayer, type SearchResultsLayerProps, TILE_CACHE_NAME, type TokenStorage, USER_TOKEN_STORAGE_KEY, type UseYarrowLayerPressOptions, type UseYarrowMapSearchOptions, type UseYarrowMapSearchResult, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowPoiHighlightResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowApiError, type YarrowApiErrorCode, type YarrowCamera, type YarrowIconsMap, YarrowImages, type YarrowImagesProps, YarrowMapConfig, type YarrowMapConfigOptions, YarrowMapContext, type YarrowMapPress, type YarrowMapRuntime, YarrowMapView, type YarrowMapViewProps, YarrowMarker, type YarrowMarkerProps, type YarrowOfflineError, YarrowOfflineManager, type YarrowOfflineManagerOptions, type YarrowPoiHighlight, type YarrowRegionState, type YarrowStyleType, type ZoomToOptions, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "./preflight.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as addApiKeyToUrl, A as fetchPlaceLocation, B as ClusterBadge, C as useYarrowMapSearch, D as YarrowMapContext, E as useYarrowLayerPress, F as DEFAULT_CLUSTER_MAX_ZOOM, G as ICON_CACHE_NAME, H as CACHE_PROTOCOL, I as DEFAULT_CLUSTER_MIN_POINTS, J as TILE_CACHE_NAME, K as MILLISECONDS_PER_DAY, L as DEFAULT_CLUSTER_RADIUS_PX, M as resolvePoiData, N as fetchYarrowIcons, O as useYarrowMapRuntime, P as resolveCategoryIcon, Q as YarrowApiError, R as groupByPixelRadius, S as useYarrowRouting, T as YARROW_CLICK_LAYER_IDS, U as DEFAULT_CACHE_LIFESPAN_DAYS, V as CACHED_AT_HEADER, W as ICONS_ENDPOINT, X as YARROW_MAP_URL, Y as USER_TOKEN_STORAGE_KEY, Z as YARROW_SEARCH_API_URL, _ as buildStyleUrl, a as PoiHighlightLayer, at as getOrCreateUserToken, b as DEFAULT_BRAND_BADGE_SCALE, c as DEFAULT_OFFLINE_MAX_ZOOM, ct as haversineDistance, d as AVG_TILE_BYTES, dt as setYarrowApiKey, et as buildStyleEndpoint, f as estimateRegion, ft as transformRouteCoordinates, g as YarrowMapView, h as HighlightMarkerView, i as useYarrowPoiHighlight, it as getBoundingBox, j as lookupPoiInViewport, k as POI_BASE_LAYER, l as DEFAULT_OFFLINE_MIN_ZOOM, lt as normalizeStyleType, m as YarrowMarker, n as trackDau, nt as fetchRoutes, o as useYarrowOfflineRegions, ot as getYarrowApiKey, p as useYarrowCamera, q as ROUTE_API_URL, r as SearchResultsLayer, rt as fetchSearchResults, s as YarrowOfflineManager, st as hasCacheStorage, t as setAsyncStorageTokenStorage, tt as fetchArrayBufferWithCache, u as OFFLINE_METADATA_VERSION, ut as setTokenStorage, v as RouteLayer, w as useYarrowSearch, x as YarrowImages, y as YarrowMapConfig, z as normalizeClusteringConfig } from "./surface-DMNyWc2D.js";
|
|
3
3
|
|
|
4
|
-
export { AVG_TILE_BYTES, CACHED_AT_HEADER, CACHE_PROTOCOL, ClusterBadge, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, HighlightMarkerView, ICONS_ENDPOINT, ICON_CACHE_NAME, MILLISECONDS_PER_DAY, OFFLINE_METADATA_VERSION, POI_BASE_LAYER, PoiHighlightLayer, ROUTE_API_URL, RouteLayer, SearchResultsLayer, TILE_CACHE_NAME, USER_TOKEN_STORAGE_KEY, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowImages, YarrowMapConfig, YarrowMapContext, YarrowMapView, YarrowMarker, YarrowOfflineManager, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
|
4
|
+
export { AVG_TILE_BYTES, CACHED_AT_HEADER, CACHE_PROTOCOL, ClusterBadge, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, HighlightMarkerView, ICONS_ENDPOINT, ICON_CACHE_NAME, MILLISECONDS_PER_DAY, OFFLINE_METADATA_VERSION, POI_BASE_LAYER, PoiHighlightLayer, ROUTE_API_URL, RouteLayer, SearchResultsLayer, TILE_CACHE_NAME, USER_TOKEN_STORAGE_KEY, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowApiError, YarrowImages, YarrowMapConfig, YarrowMapContext, YarrowMapView, YarrowMarker, YarrowOfflineManager, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
|
@@ -6,10 +6,65 @@ declare const YARROW_SEARCH_API_URL: string;
|
|
|
6
6
|
declare function setYarrowApiKey(apiKey: string): void;
|
|
7
7
|
declare function getYarrowApiKey(): string;
|
|
8
8
|
/**
|
|
9
|
-
* Appends the configured API key as the `api_key` query parameter.
|
|
10
|
-
* url unchanged when no key is configured yet or the url
|
|
9
|
+
* Appends the configured API key as the `api_key` query parameter. Deliberately
|
|
10
|
+
* lenient: returns the url unchanged when no key is configured yet or the url
|
|
11
|
+
* cannot be parsed — this is a public utility, and the SDK's own clients
|
|
12
|
+
* (`fetchRoutes`, `fetchSearchResults`, `fetchYarrowIcons`, …) enforce the key
|
|
13
|
+
* at entry via `getYarrowApiKey()` (a coded `unauthorized` error) instead of
|
|
14
|
+
* letting keyless requests hit the server and fail opaquely.
|
|
11
15
|
*/
|
|
12
16
|
declare function addApiKeyToUrl(url: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Machine-readable failure codes carried by {@link YarrowApiError}. Consumers
|
|
19
|
+
* branch on `error.code` instead of parsing messages:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* try {
|
|
23
|
+
* await fetchRoutes({ … });
|
|
24
|
+
* } catch (error) {
|
|
25
|
+
* if (error instanceof YarrowApiError && error.code === 'unauthorized') { … }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
type YarrowApiErrorCode =
|
|
30
|
+
/** Missing API key, or the server rejected it (HTTP 401). */
|
|
31
|
+
'unauthorized' |
|
|
32
|
+
/** HTTP 402 — quota exhausted with overage enabled, but the billing
|
|
33
|
+
* balance (or the overage spending cap) could not cover the request. */
|
|
34
|
+
'payment-required' |
|
|
35
|
+
/** HTTP 403 — e.g. no active subscription for a metered service. */
|
|
36
|
+
'forbidden' |
|
|
37
|
+
/** HTTP 429 — too many requests. */
|
|
38
|
+
'rate-limited' |
|
|
39
|
+
/** HTTP 404 — endpoint or resource does not exist. */
|
|
40
|
+
'not-found' |
|
|
41
|
+
/** The request never produced a response: DNS/socket failure, or timeout. */
|
|
42
|
+
'network' |
|
|
43
|
+
/** A response arrived but its shape was not what the SDK expects. */
|
|
44
|
+
'invalid-response' |
|
|
45
|
+
/** Any HTTP status without a dedicated code above. */
|
|
46
|
+
'unknown';
|
|
47
|
+
/**
|
|
48
|
+
* Coded error thrown by the Yarrow API clients (routing, search, icon
|
|
49
|
+
* registry, tile cache) in both platform SDKs.
|
|
50
|
+
*
|
|
51
|
+
* Recognizable legacy messages are kept verbatim as the error `message`
|
|
52
|
+
* (`"Request failed: 500 Server Error"`), while `code`/`status`/`url` carry
|
|
53
|
+
* the structured detail. Client-side aborts are NOT wrapped — callers keep
|
|
54
|
+
* receiving the original `AbortError` so cancellation stays distinguishable.
|
|
55
|
+
*/
|
|
56
|
+
declare class YarrowApiError extends Error {
|
|
57
|
+
code: YarrowApiErrorCode;
|
|
58
|
+
/** HTTP status code, when the error originated from a response. */
|
|
59
|
+
status?: number;
|
|
60
|
+
/** Request URL, for debugging. */
|
|
61
|
+
url?: string;
|
|
62
|
+
constructor(code: YarrowApiErrorCode, message: string, options?: {
|
|
63
|
+
status?: number;
|
|
64
|
+
url?: string;
|
|
65
|
+
cause?: unknown;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
13
68
|
type CacheConfig = {
|
|
14
69
|
enabled?: boolean;
|
|
15
70
|
lifespanDays?: number;
|
|
@@ -120,7 +175,13 @@ type RouteDirection = {
|
|
|
120
175
|
[key: string]: unknown;
|
|
121
176
|
};
|
|
122
177
|
/** Platform-agnostic input for `fetchRoutes()` — the network half of
|
|
123
|
-
* `buildRoute()`. Rendering/callback options stay in the platform SDKs.
|
|
178
|
+
* `buildRoute()`. Rendering/callback options stay in the platform SDKs.
|
|
179
|
+
*
|
|
180
|
+
* `profile` accepts the routing API's wire values (`'CAR' | 'FOOT' |
|
|
181
|
+
* 'BICYCLE'`, case-insensitive) plus the legacy friendly names
|
|
182
|
+
* (`'driving' | 'walking' | 'cycling'`), which are mapped onto the wire
|
|
183
|
+
* enum — the API removed the old uppercase `DRIVING`-style values in its
|
|
184
|
+
* 2026-11 contract update. */
|
|
124
185
|
type FetchRoutesInput = {
|
|
125
186
|
profile: string;
|
|
126
187
|
coordinates: [number, number][];
|
|
@@ -150,6 +211,16 @@ interface FetchRoutesResult {
|
|
|
150
211
|
* like the web SDK's historic `buildRoute()` behavior.
|
|
151
212
|
*/
|
|
152
213
|
declare function fetchRoutes(input: FetchRoutesInput): Promise<FetchRoutesResult>;
|
|
214
|
+
/**
|
|
215
|
+
* Normalizes routing-API feature coordinates to `[lng, lat]` tuples. The API
|
|
216
|
+
* ships `{lng, lat}` objects; tuple coordinates (already GeoJSON-canonical)
|
|
217
|
+
* pass through as-is. Features whose geometry is not a LineString with
|
|
218
|
+
* well-formed coordinates are skipped instead of crashing on the cast — a
|
|
219
|
+
* single malformed feature must not lose the whole route. Returns the
|
|
220
|
+
* surviving features; a one-line warning fires only when something was
|
|
221
|
+
* actually dropped (core has no `__DEV__`, and this path only triggers on a
|
|
222
|
+
* malformed backend response, so the warn is rare by construction).
|
|
223
|
+
*/
|
|
153
224
|
declare const transformRouteCoordinates: (features: RouteFeature[]) => RouteFeature[];
|
|
154
225
|
declare const haversineDistance: (lat1: number, lon1: number, lat2: number, lon2: number) => number;
|
|
155
226
|
interface FetchSearchResultsInput {
|
|
@@ -405,10 +476,22 @@ type UseYarrowMapSearchResult = UseYarrowSearchResult & {
|
|
|
405
476
|
*/
|
|
406
477
|
declare function useYarrowMapSearch(query: string, options: UseYarrowMapSearchOptions): UseYarrowMapSearchResult;
|
|
407
478
|
type UseYarrowRoutingOptions = {
|
|
408
|
-
/**
|
|
479
|
+
/**
|
|
480
|
+
* Routing profile. Accepts the API's wire values (`'CAR' | 'FOOT' |
|
|
481
|
+
* 'BICYCLE'`, case-insensitive) and the legacy friendly names —
|
|
482
|
+
* `'driving'` maps to `CAR`, `'walking'` to `FOOT`, `'cycling'` to
|
|
483
|
+
* `BICYCLE`. Default `"driving"`.
|
|
484
|
+
*/
|
|
409
485
|
profile?: string;
|
|
410
486
|
/** Language for turn-by-turn directions. */
|
|
411
487
|
language?: string;
|
|
488
|
+
/**
|
|
489
|
+
* Abort a `buildRoute` request after this many milliseconds, rejecting with
|
|
490
|
+
* a `YarrowApiError` (code `'network'`, message mentioning the timeout).
|
|
491
|
+
* Works with or without a caller `signal`; caller cancellation still applies
|
|
492
|
+
* immediately. Pass `0` to disable. Default `30000`.
|
|
493
|
+
*/
|
|
494
|
+
timeoutMs?: number;
|
|
412
495
|
};
|
|
413
496
|
type BuildRouteInput = {
|
|
414
497
|
/** Waypoints as `[longitude, latitude][]` (minimum two). */
|
|
@@ -439,6 +522,10 @@ type UseYarrowRoutingResult = {
|
|
|
439
522
|
* Headless routing state for the Yarrow routing API — pairs with
|
|
440
523
|
* `<RouteLayer>` for rendering.
|
|
441
524
|
*
|
|
525
|
+
* Requests abort after `timeoutMs` (default 30 s) and reject with a coded
|
|
526
|
+
* `YarrowApiError`; caller `signal` cancellation applies immediately, and
|
|
527
|
+
* pass `timeoutMs: 0` to disable the timer.
|
|
528
|
+
*
|
|
442
529
|
* ```tsx
|
|
443
530
|
* const { routes, isLoading, buildRoute } = useYarrowRouting({ profile: 'driving' });
|
|
444
531
|
* <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
|
|
@@ -456,6 +543,9 @@ type YarrowIconsMap = Record<string, string>;
|
|
|
456
543
|
*
|
|
457
544
|
* Also seeds core's API-key module state (like every standalone client), so
|
|
458
545
|
* the key is current even if the hook runs before a map mounts.
|
|
546
|
+
*
|
|
547
|
+
* Throws a coded {@link YarrowApiError}: `unauthorized` when no key is
|
|
548
|
+
* configured (or the server rejects one), `network` when the request fails.
|
|
459
549
|
*/
|
|
460
550
|
declare function fetchYarrowIcons(apiKey?: string): Promise<YarrowIconsMap>;
|
|
461
551
|
/**
|
|
@@ -579,7 +669,9 @@ declare const RouteLayer: import("react").MemoExoticComponent<({ routes, bestInd
|
|
|
579
669
|
* Full style URL for MapLibre React Native's `mapStyle` prop, built from the
|
|
580
670
|
* platform-agnostic style endpoint plus the configured API key. The key comes
|
|
581
671
|
* from core's module state (`setYarrowApiKey`) — `YarrowMapView` calls it for
|
|
582
|
-
* you; standalone callers must set it first
|
|
672
|
+
* you; standalone callers must set it first or this throws a coded
|
|
673
|
+
* `unauthorized` `YarrowApiError` (instead of producing a keyless style URL
|
|
674
|
+
* that fails opaquely on the native side).
|
|
583
675
|
*/
|
|
584
676
|
declare function buildStyleUrl(styleType?: string, theme?: 'light' | 'dark'): string;
|
|
585
677
|
type YarrowMapViewProps = YarrowMapConfigOptions & {
|
|
@@ -637,6 +729,12 @@ type YarrowMapViewProps = YarrowMapConfigOptions & {
|
|
|
637
729
|
* your style/labels don't need the Yarrow icons. Default `true`.
|
|
638
730
|
*/
|
|
639
731
|
icons?: boolean;
|
|
732
|
+
/**
|
|
733
|
+
* Called when the icon-registry fetch fails (coded `YarrowApiError` —
|
|
734
|
+
* `unauthorized` for a rejected key, `network` for connection failures).
|
|
735
|
+
* The SDK still warns to the console in dev; POIs degrade to blue dots.
|
|
736
|
+
*/
|
|
737
|
+
onIconsError?: (error: Error) => void;
|
|
640
738
|
/** Style for the wrapping native view. Default `{ flex: 1 }`. */
|
|
641
739
|
style?: ViewProps['style'];
|
|
642
740
|
/** Sources/layers/markers rendered inside the map. */
|
|
@@ -718,6 +816,12 @@ declare const YarrowMapView: import("react").ForwardRefExoticComponent<YarrowMap
|
|
|
718
816
|
* your style/labels don't need the Yarrow icons. Default `true`.
|
|
719
817
|
*/
|
|
720
818
|
icons?: boolean;
|
|
819
|
+
/**
|
|
820
|
+
* Called when the icon-registry fetch fails (coded `YarrowApiError` —
|
|
821
|
+
* `unauthorized` for a rejected key, `network` for connection failures).
|
|
822
|
+
* The SDK still warns to the console in dev; POIs degrade to blue dots.
|
|
823
|
+
*/
|
|
824
|
+
onIconsError?: (error: Error) => void;
|
|
721
825
|
/** Style for the wrapping native view. Default `{ flex: 1 }`. */
|
|
722
826
|
style?: ViewProps['style'];
|
|
723
827
|
/** Sources/layers/markers rendered inside the map. */
|
|
@@ -786,7 +890,9 @@ type YarrowCamera = {
|
|
|
786
890
|
/**
|
|
787
891
|
* Fits the camera to the bounds of a GeoJSON FeatureCollection. Applies the
|
|
788
892
|
* web SDK's minimum-dimension expansion (0.003°) so single points don't
|
|
789
|
-
* over-zoom. Web's `maxZoom` cap is not supported natively.
|
|
893
|
+
* over-zoom. Web's `maxZoom` cap is not supported natively. Empty or
|
|
894
|
+
* fully-degenerate input is ignored with a dev warning (core's inverted
|
|
895
|
+
* sentinel box would otherwise fling the camera off-world).
|
|
790
896
|
*/
|
|
791
897
|
fitBounds(data: BoundsInput, options?: FitBoundsOptions): void;
|
|
792
898
|
/** Computes the geographic bounding box of a FeatureCollection. */
|
|
@@ -1018,7 +1124,21 @@ declare class YarrowOfflineManager {
|
|
|
1018
1124
|
* and reuses the original `done` instead.
|
|
1019
1125
|
*/
|
|
1020
1126
|
private readonly activeDownloads;
|
|
1127
|
+
/**
|
|
1128
|
+
* Every live `done` settlement channel this session handed out, keyed by
|
|
1129
|
+
* native pack id — including reattached ones (`getRegion`) that are NOT in
|
|
1130
|
+
* `activeDownloads`. Deleting a pack settles (rejects) its channels so no
|
|
1131
|
+
* outstanding `done` hangs after the region disappears.
|
|
1132
|
+
*/
|
|
1133
|
+
private readonly liveChannels;
|
|
1021
1134
|
constructor(options: YarrowOfflineManagerOptions);
|
|
1135
|
+
/**
|
|
1136
|
+
* Creates a `done` promise together with its settlement channel. The
|
|
1137
|
+
* channel registers itself under the pack id (lazily — the id is often
|
|
1138
|
+
* only known after `createPack` resolves, or when the first event arrives)
|
|
1139
|
+
* so a later deletion can reject every outstanding `done` for that pack.
|
|
1140
|
+
*/
|
|
1141
|
+
private createPendingDone;
|
|
1022
1142
|
/**
|
|
1023
1143
|
* Pure tile-math estimate of a region's download/storage cost — no native
|
|
1024
1144
|
* calls. See `estimateRegion` for the math and caveats.
|
|
@@ -1070,6 +1190,13 @@ declare class YarrowOfflineManager {
|
|
|
1070
1190
|
* wakes a paused pack unless the caller explicitly asked for a download. */
|
|
1071
1191
|
private reattachExisting;
|
|
1072
1192
|
private toHandle;
|
|
1193
|
+
/**
|
|
1194
|
+
* Deletes a pack natively and settles every outstanding handle: their
|
|
1195
|
+
* `done` rejects with a `not-found` YarrowOfflineError (a deleted pack
|
|
1196
|
+
* never emits another event, so awaiting `done` would otherwise hang
|
|
1197
|
+
* forever). `forced` marks the force-re-download path for the message.
|
|
1198
|
+
* Native failures leave handles untouched — the pack still exists.
|
|
1199
|
+
*/
|
|
1073
1200
|
private deletePack;
|
|
1074
1201
|
}
|
|
1075
1202
|
/** Coordinates the caller already holds (e.g. from a search result). */
|
|
@@ -1333,4 +1460,4 @@ type AsyncStorageLike = {
|
|
|
1333
1460
|
* ```
|
|
1334
1461
|
*/
|
|
1335
1462
|
declare function setAsyncStorageTokenStorage(storage: AsyncStorageLike): Promise<void>;
|
|
1336
|
-
export { YarrowMapViewProps as $, RouteDirection as $t, useYarrowOfflineRegions as A, ClusteringConfig as At, OfflineRegionHandle as B, BoundingBox as Bt, PlaceLocation as C,
|
|
1463
|
+
export { YarrowMapViewProps as $, RouteDirection as $t, useYarrowOfflineRegions as A, ClusteringConfig as At, OfflineRegionHandle as B, BoundingBox as Bt, PlaceLocation as C, setTokenStorage as Cn, LayerPressInfo as Ct, YarrowOfflineManagerOptions as D, ClusterChild as Dt, YarrowOfflineManager as E, useYarrowLayerPress as Et, OFFLINE_METADATA_VERSION as F, PixelCluster as Ft, YarrowCamera as G, DEFAULT_CACHE_LIFESPAN_DAYS as Gt, OfflineRegionSummary as H, CACHE_PROTOCOL as Ht, OfflineBounds as I, groupByPixelRadius as It, YarrowMarker as J, ICONS_ENDPOINT as Jt, ZoomToOptions as K, FetchRoutesInput as Kt, OfflineRegionDownloadOptions as L, normalizeClusteringConfig as Lt, estimateRegion as M, DEFAULT_CLUSTER_MIN_POINTS as Mt, DEFAULT_OFFLINE_MAX_ZOOM as N, DEFAULT_CLUSTER_RADIUS_PX as Nt, UseYarrowOfflineRegionsOptions as O, ClusterClickHandler as Ot, DEFAULT_OFFLINE_MIN_ZOOM as P, NormalizedClusteringConfig as Pt, YarrowMapView as Q, ROUTE_API_URL as Qt, OfflineRegionErrorCode as R, ClusterBadge as Rt, HighlightPoiData as S, normalizeStyleType as Sn, ClickLayerTarget as St, ResolvedPoiData as T, transformRouteCoordinates as Tn, YARROW_CLICK_LAYER_IDS as Tt, YarrowOfflineError as U, CacheConfig as Ut, OfflineRegionProgress as V, CACHED_AT_HEADER as Vt, FitBoundsOptions as W, CachedArrayBufferResponse as Wt, HighlightMarkerView as X, MILLISECONDS_PER_DAY as Xt, YarrowMarkerProps as Y, ICON_CACHE_NAME as Yt, HighlightMarkerViewProps as Z, NormalizedCacheConfig as Zt, YarrowMapRuntime as _, getBoundingBox as _n, UseYarrowMapSearchResult as _t, trackDau as a, TokenStorage as an, BrandBadgePosition as at, PoiHighlightLayer as b, hasCacheStorage as bn, UseYarrowSearchResult as bt, UseYarrowPoiHighlightResult as c, YARROW_SEARCH_API_URL as cn, YarrowImagesProps as ct, POI_BASE_LAYER as d, YarrowStyleType as dn, resolveCategoryIcon as dt, RouteDirectionModifier as en, buildStyleUrl as et, fetchPlaceLocation as f, addApiKeyToUrl as fn, BuildRouteInput as ft, YarrowMapPress as g, fetchSearchResults as gn, UseYarrowMapSearchOptions as gt, YarrowMapContext as h, fetchRoutes as hn, useYarrowRouting as ht, setAsyncStorageTokenStorage as i, TILE_CACHE_NAME as in, YarrowMapConfigOptions as it, AVG_TILE_BYTES as j, DEFAULT_CLUSTER_MAX_ZOOM as jt, UseYarrowOfflineRegionsResult as k, ClusterPoint as kt, YarrowPoiHighlight as l, YarrowApiError as ln, YarrowIconsMap as lt, resolvePoiData as m, fetchArrayBufferWithCache as mn, UseYarrowRoutingResult as mt, MapRef as n, RoutesMeta as nn, RouteLayerProps as nt, SearchResultsLayer as o, USER_TOKEN_STORAGE_KEY as on, DEFAULT_BRAND_BADGE_SCALE as ot, lookupPoiInViewport as p, buildStyleEndpoint as pn, UseYarrowRoutingOptions as pt, useYarrowCamera as q, FetchRoutesResult as qt, AsyncStorageLike as r, SearchResult as rn, YarrowMapConfig as rt, SearchResultsLayerProps as s, YARROW_MAP_URL as sn, YarrowImages as st, CameraRef as t, RouteFeature as tn, RouteLayer as tt, useYarrowPoiHighlight as u, YarrowApiErrorCode as un, fetchYarrowIcons as ut, YarrowRegionState as v, getOrCreateUserToken as vn, useYarrowMapSearch as vt, PoiHighlightPressInfo as w, setYarrowApiKey as wn, UseYarrowLayerPressOptions as wt, PoiHighlightLayerProps as x, haversineDistance as xn, useYarrowSearch as xt, useYarrowMapRuntime as y, getYarrowApiKey as yn, UseYarrowSearchOptions as yt, OfflineRegionEstimate as z, ClusterBadgeProps as zt };
|
|
@@ -4,6 +4,106 @@ import { createContext, forwardRef, memo, useCallback, useContext, useEffect, us
|
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
// ../core/dist/index.js
|
|
7
|
+
/**
|
|
8
|
+
* Coded error thrown by the Yarrow API clients (routing, search, icon
|
|
9
|
+
* registry, tile cache) in both platform SDKs.
|
|
10
|
+
*
|
|
11
|
+
* Recognizable legacy messages are kept verbatim as the error `message`
|
|
12
|
+
* (`"Request failed: 500 Server Error"`), while `code`/`status`/`url` carry
|
|
13
|
+
* the structured detail. Client-side aborts are NOT wrapped — callers keep
|
|
14
|
+
* receiving the original `AbortError` so cancellation stays distinguishable.
|
|
15
|
+
*/
|
|
16
|
+
var YarrowApiError = class extends Error {
|
|
17
|
+
constructor(code, message, options) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = "YarrowApiError";
|
|
20
|
+
this.code = code;
|
|
21
|
+
if (options?.status !== void 0) this.status = options.status;
|
|
22
|
+
if (options?.url !== void 0) this.url = options.url;
|
|
23
|
+
if (options?.cause !== void 0) this.cause = options.cause;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/** Maps an HTTP status to its {@link YarrowApiErrorCode}. 402/403 follow the
|
|
27
|
+
* gateway's documented semantics on metered endpoints (quota/billing and
|
|
28
|
+
* subscription states, not authentication). */
|
|
29
|
+
const errorCodeFromStatus = (status) => {
|
|
30
|
+
if (status === 401) return "unauthorized";
|
|
31
|
+
if (status === 402) return "payment-required";
|
|
32
|
+
if (status === 403) return "forbidden";
|
|
33
|
+
if (status === 404) return "not-found";
|
|
34
|
+
if (status === 429) return "rate-limited";
|
|
35
|
+
return "unknown";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Reads `error.message` out of the API's error envelope
|
|
39
|
+
* (`{ error: { code, message, request_id }, detail }`), tolerating any shape.
|
|
40
|
+
*/
|
|
41
|
+
const serverErrorMessageFromBody = (body) => {
|
|
42
|
+
if (typeof body !== "object" || body === null) return void 0;
|
|
43
|
+
const { error } = body;
|
|
44
|
+
if (typeof error !== "object" || error === null) return void 0;
|
|
45
|
+
const { message } = error;
|
|
46
|
+
return typeof message === "string" && message.length > 0 ? message : void 0;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Best-effort read of a response body for error-message extraction. Mocked
|
|
50
|
+
* or opaque responses without a usable `json()` resolve to `undefined`,
|
|
51
|
+
* and parse failures are swallowed — this must never mask the real error.
|
|
52
|
+
*/
|
|
53
|
+
const readErrorBody = async (response) => {
|
|
54
|
+
try {
|
|
55
|
+
const json = response.json;
|
|
56
|
+
if (typeof json !== "function") return void 0;
|
|
57
|
+
return await json.call(response);
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Builds the coded error for a non-OK response. The historic
|
|
64
|
+
* `Request failed: <status> <statusText>` message is preserved so existing
|
|
65
|
+
* message-based handling keeps working. HTTP/2 responses carry an empty
|
|
66
|
+
* `statusText`, so the API error envelope's `error.message` (pass the parsed
|
|
67
|
+
* body via `body`) fills in instead — e.g. the routing API's validation
|
|
68
|
+
* errors then read "Request failed: 422 Request validation failed".
|
|
69
|
+
*/
|
|
70
|
+
const apiErrorFromResponse = (response) => {
|
|
71
|
+
const detail = response.statusText || serverErrorMessageFromBody(response.body) || "";
|
|
72
|
+
return new YarrowApiError(errorCodeFromStatus(response.status), `Request failed: ${response.status}${detail ? ` ${detail}` : ""}`, {
|
|
73
|
+
status: response.status,
|
|
74
|
+
url: response.url
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
const isAbortError = (error) => error instanceof Error && error.name === "AbortError";
|
|
78
|
+
/**
|
|
79
|
+
* Wraps a fetch rejection in a `network` {@link YarrowApiError}. Aborts pass
|
|
80
|
+
* through untouched — cancellation must stay recognizable by name. Values
|
|
81
|
+
* that are already coded errors pass through unchanged.
|
|
82
|
+
*/
|
|
83
|
+
const wrapNetworkError = (error, url) => {
|
|
84
|
+
if (isAbortError(error)) return error;
|
|
85
|
+
if (error instanceof YarrowApiError) return error;
|
|
86
|
+
return new YarrowApiError("network", `Network request failed: ${error instanceof Error ? error.message : "Unknown network error"}`, {
|
|
87
|
+
url,
|
|
88
|
+
cause: error
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Builds the `invalid-response` error for a response whose shape the SDK
|
|
93
|
+
* cannot interpret, including a short serialized snippet for debugging.
|
|
94
|
+
*/
|
|
95
|
+
const invalidResponseError = (what, payload, url) => new YarrowApiError("invalid-response", `Unexpected response from the Yarrow API: ${what} — got: ${responseSnippet(payload)}`, { url });
|
|
96
|
+
/** Short, safe JSON preview of a malformed payload for error messages. */
|
|
97
|
+
const responseSnippet = (payload) => {
|
|
98
|
+
const MAX_LENGTH = 200;
|
|
99
|
+
let text;
|
|
100
|
+
try {
|
|
101
|
+
text = typeof payload === "string" ? payload : JSON.stringify(payload) ?? "";
|
|
102
|
+
} catch {
|
|
103
|
+
text = "[unserializable]";
|
|
104
|
+
}
|
|
105
|
+
return text.length > MAX_LENGTH ? `${text.slice(0, MAX_LENGTH)}…` : text || "[empty]";
|
|
106
|
+
};
|
|
7
107
|
const YARROW_MAP_URL = "https://gis.yarrow.uz";
|
|
8
108
|
const YARROW_SEARCH_API_URL = "https://api.yarrow.uz";
|
|
9
109
|
let _apiKey = null;
|
|
@@ -12,12 +112,16 @@ function setYarrowApiKey(apiKey) {
|
|
|
12
112
|
_apiKey = apiKey;
|
|
13
113
|
}
|
|
14
114
|
function getYarrowApiKey() {
|
|
15
|
-
if (!_apiKey) throw new
|
|
115
|
+
if (!_apiKey) throw new YarrowApiError("unauthorized", "Yarrow API key not configured — pass your key to <YarrowMapView apiKey> (web: YarrowMap config, RN: YarrowMapView prop) or call setYarrowApiKey(\"YOUR_API_KEY\") before using the map SDK.");
|
|
16
116
|
return _apiKey;
|
|
17
117
|
}
|
|
18
118
|
/**
|
|
19
|
-
* Appends the configured API key as the `api_key` query parameter.
|
|
20
|
-
* url unchanged when no key is configured yet or the url
|
|
119
|
+
* Appends the configured API key as the `api_key` query parameter. Deliberately
|
|
120
|
+
* lenient: returns the url unchanged when no key is configured yet or the url
|
|
121
|
+
* cannot be parsed — this is a public utility, and the SDK's own clients
|
|
122
|
+
* (`fetchRoutes`, `fetchSearchResults`, `fetchYarrowIcons`, …) enforce the key
|
|
123
|
+
* at entry via `getYarrowApiKey()` (a coded `unauthorized` error) instead of
|
|
124
|
+
* letting keyless requests hit the server and fail opaquely.
|
|
21
125
|
*/
|
|
22
126
|
function addApiKeyToUrl(url) {
|
|
23
127
|
if (!_apiKey) return url;
|
|
@@ -106,14 +210,23 @@ const toCachedArrayBufferResponse = async (response) => {
|
|
|
106
210
|
};
|
|
107
211
|
};
|
|
108
212
|
const fetchFromNetwork = async (url, abortController, requestParameters) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
213
|
+
let response;
|
|
214
|
+
try {
|
|
215
|
+
response = await fetch(url, {
|
|
216
|
+
method: requestParameters?.method ?? "GET",
|
|
217
|
+
headers: requestParameters?.headers,
|
|
218
|
+
body: requestParameters?.body,
|
|
219
|
+
credentials: requestParameters?.credentials,
|
|
220
|
+
signal: abortController.signal
|
|
221
|
+
});
|
|
222
|
+
} catch (error) {
|
|
223
|
+
throw wrapNetworkError(error, url);
|
|
224
|
+
}
|
|
225
|
+
if (!response.ok) throw apiErrorFromResponse({
|
|
226
|
+
status: response.status,
|
|
227
|
+
statusText: response.statusText,
|
|
228
|
+
url
|
|
115
229
|
});
|
|
116
|
-
if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
|
|
117
230
|
return toCachedArrayBufferResponse(response);
|
|
118
231
|
};
|
|
119
232
|
/**
|
|
@@ -188,17 +301,54 @@ const fetchArrayBufferWithCache = async (url, cacheName, lifespanMs, abortContro
|
|
|
188
301
|
await saveToCache(cache, url, networkResponse);
|
|
189
302
|
return networkResponse;
|
|
190
303
|
};
|
|
304
|
+
/**
|
|
305
|
+
* Normalizes routing-API feature coordinates to `[lng, lat]` tuples. The API
|
|
306
|
+
* ships `{lng, lat}` objects; tuple coordinates (already GeoJSON-canonical)
|
|
307
|
+
* pass through as-is. Features whose geometry is not a LineString with
|
|
308
|
+
* well-formed coordinates are skipped instead of crashing on the cast — a
|
|
309
|
+
* single malformed feature must not lose the whole route. Returns the
|
|
310
|
+
* surviving features; a one-line warning fires only when something was
|
|
311
|
+
* actually dropped (core has no `__DEV__`, and this path only triggers on a
|
|
312
|
+
* malformed backend response, so the warn is rare by construction).
|
|
313
|
+
*/
|
|
191
314
|
const transformRouteCoordinates = (features) => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
315
|
+
const transformed = [];
|
|
316
|
+
let skipped = 0;
|
|
317
|
+
for (const feature of features) {
|
|
318
|
+
const coords = feature.geometry?.coordinates;
|
|
319
|
+
if (!Array.isArray(coords) || coords.length === 0) {
|
|
320
|
+
skipped++;
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const normalized = [];
|
|
324
|
+
let malformed = false;
|
|
325
|
+
for (const coord of coords) {
|
|
326
|
+
if (Array.isArray(coord) && typeof coord[0] === "number" && typeof coord[1] === "number") {
|
|
327
|
+
normalized.push([coord[0], coord[1]]);
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
const lng = coord?.lng;
|
|
331
|
+
const lat = coord?.lat;
|
|
332
|
+
if (typeof lng !== "number" || typeof lat !== "number") {
|
|
333
|
+
malformed = true;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
normalized.push([lng, lat]);
|
|
337
|
+
}
|
|
338
|
+
if (malformed) {
|
|
339
|
+
skipped++;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
transformed.push({
|
|
195
343
|
...feature,
|
|
196
344
|
geometry: {
|
|
197
345
|
...feature.geometry,
|
|
198
|
-
coordinates:
|
|
346
|
+
coordinates: normalized
|
|
199
347
|
}
|
|
200
|
-
};
|
|
201
|
-
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
if (skipped > 0) console.warn(`[YarrowMap] transformRouteCoordinates: skipped ${skipped} feature(s) with a non-LineString or malformed geometry.`);
|
|
351
|
+
return transformed;
|
|
202
352
|
};
|
|
203
353
|
/** Routing API endpoint used by `fetchRoutes()`. */
|
|
204
354
|
const ROUTE_API_URL = "https://api.yarrow.uz/api/routing/route";
|
|
@@ -214,6 +364,21 @@ const emptyResult = (profile) => ({
|
|
|
214
364
|
}
|
|
215
365
|
});
|
|
216
366
|
/**
|
|
367
|
+
* Legacy friendly profile names mapped onto the routing API's wire enum
|
|
368
|
+
* (`'CAR' | 'FOOT' | 'BICYCLE'` — the pre-2026-11 `'DRIVING'/'WALKING'/'CYCLING'`
|
|
369
|
+
* values were removed from the API's validation schema). Unknown values pass
|
|
370
|
+
* through uppercased so the server stays the validator.
|
|
371
|
+
*/
|
|
372
|
+
const ROUTE_PROFILE_WIRE = {
|
|
373
|
+
driving: "CAR",
|
|
374
|
+
walking: "FOOT",
|
|
375
|
+
cycling: "BICYCLE",
|
|
376
|
+
car: "CAR",
|
|
377
|
+
foot: "FOOT",
|
|
378
|
+
bicycle: "BICYCLE"
|
|
379
|
+
};
|
|
380
|
+
const resolveWireProfile = (profile) => ROUTE_PROFILE_WIRE[profile.trim().toLowerCase()] ?? profile.toUpperCase();
|
|
381
|
+
/**
|
|
217
382
|
* Network half of the routing flow: POSTs the route request to the Yarrow
|
|
218
383
|
* routing API, parses and normalizes the response (coordinate order fix
|
|
219
384
|
* included). Rendering, events and camera work stay in the platform SDKs —
|
|
@@ -225,29 +390,48 @@ const emptyResult = (profile) => ({
|
|
|
225
390
|
async function fetchRoutes(input) {
|
|
226
391
|
const { profile, coordinates, language, signal } = input;
|
|
227
392
|
if (coordinates.length < 2) throw new Error("At least two coordinates are required to build a route.");
|
|
393
|
+
getYarrowApiKey();
|
|
228
394
|
const url = addApiKeyToUrl(ROUTE_API_URL);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
395
|
+
let response;
|
|
396
|
+
try {
|
|
397
|
+
response = await fetch(url, {
|
|
398
|
+
method: "POST",
|
|
399
|
+
signal,
|
|
400
|
+
headers: {
|
|
401
|
+
"Content-Type": "application/json",
|
|
402
|
+
...language ? { "Accept-Language": language } : {}
|
|
403
|
+
},
|
|
404
|
+
body: JSON.stringify({
|
|
405
|
+
profile: resolveWireProfile(profile),
|
|
406
|
+
coordinates: coordinates.map((coord) => ({
|
|
407
|
+
lng: coord[0],
|
|
408
|
+
lat: coord[1]
|
|
409
|
+
}))
|
|
410
|
+
})
|
|
411
|
+
});
|
|
412
|
+
} catch (error) {
|
|
413
|
+
throw wrapNetworkError(error, url);
|
|
414
|
+
}
|
|
415
|
+
if (!response.ok) {
|
|
416
|
+
if (response.status === 400) {
|
|
417
|
+
console.warn("[YarrowMap] buildRoute: no route found");
|
|
418
|
+
return emptyResult(profile);
|
|
419
|
+
}
|
|
420
|
+
throw apiErrorFromResponse({
|
|
421
|
+
status: response.status,
|
|
422
|
+
statusText: response.statusText,
|
|
423
|
+
url,
|
|
424
|
+
body: await readErrorBody(response)
|
|
425
|
+
});
|
|
426
|
+
}
|
|
245
427
|
const data = await response.json();
|
|
246
428
|
if (!data.success) {
|
|
247
429
|
console.warn("[YarrowMap] buildRoute: no route found");
|
|
248
430
|
return emptyResult(profile);
|
|
249
431
|
}
|
|
432
|
+
if (!data.data || typeof data.data !== "object" || data.data.path !== void 0 && (typeof data.data.path !== "object" || data.data.path === null)) throw invalidResponseError("missing routing \"data\" payload", data, url);
|
|
250
433
|
let features = data.data.path?.features || [];
|
|
434
|
+
if (!Array.isArray(features)) throw invalidResponseError("\"data.path.features\" is not an array", data, url);
|
|
251
435
|
features = transformRouteCoordinates(features);
|
|
252
436
|
if (!features.length) {
|
|
253
437
|
console.warn("[YarrowMap] buildRoute: route has no features to render");
|
|
@@ -256,6 +440,7 @@ async function fetchRoutes(input) {
|
|
|
256
440
|
const bestCoords = features[0]?.geometry?.coordinates;
|
|
257
441
|
if (bestCoords?.every(([lng, lat]) => lng === bestCoords[0][0] && lat === bestCoords[0][1])) console.warn("[YarrowMap] buildRoute: the returned route has zero length — the requested coordinates may be outside the routing coverage area.");
|
|
258
442
|
const directions = data.data.directions?.routes?.map((r) => r.properties || []) || [];
|
|
443
|
+
const best = features[0];
|
|
259
444
|
return {
|
|
260
445
|
features,
|
|
261
446
|
directions,
|
|
@@ -263,8 +448,8 @@ async function fetchRoutes(input) {
|
|
|
263
448
|
profile,
|
|
264
449
|
totalRoutes: features.length,
|
|
265
450
|
bestRouteIndex: 0,
|
|
266
|
-
duration:
|
|
267
|
-
distance:
|
|
451
|
+
duration: best?.properties?.duration ?? 0,
|
|
452
|
+
distance: best?.properties?.distance ?? 0
|
|
268
453
|
}
|
|
269
454
|
};
|
|
270
455
|
}
|
|
@@ -283,6 +468,7 @@ const haversineDistance = (lat1, lon1, lat2, lon2) => {
|
|
|
283
468
|
* marker rendering stays in the platform SDKs.
|
|
284
469
|
*/
|
|
285
470
|
async function fetchSearchResults(query, input) {
|
|
471
|
+
getYarrowApiKey();
|
|
286
472
|
const searchUrl = addApiKeyToUrl(`${YARROW_SEARCH_API_URL}/api/search/`);
|
|
287
473
|
const url = new URL(searchUrl);
|
|
288
474
|
url.searchParams.set("q", query);
|
|
@@ -292,11 +478,21 @@ async function fetchSearchResults(query, input) {
|
|
|
292
478
|
url.searchParams.set("sort_by", "relevance");
|
|
293
479
|
url.searchParams.set("page", String(input.page ?? 1));
|
|
294
480
|
url.searchParams.set("page_size", String(input.pageSize ?? 15));
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
481
|
+
let response;
|
|
482
|
+
try {
|
|
483
|
+
response = await fetch(url.toString(), {
|
|
484
|
+
headers: { "Content-Type": "application/json" },
|
|
485
|
+
signal: input.signal
|
|
486
|
+
});
|
|
487
|
+
} catch (error) {
|
|
488
|
+
throw wrapNetworkError(error, url.toString());
|
|
489
|
+
}
|
|
490
|
+
if (!response.ok) throw apiErrorFromResponse({
|
|
491
|
+
status: response.status,
|
|
492
|
+
statusText: response.statusText,
|
|
493
|
+
url: url.toString(),
|
|
494
|
+
body: await readErrorBody(response)
|
|
298
495
|
});
|
|
299
|
-
if (!response.ok) throw new Error(`Request failed: ${response.status} ${response.statusText}`);
|
|
300
496
|
return ((await response.json())?.results || []).map((r) => ({
|
|
301
497
|
id: r.id,
|
|
302
498
|
name: r.name,
|
|
@@ -524,11 +720,26 @@ function groupByPixelRadius(items, radius) {
|
|
|
524
720
|
*
|
|
525
721
|
* Also seeds core's API-key module state (like every standalone client), so
|
|
526
722
|
* the key is current even if the hook runs before a map mounts.
|
|
723
|
+
*
|
|
724
|
+
* Throws a coded {@link YarrowApiError}: `unauthorized` when no key is
|
|
725
|
+
* configured (or the server rejects one), `network` when the request fails.
|
|
527
726
|
*/
|
|
528
727
|
async function fetchYarrowIcons(apiKey) {
|
|
529
728
|
if (apiKey) setYarrowApiKey(apiKey);
|
|
530
|
-
|
|
531
|
-
|
|
729
|
+
getYarrowApiKey();
|
|
730
|
+
const url = addApiKeyToUrl(`${YARROW_MAP_URL}${ICONS_ENDPOINT}`);
|
|
731
|
+
let response;
|
|
732
|
+
try {
|
|
733
|
+
response = await fetch(url);
|
|
734
|
+
} catch (error) {
|
|
735
|
+
throw wrapNetworkError(error, url);
|
|
736
|
+
}
|
|
737
|
+
if (!response.ok) throw apiErrorFromResponse({
|
|
738
|
+
status: response.status,
|
|
739
|
+
statusText: response.statusText,
|
|
740
|
+
url,
|
|
741
|
+
body: await readErrorBody(response)
|
|
742
|
+
});
|
|
532
743
|
return (await response.json()).reduce((acc, icon) => {
|
|
533
744
|
acc[icon.icon_image_name] = icon.icon_image_url;
|
|
534
745
|
return acc;
|
|
@@ -566,9 +777,13 @@ async function fetchPlaceLocation(id, iconsByName) {
|
|
|
566
777
|
const controller = new AbortController();
|
|
567
778
|
const timeout = setTimeout(() => controller.abort(), PLACE_TIMEOUT_MS);
|
|
568
779
|
try {
|
|
780
|
+
getYarrowApiKey();
|
|
569
781
|
const url = addApiKeyToUrl(`${YARROW_SEARCH_API_URL}/api/search/${id}?is_bus_stop=false`);
|
|
570
782
|
const res = await fetch(url, { signal: controller.signal });
|
|
571
|
-
if (!res.ok)
|
|
783
|
+
if (!res.ok) {
|
|
784
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) console.warn(`[YarrowMap] fetchPlaceLocation(${id}) failed: ${res.status} ${res.statusText} — ${url}`);
|
|
785
|
+
return null;
|
|
786
|
+
}
|
|
572
787
|
const data = (await res.json())?.search?.data;
|
|
573
788
|
const loc = data?.address?.location;
|
|
574
789
|
if (!loc) return null;
|
|
@@ -581,7 +796,7 @@ async function fetchPlaceLocation(id, iconsByName) {
|
|
|
581
796
|
title: data?.name
|
|
582
797
|
};
|
|
583
798
|
} catch (error) {
|
|
584
|
-
if (error?.name !== "AbortError") console.warn(`[YarrowMap] fetchPlaceLocation(${id}) failed:`, error);
|
|
799
|
+
if (error?.name !== "AbortError" && typeof __DEV__ !== "undefined" && __DEV__) console.warn(`[YarrowMap] fetchPlaceLocation(${id}) failed:`, error);
|
|
585
800
|
return null;
|
|
586
801
|
} finally {
|
|
587
802
|
clearTimeout(timeout);
|
|
@@ -890,10 +1105,16 @@ function useYarrowMapSearch(query, options) {
|
|
|
890
1105
|
}
|
|
891
1106
|
|
|
892
1107
|
// src/hooks/useYarrowRouting.ts
|
|
1108
|
+
/** Default `buildRoute` timeout — after this the request aborts and rejects. */
|
|
1109
|
+
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
893
1110
|
/**
|
|
894
1111
|
* Headless routing state for the Yarrow routing API — pairs with
|
|
895
1112
|
* `<RouteLayer>` for rendering.
|
|
896
1113
|
*
|
|
1114
|
+
* Requests abort after `timeoutMs` (default 30 s) and reject with a coded
|
|
1115
|
+
* `YarrowApiError`; caller `signal` cancellation applies immediately, and
|
|
1116
|
+
* pass `timeoutMs: 0` to disable the timer.
|
|
1117
|
+
*
|
|
897
1118
|
* ```tsx
|
|
898
1119
|
* const { routes, isLoading, buildRoute } = useYarrowRouting({ profile: 'driving' });
|
|
899
1120
|
* <YarrowMapView apiKey={KEY} center={[69.2401, 41.2995]}>
|
|
@@ -902,7 +1123,7 @@ function useYarrowMapSearch(query, options) {
|
|
|
902
1123
|
* ```
|
|
903
1124
|
*/
|
|
904
1125
|
const useYarrowRouting = (options = {}) => {
|
|
905
|
-
const { profile = "driving", language } = options;
|
|
1126
|
+
const { profile = "driving", language, timeoutMs = DEFAULT_TIMEOUT_MS } = options;
|
|
906
1127
|
const [result, setResult] = useState(null);
|
|
907
1128
|
const [isLoading, setIsLoading] = useState(false);
|
|
908
1129
|
const [error, setError] = useState(null);
|
|
@@ -911,22 +1132,46 @@ const useYarrowRouting = (options = {}) => {
|
|
|
911
1132
|
const requestId = ++latestRequestRef.current;
|
|
912
1133
|
setIsLoading(true);
|
|
913
1134
|
setError(null);
|
|
1135
|
+
const controller = new AbortController();
|
|
1136
|
+
let timedOut = false;
|
|
1137
|
+
let timer;
|
|
1138
|
+
const onCallerAbort = () => controller.abort();
|
|
1139
|
+
if (input.signal) {
|
|
1140
|
+
if (input.signal.aborted) controller.abort();
|
|
1141
|
+
else input.signal.addEventListener("abort", onCallerAbort);
|
|
1142
|
+
}
|
|
1143
|
+
if (timeoutMs > 0) timer = setTimeout(() => {
|
|
1144
|
+
timedOut = true;
|
|
1145
|
+
controller.abort();
|
|
1146
|
+
}, timeoutMs);
|
|
1147
|
+
const cleanup = () => {
|
|
1148
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
1149
|
+
timer = void 0;
|
|
1150
|
+
input.signal?.removeEventListener("abort", onCallerAbort);
|
|
1151
|
+
};
|
|
914
1152
|
try {
|
|
915
1153
|
const resolved = await fetchRoutes({
|
|
916
1154
|
profile: input.profile ?? profile,
|
|
917
1155
|
coordinates: input.coordinates,
|
|
918
1156
|
language: input.language ?? language,
|
|
919
|
-
signal:
|
|
1157
|
+
signal: controller.signal
|
|
920
1158
|
});
|
|
921
1159
|
if (latestRequestRef.current === requestId) setResult(resolved);
|
|
922
1160
|
return resolved;
|
|
923
1161
|
} catch (caught) {
|
|
924
|
-
|
|
925
|
-
|
|
1162
|
+
let surfaced = caught;
|
|
1163
|
+
if (timedOut && caught?.name === "AbortError") surfaced = new YarrowApiError("network", `Routing request timed out after ${timeoutMs} ms — pass a larger timeoutMs to useYarrowRouting (0 disables the timeout).`);
|
|
1164
|
+
if (latestRequestRef.current === requestId) setError(surfaced instanceof Error ? surfaced : new Error(String(surfaced)));
|
|
1165
|
+
throw surfaced;
|
|
926
1166
|
} finally {
|
|
1167
|
+
cleanup();
|
|
927
1168
|
if (latestRequestRef.current === requestId) setIsLoading(false);
|
|
928
1169
|
}
|
|
929
|
-
}, [
|
|
1170
|
+
}, [
|
|
1171
|
+
profile,
|
|
1172
|
+
language,
|
|
1173
|
+
timeoutMs
|
|
1174
|
+
]);
|
|
930
1175
|
const clearRoutes = useCallback(() => {
|
|
931
1176
|
latestRequestRef.current += 1;
|
|
932
1177
|
setResult(null);
|
|
@@ -1180,9 +1425,12 @@ const RouteLayer = memo(function RouteLayer({ routes, bestIndex = 0, routeColor
|
|
|
1180
1425
|
* Full style URL for MapLibre React Native's `mapStyle` prop, built from the
|
|
1181
1426
|
* platform-agnostic style endpoint plus the configured API key. The key comes
|
|
1182
1427
|
* from core's module state (`setYarrowApiKey`) — `YarrowMapView` calls it for
|
|
1183
|
-
* you; standalone callers must set it first
|
|
1428
|
+
* you; standalone callers must set it first or this throws a coded
|
|
1429
|
+
* `unauthorized` `YarrowApiError` (instead of producing a keyless style URL
|
|
1430
|
+
* that fails opaquely on the native side).
|
|
1184
1431
|
*/
|
|
1185
1432
|
function buildStyleUrl(styleType, theme = "light") {
|
|
1433
|
+
getYarrowApiKey();
|
|
1186
1434
|
const endpoint = buildStyleEndpoint(normalizeStyleType(styleType), theme);
|
|
1187
1435
|
return addApiKeyToUrl(`${YARROW_MAP_URL}${endpoint}`);
|
|
1188
1436
|
}
|
|
@@ -1215,7 +1463,7 @@ const redactApiKey = (url) => url.replace(/([?&])api_key=[^&]*/g, "$1api_key=***
|
|
|
1215
1463
|
* `cameraRef` (`flyTo`, `jumpTo`, `fitBounds`). Theme and styleType changes
|
|
1216
1464
|
* hot-swap the style URL natively.
|
|
1217
1465
|
*/
|
|
1218
|
-
const YarrowMapView = forwardRef(({ apiKey, center, zoom, minZoom, maxZoom, theme, styleType, onReady, onLoadError, onPress, onMoveEnd, cameraRef, attribution = false, logo = false, compass = true, brandBadgePosition, brandBadgeScale, androidView, dauTracking = true, icons = true, style, children }, ref) => {
|
|
1466
|
+
const YarrowMapView = forwardRef(({ apiKey, center, zoom, minZoom, maxZoom, theme, styleType, onReady, onLoadError, onPress, onMoveEnd, cameraRef, attribution = false, logo = false, compass = true, brandBadgePosition, brandBadgeScale, androidView, dauTracking = true, icons = true, onIconsError, style, children }, ref) => {
|
|
1219
1467
|
const config = useMemo(() => new YarrowMapConfig({
|
|
1220
1468
|
apiKey,
|
|
1221
1469
|
center,
|
|
@@ -1241,6 +1489,8 @@ const YarrowMapView = forwardRef(({ apiKey, center, zoom, minZoom, maxZoom, them
|
|
|
1241
1489
|
const highlightedPoiIds = useRef(/* @__PURE__ */ new Set());
|
|
1242
1490
|
const [iconsByName, setIconsByName] = useState({});
|
|
1243
1491
|
const iconsFetchAttemptedRef = useRef(false);
|
|
1492
|
+
const onIconsErrorRef = useRef(onIconsError);
|
|
1493
|
+
onIconsErrorRef.current = onIconsError;
|
|
1244
1494
|
useEffect(() => {
|
|
1245
1495
|
iconsFetchAttemptedRef.current = false;
|
|
1246
1496
|
if (!icons) {
|
|
@@ -1255,6 +1505,7 @@ const YarrowMapView = forwardRef(({ apiKey, center, zoom, minZoom, maxZoom, them
|
|
|
1255
1505
|
}
|
|
1256
1506
|
}).catch((error) => {
|
|
1257
1507
|
console.warn("[YarrowMap] icon registry fetch failed:", error);
|
|
1508
|
+
onIconsErrorRef.current?.(error);
|
|
1258
1509
|
});
|
|
1259
1510
|
return () => {
|
|
1260
1511
|
cancelled = true;
|
|
@@ -1530,6 +1781,10 @@ function useYarrowCamera(cameraRefInput) {
|
|
|
1530
1781
|
const camera = getCamera();
|
|
1531
1782
|
if (!camera) return;
|
|
1532
1783
|
const box = getBoundingBox(data);
|
|
1784
|
+
if (data.features.length === 0 || box.xMin > box.xMax || box.yMin > box.yMax) {
|
|
1785
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) console.warn("[YarrowMap] fitBounds: nothing to fit — the FeatureCollection is empty or none of its geometries produced coordinates.");
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1533
1788
|
const padding = options?.padding ?? DEFAULT_PADDING;
|
|
1534
1789
|
const duration = options?.duration ?? DEFAULT_DURATION_MS;
|
|
1535
1790
|
if (Math.abs(box.xMax - box.xMin) < MIN_DIMENSION_DEGREES) {
|
|
@@ -1671,6 +1926,15 @@ const notFoundError = (name, regionId) => {
|
|
|
1671
1926
|
error.regionId = regionId;
|
|
1672
1927
|
return error;
|
|
1673
1928
|
};
|
|
1929
|
+
/** Rejection for handles stranded by deleting a pack they point at. */
|
|
1930
|
+
const deletedRegionError = (name, regionId, forced) => {
|
|
1931
|
+
const reason = forced ? "was replaced by a forced re-download — its previous download will not finish; await the new downloadRegion call's handle instead" : "was deleted";
|
|
1932
|
+
const label = name ? `"${name}"` : regionId;
|
|
1933
|
+
const error = /* @__PURE__ */ new Error(`Offline region ${label} ${reason}.`);
|
|
1934
|
+
error.code = "not-found";
|
|
1935
|
+
error.regionId = regionId;
|
|
1936
|
+
return error;
|
|
1937
|
+
};
|
|
1674
1938
|
const asYarrowMetadata = (pack) => {
|
|
1675
1939
|
const meta = pack.metadata;
|
|
1676
1940
|
if (!meta || meta.v !== 1 || typeof meta.name !== "string") return null;
|
|
@@ -1717,11 +1981,60 @@ const classifyError = (raw, regionId) => {
|
|
|
1717
1981
|
var YarrowOfflineManager = class {
|
|
1718
1982
|
constructor(options) {
|
|
1719
1983
|
this.activeDownloads = /* @__PURE__ */ new Map();
|
|
1984
|
+
this.liveChannels = /* @__PURE__ */ new Map();
|
|
1720
1985
|
if (!options.apiKey) throw new Error("apiKey is required");
|
|
1721
1986
|
this.apiKey = options.apiKey;
|
|
1722
1987
|
setYarrowApiKey(this.apiKey);
|
|
1723
1988
|
}
|
|
1724
1989
|
/**
|
|
1990
|
+
* Creates a `done` promise together with its settlement channel. The
|
|
1991
|
+
* channel registers itself under the pack id (lazily — the id is often
|
|
1992
|
+
* only known after `createPack` resolves, or when the first event arrives)
|
|
1993
|
+
* so a later deletion can reject every outstanding `done` for that pack.
|
|
1994
|
+
*/
|
|
1995
|
+
createPendingDone() {
|
|
1996
|
+
let resolveDone;
|
|
1997
|
+
let rejectDone;
|
|
1998
|
+
const done = new Promise((resolve, reject) => {
|
|
1999
|
+
resolveDone = resolve;
|
|
2000
|
+
rejectDone = reject;
|
|
2001
|
+
});
|
|
2002
|
+
done.catch(() => {});
|
|
2003
|
+
let trackedId = null;
|
|
2004
|
+
let settled = false;
|
|
2005
|
+
const unregister = () => {
|
|
2006
|
+
if (!trackedId) return;
|
|
2007
|
+
const channels = this.liveChannels.get(trackedId);
|
|
2008
|
+
channels?.delete(channel);
|
|
2009
|
+
if (channels && channels.size === 0) this.liveChannels.delete(trackedId);
|
|
2010
|
+
};
|
|
2011
|
+
const channel = {
|
|
2012
|
+
settle: ({ progress, error }) => {
|
|
2013
|
+
if (settled) return;
|
|
2014
|
+
settled = true;
|
|
2015
|
+
unregister();
|
|
2016
|
+
if (error) rejectDone(error);
|
|
2017
|
+
else if (progress) resolveDone(progress);
|
|
2018
|
+
},
|
|
2019
|
+
track: (packId) => {
|
|
2020
|
+
if (settled) return;
|
|
2021
|
+
if (trackedId === packId) return;
|
|
2022
|
+
if (trackedId !== null) unregister();
|
|
2023
|
+
trackedId = packId;
|
|
2024
|
+
let channels = this.liveChannels.get(packId);
|
|
2025
|
+
if (!channels) {
|
|
2026
|
+
channels = /* @__PURE__ */ new Set();
|
|
2027
|
+
this.liveChannels.set(packId, channels);
|
|
2028
|
+
}
|
|
2029
|
+
channels.add(channel);
|
|
2030
|
+
}
|
|
2031
|
+
};
|
|
2032
|
+
return {
|
|
2033
|
+
done,
|
|
2034
|
+
channel
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
1725
2038
|
* Pure tile-math estimate of a region's download/storage cost — no native
|
|
1726
2039
|
* calls. See `estimateRegion` for the math and caveats.
|
|
1727
2040
|
*/
|
|
@@ -1771,7 +2084,10 @@ var YarrowOfflineManager = class {
|
|
|
1771
2084
|
error.code = "params-mismatch";
|
|
1772
2085
|
throw error;
|
|
1773
2086
|
}
|
|
1774
|
-
for (const { pack } of existing) await this.deletePack(pack.id
|
|
2087
|
+
for (const { pack, meta } of existing) await this.deletePack(pack.id, {
|
|
2088
|
+
name: meta.name,
|
|
2089
|
+
forced: true
|
|
2090
|
+
});
|
|
1775
2091
|
setYarrowApiKey(this.apiKey);
|
|
1776
2092
|
const metadata = {
|
|
1777
2093
|
v: 1,
|
|
@@ -1785,14 +2101,10 @@ var YarrowOfflineManager = class {
|
|
|
1785
2101
|
createdAt: Date.now(),
|
|
1786
2102
|
...options.metadata ? { user: options.metadata } : {}
|
|
1787
2103
|
};
|
|
1788
|
-
|
|
1789
|
-
const
|
|
1790
|
-
settle = ({ progress, error }) => {
|
|
1791
|
-
if (error) reject(error);
|
|
1792
|
-
else if (progress) resolve(progress);
|
|
1793
|
-
};
|
|
1794
|
-
});
|
|
2104
|
+
const { done, channel } = this.createPendingDone();
|
|
2105
|
+
const settle = channel.settle;
|
|
1795
2106
|
const routeProgress = (_pack, status) => {
|
|
2107
|
+
channel.track(_pack.id);
|
|
1796
2108
|
const progress = stripId(status);
|
|
1797
2109
|
if (status.state === "complete") {
|
|
1798
2110
|
this.activeDownloads.delete(_pack.id);
|
|
@@ -1800,6 +2112,7 @@ var YarrowOfflineManager = class {
|
|
|
1800
2112
|
} else options.onProgress?.(progress);
|
|
1801
2113
|
};
|
|
1802
2114
|
const routeError = (_pack, raw) => {
|
|
2115
|
+
channel.track(_pack.id);
|
|
1803
2116
|
this.activeDownloads.delete(_pack.id);
|
|
1804
2117
|
const error = classifyError(raw.message, _pack.id);
|
|
1805
2118
|
options.onError?.(error);
|
|
@@ -1814,6 +2127,7 @@ var YarrowOfflineManager = class {
|
|
|
1814
2127
|
metadata
|
|
1815
2128
|
}, routeProgress, routeError);
|
|
1816
2129
|
this.activeDownloads.set(pack.id, { done });
|
|
2130
|
+
channel.track(pack.id);
|
|
1817
2131
|
const status = await statusOrNull(pack);
|
|
1818
2132
|
if (status?.state === "complete") {
|
|
1819
2133
|
OfflineManager.removeListener(pack.id);
|
|
@@ -1921,13 +2235,9 @@ var YarrowOfflineManager = class {
|
|
|
1921
2235
|
const status = await statusOrNull(pack);
|
|
1922
2236
|
if (!status) throw notFoundError(meta.name, pack.id);
|
|
1923
2237
|
if (status.state === "complete") return this.toHandle(pack, meta, Promise.resolve(stripId(status)));
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
if (error) reject(error);
|
|
1928
|
-
else if (progress) resolve(progress);
|
|
1929
|
-
};
|
|
1930
|
-
});
|
|
2238
|
+
const { done, channel } = this.createPendingDone();
|
|
2239
|
+
channel.track(pack.id);
|
|
2240
|
+
const settle = channel.settle;
|
|
1931
2241
|
const routeProgress = (_pack, progressEvent) => {
|
|
1932
2242
|
if (progressEvent.state === "complete") settle({ progress: stripId(progressEvent) });
|
|
1933
2243
|
};
|
|
@@ -1960,7 +2270,14 @@ var YarrowOfflineManager = class {
|
|
|
1960
2270
|
}
|
|
1961
2271
|
};
|
|
1962
2272
|
}
|
|
1963
|
-
|
|
2273
|
+
/**
|
|
2274
|
+
* Deletes a pack natively and settles every outstanding handle: their
|
|
2275
|
+
* `done` rejects with a `not-found` YarrowOfflineError (a deleted pack
|
|
2276
|
+
* never emits another event, so awaiting `done` would otherwise hang
|
|
2277
|
+
* forever). `forced` marks the force-re-download path for the message.
|
|
2278
|
+
* Native failures leave handles untouched — the pack still exists.
|
|
2279
|
+
*/
|
|
2280
|
+
async deletePack(id, context) {
|
|
1964
2281
|
try {
|
|
1965
2282
|
await OfflineManager.deletePack(id);
|
|
1966
2283
|
} catch (caught) {
|
|
@@ -1968,6 +2285,13 @@ var YarrowOfflineManager = class {
|
|
|
1968
2285
|
} finally {
|
|
1969
2286
|
this.activeDownloads.delete(id);
|
|
1970
2287
|
}
|
|
2288
|
+
OfflineManager.removeListener(id);
|
|
2289
|
+
const channels = this.liveChannels.get(id);
|
|
2290
|
+
if (channels) {
|
|
2291
|
+
this.liveChannels.delete(id);
|
|
2292
|
+
const error = deletedRegionError(context?.name, id, context?.forced === true);
|
|
2293
|
+
for (const channel of channels) channel.settle({ error });
|
|
2294
|
+
}
|
|
1971
2295
|
}
|
|
1972
2296
|
};
|
|
1973
2297
|
|
|
@@ -2686,4 +3010,4 @@ async function setAsyncStorageTokenStorage(storage) {
|
|
|
2686
3010
|
});
|
|
2687
3011
|
}
|
|
2688
3012
|
|
|
2689
|
-
export {
|
|
3013
|
+
export { addApiKeyToUrl as $, fetchPlaceLocation as A, ClusterBadge as B, useYarrowMapSearch as C, YarrowMapContext as D, useYarrowLayerPress as E, DEFAULT_CLUSTER_MAX_ZOOM as F, ICON_CACHE_NAME as G, CACHE_PROTOCOL as H, DEFAULT_CLUSTER_MIN_POINTS as I, TILE_CACHE_NAME as J, MILLISECONDS_PER_DAY as K, DEFAULT_CLUSTER_RADIUS_PX as L, resolvePoiData as M, fetchYarrowIcons as N, useYarrowMapRuntime as O, resolveCategoryIcon as P, YarrowApiError as Q, groupByPixelRadius as R, useYarrowRouting as S, YARROW_CLICK_LAYER_IDS as T, DEFAULT_CACHE_LIFESPAN_DAYS as U, CACHED_AT_HEADER as V, ICONS_ENDPOINT as W, YARROW_MAP_URL as X, USER_TOKEN_STORAGE_KEY as Y, YARROW_SEARCH_API_URL as Z, buildStyleUrl as _, PoiHighlightLayer as a, getOrCreateUserToken as at, DEFAULT_BRAND_BADGE_SCALE as b, DEFAULT_OFFLINE_MAX_ZOOM as c, haversineDistance as ct, AVG_TILE_BYTES as d, setYarrowApiKey as dt, buildStyleEndpoint as et, estimateRegion as f, transformRouteCoordinates as ft, YarrowMapView as g, HighlightMarkerView as h, useYarrowPoiHighlight as i, getBoundingBox as it, lookupPoiInViewport as j, POI_BASE_LAYER as k, DEFAULT_OFFLINE_MIN_ZOOM as l, normalizeStyleType as lt, YarrowMarker as m, trackDau as n, fetchRoutes as nt, useYarrowOfflineRegions as o, getYarrowApiKey as ot, useYarrowCamera as p, ROUTE_API_URL as q, SearchResultsLayer as r, fetchSearchResults as rt, YarrowOfflineManager as s, hasCacheStorage as st, setAsyncStorageTokenStorage as t, fetchArrayBufferWithCache as tt, OFFLINE_METADATA_VERSION as u, setTokenStorage as ut, RouteLayer as v, useYarrowSearch as w, YarrowImages as x, YarrowMapConfig as y, normalizeClusteringConfig as z };
|
package/dist/surface.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as YarrowMapViewProps, $t as RouteDirection, A as useYarrowOfflineRegions, At as ClusteringConfig, B as OfflineRegionHandle, Bt as BoundingBox, C as PlaceLocation, Cn as
|
|
2
|
-
export { AVG_TILE_BYTES, type AsyncStorageLike, type BoundingBox, type BrandBadgePosition, type BuildRouteInput, CACHED_AT_HEADER, CACHE_PROTOCOL, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type ClickLayerTarget, ClusterBadge, type ClusterBadgeProps, type ClusterChild, type ClusterClickHandler, type ClusterPoint, type ClusteringConfig, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, type FetchRoutesInput, type FetchRoutesResult, type FitBoundsOptions, HighlightMarkerView, type HighlightMarkerViewProps, type HighlightPoiData, ICONS_ENDPOINT, ICON_CACHE_NAME, type LayerPressInfo, MILLISECONDS_PER_DAY, type MapRef, type NormalizedCacheConfig, type NormalizedClusteringConfig, OFFLINE_METADATA_VERSION, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, POI_BASE_LAYER, type PixelCluster, type PlaceLocation, PoiHighlightLayer, type PoiHighlightLayerProps, type PoiHighlightPressInfo, ROUTE_API_URL, type ResolvedPoiData, type RouteDirection, type RouteDirectionModifier, type RouteFeature, RouteLayer, type RouteLayerProps, type RoutesMeta, type SearchResult, SearchResultsLayer, type SearchResultsLayerProps, TILE_CACHE_NAME, type TokenStorage, USER_TOKEN_STORAGE_KEY, type UseYarrowLayerPressOptions, type UseYarrowMapSearchOptions, type UseYarrowMapSearchResult, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowPoiHighlightResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, type YarrowCamera, type YarrowIconsMap, YarrowImages, type YarrowImagesProps, YarrowMapConfig, type YarrowMapConfigOptions, YarrowMapContext, type YarrowMapPress, type YarrowMapRuntime, YarrowMapView, type YarrowMapViewProps, YarrowMarker, type YarrowMarkerProps, type YarrowOfflineError, YarrowOfflineManager, type YarrowOfflineManagerOptions, type YarrowPoiHighlight, type YarrowRegionState, type YarrowStyleType, type ZoomToOptions, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
|
1
|
+
import { $ as YarrowMapViewProps, $t as RouteDirection, A as useYarrowOfflineRegions, At as ClusteringConfig, B as OfflineRegionHandle, Bt as BoundingBox, C as PlaceLocation, Cn as setTokenStorage, Ct as LayerPressInfo, D as YarrowOfflineManagerOptions, Dt as ClusterChild, E as YarrowOfflineManager, Et as useYarrowLayerPress, F as OFFLINE_METADATA_VERSION, Ft as PixelCluster, G as YarrowCamera, Gt as DEFAULT_CACHE_LIFESPAN_DAYS, H as OfflineRegionSummary, Ht as CACHE_PROTOCOL, I as OfflineBounds, It as groupByPixelRadius, J as YarrowMarker, Jt as ICONS_ENDPOINT, K as ZoomToOptions, Kt as FetchRoutesInput, L as OfflineRegionDownloadOptions, Lt as normalizeClusteringConfig, M as estimateRegion, Mt as DEFAULT_CLUSTER_MIN_POINTS, N as DEFAULT_OFFLINE_MAX_ZOOM, Nt as DEFAULT_CLUSTER_RADIUS_PX, O as UseYarrowOfflineRegionsOptions, Ot as ClusterClickHandler, P as DEFAULT_OFFLINE_MIN_ZOOM, Pt as NormalizedClusteringConfig, Q as YarrowMapView, Qt as ROUTE_API_URL, R as OfflineRegionErrorCode, Rt as ClusterBadge, S as HighlightPoiData, Sn as normalizeStyleType, St as ClickLayerTarget, T as ResolvedPoiData, Tn as transformRouteCoordinates, Tt as YARROW_CLICK_LAYER_IDS, U as YarrowOfflineError, Ut as CacheConfig, V as OfflineRegionProgress, Vt as CACHED_AT_HEADER, W as FitBoundsOptions, Wt as CachedArrayBufferResponse, X as HighlightMarkerView, Xt as MILLISECONDS_PER_DAY, Y as YarrowMarkerProps, Yt as ICON_CACHE_NAME, Z as HighlightMarkerViewProps, Zt as NormalizedCacheConfig, _ as YarrowMapRuntime, _n as getBoundingBox, _t as UseYarrowMapSearchResult, a as trackDau, an as TokenStorage, at as BrandBadgePosition, b as PoiHighlightLayer, bn as hasCacheStorage, bt as UseYarrowSearchResult, c as UseYarrowPoiHighlightResult, cn as YARROW_SEARCH_API_URL, ct as YarrowImagesProps, d as POI_BASE_LAYER, dn as YarrowStyleType, dt as resolveCategoryIcon, en as RouteDirectionModifier, et as buildStyleUrl, f as fetchPlaceLocation, fn as addApiKeyToUrl, ft as BuildRouteInput, g as YarrowMapPress, gn as fetchSearchResults, gt as UseYarrowMapSearchOptions, h as YarrowMapContext, hn as fetchRoutes, ht as useYarrowRouting, i as setAsyncStorageTokenStorage, in as TILE_CACHE_NAME, it as YarrowMapConfigOptions, j as AVG_TILE_BYTES, jt as DEFAULT_CLUSTER_MAX_ZOOM, k as UseYarrowOfflineRegionsResult, kt as ClusterPoint, l as YarrowPoiHighlight, ln as YarrowApiError, lt as YarrowIconsMap, m as resolvePoiData, mn as fetchArrayBufferWithCache, mt as UseYarrowRoutingResult, n as MapRef, nn as RoutesMeta, nt as RouteLayerProps, o as SearchResultsLayer, on as USER_TOKEN_STORAGE_KEY, ot as DEFAULT_BRAND_BADGE_SCALE, p as lookupPoiInViewport, pn as buildStyleEndpoint, pt as UseYarrowRoutingOptions, q as useYarrowCamera, qt as FetchRoutesResult, r as AsyncStorageLike, rn as SearchResult, rt as YarrowMapConfig, s as SearchResultsLayerProps, sn as YARROW_MAP_URL, st as YarrowImages, t as CameraRef, tn as RouteFeature, tt as RouteLayer, u as useYarrowPoiHighlight, un as YarrowApiErrorCode, ut as fetchYarrowIcons, v as YarrowRegionState, vn as getOrCreateUserToken, vt as useYarrowMapSearch, w as PoiHighlightPressInfo, wn as setYarrowApiKey, wt as UseYarrowLayerPressOptions, x as PoiHighlightLayerProps, xn as haversineDistance, xt as useYarrowSearch, y as useYarrowMapRuntime, yn as getYarrowApiKey, yt as UseYarrowSearchOptions, z as OfflineRegionEstimate, zt as ClusterBadgeProps } from "./surface-DIyAsyCh.js";
|
|
2
|
+
export { AVG_TILE_BYTES, type AsyncStorageLike, type BoundingBox, type BrandBadgePosition, type BuildRouteInput, CACHED_AT_HEADER, CACHE_PROTOCOL, type CacheConfig, type CachedArrayBufferResponse, type CameraRef, type ClickLayerTarget, ClusterBadge, type ClusterBadgeProps, type ClusterChild, type ClusterClickHandler, type ClusterPoint, type ClusteringConfig, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, type FetchRoutesInput, type FetchRoutesResult, type FitBoundsOptions, HighlightMarkerView, type HighlightMarkerViewProps, type HighlightPoiData, ICONS_ENDPOINT, ICON_CACHE_NAME, type LayerPressInfo, MILLISECONDS_PER_DAY, type MapRef, type NormalizedCacheConfig, type NormalizedClusteringConfig, OFFLINE_METADATA_VERSION, type OfflineBounds, type OfflineRegionDownloadOptions, type OfflineRegionErrorCode, type OfflineRegionEstimate, type OfflineRegionHandle, type OfflineRegionProgress, type OfflineRegionSummary, POI_BASE_LAYER, type PixelCluster, type PlaceLocation, PoiHighlightLayer, type PoiHighlightLayerProps, type PoiHighlightPressInfo, ROUTE_API_URL, type ResolvedPoiData, type RouteDirection, type RouteDirectionModifier, type RouteFeature, RouteLayer, type RouteLayerProps, type RoutesMeta, type SearchResult, SearchResultsLayer, type SearchResultsLayerProps, TILE_CACHE_NAME, type TokenStorage, USER_TOKEN_STORAGE_KEY, type UseYarrowLayerPressOptions, type UseYarrowMapSearchOptions, type UseYarrowMapSearchResult, type UseYarrowOfflineRegionsOptions, type UseYarrowOfflineRegionsResult, type UseYarrowPoiHighlightResult, type UseYarrowRoutingOptions, type UseYarrowRoutingResult, type UseYarrowSearchOptions, type UseYarrowSearchResult, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowApiError, type YarrowApiErrorCode, type YarrowCamera, type YarrowIconsMap, YarrowImages, type YarrowImagesProps, YarrowMapConfig, type YarrowMapConfigOptions, YarrowMapContext, type YarrowMapPress, type YarrowMapRuntime, YarrowMapView, type YarrowMapViewProps, YarrowMarker, type YarrowMarkerProps, type YarrowOfflineError, YarrowOfflineManager, type YarrowOfflineManagerOptions, type YarrowPoiHighlight, type YarrowRegionState, type YarrowStyleType, type ZoomToOptions, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
package/dist/surface.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as addApiKeyToUrl, A as fetchPlaceLocation, B as ClusterBadge, C as useYarrowMapSearch, D as YarrowMapContext, E as useYarrowLayerPress, F as DEFAULT_CLUSTER_MAX_ZOOM, G as ICON_CACHE_NAME, H as CACHE_PROTOCOL, I as DEFAULT_CLUSTER_MIN_POINTS, J as TILE_CACHE_NAME, K as MILLISECONDS_PER_DAY, L as DEFAULT_CLUSTER_RADIUS_PX, M as resolvePoiData, N as fetchYarrowIcons, O as useYarrowMapRuntime, P as resolveCategoryIcon, Q as YarrowApiError, R as groupByPixelRadius, S as useYarrowRouting, T as YARROW_CLICK_LAYER_IDS, U as DEFAULT_CACHE_LIFESPAN_DAYS, V as CACHED_AT_HEADER, W as ICONS_ENDPOINT, X as YARROW_MAP_URL, Y as USER_TOKEN_STORAGE_KEY, Z as YARROW_SEARCH_API_URL, _ as buildStyleUrl, a as PoiHighlightLayer, at as getOrCreateUserToken, b as DEFAULT_BRAND_BADGE_SCALE, c as DEFAULT_OFFLINE_MAX_ZOOM, ct as haversineDistance, d as AVG_TILE_BYTES, dt as setYarrowApiKey, et as buildStyleEndpoint, f as estimateRegion, ft as transformRouteCoordinates, g as YarrowMapView, h as HighlightMarkerView, i as useYarrowPoiHighlight, it as getBoundingBox, j as lookupPoiInViewport, k as POI_BASE_LAYER, l as DEFAULT_OFFLINE_MIN_ZOOM, lt as normalizeStyleType, m as YarrowMarker, n as trackDau, nt as fetchRoutes, o as useYarrowOfflineRegions, ot as getYarrowApiKey, p as useYarrowCamera, q as ROUTE_API_URL, r as SearchResultsLayer, rt as fetchSearchResults, s as YarrowOfflineManager, st as hasCacheStorage, t as setAsyncStorageTokenStorage, tt as fetchArrayBufferWithCache, u as OFFLINE_METADATA_VERSION, ut as setTokenStorage, v as RouteLayer, w as useYarrowSearch, x as YarrowImages, y as YarrowMapConfig, z as normalizeClusteringConfig } from "./surface-DMNyWc2D.js";
|
|
2
2
|
|
|
3
|
-
export { AVG_TILE_BYTES, CACHED_AT_HEADER, CACHE_PROTOCOL, ClusterBadge, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, HighlightMarkerView, ICONS_ENDPOINT, ICON_CACHE_NAME, MILLISECONDS_PER_DAY, OFFLINE_METADATA_VERSION, POI_BASE_LAYER, PoiHighlightLayer, ROUTE_API_URL, RouteLayer, SearchResultsLayer, TILE_CACHE_NAME, USER_TOKEN_STORAGE_KEY, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowImages, YarrowMapConfig, YarrowMapContext, YarrowMapView, YarrowMarker, YarrowOfflineManager, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
|
3
|
+
export { AVG_TILE_BYTES, CACHED_AT_HEADER, CACHE_PROTOCOL, ClusterBadge, DEFAULT_BRAND_BADGE_SCALE, DEFAULT_CACHE_LIFESPAN_DAYS, DEFAULT_CLUSTER_MAX_ZOOM, DEFAULT_CLUSTER_MIN_POINTS, DEFAULT_CLUSTER_RADIUS_PX, DEFAULT_OFFLINE_MAX_ZOOM, DEFAULT_OFFLINE_MIN_ZOOM, HighlightMarkerView, ICONS_ENDPOINT, ICON_CACHE_NAME, MILLISECONDS_PER_DAY, OFFLINE_METADATA_VERSION, POI_BASE_LAYER, PoiHighlightLayer, ROUTE_API_URL, RouteLayer, SearchResultsLayer, TILE_CACHE_NAME, USER_TOKEN_STORAGE_KEY, YARROW_CLICK_LAYER_IDS, YARROW_MAP_URL, YARROW_SEARCH_API_URL, YarrowApiError, YarrowImages, YarrowMapConfig, YarrowMapContext, YarrowMapView, YarrowMarker, YarrowOfflineManager, addApiKeyToUrl, buildStyleEndpoint, buildStyleUrl, estimateRegion, fetchArrayBufferWithCache, fetchPlaceLocation, fetchRoutes, fetchSearchResults, fetchYarrowIcons, getBoundingBox, getOrCreateUserToken, getYarrowApiKey, groupByPixelRadius, hasCacheStorage, haversineDistance, lookupPoiInViewport, normalizeClusteringConfig, normalizeStyleType, resolveCategoryIcon, resolvePoiData, setAsyncStorageTokenStorage, setTokenStorage, setYarrowApiKey, trackDau, transformRouteCoordinates, useYarrowCamera, useYarrowLayerPress, useYarrowMapRuntime, useYarrowMapSearch, useYarrowOfflineRegions, useYarrowPoiHighlight, useYarrowRouting, useYarrowSearch };
|
package/package.json
CHANGED