@mappedin/react-sdk 6.17.1 → 6.18.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.
@@ -1816,6 +1816,216 @@ Apache License
1816
1816
 
1817
1817
  -----------
1818
1818
 
1819
+ The following npm package may be included in this product:
1820
+
1821
+ - @dimforge/rapier3d-compat@0.12.0
1822
+
1823
+ This package contains the following license:
1824
+
1825
+ Apache License
1826
+ Version 2.0, January 2004
1827
+ http://www.apache.org/licenses/
1828
+
1829
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1830
+
1831
+ 1. Definitions.
1832
+
1833
+ "License" shall mean the terms and conditions for use, reproduction,
1834
+ and distribution as defined by Sections 1 through 9 of this document.
1835
+
1836
+ "Licensor" shall mean the copyright owner or entity authorized by
1837
+ the copyright owner that is granting the License.
1838
+
1839
+ "Legal Entity" shall mean the union of the acting entity and all
1840
+ other entities that control, are controlled by, or are under common
1841
+ control with that entity. For the purposes of this definition,
1842
+ "control" means (i) the power, direct or indirect, to cause the
1843
+ direction or management of such entity, whether by contract or
1844
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
1845
+ outstanding shares, or (iii) beneficial ownership of such entity.
1846
+
1847
+ "You" (or "Your") shall mean an individual or Legal Entity
1848
+ exercising permissions granted by this License.
1849
+
1850
+ "Source" form shall mean the preferred form for making modifications,
1851
+ including but not limited to software source code, documentation
1852
+ source, and configuration files.
1853
+
1854
+ "Object" form shall mean any form resulting from mechanical
1855
+ transformation or translation of a Source form, including but
1856
+ not limited to compiled object code, generated documentation,
1857
+ and conversions to other media types.
1858
+
1859
+ "Work" shall mean the work of authorship, whether in Source or
1860
+ Object form, made available under the License, as indicated by a
1861
+ copyright notice that is included in or attached to the work
1862
+ (an example is provided in the Appendix below).
1863
+
1864
+ "Derivative Works" shall mean any work, whether in Source or Object
1865
+ form, that is based on (or derived from) the Work and for which the
1866
+ editorial revisions, annotations, elaborations, or other modifications
1867
+ represent, as a whole, an original work of authorship. For the purposes
1868
+ of this License, Derivative Works shall not include works that remain
1869
+ separable from, or merely link (or bind by name) to the interfaces of,
1870
+ the Work and Derivative Works thereof.
1871
+
1872
+ "Contribution" shall mean any work of authorship, including
1873
+ the original version of the Work and any modifications or additions
1874
+ to that Work or Derivative Works thereof, that is intentionally
1875
+ submitted to Licensor for inclusion in the Work by the copyright owner
1876
+ or by an individual or Legal Entity authorized to submit on behalf of
1877
+ the copyright owner. For the purposes of this definition, "submitted"
1878
+ means any form of electronic, verbal, or written communication sent
1879
+ to the Licensor or its representatives, including but not limited to
1880
+ communication on electronic mailing lists, source code control systems,
1881
+ and issue tracking systems that are managed by, or on behalf of, the
1882
+ Licensor for the purpose of discussing and improving the Work, but
1883
+ excluding communication that is conspicuously marked or otherwise
1884
+ designated in writing by the copyright owner as "Not a Contribution."
1885
+
1886
+ "Contributor" shall mean Licensor and any individual or Legal Entity
1887
+ on behalf of whom a Contribution has been received by Licensor and
1888
+ subsequently incorporated within the Work.
1889
+
1890
+ 2. Grant of Copyright License. Subject to the terms and conditions of
1891
+ this License, each Contributor hereby grants to You a perpetual,
1892
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1893
+ copyright license to reproduce, prepare Derivative Works of,
1894
+ publicly display, publicly perform, sublicense, and distribute the
1895
+ Work and such Derivative Works in Source or Object form.
1896
+
1897
+ 3. Grant of Patent License. Subject to the terms and conditions of
1898
+ this License, each Contributor hereby grants to You a perpetual,
1899
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
1900
+ (except as stated in this section) patent license to make, have made,
1901
+ use, offer to sell, sell, import, and otherwise transfer the Work,
1902
+ where such license applies only to those patent claims licensable
1903
+ by such Contributor that are necessarily infringed by their
1904
+ Contribution(s) alone or by combination of their Contribution(s)
1905
+ with the Work to which such Contribution(s) was submitted. If You
1906
+ institute patent litigation against any entity (including a
1907
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
1908
+ or a Contribution incorporated within the Work constitutes direct
1909
+ or contributory patent infringement, then any patent licenses
1910
+ granted to You under this License for that Work shall terminate
1911
+ as of the date such litigation is filed.
1912
+
1913
+ 4. Redistribution. You may reproduce and distribute copies of the
1914
+ Work or Derivative Works thereof in any medium, with or without
1915
+ modifications, and in Source or Object form, provided that You
1916
+ meet the following conditions:
1917
+
1918
+ (a) You must give any other recipients of the Work or
1919
+ Derivative Works a copy of this License; and
1920
+
1921
+ (b) You must cause any modified files to carry prominent notices
1922
+ stating that You changed the files; and
1923
+
1924
+ (c) You must retain, in the Source form of any Derivative Works
1925
+ that You distribute, all copyright, patent, trademark, and
1926
+ attribution notices from the Source form of the Work,
1927
+ excluding those notices that do not pertain to any part of
1928
+ the Derivative Works; and
1929
+
1930
+ (d) If the Work includes a "NOTICE" text file as part of its
1931
+ distribution, then any Derivative Works that You distribute must
1932
+ include a readable copy of the attribution notices contained
1933
+ within such NOTICE file, excluding those notices that do not
1934
+ pertain to any part of the Derivative Works, in at least one
1935
+ of the following places: within a NOTICE text file distributed
1936
+ as part of the Derivative Works; within the Source form or
1937
+ documentation, if provided along with the Derivative Works; or,
1938
+ within a display generated by the Derivative Works, if and
1939
+ wherever such third-party notices normally appear. The contents
1940
+ of the NOTICE file are for informational purposes only and
1941
+ do not modify the License. You may add Your own attribution
1942
+ notices within Derivative Works that You distribute, alongside
1943
+ or as an addendum to the NOTICE text from the Work, provided
1944
+ that such additional attribution notices cannot be construed
1945
+ as modifying the License.
1946
+
1947
+ You may add Your own copyright statement to Your modifications and
1948
+ may provide additional or different license terms and conditions
1949
+ for use, reproduction, or distribution of Your modifications, or
1950
+ for any such Derivative Works as a whole, provided Your use,
1951
+ reproduction, and distribution of the Work otherwise complies with
1952
+ the conditions stated in this License.
1953
+
1954
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1955
+ any Contribution intentionally submitted for inclusion in the Work
1956
+ by You to the Licensor shall be under the terms and conditions of
1957
+ this License, without any additional terms or conditions.
1958
+ Notwithstanding the above, nothing herein shall supersede or modify
1959
+ the terms of any separate license agreement you may have executed
1960
+ with Licensor regarding such Contributions.
1961
+
1962
+ 6. Trademarks. This License does not grant permission to use the trade
1963
+ names, trademarks, service marks, or product names of the Licensor,
1964
+ except as required for reasonable and customary use in describing the
1965
+ origin of the Work and reproducing the content of the NOTICE file.
1966
+
1967
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1968
+ agreed to in writing, Licensor provides the Work (and each
1969
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1970
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1971
+ implied, including, without limitation, any warranties or conditions
1972
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1973
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1974
+ appropriateness of using or redistributing the Work and assume any
1975
+ risks associated with Your exercise of permissions under this License.
1976
+
1977
+ 8. Limitation of Liability. In no event and under no legal theory,
1978
+ whether in tort (including negligence), contract, or otherwise,
1979
+ unless required by applicable law (such as deliberate and grossly
1980
+ negligent acts) or agreed to in writing, shall any Contributor be
1981
+ liable to You for damages, including any direct, indirect, special,
1982
+ incidental, or consequential damages of any character arising as a
1983
+ result of this License or out of the use or inability to use the
1984
+ Work (including but not limited to damages for loss of goodwill,
1985
+ work stoppage, computer failure or malfunction, or any and all
1986
+ other commercial damages or losses), even if such Contributor
1987
+ has been advised of the possibility of such damages.
1988
+
1989
+ 9. Accepting Warranty or Additional Liability. While redistributing
1990
+ the Work or Derivative Works thereof, You may choose to offer,
1991
+ and charge a fee for, acceptance of support, warranty, indemnity,
1992
+ or other liability obligations and/or rights consistent with this
1993
+ License. However, in accepting such obligations, You may act only
1994
+ on Your own behalf and on Your sole responsibility, not on behalf
1995
+ of any other Contributor, and only if You agree to indemnify,
1996
+ defend, and hold each Contributor harmless for any liability
1997
+ incurred by, or claims asserted against, such Contributor by reason
1998
+ of your accepting any such warranty or additional liability.
1999
+
2000
+ END OF TERMS AND CONDITIONS
2001
+
2002
+ APPENDIX: How to apply the Apache License to your work.
2003
+
2004
+ To apply the Apache License to your work, attach the following
2005
+ boilerplate notice, with the fields enclosed by brackets "[]"
2006
+ replaced with your own identifying information. (Don't include
2007
+ the brackets!) The text should be enclosed in the appropriate
2008
+ comment syntax for the file format. We also recommend that a
2009
+ file or class name and description of purpose be included on the
2010
+ same "printed page" as the copyright notice for easier
2011
+ identification within third-party archives.
2012
+
2013
+ Copyright 2020 Dimforge EURL
2014
+
2015
+ Licensed under the Apache License, Version 2.0 (the "License");
2016
+ you may not use this file except in compliance with the License.
2017
+ You may obtain a copy of the License at
2018
+
2019
+ http://www.apache.org/licenses/LICENSE-2.0
2020
+
2021
+ Unless required by applicable law or agreed to in writing, software
2022
+ distributed under the License is distributed on an "AS IS" BASIS,
2023
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2024
+ See the License for the specific language governing permissions and
2025
+ limitations under the License.
2026
+
2027
+ -----------
2028
+
1819
2029
  The following npm packages may be included in this product:
1820
2030
 
1821
2031
  - detect-libc@1.0.3
@@ -2056,7 +2266,7 @@ The following npm packages may be included in this product:
2056
2266
  - @types/stack-utils@2.0.3
2057
2267
  - @types/stats.js@0.17.4
2058
2268
  - @types/supercluster@7.1.3
2059
- - @types/three@0.173.0
2269
+ - @types/three@0.178.1
2060
2270
  - @types/ua-parser-js@0.7.39
2061
2271
  - @types/webxr@0.5.22
2062
2272
  - @types/yargs-parser@21.0.3
@@ -5128,7 +5338,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5128
5338
 
5129
5339
  The following npm package may be included in this product:
5130
5340
 
5131
- - handlebars@4.7.8
5341
+ - handlebars@4.7.9
5132
5342
 
5133
5343
  This package contains the following license:
5134
5344
 
@@ -9566,8 +9776,7 @@ The following npm packages may be included in this product:
9566
9776
 
9567
9777
  - undici-types@6.21.0
9568
9778
  - undici-types@7.16.0
9569
- - undici@6.23.0
9570
- - undici@7.10.0
9779
+ - undici@6.24.1
9571
9780
 
9572
9781
  These packages each contain the following license:
9573
9782
 
@@ -10909,7 +11118,7 @@ THE SOFTWARE.
10909
11118
 
10910
11119
  The following npm package may be included in this product:
10911
11120
 
10912
- - three@0.173.0
11121
+ - three@0.178.0
10913
11122
 
10914
11123
  This package contains the following license:
10915
11124
 
@@ -12525,7 +12734,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12525
12734
 
12526
12735
  The following npm packages may be included in this product:
12527
12736
 
12528
- - picomatch@2.3.1
12737
+ - picomatch@2.3.2
12529
12738
  - picomatch@3.0.1
12530
12739
 
12531
12740
  These packages each contain the following license:
@@ -14030,7 +14239,7 @@ POSSIBILITY OF SUCH DAMAGE.
14030
14239
 
14031
14240
  The following npm package may be included in this product:
14032
14241
 
14033
- - node-forge@1.3.3
14242
+ - node-forge@1.4.0
14034
14243
 
14035
14244
  This package contains the following license:
14036
14245
 
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.17.1"}}});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.18.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.17.1",
3
+ "version": "6.18.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.17.1"
20
+ "@mappedin/mappedin-js": "^6.18.0"
21
21
  },
22
22
  "dependencies": {},
23
23
  "devDependencies": {},
@@ -30,7 +30,7 @@
30
30
  "build:prod": "cross-env NODE_ENV=production pnpm build",
31
31
  "build:examples": "node ../scripts/build-examples.mjs react",
32
32
  "types": "tsc -b tsconfig.build.json",
33
- "test": "pnpm -w test react",
33
+ "test": "jest --config jest.config.js",
34
34
  "test:cov": "pnpm test --coverage",
35
35
  "clean": "rm -rf lib/** && rm -rf examples/dist/**",
36
36
  "version:ci": "pnpm version --no-commit-hooks --no-git-tag-version",