@janiscommerce/ui-web 0.37.0 → 0.39.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/dist/index.umd.js CHANGED
@@ -4743,6 +4743,166 @@
4743
4743
  ];
4744
4744
  }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
4745
4745
 
4746
+ var $$d = _export;
4747
+
4748
+ // `Number.isNaN` method
4749
+ // https://tc39.es/ecma262/#sec-number.isnan
4750
+ $$d({ target: 'Number', stat: true }, {
4751
+ isNaN: function isNaN(number) {
4752
+ // eslint-disable-next-line no-self-compare -- NaN check
4753
+ return number != number;
4754
+ }
4755
+ });
4756
+
4757
+ var isCallable$2 = isCallable$k;
4758
+ var isObject$3 = isObject$d;
4759
+ var setPrototypeOf$1 = objectSetPrototypeOf;
4760
+
4761
+ // makes subclassing work correct for wrapped built-ins
4762
+ var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
4763
+ var NewTarget, NewTargetPrototype;
4764
+ if (
4765
+ // it can work only with native `setPrototypeOf`
4766
+ setPrototypeOf$1 &&
4767
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
4768
+ isCallable$2(NewTarget = dummy.constructor) &&
4769
+ NewTarget !== Wrapper &&
4770
+ isObject$3(NewTargetPrototype = NewTarget.prototype) &&
4771
+ NewTargetPrototype !== Wrapper.prototype
4772
+ ) setPrototypeOf$1($this, NewTargetPrototype);
4773
+ return $this;
4774
+ };
4775
+
4776
+ var uncurryThis$a = functionUncurryThis;
4777
+
4778
+ // `thisNumberValue` abstract operation
4779
+ // https://tc39.es/ecma262/#sec-thisnumbervalue
4780
+ var thisNumberValue$1 = uncurryThis$a(1.0.valueOf);
4781
+
4782
+ // a string of all valid unicode whitespaces
4783
+ var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
4784
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
4785
+
4786
+ var uncurryThis$9 = functionUncurryThis;
4787
+ var requireObjectCoercible$2 = requireObjectCoercible$8;
4788
+ var toString$3 = toString$9;
4789
+ var whitespaces$1 = whitespaces$2;
4790
+
4791
+ var replace$1 = uncurryThis$9(''.replace);
4792
+ var whitespace = '[' + whitespaces$1 + ']';
4793
+ var ltrim = RegExp('^' + whitespace + whitespace + '*');
4794
+ var rtrim = RegExp(whitespace + whitespace + '*$');
4795
+
4796
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
4797
+ var createMethod$2 = function (TYPE) {
4798
+ return function ($this) {
4799
+ var string = toString$3(requireObjectCoercible$2($this));
4800
+ if (TYPE & 1) string = replace$1(string, ltrim, '');
4801
+ if (TYPE & 2) string = replace$1(string, rtrim, '');
4802
+ return string;
4803
+ };
4804
+ };
4805
+
4806
+ var stringTrim = {
4807
+ // `String.prototype.{ trimLeft, trimStart }` methods
4808
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
4809
+ start: createMethod$2(1),
4810
+ // `String.prototype.{ trimRight, trimEnd }` methods
4811
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
4812
+ end: createMethod$2(2),
4813
+ // `String.prototype.trim` method
4814
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
4815
+ trim: createMethod$2(3)
4816
+ };
4817
+
4818
+ var DESCRIPTORS$2 = descriptors;
4819
+ var global$e = global$T;
4820
+ var uncurryThis$8 = functionUncurryThis;
4821
+ var isForced$1 = isForced_1;
4822
+ var redefine$2 = redefine$b.exports;
4823
+ var hasOwn$1 = hasOwnProperty_1;
4824
+ var inheritIfRequired = inheritIfRequired$1;
4825
+ var isPrototypeOf$2 = objectIsPrototypeOf;
4826
+ var isSymbol = isSymbol$3;
4827
+ var toPrimitive = toPrimitive$2;
4828
+ var fails$6 = fails$q;
4829
+ var getOwnPropertyNames = objectGetOwnPropertyNames.f;
4830
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
4831
+ var defineProperty$1 = objectDefineProperty.f;
4832
+ var thisNumberValue = thisNumberValue$1;
4833
+ var trim$1 = stringTrim.trim;
4834
+
4835
+ var NUMBER = 'Number';
4836
+ var NativeNumber = global$e[NUMBER];
4837
+ var NumberPrototype = NativeNumber.prototype;
4838
+ var TypeError$6 = global$e.TypeError;
4839
+ var arraySlice$2 = uncurryThis$8(''.slice);
4840
+ var charCodeAt = uncurryThis$8(''.charCodeAt);
4841
+
4842
+ // `ToNumeric` abstract operation
4843
+ // https://tc39.es/ecma262/#sec-tonumeric
4844
+ var toNumeric = function (value) {
4845
+ var primValue = toPrimitive(value, 'number');
4846
+ return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
4847
+ };
4848
+
4849
+ // `ToNumber` abstract operation
4850
+ // https://tc39.es/ecma262/#sec-tonumber
4851
+ var toNumber = function (argument) {
4852
+ var it = toPrimitive(argument, 'number');
4853
+ var first, third, radix, maxCode, digits, length, index, code;
4854
+ if (isSymbol(it)) throw TypeError$6('Cannot convert a Symbol value to a number');
4855
+ if (typeof it == 'string' && it.length > 2) {
4856
+ it = trim$1(it);
4857
+ first = charCodeAt(it, 0);
4858
+ if (first === 43 || first === 45) {
4859
+ third = charCodeAt(it, 2);
4860
+ if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
4861
+ } else if (first === 48) {
4862
+ switch (charCodeAt(it, 1)) {
4863
+ case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
4864
+ case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
4865
+ default: return +it;
4866
+ }
4867
+ digits = arraySlice$2(it, 2);
4868
+ length = digits.length;
4869
+ for (index = 0; index < length; index++) {
4870
+ code = charCodeAt(digits, index);
4871
+ // parseInt parses a string to a first unavailable symbol
4872
+ // but ToNumber should return NaN if a string contains unavailable symbols
4873
+ if (code < 48 || code > maxCode) return NaN;
4874
+ } return parseInt(digits, radix);
4875
+ }
4876
+ } return +it;
4877
+ };
4878
+
4879
+ // `Number` constructor
4880
+ // https://tc39.es/ecma262/#sec-number-constructor
4881
+ if (isForced$1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
4882
+ var NumberWrapper = function Number(value) {
4883
+ var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
4884
+ var dummy = this;
4885
+ // check on 1..constructor(foo) case
4886
+ return isPrototypeOf$2(NumberPrototype, dummy) && fails$6(function () { thisNumberValue(dummy); })
4887
+ ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
4888
+ };
4889
+ for (var keys = DESCRIPTORS$2 ? getOwnPropertyNames(NativeNumber) : (
4890
+ // ES3:
4891
+ 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
4892
+ // ES2015 (in case, if modules with ES2015 Number statics required before):
4893
+ 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
4894
+ // ESNext
4895
+ 'fromString,range'
4896
+ ).split(','), j = 0, key$1; keys.length > j; j++) {
4897
+ if (hasOwn$1(NativeNumber, key$1 = keys[j]) && !hasOwn$1(NumberWrapper, key$1)) {
4898
+ defineProperty$1(NumberWrapper, key$1, getOwnPropertyDescriptor$1(NativeNumber, key$1));
4899
+ }
4900
+ }
4901
+ NumberWrapper.prototype = NumberPrototype;
4902
+ NumberPrototype.constructor = NumberWrapper;
4903
+ redefine$2(global$e, NUMBER, NumberWrapper);
4904
+ }
4905
+
4746
4906
  /**
4747
4907
  * Creates a debounced function that delays invoking func until after wait milliseconds have
4748
4908
  * elapsed since the last time the debounced function was invoked.
@@ -4771,6 +4931,12 @@
4771
4931
 
4772
4932
  return debounced;
4773
4933
  }
4934
+ var isObject$2 = function isObject(value) {
4935
+ return _typeof(value) === 'object' && !Array.isArray(value) && value instanceof Object;
4936
+ };
4937
+ var isNumber = function isNumber(num) {
4938
+ return typeof num === 'number' && !Number.isNaN(Number(num));
4939
+ };
4774
4940
 
4775
4941
  var breakpoints = {
4776
4942
  values: {
@@ -4971,166 +5137,6 @@
4971
5137
  yellowPressed: '#FFBA0C'
4972
5138
  };
4973
5139
 
4974
- var $$d = _export;
4975
-
4976
- // `Number.isNaN` method
4977
- // https://tc39.es/ecma262/#sec-number.isnan
4978
- $$d({ target: 'Number', stat: true }, {
4979
- isNaN: function isNaN(number) {
4980
- // eslint-disable-next-line no-self-compare -- NaN check
4981
- return number != number;
4982
- }
4983
- });
4984
-
4985
- var isCallable$2 = isCallable$k;
4986
- var isObject$3 = isObject$d;
4987
- var setPrototypeOf$1 = objectSetPrototypeOf;
4988
-
4989
- // makes subclassing work correct for wrapped built-ins
4990
- var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
4991
- var NewTarget, NewTargetPrototype;
4992
- if (
4993
- // it can work only with native `setPrototypeOf`
4994
- setPrototypeOf$1 &&
4995
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
4996
- isCallable$2(NewTarget = dummy.constructor) &&
4997
- NewTarget !== Wrapper &&
4998
- isObject$3(NewTargetPrototype = NewTarget.prototype) &&
4999
- NewTargetPrototype !== Wrapper.prototype
5000
- ) setPrototypeOf$1($this, NewTargetPrototype);
5001
- return $this;
5002
- };
5003
-
5004
- var uncurryThis$a = functionUncurryThis;
5005
-
5006
- // `thisNumberValue` abstract operation
5007
- // https://tc39.es/ecma262/#sec-thisnumbervalue
5008
- var thisNumberValue$1 = uncurryThis$a(1.0.valueOf);
5009
-
5010
- // a string of all valid unicode whitespaces
5011
- var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
5012
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
5013
-
5014
- var uncurryThis$9 = functionUncurryThis;
5015
- var requireObjectCoercible$2 = requireObjectCoercible$8;
5016
- var toString$3 = toString$9;
5017
- var whitespaces$1 = whitespaces$2;
5018
-
5019
- var replace$1 = uncurryThis$9(''.replace);
5020
- var whitespace = '[' + whitespaces$1 + ']';
5021
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
5022
- var rtrim = RegExp(whitespace + whitespace + '*$');
5023
-
5024
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
5025
- var createMethod$2 = function (TYPE) {
5026
- return function ($this) {
5027
- var string = toString$3(requireObjectCoercible$2($this));
5028
- if (TYPE & 1) string = replace$1(string, ltrim, '');
5029
- if (TYPE & 2) string = replace$1(string, rtrim, '');
5030
- return string;
5031
- };
5032
- };
5033
-
5034
- var stringTrim = {
5035
- // `String.prototype.{ trimLeft, trimStart }` methods
5036
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
5037
- start: createMethod$2(1),
5038
- // `String.prototype.{ trimRight, trimEnd }` methods
5039
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
5040
- end: createMethod$2(2),
5041
- // `String.prototype.trim` method
5042
- // https://tc39.es/ecma262/#sec-string.prototype.trim
5043
- trim: createMethod$2(3)
5044
- };
5045
-
5046
- var DESCRIPTORS$2 = descriptors;
5047
- var global$e = global$T;
5048
- var uncurryThis$8 = functionUncurryThis;
5049
- var isForced$1 = isForced_1;
5050
- var redefine$2 = redefine$b.exports;
5051
- var hasOwn$1 = hasOwnProperty_1;
5052
- var inheritIfRequired = inheritIfRequired$1;
5053
- var isPrototypeOf$2 = objectIsPrototypeOf;
5054
- var isSymbol = isSymbol$3;
5055
- var toPrimitive = toPrimitive$2;
5056
- var fails$6 = fails$q;
5057
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
5058
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
5059
- var defineProperty$1 = objectDefineProperty.f;
5060
- var thisNumberValue = thisNumberValue$1;
5061
- var trim$1 = stringTrim.trim;
5062
-
5063
- var NUMBER = 'Number';
5064
- var NativeNumber = global$e[NUMBER];
5065
- var NumberPrototype = NativeNumber.prototype;
5066
- var TypeError$6 = global$e.TypeError;
5067
- var arraySlice$2 = uncurryThis$8(''.slice);
5068
- var charCodeAt = uncurryThis$8(''.charCodeAt);
5069
-
5070
- // `ToNumeric` abstract operation
5071
- // https://tc39.es/ecma262/#sec-tonumeric
5072
- var toNumeric = function (value) {
5073
- var primValue = toPrimitive(value, 'number');
5074
- return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
5075
- };
5076
-
5077
- // `ToNumber` abstract operation
5078
- // https://tc39.es/ecma262/#sec-tonumber
5079
- var toNumber = function (argument) {
5080
- var it = toPrimitive(argument, 'number');
5081
- var first, third, radix, maxCode, digits, length, index, code;
5082
- if (isSymbol(it)) throw TypeError$6('Cannot convert a Symbol value to a number');
5083
- if (typeof it == 'string' && it.length > 2) {
5084
- it = trim$1(it);
5085
- first = charCodeAt(it, 0);
5086
- if (first === 43 || first === 45) {
5087
- third = charCodeAt(it, 2);
5088
- if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
5089
- } else if (first === 48) {
5090
- switch (charCodeAt(it, 1)) {
5091
- case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
5092
- case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
5093
- default: return +it;
5094
- }
5095
- digits = arraySlice$2(it, 2);
5096
- length = digits.length;
5097
- for (index = 0; index < length; index++) {
5098
- code = charCodeAt(digits, index);
5099
- // parseInt parses a string to a first unavailable symbol
5100
- // but ToNumber should return NaN if a string contains unavailable symbols
5101
- if (code < 48 || code > maxCode) return NaN;
5102
- } return parseInt(digits, radix);
5103
- }
5104
- } return +it;
5105
- };
5106
-
5107
- // `Number` constructor
5108
- // https://tc39.es/ecma262/#sec-number-constructor
5109
- if (isForced$1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
5110
- var NumberWrapper = function Number(value) {
5111
- var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
5112
- var dummy = this;
5113
- // check on 1..constructor(foo) case
5114
- return isPrototypeOf$2(NumberPrototype, dummy) && fails$6(function () { thisNumberValue(dummy); })
5115
- ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
5116
- };
5117
- for (var keys = DESCRIPTORS$2 ? getOwnPropertyNames(NativeNumber) : (
5118
- // ES3:
5119
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
5120
- // ES2015 (in case, if modules with ES2015 Number statics required before):
5121
- 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
5122
- // ESNext
5123
- 'fromString,range'
5124
- ).split(','), j = 0, key$1; keys.length > j; j++) {
5125
- if (hasOwn$1(NativeNumber, key$1 = keys[j]) && !hasOwn$1(NumberWrapper, key$1)) {
5126
- defineProperty$1(NumberWrapper, key$1, getOwnPropertyDescriptor$1(NativeNumber, key$1));
5127
- }
5128
- }
5129
- NumberWrapper.prototype = NumberPrototype;
5130
- NumberPrototype.constructor = NumberWrapper;
5131
- redefine$2(global$e, NUMBER, NumberWrapper);
5132
- }
5133
-
5134
5140
  var uncurryThis$7 = functionUncurryThis;
5135
5141
  var requireObjectCoercible$1 = requireObjectCoercible$8;
5136
5142
  var toString$2 = toString$9;
@@ -15981,6 +15987,13 @@
15981
15987
  var hasEqualLng = (prevPosition === null || prevPosition === void 0 ? void 0 : prevPosition.lng) === (newPosition === null || newPosition === void 0 ? void 0 : newPosition.lng);
15982
15988
  return hasEqualLat && hasEqualLng;
15983
15989
  };
15990
+ var isValidAnimation = function isValidAnimation() {
15991
+ var _window$google, _window$google$maps;
15992
+
15993
+ var animation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15994
+ var validAnimations = (_window$google = window.google) === null || _window$google === void 0 ? void 0 : (_window$google$maps = _window$google.maps) === null || _window$google$maps === void 0 ? void 0 : _window$google$maps.Animation;
15995
+ return (animation === null || animation === void 0 ? void 0 : animation.name) && validAnimations && validAnimations[animation === null || animation === void 0 ? void 0 : animation.name] !== undefined;
15996
+ };
15984
15997
 
15985
15998
  var Marker = function Marker(_ref) {
15986
15999
  var _ref$markerData = _ref.markerData,
@@ -15998,6 +16011,7 @@
15998
16011
  var _ref2 = marker || {},
15999
16012
  icon = _ref2.icon,
16000
16013
  position = _ref2.position,
16014
+ animation = _ref2.animation,
16001
16015
  overlay = _ref2.overlay,
16002
16016
  infoWindowChildren = _ref2.infoWindowChildren,
16003
16017
  isDraggable = _ref2.isDraggable;
@@ -16014,6 +16028,7 @@
16014
16028
  _onDragEnd = _markerOptions$onDrag3 === void 0 ? function () {} : _markerOptions$onDrag3;
16015
16029
 
16016
16030
  var markerRef = React.useRef(null);
16031
+ var timeoutRef = React.useRef(null);
16017
16032
 
16018
16033
  var _useState3 = React.useState(false),
16019
16034
  _useState4 = _slicedToArray(_useState3, 2),
@@ -16062,6 +16077,29 @@
16062
16077
  };
16063
16078
  };
16064
16079
 
16080
+ var animate = function animate() {
16081
+ var _markerRef$current2, _markerRef$current2$m;
16082
+
16083
+ if (!markerRef.current) return;
16084
+ if (!isValidAnimation(animation)) return;
16085
+ (_markerRef$current2 = markerRef.current) === null || _markerRef$current2 === void 0 ? void 0 : (_markerRef$current2$m = _markerRef$current2.marker) === null || _markerRef$current2$m === void 0 ? void 0 : _markerRef$current2$m.setAnimation(window.google.maps.Animation[animation === null || animation === void 0 ? void 0 : animation.name]);
16086
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
16087
+
16088
+ if (animation !== null && animation !== void 0 && animation.duration && isNumber(animation === null || animation === void 0 ? void 0 : animation.duration)) {
16089
+ timeoutRef.current = setTimeout(function () {
16090
+ var _markerRef$current3, _markerRef$current3$m;
16091
+
16092
+ (_markerRef$current3 = markerRef.current) === null || _markerRef$current3 === void 0 ? void 0 : (_markerRef$current3$m = _markerRef$current3.marker) === null || _markerRef$current3$m === void 0 ? void 0 : _markerRef$current3$m.setAnimation(null);
16093
+ }, animation === null || animation === void 0 ? void 0 : animation.duration);
16094
+ }
16095
+ };
16096
+
16097
+ React.useEffect(function () {
16098
+ if (animation && isObject$2(animation)) animate();
16099
+ return function () {
16100
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
16101
+ };
16102
+ }, [animation]);
16065
16103
  var markerProps = {
16066
16104
  ref: markerRef,
16067
16105
  position: position,
@@ -17083,40 +17121,6 @@
17083
17121
  return getBounds(markersFlatted);
17084
17122
  });
17085
17123
 
17086
- /**
17087
- * Sets the map center based on the provided markers or a default center value.
17088
- * @param {Object} center A default center object with latitude and longitude values.
17089
- * @param {number} center.lat The latitude value of the default center.
17090
- * @param {number} center.lng The longitude value of the default center.
17091
- */
17092
-
17093
- var getCenterByGeolocationOrCenter = (function () {
17094
- var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17095
- if (validateCoordinates(center)) return center;
17096
- return getGeolocationCoordinates();
17097
- });
17098
-
17099
- /**
17100
- * Retrieves the current geolocation of the user and updates the map's center coordinates.
17101
- */
17102
- var getGeolocationCoordinates = (function () {
17103
- try {
17104
- navigator.geolocation.getCurrentPosition(function () {
17105
- var pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17106
- var _pos$coords = pos.coords,
17107
- lat = _pos$coords.latitude,
17108
- lng = _pos$coords.longitude;
17109
- return {
17110
- lat: lat,
17111
- lng: lng
17112
- };
17113
- });
17114
- } catch (error) {
17115
- console.log(error);
17116
- return {};
17117
- }
17118
- });
17119
-
17120
17124
  var LIBRARIES = ['geometry', 'drawing', 'places'];
17121
17125
  var DEFAULT_CENTER = {
17122
17126
  lat: 0,
@@ -17295,15 +17299,6 @@
17295
17299
  });
17296
17300
  });
17297
17301
 
17298
- /**
17299
- * Function to check if a value is an object
17300
- * @param {*} value Value to check if it is an object
17301
- * @returns Returns true if the value is an object
17302
- */
17303
- var isObject$2 = function isObject(value) {
17304
- return _typeof(value) === 'object' && !Array.isArray(value) && value instanceof Object;
17305
- };
17306
-
17307
17302
  var global$7 = global$T;
17308
17303
 
17309
17304
  var nativePromiseConstructor = global$7.Promise;
@@ -35423,28 +35418,6 @@
35423
35418
  }, _objectSpread2({}, parsedData));
35424
35419
  });
35425
35420
 
35426
- /**
35427
- * @function validateCoordinates
35428
- * @description return true or false is region has latitude and longitude keys and type number
35429
- * @param {object} coordinates - object with latitude and longitude
35430
- * @param {number} coordinates.lng - longitude
35431
- * @param {number} coordinates.lat - latitude
35432
- * @returns {boolean}
35433
- * @example isValidRegionData({latitude: -345345, longitude: -345435345}) => true
35434
- * @example isValidRegionData({latitude: -345345, longitude: '3453453453'}) => false
35435
- * @example isValidRegionData({latitude: -345345}) => false
35436
- */
35437
-
35438
- var validateCoordinates = (function () {
35439
- var coordinates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35440
- if (!isObject$2(coordinates) || !Object.keys(coordinates).length) return false;
35441
- var lng = coordinates.lng,
35442
- lat = coordinates.lat;
35443
- if (!lng || !lat) return false;
35444
- if (!lodash.exports.isNumber(lng) || !lodash.exports.isNumber(lat)) return false;
35445
- return true;
35446
- });
35447
-
35448
35421
  var styled = {
35449
35422
  LoadingElement: styled__default["default"].div.withConfig({
35450
35423
  displayName: "styles__LoadingElement",
@@ -35512,8 +35485,7 @@
35512
35485
  };
35513
35486
 
35514
35487
  var _excluded = ["googleMapsApiKey", "width", "height", "center", "zoom", "markers", "markerOptions", "options", "callbackOnSuccessDirections", "callbackOnErrorDirections"];
35515
-
35516
- var Map$1 = function Map(_ref) {
35488
+ var Map$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
35517
35489
  var _mapRef$current;
35518
35490
 
35519
35491
  var _ref$googleMapsApiKey = _ref.googleMapsApiKey,
@@ -35522,8 +35494,7 @@
35522
35494
  width = _ref$width === void 0 ? '800px' : _ref$width,
35523
35495
  _ref$height = _ref.height,
35524
35496
  height = _ref$height === void 0 ? '400px' : _ref$height,
35525
- _ref$center = _ref.center,
35526
- center = _ref$center === void 0 ? DEFAULT_CENTER : _ref$center,
35497
+ center = _ref.center,
35527
35498
  _ref$zoom = _ref.zoom,
35528
35499
  zoom = _ref$zoom === void 0 ? 13 : _ref$zoom,
35529
35500
  _ref$markers = _ref.markers,
@@ -35566,7 +35537,7 @@
35566
35537
  mapRef.current.panTo(newCenter);
35567
35538
  };
35568
35539
 
35569
- var onLoad = React.useCallback(function (map) {
35540
+ var onLoad = function onLoad(map) {
35570
35541
  if (!map) return;
35571
35542
  mapRef.current = map;
35572
35543
  mapRef.current.setOptions({
@@ -35575,10 +35546,22 @@
35575
35546
  var fullScreenPos = mapOptions.showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
35576
35547
  handlePositions('fullScreen', window.google.maps.ControlPosition[fullScreenPos]);
35577
35548
  handlePositions('zoom', window.google.maps.ControlPosition.RIGHT_BOTTOM);
35578
- if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(getCenterByGeolocationOrCenter(center || DEFAULT_CENTER));
35579
- if (markers !== null && markers !== void 0 && markers.length) mapRef.current.fitBounds(getBoundsFromMarkers(markers));
35580
- mapRef.current.setZoom(zoom);
35581
- }, [center, markers, options, zoom]);
35549
+ if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(center || DEFAULT_CENTER);
35550
+ mapRef.current.setZoom(!center ? 2 : zoom);
35551
+ };
35552
+
35553
+ React.useImperativeHandle(ref, function () {
35554
+ return {
35555
+ setZoom: function setZoom(zoom) {
35556
+ return mapRef.current.setZoom(zoom);
35557
+ }
35558
+ };
35559
+ });
35560
+ React.useEffect(function () {
35561
+ if (mapRef.current && markers !== null && markers !== void 0 && markers.length) {
35562
+ mapRef.current.fitBounds(getBoundsFromMarkers(markers));
35563
+ }
35564
+ }, [mapRef.current, markers]);
35582
35565
  if (!isLoaded) return null;
35583
35566
  return /*#__PURE__*/React__default["default"].createElement(GoogleMap, _extends$1({
35584
35567
  className: "google-map-component",
@@ -35588,7 +35571,7 @@
35588
35571
  width: width
35589
35572
  },
35590
35573
  options: mapOptions,
35591
- center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.center
35574
+ center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.getCenter()
35592
35575
  }, props), mapOptions.showSearchBar && /*#__PURE__*/React__default["default"].createElement(SearchBox, {
35593
35576
  updateMarker: updateMarker,
35594
35577
  className: "google-map-component__search-box"
@@ -35600,7 +35583,8 @@
35600
35583
  callbackOnErrorDirections: callbackOnErrorDirections,
35601
35584
  googleMapsApiKey: googleMapsApiKey
35602
35585
  }));
35603
- };
35586
+ });
35587
+ Map$1.displayName = 'Map';
35604
35588
 
35605
35589
  var rotate = styled$g.keyframes(["to{transform:rotate(360deg);}"]);
35606
35590
  var Spinner$1 = styled__default["default"].div.withConfig({