@woosmap/ui 3.26.0 → 3.27.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.26.0",
3
+ "version": "3.27.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -210,6 +210,7 @@ export default class DistanceDemo extends Component {
210
210
  }
211
211
 
212
212
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
213
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
213
214
  this.map = createWoosmapMap(this.demoRef.current.getMap());
214
215
  this.requestDistance();
215
216
  } else {
@@ -218,6 +219,9 @@ export default class DistanceDemo extends Component {
218
219
  };
219
220
 
220
221
  localitiesOnChangeCallBack = (type) => (item) => {
222
+ if (!item) {
223
+ return;
224
+ }
221
225
  const newState = {};
222
226
  newState[`${type}Location`] = item ? item.location : {};
223
227
  this.setState(newState, this.requestDistance);
@@ -346,7 +350,7 @@ export default class DistanceDemo extends Component {
346
350
  };
347
351
  return (
348
352
  <>
349
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
353
+ <Script url="https://sdk.woosmap.com/map/map.js" />
350
354
  <Demo
351
355
  id="distance-demo"
352
356
  className="demo--distance"
@@ -180,6 +180,7 @@ export default class GeolocationDemo extends Component {
180
180
  }
181
181
 
182
182
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
183
+ window.woosmap.map.config.setApiKey(Constants.geolocationWoosmapSearchKey);
183
184
  this.map = createWoosmapMap(this.demoRef.current.getMap());
184
185
  this.requestGeolocation();
185
186
  } else {
@@ -211,7 +212,7 @@ export default class GeolocationDemo extends Component {
211
212
  }
212
213
  return (
213
214
  <>
214
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.geolocationWoosmapSearchKey}`} />
215
+ <Script url="https://sdk.woosmap.com/map/map.js" />
215
216
  <Demo
216
217
  className="demo--geolocation"
217
218
  docLink="https://developers.woosmap.com/products/geolocation-api/location/"
@@ -328,6 +328,7 @@ export default class LocalitiesAddressDemo extends Component {
328
328
  }
329
329
 
330
330
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
331
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
331
332
  this.map = createWoosmapMap(this.demoRef.current.getMap());
332
333
  this.requestAddress();
333
334
  } else {
@@ -344,7 +345,7 @@ export default class LocalitiesAddressDemo extends Component {
344
345
  }
345
346
  return (
346
347
  <>
347
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
348
+ <Script url="https://sdk.woosmap.com/map/map.js" />
348
349
  <Demo
349
350
  noheader={noheader}
350
351
  header={headerLabels}
@@ -195,6 +195,7 @@ export default class LocalitiesDemo extends Component {
195
195
  }
196
196
 
197
197
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
198
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
198
199
  this.map = createWoosmapMap(this.demoRef.current.getMap());
199
200
  this.requestLocalities();
200
201
  } else {
@@ -268,7 +269,7 @@ export default class LocalitiesDemo extends Component {
268
269
  const { noheader, headerLabels, subHeader } = this.props;
269
270
  return (
270
271
  <>
271
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
272
+ <Script url="https://sdk.woosmap.com/map/map.js" />
272
273
  <Demo
273
274
  id="localities-demo"
274
275
  header={headerLabels}
@@ -2,7 +2,6 @@
2
2
  import React, { Component } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Demo from './SkeletonDemo';
5
- import Constants from '../../Constants';
6
5
  import Button from '../Button/Button';
7
6
  import ButtonGroup from '../Button/ButtonGroup';
8
7
  import marker from '../../images/marker.png';
@@ -253,7 +252,7 @@ storesOverlay.setMap(map);
253
252
  };
254
253
  return (
255
254
  <>
256
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
255
+ <Script url="https://sdk.woosmap.com/map/map.js" />
257
256
  <Demo
258
257
  ref={this.demoRef}
259
258
  header={headerLabels}
@@ -73,7 +73,7 @@ export default class SearchDemo extends Component {
73
73
  key: Constants.woosmapKey,
74
74
  lat: location.lat,
75
75
  lng: location.lng,
76
- stores_by_page: maxStore,
76
+ stores_by_page: maxStore || '5',
77
77
  query,
78
78
  };
79
79
  };
@@ -190,6 +190,7 @@ export default class SearchDemo extends Component {
190
190
  if (this.timeoutMap) clearTimeout(this.timeoutMap);
191
191
 
192
192
  if (window.woosmap && window.woosmap.map && this.demoRef.current) {
193
+ window.woosmap.map.config.setApiKey(Constants.woosmapKey);
193
194
  this.map = createWoosmapMap(this.demoRef.current.getMap());
194
195
  this.requestSearch();
195
196
  } else {
@@ -310,7 +311,7 @@ export default class SearchDemo extends Component {
310
311
  };
311
312
  return (
312
313
  <>
313
- <Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
314
+ <Script url="https://sdk.woosmap.com/map/map.js" />
314
315
  <Demo
315
316
  id="search-demo"
316
317
  className="demo--search"
@@ -313,7 +313,7 @@ class Dropdown extends Component {
313
313
  }
314
314
  this.mouseLeaveTimeout = setTimeout(() => {
315
315
  this.setOpen(false);
316
- }, 500);
316
+ }, 300);
317
317
  }
318
318
  };
319
319
 
@@ -126,6 +126,7 @@ export const createWoosmapMap = (node) => {
126
126
  ],
127
127
  });
128
128
  } catch (e) {
129
+ console.error('Cound not instantiate a Map');
129
130
  console.error(e);
130
131
  return null;
131
132
  }
package/src/index.js CHANGED
@@ -46,6 +46,7 @@ export { default as withClickOutside } from './components/withClickOutside/withC
46
46
  export { default as withFormValidation } from './components/withFormValidation/withFormValidation';
47
47
  export { default as Marker } from './components/Map/Marker';
48
48
  export { default as LocalitiesDemo } from './components/Demo/LocalitiesDemo';
49
+ export { default as LocalitiesAllDemo } from './components/Demo/LocalitiesAllDemo';
49
50
  export { default as MerchantDemo } from './components/Demo/MerchantDemo';
50
51
  export { default as GeolocationDemo } from './components/Demo/GeolocationDemo';
51
52
  export { default as DistanceDemo } from './components/Demo/DistanceDemo';