@trackunit/react-map-adapter-google 0.0.118-alpha-12adfed37e0.0 → 0.0.118

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/README.md CHANGED
@@ -15,6 +15,7 @@ TypeScript consumers also need the `@types/google.maps` peer dependency.
15
15
  | Export | Role |
16
16
  | --- | --- |
17
17
  | `googleMapsAdapter` | Factory that returns adapter config for `useMap` (from `@trackunit/react-map`) |
18
+ | `googleMapCspDirectives` | Factory returning Google Maps runtime CSP requirements for IrisX app manifests |
18
19
  | `GoogleMapsConfig` | Configuration type for the adapter |
19
20
  | `GoogleApiProvider` | Optional wrapper to load the Maps JS API once for multiple map instances (recommended when several maps use vector/cloud `mapId` styling) |
20
21
  | `GoogleMapsAdapterInstance` | Low-level instance factory (advanced use) |
@@ -24,8 +25,39 @@ TypeScript consumers also need the `@types/google.maps` peer dependency.
24
25
 
25
26
  Pass the adapter into `useMap` from `@trackunit/react-map` (see JSDoc on `googleMapsAdapter` in source for a full example).
26
27
 
28
+ ```tsx
29
+ import { useMap } from "@trackunit/react-map";
30
+ import { googleMapsAdapter } from "@trackunit/react-map-adapter-google";
31
+
32
+ const MyMap = () => {
33
+ const googleMapsApiKey = ""; // your API key here
34
+ const [Map] = useMap(googleMapsAdapter({ apiKey: googleMapsApiKey }));
35
+
36
+ return <Map aria-label="Map" className="h-full w-full" />;
37
+ };
38
+ ```
39
+
27
40
  For **multiple Google maps** in one tree, wrap them in `GoogleApiProvider` with your API key and give each map a **distinct** `mapInstanceId` in its `GoogleMapsConfig` so the vis.gl layer registry can tell maps apart. See the docblock on `GoogleApiProvider` for details.
28
41
 
42
+ ## IrisX apps
43
+
44
+ The IrisX iframe Content Security Policy blocks Google Maps unless the app declares the adapter's runtime requirements. An empty `cspHeader` applies only the IrisX default policy which does not include Google Maps automatically.
45
+
46
+ Import and spread the adapter-owned directives in `iris-app-manifest.ts`:
47
+
48
+ ```ts
49
+ import { googleMapCspDirectives } from "@trackunit/react-map-adapter-google";
50
+
51
+ const irisAppManifest = {
52
+ // ...
53
+ cspHeader: {
54
+ ...googleMapCspDirectives(),
55
+ },
56
+ };
57
+ ```
58
+
59
+ Use the exported directives instead of copying host lists or using the Manager-only `defaultCspConfig()`. This keeps the CSP requirement versioned with the adapter.
60
+
29
61
  ## Dependencies
30
62
 
31
63
  Depends on `@trackunit/react-map-adapter-shared` and Google Maps–related packages (e.g. `@vis.gl/react-google-maps`). It does **not** import `@trackunit/react-map` (adapters are consumed *by* the map package, not the reverse).
package/index.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var reactMapAdapterShared = require('@trackunit/react-map-adapter-shared');
3
4
  var jsxRuntime = require('react/jsx-runtime');
4
5
  var reactGoogleMaps = require('@vis.gl/react-google-maps');
5
6
  var react = require('react');
6
- var reactMapAdapterShared = require('@trackunit/react-map-adapter-shared');
7
7
  var geoJsonUtils = require('@trackunit/geo-json-utils');
8
8
  var markerclusterer = require('@googlemaps/markerclusterer');
9
9
  var reactMapColorUtils = require('@trackunit/react-map-color-utils');
@@ -3120,6 +3120,10 @@ const googleMapsAdapter = reactMapAdapterShared.defineAdapter((config) => ({
3120
3120
  Renderer: GoogleMapsRenderer,
3121
3121
  }));
3122
3122
 
3123
+ Object.defineProperty(exports, "googleMapCspDirectives", {
3124
+ enumerable: true,
3125
+ get: function () { return reactMapAdapterShared.googleMapCspDirectives; }
3126
+ });
3123
3127
  exports.GoogleApiProvider = GoogleApiProvider;
3124
3128
  exports.GoogleMapsAdapterInstance = GoogleMapsAdapterInstance;
3125
3129
  exports.GoogleMapsRenderer = GoogleMapsRenderer;
package/index.esm.js CHANGED
@@ -1,7 +1,8 @@
1
+ import { canPatchAdaptiveMarker, canPatchAdaptiveViewport, canPatchMarkerInPlace, extractPointCoordinates, mergeAntimeridianFeatures, extractPolygonPaths, extractLineCoordinates, patchPortalDescriptors, collectFeatureIdSet, removeGoneIndexedMarkers, getAdaptiveDomFeatureIds, extractSourceData, buildAdaptiveDomRenderFn, resolveCircleSymbolDefaults, resolveSymbolDescriptor, buildAdaptiveSymbolStyleFn, createSymbolDotElement, anchorFromBottomCenter, createDefaultClusterElement, createClusterPinElement, fadeInElement, buildAdaptiveDomEntries, MAP_CURSORS, resolveSelectedStyle, resolveHoveredStyle, attachSafeAreaHoverListeners, INITIAL_MAP_STATE, DEFAULT_MAP_APPEARANCE, computeInitialState, getEffectiveRestrictBounds, cameraStateEquals, isEventOfType, DEFAULT_ZOOM, DEFAULT_CENTER, defineAdapter } from '@trackunit/react-map-adapter-shared';
2
+ export { googleMapCspDirectives } from '@trackunit/react-map-adapter-shared';
1
3
  import { jsx } from 'react/jsx-runtime';
2
4
  import { APIProvider, APIProviderContext, useMap, useApiLoadingStatus, APILoadingStatus, Map as Map$1 } from '@vis.gl/react-google-maps';
3
5
  import { useMemo, useCallback, useSyncExternalStore, useId, useContext, useEffect } from 'react';
4
- import { canPatchAdaptiveMarker, canPatchAdaptiveViewport, canPatchMarkerInPlace, extractPointCoordinates, mergeAntimeridianFeatures, extractPolygonPaths, extractLineCoordinates, patchPortalDescriptors, collectFeatureIdSet, removeGoneIndexedMarkers, getAdaptiveDomFeatureIds, extractSourceData, buildAdaptiveDomRenderFn, resolveCircleSymbolDefaults, resolveSymbolDescriptor, buildAdaptiveSymbolStyleFn, createSymbolDotElement, anchorFromBottomCenter, createDefaultClusterElement, createClusterPinElement, fadeInElement, buildAdaptiveDomEntries, MAP_CURSORS, resolveSelectedStyle, resolveHoveredStyle, attachSafeAreaHoverListeners, INITIAL_MAP_STATE, DEFAULT_MAP_APPEARANCE, computeInitialState, getEffectiveRestrictBounds, cameraStateEquals, isEventOfType, DEFAULT_ZOOM, DEFAULT_CENTER, defineAdapter } from '@trackunit/react-map-adapter-shared';
5
6
  import { validateBbox, validatePosition } from '@trackunit/geo-json-utils';
6
7
  import { MarkerClusterer, SuperClusterAlgorithm } from '@googlemaps/markerclusterer';
7
8
  import { colorWithOpacity } from '@trackunit/react-map-color-utils';
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trackunit/react-map-adapter-google",
3
- "version": "0.0.118-alpha-12adfed37e0.0",
3
+ "version": "0.0.118",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/react-map-adapter-shared": "0.0.129-alpha-12adfed37e0.0",
11
- "@trackunit/react-map-color-utils": "0.0.107-alpha-12adfed37e0.0",
12
- "@trackunit/geo-json-utils": "1.15.47-alpha-12adfed37e0.0",
10
+ "@trackunit/react-map-adapter-shared": "0.0.129",
11
+ "@trackunit/react-map-color-utils": "0.0.107",
12
+ "@trackunit/geo-json-utils": "1.15.47",
13
13
  "@googlemaps/markerclusterer": "^2.6.2",
14
14
  "@vis.gl/react-google-maps": "^1.7.1",
15
15
  "es-toolkit": "^1.39.10",
@@ -0,0 +1 @@
1
+ export { googleMapCspDirectives } from "@trackunit/react-map-adapter-shared";
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { googleMapCspDirectives } from "./google-map-csp-directives";
1
2
  export { GoogleApiProvider } from "./GoogleApiProvider";
2
3
  export { googleMapsAdapter, type GoogleMapsConfig } from "./googleMapsAdapter";
3
4
  export { GoogleMapsAdapterInstance } from "./GoogleMapsAdapterInstance";