@mappedin/react-sdk 6.16.0 → 6.17.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/THIRD_PARTY_LICENSES.txt +24 -30
- package/lib/esm/index.js +1 -1
- package/package.json +2 -2
package/THIRD_PARTY_LICENSES.txt
CHANGED
|
@@ -1183,7 +1183,6 @@ IN THE SOFTWARE.
|
|
|
1183
1183
|
The following npm packages may be included in this product:
|
|
1184
1184
|
|
|
1185
1185
|
- statuses@1.5.0
|
|
1186
|
-
- statuses@2.0.1
|
|
1187
1186
|
- statuses@2.0.2
|
|
1188
1187
|
|
|
1189
1188
|
These packages each contain the following license:
|
|
@@ -1275,12 +1274,11 @@ THE SOFTWARE.
|
|
|
1275
1274
|
|
|
1276
1275
|
-----------
|
|
1277
1276
|
|
|
1278
|
-
The following npm
|
|
1277
|
+
The following npm package may be included in this product:
|
|
1279
1278
|
|
|
1280
|
-
- http-errors@2.0.0
|
|
1281
1279
|
- http-errors@2.0.1
|
|
1282
1280
|
|
|
1283
|
-
|
|
1281
|
+
This package contains the following license:
|
|
1284
1282
|
|
|
1285
1283
|
The MIT License (MIT)
|
|
1286
1284
|
|
|
@@ -2504,12 +2502,11 @@ SOFTWARE.
|
|
|
2504
2502
|
|
|
2505
2503
|
-----------
|
|
2506
2504
|
|
|
2507
|
-
The following npm
|
|
2505
|
+
The following npm package may be included in this product:
|
|
2508
2506
|
|
|
2509
|
-
- serve-static@1.16.2
|
|
2510
2507
|
- serve-static@1.16.3
|
|
2511
2508
|
|
|
2512
|
-
|
|
2509
|
+
This package contains the following license:
|
|
2513
2510
|
|
|
2514
2511
|
(The MIT License)
|
|
2515
2512
|
|
|
@@ -2729,12 +2726,11 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
2729
2726
|
|
|
2730
2727
|
-----------
|
|
2731
2728
|
|
|
2732
|
-
The following npm
|
|
2729
|
+
The following npm package may be included in this product:
|
|
2733
2730
|
|
|
2734
|
-
- send@0.19.0
|
|
2735
2731
|
- send@0.19.2
|
|
2736
2732
|
|
|
2737
|
-
|
|
2733
|
+
This package contains the following license:
|
|
2738
2734
|
|
|
2739
2735
|
(The MIT License)
|
|
2740
2736
|
|
|
@@ -9355,7 +9351,7 @@ SOFTWARE.
|
|
|
9355
9351
|
|
|
9356
9352
|
The following npm package may be included in this product:
|
|
9357
9353
|
|
|
9358
|
-
- es-toolkit@1.
|
|
9354
|
+
- es-toolkit@1.44.0
|
|
9359
9355
|
|
|
9360
9356
|
This package contains the following license:
|
|
9361
9357
|
|
|
@@ -13970,25 +13966,23 @@ Unlicense
|
|
|
13970
13966
|
|
|
13971
13967
|
The following npm packages may be included in this product:
|
|
13972
13968
|
|
|
13973
|
-
- @mappedin/mvf-annotations@3.0.0-
|
|
13974
|
-
- @mappedin/mvf-cms@3.0.0-
|
|
13975
|
-
- @mappedin/mvf-connections@3.0.0-
|
|
13976
|
-
- @mappedin/mvf-core@3.0.0-
|
|
13977
|
-
- @mappedin/mvf-
|
|
13978
|
-
- @mappedin/mvf-
|
|
13979
|
-
- @mappedin/mvf-
|
|
13980
|
-
- @mappedin/mvf-floor-
|
|
13981
|
-
- @mappedin/mvf-
|
|
13982
|
-
- @mappedin/mvf-
|
|
13983
|
-
- @mappedin/mvf-
|
|
13984
|
-
- @mappedin/mvf-
|
|
13985
|
-
- @mappedin/mvf-
|
|
13986
|
-
- @mappedin/mvf-
|
|
13987
|
-
- @mappedin/mvf-
|
|
13988
|
-
- @mappedin/mvf-
|
|
13989
|
-
- @mappedin/
|
|
13990
|
-
- @mappedin/typebox-fast-transform@1.0.0-0389ae7.0
|
|
13991
|
-
- @mappedin/typebox-fast-transform@1.0.0-84afe2f.0
|
|
13969
|
+
- @mappedin/mvf-annotations@3.0.0-a3a1700.0
|
|
13970
|
+
- @mappedin/mvf-cms@3.0.0-a3a1700.0
|
|
13971
|
+
- @mappedin/mvf-connections@3.0.0-a3a1700.0
|
|
13972
|
+
- @mappedin/mvf-core@3.0.0-a3a1700.0
|
|
13973
|
+
- @mappedin/mvf-default-style@3.0.0-a3a1700.0
|
|
13974
|
+
- @mappedin/mvf-facade@3.0.0-a3a1700.0
|
|
13975
|
+
- @mappedin/mvf-floor-images@3.0.0-a3a1700.0
|
|
13976
|
+
- @mappedin/mvf-floor-stacks@3.0.0-a3a1700.0
|
|
13977
|
+
- @mappedin/mvf-kinds@3.0.0-a3a1700.0
|
|
13978
|
+
- @mappedin/mvf-locations@3.0.0-a3a1700.0
|
|
13979
|
+
- @mappedin/mvf-navigation-flags@3.0.0-a3a1700.0
|
|
13980
|
+
- @mappedin/mvf-nodes@3.0.0-a3a1700.0
|
|
13981
|
+
- @mappedin/mvf-outdoors@3.0.0-a3a1700.0
|
|
13982
|
+
- @mappedin/mvf-tileset@3.0.0-a3a1700.0
|
|
13983
|
+
- @mappedin/mvf-traversability@3.0.0-a3a1700.0
|
|
13984
|
+
- @mappedin/mvf-v2@2.100.0-a3a1700.0
|
|
13985
|
+
- @mappedin/typebox-fast-transform@1.0.0-a3a1700.0
|
|
13992
13986
|
|
|
13993
13987
|
These packages each contain the following license:
|
|
13994
13988
|
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var le=Object.create;var k=Object.defineProperty,Me=Object.defineProperties,xe=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var z=(e,r,t)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,y=(e,r)=>{for(var t in r||(r={}))A.call(r,t)&&z(e,t,r[t]);if(L)for(var t of L(r))H.call(r,t)&&z(e,t,r[t]);return e},C=(e,r)=>Me(e,ye(r)),p=(e,r)=>k(e,"name",{value:r,configurable:!0});var U=(e,r)=>{var t={};for(var a in e)A.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&L)for(var a of L(e))r.indexOf(a)<0&&H.call(e,a)&&(t[a]=e[a]);return t};var Ee=(e,r)=>()=>(e&&(r=e(e=0)),r);var Pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ge=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of we(r))!A.call(e,o)&&o!==t&&k(e,o,{get:()=>r[o],enumerable:!(a=xe(r,o))||a.enumerable});return e};var q=(e,r,t)=>(t=e!=null?le(he(e)):{},ge(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e));var u,n=Ee(()=>{u={env:{NODE_ENV:"production",npm_package_version:"6.16.0"}}});var I=Pe((Ht,K)=>{"use strict";n();K.exports=p(function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var a,o,s;if(Array.isArray(r)){if(a=r.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(s=Object.keys(r),a=s.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=a;o--!==0;){var i=s[o];if(!e(r[i],t[i]))return!1}return!0}return r!==r&&t!==t},"equal")});n();n();import Se,{createContext as Ve,useCallback as F,useMemo as Te,useRef as ve}from"react";var S=Ve({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function j({mapData:e,children:r}){let t=ve(e?{mapData:e,options:{}}:void 0),a=F(()=>t.current,[]),o=F(i=>{t.current=i},[]),s=Te(()=>({getCache:a,setCache:o}),[a,o]);return Se.createElement(S.Provider,{value:s},r)}p(j,"MapDataProvider");n();var X=q(I());import{useCallback as Ne,useContext as Le,useEffect as Q,useRef as ke,useState as J}from"react";import{getMapData as be}from"@mappedin/mappedin-js";n();var Re="[MappedinJS]";function Ce(e="",{prefix:r=Re}={}){let t="".concat(r).concat(e?"-".concat(e):""),a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?"".concat(M.message,"\n").concat(M.stack):M);window.rnDebug("".concat(e," ").concat(o,": ").concat(i.join(" ")))}},"rnDebug");return{logState:u.env.NODE_ENV==="test"?3:0,log(...o){this.logState<=0&&(console.log(t,...o),a("log",o))},warn(...o){this.logState<=1&&(console.warn(t,...o),a("warn",o))},error(...o){this.logState<=2&&(console.error(t,...o),a("error",o))},assert(...o){console.assert(...o)},time(o){console.time(o)},timeEnd(o){console.timeEnd(o)},setLevel(o){0<=o&&o<=3&&(this.logState=o)}}}p(Ce,"createLogger");var Oe=Ce();var T=Oe;n();var Y=q(I());import{useRef as B}from"react";function l(e,r){let t=B(void 0),a=B(void 0);return(0,Y.default)(r,a.current)||(t.current=e(),a.current=r),t.current}p(l,"useMemoDeep");function Ae(e){let{getCache:r,setCache:t}=Le(S),[a,o]=J(void 0),[s,i]=J(!0),[M,m]=J(void 0),g=ke(0),d=l(()=>e&&C(y({},e),{analytics:y({context:"reactsdk"},e==null?void 0:e.analytics)}),[e]),V=Ne(w=>{let D=++g.current;i(!0),m(void 0),be(w).then(h=>{g.current===D&&o(h)}).catch(h=>{g.current===D&&(T.error("Failed to fetch MapData",h),m(h))}).finally(()=>{g.current===D&&i(!1)})},[]);return Q(()=>{let w=r==null?void 0:r();if(w!=null&&(d==null||w.mapData.mapId===d.mapId&&(0,X.default)(w.options,d))){o(w.mapData),i(!1),m(void 0);return}if(!d){m(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}V(d)},[V,r,d]),Q(()=>{let w=r==null?void 0:r();a!=null&&(w==null||w.mapData.mapId===a.mapId)&&(t==null||t({mapData:a,options:d||{}}))},[a,d,r,t]),{mapData:a,isLoading:s,error:M}}p(Ae,"useMapData");n();import{useCallback as je,useContext as Ie,useEffect as Je}from"react";function We(e,r){let{getCache:t}=Ie(S),a=je(o=>r(o),[r]);Je(()=>{var s;let o=(s=t==null?void 0:t())==null?void 0:s.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o!=null&&o.off(e,a)}},[t,e,a])}p(We,"useMapDataEvent");n();import O,{useCallback as Z,useEffect as _e,useMemo as ee,useRef as te,useState as re,forwardRef as Ge,useImperativeHandle as $e,createContext as ze}from"react";import{show3dMap as He}from"@mappedin/mappedin-js";var f=ze({mapView:void 0,extensions:{}}),Ue={width:"100%",height:"100%",position:"relative"},qe=Ge((e,r)=>{let $=e,{mapData:t,options:a,style:o,fallback:s,children:i}=$,M=U($,["mapData","options","style","fallback","children"]),m=te({extensions:{}}).current,[g,d]=re(!0),[V,w]=re(!1),D=te(null),h=ee(()=>t,[t]),G=l(()=>a,[a]);$e(r,()=>m.mapView);let ce=ee(()=>({mapView:m.mapView,extensions:m.extensions}),[h,m.mapView,m.extensions]),de=Z(E=>{try{let x=Object.keys(E);for(let v of x){let R=E[v];R&&(R.onDeregister(R.instance),delete E[v])}}catch(x){T.error("Failed to clean up extensions",x)}return{}},[]),N=Z(E=>{var v;let x=E||m.mapView;try{(v=x==null?void 0:x.destroy)==null||v.call(x)}catch(R){T.error("Failed to destroy MapView",R)}E||(m.extensions=de(m.extensions),m.mapView=void 0,w(!1))},[]);return _e(()=>{if(!h||!D.current)return;N();let E=!1;return d(!0),He(D.current,h,G).then(x=>{E?N(x):(m.mapView=x,w(!0))}).catch(x=>{T.error("Failed to render MapView",x)}).finally(()=>{E||d(!1)}),()=>{E=!0,m.mapView&&N()}},[h,G,N]),O.createElement(j,{mapData:h},O.createElement(f.Provider,{value:ce},O.createElement("div",y({"data-testid":"mappedin-map",ref:D,style:y(y({},Ue),o)},M)),g?O.createElement(O.Fragment,null,s):V?i:null))});n();import{useCallback as Fe,useContext as Ke,useEffect as Be}from"react";n();var W=class W extends Error{constructor(r){super("".concat(r," must be used within a MapView component."))}};p(W,"MapViewNullError");var c=W;function Ye(e,r){let{mapView:t}=Ke(f),a=Fe(o=>r(o),[r]);Be(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t!=null&&t.off(e,a)}},[t,e,r])}p(Ye,"useMapViewEvent");n();import{useCallback as ae,useContext as Qe}from"react";function Xe(e,r){let{extensions:t}=Qe(f);if(!(r!=null&&r.onRegister)||!(r!=null&&r.onDeregister))throw new Error("onRegister and onDeregister are required");let a=ae(()=>{let s=t[e],i=s==null?void 0:s.instance;return i||(i=r.onRegister(),t[e]={instance:i,onDeregister:r.onDeregister}),i},[t,e,r.onRegister]),o=ae(()=>{let s=t[e];s&&(s.onDeregister(s.instance),delete t[e])},[t,e,r.onDeregister]);return{register:a,deregister:o}}p(Xe,"useMapViewExtension");n();import{useContext as tt,useEffect as rt,useRef as at,forwardRef as ot,useImperativeHandle as nt,useState as it}from"react";n();import{useEffect as Ze,useRef as et}from"react";function P(e,r){let t=et(!0);Ze(()=>{if(t.current){t.current=!1;return}return e()},r)}p(P,"useUpdateEffect");var st=ot((e,r)=>{let{mapView:t}=tt(f),a=at(void 0),o=l(()=>e.options,[e.options]),[s,i]=it(!1);return nt(r,()=>a.current,[s]),rt(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{var m;(m=e.onDrawComplete)==null||m.call(e)}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as pt,useEffect as mt}from"react";function ut(e){let{mapView:r}=pt(f),t=l(()=>e.options,[e.options]);return mt(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{var a;(a=e.onDrawComplete)==null||a.call(e)}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}p(ut,"Navigation");n();import{useContext as ft,useEffect as ct,useRef as dt,forwardRef as lt,useImperativeHandle as Mt,useState as xt}from"react";var yt=lt((e,r)=>{let{mapView:t}=ft(f),a=dt(void 0),o=l(()=>e.style,[e.style]),[s,i]=xt(!1);return Mt(r,()=>a.current,[s]),ct(()=>{if(t==null)throw new Error("MapView not initialized");return a.current=t.Shapes.add(e.geometry,e.style,e.floor),i(!0),()=>{t==null||a.current==null||(t.Shapes.remove(a.current),i(!1))}},[t,e.geometry,e.style,e.floor]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as wt,useEffect as ht,useRef as Et,forwardRef as Pt,useImperativeHandle as gt,useState as Dt}from"react";var St=Pt((e,r)=>{let{mapView:t}=wt(f),a=Et(void 0),o=l(()=>e.options,[e.options]),[s,i]=Dt(!1);return gt(r,()=>a.current,[s]),ht(()=>{if(t==null)throw new c("Model");return a.current=t.Models.add(e.coordinate,e.url,o),i(!0),()=>{t==null||a.current==null||(t.Models.remove(a.current),i(!1))}},[t,e.url]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({position:e.coordinate},o)))},[e.coordinate,o]),null});n();import{useContext as oe}from"react";function Vt(){var t;let{mapView:e}=oe(f),{getCache:r}=oe(S);if(!e)throw new c("useMap");return{mapData:((t=r==null?void 0:r())==null?void 0:t.mapData)||e.getMapData(),mapView:e}}p(Vt,"useMap");n();import Tt,{useCallback as vt,useContext as ie,useEffect as se,useMemo as Rt,useRef as b,forwardRef as pe,useImperativeHandle as me,useState as ue}from"react";import{createPortal as Ct}from"react-dom";n();var _=[0,4,6,8,10],ne=p(()=>{let e=new Array(16).fill(0),r=Math.random()*4294967296;for(let a=0;a<e.length;a++)a>0&&(a&3)===0&&(r=Math.random()*4294967296),e[a]=r>>>((a&3)<<3)&255;let t=e.map(a=>a.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],_.map((a,o)=>t.slice(a,o===_.length-1?void 0:_[o+1]).join("")).join("-")},"randomId");var fe=pe((e,r)=>{let{mapView:t}=ie(f),a=b(void 0),[o,s]=ue(!1),i=l(()=>e.options,[e.options]);return me(r,()=>a.current,[o]),se(()=>{if(t==null)throw new c("Marker");return a.current=t.Markers.add(e.target,"",i),s(!0),()=>{t==null||a.current==null||(t.Markers.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&i&&(t==null||t.updateState(a.current,i))},[i]),t==null||a.current==null?null:Ct(e.children,a.current.contentEl,a.current.id)}),Ot=pe((e,r)=>{let{mapView:t}=ie(f),a=b(ne()),o=b(void 0),[s,i]=ue(!1),M=b(e.target);me(r,()=>o.current,[s]);let m=vt(d=>{o.current=d||void 0,i(!!d)},[]);se(()=>{if(t==null)throw new c("Marker");if(o.current&&o.current.target!==e.target){let{duration:d=300,easing:V="linear"}=e;t.Markers.animateTo(o.current,e.target,{duration:d,easing:V})}return()=>{i(!1)}},[t,e.target]);let g=Rt(()=>C(y({},e),{duration:void 0,easing:void 0}),[e.duration,e.easing]);return Tt.createElement(fe,C(y({},g),{key:a.current,target:M.current,ref:m}))});n();import{forwardRef as Nt,useContext as Lt,useEffect as kt,useImperativeHandle as bt,useRef as At,useState as jt}from"react";var It=Nt((e,r)=>{let{mapView:t}=Lt(f),a=At(void 0),[o,s]=jt(!1),i=l(()=>e.options,[e.options]);return bt(r,()=>a.current,[o]),kt(()=>{if(t==null)throw new c("Label");return a.current=t.Labels.add(e.target,e.text,i),s(!0),()=>{t==null||a.current==null||(t.Labels.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({text:e.text},i)))},[e.text,i]),null});export{Ot as AnimatedMarker,It as Label,j as MapDataProvider,qe as MapView,fe as Marker,St as Model,ut as Navigation,st as Path,yt as Shape,Vt as useMap,Ae as useMapData,We as useMapDataEvent,Ye as useMapViewEvent,Xe as useMapViewExtension};
|
|
1
|
+
var le=Object.create;var k=Object.defineProperty,Me=Object.defineProperties,xe=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var z=(e,r,t)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,y=(e,r)=>{for(var t in r||(r={}))A.call(r,t)&&z(e,t,r[t]);if(L)for(var t of L(r))H.call(r,t)&&z(e,t,r[t]);return e},C=(e,r)=>Me(e,ye(r)),p=(e,r)=>k(e,"name",{value:r,configurable:!0});var U=(e,r)=>{var t={};for(var a in e)A.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&L)for(var a of L(e))r.indexOf(a)<0&&H.call(e,a)&&(t[a]=e[a]);return t};var Ee=(e,r)=>()=>(e&&(r=e(e=0)),r);var Pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ge=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of we(r))!A.call(e,o)&&o!==t&&k(e,o,{get:()=>r[o],enumerable:!(a=xe(r,o))||a.enumerable});return e};var q=(e,r,t)=>(t=e!=null?le(he(e)):{},ge(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e));var u,n=Ee(()=>{u={env:{NODE_ENV:"production",npm_package_version:"6.17.0"}}});var I=Pe((Ht,K)=>{"use strict";n();K.exports=p(function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var a,o,s;if(Array.isArray(r)){if(a=r.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(s=Object.keys(r),a=s.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=a;o--!==0;){var i=s[o];if(!e(r[i],t[i]))return!1}return!0}return r!==r&&t!==t},"equal")});n();n();import Se,{createContext as Ve,useCallback as F,useMemo as Te,useRef as ve}from"react";var S=Ve({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function j({mapData:e,children:r}){let t=ve(e?{mapData:e,options:{}}:void 0),a=F(()=>t.current,[]),o=F(i=>{t.current=i},[]),s=Te(()=>({getCache:a,setCache:o}),[a,o]);return Se.createElement(S.Provider,{value:s},r)}p(j,"MapDataProvider");n();var X=q(I());import{useCallback as Ne,useContext as Le,useEffect as Q,useRef as ke,useState as J}from"react";import{getMapData as be}from"@mappedin/mappedin-js";n();var Re="[MappedinJS]";function Ce(e="",{prefix:r=Re}={}){let t="".concat(r).concat(e?"-".concat(e):""),a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?"".concat(M.message,"\n").concat(M.stack):M);window.rnDebug("".concat(e," ").concat(o,": ").concat(i.join(" ")))}},"rnDebug");return{logState:u.env.NODE_ENV==="test"?3:0,log(...o){this.logState<=0&&(console.log(t,...o),a("log",o))},warn(...o){this.logState<=1&&(console.warn(t,...o),a("warn",o))},error(...o){this.logState<=2&&(console.error(t,...o),a("error",o))},assert(...o){console.assert(...o)},time(o){console.time(o)},timeEnd(o){console.timeEnd(o)},setLevel(o){0<=o&&o<=3&&(this.logState=o)}}}p(Ce,"createLogger");var Oe=Ce();var T=Oe;n();var Y=q(I());import{useRef as B}from"react";function l(e,r){let t=B(void 0),a=B(void 0);return(0,Y.default)(r,a.current)||(t.current=e(),a.current=r),t.current}p(l,"useMemoDeep");function Ae(e){let{getCache:r,setCache:t}=Le(S),[a,o]=J(void 0),[s,i]=J(!0),[M,m]=J(void 0),g=ke(0),d=l(()=>e&&C(y({},e),{analytics:y({context:"reactsdk"},e==null?void 0:e.analytics)}),[e]),V=Ne(w=>{let D=++g.current;i(!0),m(void 0),be(w).then(h=>{g.current===D&&o(h)}).catch(h=>{g.current===D&&(T.error("Failed to fetch MapData",h),m(h))}).finally(()=>{g.current===D&&i(!1)})},[]);return Q(()=>{let w=r==null?void 0:r();if(w!=null&&(d==null||w.mapData.mapId===d.mapId&&(0,X.default)(w.options,d))){o(w.mapData),i(!1),m(void 0);return}if(!d){m(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}V(d)},[V,r,d]),Q(()=>{let w=r==null?void 0:r();a!=null&&(w==null||w.mapData.mapId===a.mapId)&&(t==null||t({mapData:a,options:d||{}}))},[a,d,r,t]),{mapData:a,isLoading:s,error:M}}p(Ae,"useMapData");n();import{useCallback as je,useContext as Ie,useEffect as Je}from"react";function We(e,r){let{getCache:t}=Ie(S),a=je(o=>r(o),[r]);Je(()=>{var s;let o=(s=t==null?void 0:t())==null?void 0:s.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o!=null&&o.off(e,a)}},[t,e,a])}p(We,"useMapDataEvent");n();import O,{useCallback as Z,useEffect as _e,useMemo as ee,useRef as te,useState as re,forwardRef as Ge,useImperativeHandle as $e,createContext as ze}from"react";import{show3dMap as He}from"@mappedin/mappedin-js";var f=ze({mapView:void 0,extensions:{}}),Ue={width:"100%",height:"100%",position:"relative"},qe=Ge((e,r)=>{let $=e,{mapData:t,options:a,style:o,fallback:s,children:i}=$,M=U($,["mapData","options","style","fallback","children"]),m=te({extensions:{}}).current,[g,d]=re(!0),[V,w]=re(!1),D=te(null),h=ee(()=>t,[t]),G=l(()=>a,[a]);$e(r,()=>m.mapView);let ce=ee(()=>({mapView:m.mapView,extensions:m.extensions}),[h,m.mapView,m.extensions]),de=Z(E=>{try{let x=Object.keys(E);for(let v of x){let R=E[v];R&&(R.onDeregister(R.instance),delete E[v])}}catch(x){T.error("Failed to clean up extensions",x)}return{}},[]),N=Z(E=>{var v;let x=E||m.mapView;try{(v=x==null?void 0:x.destroy)==null||v.call(x)}catch(R){T.error("Failed to destroy MapView",R)}E||(m.extensions=de(m.extensions),m.mapView=void 0,w(!1))},[]);return _e(()=>{if(!h||!D.current)return;N();let E=!1;return d(!0),He(D.current,h,G).then(x=>{E?N(x):(m.mapView=x,w(!0))}).catch(x=>{T.error("Failed to render MapView",x)}).finally(()=>{E||d(!1)}),()=>{E=!0,m.mapView&&N()}},[h,G,N]),O.createElement(j,{mapData:h},O.createElement(f.Provider,{value:ce},O.createElement("div",y({"data-testid":"mappedin-map",ref:D,style:y(y({},Ue),o)},M)),g?O.createElement(O.Fragment,null,s):V?i:null))});n();import{useCallback as Fe,useContext as Ke,useEffect as Be}from"react";n();var W=class W extends Error{constructor(r){super("".concat(r," must be used within a MapView component."))}};p(W,"MapViewNullError");var c=W;function Ye(e,r){let{mapView:t}=Ke(f),a=Fe(o=>r(o),[r]);Be(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t!=null&&t.off(e,a)}},[t,e,r])}p(Ye,"useMapViewEvent");n();import{useCallback as ae,useContext as Qe}from"react";function Xe(e,r){let{extensions:t}=Qe(f);if(!(r!=null&&r.onRegister)||!(r!=null&&r.onDeregister))throw new Error("onRegister and onDeregister are required");let a=ae(()=>{let s=t[e],i=s==null?void 0:s.instance;return i||(i=r.onRegister(),t[e]={instance:i,onDeregister:r.onDeregister}),i},[t,e,r.onRegister]),o=ae(()=>{let s=t[e];s&&(s.onDeregister(s.instance),delete t[e])},[t,e,r.onDeregister]);return{register:a,deregister:o}}p(Xe,"useMapViewExtension");n();import{useContext as tt,useEffect as rt,useRef as at,forwardRef as ot,useImperativeHandle as nt,useState as it}from"react";n();import{useEffect as Ze,useRef as et}from"react";function P(e,r){let t=et(!0);Ze(()=>{if(t.current){t.current=!1;return}return e()},r)}p(P,"useUpdateEffect");var st=ot((e,r)=>{let{mapView:t}=tt(f),a=at(void 0),o=l(()=>e.options,[e.options]),[s,i]=it(!1);return nt(r,()=>a.current,[s]),rt(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{var m;(m=e.onDrawComplete)==null||m.call(e)}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as pt,useEffect as mt}from"react";function ut(e){let{mapView:r}=pt(f),t=l(()=>e.options,[e.options]);return mt(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{var a;(a=e.onDrawComplete)==null||a.call(e)}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}p(ut,"Navigation");n();import{useContext as ft,useEffect as ct,useRef as dt,forwardRef as lt,useImperativeHandle as Mt,useState as xt}from"react";var yt=lt((e,r)=>{let{mapView:t}=ft(f),a=dt(void 0),o=l(()=>e.style,[e.style]),[s,i]=xt(!1);return Mt(r,()=>a.current,[s]),ct(()=>{if(t==null)throw new Error("MapView not initialized");return a.current=t.Shapes.add(e.geometry,e.style,e.floor),i(!0),()=>{t==null||a.current==null||(t.Shapes.remove(a.current),i(!1))}},[t,e.geometry,e.style,e.floor]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as wt,useEffect as ht,useRef as Et,forwardRef as Pt,useImperativeHandle as gt,useState as Dt}from"react";var St=Pt((e,r)=>{let{mapView:t}=wt(f),a=Et(void 0),o=l(()=>e.options,[e.options]),[s,i]=Dt(!1);return gt(r,()=>a.current,[s]),ht(()=>{if(t==null)throw new c("Model");return a.current=t.Models.add(e.coordinate,e.url,o),i(!0),()=>{t==null||a.current==null||(t.Models.remove(a.current),i(!1))}},[t,e.url]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({position:e.coordinate},o)))},[e.coordinate,o]),null});n();import{useContext as oe}from"react";function Vt(){var t;let{mapView:e}=oe(f),{getCache:r}=oe(S);if(!e)throw new c("useMap");return{mapData:((t=r==null?void 0:r())==null?void 0:t.mapData)||e.getMapData(),mapView:e}}p(Vt,"useMap");n();import Tt,{useCallback as vt,useContext as ie,useEffect as se,useMemo as Rt,useRef as b,forwardRef as pe,useImperativeHandle as me,useState as ue}from"react";import{createPortal as Ct}from"react-dom";n();var _=[0,4,6,8,10],ne=p(()=>{let e=new Array(16).fill(0),r=Math.random()*4294967296;for(let a=0;a<e.length;a++)a>0&&(a&3)===0&&(r=Math.random()*4294967296),e[a]=r>>>((a&3)<<3)&255;let t=e.map(a=>a.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],_.map((a,o)=>t.slice(a,o===_.length-1?void 0:_[o+1]).join("")).join("-")},"randomId");var fe=pe((e,r)=>{let{mapView:t}=ie(f),a=b(void 0),[o,s]=ue(!1),i=l(()=>e.options,[e.options]);return me(r,()=>a.current,[o]),se(()=>{if(t==null)throw new c("Marker");return a.current=t.Markers.add(e.target,"",i),s(!0),()=>{t==null||a.current==null||(t.Markers.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&i&&(t==null||t.updateState(a.current,i))},[i]),t==null||a.current==null?null:Ct(e.children,a.current.contentEl,a.current.id)}),Ot=pe((e,r)=>{let{mapView:t}=ie(f),a=b(ne()),o=b(void 0),[s,i]=ue(!1),M=b(e.target);me(r,()=>o.current,[s]);let m=vt(d=>{o.current=d||void 0,i(!!d)},[]);se(()=>{if(t==null)throw new c("Marker");if(o.current&&o.current.target!==e.target){let{duration:d=300,easing:V="linear"}=e;t.Markers.animateTo(o.current,e.target,{duration:d,easing:V})}return()=>{i(!1)}},[t,e.target]);let g=Rt(()=>C(y({},e),{duration:void 0,easing:void 0}),[e.duration,e.easing]);return Tt.createElement(fe,C(y({},g),{key:a.current,target:M.current,ref:m}))});n();import{forwardRef as Nt,useContext as Lt,useEffect as kt,useImperativeHandle as bt,useRef as At,useState as jt}from"react";var It=Nt((e,r)=>{let{mapView:t}=Lt(f),a=At(void 0),[o,s]=jt(!1),i=l(()=>e.options,[e.options]);return bt(r,()=>a.current,[o]),kt(()=>{if(t==null)throw new c("Label");return a.current=t.Labels.add(e.target,e.text,i),s(!0),()=>{t==null||a.current==null||(t.Labels.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({text:e.text},i)))},[e.text,i]),null});export{Ot as AnimatedMarker,It as Label,j as MapDataProvider,qe as MapView,fe as Marker,St as Model,ut as Navigation,st as Path,yt as Shape,Vt as useMap,Ae as useMapData,We as useMapDataEvent,Ye as useMapViewEvent,Xe as useMapViewExtension};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/react-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.17.0",
|
|
4
4
|
"homepage": "https://developer.mappedin.com/",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/esm/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": ">=16.8.0",
|
|
19
19
|
"react-dom": ">=16.8.0",
|
|
20
|
-
"@mappedin/mappedin-js": "^6.
|
|
20
|
+
"@mappedin/mappedin-js": "^6.17.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {},
|
|
23
23
|
"devDependencies": {},
|