@mappedin/react-sdk 6.19.0 → 6.20.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.
@@ -5458,6 +5458,45 @@ THE SOFTWARE.
5458
5458
 
5459
5459
  -----------
5460
5460
 
5461
+ The following npm package may be included in this product:
5462
+
5463
+ - fast-uri@3.1.2
5464
+
5465
+ This package contains the following license:
5466
+
5467
+ Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
5468
+ Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
5469
+ All rights reserved.
5470
+
5471
+ Redistribution and use in source and binary forms, with or without
5472
+ modification, are permitted provided that the following conditions are met:
5473
+ * Redistributions of source code must retain the above copyright
5474
+ notice, this list of conditions and the following disclaimer.
5475
+ * Redistributions in binary form must reproduce the above copyright
5476
+ notice, this list of conditions and the following disclaimer in the
5477
+ documentation and/or other materials provided with the distribution.
5478
+ * The names of any contributors may not be used to endorse or promote
5479
+ products derived from this software without specific prior written
5480
+ permission.
5481
+
5482
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
5483
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
5484
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5485
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
5486
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
5487
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
5488
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
5489
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5490
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
5491
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5492
+
5493
+ * * *
5494
+
5495
+ The complete list of contributors can be found at:
5496
+ - https://github.com/garycourt/uri-js/graphs/contributors
5497
+
5498
+ -----------
5499
+
5461
5500
  The following npm package may be included in this product:
5462
5501
 
5463
5502
  - setimmediate@1.0.5
@@ -6627,45 +6666,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6627
6666
 
6628
6667
  -----------
6629
6668
 
6630
- The following npm package may be included in this product:
6631
-
6632
- - fast-uri@3.0.6
6633
-
6634
- This package contains the following license:
6635
-
6636
- Copyright (c) 2021 The Fastify Team
6637
- Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
6638
- All rights reserved.
6639
-
6640
- Redistribution and use in source and binary forms, with or without
6641
- modification, are permitted provided that the following conditions are met:
6642
- * Redistributions of source code must retain the above copyright
6643
- notice, this list of conditions and the following disclaimer.
6644
- * Redistributions in binary form must reproduce the above copyright
6645
- notice, this list of conditions and the following disclaimer in the
6646
- documentation and/or other materials provided with the distribution.
6647
- * The names of any contributors may not be used to endorse or promote
6648
- products derived from this software without specific prior written
6649
- permission.
6650
-
6651
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
6652
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6653
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6654
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
6655
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
6656
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
6657
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
6658
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
6659
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
6660
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6661
-
6662
- * * *
6663
-
6664
- The complete list of contributors can be found at:
6665
- - https://github.com/garycourt/uri-js/graphs/contributors
6666
-
6667
- -----------
6668
-
6669
6669
  The following npm package may be included in this product:
6670
6670
 
6671
6671
  - @mappedin/outdoor-context@5.6.1-v6-95bb923.0
@@ -7253,7 +7253,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
7253
7253
 
7254
7254
  The following npm package may be included in this product:
7255
7255
 
7256
- - @xmldom/xmldom@0.8.11
7256
+ - @xmldom/xmldom@0.8.13
7257
7257
 
7258
7258
  This package contains the following license:
7259
7259
 
package/lib/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var ie=Object.create;var N=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var p=(e,r)=>N(e,"name",{value:r,configurable:!0});var fe=(e,r)=>()=>(e&&(r=e(e=0)),r);var ce=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var de=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of pe(r))!ue.call(e,o)&&o!==t&&N(e,o,{get:()=>r[o],enumerable:!(a=se(r,o))||a.enumerable});return e};var J=(e,r,t)=>(t=e!=null?ie(me(e)):{},de(r||!e||!e.__esModule?N(t,"default",{value:e,enumerable:!0}):t,e));var m,n=fe(()=>{m={env:{NODE_ENV:"production",npm_package_version:"6.19.0"}}});var k=ce((At,_)=>{"use strict";n();_.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 Me,{createContext as ye,useCallback as W,useMemo as xe,useRef as we}from"react";var P=ye({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function L({mapData:e,children:r}){let t=we(e?{mapData:e,options:{}}:void 0),a=W(()=>t.current,[]),o=W(i=>{t.current=i},[]),s=xe(()=>({getCache:a,setCache:o}),[a,o]);return Me.createElement(P.Provider,{value:s},r)}p(L,"MapDataProvider");n();var H=J(k());import{useCallback as Ee,useContext as Pe,useEffect as z,useRef as Ve,useState as b}from"react";import{getMapData as Se}from"@mappedin/mappedin-js";n();var he="[MappedinJS]";function ge(e="",{prefix:r=he}={}){let t=`${r}${e?`-${e}`:""}`,a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?`${M.message}
1
+ var ie=Object.create;var N=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty;var p=(e,r)=>N(e,"name",{value:r,configurable:!0});var fe=(e,r)=>()=>(e&&(r=e(e=0)),r);var ce=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var de=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of pe(r))!ue.call(e,o)&&o!==t&&N(e,o,{get:()=>r[o],enumerable:!(a=se(r,o))||a.enumerable});return e};var J=(e,r,t)=>(t=e!=null?ie(me(e)):{},de(r||!e||!e.__esModule?N(t,"default",{value:e,enumerable:!0}):t,e));var m,n=fe(()=>{m={env:{NODE_ENV:"production",npm_package_version:"6.20.0"}}});var k=ce((At,_)=>{"use strict";n();_.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 Me,{createContext as ye,useCallback as W,useMemo as xe,useRef as we}from"react";var P=ye({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function L({mapData:e,children:r}){let t=we(e?{mapData:e,options:{}}:void 0),a=W(()=>t.current,[]),o=W(i=>{t.current=i},[]),s=xe(()=>({getCache:a,setCache:o}),[a,o]);return Me.createElement(P.Provider,{value:s},r)}p(L,"MapDataProvider");n();var H=J(k());import{useCallback as Ee,useContext as Pe,useEffect as z,useRef as Ve,useState as b}from"react";import{getMapData as Se}from"@mappedin/mappedin-js";n();var he="[MappedinJS]";function ge(e="",{prefix:r=he}={}){let t=`${r}${e?`-${e}`:""}`,a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?`${M.message}
2
2
  ${M.stack}`:M);window.rnDebug(`${e} ${o}: ${i.join(" ")}`)}},"rnDebug");return{logState:m.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(ge,"createLogger");var De=ge();var S=De;n();var $=J(k());import{useRef as G}from"react";function l(e,r){let t=G(void 0),a=G(void 0);return(0,$.default)(r,a.current)||(t.current=e(),a.current=r),t.current}p(l,"useMemoDeep");function Te(e){let{getCache:r,setCache:t}=Pe(P),[a,o]=b(void 0),[s,i]=b(!0),[M,f]=b(void 0),D=Ve(0),d=l(()=>e&&{...e,analytics:{context:"reactsdk",...e?.analytics}},[e]),V=Ee(y=>{let E=++D.current;i(!0),f(void 0),Se(y).then(x=>{D.current===E&&o(x)}).catch(x=>{D.current===E&&(S.error("Failed to fetch MapData",x),f(x))}).finally(()=>{D.current===E&&i(!1)})},[]);return z(()=>{let y=r?.();if(y!=null&&(d==null||y.mapData.mapId===d.mapId&&(0,H.default)(y.options,d))){o(y.mapData),i(!1),f(void 0);return}if(!d){f(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}V(d)},[V,r,d]),z(()=>{let y=r?.();a!=null&&(y==null||y.mapData.mapId===a.mapId)&&t?.({mapData:a,options:d||{}})},[a,d,r,t]),{mapData:a,isLoading:s,error:M}}p(Te,"useMapData");n();import{useCallback as Ce,useContext as ve,useEffect as Re}from"react";function Oe(e,r){let{getCache:t}=ve(P),a=Ce(o=>r(o),[r]);Re(()=>{let o=t?.()?.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o?.off(e,a)}},[t,e,a])}p(Oe,"useMapDataEvent");n();import T,{useCallback as U,useEffect as Ne,useMemo as q,useRef as F,useState as K,forwardRef as Le,useImperativeHandle as ke,createContext as be}from"react";import{show3dMap as Ae}from"@mappedin/mappedin-js";var u=be({mapView:void 0,extensions:{}}),je={width:"100%",height:"100%",position:"relative"},Ie=Le((e,r)=>{let{mapData:t,options:a,style:o,fallback:s,children:i,...M}=e,f=F({extensions:{}}).current,[D,d]=K(!0),[V,y]=K(!1),E=F(null),x=q(()=>t,[t]),I=l(()=>a,[a]);ke(r,()=>f.mapView);let oe=q(()=>({mapView:f.mapView,extensions:f.extensions}),[x,f.mapView,f.extensions]),ne=U(w=>{try{let h=Object.keys(w);for(let v of h){let O=w[v];O&&(O.onDeregister(O.instance),delete w[v])}}catch(h){S.error("Failed to clean up extensions",h)}return{}},[]),C=U(w=>{let h=w||f.mapView;try{h?.destroy?.()}catch(v){S.error("Failed to destroy MapView",v)}w||(f.extensions=ne(f.extensions),f.mapView=void 0,y(!1))},[]);return Ne(()=>{if(!x||!E.current)return;C();let w=!1;return d(!0),Ae(E.current,x,I).then(h=>{w?C(h):(f.mapView=h,y(!0))}).catch(h=>{S.error("Failed to render MapView",h)}).finally(()=>{w||d(!1)}),()=>{w=!0,f.mapView&&C()}},[x,I,C]),T.createElement(L,{mapData:x},T.createElement(u.Provider,{value:oe},T.createElement("div",{"data-testid":"mappedin-map",ref:E,style:{...je,...o},...M}),D?T.createElement(T.Fragment,null,s):V?i:null))});n();import{useCallback as Je,useContext as We,useEffect as _e}from"react";n();var A=class A extends Error{constructor(r){super(`${r} must be used within a MapView component.`)}};p(A,"MapViewNullError");var c=A;function Ge(e,r){let{mapView:t}=We(u),a=Je(o=>r(o),[r]);_e(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t?.off(e,a)}},[t,e,r])}p(Ge,"useMapViewEvent");n();import{useCallback as B,useContext as $e}from"react";function ze(e,r){let{extensions:t}=$e(u);if(!r?.onRegister||!r?.onDeregister)throw new Error("onRegister and onDeregister are required");let a=B(()=>{let i=t[e]?.instance;return i||(i=r.onRegister(),t[e]={instance:i,onDeregister:r.onDeregister}),i},[t,e,r.onRegister]),o=B(()=>{let s=t[e];s&&(s.onDeregister(s.instance),delete t[e])},[t,e,r.onDeregister]);return{register:a,deregister:o}}p(ze,"useMapViewExtension");n();import{useContext as qe,useEffect as Fe,useRef as Ke,forwardRef as Be,useImperativeHandle as Ye,useState as Qe}from"react";n();import{useEffect as He,useRef as Ue}from"react";function g(e,r){let t=Ue(!0);He(()=>{if(t.current){t.current=!1;return}return e()},r)}p(g,"useUpdateEffect");var Xe=Be((e,r)=>{let{mapView:t}=qe(u),a=Ke(void 0),o=l(()=>e.options,[e.options]),[s,i]=Qe(!1);return Ye(r,()=>a.current,[s]),Fe(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{e.onDrawComplete?.()}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),g(()=>{a.current&&o&&t?.updateState(a.current,o)},[o]),null});n();import{useContext as Ze,useEffect as et}from"react";function tt(e){let{mapView:r}=Ze(u),t=l(()=>e.options,[e.options]);return et(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{e.onDrawComplete?.()}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}p(tt,"Navigation");n();import{useContext as rt,useEffect as at,useRef as ot,forwardRef as nt,useImperativeHandle as it,useState as st}from"react";var pt=nt((e,r)=>{let{mapView:t}=rt(u),a=ot(void 0),o=l(()=>e.style,[e.style]),[s,i]=st(!1);return it(r,()=>a.current,[s]),at(()=>{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]),g(()=>{a.current&&o&&t?.updateState(a.current,o)},[o]),null});n();import{useContext as mt,useEffect as ut,useRef as ft,forwardRef as ct,useImperativeHandle as dt,useState as lt}from"react";var Mt=ct((e,r)=>{let{mapView:t}=mt(u),a=ft(void 0),o=l(()=>e.options,[e.options]),[s,i]=lt(!1);return dt(r,()=>a.current,[s]),ut(()=>{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]),g(()=>{a.current&&t?.updateState(a.current,{position:e.coordinate,...o})},[e.coordinate,o]),null});n();import{useContext as Y}from"react";function yt(){let{mapView:e}=Y(u),{getCache:r}=Y(P);if(!e)throw new c("useMap");return{mapData:r?.()?.mapData||e.getMapData(),mapView:e}}p(yt,"useMap");n();import xt,{useCallback as wt,useContext as X,useEffect as Z,useMemo as ht,useRef as R,forwardRef as ee,useImperativeHandle as te,useState as re}from"react";import{createPortal as gt}from"react-dom";n();var j=[0,4,6,8,10],Q=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],j.map((a,o)=>t.slice(a,o===j.length-1?void 0:j[o+1]).join("")).join("-")},"randomId");var ae=ee((e,r)=>{let{mapView:t}=X(u),a=R(void 0),[o,s]=re(!1),i=l(()=>e.options,[e.options]);return te(r,()=>a.current,[o]),Z(()=>{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]),g(()=>{a.current&&i&&t?.updateState(a.current,i)},[i]),t==null||a.current==null?null:gt(e.children,a.current.contentEl,a.current.id)}),Dt=ee((e,r)=>{let{mapView:t}=X(u),a=R(Q()),o=R(void 0),[s,i]=re(!1),M=R(e.target);te(r,()=>o.current,[s]);let f=wt(d=>{o.current=d||void 0,i(!!d)},[]);Z(()=>{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 D=ht(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return xt.createElement(ae,{...D,key:a.current,target:M.current,ref:f})});n();import{forwardRef as Et,useContext as Pt,useEffect as Vt,useImperativeHandle as St,useRef as Tt,useState as Ct}from"react";var vt=Et((e,r)=>{let{mapView:t}=Pt(u),a=Tt(void 0),[o,s]=Ct(!1),i=l(()=>e.options,[e.options]);return St(r,()=>a.current,[o]),Vt(()=>{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]),g(()=>{a.current&&t?.updateState(a.current,{text:e.text,...i})},[e.text,i]),null});export{Dt as AnimatedMarker,vt as Label,L as MapDataProvider,Ie as MapView,ae as Marker,Mt as Model,tt as Navigation,Xe as Path,pt as Shape,yt as useMap,Te as useMapData,Oe as useMapDataEvent,Ge as useMapViewEvent,ze as useMapViewExtension};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/react-sdk",
3
- "version": "6.19.0",
3
+ "version": "6.20.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.19.0"
20
+ "@mappedin/mappedin-js": "^6.20.0"
21
21
  },
22
22
  "dependencies": {},
23
23
  "devDependencies": {},