@janiscommerce/ui-web 0.37.0 → 0.38.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/CHANGELOG.md +10 -0
- package/dist/index.esm.js +50 -104
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +49 -103
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
|
|
516
516
|
var isCallable$j = isCallable$k;
|
|
517
517
|
|
|
518
|
-
var isObject$
|
|
518
|
+
var isObject$c = function (it) {
|
|
519
519
|
return typeof it == 'object' ? it !== null : isCallable$j(it);
|
|
520
520
|
};
|
|
521
521
|
|
|
@@ -640,7 +640,7 @@
|
|
|
640
640
|
var global$L = global$T;
|
|
641
641
|
var call$f = functionCall;
|
|
642
642
|
var isCallable$f = isCallable$k;
|
|
643
|
-
var isObject$
|
|
643
|
+
var isObject$b = isObject$c;
|
|
644
644
|
|
|
645
645
|
var TypeError$k = global$L.TypeError;
|
|
646
646
|
|
|
@@ -648,9 +648,9 @@
|
|
|
648
648
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
649
649
|
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
650
650
|
var fn, val;
|
|
651
|
-
if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$
|
|
652
|
-
if (isCallable$f(fn = input.valueOf) && !isObject$
|
|
653
|
-
if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$
|
|
651
|
+
if (pref === 'string' && isCallable$f(fn = input.toString) && !isObject$b(val = call$f(fn, input))) return val;
|
|
652
|
+
if (isCallable$f(fn = input.valueOf) && !isObject$b(val = call$f(fn, input))) return val;
|
|
653
|
+
if (pref !== 'string' && isCallable$f(fn = input.toString) && !isObject$b(val = call$f(fn, input))) return val;
|
|
654
654
|
throw TypeError$k("Can't convert object to primitive value");
|
|
655
655
|
};
|
|
656
656
|
|
|
@@ -750,7 +750,7 @@
|
|
|
750
750
|
|
|
751
751
|
var global$G = global$T;
|
|
752
752
|
var call$e = functionCall;
|
|
753
|
-
var isObject$
|
|
753
|
+
var isObject$a = isObject$c;
|
|
754
754
|
var isSymbol$2 = isSymbol$3;
|
|
755
755
|
var getMethod$4 = getMethod$5;
|
|
756
756
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
@@ -762,13 +762,13 @@
|
|
|
762
762
|
// `ToPrimitive` abstract operation
|
|
763
763
|
// https://tc39.es/ecma262/#sec-toprimitive
|
|
764
764
|
var toPrimitive$2 = function (input, pref) {
|
|
765
|
-
if (!isObject$
|
|
765
|
+
if (!isObject$a(input) || isSymbol$2(input)) return input;
|
|
766
766
|
var exoticToPrim = getMethod$4(input, TO_PRIMITIVE);
|
|
767
767
|
var result;
|
|
768
768
|
if (exoticToPrim) {
|
|
769
769
|
if (pref === undefined) pref = 'default';
|
|
770
770
|
result = call$e(exoticToPrim, input, pref);
|
|
771
|
-
if (!isObject$
|
|
771
|
+
if (!isObject$a(result) || isSymbol$2(result)) return result;
|
|
772
772
|
throw TypeError$j("Can't convert object to primitive value");
|
|
773
773
|
}
|
|
774
774
|
if (pref === undefined) pref = 'number';
|
|
@@ -786,11 +786,11 @@
|
|
|
786
786
|
};
|
|
787
787
|
|
|
788
788
|
var global$F = global$T;
|
|
789
|
-
var isObject$
|
|
789
|
+
var isObject$9 = isObject$c;
|
|
790
790
|
|
|
791
791
|
var document$3 = global$F.document;
|
|
792
792
|
// typeof document.createElement is 'object' in old IE
|
|
793
|
-
var EXISTS$1 = isObject$
|
|
793
|
+
var EXISTS$1 = isObject$9(document$3) && isObject$9(document$3.createElement);
|
|
794
794
|
|
|
795
795
|
var documentCreateElement$2 = function (it) {
|
|
796
796
|
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
@@ -847,14 +847,14 @@
|
|
|
847
847
|
});
|
|
848
848
|
|
|
849
849
|
var global$E = global$T;
|
|
850
|
-
var isObject$
|
|
850
|
+
var isObject$8 = isObject$c;
|
|
851
851
|
|
|
852
852
|
var String$4 = global$E.String;
|
|
853
853
|
var TypeError$i = global$E.TypeError;
|
|
854
854
|
|
|
855
855
|
// `Assert: Type(argument) is Object`
|
|
856
856
|
var anObject$h = function (argument) {
|
|
857
|
-
if (isObject$
|
|
857
|
+
if (isObject$8(argument)) return argument;
|
|
858
858
|
throw TypeError$i(String$4(argument) + ' is not an object');
|
|
859
859
|
};
|
|
860
860
|
|
|
@@ -953,7 +953,7 @@
|
|
|
953
953
|
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
954
954
|
var global$B = global$T;
|
|
955
955
|
var uncurryThis$o = functionUncurryThis;
|
|
956
|
-
var isObject$
|
|
956
|
+
var isObject$7 = isObject$c;
|
|
957
957
|
var createNonEnumerableProperty$6 = createNonEnumerableProperty$7;
|
|
958
958
|
var hasOwn$a = hasOwnProperty_1;
|
|
959
959
|
var shared$1 = sharedStore;
|
|
@@ -972,7 +972,7 @@
|
|
|
972
972
|
var getterFor = function (TYPE) {
|
|
973
973
|
return function (it) {
|
|
974
974
|
var state;
|
|
975
|
-
if (!isObject$
|
|
975
|
+
if (!isObject$7(it) || (state = get(it)).type !== TYPE) {
|
|
976
976
|
throw TypeError$g('Incompatible receiver, ' + TYPE + ' required');
|
|
977
977
|
} return state;
|
|
978
978
|
};
|
|
@@ -1437,7 +1437,7 @@
|
|
|
1437
1437
|
var global$x = global$T;
|
|
1438
1438
|
var isArray$2 = isArray$3;
|
|
1439
1439
|
var isConstructor$2 = isConstructor$3;
|
|
1440
|
-
var isObject$
|
|
1440
|
+
var isObject$6 = isObject$c;
|
|
1441
1441
|
var wellKnownSymbol$i = wellKnownSymbol$m;
|
|
1442
1442
|
|
|
1443
1443
|
var SPECIES$5 = wellKnownSymbol$i('species');
|
|
@@ -1451,7 +1451,7 @@
|
|
|
1451
1451
|
C = originalArray.constructor;
|
|
1452
1452
|
// cross-realm fallback
|
|
1453
1453
|
if (isConstructor$2(C) && (C === Array$3 || isArray$2(C.prototype))) C = undefined;
|
|
1454
|
-
else if (isObject$
|
|
1454
|
+
else if (isObject$6(C)) {
|
|
1455
1455
|
C = C[SPECIES$5];
|
|
1456
1456
|
if (C === null) C = undefined;
|
|
1457
1457
|
}
|
|
@@ -1490,7 +1490,7 @@
|
|
|
1490
1490
|
var global$w = global$T;
|
|
1491
1491
|
var fails$g = fails$q;
|
|
1492
1492
|
var isArray$1 = isArray$3;
|
|
1493
|
-
var isObject$
|
|
1493
|
+
var isObject$5 = isObject$c;
|
|
1494
1494
|
var toObject$7 = toObject$9;
|
|
1495
1495
|
var lengthOfArrayLike$7 = lengthOfArrayLike$9;
|
|
1496
1496
|
var createProperty$2 = createProperty$3;
|
|
@@ -1516,7 +1516,7 @@
|
|
|
1516
1516
|
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat');
|
|
1517
1517
|
|
|
1518
1518
|
var isConcatSpreadable = function (O) {
|
|
1519
|
-
if (!isObject$
|
|
1519
|
+
if (!isObject$5(O)) return false;
|
|
1520
1520
|
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1521
1521
|
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
1522
1522
|
};
|
|
@@ -3129,7 +3129,7 @@
|
|
|
3129
3129
|
var bind$7 = functionBindContext;
|
|
3130
3130
|
var classof$2 = classof$8;
|
|
3131
3131
|
var anObject$5 = anObject$h;
|
|
3132
|
-
var isObject$
|
|
3132
|
+
var isObject$4 = isObject$c;
|
|
3133
3133
|
var $toString$2 = toString$9;
|
|
3134
3134
|
var create = objectCreate;
|
|
3135
3135
|
var createPropertyDescriptor = createPropertyDescriptor$5;
|
|
@@ -3232,7 +3232,7 @@
|
|
|
3232
3232
|
this.url = null;
|
|
3233
3233
|
|
|
3234
3234
|
if (init !== undefined) {
|
|
3235
|
-
if (isObject$
|
|
3235
|
+
if (isObject$4(init)) this.parseObject(init);
|
|
3236
3236
|
else this.parseQuery(typeof init == 'string' ? charAt$1(init, 0) === '?' ? stringSlice$2(init, 1) : init : $toString$2(init));
|
|
3237
3237
|
}
|
|
3238
3238
|
};
|
|
@@ -3449,7 +3449,7 @@
|
|
|
3449
3449
|
var headersSet = uncurryThis$d(HeadersPrototype.set);
|
|
3450
3450
|
|
|
3451
3451
|
var wrapRequestOptions = function (init) {
|
|
3452
|
-
if (isObject$
|
|
3452
|
+
if (isObject$4(init)) {
|
|
3453
3453
|
var body = init.body;
|
|
3454
3454
|
var headers;
|
|
3455
3455
|
if (classof$2(body) === URL_SEARCH_PARAMS) {
|
|
@@ -4548,7 +4548,7 @@
|
|
|
4548
4548
|
return call$3.apply(apply$2, arguments);
|
|
4549
4549
|
});
|
|
4550
4550
|
|
|
4551
|
-
var isObject$
|
|
4551
|
+
var isObject$3 = isObject$c;
|
|
4552
4552
|
var classof$1 = classofRaw$1;
|
|
4553
4553
|
var wellKnownSymbol$5 = wellKnownSymbol$m;
|
|
4554
4554
|
|
|
@@ -4558,7 +4558,7 @@
|
|
|
4558
4558
|
// https://tc39.es/ecma262/#sec-isregexp
|
|
4559
4559
|
var isRegexp = function (it) {
|
|
4560
4560
|
var isRegExp;
|
|
4561
|
-
return isObject$
|
|
4561
|
+
return isObject$3(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp');
|
|
4562
4562
|
};
|
|
4563
4563
|
|
|
4564
4564
|
var global$f = global$T;
|
|
@@ -4983,7 +4983,7 @@
|
|
|
4983
4983
|
});
|
|
4984
4984
|
|
|
4985
4985
|
var isCallable$2 = isCallable$k;
|
|
4986
|
-
var isObject$
|
|
4986
|
+
var isObject$2 = isObject$c;
|
|
4987
4987
|
var setPrototypeOf$1 = objectSetPrototypeOf;
|
|
4988
4988
|
|
|
4989
4989
|
// makes subclassing work correct for wrapped built-ins
|
|
@@ -4995,7 +4995,7 @@
|
|
|
4995
4995
|
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
|
4996
4996
|
isCallable$2(NewTarget = dummy.constructor) &&
|
|
4997
4997
|
NewTarget !== Wrapper &&
|
|
4998
|
-
isObject$
|
|
4998
|
+
isObject$2(NewTargetPrototype = NewTarget.prototype) &&
|
|
4999
4999
|
NewTargetPrototype !== Wrapper.prototype
|
|
5000
5000
|
) setPrototypeOf$1($this, NewTargetPrototype);
|
|
5001
5001
|
return $this;
|
|
@@ -17083,40 +17083,6 @@
|
|
|
17083
17083
|
return getBounds(markersFlatted);
|
|
17084
17084
|
});
|
|
17085
17085
|
|
|
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
17086
|
var LIBRARIES = ['geometry', 'drawing', 'places'];
|
|
17121
17087
|
var DEFAULT_CENTER = {
|
|
17122
17088
|
lat: 0,
|
|
@@ -17295,15 +17261,6 @@
|
|
|
17295
17261
|
});
|
|
17296
17262
|
});
|
|
17297
17263
|
|
|
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
17264
|
var global$7 = global$T;
|
|
17308
17265
|
|
|
17309
17266
|
var nativePromiseConstructor = global$7.Promise;
|
|
@@ -17636,7 +17593,7 @@
|
|
|
17636
17593
|
};
|
|
17637
17594
|
|
|
17638
17595
|
var anObject = anObject$h;
|
|
17639
|
-
var isObject$1 = isObject$
|
|
17596
|
+
var isObject$1 = isObject$c;
|
|
17640
17597
|
var newPromiseCapability$1 = newPromiseCapability$2;
|
|
17641
17598
|
|
|
17642
17599
|
var promiseResolve$1 = function (C, x) {
|
|
@@ -17703,7 +17660,7 @@
|
|
|
17703
17660
|
var setSpecies = setSpecies$1;
|
|
17704
17661
|
var aCallable = aCallable$7;
|
|
17705
17662
|
var isCallable = isCallable$k;
|
|
17706
|
-
var isObject = isObject$
|
|
17663
|
+
var isObject = isObject$c;
|
|
17707
17664
|
var anInstance = anInstance$3;
|
|
17708
17665
|
var inspectSource = inspectSource$4;
|
|
17709
17666
|
var iterate = iterate$1;
|
|
@@ -35423,28 +35380,6 @@
|
|
|
35423
35380
|
}, _objectSpread2({}, parsedData));
|
|
35424
35381
|
});
|
|
35425
35382
|
|
|
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
35383
|
var styled = {
|
|
35449
35384
|
LoadingElement: styled__default["default"].div.withConfig({
|
|
35450
35385
|
displayName: "styles__LoadingElement",
|
|
@@ -35512,8 +35447,7 @@
|
|
|
35512
35447
|
};
|
|
35513
35448
|
|
|
35514
35449
|
var _excluded = ["googleMapsApiKey", "width", "height", "center", "zoom", "markers", "markerOptions", "options", "callbackOnSuccessDirections", "callbackOnErrorDirections"];
|
|
35515
|
-
|
|
35516
|
-
var Map$1 = function Map(_ref) {
|
|
35450
|
+
var Map$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35517
35451
|
var _mapRef$current;
|
|
35518
35452
|
|
|
35519
35453
|
var _ref$googleMapsApiKey = _ref.googleMapsApiKey,
|
|
@@ -35522,8 +35456,7 @@
|
|
|
35522
35456
|
width = _ref$width === void 0 ? '800px' : _ref$width,
|
|
35523
35457
|
_ref$height = _ref.height,
|
|
35524
35458
|
height = _ref$height === void 0 ? '400px' : _ref$height,
|
|
35525
|
-
|
|
35526
|
-
center = _ref$center === void 0 ? DEFAULT_CENTER : _ref$center,
|
|
35459
|
+
center = _ref.center,
|
|
35527
35460
|
_ref$zoom = _ref.zoom,
|
|
35528
35461
|
zoom = _ref$zoom === void 0 ? 13 : _ref$zoom,
|
|
35529
35462
|
_ref$markers = _ref.markers,
|
|
@@ -35566,7 +35499,7 @@
|
|
|
35566
35499
|
mapRef.current.panTo(newCenter);
|
|
35567
35500
|
};
|
|
35568
35501
|
|
|
35569
|
-
var onLoad =
|
|
35502
|
+
var onLoad = function onLoad(map) {
|
|
35570
35503
|
if (!map) return;
|
|
35571
35504
|
mapRef.current = map;
|
|
35572
35505
|
mapRef.current.setOptions({
|
|
@@ -35575,10 +35508,22 @@
|
|
|
35575
35508
|
var fullScreenPos = mapOptions.showSearchBar ? 'RIGHT_BOTTOM' : 'RIGHT_TOP';
|
|
35576
35509
|
handlePositions('fullScreen', window.google.maps.ControlPosition[fullScreenPos]);
|
|
35577
35510
|
handlePositions('zoom', window.google.maps.ControlPosition.RIGHT_BOTTOM);
|
|
35578
|
-
if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
|
|
35511
|
+
if (!(markers !== null && markers !== void 0 && markers.length)) mapRef.current.setCenter(center || DEFAULT_CENTER);
|
|
35512
|
+
mapRef.current.setZoom(!center ? 2 : zoom);
|
|
35513
|
+
};
|
|
35514
|
+
|
|
35515
|
+
React.useImperativeHandle(ref, function () {
|
|
35516
|
+
return {
|
|
35517
|
+
setZoom: function setZoom(zoom) {
|
|
35518
|
+
return mapRef.current.setZoom(zoom);
|
|
35519
|
+
}
|
|
35520
|
+
};
|
|
35521
|
+
});
|
|
35522
|
+
React.useEffect(function () {
|
|
35523
|
+
if (mapRef.current && markers !== null && markers !== void 0 && markers.length) {
|
|
35524
|
+
mapRef.current.fitBounds(getBoundsFromMarkers(markers));
|
|
35525
|
+
}
|
|
35526
|
+
}, [mapRef.current, markers]);
|
|
35582
35527
|
if (!isLoaded) return null;
|
|
35583
35528
|
return /*#__PURE__*/React__default["default"].createElement(GoogleMap, _extends$1({
|
|
35584
35529
|
className: "google-map-component",
|
|
@@ -35588,7 +35533,7 @@
|
|
|
35588
35533
|
width: width
|
|
35589
35534
|
},
|
|
35590
35535
|
options: mapOptions,
|
|
35591
|
-
center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.
|
|
35536
|
+
center: (_mapRef$current = mapRef.current) === null || _mapRef$current === void 0 ? void 0 : _mapRef$current.getCenter()
|
|
35592
35537
|
}, props), mapOptions.showSearchBar && /*#__PURE__*/React__default["default"].createElement(SearchBox, {
|
|
35593
35538
|
updateMarker: updateMarker,
|
|
35594
35539
|
className: "google-map-component__search-box"
|
|
@@ -35600,7 +35545,8 @@
|
|
|
35600
35545
|
callbackOnErrorDirections: callbackOnErrorDirections,
|
|
35601
35546
|
googleMapsApiKey: googleMapsApiKey
|
|
35602
35547
|
}));
|
|
35603
|
-
};
|
|
35548
|
+
});
|
|
35549
|
+
Map$1.displayName = 'Map';
|
|
35604
35550
|
|
|
35605
35551
|
var rotate = styled$g.keyframes(["to{transform:rotate(360deg);}"]);
|
|
35606
35552
|
var Spinner$1 = styled__default["default"].div.withConfig({
|